aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/main.yml9
-rw-r--r--.gitignore3
-rw-r--r--.gitlab-ci.yml6
-rw-r--r--Documentation/.gitignore2
-rw-r--r--Documentation/CodingGuidelines22
-rw-r--r--Documentation/Makefile53
-rw-r--r--Documentation/RelNotes/2.48.0.txt120
-rw-r--r--Documentation/asciidoc.conf.in (renamed from Documentation/asciidoc.conf)3
-rw-r--r--Documentation/asciidoctor-extensions.rb.in (renamed from Documentation/asciidoctor-extensions.rb)8
-rwxr-xr-xDocumentation/build-docdep.perl2
-rwxr-xr-xDocumentation/cmd-list.perl23
-rw-r--r--Documentation/config/diff.txt206
-rw-r--r--Documentation/config/extensions.txt6
-rw-r--r--Documentation/config/merge.txt2
-rw-r--r--Documentation/config/remote.txt13
-rw-r--r--Documentation/config/worktree.txt10
-rw-r--r--Documentation/diff-format.txt42
-rw-r--r--Documentation/diff-generate-patch.txt44
-rw-r--r--Documentation/diff-options.txt423
-rw-r--r--Documentation/fsck-msgids.txt35
-rwxr-xr-xDocumentation/generate-mergetool-list.sh17
-rw-r--r--Documentation/git-bundle.txt2
-rw-r--r--Documentation/git-clone.txt9
-rw-r--r--Documentation/git-diff.txt122
-rw-r--r--Documentation/git-update-ref.txt8
-rw-r--r--Documentation/git-worktree.txt8
-rw-r--r--Documentation/git.txt32
-rw-r--r--Documentation/gitcli.txt9
-rw-r--r--Documentation/gitcredentials.txt6
-rw-r--r--Documentation/meson.build324
-rw-r--r--Documentation/rev-list-options.txt3
-rw-r--r--Documentation/technical/build-systems.txt224
-rw-r--r--GIT-BUILD-OPTIONS.in47
-rw-r--r--GIT-VERSION-FILE.in1
-rwxr-xr-xGIT-VERSION-GEN76
-rw-r--r--INSTALL13
-rw-r--r--Makefile253
-rw-r--r--advice.c3
-rw-r--r--advice.h1
-rw-r--r--attr.c40
-rw-r--r--attr.h43
-rw-r--r--bin-wrappers/.gitignore9
-rw-r--r--bin-wrappers/meson.build28
-rwxr-xr-xbin-wrappers/wrap-for-bin.sh37
-rw-r--r--bisect.c54
-rw-r--r--bisect.h2
-rw-r--r--blame.c1
-rw-r--r--blame.h2
-rw-r--r--branch.c4
-rw-r--r--builtin/bisect.c32
-rw-r--r--builtin/blame.c12
-rw-r--r--builtin/branch.c43
-rw-r--r--builtin/bundle.c18
-rw-r--r--builtin/cat-file.c7
-rw-r--r--builtin/check-ref-format.c2
-rw-r--r--builtin/checkout.c2
-rw-r--r--builtin/clone.c5
-rw-r--r--builtin/commit-graph.c10
-rw-r--r--builtin/config.c25
-rw-r--r--builtin/count-objects.c2
-rw-r--r--builtin/describe.c16
-rw-r--r--builtin/diff.c1
-rw-r--r--builtin/fast-import.c25
-rw-r--r--builtin/fetch.c145
-rw-r--r--builtin/fsck.c20
-rw-r--r--builtin/gc.c44
-rw-r--r--builtin/help.c13
-rw-r--r--builtin/hook.c7
-rw-r--r--builtin/index-pack.c125
-rw-r--r--builtin/init-db.c34
-rw-r--r--builtin/log.c8
-rw-r--r--builtin/merge.c2
-rw-r--r--builtin/multi-pack-index.c20
-rw-r--r--builtin/notes.c36
-rw-r--r--builtin/pack-objects.c11
-rw-r--r--builtin/pack-redundant.c2
-rw-r--r--builtin/receive-pack.c4
-rw-r--r--builtin/reflog.c17
-rw-r--r--builtin/refs.c20
-rw-r--r--builtin/remote.c116
-rw-r--r--builtin/repack.c4
-rw-r--r--builtin/replace.c2
-rw-r--r--builtin/rev-list.c2
-rw-r--r--builtin/sparse-checkout.c86
-rw-r--r--builtin/stash.c39
-rw-r--r--builtin/submodule--helper.c46
-rw-r--r--builtin/tag.c15
-rw-r--r--builtin/update-ref.c4
-rw-r--r--builtin/upload-pack.c5
-rw-r--r--builtin/worktree.c65
-rw-r--r--bundle-uri.c7
-rw-r--r--bundle.c43
-rw-r--r--bundle.h17
-rwxr-xr-xci/install-dependencies.sh19
-rwxr-xr-xci/lib.sh12
-rwxr-xr-xci/run-build-and-minimal-fuzzers.sh13
-rwxr-xr-xci/test-documentation.sh2
-rw-r--r--commit-graph.c4
-rw-r--r--commit.c2
-rw-r--r--config.c22
-rw-r--r--configure.ac2
-rw-r--r--connected.c3
-rw-r--r--contrib/buildsystems/CMakeLists.txt302
-rw-r--r--contrib/buildsystems/git-version.in1
-rw-r--r--contrib/completion/git-completion.bash2
-rw-r--r--contrib/completion/meson.build16
-rw-r--r--contrib/diff-highlight/DiffHighlight.pm2
-rw-r--r--contrib/meson.build1
-rw-r--r--contrib/mw-to-git/Git/Mediawiki.pm2
-rw-r--r--daemon.c6
-rw-r--r--diff.c3
-rw-r--r--environment.c3
-rw-r--r--environment.h1
-rw-r--r--fetch-pack.c26
-rw-r--r--fetch-pack.h11
-rw-r--r--fsck.c2
-rw-r--r--fsck.h6
-rwxr-xr-xgenerate-cmdlist.sh42
-rwxr-xr-xgenerate-configlist.sh20
-rwxr-xr-xgenerate-hooklist.sh15
-rwxr-xr-xgenerate-perl.sh37
-rwxr-xr-xgenerate-python.sh20
-rwxr-xr-xgenerate-script.sh34
-rwxr-xr-xgit-archimport.perl2
-rw-r--r--git-compat-util.h20
-rw-r--r--git-curl-compat.h98
-rwxr-xr-xgit-cvsexportcommit.perl2
-rwxr-xr-xgit-cvsimport.perl2
-rwxr-xr-xgit-cvsserver.perl4
-rwxr-xr-xgit-difftool--helper.sh8
-rwxr-xr-xgit-instaweb.sh8
-rw-r--r--git-mergetool--lib.sh12
-rwxr-xr-xgit-request-pull.sh2
-rwxr-xr-xgit-send-email.perl4
-rw-r--r--git-sh-i18n.sh6
-rw-r--r--git-sh-setup.sh6
-rwxr-xr-xgit-svn.perl4
-rw-r--r--git.c124
-rw-r--r--git.rc.in (renamed from git.rc)6
-rwxr-xr-xgitk-git/gitk86
-rw-r--r--gitk-git/po/sv.po734
-rw-r--r--gitweb/GITWEB-BUILD-OPTIONS.in24
-rw-r--r--gitweb/Makefile62
-rwxr-xr-xgitweb/generate-gitweb-cgi.sh47
-rwxr-xr-xgitweb/generate-gitweb-js.sh12
-rwxr-xr-xgitweb/gitweb.perl52
-rw-r--r--gitweb/meson.build89
-rw-r--r--help.c58
-rw-r--r--help.h2
-rw-r--r--hook.c2
-rw-r--r--http.c62
-rw-r--r--imap-send.c4
-rw-r--r--line-log.c1
-rw-r--r--list-objects.c7
-rw-r--r--meson.build1901
-rw-r--r--meson_options.txt81
-rw-r--r--midx-write.c130
-rw-r--r--midx.c89
-rw-r--r--midx.h27
-rw-r--r--object-name.c42
-rw-r--r--object-store-ll.h9
-rw-r--r--oss-fuzz/.gitignore3
-rw-r--r--oss-fuzz/fuzz-credential-from-url-gently.c32
-rw-r--r--oss-fuzz/fuzz-parse-attr-line.c39
-rw-r--r--oss-fuzz/fuzz-url-decode-mem.c43
-rw-r--r--pack-bitmap.c98
-rw-r--r--pack-objects.h3
-rw-r--r--pack-revindex.c2
-rw-r--r--pack-write.c1
-rw-r--r--pack.h2
-rw-r--r--packfile.c144
-rw-r--r--packfile.h18
-rw-r--r--parse-options.h4
-rw-r--r--path.c10
-rw-r--r--path.h17
-rw-r--r--perl/FromCPAN/Mail/meson.build7
-rw-r--r--perl/FromCPAN/meson.build9
-rw-r--r--perl/Git.pm2
-rw-r--r--perl/Git/I18N.pm8
-rw-r--r--perl/Git/LoadCPAN.pm8
-rw-r--r--perl/Git/LoadCPAN/Mail/meson.build7
-rw-r--r--perl/Git/LoadCPAN/meson.build9
-rw-r--r--perl/Git/Packet.pm2
-rw-r--r--perl/Git/SVN/Memoize/meson.build7
-rw-r--r--perl/Git/SVN/meson.build20
-rw-r--r--perl/Git/meson.build18
-rw-r--r--perl/header_templates/fixed_prefix.template.pl2
-rw-r--r--perl/header_templates/runtime_prefix.template.pl8
-rw-r--r--perl/meson.build12
-rw-r--r--po/meson.build27
-rw-r--r--promisor-remote.c2
-rw-r--r--prune-packed.c2
-rw-r--r--reachable.c4
-rw-r--r--refs.c171
-rw-r--r--refs.h96
-rw-r--r--refs/debug.c18
-rw-r--r--refs/files-backend.c469
-rw-r--r--refs/packed-backend.c16
-rw-r--r--refs/ref-cache.c3
-rw-r--r--refs/refs-internal.h12
-rw-r--r--refs/reftable-backend.c455
-rw-r--r--reftable/basics.c20
-rw-r--r--reftable/basics.h10
-rw-r--r--reftable/block.c33
-rw-r--r--reftable/block.h10
-rw-r--r--reftable/merged.c18
-rw-r--r--reftable/merged.h3
-rw-r--r--reftable/reader.c14
-rw-r--r--reftable/reader.h4
-rw-r--r--reftable/reftable-basics.h13
-rw-r--r--reftable/reftable-merged.h4
-rw-r--r--reftable/reftable-reader.h2
-rw-r--r--reftable/reftable-record.h12
-rw-r--r--reftable/reftable-stack.h3
-rw-r--r--reftable/reftable-writer.h17
-rw-r--r--reftable/stack.c207
-rw-r--r--reftable/system.c126
-rw-r--r--reftable/system.h89
-rw-r--r--reftable/writer.c43
-rw-r--r--reftable/writer.h2
-rw-r--r--remote.c18
-rw-r--r--remote.h10
-rw-r--r--repo-settings.c18
-rw-r--r--repo-settings.h7
-rw-r--r--repository.c1
-rw-r--r--repository.h1
-rw-r--r--revision.c17
-rw-r--r--sequencer.c32
-rw-r--r--setup.c39
-rw-r--r--setup.h1
-rw-r--r--split-index.c6
-rw-r--r--strbuf.h22
-rw-r--r--strvec.c22
-rw-r--r--strvec.h9
-rw-r--r--subprojects/.gitignore1
-rw-r--r--subprojects/curl.wrap13
-rw-r--r--subprojects/expat.wrap13
-rw-r--r--subprojects/openssl.wrap15
-rw-r--r--subprojects/pcre2.wrap16
-rw-r--r--subprojects/zlib.wrap13
-rw-r--r--t/README21
-rw-r--r--t/helper/meson.build91
-rw-r--r--t/helper/test-parse-options.c8
-rw-r--r--t/helper/test-read-graph.c3
-rw-r--r--t/helper/test-read-midx.c8
-rw-r--r--t/helper/test-ref-store.c2
-rw-r--r--t/helper/test-reftable.c4
-rw-r--r--t/lib-gettext.sh4
-rw-r--r--t/lib-git-svn.sh4
-rw-r--r--t/meson.build1114
-rwxr-xr-xt/perf/p5311-pack-bitmaps-fetch.sh2
-rwxr-xr-xt/perf/p5332-multi-pack-reuse.sh2
-rwxr-xr-xt/perf/p6100-describe.sh30
-rwxr-xr-xt/t0001-init.sh23
-rwxr-xr-xt/t0002-gitfile.sh1
-rwxr-xr-xt/t0003-attributes.sh1
-rwxr-xr-xt/t0004-unwritable.sh1
-rwxr-xr-xt/t0005-signals.sh1
-rwxr-xr-xt/t0006-date.sh1
-rwxr-xr-xt/t0007-git-var.sh1
-rwxr-xr-xt/t0008-ignores.sh1
-rwxr-xr-xt/t0010-racy-git.sh1
-rwxr-xr-xt/t0012-help.sh1
-rwxr-xr-xt/t0013-sha1dc.sh1
-rwxr-xr-xt/t0017-env-helper.sh1
-rwxr-xr-xt/t0018-advice.sh3
-rwxr-xr-xt/t0019-json-writer.sh1
-rwxr-xr-xt/t0020-crlf.sh1
-rwxr-xr-xt/t0021-conversion.sh1
-rwxr-xr-xt/t0022-crlf-rename.sh1
-rwxr-xr-xt/t0023-crlf-am.sh1
-rwxr-xr-xt/t0024-crlf-archive.sh1
-rwxr-xr-xt/t0025-crlf-renormalize.sh1
-rwxr-xr-xt/t0026-eol-config.sh1
-rwxr-xr-xt/t0027-auto-crlf.sh1
-rwxr-xr-xt/t0028-working-tree-encoding.sh1
-rwxr-xr-xt/t0029-core-unsetenvvars.sh1
-rwxr-xr-xt/t0030-stripspace.sh1
-rwxr-xr-xt/t0033-safe-directory.sh1
-rwxr-xr-xt/t0035-safe-bare-repository.sh1
-rwxr-xr-xt/t0040-parse-options.sh1
-rwxr-xr-xt/t0041-usage.sh1
-rwxr-xr-xt/t0050-filesystem.sh1
-rwxr-xr-xt/t0052-simple-ipc.sh1
-rwxr-xr-xt/t0055-beyond-symlinks.sh1
-rwxr-xr-xt/t0056-git-C.sh1
-rwxr-xr-xt/t0060-path-utils.sh1
-rwxr-xr-xt/t0061-run-command.sh1
-rwxr-xr-xt/t0062-revision-walking.sh1
-rwxr-xr-xt/t0063-string-list.sh1
-rwxr-xr-xt/t0066-dir-iterator.sh1
-rwxr-xr-xt/t0067-parse_pathspec_file.sh1
-rwxr-xr-xt/t0068-for-each-repo.sh1
-rwxr-xr-xt/t0070-fundamental.sh1
-rwxr-xr-xt/t0071-sort.sh1
-rwxr-xr-xt/t0080-unit-test-output.sh1
-rwxr-xr-xt/t0081-find-pack.sh1
-rwxr-xr-xt/t0090-cache-tree.sh1
-rwxr-xr-xt/t0091-bugreport.sh1
-rwxr-xr-xt/t0092-diagnose.sh1
-rwxr-xr-xt/t0095-bloom.sh3
-rwxr-xr-xt/t0100-previous.sh1
-rwxr-xr-xt/t0101-at-syntax.sh1
-rwxr-xr-xt/t0200-gettext-basic.sh1
-rwxr-xr-xt/t0201-gettext-fallbacks.sh1
-rwxr-xr-xt/t0202-gettext-perl.sh1
-rwxr-xr-xt/t0202/test.pl2
-rwxr-xr-xt/t0203-gettext-setlocale-sanity.sh1
-rwxr-xr-xt/t0204-gettext-reencode-sanity.sh1
-rwxr-xr-xt/t0210-trace2-normal.sh1
-rwxr-xr-xt/t0211-trace2-perf.sh1
-rwxr-xr-xt/t0212-trace2-event.sh1
-rwxr-xr-xt/t0300-credentials.sh1
-rwxr-xr-xt/t0301-credential-cache.sh1
-rwxr-xr-xt/t0302-credential-store.sh1
-rwxr-xr-xt/t0303-credential-external.sh1
-rwxr-xr-xt/t0410-partial-clone.sh1
-rwxr-xr-xt/t0411-clone-from-partial.sh4
-rwxr-xr-xt/t0450-txt-doc-vs-help.sh1
-rwxr-xr-xt/t0500-progress-display.sh1
-rwxr-xr-xt/t0600-reffiles-backend.sh1
-rwxr-xr-xt/t0601-reffiles-pack-refs.sh1
-rwxr-xr-xt/t0602-reffiles-fsck.sh577
-rwxr-xr-xt/t0610-reftable-basics.sh1
-rwxr-xr-xt/t0611-reftable-httpd.sh1
-rwxr-xr-xt/t0612-reftable-jgit-compatibility.sh1
-rwxr-xr-xt/t0613-reftable-write-options.sh1
-rwxr-xr-xt/t1000-read-tree-m-3way.sh1
-rwxr-xr-xt/t1001-read-tree-m-2way.sh1
-rwxr-xr-xt/t1002-read-tree-m-u-2way.sh1
-rwxr-xr-xt/t1003-read-tree-prefix.sh1
-rwxr-xr-xt/t1004-read-tree-m-u-wf.sh1
-rwxr-xr-xt/t1005-read-tree-reset.sh1
-rwxr-xr-xt/t1006-cat-file.sh1
-rwxr-xr-xt/t1007-hash-object.sh1
-rwxr-xr-xt/t1008-read-tree-overlay.sh1
-rwxr-xr-xt/t1009-read-tree-new-index.sh1
-rwxr-xr-xt/t1010-mktree.sh1
-rwxr-xr-xt/t1011-read-tree-sparse-checkout.sh1
-rwxr-xr-xt/t1012-read-tree-df.sh1
-rwxr-xr-xt/t1013-read-tree-submodule.sh1
-rwxr-xr-xt/t1014-read-tree-confusing.sh1
-rwxr-xr-xt/t1015-read-index-unmerged.sh1
-rwxr-xr-xt/t1016-compatObjectFormat.sh1
-rwxr-xr-xt/t1020-subdirectory.sh1
-rwxr-xr-xt/t1021-rerere-in-workdir.sh1
-rwxr-xr-xt/t1022-read-tree-partial-clone.sh1
-rwxr-xr-xt/t1050-large.sh1
-rwxr-xr-xt/t1051-large-conversion.sh1
-rwxr-xr-xt/t1060-object-corruption.sh1
-rwxr-xr-xt/t1090-sparse-checkout-scope.sh1
-rwxr-xr-xt/t1091-sparse-checkout-builtin.sh1
-rwxr-xr-xt/t1092-sparse-checkout-compatibility.sh1
-rwxr-xr-xt/t1100-commit-tree-options.sh1
-rwxr-xr-xt/t1300-config.sh1
-rwxr-xr-xt/t1301-shared-repo.sh1
-rwxr-xr-xt/t1302-repo-version.sh1
-rwxr-xr-xt/t1303-wacky-config.sh1
-rwxr-xr-xt/t1304-default-acl.sh1
-rwxr-xr-xt/t1305-config-include.sh1
-rwxr-xr-xt/t1306-xdg-files.sh1
-rwxr-xr-xt/t1307-config-blob.sh1
-rwxr-xr-xt/t1308-config-set.sh1
-rwxr-xr-xt/t1309-early-config.sh1
-rwxr-xr-xt/t1310-config-default.sh1
-rwxr-xr-xt/t1350-config-hooks-path.sh1
-rwxr-xr-xt/t1400-update-ref.sh1
-rwxr-xr-xt/t1401-symbolic-ref.sh1
-rwxr-xr-xt/t1402-check-ref-format.sh1
-rwxr-xr-xt/t1403-show-ref.sh1
-rwxr-xr-xt/t1404-update-ref-errors.sh1
-rwxr-xr-xt/t1405-main-ref-store.sh1
-rwxr-xr-xt/t1406-submodule-ref-store.sh1
-rwxr-xr-xt/t1407-worktree-ref-store.sh1
-rwxr-xr-xt/t1408-packed-refs.sh1
-rwxr-xr-xt/t1409-avoid-packing-refs.sh1
-rwxr-xr-xt/t1410-reflog.sh1
-rwxr-xr-xt/t1411-reflog-show.sh1
-rwxr-xr-xt/t1412-reflog-loop.sh1
-rwxr-xr-xt/t1413-reflog-detach.sh1
-rwxr-xr-xt/t1414-reflog-walk.sh1
-rwxr-xr-xt/t1415-worktree-refs.sh1
-rwxr-xr-xt/t1416-ref-transaction-hooks.sh1
-rwxr-xr-xt/t1417-reflog-updateref.sh1
-rwxr-xr-xt/t1418-reflog-exists.sh1
-rwxr-xr-xt/t1419-exclude-refs.sh1
-rwxr-xr-xt/t1420-lost-found.sh1
-rwxr-xr-xt/t1430-bad-ref-name.sh1
-rwxr-xr-xt/t1450-fsck.sh1
-rwxr-xr-xt/t1451-fsck-buffer.sh1
-rwxr-xr-xt/t1460-refs-migrate.sh3
-rwxr-xr-xt/t1500-rev-parse.sh16
-rwxr-xr-xt/t1501-work-tree.sh1
-rwxr-xr-xt/t1502-rev-parse-parseopt.sh1
-rwxr-xr-xt/t1503-rev-parse-verify.sh1
-rwxr-xr-xt/t1504-ceiling-dirs.sh1
-rwxr-xr-xt/t1505-rev-parse-last.sh1
-rwxr-xr-xt/t1506-rev-parse-diagnosis.sh1
-rwxr-xr-xt/t1507-rev-parse-upstream.sh1
-rwxr-xr-xt/t1508-at-combinations.sh1
-rwxr-xr-xt/t1510-repo-setup.sh1
-rwxr-xr-xt/t1511-rev-parse-caret.sh1
-rwxr-xr-xt/t1512-rev-parse-disambiguation.sh1
-rwxr-xr-xt/t1513-rev-parse-prefix.sh1
-rwxr-xr-xt/t1514-rev-parse-push.sh1
-rwxr-xr-xt/t1515-rev-parse-outside-repo.sh1
-rwxr-xr-xt/t1517-outside-repo.sh1
-rwxr-xr-xt/t1600-index.sh1
-rwxr-xr-xt/t1601-index-bogus.sh1
-rwxr-xr-xt/t1701-racy-split-index.sh1
-rwxr-xr-xt/t1800-hook.sh1
-rwxr-xr-xt/t2000-conflict-when-checking-files-out.sh1
-rwxr-xr-xt/t2002-checkout-cache-u.sh1
-rwxr-xr-xt/t2003-checkout-cache-mkdir.sh1
-rwxr-xr-xt/t2004-checkout-cache-temp.sh1
-rwxr-xr-xt/t2005-checkout-index-symlinks.sh1
-rwxr-xr-xt/t2006-checkout-index-basic.sh1
-rwxr-xr-xt/t2007-checkout-symlink.sh1
-rwxr-xr-xt/t2008-checkout-subdir.sh1
-rwxr-xr-xt/t2009-checkout-statinfo.sh1
-rwxr-xr-xt/t2010-checkout-ambiguous.sh1
-rwxr-xr-xt/t2011-checkout-invalid-head.sh1
-rwxr-xr-xt/t2012-checkout-last.sh1
-rwxr-xr-xt/t2013-checkout-submodule.sh1
-rwxr-xr-xt/t2014-checkout-switch.sh1
-rwxr-xr-xt/t2015-checkout-unborn.sh1
-rwxr-xr-xt/t2016-checkout-patch.sh1
-rwxr-xr-xt/t2017-checkout-orphan.sh1
-rwxr-xr-xt/t2018-checkout-branch.sh1
-rwxr-xr-xt/t2019-checkout-ambiguous-ref.sh1
-rwxr-xr-xt/t2020-checkout-detach.sh1
-rwxr-xr-xt/t2021-checkout-overwrite.sh1
-rwxr-xr-xt/t2022-checkout-paths.sh1
-rwxr-xr-xt/t2023-checkout-m.sh1
-rwxr-xr-xt/t2024-checkout-dwim.sh1
-rwxr-xr-xt/t2025-checkout-no-overlay.sh1
-rwxr-xr-xt/t2026-checkout-pathspec-file.sh1
-rwxr-xr-xt/t2027-checkout-track.sh1
-rwxr-xr-xt/t2030-unresolve-info.sh1
-rwxr-xr-xt/t2050-git-dir-relative.sh1
-rwxr-xr-xt/t2060-switch.sh1
-rwxr-xr-xt/t2070-restore.sh1
-rwxr-xr-xt/t2071-restore-patch.sh1
-rwxr-xr-xt/t2072-restore-pathspec-file.sh1
-rwxr-xr-xt/t2080-parallel-checkout-basics.sh1
-rwxr-xr-xt/t2081-parallel-checkout-collisions.sh1
-rwxr-xr-xt/t2082-parallel-checkout-attributes.sh1
-rwxr-xr-xt/t2100-update-cache-badpath.sh1
-rwxr-xr-xt/t2101-update-index-reupdate.sh1
-rwxr-xr-xt/t2102-update-index-symlinks.sh1
-rwxr-xr-xt/t2103-update-index-ignore-missing.sh1
-rwxr-xr-xt/t2104-update-index-skip-worktree.sh1
-rwxr-xr-xt/t2105-update-index-gitfile.sh1
-rwxr-xr-xt/t2106-update-index-assume-unchanged.sh1
-rwxr-xr-xt/t2107-update-index-basic.sh1
-rwxr-xr-xt/t2108-update-index-refresh-racy.sh1
-rwxr-xr-xt/t2200-add-update.sh1
-rwxr-xr-xt/t2201-add-update-typechange.sh1
-rwxr-xr-xt/t2202-add-addremove.sh1
-rwxr-xr-xt/t2203-add-intent.sh1
-rwxr-xr-xt/t2204-add-ignored.sh1
-rwxr-xr-xt/t2205-add-worktree-config.sh1
-rwxr-xr-xt/t2300-cd-to-toplevel.sh1
-rwxr-xr-xt/t2400-worktree-add.sh47
-rwxr-xr-xt/t2401-worktree-prune.sh4
-rwxr-xr-xt/t2402-worktree-list.sh23
-rwxr-xr-xt/t2403-worktree-move.sh26
-rwxr-xr-xt/t2404-worktree-config.sh1
-rwxr-xr-xt/t2405-worktree-submodule.sh1
-rwxr-xr-xt/t2406-worktree-repair.sh40
-rwxr-xr-xt/t2407-worktree-heads.sh17
-rwxr-xr-xt/t2408-worktree-relative.sh39
-rwxr-xr-xt/t2500-untracked-overwriting.sh1
-rwxr-xr-xt/t2501-cwd-empty.sh1
-rwxr-xr-xt/t3000-ls-files-others.sh1
-rwxr-xr-xt/t3001-ls-files-others-exclude.sh1
-rwxr-xr-xt/t3002-ls-files-dashpath.sh1
-rwxr-xr-xt/t3003-ls-files-exclude.sh1
-rwxr-xr-xt/t3004-ls-files-basic.sh1
-rwxr-xr-xt/t3005-ls-files-relative.sh1
-rwxr-xr-xt/t3006-ls-files-long.sh1
-rwxr-xr-xt/t3007-ls-files-recurse-submodules.sh1
-rwxr-xr-xt/t3008-ls-files-lazy-init-name-hash.sh1
-rwxr-xr-xt/t3009-ls-files-others-nonsubmodule.sh1
-rwxr-xr-xt/t3010-ls-files-killed-modified.sh1
-rwxr-xr-xt/t3011-common-prefixes-and-directory-traversal.sh1
-rwxr-xr-xt/t3012-ls-files-dedup.sh1
-rwxr-xr-xt/t3013-ls-files-format.sh1
-rwxr-xr-xt/t3020-ls-files-error-unmatch.sh1
-rwxr-xr-xt/t3040-subprojects-basic.sh1
-rwxr-xr-xt/t3050-subprojects-fetch.sh1
-rwxr-xr-xt/t3060-ls-files-with-tree.sh1
-rwxr-xr-xt/t3070-wildmatch.sh1
-rwxr-xr-xt/t3100-ls-tree-restrict.sh1
-rwxr-xr-xt/t3101-ls-tree-dirname.sh1
-rwxr-xr-xt/t3102-ls-tree-wildcards.sh1
-rwxr-xr-xt/t3103-ls-tree-misc.sh1
-rwxr-xr-xt/t3104-ls-tree-format.sh1
-rwxr-xr-xt/t3105-ls-tree-output.sh1
-rwxr-xr-xt/t3200-branch.sh3
-rwxr-xr-xt/t3201-branch-contains.sh1
-rwxr-xr-xt/t3202-show-branch.sh1
-rwxr-xr-xt/t3203-branch-output.sh1
-rwxr-xr-xt/t3204-branch-name-interpretation.sh1
-rwxr-xr-xt/t3205-branch-color.sh1
-rwxr-xr-xt/t3206-range-diff.sh1
-rwxr-xr-xt/t3207-branch-submodule.sh1
-rwxr-xr-xt/t3211-peel-ref.sh1
-rwxr-xr-xt/t3300-funny-names.sh1
-rwxr-xr-xt/t3301-notes.sh1
-rwxr-xr-xt/t3302-notes-index-expensive.sh1
-rwxr-xr-xt/t3303-notes-subtrees.sh1
-rwxr-xr-xt/t3304-notes-mixed.sh1
-rwxr-xr-xt/t3305-notes-fanout.sh1
-rwxr-xr-xt/t3306-notes-prune.sh1
-rwxr-xr-xt/t3307-notes-man.sh1
-rwxr-xr-xt/t3308-notes-merge.sh1
-rwxr-xr-xt/t3309-notes-merge-auto-resolve.sh1
-rwxr-xr-xt/t3310-notes-merge-manual-resolve.sh1
-rwxr-xr-xt/t3311-notes-merge-fanout.sh1
-rwxr-xr-xt/t3320-notes-merge-worktrees.sh1
-rwxr-xr-xt/t3321-notes-stripspace.sh1
-rwxr-xr-xt/t3400-rebase.sh20
-rwxr-xr-xt/t3401-rebase-and-am-rename.sh1
-rwxr-xr-xt/t3402-rebase-merge.sh1
-rwxr-xr-xt/t3403-rebase-skip.sh1
-rwxr-xr-xt/t3404-rebase-interactive.sh7
-rwxr-xr-xt/t3405-rebase-malformed.sh1
-rwxr-xr-xt/t3406-rebase-message.sh1
-rwxr-xr-xt/t3407-rebase-abort.sh1
-rwxr-xr-xt/t3408-rebase-multi-line.sh1
-rwxr-xr-xt/t3409-rebase-environ.sh1
-rwxr-xr-xt/t3412-rebase-root.sh1
-rwxr-xr-xt/t3413-rebase-hook.sh1
-rwxr-xr-xt/t3415-rebase-autosquash.sh1
-rwxr-xr-xt/t3416-rebase-onto-threedots.sh1
-rwxr-xr-xt/t3417-rebase-whitespace-fix.sh1
-rwxr-xr-xt/t3418-rebase-continue.sh1
-rwxr-xr-xt/t3419-rebase-patch-id.sh1
-rwxr-xr-xt/t3420-rebase-autostash.sh1
-rwxr-xr-xt/t3421-rebase-topology-linear.sh1
-rwxr-xr-xt/t3422-rebase-incompatible-options.sh1
-rwxr-xr-xt/t3423-rebase-reword.sh1
-rwxr-xr-xt/t3424-rebase-empty.sh1
-rwxr-xr-xt/t3425-rebase-topology-merges.sh1
-rwxr-xr-xt/t3426-rebase-submodule.sh1
-rwxr-xr-xt/t3427-rebase-subtree.sh1
-rwxr-xr-xt/t3428-rebase-signoff.sh1
-rwxr-xr-xt/t3429-rebase-edit-todo.sh1
-rwxr-xr-xt/t3430-rebase-merges.sh1
-rwxr-xr-xt/t3431-rebase-fork-point.sh1
-rwxr-xr-xt/t3432-rebase-fast-forward.sh1
-rwxr-xr-xt/t3433-rebase-across-mode-change.sh1
-rwxr-xr-xt/t3434-rebase-i18n.sh1
-rwxr-xr-xt/t3435-rebase-gpg-sign.sh1
-rwxr-xr-xt/t3436-rebase-more-options.sh1
-rwxr-xr-xt/t3437-rebase-fixup-options.sh16
-rwxr-xr-xt/t3438-rebase-broken-files.sh1
-rwxr-xr-xt/t3500-cherry.sh1
-rwxr-xr-xt/t3501-revert-cherry-pick.sh17
-rwxr-xr-xt/t3502-cherry-pick-merge.sh1
-rwxr-xr-xt/t3503-cherry-pick-root.sh1
-rwxr-xr-xt/t3504-cherry-pick-rerere.sh1
-rwxr-xr-xt/t3505-cherry-pick-empty.sh1
-rwxr-xr-xt/t3506-cherry-pick-ff.sh1
-rwxr-xr-xt/t3507-cherry-pick-conflict.sh7
-rwxr-xr-xt/t3508-cherry-pick-many-commits.sh1
-rwxr-xr-xt/t3509-cherry-pick-merge-df.sh1
-rwxr-xr-xt/t3510-cherry-pick-sequence.sh3
-rwxr-xr-xt/t3511-cherry-pick-x.sh3
-rwxr-xr-xt/t3512-cherry-pick-submodule.sh1
-rwxr-xr-xt/t3513-revert-submodule.sh1
-rwxr-xr-xt/t3514-cherry-pick-revert-gpg.sh1
-rwxr-xr-xt/t3600-rm.sh1
-rwxr-xr-xt/t3601-rm-pathspec-file.sh1
-rwxr-xr-xt/t3602-rm-sparse-checkout.sh3
-rwxr-xr-xt/t3650-replay-basics.sh1
-rwxr-xr-xt/t3700-add.sh7
-rwxr-xr-xt/t3701-add-interactive.sh1
-rwxr-xr-xt/t3702-add-edit.sh1
-rwxr-xr-xt/t3703-add-magic-pathspec.sh1
-rwxr-xr-xt/t3704-add-pathspec-file.sh1
-rwxr-xr-xt/t3705-add-sparse-checkout.sh3
-rwxr-xr-xt/t3800-mktag.sh1
-rwxr-xr-xt/t3900-i18n-commit.sh1
-rwxr-xr-xt/t3901-i18n-patch.sh1
-rwxr-xr-xt/t3902-quoted.sh1
-rwxr-xr-xt/t3903-stash.sh1
-rwxr-xr-xt/t3904-stash-patch.sh1
-rwxr-xr-xt/t3905-stash-include-untracked.sh1
-rwxr-xr-xt/t3906-stash-submodule.sh1
-rwxr-xr-xt/t3907-stash-show-config.sh1
-rwxr-xr-xt/t3908-stash-in-worktree.sh1
-rwxr-xr-xt/t3909-stash-pathspec-file.sh1
-rwxr-xr-xt/t3920-crlf-messages.sh1
-rwxr-xr-xt/t4000-diff-format.sh1
-rwxr-xr-xt/t4001-diff-rename.sh1
-rwxr-xr-xt/t4002-diff-basic.sh1
-rwxr-xr-xt/t4003-diff-rename-1.sh1
-rwxr-xr-xt/t4004-diff-rename-symlink.sh1
-rwxr-xr-xt/t4005-diff-rename-2.sh1
-rwxr-xr-xt/t4006-diff-mode.sh1
-rwxr-xr-xt/t4007-rename-3.sh1
-rwxr-xr-xt/t4008-diff-break-rewrite.sh1
-rwxr-xr-xt/t4009-diff-rename-4.sh1
-rwxr-xr-xt/t4010-diff-pathspec.sh1
-rwxr-xr-xt/t4011-diff-symlink.sh1
-rwxr-xr-xt/t4012-diff-binary.sh1
-rwxr-xr-xt/t4013-diff-various.sh1
-rwxr-xr-xt/t4014-format-patch.sh1
-rwxr-xr-xt/t4015-diff-whitespace.sh1
-rwxr-xr-xt/t4016-diff-quote.sh1
-rwxr-xr-xt/t4017-diff-retval.sh1
-rwxr-xr-xt/t4018-diff-funcname.sh1
-rwxr-xr-xt/t4019-diff-wserror.sh1
-rwxr-xr-xt/t4020-diff-external.sh5
-rwxr-xr-xt/t4021-format-patch-numbered.sh1
-rwxr-xr-xt/t4022-diff-rewrite.sh1
-rwxr-xr-xt/t4023-diff-rename-typechange.sh1
-rwxr-xr-xt/t4024-diff-optimize-common.sh1
-rwxr-xr-xt/t4025-hunk-header.sh1
-rwxr-xr-xt/t4026-color.sh1
-rwxr-xr-xt/t4027-diff-submodule.sh1
-rwxr-xr-xt/t4028-format-patch-mime-headers.sh1
-rwxr-xr-xt/t4029-diff-trailing-space.sh1
-rwxr-xr-xt/t4030-diff-textconv.sh1
-rwxr-xr-xt/t4031-diff-rewrite-binary.sh1
-rwxr-xr-xt/t4032-diff-inter-hunk-context.sh1
-rwxr-xr-xt/t4033-diff-patience.sh1
-rwxr-xr-xt/t4034-diff-words.sh1
-rwxr-xr-xt/t4035-diff-quiet.sh1
-rwxr-xr-xt/t4036-format-patch-signer-mime.sh1
-rwxr-xr-xt/t4037-diff-r-t-dirs.sh1
-rwxr-xr-xt/t4038-diff-combined.sh1
-rwxr-xr-xt/t4039-diff-assume-unchanged.sh1
-rwxr-xr-xt/t4040-whitespace-status.sh1
-rwxr-xr-xt/t4041-diff-submodule-option.sh1
-rwxr-xr-xt/t4042-diff-textconv-caching.sh1
-rwxr-xr-xt/t4043-diff-rename-binary.sh1
-rwxr-xr-xt/t4044-diff-index-unique-abbrev.sh1
-rwxr-xr-xt/t4045-diff-relative.sh1
-rwxr-xr-xt/t4046-diff-unmerged.sh1
-rwxr-xr-xt/t4047-diff-dirstat.sh1
-rwxr-xr-xt/t4048-diff-combined-binary.sh1
-rwxr-xr-xt/t4049-diff-stat-count.sh1
-rwxr-xr-xt/t4050-diff-histogram.sh1
-rwxr-xr-xt/t4051-diff-function-context.sh1
-rwxr-xr-xt/t4052-stat-output.sh1
-rwxr-xr-xt/t4053-diff-no-index.sh1
-rwxr-xr-xt/t4054-diff-bogus-tree.sh1
-rwxr-xr-xt/t4055-diff-context.sh1
-rwxr-xr-xt/t4056-diff-order.sh1
-rwxr-xr-xt/t4057-diff-combined-paths.sh1
-rwxr-xr-xt/t4058-diff-duplicates.sh1
-rwxr-xr-xt/t4059-diff-submodule-not-initialized.sh1
-rwxr-xr-xt/t4060-diff-submodule-option-diff-format.sh1
-rwxr-xr-xt/t4061-diff-indent.sh1
-rwxr-xr-xt/t4062-diff-pickaxe.sh1
-rwxr-xr-xt/t4063-diff-blobs.sh1
-rwxr-xr-xt/t4064-diff-oidfind.sh1
-rwxr-xr-xt/t4065-diff-anchored.sh1
-rwxr-xr-xt/t4066-diff-emit-delay.sh1
-rwxr-xr-xt/t4067-diff-partial-clone.sh1
-rwxr-xr-xt/t4068-diff-symmetric-merge-base.sh1
-rwxr-xr-xt/t4069-remerge-diff.sh8
-rwxr-xr-xt/t4100-apply-stat.sh1
-rwxr-xr-xt/t4101-apply-nonl.sh1
-rwxr-xr-xt/t4102-apply-rename.sh1
-rwxr-xr-xt/t4103-apply-binary.sh1
-rwxr-xr-xt/t4104-apply-boundary.sh1
-rwxr-xr-xt/t4105-apply-fuzz.sh1
-rwxr-xr-xt/t4106-apply-stdin.sh1
-rwxr-xr-xt/t4107-apply-ignore-whitespace.sh1
-rwxr-xr-xt/t4108-apply-threeway.sh1
-rwxr-xr-xt/t4109-apply-multifrag.sh1
-rwxr-xr-xt/t4110-apply-scan.sh1
-rwxr-xr-xt/t4111-apply-subdir.sh1
-rwxr-xr-xt/t4112-apply-renames.sh1
-rwxr-xr-xt/t4113-apply-ending.sh1
-rwxr-xr-xt/t4114-apply-typechange.sh1
-rwxr-xr-xt/t4115-apply-symlink.sh1
-rwxr-xr-xt/t4116-apply-reverse.sh1
-rwxr-xr-xt/t4117-apply-reject.sh1
-rwxr-xr-xt/t4118-apply-empty-context.sh1
-rwxr-xr-xt/t4119-apply-config.sh1
-rwxr-xr-xt/t4120-apply-popt.sh1
-rwxr-xr-xt/t4121-apply-diffs.sh1
-rwxr-xr-xt/t4122-apply-symlink-inside.sh1
-rwxr-xr-xt/t4123-apply-shrink.sh1
-rwxr-xr-xt/t4124-apply-ws-rule.sh1
-rwxr-xr-xt/t4125-apply-ws-fuzz.sh1
-rwxr-xr-xt/t4126-apply-empty.sh1
-rwxr-xr-xt/t4127-apply-same-fn.sh1
-rwxr-xr-xt/t4128-apply-root.sh1
-rwxr-xr-xt/t4129-apply-samemode.sh1
-rwxr-xr-xt/t4130-apply-criss-cross-rename.sh1
-rwxr-xr-xt/t4131-apply-fake-ancestor.sh1
-rwxr-xr-xt/t4132-apply-removal.sh1
-rwxr-xr-xt/t4133-apply-filenames.sh1
-rwxr-xr-xt/t4134-apply-submodule.sh1
-rwxr-xr-xt/t4135-apply-weird-filenames.sh1
-rwxr-xr-xt/t4136-apply-check.sh1
-rwxr-xr-xt/t4137-apply-submodule.sh1
-rwxr-xr-xt/t4138-apply-ws-expansion.sh1
-rwxr-xr-xt/t4139-apply-escape.sh1
-rwxr-xr-xt/t4140-apply-ita.sh1
-rwxr-xr-xt/t4141-apply-too-large.sh1
-rwxr-xr-xt/t4150-am.sh1
-rwxr-xr-xt/t4151-am-abort.sh1
-rwxr-xr-xt/t4152-am-subjects.sh1
-rwxr-xr-xt/t4153-am-resume-override-opts.sh1
-rwxr-xr-xt/t4200-rerere.sh1
-rwxr-xr-xt/t4201-shortlog.sh1
-rwxr-xr-xt/t4202-log.sh1
-rwxr-xr-xt/t4203-mailmap.sh1
-rwxr-xr-xt/t4204-patch-id.sh1
-rwxr-xr-xt/t4205-log-pretty-formats.sh1
-rwxr-xr-xt/t4206-log-follow-harder-copies.sh1
-rwxr-xr-xt/t4207-log-decoration-colors.sh4
-rwxr-xr-xt/t4208-log-magic-pathspec.sh1
-rwxr-xr-xt/t4209-log-pickaxe.sh1
-rwxr-xr-xt/t4210-log-i18n.sh1
-rwxr-xr-xt/t4212-log-corrupt.sh1
-rwxr-xr-xt/t4213-log-tabexpand.sh1
-rwxr-xr-xt/t4214-log-graph-octopus.sh1
-rwxr-xr-xt/t4215-log-skewed-merges.sh1
-rwxr-xr-xt/t4216-log-bloom.sh1
-rwxr-xr-xt/t4217-log-limit.sh1
-rwxr-xr-xt/t4252-am-options.sh1
-rwxr-xr-xt/t4253-am-keep-cr-dos.sh1
-rwxr-xr-xt/t4254-am-corrupt.sh1
-rwxr-xr-xt/t4255-am-submodule.sh1
-rwxr-xr-xt/t4256-am-format-flowed.sh1
-rwxr-xr-xt/t4257-am-interactive.sh1
-rwxr-xr-xt/t4258-am-quoted-cr.sh1
-rwxr-xr-xt/t4300-merge-tree.sh1
-rwxr-xr-xt/t4301-merge-tree-write-tree.sh1
-rwxr-xr-xt/t5000-tar-tree.sh1
-rwxr-xr-xt/t5001-archive-attr.sh1
-rwxr-xr-xt/t5002-archive-attr-pattern.sh1
-rwxr-xr-xt/t5003-archive-zip.sh1
-rwxr-xr-xt/t5004-archive-corner-cases.sh1
-rwxr-xr-xt/t5100-mailinfo.sh1
-rwxr-xr-xt/t5150-request-pull.sh1
-rwxr-xr-xt/t5200-update-server-info.sh1
-rwxr-xr-xt/t5300-pack-object.sh1
-rwxr-xr-xt/t5301-sliding-window.sh1
-rwxr-xr-xt/t5302-pack-index.sh1
-rwxr-xr-xt/t5303-pack-corruption-resilience.sh1
-rwxr-xr-xt/t5304-prune.sh1
-rwxr-xr-xt/t5305-include-tag.sh1
-rwxr-xr-xt/t5306-pack-nobase.sh1
-rwxr-xr-xt/t5307-pack-missing-commit.sh1
-rwxr-xr-xt/t5308-pack-detect-duplicates.sh1
-rwxr-xr-xt/t5309-pack-delta-cycles.sh1
-rwxr-xr-xt/t5310-pack-bitmaps.sh1
-rwxr-xr-xt/t5311-pack-bitmaps-shallow.sh1
-rwxr-xr-xt/t5312-prune-corruption.sh1
-rwxr-xr-xt/t5313-pack-bounds-checks.sh1
-rwxr-xr-xt/t5314-pack-cycle-detection.sh1
-rwxr-xr-xt/t5315-pack-objects-compression.sh1
-rwxr-xr-xt/t5316-pack-delta-depth.sh1
-rwxr-xr-xt/t5317-pack-objects-filter-objects.sh1
-rwxr-xr-xt/t5318-commit-graph.sh1
-rwxr-xr-xt/t5319-multi-pack-index.sh1
-rwxr-xr-xt/t5320-delta-islands.sh1
-rwxr-xr-xt/t5321-pack-large-objects.sh1
-rwxr-xr-xt/t5322-pack-objects-sparse.sh1
-rwxr-xr-xt/t5323-pack-redundant.sh1
-rwxr-xr-xt/t5324-split-commit-graph.sh1
-rwxr-xr-xt/t5325-reverse-index.sh1
-rwxr-xr-xt/t5326-multi-pack-bitmaps.sh1
-rwxr-xr-xt/t5327-multi-pack-bitmaps-rev.sh1
-rwxr-xr-xt/t5328-commit-graph-64bit-time.sh1
-rwxr-xr-xt/t5329-pack-objects-cruft.sh1
-rwxr-xr-xt/t5330-no-lazy-fetch-with-commit-graph.sh1
-rwxr-xr-xt/t5331-pack-objects-stdin.sh1
-rwxr-xr-xt/t5332-multi-pack-reuse.sh1
-rwxr-xr-xt/t5333-pseudo-merge-bitmaps.sh1
-rwxr-xr-xt/t5334-incremental-multi-pack-index.sh1
-rwxr-xr-xt/t5351-unpack-large-objects.sh1
-rwxr-xr-xt/t5400-send-pack.sh1
-rwxr-xr-xt/t5401-update-hooks.sh1
-rwxr-xr-xt/t5402-post-merge-hook.sh1
-rwxr-xr-xt/t5403-post-checkout-hook.sh1
-rwxr-xr-xt/t5404-tracking-branches.sh1
-rwxr-xr-xt/t5405-send-pack-rewind.sh1
-rwxr-xr-xt/t5406-remote-rejects.sh1
-rwxr-xr-xt/t5407-post-rewrite-hook.sh1
-rwxr-xr-xt/t5408-send-pack-stdin.sh1
-rwxr-xr-xt/t5409-colorize-remote-messages.sh1
-rwxr-xr-xt/t5410-receive-pack-alternates.sh1
-rwxr-xr-xt/t5411-proc-receive-hook.sh1
-rwxr-xr-xt/t5500-fetch-pack.sh1
-rwxr-xr-xt/t5501-fetch-push-alternates.sh1
-rwxr-xr-xt/t5502-quickfetch.sh1
-rwxr-xr-xt/t5503-tagfollow.sh1
-rwxr-xr-xt/t5504-fetch-receive-strict.sh7
-rwxr-xr-xt/t5505-remote.sh119
-rwxr-xr-xt/t5506-remote-groups.sh1
-rwxr-xr-xt/t5507-remote-environment.sh1
-rwxr-xr-xt/t5509-fetch-push-namespaces.sh1
-rwxr-xr-xt/t5510-fetch.sh180
-rwxr-xr-xt/t5511-refspec.sh1
-rwxr-xr-xt/t5512-ls-remote.sh3
-rwxr-xr-xt/t5513-fetch-track.sh1
-rwxr-xr-xt/t5514-fetch-multiple.sh18
-rwxr-xr-xt/t5515-fetch-merge-logic.sh1
-rwxr-xr-xt/t5516-fetch-push.sh4
-rwxr-xr-xt/t5517-push-mirror.sh1
-rwxr-xr-xt/t5518-fetch-exit-status.sh1
-rwxr-xr-xt/t5519-push-alternates.sh1
-rwxr-xr-xt/t5520-pull.sh1
-rwxr-xr-xt/t5521-pull-options.sh1
-rwxr-xr-xt/t5522-pull-symlink.sh1
-rwxr-xr-xt/t5523-push-upstream.sh1
-rwxr-xr-xt/t5524-pull-msg.sh1
-rwxr-xr-xt/t5525-fetch-tagopt.sh1
-rwxr-xr-xt/t5526-fetch-submodules.sh1
-rwxr-xr-xt/t5527-fetch-odd-refs.sh4
-rwxr-xr-xt/t5528-push-default.sh1
-rwxr-xr-xt/t5529-push-errors.sh1
-rwxr-xr-xt/t5530-upload-pack-error.sh1
-rwxr-xr-xt/t5531-deep-submodule-push.sh1
-rwxr-xr-xt/t5532-fetch-proxy.sh1
-rwxr-xr-xt/t5533-push-cas.sh1
-rwxr-xr-xt/t5534-push-signed.sh1
-rwxr-xr-xt/t5535-fetch-push-symref.sh1
-rwxr-xr-xt/t5536-fetch-conflicts.sh1
-rwxr-xr-xt/t5537-fetch-shallow.sh1
-rwxr-xr-xt/t5538-push-shallow.sh1
-rwxr-xr-xt/t5539-fetch-http-shallow.sh1
-rwxr-xr-xt/t5540-http-push-webdav.sh1
-rwxr-xr-xt/t5541-http-push-smart.sh1
-rwxr-xr-xt/t5542-push-http-shallow.sh1
-rwxr-xr-xt/t5543-atomic-push.sh1
-rwxr-xr-xt/t5544-pack-objects-hook.sh1
-rwxr-xr-xt/t5545-push-options.sh1
-rwxr-xr-xt/t5546-receive-limits.sh1
-rwxr-xr-xt/t5547-push-quarantine.sh1
-rwxr-xr-xt/t5548-push-porcelain.sh1
-rwxr-xr-xt/t5549-fetch-push-http.sh1
-rwxr-xr-xt/t5550-http-fetch-dumb.sh1
-rwxr-xr-xt/t5551-http-fetch-smart.sh1
-rwxr-xr-xt/t5552-skipping-fetch-negotiator.sh1
-rwxr-xr-xt/t5553-set-upstream.sh1
-rwxr-xr-xt/t5554-noop-fetch-negotiator.sh1
-rwxr-xr-xt/t5555-http-smart-common.sh1
-rwxr-xr-xt/t5557-http-get.sh1
-rwxr-xr-xt/t5560-http-backend-noserver.sh1
-rwxr-xr-xt/t5561-http-backend.sh1
-rwxr-xr-xt/t5562-http-backend-content-length.sh1
-rw-r--r--t/t5562/invoke-with-content-length.pl2
-rwxr-xr-xt/t5563-simple-http-auth.sh1
-rwxr-xr-xt/t5564-http-proxy.sh1
-rwxr-xr-xt/t5570-git-daemon.sh1
-rwxr-xr-xt/t5571-pre-push-hook.sh1
-rwxr-xr-xt/t5572-pull-submodule.sh1
-rwxr-xr-xt/t5573-pull-verify-signatures.sh1
-rwxr-xr-xt/t5574-fetch-output.sh1
-rwxr-xr-xt/t5580-unc-paths.sh1
-rwxr-xr-xt/t5581-http-curl-verbose.sh1
-rwxr-xr-xt/t5582-fetch-negative-refspec.sh1
-rwxr-xr-xt/t5583-push-branches.sh1
-rwxr-xr-xt/t5600-clone-fail-cleanup.sh1
-rwxr-xr-xt/t5601-clone.sh26
-rwxr-xr-xt/t5602-clone-remote-exec.sh1
-rwxr-xr-xt/t5603-clone-dirname.sh1
-rwxr-xr-xt/t5604-clone-reference.sh7
-rwxr-xr-xt/t5605-clone-local.sh11
-rwxr-xr-xt/t5606-clone-options.sh1
-rwxr-xr-xt/t5607-clone-bundle.sh8
-rwxr-xr-xt/t5609-clone-branch.sh1
-rwxr-xr-xt/t5610-clone-detached.sh1
-rwxr-xr-xt/t5611-clone-config.sh1
-rwxr-xr-xt/t5612-clone-refspec.sh1
-rwxr-xr-xt/t5613-info-alternate.sh1
-rwxr-xr-xt/t5614-clone-submodules-shallow.sh1
-rwxr-xr-xt/t5615-alternate-env.sh1
-rwxr-xr-xt/t5616-partial-clone.sh1
-rwxr-xr-xt/t5617-clone-submodules-remote.sh1
-rwxr-xr-xt/t5618-alternate-refs.sh1
-rwxr-xr-xt/t5619-clone-local-ambiguous-transport.sh1
-rwxr-xr-xt/t5700-protocol-v1.sh1
-rwxr-xr-xt/t5701-git-serve.sh1
-rwxr-xr-xt/t5702-protocol-v2.sh1
-rwxr-xr-xt/t5703-upload-pack-ref-in-want.sh1
-rwxr-xr-xt/t5704-protocol-violations.sh1
-rwxr-xr-xt/t5705-session-id-in-capabilities.sh1
-rwxr-xr-xt/t5730-protocol-v2-bundle-uri-file.sh1
-rwxr-xr-xt/t5731-protocol-v2-bundle-uri-git.sh1
-rwxr-xr-xt/t5732-protocol-v2-bundle-uri-http.sh1
-rwxr-xr-xt/t5750-bundle-uri-parse.sh1
-rwxr-xr-xt/t5801-remote-helpers.sh1
-rwxr-xr-xt/t5802-connect-helper.sh1
-rwxr-xr-xt/t5810-proto-disable-local.sh1
-rwxr-xr-xt/t5811-proto-disable-git.sh1
-rwxr-xr-xt/t5812-proto-disable-http.sh1
-rwxr-xr-xt/t5813-proto-disable-ssh.sh1
-rwxr-xr-xt/t5814-proto-disable-ext.sh1
-rwxr-xr-xt/t5815-submodule-protos.sh1
-rwxr-xr-xt/t5900-repo-selection.sh1
-rwxr-xr-xt/t6000-rev-list-misc.sh1
-rwxr-xr-xt/t6001-rev-list-graft.sh1
-rwxr-xr-xt/t6002-rev-list-bisect.sh6
-rwxr-xr-xt/t6003-rev-list-topo-order.sh1
-rwxr-xr-xt/t6004-rev-list-path-optim.sh1
-rwxr-xr-xt/t6005-rev-list-count.sh1
-rwxr-xr-xt/t6006-rev-list-format.sh1
-rwxr-xr-xt/t6007-rev-list-cherry-pick-file.sh1
-rwxr-xr-xt/t6008-rev-list-submodule.sh1
-rwxr-xr-xt/t6009-rev-list-parent.sh1
-rwxr-xr-xt/t6010-merge-base.sh1
-rwxr-xr-xt/t6011-rev-list-with-bad-commit.sh1
-rwxr-xr-xt/t6012-rev-list-simplify.sh1
-rwxr-xr-xt/t6013-rev-list-reverse-parents.sh1
-rwxr-xr-xt/t6014-rev-list-all.sh1
-rwxr-xr-xt/t6016-rev-list-graph-simplify-history.sh1
-rwxr-xr-xt/t6017-rev-list-stdin.sh1
-rwxr-xr-xt/t6018-rev-list-glob.sh1
-rwxr-xr-xt/t6019-rev-list-ancestry-path.sh1
-rwxr-xr-xt/t6020-bundle-misc.sh45
-rwxr-xr-xt/t6021-rev-list-exclude-hidden.sh1
-rwxr-xr-xt/t6022-rev-list-missing.sh1
-rwxr-xr-xt/t6040-tracking-info.sh1
-rwxr-xr-xt/t6041-bisect-submodule.sh1
-rwxr-xr-xt/t6050-replace.sh1
-rwxr-xr-xt/t6060-merge-index.sh1
-rwxr-xr-xt/t6100-rev-list-in-order.sh1
-rwxr-xr-xt/t6101-rev-parse-parents.sh1
-rwxr-xr-xt/t6102-rev-list-unexpected-objects.sh1
-rwxr-xr-xt/t6110-rev-list-sparse.sh1
-rwxr-xr-xt/t6111-rev-list-treesame.sh1
-rwxr-xr-xt/t6112-rev-list-filters-objects.sh1
-rwxr-xr-xt/t6113-rev-list-bitmap-filters.sh1
-rwxr-xr-xt/t6114-keep-packs.sh1
-rwxr-xr-xt/t6115-rev-list-du.sh1
-rwxr-xr-xt/t6120-describe.sh25
-rwxr-xr-xt/t6130-pathspec-noglob.sh1
-rwxr-xr-xt/t6131-pathspec-icase.sh1
-rwxr-xr-xt/t6132-pathspec-exclude.sh1
-rwxr-xr-xt/t6133-pathspec-rev-dwim.sh1
-rwxr-xr-xt/t6134-pathspec-in-submodule.sh1
-rwxr-xr-xt/t6135-pathspec-with-attrs.sh1
-rwxr-xr-xt/t6136-pathspec-in-bare.sh1
-rwxr-xr-xt/t6200-fmt-merge-msg.sh1
-rwxr-xr-xt/t6300-for-each-ref.sh1
-rwxr-xr-xt/t6301-for-each-ref-errors.sh1
-rwxr-xr-xt/t6302-for-each-ref-filter.sh1
-rwxr-xr-xt/t6400-merge-df.sh1
-rwxr-xr-xt/t6401-merge-criss-cross.sh1
-rwxr-xr-xt/t6402-merge-rename.sh1
-rwxr-xr-xt/t6403-merge-file.sh1
-rwxr-xr-xt/t6404-recursive-merge.sh1
-rwxr-xr-xt/t6405-merge-symlinks.sh1
-rwxr-xr-xt/t6406-merge-attr.sh1
-rwxr-xr-xt/t6407-merge-binary.sh1
-rwxr-xr-xt/t6408-merge-up-to-date.sh1
-rwxr-xr-xt/t6409-merge-subtree.sh1
-rwxr-xr-xt/t6411-merge-filemode.sh1
-rwxr-xr-xt/t6412-merge-large-rename.sh1
-rwxr-xr-xt/t6413-merge-crlf.sh1
-rwxr-xr-xt/t6414-merge-rename-nocruft.sh1
-rwxr-xr-xt/t6415-merge-dir-to-symlink.sh1
-rwxr-xr-xt/t6416-recursive-corner-cases.sh1
-rwxr-xr-xt/t6417-merge-ours-theirs.sh1
-rwxr-xr-xt/t6418-merge-text-auto.sh1
-rwxr-xr-xt/t6421-merge-partial-clone.sh1
-rwxr-xr-xt/t6422-merge-rename-corner-cases.sh1
-rwxr-xr-xt/t6423-merge-rename-directories.sh1
-rwxr-xr-xt/t6424-merge-unrelated-index-changes.sh1
-rwxr-xr-xt/t6425-merge-rename-delete.sh1
-rwxr-xr-xt/t6426-merge-skip-unneeded-updates.sh1
-rwxr-xr-xt/t6427-diff3-conflict-markers.sh1
-rwxr-xr-xt/t6428-merge-conflicts-sparse.sh1
-rwxr-xr-xt/t6429-merge-sequence-rename-caching.sh1
-rwxr-xr-xt/t6430-merge-recursive.sh1
-rwxr-xr-xt/t6431-merge-criscross.sh1
-rwxr-xr-xt/t6432-merge-recursive-space-options.sh1
-rwxr-xr-xt/t6433-merge-toplevel.sh1
-rwxr-xr-xt/t6434-merge-recursive-rename-options.sh1
-rwxr-xr-xt/t6435-merge-sparse.sh1
-rwxr-xr-xt/t6436-merge-overwrite.sh1
-rwxr-xr-xt/t6437-submodule-merge.sh1
-rwxr-xr-xt/t6438-submodule-directory-file-conflicts.sh1
-rwxr-xr-xt/t6439-merge-co-error-msgs.sh1
-rwxr-xr-xt/t6500-gc.sh1
-rwxr-xr-xt/t6501-freshen-objects.sh1
-rwxr-xr-xt/t6600-test-reach.sh1
-rwxr-xr-xt/t6700-tree-depth.sh1
-rwxr-xr-xt/t7001-mv.sh1
-rwxr-xr-xt/t7002-mv-sparse-checkout.sh5
-rwxr-xr-xt/t7003-filter-branch.sh1
-rwxr-xr-xt/t7004-tag.sh15
-rwxr-xr-xt/t7005-editor.sh1
-rwxr-xr-xt/t7006-pager.sh1
-rwxr-xr-xt/t7007-show.sh1
-rwxr-xr-xt/t7008-filter-branch-null-sha1.sh1
-rwxr-xr-xt/t7010-setup.sh1
-rwxr-xr-xt/t7011-skip-worktree-reading.sh1
-rwxr-xr-xt/t7012-skip-worktree-writing.sh1
-rwxr-xr-xt/t7030-verify-tag.sh1
-rwxr-xr-xt/t7031-verify-tag-signed-ssh.sh1
-rwxr-xr-xt/t7060-wtstatus.sh1
-rwxr-xr-xt/t7061-wtstatus-ignore.sh1
-rwxr-xr-xt/t7062-wtstatus-ignorecase.sh1
-rwxr-xr-xt/t7063-status-untracked-cache.sh1
-rwxr-xr-xt/t7064-wtstatus-pv2.sh1
-rwxr-xr-xt/t7101-reset-empty-subdirs.sh1
-rwxr-xr-xt/t7102-reset.sh1
-rwxr-xr-xt/t7103-reset-bare.sh1
-rwxr-xr-xt/t7104-reset-hard.sh1
-rwxr-xr-xt/t7105-reset-patch.sh1
-rwxr-xr-xt/t7106-reset-unborn-branch.sh1
-rwxr-xr-xt/t7107-reset-pathspec-file.sh1
-rwxr-xr-xt/t7110-reset-merge.sh1
-rwxr-xr-xt/t7111-reset-table.sh1
-rwxr-xr-xt/t7112-reset-submodule.sh1
-rwxr-xr-xt/t7113-post-index-change-hook.sh1
-rwxr-xr-xt/t7201-co.sh5
-rwxr-xr-xt/t7300-clean.sh1
-rwxr-xr-xt/t7301-clean-interactive.sh1
-rwxr-xr-xt/t7400-submodule-basic.sh3
-rwxr-xr-xt/t7401-submodule-summary.sh1
-rwxr-xr-xt/t7402-submodule-rebase.sh1
-rwxr-xr-xt/t7403-submodule-sync.sh1
-rwxr-xr-xt/t7406-submodule-update.sh1
-rwxr-xr-xt/t7407-submodule-foreach.sh1
-rwxr-xr-xt/t7408-submodule-reference.sh1
-rwxr-xr-xt/t7409-submodule-detached-work-tree.sh1
-rwxr-xr-xt/t7411-submodule-config.sh1
-rwxr-xr-xt/t7412-submodule-absorbgitdirs.sh1
-rwxr-xr-xt/t7413-submodule-is-active.sh1
-rwxr-xr-xt/t7414-submodule-mistakes.sh1
-rwxr-xr-xt/t7416-submodule-dash-url.sh1
-rwxr-xr-xt/t7417-submodule-path-url.sh1
-rwxr-xr-xt/t7418-submodule-sparse-gitmodules.sh1
-rwxr-xr-xt/t7419-submodule-set-branch.sh1
-rwxr-xr-xt/t7420-submodule-set-url.sh1
-rwxr-xr-xt/t7421-submodule-summary-add.sh1
-rwxr-xr-xt/t7422-submodule-output.sh1
-rwxr-xr-xt/t7423-submodule-symlinks.sh1
-rwxr-xr-xt/t7424-submodule-mixed-ref-formats.sh1
-rwxr-xr-xt/t7450-bad-git-dotfiles.sh1
-rwxr-xr-xt/t7500-commit-template-squash-signoff.sh1
-rwxr-xr-xt/t7501-commit-basic-functionality.sh1
-rwxr-xr-xt/t7502-commit-porcelain.sh1
-rwxr-xr-xt/t7503-pre-commit-and-pre-merge-commit-hooks.sh1
-rwxr-xr-xt/t7504-commit-msg-hook.sh1
-rwxr-xr-xt/t7505-prepare-commit-msg-hook.sh1
-rwxr-xr-xt/t7506-status-submodule.sh1
-rwxr-xr-xt/t7507-commit-verbose.sh1
-rwxr-xr-xt/t7508-status.sh3
-rwxr-xr-xt/t7509-commit-authorship.sh1
-rwxr-xr-xt/t7510-signed-commit.sh1
-rwxr-xr-xt/t7511-status-index.sh1
-rwxr-xr-xt/t7512-status-help.sh1
-rwxr-xr-xt/t7513-interpret-trailers.sh1
-rwxr-xr-xt/t7514-commit-patch.sh1
-rwxr-xr-xt/t7515-status-symlinks.sh1
-rwxr-xr-xt/t7516-commit-races.sh1
-rwxr-xr-xt/t7517-per-repo-email.sh1
-rwxr-xr-xt/t7518-ident-corner-cases.sh1
-rwxr-xr-xt/t7519-status-fsmonitor.sh1
-rwxr-xr-xt/t7520-ignored-hook-warning.sh1
-rwxr-xr-xt/t7521-ignored-mode.sh1
-rwxr-xr-xt/t7524-commit-summary.sh1
-rwxr-xr-xt/t7525-status-rename.sh1
-rwxr-xr-xt/t7526-commit-pathspec-file.sh1
-rwxr-xr-xt/t7528-signed-commit-ssh.sh1
-rwxr-xr-xt/t7600-merge.sh1
-rwxr-xr-xt/t7601-merge-pull-config.sh1
-rwxr-xr-xt/t7602-merge-octopus-many.sh1
-rwxr-xr-xt/t7603-merge-reduce-heads.sh1
-rwxr-xr-xt/t7604-merge-custom-message.sh1
-rwxr-xr-xt/t7605-merge-resolve.sh1
-rwxr-xr-xt/t7606-merge-custom.sh1
-rwxr-xr-xt/t7607-merge-state.sh1
-rwxr-xr-xt/t7608-merge-messages.sh1
-rwxr-xr-xt/t7609-mergetool--lib.sh3
-rwxr-xr-xt/t7610-mergetool.sh9
-rwxr-xr-xt/t7611-merge-abort.sh1
-rwxr-xr-xt/t7612-merge-verify-signatures.sh1
-rwxr-xr-xt/t7614-merge-signoff.sh1
-rwxr-xr-xt/t7615-diff-algo-with-mergy-operations.sh1
-rwxr-xr-xt/t7700-repack.sh1
-rwxr-xr-xt/t7701-repack-unpack-unreachable.sh1
-rwxr-xr-xt/t7702-repack-cyclic-alternate.sh1
-rwxr-xr-xt/t7703-repack-geometric.sh1
-rwxr-xr-xt/t7704-repack-cruft.sh1
-rwxr-xr-xt/t7800-difftool.sh1
-rwxr-xr-xt/t7810-grep.sh1
-rwxr-xr-xt/t7811-grep-open.sh1
-rwxr-xr-xt/t7812-grep-icase-non-ascii.sh1
-rwxr-xr-xt/t7813-grep-icase-iso.sh1
-rwxr-xr-xt/t7814-grep-recurse-submodules.sh1
-rwxr-xr-xt/t7815-grep-binary.sh1
-rwxr-xr-xt/t7816-grep-binary-pattern.sh1
-rwxr-xr-xt/t7817-grep-sparse-checkout.sh1
-rwxr-xr-xt/t7900-maintenance.sh17
-rwxr-xr-xt/t8001-annotate.sh1
-rwxr-xr-xt/t8002-blame.sh1
-rwxr-xr-xt/t8003-blame-corner-cases.sh1
-rwxr-xr-xt/t8004-blame-with-conflicts.sh1
-rwxr-xr-xt/t8005-blame-i18n.sh1
-rwxr-xr-xt/t8006-blame-textconv.sh1
-rwxr-xr-xt/t8007-cat-file-textconv.sh1
-rwxr-xr-xt/t8008-blame-formats.sh1
-rwxr-xr-xt/t8009-blame-vs-topicbranches.sh1
-rwxr-xr-xt/t8010-cat-file-filters.sh1
-rwxr-xr-xt/t8011-blame-split-file.sh1
-rwxr-xr-xt/t8012-blame-colors.sh1
-rwxr-xr-xt/t8013-blame-ignore-revs.sh1
-rwxr-xr-xt/t8014-blame-ignore-fuzzy.sh1
-rwxr-xr-xt/t9001-send-email.sh1
-rwxr-xr-xt/t9002-column.sh1
-rwxr-xr-xt/t9003-help-autocorrect.sh1
-rwxr-xr-xt/t9200-git-cvsexportcommit.sh1
-rwxr-xr-xt/t9210-scalar.sh6
-rwxr-xr-xt/t9211-scalar-clone.sh7
-rwxr-xr-xt/t9300-fast-import.sh114
-rwxr-xr-xt/t9301-fast-import-notes.sh1
-rwxr-xr-xt/t9302-fast-import-unpack-limit.sh1
-rwxr-xr-xt/t9303-fast-import-compression.sh1
-rwxr-xr-xt/t9304-fast-import-marks.sh1
-rwxr-xr-xt/t9350-fast-export.sh3
-rwxr-xr-xt/t9351-fast-export-anonymize.sh1
-rwxr-xr-xt/t9400-git-cvsserver-server.sh1
-rwxr-xr-xt/t9401-git-cvsserver-crlf.sh1
-rwxr-xr-xt/t9402-git-cvsserver-refs.sh1
-rwxr-xr-xt/t9500-gitweb-standalone-no-errors.sh1
-rwxr-xr-xt/t9501-gitweb-standalone-http-status.sh1
-rwxr-xr-xt/t9502-gitweb-standalone-parse-output.sh1
-rwxr-xr-xt/t9600-cvsimport.sh1
-rwxr-xr-xt/t9601-cvsimport-vendor-branch.sh1
-rwxr-xr-xt/t9602-cvsimport-branches-tags.sh1
-rwxr-xr-xt/t9603-cvsimport-patchsets.sh1
-rwxr-xr-xt/t9604-cvsimport-timestamps.sh1
-rwxr-xr-xt/t9700-perl-git.sh1
-rwxr-xr-xt/t9700/test.pl2
-rwxr-xr-xt/t9800-git-p4-basic.sh1
-rwxr-xr-xt/t9801-git-p4-branch.sh1
-rwxr-xr-xt/t9802-git-p4-filetype.sh1
-rwxr-xr-xt/t9803-git-p4-shell-metachars.sh1
-rwxr-xr-xt/t9804-git-p4-label.sh1
-rwxr-xr-xt/t9805-git-p4-skip-submit-edit.sh1
-rwxr-xr-xt/t9806-git-p4-options.sh1
-rwxr-xr-xt/t9808-git-p4-chdir.sh1
-rwxr-xr-xt/t9809-git-p4-client-view.sh1
-rwxr-xr-xt/t9810-git-p4-rcs.sh1
-rwxr-xr-xt/t9811-git-p4-label-import.sh1
-rwxr-xr-xt/t9812-git-p4-wildcards.sh1
-rwxr-xr-xt/t9813-git-p4-preserve-users.sh1
-rwxr-xr-xt/t9814-git-p4-rename.sh1
-rwxr-xr-xt/t9815-git-p4-submit-fail.sh1
-rwxr-xr-xt/t9816-git-p4-locked.sh1
-rwxr-xr-xt/t9817-git-p4-exclude.sh1
-rwxr-xr-xt/t9818-git-p4-block.sh1
-rwxr-xr-xt/t9819-git-p4-case-folding.sh1
-rwxr-xr-xt/t9820-git-p4-editor-handling.sh1
-rwxr-xr-xt/t9821-git-p4-path-variations.sh1
-rwxr-xr-xt/t9822-git-p4-path-encoding.sh1
-rwxr-xr-xt/t9823-git-p4-mock-lfs.sh1
-rwxr-xr-xt/t9825-git-p4-handle-utf16-without-bom.sh1
-rwxr-xr-xt/t9826-git-p4-keep-empty-commits.sh1
-rwxr-xr-xt/t9827-git-p4-change-filetype.sh1
-rwxr-xr-xt/t9828-git-p4-map-user.sh1
-rwxr-xr-xt/t9829-git-p4-jobs.sh1
-rwxr-xr-xt/t9830-git-p4-symlink-dir.sh1
-rwxr-xr-xt/t9831-git-p4-triggers.sh1
-rwxr-xr-xt/t9832-unshelve.sh1
-rwxr-xr-xt/t9833-errors.sh1
-rwxr-xr-xt/t9834-git-p4-file-dir-bug.sh1
-rwxr-xr-xt/t9835-git-p4-metadata-encoding-python2.sh1
-rwxr-xr-xt/t9836-git-p4-metadata-encoding-python3.sh1
-rwxr-xr-xt/t9850-shell.sh1
-rwxr-xr-xt/t9901-git-web--browse.sh1
-rwxr-xr-xt/t9902-completion.sh66
-rwxr-xr-xt/t9903-bash-prompt.sh1
-rw-r--r--t/test-lib.sh103
-rwxr-xr-xt/test-terminal.perl2
-rw-r--r--t/unit-tests/lib-reftable.c5
-rw-r--r--t/unit-tests/lib-reftable.h2
-rw-r--r--t/unit-tests/strvec.c75
-rw-r--r--t/unit-tests/t-reftable-block.c41
-rw-r--r--t/unit-tests/t-reftable-merged.c99
-rw-r--r--t/unit-tests/t-reftable-pq.c3
-rw-r--r--t/unit-tests/t-reftable-reader.c4
-rw-r--r--t/unit-tests/t-reftable-readwrite.c41
-rw-r--r--t/unit-tests/t-reftable-record.c59
-rw-r--r--t/unit-tests/t-reftable-stack.c37
-rw-r--r--tag.c2
-rw-r--r--templates/Makefile39
-rw-r--r--templates/branches--1
-rw-r--r--templates/description (renamed from templates/this--description)0
-rwxr-xr-xtemplates/hooks/applypatch-msg.sample (renamed from templates/hooks--applypatch-msg.sample)0
-rwxr-xr-xtemplates/hooks/commit-msg.sample (renamed from templates/hooks--commit-msg.sample)0
-rwxr-xr-xtemplates/hooks/fsmonitor-watchman.sample (renamed from templates/hooks--fsmonitor-watchman.sample)0
-rw-r--r--templates/hooks/meson.build26
-rwxr-xr-xtemplates/hooks/post-update.sample (renamed from templates/hooks--post-update.sample)0
-rwxr-xr-xtemplates/hooks/pre-applypatch.sample (renamed from templates/hooks--pre-applypatch.sample)0
-rwxr-xr-xtemplates/hooks/pre-commit.sample (renamed from templates/hooks--pre-commit.sample)0
-rwxr-xr-xtemplates/hooks/pre-merge-commit.sample (renamed from templates/hooks--pre-merge-commit.sample)0
-rwxr-xr-xtemplates/hooks/pre-push.sample (renamed from templates/hooks--pre-push.sample)0
-rwxr-xr-xtemplates/hooks/pre-rebase.sample (renamed from templates/hooks--pre-rebase.sample)0
-rwxr-xr-xtemplates/hooks/pre-receive.sample (renamed from templates/hooks--pre-receive.sample)0
-rwxr-xr-xtemplates/hooks/prepare-commit-msg.sample (renamed from templates/hooks--prepare-commit-msg.sample)0
-rwxr-xr-xtemplates/hooks/push-to-checkout.sample (renamed from templates/hooks--push-to-checkout.sample)0
-rwxr-xr-xtemplates/hooks/sendemail-validate.sample (renamed from templates/hooks--sendemail-validate.sample)0
-rwxr-xr-xtemplates/hooks/update.sample (renamed from templates/hooks--update.sample)0
-rw-r--r--templates/info/exclude (renamed from templates/info--exclude)0
-rw-r--r--templates/info/meson.build7
-rw-r--r--templates/meson.build15
-rw-r--r--transport.c26
-rw-r--r--unimplemented.sh2
-rw-r--r--usage.c15
-rw-r--r--version-def.h.in8
-rw-r--r--version.c1
-rw-r--r--walker.c2
-rw-r--r--worktree.c157
-rw-r--r--worktree.h22
-rw-r--r--wrap-for-bin.sh36
1222 files changed, 10977 insertions, 4413 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 9301a1edd6..808ddc19b8 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -342,12 +342,21 @@ jobs:
- jobname: linux-musl
image: alpine
distro: alpine-latest
+ # Supported until 2025-04-02.
- jobname: linux32
image: i386/ubuntu:focal
distro: ubuntu32-20.04
- jobname: pedantic
image: fedora
distro: fedora-latest
+ # A RHEL 8 compatible distro. Supported until 2029-05-31.
+ - jobname: almalinux-8
+ image: almalinux:8
+ distro: almalinux-8
+ # Supported until 2026-08-31.
+ - jobname: debian-11
+ image: debian:11
+ distro: debian-11
env:
jobname: ${{matrix.vector.jobname}}
distro: ${{matrix.vector.distro}}
diff --git a/.gitignore b/.gitignore
index 6687bd6db4..e82aa19df0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@
/GIT-TEST-SUITES
/GIT-USER-AGENT
/GIT-VERSION-FILE
-/bin-wrappers/
/git
/git-add
/git-am
@@ -195,9 +194,11 @@
/config-list.h
/command-list.h
/hook-list.h
+/version-def.h
*.tar.gz
*.dsc
*.deb
+/git.rc
/git.spec
*.exe
*.[aos]
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 526ecfe030..008966cae4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -35,7 +35,7 @@ test:linux:
parallel:
matrix:
- jobname: linux-old
- image: ubuntu:16.04
+ image: ubuntu:20.04
CC: gcc
- jobname: linux-sha256
image: ubuntu:latest
@@ -99,10 +99,10 @@ test:osx:
parallel:
matrix:
- jobname: osx-clang
- image: macos-13-xcode-14
+ image: macos-14-xcode-15
CC: clang
- jobname: osx-reftable
- image: macos-13-xcode-14
+ image: macos-14-xcode-15
CC: clang
artifacts:
paths:
diff --git a/Documentation/.gitignore b/Documentation/.gitignore
index a48448de32..649df89474 100644
--- a/Documentation/.gitignore
+++ b/Documentation/.gitignore
@@ -15,3 +15,5 @@ tmp-doc-diff/
GIT-ASCIIDOCFLAGS
/.build/
/GIT-EXCLUDED-PROGRAMS
+/asciidoc.conf
+/asciidoctor-extensions.rb
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 87904791cb..ba047ed224 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -583,7 +583,7 @@ For C programs:
Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or
run `GIT_DEBUGGER="<debugger> <debugger-args>" ./bin-wrappers/git foo` to
use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb"
- ./bin-wrappers/git log` (See `wrap-for-bin.sh`.)
+ ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.)
- The primary data structure that a subsystem 'S' deals with is called
`struct S`. Functions that operate on `struct S` are named
@@ -703,16 +703,30 @@ Program Output
Error Messages
- - Do not end error messages with a full stop.
+ - Do not end a single-sentence error message with a full stop.
- Do not capitalize the first word, only because it is the first word
- in the message ("unable to open %s", not "Unable to open %s"). But
+ in the message ("unable to open '%s'", not "Unable to open '%s'"). But
"SHA-3 not supported" is fine, because the reason the first word is
capitalized is not because it is at the beginning of the sentence,
but because the word would be spelled in capital letters even when
it appeared in the middle of the sentence.
- - Say what the error is first ("cannot open %s", not "%s: cannot open")
+ - Say what the error is first ("cannot open '%s'", not "%s: cannot open").
+
+ - Enclose the subject of an error inside a pair of single quotes,
+ e.g. `die(_("unable to open '%s'"), path)`.
+
+ - Unless there is a compelling reason not to, error messages from
+ porcelain commands should be marked for translation, e.g.
+ `die(_("bad revision %s"), revision)`.
+
+ - Error messages from the plumbing commands are sometimes meant for
+ machine consumption and should not be marked for translation,
+ e.g., `die("bad revision %s", revision)`.
+
+ - BUG("message") are for communicating the specific error to developers,
+ thus should not be translated.
Externally Visible Names
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0f55baa252..3392e1ce7e 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,6 +1,8 @@
# Import tree-wide shared Makefile behavior and libraries
include ../shared.mak
+.PHONY: FORCE
+
# Guard against environment variables
MAN1_TXT =
MAN5_TXT =
@@ -111,6 +113,7 @@ TECH_DOCS += MyFirstObjectWalk
TECH_DOCS += SubmittingPatches
TECH_DOCS += ToolsForGit
TECH_DOCS += technical/bitmap-format
+TECH_DOCS += technical/build-systems
TECH_DOCS += technical/bundle-uri
TECH_DOCS += technical/hash-function-transition
TECH_DOCS += technical/long-running-process-protocol
@@ -148,16 +151,12 @@ man5dir = $(mandir)/man5
man7dir = $(mandir)/man7
# DESTDIR =
-GIT_DATE := $(shell git show --quiet --pretty='%as')
-
ASCIIDOC = asciidoc
ASCIIDOC_EXTRA =
ASCIIDOC_HTML = xhtml11
ASCIIDOC_DOCBOOK = docbook
ASCIIDOC_CONF = -f asciidoc.conf
-ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
- -amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' \
- -arevdate='$(GIT_DATE)'
+ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF)
ASCIIDOC_DEPS = asciidoc.conf GIT-ASCIIDOCFLAGS
TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
@@ -210,6 +209,14 @@ ASCIIDOC_DEPS = asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
DBLATEX_COMMON =
XMLTO_EXTRA += --skip-validation
XMLTO_EXTRA += -x manpage.xsl
+
+asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+else
+asciidoc.conf: asciidoc.conf.in FORCE
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
endif
ASCIIDOC_DEPS += docinfo.html
@@ -218,6 +225,7 @@ SHELL_PATH ?= $(SHELL)
# Shell quote;
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+ASCIIDOC_EXTRA += -abuild_dir='$(shell pwd)'
ifdef DEFAULT_PAGER
DEFAULT_PAGER_SQ = $(subst ','\'',$(DEFAULT_PAGER))
ASCIIDOC_EXTRA += -a 'git-default-pager=$(DEFAULT_PAGER_SQ)'
@@ -275,15 +283,17 @@ ifneq ($(filter-out lint-docs clean,$(MAKECMDGOALS)),)
-include ../GIT-VERSION-FILE
endif
+mergetools_txt = mergetools-diff.txt mergetools-merge.txt
+
#
# Determine "include::" file references in asciidoc files.
#
docdep_prereqs = \
- mergetools-list.made $(mergetools_txt) \
+ $(mergetools_txt) \
cmd-list.made $(cmds_txt)
doc.dep : $(docdep_prereqs) $(DOC_DEP_TXT) build-docdep.perl
- $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl >$@ $(QUIET_STDERR)
+ $(QUIET_GEN)$(PERL_PATH) ./build-docdep.perl "$(shell pwd)" >$@ $(QUIET_STDERR)
ifneq ($(MAKECMDGOALS),clean)
-include doc.dep
@@ -305,22 +315,14 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
$(cmds_txt): cmd-list.made
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
- $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(cmds_txt) $(QUIET_STDERR) && \
+ $(QUIET_GEN)$(PERL_PATH) ./cmd-list.perl .. . $(cmds_txt) && \
date >$@
-mergetools_txt = mergetools-diff.txt mergetools-merge.txt
-
-$(mergetools_txt): mergetools-list.made
-
-mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
- $(QUIET_GEN) \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=diff && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_diff' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-diff.txt && \
- $(SHELL_PATH) -c 'MERGE_TOOLS_DIR=../mergetools && TOOL_MODE=merge && \
- . ../git-mergetool--lib.sh && \
- show_tool_names can_merge' | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >mergetools-merge.txt && \
- date >$@
+mergetools-%.txt: generate-mergetool-list.sh ../git-mergetool--lib.sh $(wildcard ../mergetools/*)
+mergetools-diff.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. diff $@
+mergetools-merge.txt:
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-mergetool-list.sh .. merge $@
TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK))
@@ -341,6 +343,7 @@ clean:
$(RM) SubmittingPatches.txt
$(RM) $(cmds_txt) $(mergetools_txt) *.made
$(RM) GIT-ASCIIDOCFLAGS
+ $(RM) asciidoc.conf asciidoctor-extensions.rb
docinfo.html: docinfo-html.in
$(QUIET_GEN)$(RM) $@ && cat $< >$@
@@ -364,7 +367,7 @@ manpage-cmd = $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
%.xml : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d manpage -o $@ $<
-user-manual.xml: user-manual.txt user-manual.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS
+user-manual.xml: user-manual.txt user-manual.conf $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d book -o $@ $<
technical/api-index.txt: technical/api-index-skel.txt \
@@ -373,7 +376,7 @@ technical/api-index.txt: technical/api-index-skel.txt \
technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
$(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt \
- asciidoc.conf GIT-ASCIIDOCFLAGS
+ $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
SubmittingPatches.txt: SubmittingPatches
@@ -416,13 +419,13 @@ $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
howto-index.txt: howto-index.sh $(HOWTO_TXT)
$(QUIET_GEN)'$(SHELL_PATH_SQ)' ./howto-index.sh $(sort $(HOWTO_TXT)) >$@
-$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
+$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt
WEBDOC_DEST = /pub/software/scm/git/docs
howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
-$(patsubst %.txt,%.html,$(HOWTO_TXT)): %.html : %.txt GIT-ASCIIDOCFLAGS
+$(patsubst %.txt,%.html,$(HOWTO_TXT)): %.html : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC) \
sed -e '1,/^$$/d' $< | \
$(TXT_TO_HTML) - >$@
diff --git a/Documentation/RelNotes/2.48.0.txt b/Documentation/RelNotes/2.48.0.txt
index a949a103b1..cc752d5466 100644
--- a/Documentation/RelNotes/2.48.0.txt
+++ b/Documentation/RelNotes/2.48.0.txt
@@ -19,12 +19,27 @@ UI, Workflows & Features
* Documentation for "git bundle" saw improvements to more prominently
call out the use of '--all' when creating bundles.
+ * Drop support for older libcURL and Perl.
+
+ * End-user experience of "git mergetool" when the command errors out
+ has been improved.
+
+ * "git bundle --unbundle" and "git clone" running on a bundle file
+ both learned to trigger fsck over the new objects with configurable
+ fck check levels.
+
+ * When "git fetch $remote" notices that refs/remotes/$remote/HEAD is
+ missing and discovers what branch the other side points with its
+ HEAD, refs/remotes/$remote/HEAD is updated to point to it.
+
+ * "git fetch" honors "remote.<remote>.followRemoteHEAD" settings to
+ tweak the remote-tracking HEAD in "refs/remotes/<remote>/HEAD".
+
Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
* Document "amlog" notes.
- (merge ddfb5bcfc6 tb/notes-amlog-doc later to maint).
* The way AsciiDoc is used for SYNOPSIS part of the manual pages has
been revamped. The sources, at least for the simple cases, got
@@ -94,13 +109,44 @@ Performance, Internal Implementation, Development Support etc.
* We now ensure "index-pack" is used with the "--promisor" option
only during a "git fetch".
+ * The migration procedure between two ref backends has been optimized.
+
+ * "git fsck" learned to issue warnings on "curiously formatted" ref
+ contents that have always been taken valid but something Git
+ wouldn't have written itself (e.g., missing terminating end-of-line
+ after the full object name).
+
+ * Work around Coverity warning that would not trigger in practice.
+
+ * Built-in Git subcommands are supplied the repository object to work
+ with; they learned to do the same when they invoke sub-subcommands.
+
+ * Drop support for ancient environments in various CI jobs.
+
+ * Isolates the reftable subsystem from the rest of Git's codebase by
+ using fewer pieces of Git's infrastructure.
+
+ * Optimize reading random references out of the reftable backend by
+ allowing reuse of iterator objects.
+
+ * Backport oss-fuzz tests for us to our codebase.
+
+ * Introduce a new repository extension to prevent older Git versions
+ from mis-interpreting worktrees created with relative paths.
+
+ * Yet another "pass the repository through the callchain" topic.
+
+ * "git describe" learned to stop digging the history needlessly
+ deeper.
+
+ * Build procedure update plus introduction of Meson based builds.
+
Fixes since v2.47
-----------------
* Doc update to clarify how periodical maintenance are scheduled,
spread across time to avoid thundering hurds.
- (merge 3d6ab4177d sk/doc-maintenance-schedule later to maint).
* Use after free and double freeing at the end in "git log -L... -p"
had been identified and fixed.
@@ -179,17 +225,67 @@ Fixes since v2.47
been corrected.
(merge b886db48c6 kn/ref-transaction-hook-with-reflog later to maint).
+ * Give a bit of advice/hint message when "git maintenance" stops finding a
+ lock file left by another instance that still is potentially running.
+ (merge ba874d1dac ps/gc-stale-lock-warning later to maint).
+
+ * Use the right helper program to measure file size in performance tests.
+ (merge 3f97f1bce6 tb/use-test-file-size-more later to maint).
+
+ * A double-free that may not trigger in practice by luck has been
+ corrected in the reference resolution code.
+ (merge b6318cf23a sj/refs-symref-referent-fix later to maint).
+
+ * The sequencer failed to honor core.commentString in some places.
+
+ * Describe a case where an option value needs to be spelled as a
+ separate argument, i.e. "--opt val", not "--opt=val".
+ (merge 1bc1e94091 jc/doc-opt-tilde-expand later to maint).
+
+ * Loosen overly strict ownership check introduced in the recent past,
+ to keep the promise "cloning a suspicious repository is a safe
+ first step to inspect it".
+ (merge 0ffb5a6bf1 bc/allow-upload-pack-from-other-people later to maint).
+
+ * "git fast-import" learned to reject paths with ".." and "." as
+ their components to avoid creating invalid tree objects.
+ (merge 8cb4c6e62f en/fast-import-verify-path later to maint).
+
+ * The --ancestry-path option is designed to be given a commit that is
+ on the path, which was not documented, which has been corrected.
+ (merge bc1a980759 kk/doc-ancestry-path later to maint).
+
+
+ * "git tag" has been taught to refuse to create refs/tags/HEAD
+ as such a tag will be confusing in the context of UI provided by
+ the Git Porcelain commands.
+ (merge bbd445d5ef jc/forbid-head-as-tagname later to maint).
+
+ * The advice messages now tell the newer 'git config set' command to
+ set the advice.token configuration variable to squelch a message.
+ (merge 6c397d0104 bf/explicit-config-set-in-advice-messages later to maint).
+
+ * The syntax ":/<text>" to name the latest commit with the matching
+ text was broken with a recent change, which has been corrected.
+ (merge 0ff919e87a ps/commit-with-message-syntax-fix later to maint).
+
+ * Fix performance regression of a recent "fatten promisor pack with
+ local objects" protection against an unwanted gc.
+
+ * "git log -p --remerge-diff --reverse" was completely broken.
+ (merge f94bfa1516 js/log-remerge-keep-ancestry later to maint).
+
+ * "git bundle create" with an annotated tag on the positive end of
+ the revision range had a workaround code for older limitation in
+ the revision walker, which has become unnecessary.
+ (merge dd1072dfa8 tc/bundle-with-tag-remove-workaround later to maint).
+
* Other code cleanup, docfix, build fix, etc.
- (merge 1164e270b5 jk/output-prefix-cleanup later to maint).
- (merge f36b8cbaef jh/config-unset-doc-fix later to maint).
- (merge 4154ed4108 js/doc-platform-support-link-fix later to maint).
(merge 77af53f56f aa/t7300-modernize later to maint).
- (merge 8ead1bba3e jc/doc-refspec-syntax later to maint).
- (merge 432f666aa6 kn/loose-object-layer-wo-global-hash later to maint).
- (merge c4b8fb6ef2 kh/merge-tree-doc later to maint).
- (merge b8139c8f4e kh/checkout-ignore-other-docfix later to maint).
- (merge 6dab49b9fb tc/bundle-uri-leakfix later to maint).
- (merge f1ed39987b xx/protocol-v2-doc-markup-fix later to maint).
- (merge 41869f7447 ak/typofixes later to maint).
(merge dcd590a39d bf/t-readme-mention-reftable later to maint).
(merge 68e3c69efa kh/trailer-in-glossary later to maint).
+ (merge 91f88f76e6 tb/boundary-traversal-fix later to maint).
+ (merge 168ebb7159 jc/doc-error-message-guidelines later to maint).
+ (merge 18693d7d65 kh/doc-bundle-typofix later to maint).
+ (merge e2f5d3b491 kh/doc-update-ref-grammofix later to maint).
+ (merge 8525e92886 mh/doc-windows-home-env later to maint).
diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf.in
index f6da6d1fbd..dbe36a52ea 100644
--- a/Documentation/asciidoc.conf
+++ b/Documentation/asciidoc.conf.in
@@ -21,6 +21,9 @@ tilde=&#126;
apostrophe=&#39;
backtick=&#96;
litdd=&#45;&#45;
+manmanual='Git Manual'
+mansource='Git @GIT_VERSION@'
+revdate='@GIT_DATE@'
ifdef::backend-docbook[]
[linkgit-inlinemacro]
diff --git a/Documentation/asciidoctor-extensions.rb b/Documentation/asciidoctor-extensions.rb.in
index cb24480b63..c4c200dace 100644
--- a/Documentation/asciidoctor-extensions.rb
+++ b/Documentation/asciidoctor-extensions.rb.in
@@ -29,13 +29,9 @@ module Git
class DocumentPostProcessor < Asciidoctor::Extensions::Postprocessor
def process document, output
if document.basebackend? 'docbook'
- mansource = document.attributes['mansource']
- manversion = document.attributes['manversion']
- manmanual = document.attributes['manmanual']
new_tags = "" \
- "<refmiscinfo class=\"source\">#{mansource}</refmiscinfo>\n" \
- "<refmiscinfo class=\"version\">#{manversion}</refmiscinfo>\n" \
- "<refmiscinfo class=\"manual\">#{manmanual}</refmiscinfo>\n"
+ "<refmiscinfo class=\"source\">@GIT_VERSION@</refmiscinfo>\n" \
+ "<refmiscinfo class=\"manual\">Git Manual</refmiscinfo>\n"
output = output.sub(/<\/refmeta>/, new_tags + "</refmeta>")
end
output
diff --git a/Documentation/build-docdep.perl b/Documentation/build-docdep.perl
index 1b3ac8fdd9..315efaa2fa 100755
--- a/Documentation/build-docdep.perl
+++ b/Documentation/build-docdep.perl
@@ -1,5 +1,6 @@
#!/usr/bin/perl
+my ($build_dir) = @ARGV;
my %include = ();
my %included = ();
@@ -10,6 +11,7 @@ for my $text (<*.txt>) {
chomp;
s/^include::\s*//;
s/\[\]//;
+ s/{build_dir}/${build_dir}/;
$include{$text}{$_} = 1;
$included{$_} = 1;
}
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 755a110bc4..e260a98977 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -3,12 +3,13 @@
use File::Compare qw(compare);
sub format_one {
- my ($out, $nameattr) = @_;
+ my ($source_dir, $out, $nameattr) = @_;
my ($name, $attr) = @$nameattr;
+ my ($path) = "$source_dir/Documentation/$name.txt";
my ($state, $description);
my $mansection;
$state = 0;
- open I, '<', "$name.txt" or die "No such file $name.txt";
+ open I, '<', "$path" or die "No such file $path.txt";
while (<I>) {
if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) {
$mansection = $1;
@@ -29,7 +30,7 @@ sub format_one {
}
close I;
if (!defined $description) {
- die "No description found in $name.txt";
+ die "No description found in $path.txt";
}
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
print $out "linkgit:$name\[$mansection\]::\n\t";
@@ -43,9 +44,9 @@ sub format_one {
}
}
-my ($input, @categories) = @ARGV;
+my ($source_dir, $build_dir, @categories) = @ARGV;
-open IN, "<$input";
+open IN, "<$source_dir/command-list.txt";
while (<IN>) {
last if /^### command list/;
}
@@ -63,17 +64,17 @@ close IN;
for my $out (@categories) {
my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
- open O, '>', "$out+" or die "Cannot open output file $out+";
+ my ($path) = "$build_dir/$out";
+ open O, '>', "$path+" or die "Cannot open output file $out+";
for (@{$cmds{$cat}}) {
- format_one(\*O, $_);
+ format_one($source_dir, \*O, $_);
}
close O;
- if (-f "$out" && compare("$out", "$out+") == 0) {
- unlink "$out+";
+ if (-f "$path" && compare("$path", "$path+") == 0) {
+ unlink "$path+";
}
else {
- print STDERR "$out\n";
- rename "$out+", "$out";
+ rename "$path+", "$path";
}
}
diff --git a/Documentation/config/diff.txt b/Documentation/config/diff.txt
index 190bda17e5..fdae13a212 100644
--- a/Documentation/config/diff.txt
+++ b/Documentation/config/diff.txt
@@ -1,18 +1,25 @@
-diff.autoRefreshIndex::
- When using 'git diff' to compare with work tree
+`diff.autoRefreshIndex`::
+ When using `git diff` to compare with work tree
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
- index. This option defaults to true. Note that this
- affects only 'git diff' Porcelain, and not lower level
- 'diff' commands such as 'git diff-files'.
+ index. This option defaults to `true`. Note that this
+ affects only `git diff` Porcelain, and not lower level
+ `diff` commands such as `git diff-files`.
-diff.dirstat::
+`diff.dirstat`::
+ifdef::git-diff[]
+ A comma separated list of `--dirstat` parameters specifying the
+ default behavior of the `--dirstat` option to `git diff` and friends.
+endif::git-diff[]
+ifndef::git-diff[]
A comma separated list of `--dirstat` parameters specifying the
default behavior of the `--dirstat` option to linkgit:git-diff[1]
- and friends. The defaults can be overridden on the command line
- (using `--dirstat=<param1,param2,...>`). The fallback defaults
+ and friends.
+endif::git-diff[]
+ The defaults can be overridden on the command line
+ (using `--dirstat=<param>,...`). The fallback defaults
(when not changed by `diff.dirstat`) are `changes,noncumulative,3`.
The following parameters are available:
+
@@ -41,7 +48,7 @@ diff.dirstat::
Note that when using `cumulative`, the sum of the percentages
reported may exceed 100%. The default (non-cumulative) behavior can
be specified with the `noncumulative` parameter.
-<limit>;;
+_<limit>_;;
An integer parameter specifies a cut-off percent (3% by default).
Directories contributing less than this percentage of the changes
are not shown in the output.
@@ -52,58 +59,58 @@ 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.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.
+`diff.statGraphWidth`::
+ Limit the width of the graph part in `--stat` output. If set, applies
+ to all commands generating `--stat` output except `format-patch`.
-diff.context::
- Generate diffs with <n> lines of context instead of the default
- of 3. This value is overridden by the -U option.
+`diff.context`::
+ Generate diffs with _<n>_ lines of context instead of the default
+ of 3. This value is overridden by the `-U` option.
-diff.interHunkContext::
+`diff.interHunkContext`::
Show the context between diff hunks, up to the specified number
of lines, thereby fusing the hunks that are close to each other.
This value serves as the default for the `--inter-hunk-context`
command line option.
-diff.external::
+`diff.external`::
If this config variable is set, diff generation is not
performed using the internal diff machinery, but using the
- given command. Can be overridden with the `GIT_EXTERNAL_DIFF'
+ given command. Can be overridden with the `GIT_EXTERNAL_DIFF`
environment variable. The command is called with parameters
as described under "git Diffs" in linkgit:git[1]. Note: if
you want to use an external diff program only on a subset of
your files, you might want to use linkgit:gitattributes[5] instead.
-diff.trustExitCode::
- If this boolean value is set to true then the
+`diff.trustExitCode`::
+ If this boolean value is set to `true` then the
`diff.external` command is expected to return exit code
0 if it considers the input files to be equal or 1 if it
- considers them to be different, like `diff(1)`.
- If it is set to false, which is the default, then the command
- is expected to return exit code 0 regardless of equality.
+ considers them to be different, like `diff`(1).
+ If it is set to `false`, which is the default, then the command
+ is expected to return exit code `0` regardless of equality.
Any other exit code causes Git to report a fatal error.
-diff.ignoreSubmodules::
- Sets the default value of --ignore-submodules. Note that this
- affects only 'git diff' Porcelain, and not lower level 'diff'
- commands such as 'git diff-files'. 'git checkout'
- and 'git switch' also honor
+`diff.ignoreSubmodules`::
+ Sets the default value of `--ignore-submodules`. Note that this
+ affects only `git diff` Porcelain, and not lower level `diff`
+ commands such as `git diff-files`. `git checkout`
+ and `git switch` also honor
this setting when reporting uncommitted changes. Setting it to
- 'all' disables the submodule summary normally shown by 'git commit'
- and 'git status' when `status.submoduleSummary` is set unless it is
- overridden by using the --ignore-submodules command-line option.
- The 'git submodule' commands are not affected by this setting.
+ `all` disables the submodule summary normally shown by `git commit`
+ and `git status` when `status.submoduleSummary` is set unless it is
+ overridden by using the `--ignore-submodules` command-line option.
+ The `git submodule` commands are not affected by this setting.
By default this is set to untracked so that any untracked
submodules are ignored.
-diff.mnemonicPrefix::
- If set, 'git diff' uses a prefix pair that is different from the
- standard "a/" and "b/" depending on what is being compared. When
+`diff.mnemonicPrefix`::
+ If set, `git diff` uses a prefix pair that is different from the
+ standard `a/` and `b/` depending on what is being compared. When
this configuration is in effect, reverse diff output also swaps
the order of the prefixes:
`git diff`;;
@@ -112,111 +119,117 @@ diff.mnemonicPrefix::
compares a (c)ommit and the (w)ork tree;
`git diff --cached`;;
compares a (c)ommit and the (i)ndex;
-`git diff HEAD:file1 file2`;;
+`git diff HEAD:<file1> <file2>`;;
compares an (o)bject and a (w)ork tree entity;
-`git diff --no-index a b`;;
- compares two non-git things (1) and (2).
+`git diff --no-index <a> <b>`;;
+ compares two non-git things _<a>_ and _<b>_.
-diff.noPrefix::
- If set, 'git diff' does not show any source or destination prefix.
+`diff.noPrefix`::
+ If set, `git diff` does not show any source or destination prefix.
-diff.srcPrefix::
- If set, 'git diff' uses this source prefix. Defaults to "a/".
+`diff.srcPrefix`::
+ If set, `git diff` uses this source prefix. Defaults to `a/`.
-diff.dstPrefix::
- If set, 'git diff' uses this destination prefix. Defaults to "b/".
+`diff.dstPrefix`::
+ If set, `git diff` uses this destination prefix. Defaults to `b/`.
-diff.relative::
- If set to 'true', 'git diff' does not show changes outside of the directory
+`diff.relative`::
+ If set to `true`, `git diff` does not show changes outside of the directory
and show pathnames relative to the current directory.
-diff.orderFile::
+`diff.orderFile`::
File indicating how to order files within a diff.
- See the '-O' option to linkgit:git-diff[1] for details.
+ifdef::git-diff[]
+ See the `-O` option for details.
+endif::git-diff[]
+ifndef::git-diff[]
+ See the `-O` option to linkgit:git-diff[1] for details.
+endif::git-diff[]
If `diff.orderFile` is a relative pathname, it is treated as
relative to the top of the working tree.
-diff.renameLimit::
+`diff.renameLimit`::
The number of files to consider in the exhaustive portion of
- copy/rename detection; equivalent to the 'git diff' option
+ copy/rename detection; equivalent to the `git diff` option
`-l`. If not set, the default value is currently 1000. This
setting has no effect if rename detection is turned off.
-diff.renames::
- Whether and how Git detects renames. If set to "false",
- rename detection is disabled. If set to "true", basic rename
- detection is enabled. If set to "copies" or "copy", Git will
- detect copies, as well. Defaults to true. Note that this
- affects only 'git diff' Porcelain like linkgit:git-diff[1] and
+`diff.renames`::
+ Whether and how Git detects renames. If set to `false`,
+ rename detection is disabled. If set to `true`, basic rename
+ detection is enabled. If set to `copies` or `copy`, Git will
+ detect copies, as well. Defaults to `true`. Note that this
+ affects only `git diff` Porcelain like linkgit:git-diff[1] and
linkgit:git-log[1], and not lower level commands such as
linkgit:git-diff-files[1].
-diff.suppressBlankEmpty::
+`diff.suppressBlankEmpty`::
A boolean to inhibit the standard behavior of printing a space
- before each empty output line. Defaults to false.
+ before each empty output line. Defaults to `false`.
-diff.submodule::
+`diff.submodule`::
Specify the format in which differences in submodules are
- shown. The "short" format just shows the names of the commits
- at the beginning and end of the range. The "log" format lists
+ shown. The `short` format just shows the names of the commits
+ at the beginning and end of the range. The `log` format lists
the commits in the range like linkgit:git-submodule[1] `summary`
- does. The "diff" format shows an inline diff of the changed
- contents of the submodule. Defaults to "short".
+ does. The `diff` format shows an inline diff of the changed
+ contents of the submodule. Defaults to `short`.
-diff.wordRegex::
+`diff.wordRegex`::
A POSIX Extended Regular Expression used to determine what is a "word"
when performing word-by-word difference calculations. Character
sequences that match the regular expression are "words", all other
characters are *ignorable* whitespace.
-diff.<driver>.command::
+`diff.<driver>.command`::
The custom diff driver command. See linkgit:gitattributes[5]
for details.
-diff.<driver>.trustExitCode::
- If this boolean value is set to true then the
+`diff.<driver>.trustExitCode`::
+ If this boolean value is set to `true` then the
`diff.<driver>.command` command is expected to return exit code
0 if it considers the input files to be equal or 1 if it
- considers them to be different, like `diff(1)`.
- If it is set to false, which is the default, then the command
+ considers them to be different, like `diff`(1).
+ If it is set to `false`, which is the default, then the command
is expected to return exit code 0 regardless of equality.
Any other exit code causes Git to report a fatal error.
-diff.<driver>.xfuncname::
+`diff.<driver>.xfuncname`::
The regular expression that the diff driver should use to
recognize the hunk header. A built-in pattern may also be used.
See linkgit:gitattributes[5] for details.
-diff.<driver>.binary::
- Set this option to true to make the diff driver treat files as
+`diff.<driver>.binary`::
+ Set this option to `true` to make the diff driver treat files as
binary. See linkgit:gitattributes[5] for details.
-diff.<driver>.textconv::
+`diff.<driver>.textconv`::
The command that the diff driver should call to generate the
text-converted version of a file. The result of the
conversion is used to generate a human-readable diff. See
linkgit:gitattributes[5] for details.
-diff.<driver>.wordRegex::
+`diff.<driver>.wordRegex`::
The regular expression that the diff driver should use to
split words in a line. See linkgit:gitattributes[5] for
details.
-diff.<driver>.cachetextconv::
- Set this option to true to make the diff driver cache the text
+`diff.<driver>.cachetextconv`::
+ Set this option to `true` to make the diff driver cache the text
conversion outputs. See linkgit:gitattributes[5] for details.
-include::../mergetools-diff.txt[]
+include::{build_dir}/mergetools-diff.txt[]
-diff.indentHeuristic::
+`diff.indentHeuristic`::
Set this option to `false` to disable the default heuristics
that shift diff hunk boundaries to make patches easier to read.
-diff.algorithm::
+`diff.algorithm`::
Choose a diff algorithm. The variants are as follows:
+
--
-`default`, `myers`;;
+`default`;;
+`myers`;;
The basic greedy diff algorithm. Currently, this is the default.
`minimal`;;
Spend extra time to make sure the smallest possible diff is
@@ -229,7 +242,7 @@ diff.algorithm::
--
+
-diff.wsErrorHighlight::
+`diff.wsErrorHighlight`::
Highlight whitespace errors in the `context`, `old` or `new`
lines of the diff. Multiple values are separated by comma,
`none` resets previous values, `default` reset the list to
@@ -238,14 +251,19 @@ diff.wsErrorHighlight::
The command line option `--ws-error-highlight=<kind>`
overrides this setting.
-diff.colorMoved::
- If set to either a valid `<mode>` or a true value, moved lines
- in a diff are colored differently, for details of valid modes
- see '--color-moved' in linkgit:git-diff[1]. If simply set to
- true the default color mode will be used. When set to false,
- moved lines are not colored.
-
-diff.colorMovedWS::
+`diff.colorMoved`::
+ If set to either a valid _<mode>_ or a `true` value, moved lines
+ in a diff are colored differently.
+ifdef::git-diff[]
+ For details of valid modes see `--color-moved`.
+endif::git-diff[]
+ifndef::git-diff[]
+ For details of valid modes see `--color-moved` in linkgit:git-diff[1].
+endif::git-diff[]
+ If simply set to `true` the default color mode will be used. When
+ set to `false`, moved lines are not colored.
+
+`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].
diff --git a/Documentation/config/extensions.txt b/Documentation/config/extensions.txt
index 5dc569d1c9..5cb4721a0e 100644
--- a/Documentation/config/extensions.txt
+++ b/Documentation/config/extensions.txt
@@ -63,6 +63,12 @@ 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.
+relativeWorktrees::
+ If enabled, indicates at least one worktree has been linked with
+ relative paths. Automatically set if a worktree has been created or
+ repaired with either the `--relative-paths` option or with the
+ `worktree.useRelativePaths` config set to `true`.
+
worktreeConfig::
If enabled, then worktrees will load config settings from the
`$GIT_DIR/config.worktree` file in addition to the
diff --git a/Documentation/config/merge.txt b/Documentation/config/merge.txt
index 8851b6cede..82554d65a0 100644
--- a/Documentation/config/merge.txt
+++ b/Documentation/config/merge.txt
@@ -101,7 +101,7 @@ merge.guitool::
Any other value is treated as a custom merge tool and requires that a
corresponding mergetool.<guitool>.cmd variable is defined.
-include::../mergetools-merge.txt[]
+include::{build_dir}/mergetools-merge.txt[]
merge.verbosity::
Controls the amount of output shown by the recursive merge
diff --git a/Documentation/config/remote.txt b/Documentation/config/remote.txt
index 6d8b7d6c63..4118c219c1 100644
--- a/Documentation/config/remote.txt
+++ b/Documentation/config/remote.txt
@@ -101,6 +101,19 @@ remote.<name>.serverOption::
The default set of server options used when fetching from this remote.
These server options can be overridden by the `--server-option=` command
line arguments.
+
+remote.<name>.followRemoteHEAD::
+ How linkgit:git-fetch[1] should handle updates to `remotes/<name>/HEAD`.
+ The default value is "create", which will create `remotes/<name>/HEAD`
+ if it exists on the remote, but not locally, but will not touch an
+ already existing local reference. Setting to "warn" will print
+ a message if the remote has a different value, than the local one and
+ in case there is no local reference, it behaves like "create".
+ A variant on "warn" is "warn-if-not-$branch", which behaves like
+ "warn", but if `HEAD` on the remote is `$branch` it will be silent.
+ Setting to "always" will silently update it to the value on the remote.
+ Finally, setting it to "never" will never change or create the local
+ reference.
+
This is a multi-valued variable, and an empty value can be used in a higher
priority configuration file (e.g. `.git/config` in a repository) to clear
diff --git a/Documentation/config/worktree.txt b/Documentation/config/worktree.txt
index 048e349482..5e35c7d018 100644
--- a/Documentation/config/worktree.txt
+++ b/Documentation/config/worktree.txt
@@ -7,3 +7,13 @@ worktree.guessRemote::
such a branch exists, it is checked out and set as "upstream"
for the new branch. If no such match can be found, it falls
back to creating a new branch from the current HEAD.
+
+worktree.useRelativePaths::
+ Link worktrees using relative paths (when "true") or absolute
+ paths (when "false"). This is particularly useful for setups
+ where the repository and worktrees may be moved between
+ different locations or environments. Defaults to "false".
++
+Note that setting `worktree.useRelativePaths` to "true" implies enabling the
+`extension.relativeWorktrees` config (see linkgit:git-config[1]),
+thus making it incompatible with older versions of Git.
diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
index a3ae8747a2..c72fb37986 100644
--- a/Documentation/diff-format.txt
+++ b/Documentation/diff-format.txt
@@ -1,25 +1,25 @@
Raw output format
-----------------
-The raw output format from "git-diff-index", "git-diff-tree",
-"git-diff-files" and "git diff --raw" are very similar.
+The raw output format from `git-diff-index`, `git-diff-tree`,
+`git-diff-files` and `git diff --raw` are very similar.
These commands all compare two sets of things; what is
compared differs:
-git-diff-index <tree-ish>::
- compares the <tree-ish> and the files on the filesystem.
+`git-diff-index <tree-ish>`::
+ compares the _<tree-ish>_ and the files on the filesystem.
-git-diff-index --cached <tree-ish>::
- compares the <tree-ish> and the index.
+`git-diff-index --cached <tree-ish>`::
+ compares the _<tree-ish>_ and the index.
-git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>...]::
+`git-diff-tree [-r] <tree-ish-1> <tree-ish-2> [<pattern>...]`::
compares the trees named by the two arguments.
-git-diff-files [<pattern>...]::
+`git-diff-files [<pattern>...]`::
compares the index and the files on the filesystem.
-The "git-diff-tree" command begins its output by printing the hash of
+The `git-diff-tree` command begins its output by printing the hash of
what is being compared. After that, all the commands print one output
line per changed file.
@@ -54,19 +54,19 @@ That is, from the left to the right:
Possible status letters are:
-- A: addition of a file
-- C: copy of a file into a new one
-- D: deletion of a file
-- M: modification of the contents or mode of a file
-- R: renaming of a file
-- T: change in the type of the file (regular file, symbolic link or submodule)
-- U: file is unmerged (you must complete the merge before it can
+- `A`: addition of a file
+- `C`: copy of a file into a new one
+- `D`: deletion of a file
+- `M`: modification of the contents or mode of a file
+- `R`: renaming of a file
+- `T`: change in the type of the file (regular file, symbolic link or submodule)
+- `U`: file is unmerged (you must complete the merge before it can
be committed)
-- X: "unknown" change type (most probably a bug, please report it)
+- `X`: "unknown" change type (most probably a bug, please report it)
-Status letters C and R are always followed by a score (denoting the
+Status letters `C` and `R` are always followed by a score (denoting the
percentage of similarity between the source and target of the move or
-copy). Status letter M may be followed by a score (denoting the
+copy). Status letter `M` may be followed by a score (denoting the
percentage of dissimilarity) for file rewrites.
The sha1 for "dst" is shown as all 0's if a file on the filesystem
@@ -86,7 +86,7 @@ verbatim and the line is terminated by a NUL byte.
diff format for merges
----------------------
-"git-diff-tree", "git-diff-files" and "git-diff --raw"
+`git-diff-tree`, `git-diff-files` and `git-diff --raw`
can take `-c` or `--cc` option
to generate diff output also for merge commits. The output differs
from the format described above in the following way:
@@ -128,7 +128,7 @@ other diff formats
------------------
The `--summary` option describes newly added, deleted, renamed and
-copied files. The `--stat` option adds diffstat(1) graph to the
+copied files. The `--stat` option adds `diffstat`(1) graph to the
output. These options can be combined with other options, such as
`-p`, and are meant for human consumption.
diff --git a/Documentation/diff-generate-patch.txt b/Documentation/diff-generate-patch.txt
index 4b5aa5c2e0..e5c813c96f 100644
--- a/Documentation/diff-generate-patch.txt
+++ b/Documentation/diff-generate-patch.txt
@@ -14,7 +14,7 @@ You can customize the creation of patch text via the
`GIT_EXTERNAL_DIFF` and the `GIT_DIFF_OPTS` environment variables
(see linkgit:git[1]), and the `diff` attribute (see linkgit:gitattributes[5]).
-What the -p option produces is slightly different from the traditional
+What the `-p` option produces is slightly different from the traditional
diff format:
1. It is preceded by a "git diff" header that looks like this:
@@ -30,20 +30,21 @@ name of the source file of the rename/copy and the name of
the file that the rename/copy produces, respectively.
2. It is followed by one or more extended header lines:
-
- old mode <mode>
- new mode <mode>
- deleted file mode <mode>
- new file mode <mode>
- copy from <path>
- copy to <path>
- rename from <path>
- rename to <path>
- similarity index <number>
- dissimilarity index <number>
- index <hash>..<hash> <mode>
+
-File modes are printed as 6-digit octal numbers including the file type
+[synopsis]
+old mode <mode>
+new mode <mode>
+deleted file mode <mode>
+new file mode <mode>
+copy from <path>
+copy to <path>
+rename from <path>
+rename to <path>
+similarity index <number>
+dissimilarity index <number>
+index <hash>..<hash> <mode>
++
+File modes _<mode>_ are printed as 6-digit octal numbers including the file type
and file permission bits.
+
Path names in extended headers do not include the `a/` and `b/` prefixes.
@@ -56,7 +57,7 @@ files, while 100% dissimilarity means that no line from the old
file made it into the new one.
+
The index line includes the blob object names before and after the change.
-The <mode> is included if the file mode does not change; otherwise,
+The _<mode>_ is included if the file mode does not change; otherwise,
separate lines indicate the old and the new mode.
3. Pathnames with "unusual" characters are quoted as explained for
@@ -134,17 +135,18 @@ or like this (when the `--cc` option is used):
2. It is followed by one or more extended header lines
(this example shows a merge with two parents):
-
- index <hash>,<hash>..<hash>
- mode <mode>,<mode>..<mode>
- new file mode <mode>
- deleted file mode <mode>,<mode>
++
+[synopsis]
+index <hash>,<hash>..<hash>
+mode <mode>,<mode>`..`<mode>
+new file mode <mode>
+deleted file mode <mode>,<mode>
+
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 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.
+_<tree-ish>_ and are not used by combined diff format.
3. It is followed by a two-line from-file/to-file header:
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index cd0b81adbb..640eb6e7db 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -19,16 +19,16 @@ ifdef::git-format-patch[]
endif::git-format-patch[]
ifndef::git-format-patch[]
--p::
--u::
---patch::
+`-p`::
+`-u`::
+`--patch`::
Generate patch (see <<generate_patch_text_with_p>>).
ifdef::git-diff[]
This is the default.
endif::git-diff[]
--s::
---no-patch::
+`-s`::
+`--no-patch`::
Suppress all output from the diff machinery. Useful for
commands like `git show` that show the patch by default to
squelch their output, or to cancel the effect of options like
@@ -39,28 +39,28 @@ endif::git-format-patch[]
ifdef::git-log[]
-m::
Show diffs for merge commits in the default format. This is
- similar to '--diff-merges=on', except `-m` will
+ 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'.
+ Shortcut for `--diff-merges=combined -p`.
--cc::
Produce dense combined diff output for merge commits.
- Shortcut for '--diff-merges=dense-combined -p'.
+ 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'.
+ Shortcut for `--diff-merges=first-parent -p`.
--remerge-diff::
Produce remerge-diff output for merge commits.
- Shortcut for '--diff-merges=remerge -p'.
+ Shortcut for `--diff-merges=remerge -p`.
--no-diff-merges::
- Synonym for '--diff-merges=off'.
+ Synonym for `--diff-merges=off`.
--diff-merges=<format>::
Specify diff format to be used for merge commits. Default is
@@ -73,33 +73,33 @@ The following formats are supported:
off, none::
Disable output of diffs for merge commits. Useful to override
implied 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`.
-+
+
first-parent, 1::
Show full diff with respect to first parent. This is the same
format as `--patch` produces for non-merge commits.
-+
+
separate::
Show full diff with respect to each of parents.
Separate log entry and diff is generated for each parent.
-+
+
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
@@ -112,33 +112,33 @@ documented).
--
--combined-all-paths::
- This flag causes combined diffs (used for merge commits) to
+ Cause combined diffs (used for merge commits) to
list the name of the file from all parents. It thus only has
effect when `--diff-merges=[dense-]combined` is in use, and
is likely only useful if filename changes are detected (i.e.
when either rename or copy detection have been requested).
endif::git-log[]
--U<n>::
---unified=<n>::
- Generate diffs with <n> lines of context instead of
+`-U<n>`::
+`--unified=<n>`::
+ Generate diffs with _<n>_ lines of context instead of
the usual three.
ifndef::git-format-patch[]
Implies `--patch`.
endif::git-format-patch[]
---output=<file>::
+`--output=<file>`::
Output to a specific file instead of stdout.
---output-indicator-new=<char>::
---output-indicator-old=<char>::
---output-indicator-context=<char>::
+`--output-indicator-new=<char>`::
+`--output-indicator-old=<char>`::
+`--output-indicator-context=<char>`::
Specify the character used to indicate new, old or context
- lines in the generated patch. Normally they are '+', '-' and
+ lines in the generated patch. Normally they are `+`, `-` and
' ' respectively.
ifndef::git-format-patch[]
---raw::
+`--raw`::
ifndef::git-log[]
Generate the diff in raw format.
ifdef::git-diff-core[]
@@ -155,54 +155,55 @@ endif::git-log[]
endif::git-format-patch[]
ifndef::git-format-patch[]
---patch-with-raw::
+`--patch-with-raw`::
Synonym for `-p --raw`.
endif::git-format-patch[]
ifdef::git-log[]
--t::
+`-t`::
Show the tree objects in the diff output.
endif::git-log[]
---indent-heuristic::
+`--indent-heuristic`::
Enable the heuristic that shifts diff hunk boundaries to make patches
easier to read. This is the default.
---no-indent-heuristic::
+`--no-indent-heuristic`::
Disable the indent heuristic.
---minimal::
+`--minimal`::
Spend extra time to make sure the smallest possible
diff is produced.
---patience::
+`--patience`::
Generate a diff using the "patience diff" algorithm.
---histogram::
+`--histogram`::
Generate a diff using the "histogram diff" algorithm.
---anchored=<text>::
+`--anchored=<text>`::
Generate a diff using the "anchored diff" algorithm.
+
This option may be specified more than once.
+
If a line exists in both the source and destination, exists only once,
-and starts with this text, this algorithm attempts to prevent it from
+and starts with _<text>_, this algorithm attempts to prevent it from
appearing as a deletion or addition in the output. It uses the "patience
diff" algorithm internally.
---diff-algorithm={patience|minimal|histogram|myers}::
+`--diff-algorithm=(patience|minimal|histogram|myers)`::
Choose a diff algorithm. The variants are as follows:
+
--
-`default`, `myers`;;
+ `default`;;
+ `myers`;;
The basic greedy diff algorithm. Currently, this is the default.
-`minimal`;;
+ `minimal`;;
Spend extra time to make sure the smallest possible diff is
produced.
-`patience`;;
+ `patience`;;
Use "patience diff" algorithm when generating patches.
-`histogram`;;
+ `histogram`;;
This algorithm extends the patience algorithm to "support
low-occurrence common elements".
--
@@ -211,47 +212,47 @@ For instance, if you configured the `diff.algorithm` variable to a
non-default value and want to use the default one, then you
have to use `--diff-algorithm=default` option.
---stat[=<width>[,<name-width>[,<count>]]]::
+`--stat[=<width>[,<name-width>[,<count>]]]`::
Generate a diffstat. By default, as much space as necessary
will be used for the filename part, and the rest for the graph
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 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
+ _<width>_. The width of the filename part can be limited by
+ giving another width _<name-width>_ after a comma or by setting
+ `diff.statNameWidth=<name-width>`. The width of the graph part can be
+ limited by using `--stat-graph-width=<graph-width>` or by setting
+ `diff.statGraphWidth=<graph-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.
+ 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>`.
---compact-summary::
+`--compact-summary`::
Output a condensed summary of extended header information such
- as file creations or deletions ("new" or "gone", optionally "+l"
- if it's a symlink) and mode changes ("+x" or "-x" for adding
+ as file creations or deletions ("new" or "gone", optionally `+l`
+ if it's a symlink) and mode changes (`+x` or `-x` for adding
or removing executable bit respectively) in diffstat. The
information is put between the filename part and the graph
part. Implies `--stat`.
---numstat::
+`--numstat`::
Similar to `--stat`, but shows number of added and
deleted lines in decimal notation and pathname without
abbreviation, to make it more machine friendly. For
binary files, outputs two `-` instead of saying
`0 0`.
---shortstat::
+`--shortstat`::
Output only the last line of the `--stat` format containing total
number of modified files, as well as number of added and deleted
lines.
--X[<param1,param2,...>]::
---dirstat[=<param1,param2,...>]::
+`-X [<param>,...]`::
+`--dirstat[=<param>,...]`::
Output the distribution of relative amount of changes for each
sub-directory. The behavior of `--dirstat` can be customized by
passing it a comma separated list of parameters.
@@ -284,7 +285,7 @@ These parameters can also be set individually with `--stat-width=<width>`,
Note that when using `cumulative`, the sum of the percentages
reported may exceed 100%. The default (non-cumulative) behavior can
be specified with the `noncumulative` parameter.
-<limit>;;
+_<limit>_;;
An integer parameter specifies a cut-off percent (3% by default).
Directories contributing less than this percentage of the changes
are not shown in the output.
@@ -295,29 +296,29 @@ directories with less than 10% of the total amount of changed files,
and accumulating child directory counts in the parent directories:
`--dirstat=files,10,cumulative`.
---cumulative::
- Synonym for --dirstat=cumulative
+`--cumulative`::
+ Synonym for `--dirstat=cumulative`.
---dirstat-by-file[=<param1,param2>...]::
- Synonym for --dirstat=files,<param1>,<param2>...
+`--dirstat-by-file[=<param>,...]`::
+ Synonym for `--dirstat=files,<param>,...`.
---summary::
+`--summary`::
Output a condensed summary of extended header information
such as creations, renames and mode changes.
ifndef::git-format-patch[]
---patch-with-stat::
+`--patch-with-stat`::
Synonym for `-p --stat`.
endif::git-format-patch[]
ifndef::git-format-patch[]
--z::
+`-z`::
ifdef::git-log[]
- Separate the commits with NULs instead of newlines.
+ Separate the commits with __NUL__s instead of newlines.
+
Also, when `--raw` or `--numstat` has been given, do not munge
-pathnames and use NULs as output field terminators.
+pathnames and use __NUL__s as output field terminators.
endif::git-log[]
ifndef::git-log[]
When `--raw`, `--numstat`, `--name-only` or `--name-status` has been
@@ -328,89 +329,89 @@ Without this option, pathnames with "unusual" characters are quoted as
explained for the configuration variable `core.quotePath` (see
linkgit:git-config[1]).
---name-only::
+`--name-only`::
Show only the name of each changed file in the post-image tree.
The file names are often encoded in UTF-8.
For more information see the discussion about encoding in the linkgit:git-log[1]
manual page.
---name-status::
+`--name-status`::
Show only the name(s) and status of each changed file. See the description
of the `--diff-filter` option on what the status letters mean.
Just like `--name-only` the file names are often encoded in UTF-8.
---submodule[=<format>]::
+`--submodule[=<format>]`::
Specify how differences in submodules are shown. When specifying
- `--submodule=short` the 'short' format is used. This format just
+ `--submodule=short` the `short` format is used. This format just
shows the names of the commits at the beginning and end of the range.
- When `--submodule` or `--submodule=log` is specified, the 'log'
+ When `--submodule` or `--submodule=log` is specified, the `log`
format is used. This format lists the commits in the range like
linkgit:git-submodule[1] `summary` does. When `--submodule=diff`
- is specified, the 'diff' format is used. This format shows an
+ is specified, the `diff` format is used. This format shows an
inline diff of the changes in the submodule contents between the
- commit range. Defaults to `diff.submodule` or the 'short' format
+ commit range. Defaults to `diff.submodule` or the `short` format
if the config option is unset.
---color[=<when>]::
+`--color[=<when>]`::
Show colored diff.
- `--color` (i.e. without '=<when>') is the same as `--color=always`.
- '<when>' can be one of `always`, `never`, or `auto`.
+ `--color` (i.e. without `=<when>`) is the same as `--color=always`.
+ _<when>_ can be one of `always`, `never`, or `auto`.
ifdef::git-diff[]
It can be changed by the `color.ui` and `color.diff`
configuration settings.
endif::git-diff[]
---no-color::
+`--no-color`::
Turn off colored diff.
ifdef::git-diff[]
This can be used to override configuration settings.
endif::git-diff[]
It is the same as `--color=never`.
---color-moved[=<mode>]::
+`--color-moved[=<mode>]`::
Moved lines of code are colored differently.
ifdef::git-diff[]
It can be changed by the `diff.colorMoved` configuration setting.
endif::git-diff[]
- The <mode> defaults to 'no' if the option is not given
- and to 'zebra' if the option with no mode is given.
+ The _<mode>_ defaults to `no` if the option is not given
+ and to `zebra` if the option with no mode is given.
The mode must be one of:
+
--
-no::
+`no`::
Moved lines are not highlighted.
-default::
+`default`::
Is a synonym for `zebra`. This may change to a more sensible mode
in the future.
-plain::
+`plain`::
Any line that is added in one location and was removed
- in another location will be colored with 'color.diff.newMoved'.
- Similarly 'color.diff.oldMoved' will be used for removed lines
+ in another location will be colored with `color.diff.newMoved`.
+ Similarly `color.diff.oldMoved` will be used for removed lines
that are added somewhere else in the diff. This mode picks up any
moved line, but it is not very useful in a review to determine
if a block of code was moved without permutation.
-blocks::
+`blocks`::
Blocks of moved text of at least 20 alphanumeric characters
are detected greedily. The detected blocks are
- painted using either the 'color.diff.{old,new}Moved' color.
+ painted using either the `color.diff.(old|new)Moved` color.
Adjacent blocks cannot be told apart.
-zebra::
- Blocks of moved text are detected as in 'blocks' mode. The blocks
- are painted using either the 'color.diff.{old,new}Moved' color or
- 'color.diff.{old,new}MovedAlternative'. The change between
+`zebra`::
+ Blocks of moved text are detected as in `blocks` mode. The blocks
+ are painted using either the `color.diff.(old|new)Moved` color or
+ `color.diff.(old|new)MovedAlternative`. The change between
the two colors indicates that a new block was detected.
-dimmed-zebra::
- Similar to 'zebra', but additional dimming of uninteresting parts
+`dimmed-zebra`::
+ Similar to `zebra`, but additional dimming of uninteresting parts
of moved code is performed. The bordering lines of two adjacent
blocks are considered interesting, the rest is uninteresting.
`dimmed_zebra` is a deprecated synonym.
--
---no-color-moved::
+`--no-color-moved`::
Turn off move detection. This can be used to override configuration
settings. It is the same as `--color-moved=no`.
---color-moved-ws=<modes>::
+`--color-moved-ws=<mode>,...`::
This configures how whitespace is ignored when performing the
move detection for `--color-moved`.
ifdef::git-diff[]
@@ -419,63 +420,62 @@ endif::git-diff[]
These modes can be given as a comma separated list:
+
--
-no::
+`no`::
Do not ignore whitespace when performing move detection.
-ignore-space-at-eol::
+`ignore-space-at-eol`::
Ignore changes in whitespace at EOL.
-ignore-space-change::
+`ignore-space-change`::
Ignore changes in amount of whitespace. This ignores whitespace
at line end, and considers all other sequences of one or
more whitespace characters to be equivalent.
-ignore-all-space::
+`ignore-all-space`::
Ignore whitespace when comparing lines. This ignores differences
even if one line has whitespace where the other line has none.
-allow-indentation-change::
+`allow-indentation-change`::
Initially ignore any whitespace in the move detection, then
group the moved code blocks only into a block if the change in
whitespace is the same per line. This is incompatible with the
other modes.
--
---no-color-moved-ws::
+`--no-color-moved-ws`::
Do not ignore whitespace when performing move detection. This can be
used to override configuration settings. It is the same as
`--color-moved-ws=no`.
---word-diff[=<mode>]::
- Show a word diff, using the <mode> to delimit changed words.
+`--word-diff[=<mode>]`::
By default, words are delimited by whitespace; see
- `--word-diff-regex` below. The <mode> defaults to 'plain', and
+ `--word-diff-regex` below. The _<mode>_ defaults to `plain`, and
must be one of:
+
--
-color::
+`color`::
Highlight changed words using only colors. Implies `--color`.
-plain::
- Show words as `[-removed-]` and `{+added+}`. Makes no
+`plain`::
+ Show words as ++[-removed-]++ and ++{+added+}++. Makes no
attempts to escape the delimiters if they appear in the input,
so the output may be ambiguous.
-porcelain::
+`porcelain`::
Use a special line-based format intended for script
consumption. Added/removed/unchanged runs are printed in the
usual unified diff format, starting with a `+`/`-`/` `
character at the beginning of the line and extending to the
end of the line. Newlines in the input are represented by a
tilde `~` on a line of its own.
-none::
+`none`::
Disable word diff again.
--
+
Note that despite the name of the first mode, color is used to
highlight the changed parts in all modes if enabled.
---word-diff-regex=<regex>::
- Use <regex> to decide what a word is, instead of considering
+`--word-diff-regex=<regex>`::
+ Use _<regex>_ to decide what a word is, instead of considering
runs of non-whitespace to be a word. Also implies
`--word-diff` unless it was already enabled.
+
Every non-overlapping match of the
-<regex> is considered a word. Anything between these matches is
+_<regex>_ is considered a word. Anything between these matches is
considered whitespace and ignored(!) for the purposes of finding
differences. You may want to append `|[^[:space:]]` to your regular
expression to make sure that it matches all non-whitespace characters.
@@ -490,20 +490,20 @@ linkgit:gitattributes[5] or linkgit:git-config[1]. Giving it explicitly
overrides any diff driver or configuration setting. Diff drivers
override configuration settings.
---color-words[=<regex>]::
+`--color-words[=<regex>]`::
Equivalent to `--word-diff=color` plus (if a regex was
specified) `--word-diff-regex=<regex>`.
endif::git-format-patch[]
---no-renames::
+`--no-renames`::
Turn off rename detection, even when the configuration
file gives the default to do so.
---[no-]rename-empty::
+`--[no-]rename-empty`::
Whether to use empty blobs as rename source.
ifndef::git-format-patch[]
---check::
+`--check`::
Warn if changes introduce conflict markers or whitespace errors.
What are considered whitespace errors is controlled by `core.whitespace`
configuration. By default, trailing whitespaces (including
@@ -511,9 +511,9 @@ ifndef::git-format-patch[]
that is immediately followed by a tab character inside the
initial indent of the line are considered whitespace errors.
Exits with non-zero status if problems are found. Not compatible
- with --exit-code.
+ with `--exit-code`.
---ws-error-highlight=<kind>::
+`--ws-error-highlight=<kind>`::
Highlight whitespace errors in the `context`, `old` or `new`
lines of the diff. Multiple values are separated by comma,
`none` resets previous values, `default` reset the list to
@@ -525,30 +525,30 @@ ifndef::git-format-patch[]
endif::git-format-patch[]
---full-index::
+`--full-index`::
Instead of the first handful of characters, show the full
pre- and post-image blob object names on the "index"
line when generating patch format output.
---binary::
+`--binary`::
In addition to `--full-index`, output a binary diff that
can be applied with `git-apply`.
ifndef::git-format-patch[]
Implies `--patch`.
endif::git-format-patch[]
---abbrev[=<n>]::
+`--abbrev[=<n>]`::
Instead of showing the full 40-byte hexadecimal object
name in diff-raw format output and diff-tree header
- lines, show the shortest prefix that is at least '<n>'
+ lines, show the shortest prefix that is at least _<n>_
hexdigits long that uniquely refers the object.
In diff-patch output format, `--full-index` takes higher
precedence, i.e. if `--full-index` is specified, full blob
names will be shown regardless of `--abbrev`.
Non default number of digits can be specified with `--abbrev=<n>`.
--B[<n>][/<m>]::
---break-rewrites[=[<n>][/<m>]]::
+`-B[<n>][/<m>]`::
+`--break-rewrites[=[<n>][/<m>]]`::
Break complete rewrite changes into pairs of delete and
create. This serves two purposes:
+
@@ -556,22 +556,22 @@ It affects the way a change that amounts to a total rewrite of a file
not as a series of deletion and insertion mixed together with a very
few lines that happen to match textually as the context, but as a
single deletion of everything old followed by a single insertion of
-everything new, and the number `m` controls this aspect of the -B
+everything new, and the number _<m>_ controls this aspect of the `-B`
option (defaults to 60%). `-B/70%` specifies that less than 30% of the
original should remain in the result for Git to consider it a total
rewrite (i.e. otherwise the resulting patch will be a series of
deletion and insertion mixed together with context lines).
+
-When used with -M, a totally-rewritten file is also considered as the
-source of a rename (usually -M only considers a file that disappeared
-as the source of a rename), and the number `n` controls this aspect of
-the -B option (defaults to 50%). `-B20%` specifies that a change with
+When used with `-M`, a totally-rewritten file is also considered as the
+source of a rename (usually `-M` only considers a file that disappeared
+as the source of a rename), and the number _<n>_ controls this aspect of
+the `-B` option (defaults to 50%). `-B20%` specifies that a change with
addition and deletion compared to 20% or more of the file's size are
eligible for being picked up as a possible source of a rename to
another file.
--M[<n>]::
---find-renames[=<n>]::
+`-M[<n>]`::
+`--find-renames[=<n>]`::
ifndef::git-log[]
Detect renames.
endif::git-log[]
@@ -580,7 +580,7 @@ ifdef::git-log[]
For following files across renames while traversing history, see
`--follow`.
endif::git-log[]
- If `n` is specified, it is a threshold on the similarity
+ If _<n>_ is specified, it is a threshold on the similarity
index (i.e. amount of addition/deletions compared to the
file's size). For example, `-M90%` means Git should consider a
delete/add pair to be a rename if more than 90% of the file
@@ -590,12 +590,12 @@ endif::git-log[]
the same as `-M5%`. To limit detection to exact renames, use
`-M100%`. The default similarity index is 50%.
--C[<n>]::
---find-copies[=<n>]::
+`-C[<n>]`::
+`--find-copies[=<n>]`::
Detect copies as well as renames. See also `--find-copies-harder`.
- If `n` is specified, it has the same meaning as for `-M<n>`.
+ If _<n>_ is specified, it has the same meaning as for `-M<n>`.
---find-copies-harder::
+`--find-copies-harder`::
For performance reasons, by default, `-C` option finds copies only
if the original file of the copy was modified in the same
changeset. This flag makes the command
@@ -604,8 +604,8 @@ endif::git-log[]
projects, so use it with caution. Giving more than one
`-C` option has the same effect.
--D::
---irreversible-delete::
+`-D`::
+`--irreversible-delete`::
Omit the preimage for deletes, i.e. print only the header but not
the diff between the preimage and `/dev/null`. The resulting patch
is not meant to be applied with `patch` or `git apply`; this is
@@ -617,7 +617,7 @@ endif::git-log[]
When used together with `-B`, omit also the preimage in the deletion part
of a delete/create pair.
--l<num>::
+`-l<num>`::
The `-M` and `-C` options involve some preliminary steps that
can detect subsets of renames/copies cheaply, followed by an
exhaustive fallback portion that compares all remaining
@@ -627,11 +627,11 @@ of a delete/create pair.
destinations, this exhaustive check is O(N^2). This option
prevents the exhaustive portion of rename/copy detection from
running if the number of source/destination files involved
- exceeds the specified number. Defaults to diff.renameLimit.
+ exceeds the specified number. Defaults to `diff.renameLimit`.
Note that a value of 0 is treated as unlimited.
ifndef::git-format-patch[]
---diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]::
+`--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]`::
Select only files that are Added (`A`), Copied (`C`),
Deleted (`D`), Modified (`M`), Renamed (`R`), have their
type (i.e. regular file, symlink, submodule, ...) changed (`T`),
@@ -649,9 +649,9 @@ Also, these upper-case letters can be downcased to exclude. E.g.
Note that not all diffs can feature all types. For instance, copied and
renamed entries cannot appear if detection for those types is disabled.
--S<string>::
+`-S<string>`::
Look for differences that change the number of occurrences of
- the specified string (i.e. addition/deletion) in a file.
+ the specified _<string>_ (i.e. addition/deletion) in a file.
Intended for the scripter's use.
+
It is useful when you're looking for an exact block of code (like a
@@ -662,11 +662,11 @@ very first version of the block.
+
Binary files are searched as well.
--G<regex>::
+`-G<regex>`::
Look for differences whose patch text contains added/removed
- lines that match <regex>.
+ lines that match _<regex>_.
+
-To illustrate the difference between `-S<regex> --pickaxe-regex` and
+To illustrate the difference between `-S<regex>` `--pickaxe-regex` and
`-G<regex>`, consider a commit with the following diff in the same
file:
+
@@ -686,7 +686,7 @@ filter will be ignored.
See the 'pickaxe' entry in linkgit:gitdiffcore[7] for more
information.
---find-object=<object-id>::
+`--find-object=<object-id>`::
Look for differences that change the number of occurrences of
the specified object. Similar to `-S`, just the argument is different
in that it doesn't search for a specific string but for a specific
@@ -695,25 +695,25 @@ information.
The object can be a blob or a submodule commit. It implies the `-t` option in
`git-log` to also find trees.
---pickaxe-all::
+`--pickaxe-all`::
When `-S` or `-G` finds a change, show all the changes in that
changeset, not just the files that contain the change
- in <string>.
+ in _<string>_.
---pickaxe-regex::
- Treat the <string> given to `-S` as an extended POSIX regular
+`--pickaxe-regex`::
+ Treat the _<string>_ given to `-S` as an extended POSIX regular
expression to match.
endif::git-format-patch[]
--O<orderfile>::
+`-O<orderfile>`::
Control the order in which files appear in the output.
This overrides the `diff.orderFile` configuration variable
(see linkgit:git-config[1]). To cancel `diff.orderFile`,
use `-O/dev/null`.
+
The output order is determined by the order of glob patterns in
-<orderfile>.
+_<orderfile>_.
All files with pathnames that match the first pattern are output
first, all files with pathnames that match the second pattern (but not
the first) are output next, and so on.
@@ -724,7 +724,7 @@ If multiple pathnames have the same rank (they match the same pattern
but no earlier patterns), their output order relative to each other is
the normal order.
+
-<orderfile> is parsed as follows:
+_<orderfile>_ is parsed as follows:
+
--
- Blank lines are ignored, so they can be used as separators for
@@ -738,106 +738,107 @@ the normal order.
--
+
Patterns have the same syntax and semantics as patterns used for
-fnmatch(3) without the FNM_PATHNAME flag, except a pathname also
+`fnmatch`(3) without the `FNM_PATHNAME` flag, except a pathname also
matches a pattern if removing any number of the final pathname
components matches the pattern. For example, the pattern "`foo*bar`"
matches "`fooasdfbar`" and "`foo/bar/baz/asdf`" but not "`foobarx`".
---skip-to=<file>::
---rotate-to=<file>::
- Discard the files before the named <file> from the output
+`--skip-to=<file>`::
+`--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 options were invented primarily for the use
of the `git difftool` command, and may not be very useful
otherwise.
ifndef::git-format-patch[]
--R::
+`-R`::
Swap two inputs; that is, show differences from index or
on-disk file to tree contents.
endif::git-format-patch[]
---relative[=<path>]::
---no-relative::
+`--relative[=<path>]`::
+`--no-relative`::
When run from a subdirectory of the project, it can be
told to exclude changes outside the directory and show
pathnames relative to it with this option. When you are
not in a subdirectory (e.g. in a bare repository), you
can name which subdirectory to make the output relative
- to by giving a <path> as an argument.
+ to by giving a _<path>_ as an argument.
`--no-relative` can be used to countermand both `diff.relative` config
option and previous `--relative`.
--a::
---text::
+`-a`::
+`--text`::
Treat all files as text.
---ignore-cr-at-eol::
+`--ignore-cr-at-eol`::
Ignore carriage-return at the end of line when doing a comparison.
---ignore-space-at-eol::
+`--ignore-space-at-eol`::
Ignore changes in whitespace at EOL.
--b::
---ignore-space-change::
+`-b`::
+`--ignore-space-change`::
Ignore changes in amount of whitespace. This ignores whitespace
at line end, and considers all other sequences of one or
more whitespace characters to be equivalent.
--w::
---ignore-all-space::
+`-w`::
+`--ignore-all-space`::
Ignore whitespace when comparing lines. This ignores
differences even if one line has whitespace where the other
line has none.
---ignore-blank-lines::
+`--ignore-blank-lines`::
Ignore changes whose lines are all blank.
--I<regex>::
---ignore-matching-lines=<regex>::
- Ignore changes whose all lines match <regex>. This option may
+
+`-I<regex>`::
+`--ignore-matching-lines=<regex>`::
+ Ignore changes whose all lines match _<regex>_. This option may
be specified more than once.
---inter-hunk-context=<lines>::
- Show the context between diff hunks, up to the specified number
+`--inter-hunk-context=<number>`::
+ Show the context between diff hunks, up to the specified _<number>_
of lines, thereby fusing hunks that are close to each other.
Defaults to `diff.interHunkContext` or 0 if the config option
is unset.
--W::
---function-context::
+`-W`::
+`--function-context`::
Show whole function as context lines for each change.
The function names are determined in the same way as
- `git diff` works out patch hunk headers (see 'Defining a
- custom hunk-header' in linkgit:gitattributes[5]).
+ `git diff` works out patch hunk headers (see "Defining a
+ custom hunk-header" in linkgit:gitattributes[5]).
ifndef::git-format-patch[]
ifndef::git-log[]
---exit-code::
- Make the program exit with codes similar to diff(1).
+`--exit-code`::
+ Make the program exit with codes similar to `diff`(1).
That is, it exits with 1 if there were differences and
0 means no differences.
---quiet::
+`--quiet`::
Disable all output of the program. Implies `--exit-code`.
Disables execution of external diff helpers whose exit code
is not trusted, i.e. their respective configuration option
- `diff.trustExitCode` or `diff.<driver>.trustExitCode` or
+ `diff.trustExitCode` or ++diff.++__<driver>__++.trustExitCode++ or
environment variable `GIT_EXTERNAL_DIFF_TRUST_EXIT_CODE` is
false.
endif::git-log[]
endif::git-format-patch[]
---ext-diff::
+`--ext-diff`::
Allow an external diff helper to be executed. If you set an
external diff driver with linkgit:gitattributes[5], you need
to use this option with linkgit:git-log[1] and friends.
---no-ext-diff::
+`--no-ext-diff`::
Disallow external diff drivers.
---textconv::
---no-textconv::
+`--textconv`::
+`--no-textconv`::
Allow (or disallow) external text conversion filters to be run
when comparing binary files. See linkgit:gitattributes[5] for
details. Because textconv filters are typically a one-way
@@ -847,42 +848,42 @@ endif::git-format-patch[]
linkgit:git-log[1], but not for linkgit:git-format-patch[1] or
diff plumbing commands.
---ignore-submodules[=<when>]::
- Ignore changes to submodules in the diff generation. <when> can be
- either "none", "untracked", "dirty" or "all", which is the default.
- Using "none" will consider the submodule modified when it either contains
- untracked or modified files or its HEAD differs from the commit recorded
+
+`--ignore-submodules[=(none|untracked|dirty|all)]`::
+ Ignore changes to submodules in the diff generation. `all` is the default.
+ Using `none` will consider the submodule modified when it either contains
+ untracked or modified files or its `HEAD` differs from the commit recorded
in the superproject and can be used to override any settings of the
- 'ignore' option in linkgit:git-config[1] or linkgit:gitmodules[5]. When
- "untracked" is used submodules are not considered dirty when they only
+ `ignore` option in linkgit:git-config[1] or linkgit:gitmodules[5]. When
+ `untracked` is used submodules are not considered dirty when they only
contain untracked content (but they are still scanned for modified
- content). Using "dirty" ignores all changes to the work tree of submodules,
+ content). Using `dirty` ignores all changes to the work tree of submodules,
only changes to the commits stored in the superproject are shown (this was
- the behavior until 1.7.0). Using "all" hides all changes to submodules.
+ the behavior until 1.7.0). Using `all` hides all changes to submodules.
---src-prefix=<prefix>::
- Show the given source prefix instead of "a/".
+`--src-prefix=<prefix>`::
+ Show the given source _<prefix>_ instead of "a/".
---dst-prefix=<prefix>::
- Show the given destination prefix instead of "b/".
+`--dst-prefix=<prefix>`::
+ Show the given destination _<prefix>_ instead of "b/".
---no-prefix::
+`--no-prefix`::
Do not show any source or destination prefix.
---default-prefix::
+`--default-prefix`::
Use the default source and destination prefixes ("a/" and "b/").
This overrides configuration variables such as `diff.noprefix`,
`diff.srcPrefix`, `diff.dstPrefix`, and `diff.mnemonicPrefix`
- (see `git-config`(1)).
+ (see linkgit:git-config[1]).
---line-prefix=<prefix>::
- Prepend an additional prefix to every line of output.
+`--line-prefix=<prefix>`::
+ Prepend an additional _<prefix>_ to every line of output.
---ita-invisible-in-index::
- By default entries added by "git add -N" appear as an existing
- empty file in "git diff" and a new file in "git diff --cached".
- This option makes the entry appear as a new file in "git diff"
- and non-existent in "git diff --cached". This option could be
+`--ita-invisible-in-index`::
+ By default entries added by `git add -N` appear as an existing
+ empty file in `git diff` and a new file in `git diff --cached`.
+ This option makes the entry appear as a new file in `git diff`
+ and non-existent in `git diff --cached`. This option could be
reverted with `--ita-visible-in-index`. Both options are
experimental and could be removed in future.
diff --git a/Documentation/fsck-msgids.txt b/Documentation/fsck-msgids.txt
index 68a2801f15..b14bc44ca4 100644
--- a/Documentation/fsck-msgids.txt
+++ b/Documentation/fsck-msgids.txt
@@ -19,12 +19,18 @@
`badParentSha1`::
(ERROR) A commit object has a bad parent sha1.
+`badRefContent`::
+ (ERROR) A ref has bad content.
+
`badRefFiletype`::
(ERROR) A ref has a bad file type.
`badRefName`::
(ERROR) A ref has an invalid format.
+`badReferentName`::
+ (ERROR) The referent name of a symref is invalid.
+
`badTagName`::
(INFO) A tag has an invalid format.
@@ -170,6 +176,35 @@
`nullSha1`::
(WARN) Tree contains entries pointing to a null sha1.
+`refMissingNewline`::
+ (INFO) A loose ref that does not end with newline(LF). As
+ valid implementations of Git never created such a loose ref
+ file, it may become an error in the future. Report to the
+ git@vger.kernel.org mailing list if you see this error, as
+ we need to know what tools created such a file.
+
+`symlinkRef`::
+ (INFO) A symbolic link is used as a symref. Report to the
+ git@vger.kernel.org mailing list if you see this error, as we
+ are assessing the feasibility of dropping the support to drop
+ creating symbolic links as symrefs.
+
+`symrefTargetIsNotARef`::
+ (INFO) The target of a symbolic reference points neither to
+ a root reference nor to a reference starting with "refs/".
+ Although we allow create a symref pointing to the referent which
+ is outside the "ref" by using `git symbolic-ref`, we may tighten
+ the rule in the future. Report to the git@vger.kernel.org
+ mailing list if you see this error, as we need to know what tools
+ created such a file.
+
+`trailingRefContent`::
+ (INFO) A loose ref has trailing content. As valid implementations
+ of Git never created such a loose ref file, it may become an
+ error in the future. Report to the git@vger.kernel.org mailing
+ list if you see this error, as we need to know what tools
+ created such a file.
+
`treeNotSorted`::
(ERROR) A tree is not properly sorted.
diff --git a/Documentation/generate-mergetool-list.sh b/Documentation/generate-mergetool-list.sh
new file mode 100755
index 0000000000..6700498b93
--- /dev/null
+++ b/Documentation/generate-mergetool-list.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if test "$#" -ne 3
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <MODE> <OUTPUT>"
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+TOOL_MODE="$2"
+OUTPUT="$3"
+MERGE_TOOLS_DIR="$SOURCE_DIR/mergetools"
+
+(
+ . "$SOURCE_DIR"/git-mergetool--lib.sh &&
+ show_tool_names can_$TOOL_MODE
+) | sed -e "s/\([a-z0-9]*\)/\`\1\`;;/" >"$OUTPUT"
diff --git a/Documentation/git-bundle.txt b/Documentation/git-bundle.txt
index 504b8a8143..03cd36fe8d 100644
--- a/Documentation/git-bundle.txt
+++ b/Documentation/git-bundle.txt
@@ -32,7 +32,7 @@ Git commands that fetch or otherwise "read" via protocols such as
possible linkgit:git-clone[1] a new repository from a bundle, to use
linkgit:git-fetch[1] to fetch from one, and to list the references
contained within it with linkgit:git-ls-remote[1]. There's no
-corresponding "write" support, i.e.a 'git push' into a bundle is not
+corresponding "write" support, i.e. a 'git push' into a bundle is not
supported.
BUNDLE FORMAT
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 7acb4cb176..de8d8f5893 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -63,6 +63,9 @@ symbolic link, the clone will fail. This is a security measure to
prevent the unintentional copying of files by dereferencing the symbolic
links.
+
+This option does not work with repositories owned by other users for security
+reasons, and `--no-local` must be specified for the clone to succeed.
++
*NOTE*: this operation can race with concurrent modification to the
source repository, similar to running `cp -r <src> <dst>` while modifying
_<src>_.
@@ -384,6 +387,12 @@ $ cd my-linux
$ git clone --bare -l /home/proj/.git /pub/scm/proj.git
------------
+* Clone a local repository from a different user:
++
+------------
+$ git clone --no-local /home/otheruser/proj.git /pub/scm/proj.git
+------------
+
CONFIGURATION
-------------
diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt
index c065f023ec..e19f31e8b9 100644
--- a/Documentation/git-diff.txt
+++ b/Documentation/git-diff.txt
@@ -8,13 +8,13 @@ git-diff - Show changes between commits, commit and working tree, etc
SYNOPSIS
--------
-[verse]
-'git diff' [<options>] [<commit>] [--] [<path>...]
-'git diff' [<options>] --cached [--merge-base] [<commit>] [--] [<path>...]
-'git diff' [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...]
-'git diff' [<options>] <commit>...<commit> [--] [<path>...]
-'git diff' [<options>] <blob> <blob>
-'git diff' [<options>] --no-index [--] <path> <path>
+[synopsis]
+git diff [<options>] [<commit>] [--] [<path>...]
+git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>...]
+git diff [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...]
+git diff [<options>] <commit>...<commit> [--] [<path>...]
+git diff [<options>] <blob> <blob>
+git diff [<options>] --no-index [--] <path> <path>
DESCRIPTION
-----------
@@ -23,7 +23,7 @@ between the index and a tree, changes between two trees, changes resulting
from a merge, changes between two blob objects, or changes between two
files on disk.
-'git diff' [<options>] [--] [<path>...]::
+`git diff [<options>] [--] [<path>...]`::
This form is to view the changes you made relative to
the index (staging area for the next commit). In other
@@ -31,7 +31,7 @@ files on disk.
further add to the index but you still haven't. You can
stage these changes by using linkgit:git-add[1].
-'git diff' [<options>] --no-index [--] <path> <path>::
+`git diff [<options>] --no-index [--] <path> <path>`::
This form is to compare the given two paths on the
filesystem. You can omit the `--no-index` option when
@@ -40,82 +40,82 @@ files on disk.
or when running the command outside a working tree
controlled by Git. This form implies `--exit-code`.
-'git diff' [<options>] --cached [--merge-base] [<commit>] [--] [<path>...]::
+`git diff [<options>] --cached [--merge-base] [<commit>] [--] [<path>...]`::
This form is to view the changes you staged for the next
- commit relative to the named <commit>. Typically you
+ commit relative to the named _<commit>_. Typically you
would want comparison with the latest commit, so if you
- do not give <commit>, it defaults to HEAD.
- If HEAD does not exist (e.g. unborn branches) and
- <commit> is not given, it shows all staged changes.
- --staged is a synonym of --cached.
+ do not give _<commit>_, it defaults to `HEAD`.
+ If `HEAD` does not exist (e.g. unborn branches) and
+ _<commit>_ is not given, it shows all staged changes.
+ `--staged` is a synonym of `--cached`.
+
-If --merge-base is given, instead of using <commit>, use the merge base
-of <commit> and HEAD. `git diff --cached --merge-base A` is equivalent to
+If `--merge-base` is given, instead of using _<commit>_, use the merge base
+of _<commit>_ and `HEAD`. `git diff --cached --merge-base A` is equivalent to
`git diff --cached $(git merge-base A HEAD)`.
-'git diff' [<options>] [--merge-base] <commit> [--] [<path>...]::
+`git diff [<options>] [--merge-base] <commit> [--] [<path>...]`::
This form is to view the changes you have in your
- working tree relative to the named <commit>. You can
- use HEAD to compare it with the latest commit, or a
+ working tree relative to the named _<commit>_. You can
+ use `HEAD` to compare it with the latest commit, or a
branch name to compare with the tip of a different
branch.
+
-If --merge-base is given, instead of using <commit>, use the merge base
-of <commit> and HEAD. `git diff --merge-base A` is equivalent to
+If `--merge-base` is given, instead of using _<commit>_, use the merge base
+of _<commit>_ and `HEAD`. `git diff --merge-base A` is equivalent to
`git diff $(git merge-base A HEAD)`.
-'git diff' [<options>] [--merge-base] <commit> <commit> [--] [<path>...]::
+`git diff [<options>] [--merge-base] <commit> <commit> [--] [<path>...]`::
This is to view the changes between two arbitrary
- <commit>.
+ _<commit>_.
+
-If --merge-base is given, use the merge base of the two commits for the
+If `--merge-base` is given, use the merge base of the two commits for the
"before" side. `git diff --merge-base A B` is equivalent to
`git diff $(git merge-base A B) B`.
-'git diff' [<options>] <commit> <commit>... <commit> [--] [<path>...]::
+`git diff [<options>] <commit> <commit>...<commit> [--] [<path>...]`::
This form is to view the results of a merge commit. The first
- listed <commit> must be the merge itself; the remaining two or
+ listed _<commit>_ must be the merge itself; the remaining two or
more commits should be its parents. Convenient ways to produce
- the desired set of revisions are to use the suffixes `^@` and
- `^!`. If A is a merge commit, then `git diff A A^@`,
+ the desired set of revisions are to use the suffixes `@` and
+ `^!`. If `A` is a merge commit, then `git diff A A^@`,
`git diff A^!` and `git show A` all give the same combined diff.
-'git diff' [<options>] <commit>..<commit> [--] [<path>...]::
+`git diff [<options>] <commit>..<commit> [--] [<path>...]`::
This is synonymous to the earlier form (without the `..`) for
- viewing the changes between two arbitrary <commit>. If <commit> on
+ viewing the changes between two arbitrary _<commit>_. If _<commit>_ on
one side is omitted, it will have the same effect as
- using HEAD instead.
+ using `HEAD` instead.
-'git diff' [<options>] <commit>\...<commit> [--] [<path>...]::
+`git diff [<options>] <commit>...<commit> [--] [<path>...]`::
This form is to view the changes on the branch containing
- and up to the second <commit>, starting at a common ancestor
- of both <commit>. `git diff A...B` is equivalent to
+ and up to the second _<commit>_, starting at a common ancestor
+ of both _<commit>_. `git diff A...B` is equivalent to
`git diff $(git merge-base A B) B`. You can omit any one
- of <commit>, which has the same effect as using HEAD instead.
+ of _<commit>_, which has the same effect as using `HEAD` instead.
Just in case you are doing something exotic, it should be
-noted that all of the <commit> in the above description, except
+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 ref named `AUTO_MERGE`, which is written by the 'ort' merge
+notations, can be any _<tree>_. A tree of interest is the one pointed to
+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).
-For a more complete list of ways to spell <commit>, see
+For a more complete list of ways to spell _<commit>_, see
"SPECIFYING REVISIONS" section in linkgit:gitrevisions[7].
-However, "diff" is about comparing two _endpoints_, not ranges,
-and the range notations (`<commit>..<commit>` and
-`<commit>...<commit>`) do not mean a range as defined in the
+However, `diff` is about comparing two _endpoints_, not ranges,
+and the range notations (`<commit>..<commit>` and `<commit>...<commit>`)
+do not mean a range as defined in the
"SPECIFYING RANGES" section in linkgit:gitrevisions[7].
-'git diff' [<options>] <blob> <blob>::
+`git diff [<options>] <blob> <blob>`::
This form is to view the differences between the raw
contents of two blob objects.
@@ -125,22 +125,31 @@ OPTIONS
:git-diff: 1
include::diff-options.txt[]
--1 --base::
--2 --ours::
--3 --theirs::
- Compare the working tree with the "base" version (stage #1),
- "our branch" (stage #2) or "their branch" (stage #3). The
- index contains these stages only for unmerged entries i.e.
- while resolving conflicts. See linkgit:git-read-tree[1]
- section "3-Way Merge" for detailed information.
+`-1`::
+`--base`::
+`-2`::
+`--ours`::
+`-3`::
+`--theirs`::
+ Compare the working tree with
++
+--
+ * the "base" version (stage #1) when using `-1` or `--base`,
+ * "our branch" (stage #2) when using `-2` or `--ours`, or
+ * "their branch" (stage #3) when using `-3` or `--theirs`.
+--
++
+The index contains these stages only for unmerged entries i.e.
+while resolving conflicts. See linkgit:git-read-tree[1]
+section "3-Way Merge" for detailed information.
--0::
+`-0`::
Omit diff output for unmerged entries and just show
"Unmerged". Can be used only when comparing the working tree
with the index.
-<path>...::
- The <paths> parameters, when given, are used to limit
+`<path>...`::
+ The _<path>_ parameters, when given, are used to limit
the diff to the named paths (you can give directory
names and get diff for all files under them).
@@ -225,11 +234,12 @@ CONFIGURATION
include::includes/cmd-config-section-all.txt[]
+:git-diff: 1
include::config/diff.txt[]
SEE ALSO
--------
-diff(1),
+`diff`(1),
linkgit:git-difftool[1],
linkgit:git-log[1],
linkgit:gitdiffcore[7],
diff --git a/Documentation/git-update-ref.txt b/Documentation/git-update-ref.txt
index 8a4281cde9..9e6935d38d 100644
--- a/Documentation/git-update-ref.txt
+++ b/Documentation/git-update-ref.txt
@@ -93,11 +93,11 @@ update::
ref does not exist before the update.
create::
- Create <ref> with <new-oid> after verifying it does not
+ Create <ref> with <new-oid> after verifying that it does not
exist. The given <new-oid> may not be zero.
delete::
- Delete <ref> after verifying it exists with <old-oid>, if
+ Delete <ref> after verifying that it exists with <old-oid>, if
given. If given, <old-oid> may not be zero.
symref-update::
@@ -110,11 +110,11 @@ verify::
<old-oid> is zero or missing, the ref must not exist.
symref-create:
- Create symbolic ref <ref> with <new-target> after verifying
+ Create symbolic ref <ref> with <new-target> after verifying that
it does not exist.
symref-delete::
- Delete <ref> after verifying it exists with <old-target>, if given.
+ Delete <ref> after verifying that it exists with <old-target>, if given.
symref-verify::
Verify symbolic <ref> against <old-target> but do not change it.
diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt
index 70437c815f..8340b7f028 100644
--- a/Documentation/git-worktree.txt
+++ b/Documentation/git-worktree.txt
@@ -216,6 +216,14 @@ To remove a locked worktree, specify `--force` twice.
This can also be set up as the default behaviour by using the
`worktree.guessRemote` config option.
+--[no-]relative-paths::
+ Link worktrees using relative paths or absolute paths (default).
+ Overrides the `worktree.useRelativePaths` config option, see
+ linkgit:git-config[1].
++
+With `repair`, the linking files will be updated if there's an absolute/relative
+mismatch, even if the links are correct.
+
--[no-]track::
When creating a new branch, if `<commit-ish>` is a branch,
mark it as "upstream" from the new branch. This is the
diff --git a/Documentation/git.txt b/Documentation/git.txt
index d15a869762..81498393af 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -245,17 +245,17 @@ ancillary user utilities.
Main porcelain commands
~~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-mainporcelain.txt[]
+include::{build_dir}/cmds-mainporcelain.txt[]
Ancillary Commands
~~~~~~~~~~~~~~~~~~
Manipulators:
-include::cmds-ancillarymanipulators.txt[]
+include::{build_dir}/cmds-ancillarymanipulators.txt[]
Interrogators:
-include::cmds-ancillaryinterrogators.txt[]
+include::{build_dir}/cmds-ancillaryinterrogators.txt[]
Interacting with Others
@@ -264,7 +264,7 @@ Interacting with Others
These commands are to interact with foreign SCM and with other
people via patch over e-mail.
-include::cmds-foreignscminterface.txt[]
+include::{build_dir}/cmds-foreignscminterface.txt[]
Reset, restore and revert
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -313,13 +313,13 @@ repositories.
Manipulation commands
~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbingmanipulators.txt[]
+include::{build_dir}/cmds-plumbingmanipulators.txt[]
Interrogation commands
~~~~~~~~~~~~~~~~~~~~~~
-include::cmds-plumbinginterrogators.txt[]
+include::{build_dir}/cmds-plumbinginterrogators.txt[]
In general, the interrogate commands do not touch the files in
the working tree.
@@ -328,12 +328,12 @@ the working tree.
Syncing repositories
~~~~~~~~~~~~~~~~~~~~
-include::cmds-synchingrepositories.txt[]
+include::{build_dir}/cmds-synchingrepositories.txt[]
The following are helper commands used by the above; end users
typically do not use them directly.
-include::cmds-synchelpers.txt[]
+include::{build_dir}/cmds-synchelpers.txt[]
Internal helper commands
@@ -342,14 +342,14 @@ Internal helper commands
These are internal helper commands used by other commands; end
users typically do not use them directly.
-include::cmds-purehelpers.txt[]
+include::{build_dir}/cmds-purehelpers.txt[]
Guides
------
The following documentation pages are guides about Git concepts.
-include::cmds-guide.txt[]
+include::{build_dir}/cmds-guide.txt[]
Repository, command and file interfaces
---------------------------------------
@@ -358,7 +358,7 @@ This documentation discusses repository and command interfaces which
users are expected to interact with directly. See `--user-formats` in
linkgit:git-help[1] for more details on the criteria.
-include::cmds-userinterfaces.txt[]
+include::{build_dir}/cmds-userinterfaces.txt[]
File formats, protocols and other developer interfaces
------------------------------------------------------
@@ -367,7 +367,7 @@ This documentation discusses file formats, over-the-wire protocols and
other git developer interfaces. See `--developer-interfaces` in
linkgit:git-help[1].
-include::cmds-developerinterfaces.txt[]
+include::{build_dir}/cmds-developerinterfaces.txt[]
Configuration Mechanism
-----------------------
@@ -477,6 +477,14 @@ their values the same way as Boolean valued configuration variables, e.g.
Here are the variables:
+System
+~~~~~~~~~~~~~~~~~~
+`HOME`::
+ Specifies the path to the user's home directory. On Windows, if
+ unset, Git will set a process environment variable equal to:
+ `$HOMEDRIVE$HOMEPATH` if both `$HOMEDRIVE` and `$HOMEPATH` exist;
+ otherwise `$USERPROFILE` if `$USERPROFILE` exists.
+
The Git Repository
~~~~~~~~~~~~~~~~~~
These environment variables apply to 'all' core Git commands. Nb: it
diff --git a/Documentation/gitcli.txt b/Documentation/gitcli.txt
index 7c709324ba..bd62cbd043 100644
--- a/Documentation/gitcli.txt
+++ b/Documentation/gitcli.txt
@@ -90,6 +90,15 @@ scripting Git:
for long options. An option that takes optional option-argument must be
written in the 'stuck' form.
+ * Despite the above suggestion, when Arg is a path relative to the
+ home directory of a user, e.g. ~/directory/file or ~u/d/f, you
+ may want to use the separate form, e.g. `git foo --file ~/mine`,
+ not `git foo --file=~/mine`. The shell will expand `~/` in the
+ former to your home directory, but most shells keep the tilde in
+ the latter. Some of our commands know how to tilde-expand the
+ option value even when given in the stuck form, but not all of
+ them do.
+
* When you give a revision parameter to a command, make sure the parameter is
not ambiguous with a name of a file in the work tree. E.g. do not write
`git log -1 HEAD` but write `git log -1 HEAD --`; the former will not work
diff --git a/Documentation/gitcredentials.txt b/Documentation/gitcredentials.txt
index 71dd19731a..35a7452c8f 100644
--- a/Documentation/gitcredentials.txt
+++ b/Documentation/gitcredentials.txt
@@ -242,6 +242,12 @@ Here are some example specifications:
[credential]
helper = "foo --bar='whitespace arg'"
+# store helper (discouraged) with custom location for the db file;
+# use `--file ~/.git-secret.txt`, rather than `--file=~/.git-secret.txt`,
+# to allow the shell to expand tilde to the home directory.
+[credential]
+ helper = "store --file ~/.git-secret.txt"
+
# you can also use an absolute path, which will not use the git wrapper
[credential]
helper = "/path/to/my/helper --with-arguments"
diff --git a/Documentation/meson.build b/Documentation/meson.build
new file mode 100644
index 0000000000..f2426ccaa3
--- /dev/null
+++ b/Documentation/meson.build
@@ -0,0 +1,324 @@
+manpages = {
+ # Category 1.
+ 'git-add.txt' : 1,
+ 'git-am.txt' : 1,
+ 'git-annotate.txt' : 1,
+ 'git-apply.txt' : 1,
+ 'git-archimport.txt' : 1,
+ 'git-archive.txt' : 1,
+ 'git-bisect.txt' : 1,
+ 'git-blame.txt' : 1,
+ 'git-branch.txt' : 1,
+ 'git-bugreport.txt' : 1,
+ 'git-bundle.txt' : 1,
+ 'git-cat-file.txt' : 1,
+ 'git-check-attr.txt' : 1,
+ 'git-check-ignore.txt' : 1,
+ 'git-check-mailmap.txt' : 1,
+ 'git-checkout-index.txt' : 1,
+ 'git-checkout.txt' : 1,
+ 'git-check-ref-format.txt' : 1,
+ 'git-cherry-pick.txt' : 1,
+ 'git-cherry.txt' : 1,
+ 'git-citool.txt' : 1,
+ 'git-clean.txt' : 1,
+ 'git-clone.txt' : 1,
+ 'git-column.txt' : 1,
+ 'git-commit-graph.txt' : 1,
+ 'git-commit-tree.txt' : 1,
+ 'git-commit.txt' : 1,
+ 'git-config.txt' : 1,
+ 'git-count-objects.txt' : 1,
+ 'git-credential-cache--daemon.txt' : 1,
+ 'git-credential-cache.txt' : 1,
+ 'git-credential-store.txt' : 1,
+ 'git-credential.txt' : 1,
+ 'git-cvsexportcommit.txt' : 1,
+ 'git-cvsimport.txt' : 1,
+ 'git-cvsserver.txt' : 1,
+ 'git-daemon.txt' : 1,
+ 'git-describe.txt' : 1,
+ 'git-diagnose.txt' : 1,
+ 'git-diff-files.txt' : 1,
+ 'git-diff-index.txt' : 1,
+ 'git-difftool.txt' : 1,
+ 'git-diff-tree.txt' : 1,
+ 'git-diff.txt' : 1,
+ 'git-fast-export.txt' : 1,
+ 'git-fast-import.txt' : 1,
+ 'git-fetch-pack.txt' : 1,
+ 'git-fetch.txt' : 1,
+ 'git-filter-branch.txt' : 1,
+ 'git-fmt-merge-msg.txt' : 1,
+ 'git-for-each-ref.txt' : 1,
+ 'git-for-each-repo.txt' : 1,
+ 'git-format-patch.txt' : 1,
+ 'git-fsck-objects.txt' : 1,
+ 'git-fsck.txt' : 1,
+ 'git-fsmonitor--daemon.txt' : 1,
+ 'git-gc.txt' : 1,
+ 'git-get-tar-commit-id.txt' : 1,
+ 'git-grep.txt' : 1,
+ 'git-gui.txt' : 1,
+ 'git-hash-object.txt' : 1,
+ 'git-help.txt' : 1,
+ 'git-hook.txt' : 1,
+ 'git-http-backend.txt' : 1,
+ 'git-http-fetch.txt' : 1,
+ 'git-http-push.txt' : 1,
+ 'git-imap-send.txt' : 1,
+ 'git-index-pack.txt' : 1,
+ 'git-init-db.txt' : 1,
+ 'git-init.txt' : 1,
+ 'git-instaweb.txt' : 1,
+ 'git-interpret-trailers.txt' : 1,
+ 'git-log.txt' : 1,
+ 'git-ls-files.txt' : 1,
+ 'git-ls-remote.txt' : 1,
+ 'git-ls-tree.txt' : 1,
+ 'git-mailinfo.txt' : 1,
+ 'git-mailsplit.txt' : 1,
+ 'git-maintenance.txt' : 1,
+ 'git-merge-base.txt' : 1,
+ 'git-merge-file.txt' : 1,
+ 'git-merge-index.txt' : 1,
+ 'git-merge-one-file.txt' : 1,
+ 'git-mergetool--lib.txt' : 1,
+ 'git-mergetool.txt' : 1,
+ 'git-merge-tree.txt' : 1,
+ 'git-merge.txt' : 1,
+ 'git-mktag.txt' : 1,
+ 'git-mktree.txt' : 1,
+ 'git-multi-pack-index.txt' : 1,
+ 'git-mv.txt' : 1,
+ 'git-name-rev.txt' : 1,
+ 'git-notes.txt' : 1,
+ 'git-p4.txt' : 1,
+ 'git-pack-objects.txt' : 1,
+ 'git-pack-redundant.txt' : 1,
+ 'git-pack-refs.txt' : 1,
+ 'git-patch-id.txt' : 1,
+ 'git-prune-packed.txt' : 1,
+ 'git-prune.txt' : 1,
+ 'git-pull.txt' : 1,
+ 'git-push.txt' : 1,
+ 'git-quiltimport.txt' : 1,
+ 'git-range-diff.txt' : 1,
+ 'git-read-tree.txt' : 1,
+ 'git-rebase.txt' : 1,
+ 'git-receive-pack.txt' : 1,
+ 'git-reflog.txt' : 1,
+ 'git-refs.txt' : 1,
+ 'git-remote-ext.txt' : 1,
+ 'git-remote-fd.txt' : 1,
+ 'git-remote.txt' : 1,
+ 'git-repack.txt' : 1,
+ 'git-replace.txt' : 1,
+ 'git-replay.txt' : 1,
+ 'git-request-pull.txt' : 1,
+ 'git-rerere.txt' : 1,
+ 'git-reset.txt' : 1,
+ 'git-restore.txt' : 1,
+ 'git-revert.txt' : 1,
+ 'git-rev-list.txt' : 1,
+ 'git-rev-parse.txt' : 1,
+ 'git-rm.txt' : 1,
+ 'git-send-email.txt' : 1,
+ 'git-send-pack.txt' : 1,
+ 'git-shell.txt' : 1,
+ 'git-sh-i18n--envsubst.txt' : 1,
+ 'git-sh-i18n.txt' : 1,
+ 'git-shortlog.txt' : 1,
+ 'git-show-branch.txt' : 1,
+ 'git-show-index.txt' : 1,
+ 'git-show-ref.txt' : 1,
+ 'git-show.txt' : 1,
+ 'git-sh-setup.txt' : 1,
+ 'git-sparse-checkout.txt' : 1,
+ 'git-stage.txt' : 1,
+ 'git-stash.txt' : 1,
+ 'git-status.txt' : 1,
+ 'git-stripspace.txt' : 1,
+ 'git-submodule.txt' : 1,
+ 'git-svn.txt' : 1,
+ 'git-switch.txt' : 1,
+ 'git-symbolic-ref.txt' : 1,
+ 'git-tag.txt' : 1,
+ 'git-unpack-file.txt' : 1,
+ 'git-unpack-objects.txt' : 1,
+ 'git-update-index.txt' : 1,
+ 'git-update-ref.txt' : 1,
+ 'git-update-server-info.txt' : 1,
+ 'git-upload-archive.txt' : 1,
+ 'git-upload-pack.txt' : 1,
+ 'git-var.txt' : 1,
+ 'git-verify-commit.txt' : 1,
+ 'git-verify-pack.txt' : 1,
+ 'git-verify-tag.txt' : 1,
+ 'git-version.txt' : 1,
+ 'git-web--browse.txt' : 1,
+ 'git-whatchanged.txt' : 1,
+ 'git-worktree.txt' : 1,
+ 'git-write-tree.txt' : 1,
+ 'git.txt' : 1,
+ 'gitk.txt' : 1,
+ 'gitweb.txt' : 1,
+ 'scalar.txt' : 1,
+
+ # Category 5.
+ 'gitattributes.txt' : 5,
+ 'gitformat-bundle.txt' : 5,
+ 'gitformat-chunk.txt' : 5,
+ 'gitformat-commit-graph.txt' : 5,
+ 'gitformat-index.txt' : 5,
+ 'gitformat-pack.txt' : 5,
+ 'gitformat-signature.txt' : 5,
+ 'githooks.txt' : 5,
+ 'gitignore.txt' : 5,
+ 'gitmailmap.txt' : 5,
+ 'gitmodules.txt' : 5,
+ 'gitprotocol-capabilities.txt' : 5,
+ 'gitprotocol-common.txt' : 5,
+ 'gitprotocol-http.txt' : 5,
+ 'gitprotocol-pack.txt' : 5,
+ 'gitprotocol-v2.txt' : 5,
+ 'gitrepository-layout.txt' : 5,
+ 'gitweb.conf.txt' : 5,
+
+ # Category 7.
+ 'gitcli.txt' : 7,
+ 'gitcore-tutorial.txt' : 7,
+ 'gitcredentials.txt' : 7,
+ 'gitcvs-migration.txt' : 7,
+ 'gitdiffcore.txt' : 7,
+ 'giteveryday.txt' : 7,
+ 'gitfaq.txt' : 7,
+ 'gitglossary.txt' : 7,
+ 'gitpacking.txt' : 7,
+ 'gitnamespaces.txt' : 7,
+ 'gitremote-helpers.txt' : 7,
+ 'gitrevisions.txt' : 7,
+ 'gitsubmodules.txt' : 7,
+ 'gittutorial-2.txt' : 7,
+ 'gittutorial.txt' : 7,
+ 'gitworkflows.txt' : 7,
+}
+
+asciidoc = find_program('asciidoc')
+git = find_program('git', required: false)
+xmlto = find_program('xmlto')
+
+asciidoc_conf = custom_target(
+ command: [
+ shell,
+ meson.project_source_root() / 'GIT-VERSION-GEN',
+ meson.project_source_root(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'asciidoc.conf.in',
+ output: 'asciidoc.conf',
+ depends: [git_version_file],
+)
+
+asciidoc_common_options = [
+ asciidoc,
+ '--conf-file=' + asciidoc_conf.full_path(),
+ '--attribute=build_dir=' + meson.current_build_dir(),
+]
+
+cmd_lists = [
+ 'cmds-ancillaryinterrogators.txt',
+ 'cmds-ancillarymanipulators.txt',
+ 'cmds-mainporcelain.txt',
+ 'cmds-plumbinginterrogators.txt',
+ 'cmds-plumbingmanipulators.txt',
+ 'cmds-synchingrepositories.txt',
+ 'cmds-synchelpers.txt',
+ 'cmds-guide.txt',
+ 'cmds-developerinterfaces.txt',
+ 'cmds-userinterfaces.txt',
+ 'cmds-purehelpers.txt',
+ 'cmds-foreignscminterface.txt',
+]
+
+documentation_deps = [
+ asciidoc_conf,
+]
+
+documentation_deps += custom_target(
+ command: [
+ perl,
+ meson.current_source_dir() / 'cmd-list.perl',
+ meson.project_source_root(),
+ meson.current_build_dir(),
+ ] + cmd_lists,
+ output: cmd_lists
+)
+
+foreach mode : [ 'diff', 'merge' ]
+ documentation_deps += custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'generate-mergetool-list.sh',
+ '..',
+ 'diff',
+ '@OUTPUT@'
+ ],
+ env: [
+ 'MERGE_TOOLS_DIR=' + meson.project_source_root() / 'mergetools',
+ 'TOOL_MODE=' + mode,
+ ],
+ output: 'mergetools-' + mode + '.txt',
+ )
+endforeach
+
+foreach manpage, category : manpages
+ if get_option('docs').contains('man')
+ manpage_xml_target = custom_target(
+ command: asciidoc_common_options + [
+ '--backend=docbook',
+ '--doctype=manpage',
+ '--out-file=@OUTPUT@',
+ meson.current_source_dir() / manpage,
+ ],
+ depends: documentation_deps,
+ output: fs.stem(manpage) + '.xml',
+ )
+
+ manpage_path = fs.stem(manpage) + '.' + category.to_string()
+ manpage_target = custom_target(
+ command: [
+ xmlto,
+ '-m',
+ meson.current_source_dir() / 'manpage-normal.xsl',
+ '-m',
+ meson.current_source_dir() / 'manpage-bold-literal.xsl',
+ '--stringparam',
+ 'man.base.url.for.relative.links=' + get_option('prefix') / get_option('mandir'),
+ 'man',
+ manpage_xml_target,
+ '-o',
+ meson.current_build_dir(),
+ ],
+ output: manpage_path,
+ install: true,
+ install_dir: get_option('mandir') / 'man' + category.to_string(),
+ )
+ endif
+
+ if get_option('docs').contains('html') and category == 1
+ custom_target(
+ command: asciidoc_common_options + [
+ '--backend=xhtml11',
+ '--doctype=manpage',
+ '--out-file=@OUTPUT@',
+ meson.current_source_dir() / manpage,
+ ],
+ depends: documentation_deps,
+ output: fs.stem(manpage) + '.html',
+ install: true,
+ install_dir: get_option('datadir') / 'doc/git-doc',
+ )
+ endif
+endforeach
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 00ccf68744..459e5a02f5 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -412,7 +412,8 @@ Default mode::
--ancestry-path[=<commit>]::
When given a range of commits to display (e.g. 'commit1..commit2'
- or 'commit2 {caret}commit1'), only display commits in that range
+ or 'commit2 {caret}commit1'), and a commit <commit> in that range,
+ only display commits in that range
that are ancestors of <commit>, descendants of <commit>, or
<commit> itself. If no commit is specified, use 'commit1' (the
excluded part of the range) as <commit>. Can be passed multiple
diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt
new file mode 100644
index 0000000000..d9dafb407c
--- /dev/null
+++ b/Documentation/technical/build-systems.txt
@@ -0,0 +1,224 @@
+= Build Systems
+
+The build system is the primary way for both developers and system integrators
+to interact with the Git project. As such, being easy to use and extend for
+those who are not directly developing Git itself is just as important as other
+requirements we have on any potential build system.
+
+This document outlines the different requirements that we have for the build
+system and then compares available build systems using these criteria.
+
+== Requirements
+
+The following subsections present a list of requirements that we have for any
+potential build system. Sections are sorted by decreasing priority.
+
+=== Platform support
+
+The build system must have support for all of our platforms that we continually
+test against as outlined by our platform support policy. These platforms are:
+
+ - Linux
+ - Windows
+ - macOS
+
+Furthermore, the build system should have support for the following platforms
+that generally have somebody running test pipelines against regularly:
+
+ - AIX
+ - FreeBSD
+ - NetBSD
+ - NonStop
+ - OpenBSD
+
+The platforms which must be supported by the tool should be aligned with our
+[platform support policy](platform-support.txt).
+
+=== Auto-detection of supported features
+
+The build system must support auto-detection of features which are or aren't
+available on the current platform. Platform maintainers should not be required
+to manually configure the complete build.
+
+Auto-detection of the following items is considered to be important:
+
+ - Check for the existence of headers.
+ - Check for the existence of libraries.
+ - Check for the existence of exectuables.
+ - Check for the runtime behavior of specific functions.
+ - Check for specific link order requirements when multiple libraries are
+ involved.
+
+=== Ease of use
+
+The build system should be both easy to use and easy to extend. While this is
+naturally a subjective metric it is likely not controversial to say that some
+build systems are considerably harder to use than others.
+
+=== IDE support
+
+The build system should integrate with well-known IDEs. Well-known IDEs include:
+
+ - Microsoft Visual Studio
+ - Visual Studio Code
+ - Xcode
+
+There are four levels of support:
+
+ - Native integration into the IDE.
+ - Integration into the IDE via a plugin.
+ - Integration into the IDE via generating a project description with the build
+ system.
+ - No integration.
+
+Native integration is preferable, but integration via either a plugin or by
+generating a project description via the build system are considered feasible
+alternatives.
+
+Another important distinction is the level of integration. There are two
+features that one generally wants to have:
+
+ - Integration of build targets.
+ - Automatic setup of features like code completion with detected build
+ dependencies.
+
+The first bullet point is the bare minimum, but is not sufficient to be
+considered proper integration.
+
+=== Out-of-tree builds
+
+The build system should support out-of-tree builds. Out-of-tree builds allow a
+developer to configure multiple different build directories with different
+configuration, e.g. one "debug" build and one "release" build.
+
+=== Cross-platform builds
+
+The build system should support cross-platform builds, e.g. building for arm on
+an x86-64 host.
+
+=== Language support
+
+The following languages and toolchains are of relevance and should be supported
+by the build system:
+
+ - C: the primary compiled language used by Git, must be supported. Relevant
+ toolchains are GCC, Clang and MSVC.
+ - Rust: candidate as a second compiled lanugage, should be supported. Relevant
+ toolchains is the LLVM-based rustc.
+
+Built-in support for the respective languages is preferred over support that
+needs to be wired up manually to avoid unnecessary complexity. Native support
+includes the following features:
+
+ - Compiling objects.
+ - Dependency tracking.
+ - Detection of available features.
+ - Discovery of relevant toolchains.
+ - Linking libraries and executables.
+ - Templating placeholders in scripts.
+
+=== Test integration
+
+It should be possible to integrate tests into the build system such that it is
+possible to build and test Git within the build system. Features which are nice
+to have:
+
+ - Track build-time dependencies for respective tests. Unit tests have
+ different requirements than integration tests.
+ - Allow filtering of which tests to run.
+ - Allow running tests such that utilities like `test_pause` or `debug` work.
+
+== Comparison
+
+The following list of build systems are considered:
+
+- GNU Make
+- autoconf
+- CMake
+- Meson
+
+=== GNU Make
+
+- Platform support: ubitquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: no built-in support for auto-detection of features.
+- Ease of use: easy to use, but discovering available options is hard. Makefile
+ rules can quickly get out of hand once reaching a certain scope.
+- IDE support: execution of Makefile targets is supported by many IDEs
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported in theory, not wired up in practice.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== autoconf
+
+- Platform support: ubiquitous on all platforms, but not well-integrated into Windows.
+- Auto-detection: supported.
+- Ease of use: easy to use, discovering available options is comparatively
+ easy. The autoconf syntax is prohibitively hard to extend though due to its
+ complex set of interacting files and the hard-to-understand M4 language.
+- IDE support: no integration into IDEs at generation time. The generated
+ Makefiles have the same level of support as GNU Make.
+- Out-of-tree builds: supported in theory, not wired up in practice.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Limited built-in support, many parts need to be wired up manually.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: partially supported, many parts need to be wired up
+ manually.
+
+=== CMake
+
+- Platform support: not as extensive as GNU Make or autoconf, but all major
+ platforms are supported.
+ - AIX
+ - Cygwin
+ - FreeBSD
+ - Linux
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is not always
+ trivial. The scripting language used by CMake is somewhat cumbersome to use,
+ but extending CMake build instructions is doable.
+- IDE support: natively integrated into Microsoft Visual Studio. Can generate
+ project descriptions for Xcode. An extension is available for Visual Studio
+ Code. Many other IDEs have plugins for CMake.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: No built-in support, needs to be wired up manually.
+- Test integration: supported, even though test dependencies are a bit
+ cumbersome to use via "test fixtures". Interactive test runs are not
+ supported.
+
+=== Meson
+
+- Platform: not as extensive as GNU Make or autoconf, but all major platforms
+ and some smaller ones are supported.
+ - AIX
+ - Cygwin
+ - DragonflyBSD
+ - FreeBSD
+ - Haiku
+ - Linux
+ - NetBSD
+ - OpenBSD
+ - Solaris
+ - Windows
+ - macOS
+- Ease of use: easy to use, discovering available options is easy. The
+ scripting language is straight-forward to use.
+- IDE support: Supports generating build instructions for Xcode and Microsoft
+ Visual Studio, a plugin exists for Visual Studio Code.
+- Out-of-tree builds: supported.
+- Cross-platform builds: supported.
+- Language support:
+ - C: Supported for GCC, Clang, MSVC and other toolchains.
+ - Rust: Supported for rustc.
+- Test integration: supported. Interactive tests are supported starting with
+ Meson 1.5.0 via the `--interactive` flag.
diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
new file mode 100644
index 0000000000..f651116102
--- /dev/null
+++ b/GIT-BUILD-OPTIONS.in
@@ -0,0 +1,47 @@
+SHELL_PATH=@SHELL_PATH@
+TEST_SHELL_PATH=@TEST_SHELL_PATH@
+PERL_PATH=@PERL_PATH@
+PERL_LOCALEDIR=@PERL_LOCALEDIR@
+NO_PERL_CPAN_FALLBACKS=@NO_PERL_CPAN_FALLBACKS@
+DIFF=@DIFF@
+PYTHON_PATH=@PYTHON_PATH@
+TAR=@TAR@
+NO_CURL=@NO_CURL@
+NO_ICONV=@NO_ICONV@
+NO_EXPAT=@NO_EXPAT@
+USE_LIBPCRE2=@USE_LIBPCRE2@
+NO_PERL=@NO_PERL@
+NO_PTHREADS=@NO_PTHREADS@
+NO_PYTHON=@NO_PYTHON@
+NO_REGEX=@NO_REGEX@
+NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@
+PAGER_ENV=@PAGER_ENV@
+SANITIZE_LEAK=@SANITIZE_LEAK@
+SANITIZE_ADDRESS=@SANITIZE_ADDRESS@
+X=@X@
+FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@
+FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@
+TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@
+GIT_TEST_OPTS=@GIT_TEST_OPTS@
+GIT_TEST_CMP=@GIT_TEST_CMP@
+GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
+GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
+NO_GETTEXT=@NO_GETTEXT@
+GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
+GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@
+GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
+GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
+GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@
+GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
+GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
+GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
+GIT_TEST_POPATH=@GIT_TEST_POPATH@
+GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
+GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
+GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
+RUNTIME_PREFIX=@RUNTIME_PREFIX@
+GITWEBDIR=@GITWEBDIR@
+USE_GETTEXT_SCHEME=@USE_GETTEXT_SCHEME@
+LOCALEDIR=@LOCALEDIR@
+BROKEN_PATH_FIX=@BROKEN_PATH_FIX@
diff --git a/GIT-VERSION-FILE.in b/GIT-VERSION-FILE.in
new file mode 100644
index 0000000000..3789a48a34
--- /dev/null
+++ b/GIT-VERSION-FILE.in
@@ -0,0 +1 @@
+GIT_VERSION=@GIT_VERSION@
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 78e8631f67..de0e63bdfb 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,23 +1,48 @@
#!/bin/sh
-GVF=GIT-VERSION-FILE
-DEF_VER=v2.47.GIT
+DEF_VER=v2.48.0-rc0
LF='
'
+if test "$#" -ne 3
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
+SOURCE_DIR="$1"
+INPUT="$2"
+OUTPUT="$3"
+
+if ! test -f "$INPUT"
+then
+ echo >&2 "Input is not a file: $INPUT"
+ exit 1
+fi
+
+# Protect us from reading Git version information outside of the Git directory
+# in case it is not a repository itself, but embedded in an unrelated
+# repository.
+GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.."
+export GIT_CEILING_DIRECTORIES
+
# First see if there is a version file (included in release tarballs),
# then try git-describe, then default.
-if test -f version
+if test -f "$SOURCE_DIR"/version
then
- VN=$(cat version) || VN="$DEF_VER"
-elif { test -d "${GIT_DIR:-.git}" || test -f .git; } &&
- VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null) &&
+ VN=$(cat "$SOURCE_DIR"/version) || VN="$DEF_VER"
+elif {
+ test -d "$SOURCE_DIR/.git" ||
+ test -d "${GIT_DIR:-.git}" ||
+ test -f "$SOURCE_DIR"/.git;
+ } &&
+ VN=$(git -C "$SOURCE_DIR" describe --match "v[0-9]*" HEAD 2>/dev/null) &&
case "$VN" in
*$LF*) (exit 1) ;;
v[0-9]*)
- git update-index -q --refresh
- test -z "$(git diff-index --name-only HEAD --)" ||
+ git -C "$SOURCE_DIR" update-index -q --refresh
+ test -z "$(git -C "$SOURCE_DIR" diff-index --name-only HEAD --)" ||
VN="$VN-dirty" ;;
esac
then
@@ -26,15 +51,34 @@ else
VN="$DEF_VER"
fi
-VN=$(expr "$VN" : v*'\(.*\)')
+GIT_VERSION=$(expr "$VN" : v*'\(.*\)')
+GIT_BUILT_FROM_COMMIT=$(git -C "$SOURCE_DIR" rev-parse -q --verify HEAD 2>/dev/null)
+GIT_DATE=$(git -C "$SOURCE_DIR" show --quiet --format='%as' 2>/dev/null)
+if test -z "$GIT_USER_AGENT"
+then
+ GIT_USER_AGENT="git/$GIT_VERSION"
+fi
+
+# While released Git versions only have three numbers, development builds also
+# have a fourth number that corresponds to the number of patches since the last
+# release.
+read GIT_MAJOR_VERSION GIT_MINOR_VERSION GIT_MICRO_VERSION GIT_PATCH_LEVEL trailing <<EOF
+$(echo "$GIT_VERSION" 0 0 0 0 | tr '.a-zA-Z-' ' ')
+EOF
+
+sed -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_MAJOR_VERSION@|$GIT_MAJOR_VERSION|" \
+ -e "s|@GIT_MINOR_VERSION@|$GIT_MINOR_VERSION|" \
+ -e "s|@GIT_MICRO_VERSION@|$GIT_MICRO_VERSION|" \
+ -e "s|@GIT_PATCH_LEVEL@|$GIT_PATCH_LEVEL|" \
+ -e "s|@GIT_BUILT_FROM_COMMIT@|$GIT_BUILT_FROM_COMMIT|" \
+ -e "s|@GIT_USER_AGENT@|$GIT_USER_AGENT|" \
+ -e "s|@GIT_DATE@|$GIT_DATE|" \
+ "$INPUT" >"$OUTPUT"+
-if test -r $GVF
+if ! test -f "$OUTPUT" || ! cmp "$OUTPUT"+ "$OUTPUT" >/dev/null
then
- VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
+ mv "$OUTPUT"+ "$OUTPUT"
else
- VC=unset
+ rm "$OUTPUT"+
fi
-test "$VN" = "$VC" || {
- echo >&2 "GIT_VERSION = $VN"
- echo "GIT_VERSION = $VN" >$GVF
-}
diff --git a/INSTALL b/INSTALL
index 2a46d04592..54d7528f9e 100644
--- a/INSTALL
+++ b/INSTALL
@@ -119,7 +119,7 @@ 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.1 or later is needed to use some of the
+ - "Perl" version 5.26.0 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
@@ -129,17 +129,12 @@ Issues of note:
itself, e.g. Digest::MD5, File::Spec, File::Temp, Net::Domain,
Net::SMTP, and Time::HiRes.
- - git-imap-send needs the OpenSSL library to talk IMAP over SSL if
- you are using libcurl older than 7.34.0. Otherwise you can use
- NO_OPENSSL without losing git-imap-send.
-
- "libcurl" library is used for fetching and pushing
repositories over http:// or https://, as well as by
- git-imap-send if the curl version is >= 7.34.0. If you do
- not need that functionality, use NO_CURL to build without
- it.
+ git-imap-send. If you do not need that functionality,
+ use NO_CURL to build without it.
- Git requires version "7.21.3" or later of "libcurl" to build
+ Git requires version "7.61.0" or later of "libcurl" to build
without NO_CURL. This version requirement may be bumped in
the future.
diff --git a/Makefile b/Makefile
index 549b24e7fd..79739a13d2 100644
--- a/Makefile
+++ b/Makefile
@@ -592,7 +592,10 @@ include shared.mak
# Disable -pedantic compilation.
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @OLD=$$(cat $@ 2>/dev/null || :) && \
+ $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" GIT-VERSION-FILE.in $@ && \
+ NEW=$$(cat $@ 2>/dev/null || :) && \
+ if test "$$OLD" != "$$NEW"; then echo "$$NEW" >&2; fi
-include GIT-VERSION-FILE
# Set our default configuration.
@@ -1555,10 +1558,10 @@ endif
ifdef SANE_TOOL_PATH
SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
-BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|'
+BROKEN_PATH_FIX = s|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|
PATH := $(SANE_TOOL_PATH):${PATH}
else
-BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
+BROKEN_PATH_FIX = /^\# @BROKEN_PATH_FIX@$$/d
endif
ifeq (,$(HOST_CPU))
@@ -2422,9 +2425,12 @@ endif
FUZZ_OBJS += oss-fuzz/dummy-cmd-main.o
FUZZ_OBJS += oss-fuzz/fuzz-commit-graph.o
FUZZ_OBJS += oss-fuzz/fuzz-config.o
+FUZZ_OBJS += oss-fuzz/fuzz-credential-from-url-gently.o
FUZZ_OBJS += oss-fuzz/fuzz-date.o
FUZZ_OBJS += oss-fuzz/fuzz-pack-headers.o
FUZZ_OBJS += oss-fuzz/fuzz-pack-idx.o
+FUZZ_OBJS += oss-fuzz/fuzz-parse-attr-line.o
+FUZZ_OBJS += oss-fuzz/fuzz-url-decode-mem.o
.PHONY: fuzz-objs
fuzz-objs: $(FUZZ_OBJS)
@@ -2505,13 +2511,11 @@ PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
-version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
-version.sp version.s version.o: EXTRA_CPPFLAGS = \
- '-DGIT_VERSION="$(GIT_VERSION)"' \
- '-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
- '-DGIT_BUILT_FROM_COMMIT="$(shell \
- GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
- git rev-parse -q --verify HEAD 2>/dev/null)"'
+version-def.h: version-def.h.in GIT-VERSION-GEN GIT-VERSION-FILE GIT-USER-AGENT
+ $(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+
+version.sp version.s version.o: version-def.h
$(BUILT_INS): git$X
$(QUIET_BUILT_IN)$(RM) $@ && \
@@ -2522,17 +2526,17 @@ $(BUILT_INS): git$X
config-list.h: generate-configlist.sh
config-list.h: Documentation/*config.txt Documentation/config/*.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@
command-list.h: generate-cmdlist.sh command-list.txt
command-list.h: $(wildcard Documentation/git*.txt)
$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
- command-list.txt >$@
+ . $@
hook-list.h: generate-hooklist.sh Documentation/githooks.txt
- $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@
+ $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@
SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\
$(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
@@ -2545,33 +2549,16 @@ GIT-SCRIPT-DEFINES: FORCE
echo "$$FLAGS" >$@; \
fi
-define cmd_munge_script
-sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@@DIFF@@|$(DIFF_SQ)|' \
- -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \
- -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \
- -e $(BROKEN_PATH_FIX) \
- -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
- -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
- -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \
- $@.sh >$@+
-endef
-
-$(SCRIPT_SH_GEN) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
- chmod +x $@+ && \
+$(SCRIPT_SH_GEN) $(SCRIPT_LIB) : % : %.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
mv $@+ $@
-$(SCRIPT_LIB) : % : %.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
- mv $@+ $@
+git.rc: git.rc.in GIT-VERSION-GEN GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) ./GIT-VERSION-GEN "$(shell pwd)" $< $@+
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
-git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
- $(QUIET_RC)$(RC) \
- $(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
- $(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
- -DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@
+git.res: git.rc GIT-PREFIX
+ $(QUIET_RC)$(RC) -i $< -o $@
# This makes sure we depend on the NO_PERL setting itself.
$(SCRIPT_PERL_GEN): GIT-BUILD-OPTIONS
@@ -2604,16 +2591,8 @@ endif
PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir)
-$(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
- $(QUIET_GEN) \
- sed -e '1{' \
- -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- -e ' r GIT-PERL-HEADER' \
- -e ' G' \
- -e '}' \
- -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
- $< >$@+ && \
- chmod +x $@+ && \
+$(SCRIPT_PERL_GEN): % : %.perl generate-perl.sh GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@+" && \
mv $@+ $@
PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES))
@@ -2629,11 +2608,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
INSTLIBDIR='$(perllibdir_SQ)' && \
INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \
INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \
- sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
- -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
- -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
- -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
- -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
+ sed -e 's=@PATHSEP@=$(pathsep)=g' \
+ -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \
+ -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \
+ -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \
+ -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \
$< >$@+ && \
mv $@+ $@
@@ -2641,15 +2620,15 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
perllibdir:
@echo '$(perllibdir_SQ)'
-git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
- $(QUIET_GEN)$(cmd_munge_script) && \
+git-instaweb: git-instaweb.sh generate-script.sh GIT-BUILD-OPTIONS GIT-SCRIPT-DEFINES
+ $(QUIET_GEN)./generate-script.sh "$<" "$@+" ./GIT-BUILD-OPTIONS && \
chmod +x $@+ && \
mv $@+ $@
else # NO_PERL
$(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \
+ -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2659,24 +2638,20 @@ endif # NO_PERL
$(SCRIPT_PYTHON_GEN): GIT-BUILD-OPTIONS
ifndef NO_PYTHON
-$(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
+$(SCRIPT_PYTHON_GEN): generate-python.sh
$(SCRIPT_PYTHON_GEN): % : %.py
- $(QUIET_GEN) \
- sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
- $< >$@+ && \
- chmod +x $@+ && \
- mv $@+ $@
+ $(QUIET_GEN)$(SHELL_PATH) generate-python.sh ./GIT-BUILD-OPTIONS "$<" "$@"
else # NO_PYTHON
$(SCRIPT_PYTHON_GEN): % : unimplemented.sh
$(QUIET_GEN) \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \
+ -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \
unimplemented.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
endif # NO_PYTHON
-CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \
configure.ac >configure.ac+ && \
autoconf -o configure configure.ac+ && \
$(RM) configure.ac+
@@ -2722,6 +2697,7 @@ REFTABLE_OBJS += reftable/pq.o
REFTABLE_OBJS += reftable/reader.o
REFTABLE_OBJS += reftable/record.o
REFTABLE_OBJS += reftable/stack.o
+REFTABLE_OBJS += reftable/system.o
REFTABLE_OBJS += reftable/tree.o
REFTABLE_OBJS += reftable/writer.o
@@ -3101,13 +3077,9 @@ endif
NO_PERL_CPAN_FALLBACKS_SQ = $(subst ','\'',$(NO_PERL_CPAN_FALLBACKS))
endif
-perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES
+perl/build/lib/%.pm: perl/%.pm generate-perl.sh GIT-BUILD-OPTIONS GIT-VERSION-FILE GIT-PERL-DEFINES
$(call mkdir_p_parent_template)
- $(QUIET_GEN) \
- sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \
- -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \
- -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \
- < $< > $@
+ $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh ./GIT-BUILD-OPTIONS ./GIT-VERSION-FILE GIT-PERL-HEADER "$<" "$@"
perl/build/man/man3/Git.3pm: perl/Git.pm
$(call mkdir_p_parent_template)
@@ -3160,80 +3132,66 @@ GIT-LDFLAGS: FORCE
echo "$$FLAGS" >GIT-LDFLAGS; \
fi
+ifdef RUNTIME_PREFIX
+RUNTIME_PREFIX_OPTION = true
+else
+RUNTIME_PREFIX_OPTION = false
+endif
+
# We need to apply sq twice, once to protect from the shell
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
- @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
- @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+
- @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
- @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
- @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
- @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
- @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
- @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
- @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
- @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
- @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
- @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
- @echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+
- @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
- @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
- @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
- @echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
- @echo X=\'$(X)\' >>$@+
-ifdef FSMONITOR_DAEMON_BACKEND
- @echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+
-endif
-ifdef FSMONITOR_OS_SETTINGS
- @echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+
-endif
-ifdef TEST_OUTPUT_DIRECTORY
- @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
-endif
-ifdef GIT_TEST_OPTS
- @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP
- @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
-endif
-ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
- @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
-endif
-ifdef GIT_TEST_UTF8_LOCALE
- @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+
-endif
- @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
-ifdef GIT_PERF_REPEAT_COUNT
- @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
-endif
-ifdef GIT_PERF_REPO
- @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_LARGE_REPO
- @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_OPTS
- @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_PERF_MAKE_COMMAND
- @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
-endif
-ifdef GIT_INTEROP_MAKE_OPTS
- @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
-endif
-ifdef GIT_TEST_INDEX_VERSION
- @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+
-endif
-ifdef GIT_TEST_PERL_FATAL_WARNINGS
- @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+
-endif
-ifdef RUNTIME_PREFIX
- @echo RUNTIME_PREFIX=\'true\' >>$@+
-else
- @echo RUNTIME_PREFIX=\'false\' >>$@+
-endif
+ @sed \
+ -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \
+ -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \
+ -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \
+ -e "s|@PERL_LOCALEDIR@|\'$(perl_localedir_SQ)\'|" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|\'$(NO_PERL_CPAN_FALLBACKS_SQ)\'|" \
+ -e "s|@DIFF@|\'$(DIFF)\'|" \
+ -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \
+ -e "s|@TAR@|\'$(TAR)\'|" \
+ -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \
+ -e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \
+ -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \
+ -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \
+ -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \
+ -e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \
+ -e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \
+ -e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \
+ -e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \
+ -e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \
+ -e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \
+ -e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \
+ -e "s|@X@|\'$(X)\'|" \
+ -e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \
+ -e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \
+ -e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \
+ -e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
+ -e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \
+ -e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \
+ -e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
+ -e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \
+ -e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
+ -e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+ -e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \
+ -e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
+ -e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \
+ -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \
+ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
+ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
+ -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
+ -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
+ -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
+ -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
+ -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
+ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX_OPTION)\'|" \
+ -e "s|@GITWEBDIR@|\'$(gitwebdir_SQ)\'|" \
+ -e "s|@USE_GETTEXT_SCHEME@|\'$(USE_GETTEXT_SCHEME)\'|" \
+ -e "s|@LOCALEDIR@|\'$(localedir_SQ)\'|" \
+ -e "s!@BROKEN_PATH_FIX@!\'$(BROKEN_PATH_FIX)\'!" \
+ GIT-BUILD-OPTIONS.in >$@+
+ @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
@if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
@@ -3253,11 +3211,14 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $(
all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
-bin-wrappers/%: wrap-for-bin.sh
- $(call mkdir_p_parent_template)
+$(test_bindir_programs): bin-wrappers/%: bin-wrappers/wrap-for-bin.sh
$(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@BUILD_DIR@@|$(shell pwd)|' \
- -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
+ -e 's|@BUILD_DIR@|$(shell pwd)|' \
+ -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \
+ -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \
+ -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \
+ -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \
+ -e 's|@PROG@|$(shell pwd)/$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \
chmod +x $@
# GNU make supports exporting all variables by "export" without parameters.
@@ -3741,7 +3702,7 @@ clean: profile-clean coverage-clean cocciclean
$(RM) -r .build $(UNIT_TEST_BIN)
$(RM) GIT-TEST-SUITES
$(RM) po/git.pot po/git-core.pot
- $(RM) git.res
+ $(RM) git.rc git.res
$(RM) $(OBJECTS)
$(RM) headless-git.o
$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB)
@@ -3750,7 +3711,9 @@ clean: profile-clean coverage-clean cocciclean
$(RM) $(FUZZ_PROGRAMS)
$(RM) $(SP_OBJ)
$(RM) $(HCC)
- $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) version-def.h
+ $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json
+ $(RM) $(test_bindir_programs)
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r .dist-tmp-dir .doc-tmp-dir
diff --git a/advice.c b/advice.c
index 6b879d805c..e3dd8b468c 100644
--- a/advice.c
+++ b/advice.c
@@ -53,6 +53,7 @@ static struct {
[ADVICE_COMMIT_BEFORE_MERGE] = { "commitBeforeMerge" },
[ADVICE_DETACHED_HEAD] = { "detachedHead" },
[ADVICE_DIVERGING] = { "diverging" },
+ [ADVICE_FETCH_SET_HEAD_WARN] = { "fetchRemoteHEADWarn" },
[ADVICE_FETCH_SHOW_FORCED_UPDATES] = { "fetchShowForcedUpdates" },
[ADVICE_FORCE_DELETE_BRANCH] = { "forceDeleteBranch" },
[ADVICE_GRAFT_FILE_DEPRECATED] = { "graftFileDeprecated" },
@@ -93,7 +94,7 @@ static struct {
static const char turn_off_instructions[] =
N_("\n"
- "Disable this message with \"git config advice.%s false\"");
+ "Disable this message with \"git config set advice.%s false\"");
static void vadvise(const char *advice, int display_instructions,
const char *key, va_list params)
diff --git a/advice.h b/advice.h
index d7466bc0ef..cf2284ec43 100644
--- a/advice.h
+++ b/advice.h
@@ -20,6 +20,7 @@ enum advice_type {
ADVICE_COMMIT_BEFORE_MERGE,
ADVICE_DETACHED_HEAD,
ADVICE_DIVERGING,
+ ADVICE_FETCH_SET_HEAD_WARN,
ADVICE_FETCH_SHOW_FORCED_UPDATES,
ADVICE_FORCE_DELETE_BRANCH,
ADVICE_GRAFT_FILE_DEPRECATED,
diff --git a/attr.c b/attr.c
index c605d2c170..192936c4bc 100644
--- a/attr.c
+++ b/attr.c
@@ -259,42 +259,6 @@ const struct git_attr *git_attr(const char *name)
return git_attr_internal(name, strlen(name));
}
-/* What does a matched pattern decide? */
-struct attr_state {
- const struct git_attr *attr;
- const char *setto;
-};
-
-struct pattern {
- const char *pattern;
- int patternlen;
- int nowildcardlen;
- unsigned flags; /* PATTERN_FLAG_* */
-};
-
-/*
- * One rule, as from a .gitattributes file.
- *
- * If is_macro is true, then u.attr is a pointer to the git_attr being
- * defined.
- *
- * If is_macro is false, then u.pat is the filename pattern to which the
- * rule applies.
- *
- * In either case, num_attr is the number of attributes affected by
- * this rule, and state is an array listing them. The attributes are
- * listed as they appear in the file (macros unexpanded).
- */
-struct match_attr {
- union {
- struct pattern pat;
- const struct git_attr *attr;
- } u;
- char is_macro;
- size_t num_attr;
- struct attr_state state[FLEX_ARRAY];
-};
-
static const char blank[] = " \t\r\n";
/* Flags usable in read_attr() and parse_attr_line() family of functions. */
@@ -353,8 +317,8 @@ static const char *parse_attr(const char *src, int lineno, const char *cp,
return ep + strspn(ep, blank);
}
-static struct match_attr *parse_attr_line(const char *line, const char *src,
- int lineno, unsigned flags)
+struct match_attr *parse_attr_line(const char *line, const char *src,
+ int lineno, unsigned flags)
{
size_t namelen, num_attr, i;
const char *cp, *name, *states;
diff --git a/attr.h b/attr.h
index bb33b60880..a04a521092 100644
--- a/attr.h
+++ b/attr.h
@@ -240,4 +240,47 @@ int git_attr_system_is_enabled(void);
extern char *git_attr_tree;
+/*
+ * Exposed for fuzz-testing only.
+ */
+
+/* What does a matched pattern decide? */
+struct attr_state {
+ const struct git_attr *attr;
+ const char *setto;
+};
+
+struct pattern {
+ const char *pattern;
+ int patternlen;
+ int nowildcardlen;
+ unsigned flags; /* PATTERN_FLAG_* */
+};
+
+/*
+ * One rule, as from a .gitattributes file.
+ *
+ * If is_macro is true, then u.attr is a pointer to the git_attr being
+ * defined.
+ *
+ * If is_macro is false, then u.pat is the filename pattern to which the
+ * rule applies.
+ *
+ * In either case, num_attr is the number of attributes affected by
+ * this rule, and state is an array listing them. The attributes are
+ * listed as they appear in the file (macros unexpanded).
+ */
+struct match_attr {
+ union {
+ struct pattern pat;
+ const struct git_attr *attr;
+ } u;
+ char is_macro;
+ size_t num_attr;
+ struct attr_state state[FLEX_ARRAY];
+};
+
+struct match_attr *parse_attr_line(const char *line, const char *src,
+ int lineno, unsigned flags);
+
#endif /* ATTR_H */
diff --git a/bin-wrappers/.gitignore b/bin-wrappers/.gitignore
new file mode 100644
index 0000000000..1c6c90458b
--- /dev/null
+++ b/bin-wrappers/.gitignore
@@ -0,0 +1,9 @@
+/git
+/git-cvsserver
+/git-receive-pack
+/git-shell
+/git-upload-archive
+/git-upload-pack
+/scalar
+/test-fake-ssh
+/test-tool
diff --git a/bin-wrappers/meson.build b/bin-wrappers/meson.build
new file mode 100644
index 0000000000..8a4e910c9b
--- /dev/null
+++ b/bin-wrappers/meson.build
@@ -0,0 +1,28 @@
+bin_wrappers_config = configuration_data()
+foreach key, value : {
+ 'BUILD_DIR': meson.project_build_root(),
+ 'MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
+ 'TEMPLATE_DIR': meson.project_build_root() / 'templates',
+ 'GIT_TEXTDOMAINDIR': meson.project_build_root() / 'po',
+ 'GITPERLLIB': meson.project_build_root() / 'perl/lib',
+}
+ # Paths need to be Unix-style without drive prefixes as they get added to the
+ # PATH variable. And given that drive prefixes contain a colon we'd otherwise
+ # end up with a broken PATH if we didn't convert them.
+ if cygpath.found()
+ value = run_command(cygpath, value, check: true).stdout().strip()
+ endif
+ bin_wrappers_config.set(key, value)
+endforeach
+
+foreach executable : bin_wrappers
+ executable_config = configuration_data()
+ executable_config.merge_from(bin_wrappers_config)
+ executable_config.set('PROG', executable.full_path())
+
+ configure_file(
+ input: 'wrap-for-bin.sh',
+ output: fs.stem(executable.full_path()),
+ configuration: executable_config,
+ )
+endforeach
diff --git a/bin-wrappers/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh
new file mode 100755
index 0000000000..4b658ffd2d
--- /dev/null
+++ b/bin-wrappers/wrap-for-bin.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# wrap-for-bin.sh: Template for git executable wrapper scripts
+# to run test suite against sandbox, but with only bindir-installed
+# executables in PATH. The Makefile copies this into various
+# files in bin-wrappers, substituting
+# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@.
+
+GIT_EXEC_PATH='@BUILD_DIR@'
+if test -n "$NO_SET_GIT_TEMPLATE_DIR"
+then
+ unset GIT_TEMPLATE_DIR
+else
+ GIT_TEMPLATE_DIR='@TEMPLATE_DIR@'
+ export GIT_TEMPLATE_DIR
+fi
+MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@'
+GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}"
+GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@'
+PATH='@BUILD_DIR@/bin-wrappers:'"$PATH"
+
+export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
+
+case "$GIT_DEBUGGER" in
+'')
+ exec "@PROG@" "$@"
+ ;;
+1)
+ unset GIT_DEBUGGER
+ exec gdb --args "@PROG@" "$@"
+ ;;
+*)
+ GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
+ unset GIT_DEBUGGER
+ exec ${GIT_DEBUGGER_ARGS} "@PROG@" "$@"
+ ;;
+esac
diff --git a/bisect.c b/bisect.c
index 4713226fad..d71c4e4b44 100644
--- a/bisect.c
+++ b/bisect.c
@@ -28,8 +28,8 @@ static struct oid_array skipped_revs;
static struct object_id *current_bad_oid;
-static const char *term_bad;
-static const char *term_good;
+static char *term_bad;
+static char *term_good;
/* Remember to update object flag allocation in object.h */
#define COUNTED (1u<<16)
@@ -443,8 +443,9 @@ void find_bisection(struct commit_list **commit_list, int *reaches,
}
*reaches = weight(best);
}
- free(weights);
*commit_list = best;
+
+ free(weights);
clear_commit_weight(&commit_weight);
}
@@ -456,6 +457,7 @@ static int register_ref(const char *refname, const char *referent UNUSED, const
strbuf_addstr(&good_prefix, "-");
if (!strcmp(refname, term_bad)) {
+ free(current_bad_oid);
current_bad_oid = xmalloc(sizeof(*current_bad_oid));
oidcpy(current_bad_oid, oid);
} else if (starts_with(refname, good_prefix.buf)) {
@@ -556,8 +558,11 @@ struct commit_list *filter_skipped(struct commit_list *list,
tried = &list->next;
} else {
if (!show_all) {
- if (!skipped_first || !*skipped_first)
+ if (!skipped_first || !*skipped_first) {
+ free_commit_list(next);
+ free_commit_list(filtered);
return list;
+ }
} else if (skipped_first && !*skipped_first) {
/* This means we know it's not skipped */
*skipped_first = -1;
@@ -613,7 +618,7 @@ static int sqrti(int val)
static struct commit_list *skip_away(struct commit_list *list, int count)
{
- struct commit_list *cur, *previous;
+ struct commit_list *cur, *previous, *result = list;
int prn, index, i;
prn = get_prn(count);
@@ -625,15 +630,23 @@ static struct commit_list *skip_away(struct commit_list *list, int count)
for (i = 0; cur; cur = cur->next, i++) {
if (i == index) {
if (!oideq(&cur->item->object.oid, current_bad_oid))
- return cur;
- if (previous)
- return previous;
- return list;
+ result = cur;
+ else if (previous)
+ result = previous;
+ else
+ result = list;
+ break;
}
previous = cur;
}
- return list;
+ for (cur = list; cur != result; ) {
+ struct commit_list *next = cur->next;
+ free(cur);
+ cur = next;
+ }
+
+ return result;
}
static struct commit_list *managed_skipped(struct commit_list *list,
@@ -801,6 +814,8 @@ static enum bisect_error handle_bad_merge_base(void)
"between %s and [%s].\n"),
bad_hex, term_bad, term_good, bad_hex, good_hex);
}
+
+ free(good_hex);
return BISECT_MERGE_BASE_CHECK;
}
@@ -848,8 +863,8 @@ static enum bisect_error check_merge_bases(int rev_nr, struct commit **rev, int
rev + 1, &result) < 0)
exit(128);
- for (; result; result = result->next) {
- const struct object_id *mb = &result->item->object.oid;
+ for (struct commit_list *l = result; l; l = l->next) {
+ const struct object_id *mb = &l->item->object.oid;
if (oideq(mb, current_bad_oid)) {
res = handle_bad_merge_base();
break;
@@ -985,7 +1000,7 @@ static void show_commit(struct commit *commit)
* We read them and store them to adapt the messages accordingly.
* Default is bad/good.
*/
-void read_bisect_terms(const char **read_bad, const char **read_good)
+void read_bisect_terms(char **read_bad, char **read_good)
{
struct strbuf str = STRBUF_INIT;
const char *filename = git_path_bisect_terms();
@@ -993,16 +1008,20 @@ void read_bisect_terms(const char **read_bad, const char **read_good)
if (!fp) {
if (errno == ENOENT) {
- *read_bad = "bad";
- *read_good = "good";
+ free(*read_bad);
+ *read_bad = xstrdup("bad");
+ free(*read_good);
+ *read_good = xstrdup("good");
return;
} else {
die_errno(_("could not read file '%s'"), filename);
}
} else {
strbuf_getline_lf(&str, fp);
+ free(*read_bad);
*read_bad = strbuf_detach(&str, NULL);
strbuf_getline_lf(&str, fp);
+ free(*read_good);
*read_good = strbuf_detach(&str, NULL);
}
strbuf_release(&str);
@@ -1024,7 +1043,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
{
struct strvec rev_argv = STRVEC_INIT;
struct rev_info revs = REV_INFO_INIT;
- struct commit_list *tried;
+ struct commit_list *tried = NULL;
int reaches = 0, all = 0, nr, steps;
enum bisect_error res = BISECT_OK;
struct object_id *bisect_rev;
@@ -1091,7 +1110,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
if (oideq(bisect_rev, current_bad_oid)) {
res = error_if_skipped_commits(tried, current_bad_oid);
if (res)
- return res;
+ goto cleanup;
printf("%s is the first %s commit\n", oid_to_hex(bisect_rev),
term_bad);
@@ -1125,6 +1144,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
res = bisect_checkout(bisect_rev, no_checkout);
cleanup:
+ free_commit_list(tried);
release_revisions(&revs);
strvec_clear(&rev_argv);
return res;
diff --git a/bisect.h b/bisect.h
index ee3fd65f3b..944439bfac 100644
--- a/bisect.h
+++ b/bisect.h
@@ -75,7 +75,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix);
int estimate_bisect_steps(int all);
-void read_bisect_terms(const char **bad, const char **good);
+void read_bisect_terms(char **bad, char **good);
int bisect_clean_state(void);
diff --git a/blame.c b/blame.c
index 90633380cd..bf69768a7d 100644
--- a/blame.c
+++ b/blame.c
@@ -2931,6 +2931,7 @@ void setup_blame_bloom_data(struct blame_scoreboard *sb)
void cleanup_scoreboard(struct blame_scoreboard *sb)
{
free(sb->lineno);
+ free(sb->final_buf);
clear_prio_queue(&sb->commits);
oidset_clear(&sb->ignore_list);
diff --git a/blame.h b/blame.h
index 5b4e47d44c..3b34be0e5c 100644
--- a/blame.h
+++ b/blame.h
@@ -116,7 +116,7 @@ struct blame_scoreboard {
* Used by many functions to obtain contents of the nth line,
* indexed with scoreboard.lineno[blame_entry.lno].
*/
- const char *final_buf;
+ char *final_buf;
unsigned long final_buf_size;
/* linked list of blames */
diff --git a/branch.c b/branch.c
index 44977ad0aa..77716966fe 100644
--- a/branch.c
+++ b/branch.c
@@ -372,7 +372,7 @@ 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)) {
+ if (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`"));
@@ -627,7 +627,7 @@ void create_branch(struct repository *r,
else
msg = xstrfmt("branch: Created from %s", start_name);
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction ||
ref_transaction_update(transaction, ref.buf,
&oid, forcing ? NULL : null_oid(),
diff --git a/builtin/bisect.c b/builtin/bisect.c
index 21d17a6c1a..8166d4abf5 100644
--- a/builtin/bisect.c
+++ b/builtin/bisect.c
@@ -1312,7 +1312,8 @@ static int bisect_run(struct bisect_terms *terms, int argc, const char **argv)
return res;
}
-static int cmd_bisect__reset(int argc, const char **argv, const char *prefix UNUSED)
+static int cmd_bisect__reset(int argc, const char **argv, const char *prefix UNUSED,
+ struct repository *repo UNUSED)
{
if (argc > 1)
return error(_("'%s' requires either no argument or a commit"),
@@ -1320,7 +1321,8 @@ static int cmd_bisect__reset(int argc, const char **argv, const char *prefix UNU
return bisect_reset(argc ? argv[0] : NULL);
}
-static int cmd_bisect__terms(int argc, const char **argv, const char *prefix UNUSED)
+static int cmd_bisect__terms(int argc, const char **argv, const char *prefix UNUSED,
+ struct repository *repo UNUSED)
{
int res;
struct bisect_terms terms = { 0 };
@@ -1333,7 +1335,8 @@ static int cmd_bisect__terms(int argc, const char **argv, const char *prefix UNU
return res;
}
-static int cmd_bisect__start(int argc, const char **argv, const char *prefix UNUSED)
+static int cmd_bisect__start(int argc, const char **argv, const char *prefix UNUSED,
+ struct repository *repo UNUSED)
{
int res;
struct bisect_terms terms = { 0 };
@@ -1344,7 +1347,8 @@ static int cmd_bisect__start(int argc, const char **argv, const char *prefix UNU
return res;
}
-static int cmd_bisect__next(int argc, const char **argv UNUSED, const char *prefix)
+static int cmd_bisect__next(int argc, const char **argv UNUSED, const char *prefix,
+ struct repository *repo UNUSED)
{
int res;
struct bisect_terms terms = { 0 };
@@ -1358,12 +1362,15 @@ static int cmd_bisect__next(int argc, const char **argv UNUSED, const char *pref
return res;
}
-static int cmd_bisect__log(int argc UNUSED, const char **argv UNUSED, const char *prefix UNUSED)
+static int cmd_bisect__log(int argc UNUSED, const char **argv UNUSED,
+ const char *prefix UNUSED,
+ struct repository *repo UNUSED)
{
return bisect_log();
}
-static int cmd_bisect__replay(int argc, const char **argv, const char *prefix UNUSED)
+static int cmd_bisect__replay(int argc, const char **argv, const char *prefix UNUSED,
+ struct repository *repo UNUSED)
{
int res;
struct bisect_terms terms = { 0 };
@@ -1376,7 +1383,8 @@ static int cmd_bisect__replay(int argc, const char **argv, const char *prefix UN
return res;
}
-static int cmd_bisect__skip(int argc, const char **argv, const char *prefix UNUSED)
+static int cmd_bisect__skip(int argc, const char **argv, const char *prefix UNUSED,
+ struct repository *repo UNUSED)
{
int res;
struct bisect_terms terms = { 0 };
@@ -1388,7 +1396,8 @@ static int cmd_bisect__skip(int argc, const char **argv, const char *prefix UNUS
return res;
}
-static int cmd_bisect__visualize(int argc, const char **argv, const char *prefix UNUSED)
+static int cmd_bisect__visualize(int argc, const char **argv, const char *prefix UNUSED,
+ struct repository *repo UNUSED)
{
int res;
struct bisect_terms terms = { 0 };
@@ -1399,7 +1408,8 @@ static int cmd_bisect__visualize(int argc, const char **argv, const char *prefix
return res;
}
-static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSED)
+static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSED,
+ struct repository *repo UNUSED)
{
int res;
struct bisect_terms terms = { 0 };
@@ -1415,7 +1425,7 @@ static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSE
int cmd_bisect(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
int res = 0;
parse_opt_subcommand_fn *fn = NULL;
@@ -1451,7 +1461,7 @@ int cmd_bisect(int argc,
} else {
argc--;
argv++;
- res = fn(argc, argv, prefix);
+ res = fn(argc, argv, prefix, repo);
}
return is_bisect_success(res) ? 0 : -res;
diff --git a/builtin/blame.c b/builtin/blame.c
index e407a22da3..6a7bb3b072 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -1216,12 +1216,6 @@ parse_done:
output_option &= ~(OUTPUT_COLOR_LINE | OUTPUT_SHOW_AGE_WITH_COLOR);
output(&sb, output_option);
- free((void *)sb.final_buf);
- for (ent = sb.ent; ent; ) {
- struct blame_entry *e = ent->next;
- free(ent);
- ent = e;
- }
if (show_stats) {
printf("num read blob: %d\n", sb.num_read_blob);
@@ -1230,6 +1224,12 @@ parse_done:
}
cleanup:
+ for (ent = sb.ent; ent; ) {
+ struct blame_entry *e = ent->next;
+ free(ent);
+ ent = e;
+ }
+
free(path);
cleanup_scoreboard(&sb);
release_revisions(&revs);
diff --git a/builtin/branch.c b/builtin/branch.c
index fd1611ebf5..200909c23e 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -257,7 +257,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
char *target = NULL;
int flags = 0;
- strbuf_branchname(&bname, argv[i], allowed_interpret);
+ copy_branchname(&bname, argv[i], allowed_interpret);
free(name);
name = mkpathdup(fmt, bname.buf);
@@ -579,7 +579,7 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int
int recovery = 0, oldref_usage = 0;
struct worktree **worktrees = get_worktrees();
- if (strbuf_check_branch_ref(&oldref, oldname)) {
+ if (check_branch_ref(&oldref, oldname)) {
/*
* Bad name --- this could be an attempt to rename a
* ref that we used to allow to be created by accident.
@@ -722,6 +722,7 @@ int cmd_branch(int argc,
static struct ref_sorting *sorting;
struct string_list sorting_options = STRING_LIST_INIT_DUP;
struct ref_format format = REF_FORMAT_INIT;
+ int ret;
struct option options[] = {
OPT_GROUP(N_("Generic options")),
@@ -851,15 +852,15 @@ int cmd_branch(int argc,
if (list)
setup_auto_pager("branch", 1);
- UNLEAK(sorting_options);
-
if (delete) {
if (!argc)
die(_("branch name required"));
- return delete_branches(argc, argv, delete > 1, filter.kind, quiet);
+ ret = delete_branches(argc, argv, delete > 1, filter.kind, quiet);
+ goto out;
} else if (show_current) {
print_current_branch_name();
- return 0;
+ ret = 0;
+ goto out;
} else if (list) {
/* git branch --list also shows HEAD when it is detached */
if ((filter.kind & FILTER_REFS_BRANCHES) && filter.detached)
@@ -882,37 +883,42 @@ int cmd_branch(int argc,
ref_sorting_release(sorting);
ref_filter_clear(&filter);
ref_format_clear(&format);
- return 0;
+
+ ret = 0;
+ goto out;
} else if (edit_description) {
const char *branch_name;
struct strbuf branch_ref = STRBUF_INIT;
struct strbuf buf = STRBUF_INIT;
- int ret = 1; /* assume failure */
if (!argc) {
if (filter.detached)
die(_("cannot give description to detached HEAD"));
branch_name = head;
} else if (argc == 1) {
- strbuf_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
+ copy_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
branch_name = buf.buf;
} else {
die(_("cannot edit description of more than one branch"));
}
strbuf_addf(&branch_ref, "refs/heads/%s", branch_name);
- if (!refs_ref_exists(get_main_ref_store(the_repository), branch_ref.buf))
+ if (!refs_ref_exists(get_main_ref_store(the_repository), branch_ref.buf)) {
error((!argc || branch_checked_out(branch_ref.buf))
? _("no commit on branch '%s' yet")
: _("no branch named '%s'"),
branch_name);
- else if (!edit_branch_description(branch_name))
+ ret = 1;
+ } else if (!edit_branch_description(branch_name)) {
ret = 0; /* happy */
+ } else {
+ ret = 1;
+ }
strbuf_release(&branch_ref);
strbuf_release(&buf);
- return ret;
+ goto out;
} else if (copy || rename) {
if (!argc)
die(_("branch name required"));
@@ -933,7 +939,7 @@ int cmd_branch(int argc,
if (!argc)
branch = branch_get(NULL);
else if (argc == 1) {
- strbuf_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
+ copy_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
branch = branch_get(buf.buf);
} else
die(_("too many arguments to set new upstream"));
@@ -963,7 +969,7 @@ int cmd_branch(int argc,
if (!argc)
branch = branch_get(NULL);
else if (argc == 1) {
- strbuf_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
+ copy_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
branch = branch_get(buf.buf);
} else
die(_("too many arguments to unset upstream"));
@@ -1000,12 +1006,17 @@ int cmd_branch(int argc,
create_branches_recursively(the_repository, branch_name,
start_name, NULL, force,
reflog, quiet, track, 0);
- return 0;
+ ret = 0;
+ goto out;
}
create_branch(the_repository, branch_name, start_name, force, 0,
reflog, quiet, track, 0);
} else
usage_with_options(builtin_branch_usage, options);
- return 0;
+ ret = 0;
+
+out:
+ string_list_clear(&sorting_options, 0);
+ return ret;
}
diff --git a/builtin/bundle.c b/builtin/bundle.c
index 127518c2a8..1e170e9278 100644
--- a/builtin/bundle.c
+++ b/builtin/bundle.c
@@ -67,7 +67,8 @@ static int parse_options_cmd_bundle(int argc,
return argc;
}
-static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {
+static int cmd_bundle_create(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED) {
struct strvec pack_opts = STRVEC_INIT;
int version = -1;
int ret;
@@ -123,7 +124,8 @@ static int open_bundle(const char *path, struct bundle_header *header,
return read_bundle_header(path, header);
}
-static int cmd_bundle_verify(int argc, const char **argv, const char *prefix) {
+static int cmd_bundle_verify(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED) {
struct bundle_header header = BUNDLE_HEADER_INIT;
int bundle_fd = -1;
int quiet = 0;
@@ -164,7 +166,8 @@ cleanup:
return ret;
}
-static int cmd_bundle_list_heads(int argc, const char **argv, const char *prefix) {
+static int cmd_bundle_list_heads(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED) {
struct bundle_header header = BUNDLE_HEADER_INIT;
int bundle_fd = -1;
int ret;
@@ -189,7 +192,8 @@ cleanup:
return ret;
}
-static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix) {
+static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED) {
struct bundle_header header = BUNDLE_HEADER_INIT;
int bundle_fd = -1;
int ret;
@@ -218,7 +222,7 @@ static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix)
strvec_pushl(&extra_index_pack_args, "-v", "--progress-title",
_("Unbundling objects"), NULL);
ret = !!unbundle(the_repository, &header, bundle_fd,
- &extra_index_pack_args, 0) ||
+ &extra_index_pack_args, NULL) ||
list_bundle_refs(&header, argc, argv);
bundle_header_release(&header);
@@ -231,7 +235,7 @@ cleanup:
int cmd_bundle(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
parse_opt_subcommand_fn *fn = NULL;
struct option options[] = {
@@ -247,5 +251,5 @@ int cmd_bundle(int argc,
packet_trace_identity("bundle");
- return !!fn(argc, argv, prefix);
+ return !!fn(argc, argv, prefix, repo);
}
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index bfdfb51c7c..d67b101c20 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -827,15 +827,16 @@ static int batch_objects(struct batch_options *opt)
cb.seen = &seen;
for_each_loose_object(batch_unordered_loose, &cb, 0);
- for_each_packed_object(batch_unordered_packed, &cb,
- FOR_EACH_OBJECT_PACK_ORDER);
+ for_each_packed_object(the_repository, batch_unordered_packed,
+ &cb, FOR_EACH_OBJECT_PACK_ORDER);
oidset_clear(&seen);
} else {
struct oid_array sa = OID_ARRAY_INIT;
for_each_loose_object(collect_loose_object, &sa, 0);
- for_each_packed_object(collect_packed_object, &sa, 0);
+ for_each_packed_object(the_repository, collect_packed_object,
+ &sa, 0);
oid_array_for_each_unique(&sa, batch_object_cb, &cb);
diff --git a/builtin/check-ref-format.c b/builtin/check-ref-format.c
index e86d8ef980..cef1ffe3ce 100644
--- a/builtin/check-ref-format.c
+++ b/builtin/check-ref-format.c
@@ -42,7 +42,7 @@ static int check_ref_format_branch(const char *arg)
int nongit;
setup_git_directory_gently(&nongit);
- if (strbuf_check_branch_ref(&sb, arg) ||
+ if (check_branch_ref(&sb, arg) ||
!skip_prefix(sb.buf, "refs/heads/", &name))
die("'%s' is not a valid branch name", arg);
printf("%s\n", name);
diff --git a/builtin/checkout.c b/builtin/checkout.c
index c449558e66..5e5afa0f26 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -742,7 +742,7 @@ static void setup_branch_path(struct branch_info *branch)
&branch->oid, &branch->refname, 0))
repo_get_oid_committish(the_repository, branch->name, &branch->oid);
- strbuf_branchname(&buf, branch->name, INTERPRET_BRANCH_LOCAL);
+ copy_branchname(&buf, branch->name, INTERPRET_BRANCH_LOCAL);
if (strcmp(buf.buf, branch->name)) {
free(branch->name);
branch->name = xstrdup(buf.buf);
diff --git a/builtin/clone.c b/builtin/clone.c
index c0013c75cd..21721db28a 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -574,7 +574,7 @@ static void write_remote_refs(const struct ref *local_refs)
struct strbuf err = STRBUF_INIT;
t = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ REF_TRANSACTION_FLAG_INITIAL, &err);
if (!t)
die("%s", err.buf);
@@ -586,7 +586,7 @@ static void write_remote_refs(const struct ref *local_refs)
die("%s", err.buf);
}
- if (initial_ref_transaction_commit(t, &err))
+ if (ref_transaction_commit(t, &err))
die("%s", err.buf);
strbuf_release(&err);
@@ -1586,7 +1586,6 @@ int cmd_clone(int argc,
free(dir);
free(path);
free(repo_to_free);
- UNLEAK(repo);
junk_mode = JUNK_LEAVE_ALL;
transport_ls_refs_options_release(&transport_ls_refs_options);
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index 7c991db6eb..bd70d052e7 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -62,7 +62,8 @@ static struct option *add_common_options(struct option *to)
return parse_options_concat(common_opts, to);
}
-static int graph_verify(int argc, const char **argv, const char *prefix)
+static int graph_verify(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct commit_graph *graph = NULL;
struct object_directory *odb = NULL;
@@ -214,7 +215,8 @@ static int git_commit_graph_write_config(const char *var, const char *value,
return 0;
}
-static int graph_write(int argc, const char **argv, const char *prefix)
+static int graph_write(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct string_list pack_indexes = STRING_LIST_INIT_DUP;
struct strbuf buf = STRBUF_INIT;
@@ -333,7 +335,7 @@ cleanup:
int cmd_commit_graph(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
parse_opt_subcommand_fn *fn = NULL;
struct option builtin_commit_graph_options[] = {
@@ -352,5 +354,5 @@ int cmd_commit_graph(int argc,
builtin_commit_graph_usage, 0);
FREE_AND_NULL(options);
- return fn(argc, argv, prefix);
+ return fn(argc, argv, prefix, repo);
}
diff --git a/builtin/config.c b/builtin/config.c
index cba7022108..16e6e30555 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -826,7 +826,8 @@ static void display_options_init(struct config_display_options *opts)
}
}
-static int cmd_config_list(int argc, const char **argv, const char *prefix)
+static int cmd_config_list(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct config_location_options location_opts = CONFIG_LOCATION_OPTIONS_INIT;
struct config_display_options display_opts = CONFIG_DISPLAY_OPTIONS_INIT;
@@ -861,7 +862,8 @@ static int cmd_config_list(int argc, const char **argv, const char *prefix)
return 0;
}
-static int cmd_config_get(int argc, const char **argv, const char *prefix)
+static int cmd_config_get(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct config_location_options location_opts = CONFIG_LOCATION_OPTIONS_INIT;
struct config_display_options display_opts = CONFIG_DISPLAY_OPTIONS_INIT;
@@ -915,7 +917,8 @@ static int cmd_config_get(int argc, const char **argv, const char *prefix)
return ret;
}
-static int cmd_config_set(int argc, const char **argv, const char *prefix)
+static int cmd_config_set(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct config_location_options location_opts = CONFIG_LOCATION_OPTIONS_INIT;
const char *value_pattern = NULL, *comment_arg = NULL;
@@ -973,7 +976,8 @@ static int cmd_config_set(int argc, const char **argv, const char *prefix)
return ret;
}
-static int cmd_config_unset(int argc, const char **argv, const char *prefix)
+static int cmd_config_unset(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct config_location_options location_opts = CONFIG_LOCATION_OPTIONS_INIT;
const char *value_pattern = NULL;
@@ -1010,7 +1014,8 @@ static int cmd_config_unset(int argc, const char **argv, const char *prefix)
return ret;
}
-static int cmd_config_rename_section(int argc, const char **argv, const char *prefix)
+static int cmd_config_rename_section(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct config_location_options location_opts = CONFIG_LOCATION_OPTIONS_INIT;
struct option opts[] = {
@@ -1039,7 +1044,8 @@ out:
return ret;
}
-static int cmd_config_remove_section(int argc, const char **argv, const char *prefix)
+static int cmd_config_remove_section(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct config_location_options location_opts = CONFIG_LOCATION_OPTIONS_INIT;
struct option opts[] = {
@@ -1099,7 +1105,8 @@ static int show_editor(struct config_location_options *opts)
return 0;
}
-static int cmd_config_edit(int argc, const char **argv, const char *prefix)
+static int cmd_config_edit(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct config_location_options location_opts = CONFIG_LOCATION_OPTIONS_INIT;
struct option opts[] = {
@@ -1395,7 +1402,7 @@ out:
int cmd_config(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
parse_opt_subcommand_fn *subcommand = NULL;
struct option subcommand_opts[] = {
@@ -1422,7 +1429,7 @@ int cmd_config(int argc,
if (subcommand) {
argc = parse_options(argc, argv, prefix, subcommand_opts, builtin_config_usage,
PARSE_OPT_SUBCOMMAND_OPTIONAL|PARSE_OPT_KEEP_UNKNOWN_OPT);
- return subcommand(argc, argv, prefix);
+ return subcommand(argc, argv, prefix, repo);
}
return cmd_config_actions(argc, argv, prefix);
diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index 04d80887e0..1e89148ed7 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -67,7 +67,7 @@ static int count_loose(const struct object_id *oid, const char *path,
else {
loose_size += on_disk_bytes(st);
loose++;
- if (verbose && has_object_pack(oid))
+ if (verbose && has_object_pack(the_repository, oid))
packed_loose++;
}
return 0;
diff --git a/builtin/describe.c b/builtin/describe.c
index 7330a77b38..a6ef8af32a 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -366,6 +366,13 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)
struct commit_name **slot;
seen_commits++;
+
+ if (match_cnt == max_candidates ||
+ match_cnt == hashmap_get_size(&names)) {
+ gave_up_on = c;
+ break;
+ }
+
slot = commit_names_peek(&commit_names, c);
n = slot ? *slot : NULL;
if (n) {
@@ -381,10 +388,6 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)
if (n->prio == 2)
annotated_cnt++;
}
- else {
- gave_up_on = c;
- break;
- }
}
for (cur_match = 0; cur_match < match_cnt; cur_match++) {
struct possible_tag *t = &all_matches[cur_match];
@@ -470,9 +473,8 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)
fprintf(stderr, _("traversed %lu commits\n"), seen_commits);
if (gave_up_on) {
fprintf(stderr,
- _("more than %i tags found; listed %i most recent\n"
- "gave up search at %s\n"),
- max_candidates, max_candidates,
+ _("found %i tags; gave up search at %s\n"),
+ max_candidates,
oid_to_hex(&gave_up_on->object.oid));
}
}
diff --git a/builtin/diff.c b/builtin/diff.c
index dca52d4221..2fe92f373e 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -628,6 +628,5 @@ int cmd_diff(int argc,
release_revisions(&rev);
object_array_clear(&ent);
symdiff_release(&sdiff);
- UNLEAK(blob);
return result;
}
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 51c8228cb7..a67c1c4416 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -13,6 +13,7 @@
#include "delta.h"
#include "pack.h"
#include "path.h"
+#include "read-cache-ll.h"
#include "refs.h"
#include "csum-file.h"
#include "quote.h"
@@ -766,6 +767,7 @@ static void start_packfile(void)
p->pack_fd = pack_fd;
p->do_not_close = 1;
+ p->repo = the_repository;
pack_file = hashfd(pack_fd, p->pack_name);
pack_data = p;
@@ -806,7 +808,7 @@ static char *keep_pack(const char *curr_index_name)
struct strbuf name = STRBUF_INIT;
int keep_fd;
- odb_pack_name(&name, pack_data->hash, "keep");
+ odb_pack_name(pack_data->repo, &name, pack_data->hash, "keep");
keep_fd = odb_pack_keep(name.buf);
if (keep_fd < 0)
die_errno("cannot create keep file");
@@ -814,11 +816,11 @@ static char *keep_pack(const char *curr_index_name)
if (close(keep_fd))
die_errno("failed to write keep file");
- odb_pack_name(&name, pack_data->hash, "pack");
+ odb_pack_name(pack_data->repo, &name, pack_data->hash, "pack");
if (finalize_object_file(pack_data->pack_name, name.buf))
die("cannot store pack file");
- odb_pack_name(&name, pack_data->hash, "idx");
+ odb_pack_name(pack_data->repo, &name, pack_data->hash, "idx");
if (finalize_object_file(curr_index_name, name.buf))
die("cannot store index file");
free((void *)curr_index_name);
@@ -832,7 +834,7 @@ static void unkeep_all_packs(void)
for (k = 0; k < pack_id; k++) {
struct packed_git *p = all_packs[k];
- odb_pack_name(&name, p->hash, "keep");
+ odb_pack_name(p->repo, &name, p->hash, "keep");
unlink_or_warn(name.buf);
}
strbuf_release(&name);
@@ -889,7 +891,7 @@ static void end_packfile(void)
idx_name = keep_pack(create_index());
/* Register the packfile with core git's machinery. */
- new_p = add_packed_git(idx_name, strlen(idx_name), 1);
+ new_p = add_packed_git(pack_data->repo, idx_name, strlen(idx_name), 1);
if (!new_p)
die("core git rejected index %s", idx_name);
all_packs[pack_id] = new_p;
@@ -1647,7 +1649,7 @@ static int update_branch(struct branch *b)
}
}
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction ||
ref_transaction_update(transaction, b->name, &b->oid, &old_oid,
NULL, NULL, 0, msg, &err) ||
@@ -1682,7 +1684,7 @@ static void dump_tags(void)
struct ref_transaction *transaction;
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction) {
failure |= error("%s", err.buf);
goto cleanup;
@@ -2425,6 +2427,9 @@ static void file_change_m(const char *p, struct branch *b)
tree_content_replace(&b->branch_tree, &oid, mode, NULL);
return;
}
+
+ if (!verify_path(path.buf, mode))
+ die("invalid path '%s'", path.buf);
tree_content_set(&b->branch_tree, path.buf, &oid, mode, NULL);
}
@@ -2462,6 +2467,8 @@ static void file_change_cr(const char *p, struct branch *b, int rename)
leaf.tree);
return;
}
+ if (!verify_path(dest.buf, leaf.versions[1].mode))
+ die("invalid path '%s'", dest.buf);
tree_content_set(&b->branch_tree, dest.buf,
&leaf.versions[1].oid,
leaf.versions[1].mode,
@@ -3552,7 +3559,7 @@ static void parse_argv(void)
int cmd_fast_import(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
unsigned int i;
@@ -3673,7 +3680,7 @@ int cmd_fast_import(int argc,
fprintf(stderr, " pools: %10lu KiB\n", (unsigned long)((tree_entry_allocd + fi_mem_pool.pool_alloc) /1024));
fprintf(stderr, " objects: %10" PRIuMAX " KiB\n", (alloc_count*sizeof(struct object_entry))/1024);
fprintf(stderr, "---------------------------------------------------------------------\n");
- pack_report();
+ pack_report(repo);
fprintf(stderr, "---------------------------------------------------------------------\n");
fprintf(stderr, "\n");
}
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 06b4611958..872ad49834 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -665,7 +665,7 @@ static int s_update_ref(const char *action,
*/
if (!transaction) {
transaction = our_transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction) {
ret = STORE_REF_ERROR_OTHER;
goto out;
@@ -1574,6 +1574,135 @@ static int backfill_tags(struct display_state *display_state,
return retcode;
}
+static const char *strip_refshead(const char *name){
+ skip_prefix(name, "refs/heads/", &name);
+ return name;
+}
+
+static void set_head_advice_msg(const char *remote, const char *head_name)
+{
+ const char message_advice_set_head[] =
+ N_("Run 'git remote set-head %s %s' to follow the change, or set\n"
+ "'remote.%s.followRemoteHEAD' configuration option to a different value\n"
+ "if you do not want to see this message. Specifically running\n"
+ "'git config set remote.%s.followRemoteHEAD %s' will disable the warning\n"
+ "until the remote changes HEAD to something else.");
+
+ advise_if_enabled(ADVICE_FETCH_SET_HEAD_WARN, _(message_advice_set_head),
+ remote, head_name, remote, remote, head_name);
+}
+
+static void report_set_head(const char *remote, const char *head_name,
+ struct strbuf *buf_prev, int updateres) {
+ struct strbuf buf_prefix = STRBUF_INIT;
+ const char *prev_head = NULL;
+
+ strbuf_addf(&buf_prefix, "refs/remotes/%s/", remote);
+ skip_prefix(buf_prev->buf, buf_prefix.buf, &prev_head);
+
+ if (prev_head && strcmp(prev_head, head_name)) {
+ printf("'HEAD' at '%s' is '%s', but we have '%s' locally.\n",
+ remote, head_name, prev_head);
+ set_head_advice_msg(remote, head_name);
+ }
+ else if (updateres && buf_prev->len) {
+ printf("'HEAD' at '%s' is '%s', "
+ "but we have a detached HEAD pointing to '%s' locally.\n",
+ remote, head_name, buf_prev->buf);
+ set_head_advice_msg(remote, head_name);
+ }
+ strbuf_release(&buf_prefix);
+}
+
+static int set_head(const struct ref *remote_refs, int follow_remote_head,
+ const char *no_warn_branch)
+{
+ int result = 0, create_only, is_bare, was_detached;
+ struct strbuf b_head = STRBUF_INIT, b_remote_head = STRBUF_INIT,
+ b_local_head = STRBUF_INIT;
+ const char *remote = gtransport->remote->name;
+ char *head_name = NULL;
+ struct ref *ref, *matches;
+ struct ref *fetch_map = NULL, **fetch_map_tail = &fetch_map;
+ struct refspec_item refspec = {
+ .force = 0,
+ .pattern = 1,
+ .src = (char *) "refs/heads/*",
+ .dst = (char *) "refs/heads/*",
+ };
+ struct string_list heads = STRING_LIST_INIT_DUP;
+ struct ref_store *refs = get_main_ref_store(the_repository);
+
+ get_fetch_map(remote_refs, &refspec, &fetch_map_tail, 0);
+ matches = guess_remote_head(find_ref_by_name(remote_refs, "HEAD"),
+ fetch_map, 1);
+ for (ref = matches; ref; ref = ref->next) {
+ string_list_append(&heads, strip_refshead(ref->name));
+ }
+
+ if (follow_remote_head == FOLLOW_REMOTE_NEVER)
+ goto cleanup;
+
+ if (!heads.nr)
+ result = 1;
+ else if (heads.nr > 1)
+ result = 1;
+ else
+ head_name = xstrdup(heads.items[0].string);
+
+ if (!head_name)
+ goto cleanup;
+ is_bare = is_bare_repository();
+ create_only = follow_remote_head == FOLLOW_REMOTE_ALWAYS ? 0 : !is_bare;
+ if (is_bare) {
+ strbuf_addstr(&b_head, "HEAD");
+ strbuf_addf(&b_remote_head, "refs/heads/%s", head_name);
+ } else {
+ strbuf_addf(&b_head, "refs/remotes/%s/HEAD", remote);
+ strbuf_addf(&b_remote_head, "refs/remotes/%s/%s", remote, head_name);
+ }
+ /* make sure it's valid */
+ if (!is_bare && !refs_ref_exists(refs, b_remote_head.buf)) {
+ result = 1;
+ goto cleanup;
+ }
+ was_detached = refs_update_symref_extended(refs, b_head.buf, b_remote_head.buf,
+ "fetch", &b_local_head, create_only);
+ if (was_detached == -1) {
+ result = 1;
+ goto cleanup;
+ }
+ if (verbosity >= 0 &&
+ follow_remote_head == FOLLOW_REMOTE_WARN &&
+ (!no_warn_branch || strcmp(no_warn_branch, head_name)))
+ report_set_head(remote, head_name, &b_local_head, was_detached);
+
+cleanup:
+ free(head_name);
+ free_refs(fetch_map);
+ free_refs(matches);
+ string_list_clear(&heads, 0);
+ strbuf_release(&b_head);
+ strbuf_release(&b_local_head);
+ strbuf_release(&b_remote_head);
+ return result;
+}
+
+static int uses_remote_tracking(struct transport *transport, struct refspec *rs)
+{
+ if (!remote_is_configured(transport->remote, 0))
+ return 0;
+
+ if (!rs->nr)
+ rs = &transport->remote->fetch;
+
+ for (int i = 0; i < rs->nr; i++)
+ if (rs->items[i].dst)
+ return 1;
+
+ return 0;
+}
+
static int do_fetch(struct transport *transport,
struct refspec *rs,
const struct fetch_config *config)
@@ -1643,6 +1772,11 @@ static int do_fetch(struct transport *transport,
"refs/tags/");
}
+ if (uses_remote_tracking(transport, rs)) {
+ must_list_refs = 1;
+ strvec_push(&transport_ls_refs_options.ref_prefixes, "HEAD");
+ }
+
if (must_list_refs) {
trace2_region_enter("fetch", "remote_refs", the_repository);
remote_refs = transport_get_remote_refs(transport,
@@ -1667,7 +1801,7 @@ static int do_fetch(struct transport *transport,
if (atomic_fetch) {
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction) {
retcode = -1;
goto cleanup;
@@ -1787,6 +1921,13 @@ static int do_fetch(struct transport *transport,
"you need to specify exactly one branch with the --set-upstream option"));
}
}
+ if (set_head(remote_refs, transport->remote->follow_remote_head,
+ transport->remote->no_warn_branch))
+ ;
+ /*
+ * Way too many cases where this can go wrong
+ * so let's just fail silently for now.
+ */
cleanup:
if (retcode) {
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 7f4e2f0414..0196c54eb6 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -150,7 +150,7 @@ static int mark_object(struct object *obj, enum object_type type,
return 0;
obj->flags |= REACHABLE;
- if (is_promisor_object(&obj->oid))
+ if (is_promisor_object(the_repository, &obj->oid))
/*
* Further recursion does not need to be performed on this
* object since it is a promisor object (so it does not need to
@@ -270,9 +270,9 @@ static void check_reachable_object(struct object *obj)
* do a full fsck
*/
if (!(obj->flags & HAS_OBJ)) {
- if (is_promisor_object(&obj->oid))
+ if (is_promisor_object(the_repository, &obj->oid))
return;
- if (has_object_pack(&obj->oid))
+ if (has_object_pack(the_repository, &obj->oid))
return; /* it is in pack - forget about it */
printf_ln(_("missing %s %s"),
printable_type(&obj->oid, obj->type),
@@ -391,7 +391,10 @@ static void check_connectivity(void)
* traversal.
*/
for_each_loose_object(mark_loose_unreachable_referents, NULL, 0);
- for_each_packed_object(mark_packed_unreachable_referents, NULL, 0);
+ for_each_packed_object(the_repository,
+ mark_packed_unreachable_referents,
+ NULL,
+ 0);
}
/* Look up all the requirements, warn about missing objects.. */
@@ -488,7 +491,7 @@ static void fsck_handle_reflog_oid(const char *refname, struct object_id *oid,
refname, timestamp);
obj->flags |= USED;
mark_object_reachable(obj);
- } else if (!is_promisor_object(oid)) {
+ } else if (!is_promisor_object(the_repository, oid)) {
error(_("%s: invalid reflog entry %s"),
refname, oid_to_hex(oid));
errors_found |= ERROR_REACHABLE;
@@ -531,7 +534,7 @@ static int fsck_handle_ref(const char *refname, const char *referent UNUSED, con
obj = parse_object(the_repository, oid);
if (!obj) {
- if (is_promisor_object(oid)) {
+ if (is_promisor_object(the_repository, oid)) {
/*
* Increment default_refs anyway, because this is a
* valid ref.
@@ -966,7 +969,8 @@ int cmd_fsck(int argc,
if (connectivity_only) {
for_each_loose_object(mark_loose_for_connectivity, NULL, 0);
- for_each_packed_object(mark_packed_for_connectivity, NULL, 0);
+ for_each_packed_object(the_repository,
+ mark_packed_for_connectivity, NULL, 0);
} else {
prepare_alt_odb(the_repository);
for (odb = the_repository->objects->odb; odb; odb = odb->next)
@@ -1011,7 +1015,7 @@ int cmd_fsck(int argc,
&oid);
if (!obj || !(obj->flags & HAS_OBJ)) {
- if (is_promisor_object(&oid))
+ if (is_promisor_object(the_repository, &oid))
continue;
error(_("%s: object missing"), oid_to_hex(&oid));
errors_found |= ERROR_OBJECT;
diff --git a/builtin/gc.c b/builtin/gc.c
index d52735354c..4ae5196aed 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -138,6 +138,11 @@ struct gc_config {
char *repack_filter_to;
unsigned long big_pack_threshold;
unsigned long max_delta_cache_size;
+ /*
+ * Remove this member from gc_config once repo_settings is passed
+ * through the callchain.
+ */
+ size_t delta_base_cache_limit;
};
#define GC_CONFIG_INIT { \
@@ -153,6 +158,7 @@ struct gc_config {
.prune_expire = xstrdup("2.weeks.ago"), \
.prune_worktrees_expire = xstrdup("3.months.ago"), \
.max_delta_cache_size = DEFAULT_DELTA_CACHE_SIZE, \
+ .delta_base_cache_limit = DEFAULT_DELTA_BASE_CACHE_LIMIT, \
}
static void gc_config_release(struct gc_config *cfg)
@@ -168,6 +174,7 @@ static void gc_config(struct gc_config *cfg)
{
const char *value;
char *owned = NULL;
+ unsigned long ulongval;
if (!git_config_get_value("gc.packrefs", &value)) {
if (value && !strcmp(value, "notbare"))
@@ -206,6 +213,9 @@ static void gc_config(struct gc_config *cfg)
git_config_get_ulong("gc.bigpackthreshold", &cfg->big_pack_threshold);
git_config_get_ulong("pack.deltacachesize", &cfg->max_delta_cache_size);
+ if (!git_config_get_ulong("core.deltabasecachelimit", &ulongval))
+ cfg->delta_base_cache_limit = ulongval;
+
if (!git_config_get_string("gc.repackfilter", &owned)) {
free(cfg->repack_filter);
cfg->repack_filter = owned;
@@ -416,7 +426,7 @@ static uint64_t estimate_repack_memory(struct gc_config *cfg,
* read_sha1_file() (either at delta calculation phase, or
* writing phase) also fills up the delta base cache
*/
- heap += delta_base_cache_limit;
+ heap += cfg->delta_base_cache_limit;
/* and of course pack-objects has its own delta cache */
heap += cfg->max_delta_cache_size;
@@ -1561,7 +1571,8 @@ static int task_option_parse(const struct option *opt UNUSED,
return 0;
}
-static int maintenance_run(int argc, const char **argv, const char *prefix)
+static int maintenance_run(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int i;
struct maintenance_run_opts opts = MAINTENANCE_RUN_OPTS_INIT;
@@ -1623,7 +1634,8 @@ static char const * const builtin_maintenance_register_usage[] = {
NULL
};
-static int maintenance_register(int argc, const char **argv, const char *prefix)
+static int maintenance_register(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
char *config_file = NULL;
struct option options[] = {
@@ -1687,7 +1699,8 @@ static char const * const builtin_maintenance_unregister_usage[] = {
NULL
};
-static int maintenance_unregister(int argc, const char **argv, const char *prefix)
+static int maintenance_unregister(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int force = 0;
char *config_file = NULL;
@@ -2890,8 +2903,17 @@ static int update_background_schedule(const struct maintenance_start_opts *opts,
char *lock_path = xstrfmt("%s/schedule", the_repository->objects->odb->path);
if (hold_lock_file_for_update(&lk, lock_path, LOCK_NO_DEREF) < 0) {
+ if (errno == EEXIST)
+ error(_("unable to create '%s.lock': %s.\n\n"
+ "Another scheduled git-maintenance(1) process seems to be running in this\n"
+ "repository. Please make sure no other maintenance processes are running and\n"
+ "then try again. If it still fails, a git-maintenance(1) process may have\n"
+ "crashed in this repository earlier: remove the file manually to continue."),
+ absolute_path(lock_path), strerror(errno));
+ else
+ error_errno(_("cannot acquire lock for scheduled background maintenance"));
free(lock_path);
- return error(_("another process is scheduling background maintenance"));
+ return -1;
}
for (i = 1; i < ARRAY_SIZE(scheduler_fn); i++) {
@@ -2917,7 +2939,8 @@ static const char *const builtin_maintenance_start_usage[] = {
NULL
};
-static int maintenance_start(int argc, const char **argv, const char *prefix)
+static int maintenance_start(int argc, const char **argv, const char *prefix,
+ struct repository *repo)
{
struct maintenance_start_opts opts = { 0 };
struct option options[] = {
@@ -2940,7 +2963,7 @@ static int maintenance_start(int argc, const char **argv, const char *prefix)
if (update_background_schedule(&opts, 1))
die(_("failed to set up maintenance schedule"));
- if (maintenance_register(ARRAY_SIZE(register_args)-1, register_args, NULL))
+ if (maintenance_register(ARRAY_SIZE(register_args)-1, register_args, NULL, repo))
warning(_("failed to add repo to global config"));
return 0;
}
@@ -2950,7 +2973,8 @@ static const char *const builtin_maintenance_stop_usage[] = {
NULL
};
-static int maintenance_stop(int argc, const char **argv, const char *prefix)
+static int maintenance_stop(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct option options[] = {
OPT_END()
@@ -2970,7 +2994,7 @@ static const char * const builtin_maintenance_usage[] = {
int cmd_maintenance(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
parse_opt_subcommand_fn *fn = NULL;
struct option builtin_maintenance_options[] = {
@@ -2984,5 +3008,5 @@ int cmd_maintenance(int argc,
argc = parse_options(argc, argv, prefix, builtin_maintenance_options,
builtin_maintenance_usage, 0);
- return fn(argc, argv, prefix);
+ return fn(argc, argv, prefix, repo);
}
diff --git a/builtin/help.c b/builtin/help.c
index 4a5a079070..6a72d991a8 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -551,12 +551,12 @@ static void show_html_page(const char *page)
open_html(page_path.buf);
}
-static const char *check_git_cmd(const char* cmd)
+static char *check_git_cmd(const char *cmd)
{
char *alias;
if (is_git_command(cmd))
- return cmd;
+ return xstrdup(cmd);
alias = alias_lookup(cmd);
if (alias) {
@@ -589,14 +589,13 @@ static const char *check_git_cmd(const char* cmd)
die(_("bad alias.%s string: %s"), cmd,
split_cmdline_strerror(count));
free(argv);
- UNLEAK(alias);
return alias;
}
if (exclude_guides)
return help_unknown_cmd(cmd);
- return cmd;
+ return xstrdup(cmd);
}
static void no_help_format(const char *opt_mode, enum help_format fmt)
@@ -642,6 +641,7 @@ int cmd_help(int argc,
{
int nongit;
enum help_format parsed_help_format;
+ char *command = NULL;
const char *page;
argc = parse_options(argc, argv, prefix, builtin_help_options,
@@ -713,9 +713,9 @@ int cmd_help(int argc,
if (help_format == HELP_FORMAT_NONE)
help_format = parse_help_format(DEFAULT_HELP_FORMAT);
- argv[0] = check_git_cmd(argv[0]);
+ command = check_git_cmd(argv[0]);
- page = cmd_to_page(argv[0]);
+ page = cmd_to_page(command);
switch (help_format) {
case HELP_FORMAT_NONE:
case HELP_FORMAT_MAN:
@@ -729,5 +729,6 @@ int cmd_help(int argc,
break;
}
+ free(command);
return 0;
}
diff --git a/builtin/hook.c b/builtin/hook.c
index 367ef3e0b8..672d2e37e8 100644
--- a/builtin/hook.c
+++ b/builtin/hook.c
@@ -19,7 +19,8 @@ static const char * const builtin_hook_run_usage[] = {
NULL
};
-static int run(int argc, const char **argv, const char *prefix)
+static int run(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int i;
struct run_hooks_opt opt = RUN_HOOKS_OPT_INIT;
@@ -70,7 +71,7 @@ usage:
int cmd_hook(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
parse_opt_subcommand_fn *fn = NULL;
struct option builtin_hook_options[] = {
@@ -81,5 +82,5 @@ int cmd_hook(int argc,
argc = parse_options(argc, argv, NULL, builtin_hook_options,
builtin_hook_usage, 0);
- return fn(argc, argv, prefix);
+ return fn(argc, argv, prefix, repo);
}
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 95babdc5ea..cde49e0b4d 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -155,11 +155,11 @@ static int input_fd, output_fd;
static const char *curr_pack;
/*
- * local_links is guarded by read_mutex, and record_local_links is read-only in
- * a thread.
+ * outgoing_links is guarded by read_mutex, and record_outgoing_links is
+ * read-only in a thread.
*/
-static struct oidset local_links = OIDSET_INIT;
-static int record_local_links;
+static struct oidset outgoing_links = OIDSET_INIT;
+static int record_outgoing_links;
static struct thread_local_data *thread_data;
static int nr_dispatched;
@@ -812,18 +812,41 @@ static int check_collison(struct object_entry *entry)
return 0;
}
-static void record_if_local_object(const struct object_id *oid)
+static void record_outgoing_link(const struct object_id *oid)
{
- struct object_info info = OBJECT_INFO_INIT;
- if (oid_object_info_extended(the_repository, oid, &info, 0))
- /* Missing; assume it is a promisor object */
- return;
- if (info.whence == OI_PACKED && info.u.packed.pack->pack_promisor)
- return;
- oidset_insert(&local_links, oid);
+ oidset_insert(&outgoing_links, oid);
+}
+
+static void maybe_record_name_entry(const struct name_entry *entry)
+{
+ /*
+ * Checking only trees here results in a significantly faster packfile
+ * indexing, but the drawback is that if the packfile to be indexed
+ * references a local blob only directly (that is, never through a
+ * local tree), that local blob is in danger of being garbage
+ * collected. Such a situation may arise if we push local commits,
+ * including one with a change to a blob in the root tree, and then the
+ * server incorporates them into its main branch through a "rebase" or
+ * "squash" merge strategy, and then we fetch the new main branch from
+ * the server.
+ *
+ * This situation has not been observed yet - we have only noticed
+ * missing commits, not missing trees or blobs. (In fact, if it were
+ * believed that only missing commits are problematic, one could argue
+ * that we should also exclude trees during the outgoing link check;
+ * but it is safer to include them.)
+ *
+ * Due to the rarity of the situation (it has not been observed to
+ * happen in real life), and because the "penalty" in such a situation
+ * is merely to refetch the missing blob when it's needed (and this
+ * happens only once - when refetched, the blob goes into a promisor
+ * pack, so it won't be GC-ed, the tradeoff seems worth it.
+ */
+ if (S_ISDIR(entry->mode))
+ record_outgoing_link(&entry->oid);
}
-static void do_record_local_links(struct object *obj)
+static void do_record_outgoing_links(struct object *obj)
{
if (obj->type == OBJ_TREE) {
struct tree *tree = (struct tree *)obj;
@@ -837,16 +860,17 @@ static void do_record_local_links(struct object *obj)
*/
return;
while (tree_entry_gently(&desc, &entry))
- record_if_local_object(&entry.oid);
+ maybe_record_name_entry(&entry);
} else if (obj->type == OBJ_COMMIT) {
struct commit *commit = (struct commit *) obj;
struct commit_list *parents = commit->parents;
+ record_outgoing_link(get_commit_tree_oid(commit));
for (; parents; parents = parents->next)
- record_if_local_object(&parents->item->object.oid);
+ record_outgoing_link(&parents->item->object.oid);
} else if (obj->type == OBJ_TAG) {
struct tag *tag = (struct tag *) obj;
- record_if_local_object(get_tagged_oid(tag));
+ record_outgoing_link(get_tagged_oid(tag));
}
}
@@ -896,7 +920,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
free(has_data);
}
- if (strict || do_fsck_object || record_local_links) {
+ if (strict || do_fsck_object || record_outgoing_links) {
read_lock();
if (type == OBJ_BLOB) {
struct blob *blob = lookup_blob(the_repository, oid);
@@ -928,8 +952,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
die(_("fsck error in packed object"));
if (strict && fsck_walk(obj, NULL, &fsck_options))
die(_("Not all child objects of %s are reachable"), oid_to_hex(&obj->oid));
- if (record_local_links)
- do_record_local_links(obj);
+ if (record_outgoing_links)
+ do_record_outgoing_links(obj);
if (obj->type == OBJ_TREE) {
struct tree *item = (struct tree *) obj;
@@ -1291,7 +1315,7 @@ static void parse_pack_objects(unsigned char *hash)
* recursively checking if the resulting object is used as a base
* for some more deltas.
*/
-static void resolve_deltas(void)
+static void resolve_deltas(struct pack_idx_option *opts)
{
int i;
@@ -1307,7 +1331,7 @@ static void resolve_deltas(void)
nr_ref_deltas + nr_ofs_deltas);
nr_dispatched = 0;
- base_cache_limit = delta_base_cache_limit * nr_threads;
+ base_cache_limit = opts->delta_base_cache_limit * nr_threads;
if (nr_threads > 1 || getenv("GIT_FORCE_THREADS")) {
init_thread();
work_lock();
@@ -1532,7 +1556,7 @@ static void write_special_file(const char *suffix, const char *msg,
if (pack_name)
filename = derive_filename(pack_name, "pack", suffix, &name_buf);
else
- filename = odb_pack_name(&name_buf, hash, suffix);
+ filename = odb_pack_name(the_repository, &name_buf, hash, suffix);
fd = odb_pack_keep(filename);
if (fd < 0) {
@@ -1560,7 +1584,7 @@ static void rename_tmp_packfile(const char **final_name,
{
if (!*final_name || strcmp(*final_name, curr_name)) {
if (!*final_name)
- *final_name = odb_pack_name(name, hash, ext);
+ *final_name = odb_pack_name(the_repository, name, hash, ext);
if (finalize_object_file(curr_name, *final_name))
die(_("unable to rename temporary '*.%s' file to '%s'"),
ext, *final_name);
@@ -1605,7 +1629,8 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
if (do_fsck_object) {
struct packed_git *p;
- p = add_packed_git(final_index_name, strlen(final_index_name), 0);
+ p = add_packed_git(the_repository, final_index_name,
+ strlen(final_index_name), 0);
if (p)
install_packed_git(the_repository, p);
}
@@ -1656,6 +1681,10 @@ static int git_index_pack_config(const char *k, const char *v,
else
opts->flags &= ~WRITE_REV;
}
+ if (!strcmp(k, "core.deltabasecachelimit")) {
+ opts->delta_base_cache_limit = git_config_ulong(k, v, ctx->kvi);
+ return 0;
+ }
return git_default_config(k, v, ctx, cb);
}
@@ -1703,7 +1732,8 @@ static void read_v2_anomalous_offsets(struct packed_git *p,
static void read_idx_option(struct pack_idx_option *opts, const char *pack_name)
{
- struct packed_git *p = add_packed_git(pack_name, strlen(pack_name), 1);
+ struct packed_git *p = add_packed_git(the_repository, pack_name,
+ strlen(pack_name), 1);
if (!p)
die(_("Cannot open existing pack file '%s'"), pack_name);
@@ -1779,28 +1809,43 @@ static void repack_local_links(void)
struct strbuf line = STRBUF_INIT;
struct oidset_iter iter;
struct object_id *oid;
- char *base_name;
+ char *base_name = NULL;
- if (!oidset_size(&local_links))
+ if (!oidset_size(&outgoing_links))
return;
- base_name = mkpathdup("%s/pack/pack", repo_get_object_directory(the_repository));
+ oidset_iter_init(&outgoing_links, &iter);
+ while ((oid = oidset_iter_next(&iter))) {
+ struct object_info info = OBJECT_INFO_INIT;
+ if (oid_object_info_extended(the_repository, oid, &info, 0))
+ /* Missing; assume it is a promisor object */
+ continue;
+ if (info.whence == OI_PACKED && info.u.packed.pack->pack_promisor)
+ continue;
- strvec_push(&cmd.args, "pack-objects");
- strvec_push(&cmd.args, "--exclude-promisor-objects-best-effort");
- strvec_push(&cmd.args, base_name);
- cmd.git_cmd = 1;
- cmd.in = -1;
- cmd.out = -1;
- if (start_command(&cmd))
- die(_("could not start pack-objects to repack local links"));
+ if (!cmd.args.nr) {
+ base_name = mkpathdup(
+ "%s/pack/pack",
+ repo_get_object_directory(the_repository));
+ strvec_push(&cmd.args, "pack-objects");
+ strvec_push(&cmd.args,
+ "--exclude-promisor-objects-best-effort");
+ strvec_push(&cmd.args, base_name);
+ cmd.git_cmd = 1;
+ cmd.in = -1;
+ cmd.out = -1;
+ if (start_command(&cmd))
+ die(_("could not start pack-objects to repack local links"));
+ }
- oidset_iter_init(&local_links, &iter);
- while ((oid = oidset_iter_next(&iter))) {
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 local object to pack-objects"));
}
+
+ if (!cmd.args.nr)
+ return;
+
close(cmd.in);
out = xfdopen(cmd.out, "r");
@@ -1899,7 +1944,7 @@ int cmd_index_pack(int argc,
} else if (skip_to_optional_arg(arg, "--keep", &keep_msg)) {
; /* nothing to do */
} else if (skip_to_optional_arg(arg, "--promisor", &promisor_msg)) {
- record_local_links = 1;
+ record_outgoing_links = 1;
} else if (starts_with(arg, "--threads=")) {
char *end;
nr_threads = strtoul(arg+10, &end, 0);
@@ -2035,7 +2080,7 @@ int cmd_index_pack(int argc,
parse_pack_objects(pack_hash);
if (report_end_of_input)
write_in_full(2, "\0", 1);
- resolve_deltas();
+ resolve_deltas(&opts);
conclude_pack(fix_thin_pack, curr_pack, pack_hash);
free(ofs_deltas);
free(ref_deltas);
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 7e00d57d65..096f96b9c4 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -75,10 +75,12 @@ int cmd_init_db(int argc,
const char *prefix,
struct repository *repo UNUSED)
{
- const char *git_dir;
+ char *git_dir;
const char *real_git_dir = NULL;
- const char *work_tree;
+ char *real_git_dir_to_free = NULL;
+ char *work_tree = NULL;
const char *template_dir = NULL;
+ char *template_dir_to_free = NULL;
unsigned int flags = 0;
const char *object_format = NULL;
const char *ref_format = NULL;
@@ -106,6 +108,7 @@ int cmd_init_db(int argc,
N_("specify the reference format to use")),
OPT_END()
};
+ int ret;
argc = parse_options(argc, argv, prefix, init_db_options, init_db_usage, 0);
@@ -113,12 +116,10 @@ int cmd_init_db(int argc,
die(_("options '%s' and '%s' cannot be used together"), "--separate-git-dir", "--bare");
if (real_git_dir && !is_absolute_path(real_git_dir))
- real_git_dir = real_pathdup(real_git_dir, 1);
+ real_git_dir = real_git_dir_to_free = real_pathdup(real_git_dir, 1);
- if (template_dir && *template_dir && !is_absolute_path(template_dir)) {
- template_dir = absolute_pathdup(template_dir);
- UNLEAK(template_dir);
- }
+ if (template_dir && *template_dir && !is_absolute_path(template_dir))
+ template_dir = template_dir_to_free = absolute_pathdup(template_dir);
if (argc == 1) {
int mkdir_tried = 0;
@@ -192,7 +193,7 @@ int cmd_init_db(int argc,
* Set up the default .git directory contents
*/
if (!git_dir)
- git_dir = DEFAULT_GIT_DIR_ENVIRONMENT;
+ git_dir = xstrdup(DEFAULT_GIT_DIR_ENVIRONMENT);
/*
* When --separate-git-dir is used inside a linked worktree, take
@@ -213,6 +214,7 @@ int cmd_init_db(int argc,
if (chdir(mainwt.buf) < 0)
die_errno(_("cannot chdir to %s"), mainwt.buf);
strbuf_release(&mainwt);
+ free(git_dir);
git_dir = strbuf_detach(&sb, NULL);
}
strbuf_release(&sb);
@@ -245,12 +247,14 @@ int cmd_init_db(int argc,
set_git_work_tree(work_tree);
}
- UNLEAK(real_git_dir);
- UNLEAK(git_dir);
- UNLEAK(work_tree);
-
flags |= INIT_DB_EXIST_OK;
- return init_db(git_dir, real_git_dir, template_dir, hash_algo,
- ref_storage_format, initial_branch,
- init_shared_repository, flags);
+ ret = init_db(git_dir, real_git_dir, template_dir, hash_algo,
+ ref_storage_format, initial_branch,
+ init_shared_repository, flags);
+
+ free(template_dir_to_free);
+ free(real_git_dir_to_free);
+ free(work_tree);
+ free(git_dir);
+ return ret;
}
diff --git a/builtin/log.c b/builtin/log.c
index 368f6580a6..923e4e6069 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -528,10 +528,14 @@ static int cmd_log_walk_no_free(struct rev_info *rev)
* but we didn't actually show the commit.
*/
rev->max_count++;
- if (!rev->reflog_info) {
+ if (!rev->reflog_info && !rev->remerge_diff) {
/*
* We may show a given commit multiple times when
- * walking the reflogs.
+ * walking the reflogs. Therefore we still need it.
+ *
+ * Likewise, we potentially still need the parents
+ * of * already shown commits to determine merge
+ * bases when showing remerge diffs.
*/
free_commit_buffer(the_repository->parsed_objects,
commit);
diff --git a/builtin/merge.c b/builtin/merge.c
index 51038eaca8..e32c99087f 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -498,7 +498,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
char *found_ref = NULL;
int len, early;
- strbuf_branchname(&bname, remote, 0);
+ copy_branchname(&bname, remote, 0);
remote = bname.buf;
oidclr(&branch_head, the_repository->hash_algo);
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index d159ed1314..2a938466f5 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -119,7 +119,8 @@ static void read_packs_from_stdin(struct string_list *to)
}
static int cmd_multi_pack_index_write(int argc, const char **argv,
- const char *prefix)
+ const char *prefix,
+ struct repository *repo)
{
struct option *options;
static struct option builtin_multi_pack_index_write_options[] = {
@@ -164,7 +165,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,
read_packs_from_stdin(&packs);
- ret = write_midx_file_only(opts.object_dir, &packs,
+ ret = write_midx_file_only(repo, opts.object_dir, &packs,
opts.preferred_pack,
opts.refs_snapshot, opts.flags);
@@ -175,7 +176,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,
}
- ret = write_midx_file(opts.object_dir, opts.preferred_pack,
+ ret = write_midx_file(repo, opts.object_dir, opts.preferred_pack,
opts.refs_snapshot, opts.flags);
free(opts.refs_snapshot);
@@ -183,7 +184,8 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,
}
static int cmd_multi_pack_index_verify(int argc, const char **argv,
- const char *prefix)
+ const char *prefix,
+ struct repository *repo UNUSED)
{
struct option *options;
static struct option builtin_multi_pack_index_verify_options[] = {
@@ -210,7 +212,8 @@ static int cmd_multi_pack_index_verify(int argc, const char **argv,
}
static int cmd_multi_pack_index_expire(int argc, const char **argv,
- const char *prefix)
+ const char *prefix,
+ struct repository *repo UNUSED)
{
struct option *options;
static struct option builtin_multi_pack_index_expire_options[] = {
@@ -237,7 +240,8 @@ static int cmd_multi_pack_index_expire(int argc, const char **argv,
}
static int cmd_multi_pack_index_repack(int argc, const char **argv,
- const char *prefix)
+ const char *prefix,
+ struct repository *repo UNUSED)
{
struct option *options;
static struct option builtin_multi_pack_index_repack_options[] = {
@@ -271,7 +275,7 @@ static int cmd_multi_pack_index_repack(int argc, const char **argv,
int cmd_multi_pack_index(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
int res;
parse_opt_subcommand_fn *fn = NULL;
@@ -297,7 +301,7 @@ int cmd_multi_pack_index(int argc,
builtin_multi_pack_index_usage, 0);
FREE_AND_NULL(options);
- res = fn(argc, argv, prefix);
+ res = fn(argc, argv, prefix, repo);
free(opts.object_dir);
return res;
diff --git a/builtin/notes.c b/builtin/notes.c
index 72c8a51cfa..d051abf6df 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -431,7 +431,8 @@ static struct notes_tree *init_notes_check(const char *subcommand,
return t;
}
-static int list(int argc, const char **argv, const char *prefix)
+static int list(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct notes_tree *t;
struct object_id object;
@@ -468,9 +469,11 @@ static int list(int argc, const char **argv, const char *prefix)
return retval;
}
-static int append_edit(int argc, const char **argv, const char *prefix);
+static int append_edit(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED);
-static int add(int argc, const char **argv, const char *prefix)
+static int add(int argc, const char **argv, const char *prefix,
+ struct repository *repo)
{
int force = 0, allow_empty = 0;
const char *object_ref;
@@ -543,7 +546,7 @@ static int add(int argc, const char **argv, const char *prefix)
* argv[0-1].
*/
argv[0] = "edit";
- return append_edit(argc, argv, prefix);
+ return append_edit(argc, argv, prefix, repo);
}
fprintf(stderr, _("Overwriting existing notes for object %s\n"),
oid_to_hex(&object));
@@ -569,7 +572,8 @@ static int add(int argc, const char **argv, const char *prefix)
return 0;
}
-static int copy(int argc, const char **argv, const char *prefix)
+static int copy(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int retval = 0, force = 0, from_stdin = 0;
const struct object_id *from_note, *note;
@@ -646,7 +650,8 @@ out:
return retval;
}
-static int append_edit(int argc, const char **argv, const char *prefix)
+static int append_edit(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int allow_empty = 0;
const char *object_ref;
@@ -749,7 +754,8 @@ static int append_edit(int argc, const char **argv, const char *prefix)
return 0;
}
-static int show(int argc, const char **argv, const char *prefix)
+static int show(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
const char *object_ref;
struct notes_tree *t;
@@ -875,7 +881,8 @@ static int git_config_get_notes_strategy(const char *key,
return 0;
}
-static int merge(int argc, const char **argv, const char *prefix)
+static int merge(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct strbuf remote_ref = STRBUF_INIT, msg = STRBUF_INIT;
struct object_id result_oid;
@@ -1016,7 +1023,8 @@ static int remove_one_note(struct notes_tree *t, const char *name, unsigned flag
return (flag & IGNORE_MISSING) ? 0 : status;
}
-static int remove_cmd(int argc, const char **argv, const char *prefix)
+static int remove_cmd(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
unsigned flag = 0;
int from_stdin = 0;
@@ -1059,7 +1067,8 @@ static int remove_cmd(int argc, const char **argv, const char *prefix)
return retval;
}
-static int prune(int argc, const char **argv, const char *prefix)
+static int prune(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct notes_tree *t;
int show_only = 0, verbose = 0;
@@ -1088,7 +1097,8 @@ static int prune(int argc, const char **argv, const char *prefix)
return 0;
}
-static int get_ref(int argc, const char **argv, const char *prefix)
+static int get_ref(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct option options[] = { OPT_END() };
char *notes_ref;
@@ -1109,7 +1119,7 @@ static int get_ref(int argc, const char **argv, const char *prefix)
int cmd_notes(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
const char *override_notes_ref = NULL;
parse_opt_subcommand_fn *fn = NULL;
@@ -1148,5 +1158,5 @@ int cmd_notes(int argc,
strbuf_release(&sb);
}
- return !!fn(argc, argv, prefix);
+ return !!fn(argc, argv, prefix, repo);
}
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 676a586709..7dc51c03c4 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1515,7 +1515,7 @@ static int want_found_object(const struct object_id *oid, int exclude,
return 0;
if (ignore_packed_keep_in_core && p->pack_keep_in_core)
return 0;
- if (has_object_kept_pack(oid, flags))
+ if (has_object_kept_pack(p->repo, oid, flags))
return 0;
}
@@ -3613,7 +3613,7 @@ static void show_cruft_commit(struct commit *commit, void *data)
static int cruft_include_check_obj(struct object *obj, void *data UNUSED)
{
- return !has_object_kept_pack(&obj->oid, IN_CORE_KEEP_PACKS);
+ return !has_object_kept_pack(to_pack.repo, &obj->oid, IN_CORE_KEEP_PACKS);
}
static int cruft_include_check(struct commit *commit, void *data)
@@ -3844,7 +3844,8 @@ static void show_object__ma_allow_promisor(struct object *obj, const char *name,
* Quietly ignore EXPECTED missing objects. This avoids problems with
* staging them now and getting an odd error later.
*/
- if (!has_object(the_repository, &obj->oid, 0) && is_promisor_object(&obj->oid))
+ if (!has_object(the_repository, &obj->oid, 0) &&
+ is_promisor_object(to_pack.repo, &obj->oid))
return;
show_object(obj, name, data);
@@ -3913,7 +3914,9 @@ static int add_object_in_unpacked_pack(const struct object_id *oid,
static void add_objects_in_unpacked_packs(void)
{
- if (for_each_packed_object(add_object_in_unpacked_pack, NULL,
+ if (for_each_packed_object(to_pack.repo,
+ add_object_in_unpacked_pack,
+ NULL,
FOR_EACH_OBJECT_PACK_ORDER |
FOR_EACH_OBJECT_LOCAL_ONLY |
FOR_EACH_OBJECT_SKIP_IN_CORE_KEPT_PACKS |
diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c
index d2c1c4e5ec..bc61990a93 100644
--- a/builtin/pack-redundant.c
+++ b/builtin/pack-redundant.c
@@ -690,7 +690,7 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED, s
pl = red = pack_list_difference(local_packs, min);
while (pl) {
printf("%s\n%s\n",
- odb_pack_name(&idx_name, pl->pack->hash, "idx"),
+ odb_pack_name(pl->pack->repo, &idx_name, pl->pack->hash, "idx"),
pl->pack->pack_name);
pl = pl->next;
}
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index ab5b20e39c..9d2c07f68d 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1849,7 +1849,7 @@ static void execute_commands_non_atomic(struct command *commands,
continue;
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction) {
rp_error("%s", err.buf);
strbuf_reset(&err);
@@ -1878,7 +1878,7 @@ static void execute_commands_atomic(struct command *commands,
const char *reported_error = "atomic push failure";
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction) {
rp_error("%s", err.buf);
strbuf_reset(&err);
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 22df6834f7..5a0c22f2f7 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -234,7 +234,8 @@ static int expire_total_callback(const struct option *opt,
return 0;
}
-static int cmd_reflog_show(int argc, const char **argv, const char *prefix)
+static int cmd_reflog_show(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct option options[] = {
OPT_END()
@@ -253,7 +254,8 @@ static int show_reflog(const char *refname, void *cb_data UNUSED)
return 0;
}
-static int cmd_reflog_list(int argc, const char **argv, const char *prefix)
+static int cmd_reflog_list(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct option options[] = {
OPT_END()
@@ -270,7 +272,8 @@ static int cmd_reflog_list(int argc, const char **argv, const char *prefix)
return refs_for_each_reflog(ref_store, show_reflog, NULL);
}
-static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
+static int cmd_reflog_expire(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct cmd_reflog_expire_cb cmd = { 0 };
timestamp_t now = time(NULL);
@@ -394,7 +397,8 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
return status;
}
-static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
+static int cmd_reflog_delete(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int i, status = 0;
unsigned int flags = 0;
@@ -424,7 +428,8 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
return status;
}
-static int cmd_reflog_exists(int argc, const char **argv, const char *prefix)
+static int cmd_reflog_exists(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct option options[] = {
OPT_END()
@@ -467,7 +472,7 @@ int cmd_reflog(int argc,
PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_ARGV0 |
PARSE_OPT_KEEP_UNKNOWN_OPT);
if (fn)
- return fn(argc - 1, argv + 1, prefix);
+ return fn(argc - 1, argv + 1, prefix, repository);
else
return cmd_log_reflog(argc, argv, prefix, repository);
}
diff --git a/builtin/refs.c b/builtin/refs.c
index 24978a7b7b..a29f195834 100644
--- a/builtin/refs.c
+++ b/builtin/refs.c
@@ -5,6 +5,7 @@
#include "parse-options.h"
#include "refs.h"
#include "strbuf.h"
+#include "worktree.h"
#define REFS_MIGRATE_USAGE \
N_("git refs migrate --ref-format=<format> [--dry-run]")
@@ -12,7 +13,8 @@
#define REFS_VERIFY_USAGE \
N_("git refs verify [--strict] [--verbose]")
-static int cmd_refs_migrate(int argc, const char **argv, const char *prefix)
+static int cmd_refs_migrate(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
const char * const migrate_usage[] = {
REFS_MIGRATE_USAGE,
@@ -63,9 +65,11 @@ out:
return err;
}
-static int cmd_refs_verify(int argc, const char **argv, const char *prefix)
+static int cmd_refs_verify(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct fsck_options fsck_refs_options = FSCK_REFS_OPTIONS_DEFAULT;
+ struct worktree **worktrees;
const char * const verify_usage[] = {
REFS_VERIFY_USAGE,
NULL,
@@ -75,7 +79,7 @@ static int cmd_refs_verify(int argc, const char **argv, const char *prefix)
OPT_BOOL(0, "strict", &fsck_refs_options.strict, N_("enable strict checking")),
OPT_END(),
};
- int ret;
+ int ret = 0;
argc = parse_options(argc, argv, prefix, options, verify_usage, 0);
if (argc)
@@ -84,16 +88,20 @@ static int cmd_refs_verify(int argc, const char **argv, const char *prefix)
git_config(git_fsck_config, &fsck_refs_options);
prepare_repo_settings(the_repository);
- ret = refs_fsck(get_main_ref_store(the_repository), &fsck_refs_options);
+ worktrees = get_worktrees();
+ for (size_t i = 0; worktrees[i]; i++)
+ ret |= refs_fsck(get_worktree_ref_store(worktrees[i]),
+ &fsck_refs_options, worktrees[i]);
fsck_options_clear(&fsck_refs_options);
+ free_worktrees(worktrees);
return ret;
}
int cmd_refs(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
const char * const refs_usage[] = {
REFS_MIGRATE_USAGE,
@@ -108,5 +116,5 @@ int cmd_refs(int argc,
};
argc = parse_options(argc, argv, prefix, opts, refs_usage, 0);
- return fn(argc, argv, prefix);
+ return fn(argc, argv, prefix, repo);
}
diff --git a/builtin/remote.c b/builtin/remote.c
index 9093600965..32d02ca4a0 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -155,7 +155,8 @@ static int parse_mirror_opt(const struct option *opt, const char *arg, int not)
return 0;
}
-static int add(int argc, const char **argv, const char *prefix)
+static int add(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int fetch = 0, fetch_tags = TAGS_DEFAULT;
unsigned mirror = MIRROR_NONE;
@@ -706,7 +707,8 @@ static void handle_push_default(const char* old_name, const char* new_name)
}
-static int mv(int argc, const char **argv, const char *prefix)
+static int mv(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int show_progress = isatty(2);
struct option options[] = {
@@ -881,7 +883,8 @@ out:
return result;
}
-static int rm(int argc, const char **argv, const char *prefix)
+static int rm(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct option options[] = {
OPT_END()
@@ -1303,7 +1306,8 @@ static int show_all(void)
return result;
}
-static int show(int argc, const char **argv, const char *prefix)
+static int show(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int no_query = 0, result = 0, query_flag = 0;
struct option options[] = {
@@ -1399,11 +1403,42 @@ static int show(int argc, const char **argv, const char *prefix)
return result;
}
-static int set_head(int argc, const char **argv, const char *prefix)
+static void report_set_head_auto(const char *remote, const char *head_name,
+ struct strbuf *b_local_head, int was_detached) {
+ struct strbuf buf_prefix = STRBUF_INIT;
+ const char *prev_head = NULL;
+
+ strbuf_addf(&buf_prefix, "refs/remotes/%s/", remote);
+ skip_prefix(b_local_head->buf, buf_prefix.buf, &prev_head);
+
+ if (prev_head && !strcmp(prev_head, head_name))
+ printf(_("'%s/HEAD' is unchanged and points to '%s'\n"),
+ remote, head_name);
+ else if (prev_head)
+ printf(_("'%s/HEAD' has changed from '%s' and now points to '%s'\n"),
+ remote, prev_head, head_name);
+ else if (!b_local_head->len)
+ printf(_("'%s/HEAD' is now created and points to '%s'\n"),
+ remote, head_name);
+ else if (was_detached && b_local_head->len)
+ printf(_("'%s/HEAD' was detached at '%s' and now points to '%s'\n"),
+ remote, b_local_head->buf, head_name);
+ else
+ printf(_("'%s/HEAD' used to point to '%s' "
+ "(which is not a remote branch), but now points to '%s'\n"),
+ remote, b_local_head->buf, head_name);
+ strbuf_release(&buf_prefix);
+}
+
+static int set_head(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
- int i, opt_a = 0, opt_d = 0, result = 0;
- struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT;
+ int i, opt_a = 0, opt_d = 0, result = 0, was_detached;
+ struct strbuf b_head = STRBUF_INIT, b_remote_head = STRBUF_INIT,
+ b_local_head = STRBUF_INIT;
char *head_name = NULL;
+ struct ref_store *refs = get_main_ref_store(the_repository);
+ struct remote *remote;
struct option options[] = {
OPT_BOOL('a', "auto", &opt_a,
@@ -1414,8 +1449,10 @@ static int set_head(int argc, const char **argv, const char *prefix)
};
argc = parse_options(argc, argv, prefix, options,
builtin_remote_sethead_usage, 0);
- if (argc)
- strbuf_addf(&buf, "refs/remotes/%s/HEAD", argv[0]);
+ if (argc) {
+ strbuf_addf(&b_head, "refs/remotes/%s/HEAD", argv[0]);
+ remote = remote_get(argv[0]);
+ }
if (!opt_a && !opt_d && argc == 2) {
head_name = xstrdup(argv[1]);
@@ -1434,25 +1471,39 @@ static int set_head(int argc, const char **argv, const char *prefix)
head_name = xstrdup(states.heads.items[0].string);
free_remote_ref_states(&states);
} else if (opt_d && !opt_a && argc == 1) {
- if (refs_delete_ref(get_main_ref_store(the_repository), NULL, buf.buf, NULL, REF_NO_DEREF))
- result |= error(_("Could not delete %s"), buf.buf);
+ if (refs_delete_ref(refs, NULL, b_head.buf, NULL, REF_NO_DEREF))
+ result |= error(_("Could not delete %s"), b_head.buf);
} else
usage_with_options(builtin_remote_sethead_usage, options);
- if (head_name) {
- strbuf_addf(&buf2, "refs/remotes/%s/%s", argv[0], head_name);
- /* make sure it's valid */
- if (!refs_ref_exists(get_main_ref_store(the_repository), buf2.buf))
- result |= error(_("Not a valid ref: %s"), buf2.buf);
- else if (refs_update_symref(get_main_ref_store(the_repository), buf.buf, buf2.buf, "remote set-head"))
- result |= error(_("Could not setup %s"), buf.buf);
- else if (opt_a)
- printf("%s/HEAD set to %s\n", argv[0], head_name);
- free(head_name);
+ if (!head_name)
+ goto cleanup;
+ strbuf_addf(&b_remote_head, "refs/remotes/%s/%s", argv[0], head_name);
+ if (!refs_ref_exists(refs, b_remote_head.buf)) {
+ result |= error(_("Not a valid ref: %s"), b_remote_head.buf);
+ goto cleanup;
+ }
+ was_detached = refs_update_symref_extended(refs, b_head.buf, b_remote_head.buf,
+ "remote set-head", &b_local_head, 0);
+ if (was_detached == -1) {
+ result |= error(_("Could not set up %s"), b_head.buf);
+ goto cleanup;
+ }
+ if (opt_a)
+ report_set_head_auto(argv[0], head_name, &b_local_head, was_detached);
+ if (remote->follow_remote_head == FOLLOW_REMOTE_ALWAYS) {
+ struct strbuf config_name = STRBUF_INIT;
+ strbuf_addf(&config_name,
+ "remote.%s.followremotehead", remote->name);
+ git_config_set(config_name.buf, "warn");
+ strbuf_release(&config_name);
}
- strbuf_release(&buf);
- strbuf_release(&buf2);
+cleanup:
+ free(head_name);
+ strbuf_release(&b_head);
+ strbuf_release(&b_remote_head);
+ strbuf_release(&b_local_head);
return result;
}
@@ -1503,7 +1554,8 @@ static int prune_remote(const char *remote, int dry_run)
return result;
}
-static int prune(int argc, const char **argv, const char *prefix)
+static int prune(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int dry_run = 0, result = 0;
struct option options[] = {
@@ -1534,7 +1586,8 @@ static int get_remote_default(const char *key, const char *value UNUSED,
return 0;
}
-static int update(int argc, const char **argv, const char *prefix)
+static int update(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int i, prune = -1;
struct option options[] = {
@@ -1616,7 +1669,8 @@ static int set_remote_branches(const char *remotename, const char **branches,
return 0;
}
-static int set_branches(int argc, const char **argv, const char *prefix)
+static int set_branches(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int add_mode = 0;
struct option options[] = {
@@ -1635,7 +1689,8 @@ static int set_branches(int argc, const char **argv, const char *prefix)
return set_remote_branches(argv[0], argv + 1, add_mode);
}
-static int get_url(int argc, const char **argv, const char *prefix)
+static int get_url(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int i, push_mode = 0, all_mode = 0;
const char *remotename = NULL;
@@ -1674,7 +1729,8 @@ static int get_url(int argc, const char **argv, const char *prefix)
return 0;
}
-static int set_url(int argc, const char **argv, const char *prefix)
+static int set_url(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int i, push_mode = 0, add_mode = 0, delete_mode = 0;
int matches = 0, negative_matches = 0;
@@ -1765,7 +1821,7 @@ out:
int cmd_remote(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
parse_opt_subcommand_fn *fn = NULL;
struct option options[] = {
@@ -1788,7 +1844,7 @@ int cmd_remote(int argc,
PARSE_OPT_SUBCOMMAND_OPTIONAL);
if (fn) {
- return !!fn(argc, argv, prefix);
+ return !!fn(argc, argv, prefix, repo);
} else {
if (argc) {
error(_("unknown subcommand: `%s'"), argv[0]);
diff --git a/builtin/repack.c b/builtin/repack.c
index d6bb37e84a..9c21fc482d 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -404,7 +404,7 @@ static void repack_promisor_objects(const struct pack_objects_args *args,
* {type -> existing pack order} ordering when computing deltas instead
* of a {type -> size} ordering, which may produce better deltas.
*/
- for_each_packed_object(write_oid, &cmd,
+ for_each_packed_object(the_repository, write_oid, &cmd,
FOR_EACH_OBJECT_PROMISOR_ONLY);
if (cmd.in == -1) {
@@ -1569,7 +1569,7 @@ int cmd_repack(int argc,
unsigned flags = 0;
if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL, 0))
flags |= MIDX_WRITE_INCREMENTAL;
- write_midx_file(repo_get_object_directory(the_repository),
+ write_midx_file(the_repository, repo_get_object_directory(the_repository),
NULL, NULL, flags);
}
diff --git a/builtin/replace.c b/builtin/replace.c
index a44f4e7ea9..a4eaadff91 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -201,7 +201,7 @@ static int replace_object_oid(const char *object_ref,
}
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction ||
ref_transaction_update(transaction, ref.buf, repl, &prev,
NULL, NULL, 0, NULL, &err) ||
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 3078787115..8fe83893fa 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -121,7 +121,7 @@ static inline void finish_object__ma(struct object *obj)
return;
case MA_ALLOW_PROMISOR:
- if (is_promisor_object(&obj->oid))
+ if (is_promisor_object(the_repository, &obj->oid))
return;
die("unexpected missing %s object '%s'",
type_name(obj->type), oid_to_hex(&obj->oid));
diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c
index 49aedc1de8..34af5b2590 100644
--- a/builtin/sparse-checkout.c
+++ b/builtin/sparse-checkout.c
@@ -48,7 +48,8 @@ static char const * const builtin_sparse_checkout_list_usage[] = {
NULL
};
-static int sparse_checkout_list(int argc, const char **argv, const char *prefix)
+static int sparse_checkout_list(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
static struct option builtin_sparse_checkout_list_options[] = {
OPT_END(),
@@ -443,7 +444,8 @@ static struct sparse_checkout_init_opts {
int sparse_index;
} init_opts;
-static int sparse_checkout_init(int argc, const char **argv, const char *prefix)
+static int sparse_checkout_init(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct pattern_list pl;
char *sparse_filename;
@@ -669,7 +671,7 @@ static void add_patterns_literal(int argc, const char **argv,
add_patterns_from_input(pl, argc, argv, use_stdin ? stdin : NULL);
}
-static int modify_pattern_list(int argc, const char **argv, int use_stdin,
+static int modify_pattern_list(struct strvec *args, int use_stdin,
enum modify_type m)
{
int result;
@@ -679,13 +681,13 @@ static int modify_pattern_list(int argc, const char **argv, int use_stdin,
switch (m) {
case ADD:
if (core_sparse_checkout_cone)
- add_patterns_cone_mode(argc, argv, pl, use_stdin);
+ add_patterns_cone_mode(args->nr, args->v, pl, use_stdin);
else
- add_patterns_literal(argc, argv, pl, use_stdin);
+ add_patterns_literal(args->nr, args->v, pl, use_stdin);
break;
case REPLACE:
- add_patterns_from_input(pl, argc, argv,
+ add_patterns_from_input(pl, args->nr, args->v,
use_stdin ? stdin : NULL);
break;
}
@@ -706,12 +708,12 @@ static int modify_pattern_list(int argc, const char **argv, int use_stdin,
return result;
}
-static void sanitize_paths(int argc, const char **argv,
+static void sanitize_paths(struct strvec *args,
const char *prefix, int skip_checks)
{
int i;
- if (!argc)
+ if (!args->nr)
return;
if (prefix && *prefix && core_sparse_checkout_cone) {
@@ -721,8 +723,11 @@ static void sanitize_paths(int argc, const char **argv,
*/
int prefix_len = strlen(prefix);
- for (i = 0; i < argc; i++)
- argv[i] = prefix_path(prefix, prefix_len, argv[i]);
+ for (i = 0; i < args->nr; i++) {
+ char *prefixed_path = prefix_path(prefix, prefix_len, args->v[i]);
+ strvec_replace(args, i, prefixed_path);
+ free(prefixed_path);
+ }
}
if (skip_checks)
@@ -732,20 +737,20 @@ static void sanitize_paths(int argc, const char **argv,
die(_("please run from the toplevel directory in non-cone mode"));
if (core_sparse_checkout_cone) {
- for (i = 0; i < argc; i++) {
- if (argv[i][0] == '/')
+ for (i = 0; i < args->nr; i++) {
+ if (args->v[i][0] == '/')
die(_("specify directories rather than patterns (no leading slash)"));
- if (argv[i][0] == '!')
+ if (args->v[i][0] == '!')
die(_("specify directories rather than patterns. If your directory starts with a '!', pass --skip-checks"));
- if (strpbrk(argv[i], "*?[]"))
+ if (strpbrk(args->v[i], "*?[]"))
die(_("specify directories rather than patterns. If your directory really has any of '*?[]\\' in it, pass --skip-checks"));
}
}
- for (i = 0; i < argc; i++) {
+ for (i = 0; i < args->nr; i++) {
struct cache_entry *ce;
struct index_state *index = the_repository->index;
- int pos = index_name_pos(index, argv[i], strlen(argv[i]));
+ int pos = index_name_pos(index, args->v[i], strlen(args->v[i]));
if (pos < 0)
continue;
@@ -754,9 +759,9 @@ static void sanitize_paths(int argc, const char **argv,
continue;
if (core_sparse_checkout_cone)
- die(_("'%s' is not a directory; to treat it as a directory anyway, rerun with --skip-checks"), argv[i]);
+ die(_("'%s' is not a directory; to treat it as a directory anyway, rerun with --skip-checks"), args->v[i]);
else
- warning(_("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)."), argv[i]);
+ warning(_("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)."), args->v[i]);
}
}
@@ -770,7 +775,8 @@ static struct sparse_checkout_add_opts {
int use_stdin;
} add_opts;
-static int sparse_checkout_add(int argc, const char **argv, const char *prefix)
+static int sparse_checkout_add(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
static struct option builtin_sparse_checkout_add_options[] = {
OPT_BOOL_F(0, "skip-checks", &add_opts.skip_checks,
@@ -780,6 +786,8 @@ static int sparse_checkout_add(int argc, const char **argv, const char *prefix)
N_("read patterns from standard in")),
OPT_END(),
};
+ struct strvec patterns = STRVEC_INIT;
+ int ret;
setup_work_tree();
if (!core_apply_sparse_checkout)
@@ -791,9 +799,14 @@ static int sparse_checkout_add(int argc, const char **argv, const char *prefix)
builtin_sparse_checkout_add_options,
builtin_sparse_checkout_add_usage, 0);
- sanitize_paths(argc, argv, prefix, add_opts.skip_checks);
+ for (int i = 0; i < argc; i++)
+ strvec_push(&patterns, argv[i]);
+ sanitize_paths(&patterns, prefix, add_opts.skip_checks);
- return modify_pattern_list(argc, argv, add_opts.use_stdin, ADD);
+ ret = modify_pattern_list(&patterns, add_opts.use_stdin, ADD);
+
+ strvec_clear(&patterns);
+ return ret;
}
static char const * const builtin_sparse_checkout_set_usage[] = {
@@ -808,7 +821,8 @@ static struct sparse_checkout_set_opts {
int use_stdin;
} set_opts;
-static int sparse_checkout_set(int argc, const char **argv, const char *prefix)
+static int sparse_checkout_set(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int default_patterns_nr = 2;
const char *default_patterns[] = {"/*", "!/*/", NULL};
@@ -826,6 +840,8 @@ static int sparse_checkout_set(int argc, const char **argv, const char *prefix)
PARSE_OPT_NONEG),
OPT_END(),
};
+ struct strvec patterns = STRVEC_INIT;
+ int ret;
setup_work_tree();
repo_read_index(the_repository);
@@ -846,13 +862,18 @@ static int sparse_checkout_set(int argc, const char **argv, const char *prefix)
* top-level directory (much as 'init' would do).
*/
if (!core_sparse_checkout_cone && !set_opts.use_stdin && argc == 0) {
- argv = default_patterns;
- argc = default_patterns_nr;
+ for (int i = 0; i < default_patterns_nr; i++)
+ strvec_push(&patterns, default_patterns[i]);
} else {
- sanitize_paths(argc, argv, prefix, set_opts.skip_checks);
+ for (int i = 0; i < argc; i++)
+ strvec_push(&patterns, argv[i]);
+ sanitize_paths(&patterns, prefix, set_opts.skip_checks);
}
- return modify_pattern_list(argc, argv, set_opts.use_stdin, REPLACE);
+ ret = modify_pattern_list(&patterns, set_opts.use_stdin, REPLACE);
+
+ strvec_clear(&patterns);
+ return ret;
}
static char const * const builtin_sparse_checkout_reapply_usage[] = {
@@ -866,7 +887,8 @@ static struct sparse_checkout_reapply_opts {
} reapply_opts;
static int sparse_checkout_reapply(int argc, const char **argv,
- const char *prefix)
+ const char *prefix,
+ struct repository *repo UNUSED)
{
static struct option builtin_sparse_checkout_reapply_options[] = {
OPT_BOOL(0, "cone", &reapply_opts.cone_mode,
@@ -901,7 +923,8 @@ static char const * const builtin_sparse_checkout_disable_usage[] = {
};
static int sparse_checkout_disable(int argc, const char **argv,
- const char *prefix)
+ const char *prefix,
+ struct repository *repo UNUSED)
{
static struct option builtin_sparse_checkout_disable_options[] = {
OPT_END(),
@@ -989,7 +1012,8 @@ static int check_rules(struct pattern_list *pl, int null_terminated) {
return 0;
}
-static int sparse_checkout_check_rules(int argc, const char **argv, const char *prefix)
+static int sparse_checkout_check_rules(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
static struct option builtin_sparse_checkout_check_rules_options[] = {
OPT_BOOL('z', NULL, &check_rules_opts.null_termination,
@@ -1037,7 +1061,7 @@ static int sparse_checkout_check_rules(int argc, const char **argv, const char *
int cmd_sparse_checkout(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
parse_opt_subcommand_fn *fn = NULL;
struct option builtin_sparse_checkout_options[] = {
@@ -1060,5 +1084,5 @@ int cmd_sparse_checkout(int argc,
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
- return fn(argc, argv, prefix);
+ return fn(argc, argv, prefix, repo);
}
diff --git a/builtin/stash.c b/builtin/stash.c
index 1399a1bbe2..c212b1c0b2 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -249,7 +249,8 @@ static int do_clear_stash(void)
ref_stash, &obj, 0);
}
-static int clear_stash(int argc, const char **argv, const char *prefix)
+static int clear_stash(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct option options[] = {
OPT_END()
@@ -652,7 +653,8 @@ restore_untracked:
return ret;
}
-static int apply_stash(int argc, const char **argv, const char *prefix)
+static int apply_stash(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int ret = -1;
int quiet = 0;
@@ -726,7 +728,8 @@ static int get_stash_info_assert(struct stash_info *info, int argc,
return 0;
}
-static int drop_stash(int argc, const char **argv, const char *prefix)
+static int drop_stash(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int ret = -1;
int quiet = 0;
@@ -748,7 +751,8 @@ cleanup:
return ret;
}
-static int pop_stash(int argc, const char **argv, const char *prefix)
+static int pop_stash(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int ret = -1;
int index = 0;
@@ -778,7 +782,8 @@ cleanup:
return ret;
}
-static int branch_stash(int argc, const char **argv, const char *prefix)
+static int branch_stash(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int ret = -1;
const char *branch = NULL;
@@ -816,7 +821,8 @@ cleanup:
return ret;
}
-static int list_stash(int argc, const char **argv, const char *prefix)
+static int list_stash(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct child_process cp = CHILD_PROCESS_INIT;
struct option options[] = {
@@ -889,7 +895,8 @@ static void diff_include_untracked(const struct stash_info *info, struct diff_op
do_diff_cache(&info->b_commit, diff_opt);
}
-static int show_stash(int argc, const char **argv, const char *prefix)
+static int show_stash(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int i;
int ret = -1;
@@ -1017,7 +1024,8 @@ static int do_store_stash(const struct object_id *w_commit, const char *stash_ms
return 0;
}
-static int store_stash(int argc, const char **argv, const char *prefix)
+static int store_stash(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int quiet = 0;
const char *stash_msg = NULL;
@@ -1491,7 +1499,8 @@ done:
return ret;
}
-static int create_stash(int argc, const char **argv, const char *prefix UNUSED)
+static int create_stash(int argc, const char **argv, const char *prefix UNUSED,
+ struct repository *repo UNUSED)
{
int ret;
struct strbuf stash_msg_buf = STRBUF_INIT;
@@ -1827,12 +1836,14 @@ static int push_stash(int argc, const char **argv, const char *prefix,
return ret;
}
-static int push_stash_unassumed(int argc, const char **argv, const char *prefix)
+static int push_stash_unassumed(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
return push_stash(argc, argv, prefix, 0);
}
-static int save_stash(int argc, const char **argv, const char *prefix)
+static int save_stash(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int keep_index = -1;
int only_staged = 0;
@@ -1878,7 +1889,7 @@ static int save_stash(int argc, const char **argv, const char *prefix)
int cmd_stash(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
pid_t pid = getpid();
const char *index_file;
@@ -1916,9 +1927,9 @@ int cmd_stash(int argc,
(uintmax_t)pid);
if (fn)
- return !!fn(argc, argv, prefix);
+ return !!fn(argc, argv, prefix, repo);
else if (!argc)
- return !!push_stash_unassumed(0, NULL, prefix);
+ return !!push_stash_unassumed(0, NULL, prefix, repo);
/* Assume 'stash push' */
strvec_push(&args, "push");
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index b6b5f1ebde..19e5878381 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -399,7 +399,8 @@ cleanup:
free(displaypath);
}
-static int module_foreach(int argc, const char **argv, const char *prefix)
+static int module_foreach(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct foreach_cb info = FOREACH_CB_INIT;
struct pathspec pathspec = { 0 };
@@ -544,7 +545,8 @@ static void init_submodule_cb(const struct cache_entry *list_item, void *cb_data
info->flags);
}
-static int module_init(int argc, const char **argv, const char *prefix)
+static int module_init(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct init_cb info = INIT_CB_INIT;
struct pathspec pathspec = { 0 };
@@ -738,7 +740,8 @@ static void status_submodule_cb(const struct cache_entry *list_item,
info->prefix, info->super_prefix, info->flags);
}
-static int module_status(int argc, const char **argv, const char *prefix)
+static int module_status(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct status_cb info = STATUS_CB_INIT;
struct pathspec pathspec = { 0 };
@@ -1163,7 +1166,8 @@ cleanup:
return ret;
}
-static int module_summary(int argc, const char **argv, const char *prefix)
+static int module_summary(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct summary_cb info = SUMMARY_CB_INIT;
int cached = 0;
@@ -1339,7 +1343,8 @@ static void sync_submodule_cb(const struct cache_entry *list_item, void *cb_data
info->flags);
}
-static int module_sync(int argc, const char **argv, const char *prefix)
+static int module_sync(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct sync_cb info = SYNC_CB_INIT;
struct pathspec pathspec = { 0 };
@@ -1485,7 +1490,8 @@ static void deinit_submodule_cb(const struct cache_entry *list_item,
deinit_submodule(list_item->name, info->prefix, info->flags);
}
-static int module_deinit(int argc, const char **argv, const char *prefix)
+static int module_deinit(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct deinit_cb info = DEINIT_CB_INIT;
struct pathspec pathspec = { 0 };
@@ -1842,7 +1848,8 @@ static int clone_submodule(const struct module_clone_data *clone_data,
return 0;
}
-static int module_clone(int argc, const char **argv, const char *prefix)
+static int module_clone(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int dissociate = 0, quiet = 0, progress = 0, require_init = 0;
struct module_clone_data clone_data = MODULE_CLONE_DATA_INIT;
@@ -2779,7 +2786,8 @@ cleanup:
return ret;
}
-static int module_update(int argc, const char **argv, const char *prefix)
+static int module_update(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
struct pathspec pathspec = { 0 };
struct pathspec pathspec2 = { 0 };
@@ -2911,7 +2919,8 @@ cleanup:
return ret;
}
-static int push_check(int argc, const char **argv, const char *prefix UNUSED)
+static int push_check(int argc, const char **argv, const char *prefix UNUSED,
+ struct repository *repo UNUSED)
{
struct remote *remote;
const char *superproject_head;
@@ -2991,7 +3000,8 @@ static int push_check(int argc, const char **argv, const char *prefix UNUSED)
return 0;
}
-static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
+static int absorb_git_dirs(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int i;
struct pathspec pathspec = { 0 };
@@ -3024,7 +3034,8 @@ cleanup:
return ret;
}
-static int module_set_url(int argc, const char **argv, const char *prefix)
+static int module_set_url(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int quiet = 0, ret;
const char *newurl;
@@ -3063,7 +3074,8 @@ static int module_set_url(int argc, const char **argv, const char *prefix)
return !!ret;
}
-static int module_set_branch(int argc, const char **argv, const char *prefix)
+static int module_set_branch(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int opt_default = 0, ret;
const char *opt_branch = NULL;
@@ -3113,7 +3125,8 @@ static int module_set_branch(int argc, const char **argv, const char *prefix)
return !!ret;
}
-static int module_create_branch(int argc, const char **argv, const char *prefix)
+static int module_create_branch(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
enum branch_track track;
int quiet = 0, force = 0, reflog = 0, dry_run = 0;
@@ -3424,7 +3437,8 @@ static void die_on_repo_without_commits(const char *path)
strbuf_release(&sb);
}
-static int module_add(int argc, const char **argv, const char *prefix)
+static int module_add(int argc, const char **argv, const char *prefix,
+ struct repository *repo UNUSED)
{
int force = 0, quiet = 0, progress = 0, dissociate = 0;
struct add_data add_data = ADD_DATA_INIT;
@@ -3557,7 +3571,7 @@ cleanup:
int cmd_submodule__helper(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
parse_opt_subcommand_fn *fn = NULL;
const char *const usage[] = {
@@ -3583,5 +3597,5 @@ int cmd_submodule__helper(int argc,
};
argc = parse_options(argc, argv, prefix, options, usage, 0);
- return fn(argc, argv, prefix);
+ return fn(argc, argv, prefix, repo);
}
diff --git a/builtin/tag.c b/builtin/tag.c
index c37c0a68fd..affa14d659 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -447,17 +447,6 @@ static int parse_msg_arg(const struct option *opt, const char *arg, int unset)
return 0;
}
-static int strbuf_check_tag_ref(struct strbuf *sb, const char *name)
-{
- if (name[0] == '-')
- return -1;
-
- strbuf_reset(sb);
- strbuf_addf(sb, "refs/tags/%s", name);
-
- return check_refname_format(sb->buf, 0);
-}
-
int cmd_tag(int argc,
const char **argv,
const char *prefix,
@@ -650,7 +639,7 @@ int cmd_tag(int argc,
if (repo_get_oid(the_repository, object_ref, &object))
die(_("Failed to resolve '%s' as a valid ref."), object_ref);
- if (strbuf_check_tag_ref(&ref, tag))
+ if (check_tag_ref(&ref, tag))
die(_("'%s' is not a valid tag name."), tag);
if (refs_read_ref(get_main_ref_store(the_repository), ref.buf, &prev))
@@ -681,7 +670,7 @@ int cmd_tag(int argc,
}
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction ||
ref_transaction_update(transaction, ref.buf, &object, &prev,
NULL, NULL,
diff --git a/builtin/update-ref.c b/builtin/update-ref.c
index 8a98615dc8..670e7812d6 100644
--- a/builtin/update-ref.c
+++ b/builtin/update-ref.c
@@ -612,7 +612,7 @@ static void update_refs_stdin(void)
int i, j;
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction)
die("%s", err.buf);
@@ -680,7 +680,7 @@ static void update_refs_stdin(void)
*/
state = cmd->state;
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction)
die("%s", err.buf);
diff --git a/builtin/upload-pack.c b/builtin/upload-pack.c
index 3b6c83fbce..dd63d6eadf 100644
--- a/builtin/upload-pack.c
+++ b/builtin/upload-pack.c
@@ -39,6 +39,7 @@ int cmd_upload_pack(int argc,
N_("interrupt transfer after <n> seconds of inactivity")),
OPT_END()
};
+ unsigned enter_repo_flags = ENTER_REPO_ANY_OWNER_OK;
packet_trace_identity("upload-pack");
disable_replace_refs();
@@ -54,7 +55,9 @@ int cmd_upload_pack(int argc,
dir = argv[0];
- if (!enter_repo(dir, strict))
+ if (strict)
+ enter_repo_flags |= ENTER_REPO_STRICT;
+ if (!enter_repo(dir, enter_repo_flags))
die("'%s' does not appear to be a git repository", dir);
switch (determine_protocol_version_server()) {
diff --git a/builtin/worktree.c b/builtin/worktree.c
index dae63dedf4..0186d60ab1 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -120,12 +120,14 @@ struct add_opts {
int quiet;
int checkout;
int orphan;
+ int relative_paths;
const char *keep_locked;
};
static int show_only;
static int verbose;
static int guess_remote;
+static int use_relative_paths;
static timestamp_t expire;
static int git_worktree_config(const char *var, const char *value,
@@ -134,6 +136,9 @@ static int git_worktree_config(const char *var, const char *value,
if (!strcmp(var, "worktree.guessremote")) {
guess_remote = git_config_bool(var, value);
return 0;
+ } else if (!strcmp(var, "worktree.userelativepaths")) {
+ use_relative_paths = git_config_bool(var, value);
+ return 0;
}
return git_default_config(var, value, ctx, cb);
@@ -231,7 +236,8 @@ static void prune_worktrees(void)
strbuf_release(&reason);
}
-static int prune(int ac, const char **av, const char *prefix)
+static int prune(int ac, const char **av, const char *prefix,
+ struct repository *repo UNUSED)
{
struct option options[] = {
OPT__DRY_RUN(&show_only, N_("do not remove, show only")),
@@ -414,8 +420,7 @@ static int add_worktree(const char *path, const char *refname,
const struct add_opts *opts)
{
struct strbuf sb_git = STRBUF_INIT, sb_repo = STRBUF_INIT;
- struct strbuf sb = STRBUF_INIT, sb_tmp = STRBUF_INIT;
- struct strbuf sb_path_realpath = STRBUF_INIT, sb_repo_realpath = STRBUF_INIT;
+ struct strbuf sb = STRBUF_INIT;
const char *name;
struct strvec child_env = STRVEC_INIT;
unsigned int counter = 0;
@@ -433,7 +438,7 @@ static int add_worktree(const char *path, const char *refname,
worktrees = NULL;
/* is 'refname' a branch or commit? */
- if (!opts->detach && !strbuf_check_branch_ref(&symref, refname) &&
+ if (!opts->detach && !check_branch_ref(&symref, refname) &&
refs_ref_exists(get_main_ref_store(the_repository), symref.buf)) {
is_branch = 1;
if (!opts->force)
@@ -491,10 +496,7 @@ static int add_worktree(const char *path, const char *refname,
strbuf_reset(&sb);
strbuf_addf(&sb, "%s/gitdir", sb_repo.buf);
- strbuf_realpath(&sb_path_realpath, path, 1);
- strbuf_realpath(&sb_repo_realpath, sb_repo.buf, 1);
- write_file(sb.buf, "%s/.git", relative_path(sb_path_realpath.buf, sb_repo_realpath.buf, &sb_tmp));
- write_file(sb_git.buf, "gitdir: %s", relative_path(sb_repo_realpath.buf, sb_path_realpath.buf, &sb_tmp));
+ write_worktree_linking_files(sb_git, sb, opts->relative_paths);
strbuf_reset(&sb);
strbuf_addf(&sb, "%s/commondir", sb_repo.buf);
write_file(sb.buf, "../..");
@@ -578,12 +580,9 @@ done:
strvec_clear(&child_env);
strbuf_release(&sb);
- strbuf_release(&sb_tmp);
strbuf_release(&symref);
strbuf_release(&sb_repo);
- strbuf_release(&sb_repo_realpath);
strbuf_release(&sb_git);
- strbuf_release(&sb_path_realpath);
strbuf_release(&sb_name);
free_worktree(wt);
return ret;
@@ -606,7 +605,7 @@ static void print_preparing_worktree_line(int detach,
fprintf_ln(stderr, _("Preparing worktree (new branch '%s')"), new_branch);
} else {
struct strbuf s = STRBUF_INIT;
- if (!detach && !strbuf_check_branch_ref(&s, branch) &&
+ if (!detach && !check_branch_ref(&s, branch) &&
refs_ref_exists(get_main_ref_store(the_repository), s.buf))
fprintf_ln(stderr, _("Preparing worktree (checking out '%s')"),
branch);
@@ -747,7 +746,7 @@ static char *dwim_branch(const char *path, char **new_branch)
char *branchname = xstrndup(s, n);
struct strbuf ref = STRBUF_INIT;
- branch_exists = !strbuf_check_branch_ref(&ref, branchname) &&
+ branch_exists = !check_branch_ref(&ref, branchname) &&
refs_ref_exists(get_main_ref_store(the_repository),
ref.buf);
strbuf_release(&ref);
@@ -763,7 +762,8 @@ static char *dwim_branch(const char *path, char **new_branch)
return NULL;
}
-static int add(int ac, const char **av, const char *prefix)
+static int add(int ac, const char **av, const char *prefix,
+ struct repository *repo UNUSED)
{
struct add_opts opts;
const char *new_branch_force = NULL;
@@ -796,12 +796,15 @@ static int add(int ac, const char **av, const char *prefix)
PARSE_OPT_NOARG | PARSE_OPT_OPTARG),
OPT_BOOL(0, "guess-remote", &guess_remote,
N_("try to match the new branch name with a remote-tracking branch")),
+ OPT_BOOL(0, "relative-paths", &opts.relative_paths,
+ N_("use relative paths for worktrees")),
OPT_END()
};
int ret;
memset(&opts, 0, sizeof(opts));
opts.checkout = 1;
+ opts.relative_paths = use_relative_paths;
ac = parse_options(ac, av, prefix, options, git_worktree_add_usage, 0);
if (!!opts.detach + !!new_branch + !!new_branch_force > 1)
die(_("options '%s', '%s', and '%s' cannot be used together"), "-b", "-B", "--detach");
@@ -840,7 +843,7 @@ static int add(int ac, const char **av, const char *prefix)
new_branch = new_branch_force;
if (!opts.force &&
- !strbuf_check_branch_ref(&symref, new_branch) &&
+ !check_branch_ref(&symref, new_branch) &&
refs_ref_exists(get_main_ref_store(the_repository), symref.buf))
die_if_checked_out(symref.buf, 0);
strbuf_release(&symref);
@@ -1039,7 +1042,8 @@ static void pathsort(struct worktree **wt)
QSORT(wt, n, pathcmp);
}
-static int list(int ac, const char **av, const char *prefix)
+static int list(int ac, const char **av, const char *prefix,
+ struct repository *repo UNUSED)
{
int porcelain = 0;
int line_terminator = '\n';
@@ -1084,7 +1088,8 @@ static int list(int ac, const char **av, const char *prefix)
return 0;
}
-static int lock_worktree(int ac, const char **av, const char *prefix)
+static int lock_worktree(int ac, const char **av, const char *prefix,
+ struct repository *repo UNUSED)
{
const char *reason = "", *old_reason;
struct option options[] = {
@@ -1119,7 +1124,8 @@ static int lock_worktree(int ac, const char **av, const char *prefix)
return 0;
}
-static int unlock_worktree(int ac, const char **av, const char *prefix)
+static int unlock_worktree(int ac, const char **av, const char *prefix,
+ struct repository *repo UNUSED)
{
struct option options[] = {
OPT_END()
@@ -1182,13 +1188,16 @@ static void validate_no_submodules(const struct worktree *wt)
die(_("working trees containing submodules cannot be moved or removed"));
}
-static int move_worktree(int ac, const char **av, const char *prefix)
+static int move_worktree(int ac, const char **av, const char *prefix,
+ struct repository *repo UNUSED)
{
int force = 0;
struct option options[] = {
OPT__FORCE(&force,
N_("force move even if worktree is dirty or locked"),
PARSE_OPT_NOCOMPLETE),
+ OPT_BOOL(0, "relative-paths", &use_relative_paths,
+ N_("use relative paths for worktrees")),
OPT_END()
};
struct worktree **worktrees, *wt;
@@ -1241,7 +1250,7 @@ static int move_worktree(int ac, const char **av, const char *prefix)
if (rename(wt->path, dst.buf) == -1)
die_errno(_("failed to move '%s' to '%s'"), wt->path, dst.buf);
- update_worktree_location(wt, dst.buf);
+ update_worktree_location(wt, dst.buf, use_relative_paths);
strbuf_release(&dst);
free_worktrees(worktrees);
@@ -1312,7 +1321,8 @@ static int delete_git_work_tree(struct worktree *wt)
return ret;
}
-static int remove_worktree(int ac, const char **av, const char *prefix)
+static int remove_worktree(int ac, const char **av, const char *prefix,
+ struct repository *repo UNUSED)
{
int force = 0;
struct option options[] = {
@@ -1377,11 +1387,14 @@ static void report_repair(int iserr, const char *path, const char *msg, void *cb
}
}
-static int repair(int ac, const char **av, const char *prefix)
+static int repair(int ac, const char **av, const char *prefix,
+ struct repository *repo UNUSED)
{
const char **p;
const char *self[] = { ".", NULL };
struct option options[] = {
+ OPT_BOOL(0, "relative-paths", &use_relative_paths,
+ N_("use relative paths for worktrees")),
OPT_END()
};
int rc = 0;
@@ -1389,15 +1402,15 @@ static int repair(int ac, const char **av, const char *prefix)
ac = parse_options(ac, av, prefix, options, git_worktree_repair_usage, 0);
p = ac > 0 ? av : self;
for (; *p; p++)
- repair_worktree_at_path(*p, report_repair, &rc);
- repair_worktrees(report_repair, &rc);
+ repair_worktree_at_path(*p, report_repair, &rc, use_relative_paths);
+ repair_worktrees(report_repair, &rc, use_relative_paths);
return rc;
}
int cmd_worktree(int ac,
const char **av,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
parse_opt_subcommand_fn *fn = NULL;
struct option options[] = {
@@ -1422,5 +1435,5 @@ int cmd_worktree(int ac,
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
- return fn(ac, av, prefix);
+ return fn(ac, av, prefix, repo);
}
diff --git a/bundle-uri.c b/bundle-uri.c
index 0df66e2872..cdf9e4f9e1 100644
--- a/bundle-uri.c
+++ b/bundle-uri.c
@@ -367,6 +367,10 @@ static int unbundle_from_file(struct repository *r, const char *file)
struct string_list_item *refname;
struct strbuf bundle_ref = STRBUF_INIT;
size_t bundle_prefix_len;
+ struct unbundle_opts opts = {
+ .flags = VERIFY_BUNDLE_QUIET |
+ (fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0),
+ };
bundle_fd = read_bundle_header(file, &header);
if (bundle_fd < 0) {
@@ -379,8 +383,7 @@ static int unbundle_from_file(struct repository *r, const char *file)
* a reachable ref pointing to the new tips, which will reach
* the prerequisite commits.
*/
- result = unbundle(r, &header, bundle_fd, NULL,
- VERIFY_BUNDLE_QUIET | (fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0));
+ result = unbundle(r, &header, bundle_fd, NULL, &opts);
if (result) {
result = 1;
goto cleanup;
diff --git a/bundle.c b/bundle.c
index 4773b51eb1..83c08e65cb 100644
--- a/bundle.c
+++ b/bundle.c
@@ -420,36 +420,6 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)
e->name);
goto skip_write_ref;
}
- /*
- * If you run "git bundle create bndl v1.0..v2.0", the
- * name of the positive ref is "v2.0" but that is the
- * commit that is referenced by the tag, and not the tag
- * itself.
- */
- if (!oideq(&oid, &e->item->oid)) {
- /*
- * Is this the positive end of a range expressed
- * in terms of a tag (e.g. v2.0 from the range
- * "v1.0..v2.0")?
- */
- struct commit *one = lookup_commit_reference(revs->repo, &oid);
- struct object *obj;
-
- if (e->item == &(one->object)) {
- /*
- * Need to include e->name as an
- * independent ref to the pack-objects
- * input, so that the tag is included
- * in the output; otherwise we would
- * end up triggering "empty bundle"
- * error.
- */
- obj = parse_object_or_die(&oid, e->name);
- obj->flags |= SHOWN;
- add_pending_object(revs, obj, e->name);
- }
- goto skip_write_ref;
- }
ref_count++;
write_or_die(bundle_fd, oid_to_hex(&e->item->oid), the_hash_algo->hexsz);
@@ -628,11 +598,15 @@ out:
int unbundle(struct repository *r, struct bundle_header *header,
int bundle_fd, struct strvec *extra_index_pack_args,
- enum verify_bundle_flags flags)
+ struct unbundle_opts *opts)
{
struct child_process ip = CHILD_PROCESS_INIT;
+ struct unbundle_opts opts_fallback = { 0 };
+
+ if (!opts)
+ opts = &opts_fallback;
- if (verify_bundle(r, header, flags))
+ if (verify_bundle(r, header, opts->flags))
return -1;
strvec_pushl(&ip.args, "index-pack", "--fix-thin", "--stdin", NULL);
@@ -641,8 +615,9 @@ int unbundle(struct repository *r, struct bundle_header *header,
if (header->filter.choice)
strvec_push(&ip.args, "--promisor=from-bundle");
- if (flags & VERIFY_BUNDLE_FSCK)
- strvec_push(&ip.args, "--fsck-objects");
+ if (opts->flags & VERIFY_BUNDLE_FSCK)
+ strvec_pushf(&ip.args, "--fsck-objects%s",
+ opts->fsck_msg_types ? opts->fsck_msg_types : "");
if (extra_index_pack_args)
strvec_pushv(&ip.args, extra_index_pack_args->v);
diff --git a/bundle.h b/bundle.h
index 5ccc9a061a..a80aa8ad9b 100644
--- a/bundle.h
+++ b/bundle.h
@@ -39,6 +39,17 @@ enum verify_bundle_flags {
int verify_bundle(struct repository *r, struct bundle_header *header,
enum verify_bundle_flags flags);
+struct unbundle_opts {
+ enum verify_bundle_flags flags;
+ /*
+ * fsck_msg_types may optionally contain fsck message severity
+ * configuration. If present, this configuration gets directly appended
+ * to a '--fsck-objects' option and therefore must be prefixed with '='.
+ * (E.g. "=missingEmail=ignore,gitmodulesUrl=ignore")
+ */
+ const char *fsck_msg_types;
+};
+
/**
* Unbundle after reading the header with read_bundle_header().
*
@@ -49,12 +60,12 @@ int verify_bundle(struct repository *r, struct bundle_header *header,
* (e.g. "-v" for verbose/progress), NULL otherwise. The provided
* "extra_index_pack_args" (if any) will be strvec_clear()'d for you.
*
- * Before unbundling, this method will call verify_bundle() with the
- * given 'flags'.
+ * Before unbundling, this method will call verify_bundle() with 'flags'
+ * provided in 'opts'.
*/
int unbundle(struct repository *r, struct bundle_header *header,
int bundle_fd, struct strvec *extra_index_pack_args,
- enum verify_bundle_flags flags);
+ struct unbundle_opts *opts);
int list_bundle_refs(struct bundle_header *header,
int argc, const char **argv);
diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
index 126e570eb4..d020cb7aa5 100755
--- a/ci/install-dependencies.sh
+++ b/ci/install-dependencies.sh
@@ -29,37 +29,38 @@ alpine-*)
apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \
bash cvs gnupg perl-cgi perl-dbd-sqlite perl-io-tty >/dev/null
;;
-fedora-*)
+fedora-*|almalinux-*)
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
;;
-ubuntu-*|ubuntu32-*)
+ubuntu-*|ubuntu32-*|debian-*)
# Required so that apt doesn't wait for user input on certain packages.
export DEBIAN_FRONTEND=noninteractive
case "$distro" in
ubuntu-*)
SVN='libsvn-perl subversion'
+ LANGUAGES='language-pack-is'
;;
- *)
+ ubuntu32-*)
SVN=
+ LANGUAGES='language-pack-is'
+ ;;
+ *)
+ SVN='libsvn-perl subversion'
+ LANGUAGES='locales-all'
;;
esac
sudo apt-get -q update
sudo apt-get -q -y install \
- language-pack-is apache2 cvs cvsps git gnupg $SVN \
+ $LANGUAGES apache2 cvs cvsps git gnupg $SVN \
make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \
tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
libemail-valid-perl libio-pty-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
case "$distro" in
- ubuntu-16.04)
- # Does not support JGit, but we also don't really care about
- # the others. We rather care whether Git still compiles and
- # runs fine overall.
- ;;
ubuntu-*)
mkdir --parents "$CUSTOM_PATH"
diff --git a/ci/lib.sh b/ci/lib.sh
index 246072a093..5440eb6dc0 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -18,7 +18,8 @@ elif test true = "$GITLAB_CI"
then
begin_group () {
need_to_end_group=t
- printf "\e[0Ksection_start:$(date +%s):$(echo "$1" | tr ' ' _)[collapsed=true]\r\e[0K$1\n"
+ printf '\e[0Ksection_start:%s:%s[collapsed=true]\r\e[0K%s\n' \
+ "$(date +%s)" "$(echo "$1" | tr ' ' _)" "$1"
trap "end_group '$1'" EXIT
set -x
}
@@ -27,7 +28,8 @@ then
test -n "$need_to_end_group" || return 0
set +x
need_to_end_group=
- printf "\e[0Ksection_end:$(date +%s):$(echo "$1" | tr ' ' _)\r\e[0K\n"
+ printf '\e[0Ksection_end:%s:%s\r\e[0K\n' \
+ "$(date +%s)" "$(echo "$1" | tr ' ' _)"
trap - EXIT
}
else
@@ -55,8 +57,7 @@ group () {
return $res
}
-begin_group "CI setup"
-trap "end_group 'CI setup'" EXIT
+begin_group "CI setup via $(basename $0)"
# Set 'exit on error' for all CI scripts to let the caller know that
# something went wrong.
@@ -384,7 +385,6 @@ linux-musl)
;;
linux-leaks|linux-reftable-leaks)
export SANITIZE=leak
- export GIT_TEST_PASSING_SANITIZE_LEAK=true
;;
linux-asan-ubsan)
export SANITIZE=address,undefined
@@ -395,5 +395,5 @@ esac
MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}"
-end_group "CI setup"
+end_group "CI setup via $(basename $0)"
set -x
diff --git a/ci/run-build-and-minimal-fuzzers.sh b/ci/run-build-and-minimal-fuzzers.sh
index af8065f349..e7b97952e7 100755
--- a/ci/run-build-and-minimal-fuzzers.sh
+++ b/ci/run-build-and-minimal-fuzzers.sh
@@ -13,7 +13,18 @@ group "Build fuzzers" make \
LIB_FUZZING_ENGINE="-fsanitize=fuzzer,address" \
fuzz-all
-for fuzzer in commit-graph config date pack-headers pack-idx ; do
+fuzzers="
+commit-graph
+config
+credential-from-url-gently
+date
+pack-headers
+pack-idx
+parse-attr-line
+url-decode-mem
+"
+
+for fuzzer in $fuzzers; do
begin_group "fuzz-$fuzzer"
./oss-fuzz/fuzz-$fuzzer -verbosity=0 -runs=1 || exit 1
end_group "fuzz-$fuzzer"
diff --git a/ci/test-documentation.sh b/ci/test-documentation.sh
index 02b3af3941..6c018b673e 100755
--- a/ci/test-documentation.sh
+++ b/ci/test-documentation.sh
@@ -6,7 +6,7 @@
. ${0%/*}/lib.sh
filter_log () {
- sed -e '/^GIT_VERSION = /d' \
+ sed -e '/^GIT_VERSION=/d' \
-e "/constant Gem::ConfigMap is deprecated/d" \
-e '/^ \* new asciidoc flags$/d' \
-e '/stripped namespace before processing/d' \
diff --git a/commit-graph.c b/commit-graph.c
index 5bd89c0acd..e2e2083951 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -1914,7 +1914,7 @@ static int fill_oids_from_packs(struct write_commit_graph_context *ctx,
struct packed_git *p;
strbuf_setlen(&packname, dirlen);
strbuf_addstr(&packname, pack_indexes->items[i].string);
- p = add_packed_git(packname.buf, packname.len, 1);
+ p = add_packed_git(ctx->r, packname.buf, packname.len, 1);
if (!p) {
ret = error(_("error adding pack %s"), packname.buf);
goto cleanup;
@@ -1960,7 +1960,7 @@ static void fill_oids_from_all_packs(struct write_commit_graph_context *ctx)
ctx->progress = start_delayed_progress(
_("Finding commits for commit graph among packed objects"),
ctx->approx_nr_objects);
- for_each_packed_object(add_packed_commits, ctx,
+ for_each_packed_object(ctx->r, add_packed_commits, ctx,
FOR_EACH_OBJECT_PACK_ORDER);
if (ctx->progress_done < ctx->approx_nr_objects)
display_progress(ctx->progress, ctx->approx_nr_objects);
diff --git a/commit.c b/commit.c
index cc03a93036..35ab9bead5 100644
--- a/commit.c
+++ b/commit.c
@@ -276,7 +276,7 @@ static int read_graft_file(struct repository *r, const char *graft_file)
"to convert the grafts into replace refs.\n"
"\n"
"Turn this message off by running\n"
- "\"git config advice.graftFileDeprecated false\""));
+ "\"git config set advice.graftFileDeprecated false\""));
while (!strbuf_getwholeline(&buf, fp, '\n')) {
/* The format is just "Commit Parent1 Parent2 ...\n" */
struct commit_graft *graft = read_graft_line(&buf);
diff --git a/config.c b/config.c
index a11bb85da3..2c295f7430 100644
--- a/config.c
+++ b/config.c
@@ -1493,33 +1493,11 @@ static int git_default_core_config(const char *var, const char *value,
return 0;
}
- if (!strcmp(var, "core.packedgitwindowsize")) {
- int pgsz_x2 = getpagesize() * 2;
- packed_git_window_size = git_config_ulong(var, value, ctx->kvi);
-
- /* This value must be multiple of (pagesize * 2) */
- packed_git_window_size /= pgsz_x2;
- if (packed_git_window_size < 1)
- packed_git_window_size = 1;
- packed_git_window_size *= pgsz_x2;
- return 0;
- }
-
if (!strcmp(var, "core.bigfilethreshold")) {
big_file_threshold = git_config_ulong(var, value, ctx->kvi);
return 0;
}
- if (!strcmp(var, "core.packedgitlimit")) {
- packed_git_limit = git_config_ulong(var, value, ctx->kvi);
- return 0;
- }
-
- if (!strcmp(var, "core.deltabasecachelimit")) {
- delta_base_cache_limit = git_config_ulong(var, value, ctx->kvi);
- return 0;
- }
-
if (!strcmp(var, "core.autocrlf")) {
if (value && !strcasecmp(value, "input")) {
auto_crlf = AUTO_CRLF_INPUT;
diff --git a/configure.ac b/configure.ac
index d1a96da14e..5923edc44a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,7 @@ fi
## Configure body starts here.
AC_PREREQ(2.59)
-AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
+AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org])
AC_CONFIG_SRCDIR([git.c])
diff --git a/connected.c b/connected.c
index a9e2e13995..3099da84f3 100644
--- a/connected.c
+++ b/connected.c
@@ -54,7 +54,8 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
strbuf_add(&idx_file, transport->pack_lockfiles.items[0].string,
base_len);
strbuf_addstr(&idx_file, ".idx");
- new_pack = add_packed_git(idx_file.buf, idx_file.len, 1);
+ new_pack = add_packed_git(the_repository, idx_file.buf,
+ idx_file.len, 1);
strbuf_release(&idx_file);
}
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 8c71f5a1d0..49904ca8a9 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -83,23 +83,12 @@ if(NOT SH_EXE)
"On Windows, you can get it as part of 'Git for Windows' install at https://gitforwindows.org/")
endif()
-#Create GIT-VERSION-FILE using GIT-VERSION-GEN
-if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE)
- message("Generating GIT-VERSION-FILE")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-endif()
-
-#Parse GIT-VERSION-FILE to get the version
-file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)")
-string(REPLACE "GIT_VERSION = " "" git_version ${git_version})
-string(FIND ${git_version} "GIT" location)
-if(location EQUAL -1)
- string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})
-else()
- string(REGEX MATCH "[0-9]*\\.[0-9]*" git_version ${git_version})
- string(APPEND git_version ".0") #for building from a snapshot
-endif()
+message("Generating Git version")
+execute_process(COMMAND ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/contrib/buildsystems/git-version.in"
+ "${CMAKE_BINARY_DIR}/git-version")
+file(STRINGS "${CMAKE_BINARY_DIR}/git-version" git_version)
project(git
VERSION ${git_version}
@@ -110,8 +99,8 @@ project(git
#TODO Enable NLS on windows natively
#macros for parsing the Makefile for sources and scripts
-macro(parse_makefile_for_sources list_var regex)
- file(STRINGS ${CMAKE_SOURCE_DIR}/Makefile ${list_var} REGEX "^${regex} \\+=(.*)")
+macro(parse_makefile_for_sources list_var makefile regex)
+ file(STRINGS ${makefile} ${list_var} REGEX "^${regex} \\+=(.*)")
string(REPLACE "${regex} +=" "" ${list_var} ${${list_var}})
string(REPLACE "$(COMPAT_OBJS)" "" ${list_var} ${${list_var}}) #remove "$(COMPAT_OBJS)" This is only for libgit.
string(STRIP ${${list_var}} ${list_var}) #remove trailing/leading whitespaces
@@ -240,10 +229,7 @@ add_compile_definitions(PAGER_ENV="LESS=FRX LV=-c"
GIT_HTML_PATH="share/doc/git-doc"
DEFAULT_HELP_FORMAT="html"
DEFAULT_GIT_TEMPLATE_DIR="share/git-core/templates"
- GIT_VERSION="${PROJECT_VERSION}.GIT"
- GIT_USER_AGENT="git/${PROJECT_VERSION}.GIT"
- BINDIR="bin"
- GIT_BUILT_FROM_COMMIT="")
+ BINDIR="bin")
if(WIN32)
set(FALLBACK_RUNTIME_PREFIX /mingw64)
@@ -652,60 +638,79 @@ set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS} CACHE STRING "Programs not built" F
if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS)
list(REMOVE_ITEM EXCLUSION_PROGS empty)
message("Generating command-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-cmdlist.sh"
+ ${EXCLUSION_PROGS}
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/command-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h)
message("Generating config-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h)
+ execute_process(COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-configlist.sh"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/config-list.h")
endif()
if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h)
message("Generating hook-list.h")
- execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h)
+ execute_process(COMMAND "${SH_EXE}" ${CMAKE_SOURCE_DIR}/generate-hooklist.sh
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_BINARY_DIR}/hook-list.h")
endif()
include_directories(${CMAKE_BINARY_DIR})
#build
#libgit
-parse_makefile_for_sources(libgit_SOURCES "LIB_OBJS")
+parse_makefile_for_sources(libgit_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "LIB_OBJS")
list(TRANSFORM libgit_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
list(TRANSFORM compat_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
+
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/version-def.h"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/version-def.h.in"
+ "${CMAKE_BINARY_DIR}/version-def.h"
+ DEPENDS "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/version-def.h.in"
+ VERBATIM)
+list(APPEND libgit_SOURCES "${CMAKE_BINARY_DIR}/version-def.h")
+
add_library(libgit ${libgit_SOURCES} ${compat_SOURCES})
#libxdiff
-parse_makefile_for_sources(libxdiff_SOURCES "XDIFF_OBJS")
+parse_makefile_for_sources(libxdiff_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "XDIFF_OBJS")
list(TRANSFORM libxdiff_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(xdiff STATIC ${libxdiff_SOURCES})
#reftable
-parse_makefile_for_sources(reftable_SOURCES "REFTABLE_OBJS")
+parse_makefile_for_sources(reftable_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "REFTABLE_OBJS")
list(TRANSFORM reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_library(reftable STATIC ${reftable_SOURCES})
if(WIN32)
+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.rc
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/git.rc.in"
+ "${CMAKE_BINARY_DIR}/git.rc"
+ DEPENDS "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/git.rc.in"
+ VERBATIM)
+
if(NOT MSVC)#use windres when compiling with gcc and clang
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
- COMMAND ${WINDRES_EXE} -O coff -DMAJOR=${PROJECT_VERSION_MAJOR} -DMINOR=${PROJECT_VERSION_MINOR}
- -DMICRO=${PROJECT_VERSION_PATCH} -DPATCHLEVEL=0 -DGIT_VERSION="\\\"${PROJECT_VERSION}.GIT\\\""
- -i ${CMAKE_SOURCE_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+ COMMAND ${WINDRES_EXE} -O coff -i ${CMAKE_BINARY_DIR}/git.rc -o ${CMAKE_BINARY_DIR}/git.res
+ DEPENDS "${CMAKE_BINARY_DIR}/git.rc"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM)
else()#MSVC use rc
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git.res
- COMMAND ${CMAKE_RC_COMPILER} /d MAJOR=${PROJECT_VERSION_MAJOR} /d MINOR=${PROJECT_VERSION_MINOR}
- /d MICRO=${PROJECT_VERSION_PATCH} /d PATCHLEVEL=0 /d GIT_VERSION="${PROJECT_VERSION}.GIT"
- /fo ${CMAKE_BINARY_DIR}/git.res ${CMAKE_SOURCE_DIR}/git.rc
+ COMMAND ${CMAKE_RC_COMPILER} /fo ${CMAKE_BINARY_DIR}/git.res ${CMAKE_BINARY_DIR}/git.rc
+ DEPENDS "${CMAKE_BINARY_DIR}/git.rc"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
VERBATIM)
endif()
@@ -752,7 +757,7 @@ elseif(UNIX)
endif()
#git
-parse_makefile_for_sources(git_SOURCES "BUILTIN_OBJS")
+parse_makefile_for_sources(git_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "BUILTIN_OBJS")
list(TRANSFORM git_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
add_executable(git ${CMAKE_SOURCE_DIR}/git.c ${git_SOURCES})
@@ -834,70 +839,87 @@ set(git_shell_scripts
${git_sh_scripts} ${git_shlib_scripts} git-instaweb)
foreach(script ${git_shell_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME)
- string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}")
- string(REPLACE "@@DIFF@@" "diff" content "${content}")
- string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}")
- string(REPLACE "@@NO_CURL@@" "" content "${content}")
- string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}")
- string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}")
- string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
- string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+ if ("${script}" IN_LIST git_sh_scripts)
+ string(REPLACE ".sh" "" shell_gen_path "${script}")
+ else()
+ set(shell_gen_path "${script}")
+ endif()
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ "${CMAKE_BINARY_DIR}/${shell_gen_path}"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-script.sh"
+ "${CMAKE_SOURCE_DIR}/${script}.sh"
+ VERBATIM)
+ list(APPEND shell_gen ${CMAKE_BINARY_DIR}/${shell_gen_path})
endforeach()
+add_custom_target(shell-gen ALL DEPENDS ${shell_gen})
#perl scripts
-parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl")
+parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" "")
+#perl modules
+file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
+list(TRANSFORM perl_modules REPLACE "${CMAKE_SOURCE_DIR}/" "")
#create perl header
file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header )
-string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}")
-string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}")
-
-foreach(script ${git_perl_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME)
- string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}")
- string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
-endforeach()
-
-#python script
-file(STRINGS ${CMAKE_SOURCE_DIR}/git-p4.py content NEWLINE_CONSUME)
-string(REPLACE "#!/usr/bin/env python" "#!/usr/bin/python" content "${content}")
-file(WRITE ${CMAKE_BINARY_DIR}/git-p4 ${content})
-
-#perl modules
-file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm")
+string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}")
+string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}")
+file(WRITE ${CMAKE_BINARY_DIR}/PERL-HEADER ${perl_header})
+
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}"
+ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ DEPENDS ${SH_EXE} "${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN"
+ "${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE.in"
+ VERBATIM)
-foreach(pm ${perl_modules})
- string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm})
- file(STRINGS ${pm} content NEWLINE_CONSUME)
- string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}")
- string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}")
- file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content})
-#test-lib.sh requires perl/build/lib to be the build directory of perl modules
+foreach(script ${git_perl_scripts} ${perl_modules})
+ string(REPLACE ".perl" "" perl_gen_path "${script}")
+
+ get_filename_component(perl_gen_dir "${perl_gen_path}" DIRECTORY)
+ file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${perl_gen_dir}")
+
+ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ "${CMAKE_BINARY_DIR}/PERL-HEADER"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/${perl_gen_path}"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-perl.sh"
+ "${CMAKE_SOURCE_DIR}/${script}"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${CMAKE_BINARY_DIR}/GIT-VERSION-FILE"
+ VERBATIM)
+ list(APPEND perl_gen ${CMAKE_BINARY_DIR}/${perl_gen_path})
endforeach()
+add_custom_target(perl-gen ALL DEPENDS ${perl_gen})
+
+# Python script
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/git-p4"
+ COMMAND "${SH_EXE}" "${CMAKE_SOURCE_DIR}/generate-python.sh"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ "${CMAKE_SOURCE_DIR}/git-p4.py"
+ "${CMAKE_BINARY_DIR}/git-p4"
+ DEPENDS "${CMAKE_SOURCE_DIR}/generate-python.sh"
+ "${CMAKE_SOURCE_DIR}/git-p4.py"
+ "${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS"
+ VERBATIM)
+add_custom_target(python-gen ALL DEPENDS "${CMAKE_BINARY_DIR}/git-p4")
-
-#templates
-file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*")
-list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "")
-list(REMOVE_ITEM templates ".gitignore")
-list(REMOVE_ITEM templates "Makefile")
-list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds
-
-list(REMOVE_ITEM templates "branches--")
-file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches
-
+#${CMAKE_SOURCE_DIR}/Makefile templates
+parse_makefile_for_sources(templates ${CMAKE_SOURCE_DIR}/templates/Makefile "TEMPLATES")
+string(REPLACE " " ";" templates ${templates})
#templates have @.*@ replacement so use configure_file instead
foreach(tm ${templates})
- string(REPLACE "--" "/" blt_tm ${tm})
- string(REPLACE "this" "" blt_tm ${blt_tm})# for this--
- configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY)
+ configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${tm} @ONLY)
endforeach()
-
#translations
if(MSGFMT_EXE)
file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po")
@@ -971,7 +993,7 @@ add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
target_link_libraries(test-fake-ssh common-main)
#unit-tests
-parse_makefile_for_sources(unit-test_SOURCES "UNIT_TEST_OBJS")
+parse_makefile_for_sources(unit-test_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "UNIT_TEST_OBJS")
list(TRANSFORM unit-test_SOURCES REPLACE "\\$\\(UNIT_TEST_DIR\\)/" "${CMAKE_SOURCE_DIR}/t/unit-tests/")
add_library(unit-test-lib STATIC ${unit-test_SOURCES})
@@ -1037,7 +1059,7 @@ if(MSVC)
endif()
#test-tool
-parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
+parse_makefile_for_sources(test-tool_SOURCES ${CMAKE_SOURCE_DIR}/Makefile "TEST_BUILTINS_OBJS")
add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)
list(TRANSFORM test-tool_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/t/helper/")
@@ -1063,22 +1085,25 @@ set(wrapper_test_scripts
foreach(script ${wrapper_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}")
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "${CMAKE_BINARY_DIR}/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
foreach(script ${wrapper_test_scripts})
- file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
- string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
- string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}")
+ file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
+ string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+ string(REPLACE "@PROG@" "${CMAKE_BINARY_DIR}/t/helper/${script}${EXE_EXTENSION}" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content})
endforeach()
-file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)
-string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}")
-string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}")
+file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME)
+string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}")
+string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}")
+string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}")
+string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}")
+string(REPLACE "@PROG@" "${CMAKE_BINARY_DIR}/git-cvsserver" content "${content}")
file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content})
#options for configuring test options
@@ -1125,27 +1150,58 @@ if(NOT PYTHON_TESTS)
set(NO_PYTHON 1)
endif()
-file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SHELL_PATH='${SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TEST_SHELL_PATH='${TEST_SHELL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PERL_PATH='${PERL_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
-file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
+file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME)
+string(REPLACE "@SHELL_PATH@" "'${SHELL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_SHELL_PATH@" "'${TEST_SHELL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_PATH@" "'${PERL_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@PERL_LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@DIFF@" "'${DIFF}'" git_build_options "${git_build_options}")
+string(REPLACE "@PYTHON_PATH@" "'${PYTHON_PATH}'" git_build_options "${git_build_options}")
+string(REPLACE "@TAR@" "'${TAR}'" git_build_options "${git_build_options}")
+string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}")
+string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}")
+string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}")
+string(REPLACE "@PAGER_ENV@" "'${PAGER_ENV}'" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}")
+string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}")
+string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
+string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "'${CMAKE_BINARY_DIR}/po/build/locale'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_POPATH@" "'${CMAKE_BINARY_DIR}/po'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "'${CMAKE_BINARY_DIR}/templates/blt'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_GITPERLLIB@" "'${CMAKE_BINARY_DIR}/perl/build/lib'" git_build_options "${git_build_options}")
+string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
+string(REPLACE "@RUNTIME_PREFIX@" "'${RUNTIME_PREFIX}'" git_build_options "${git_build_options}")
+string(REPLACE "@GITWEBDIR@" "'${GITWEBDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@USE_GETTEXT_SCHEME@" "" git_build_options "${git_build_options}")
+string(REPLACE "@LOCALEDIR@" "'${LOCALEDIR}'" git_build_options "${git_build_options}")
+string(REPLACE "@BROKEN_PATH_FIX@" "" git_build_options "${git_build_options}")
if(USE_VCPKG)
- file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
+ string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
endif()
+file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options})
#Make the tests work when building out of the source tree
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)
diff --git a/contrib/buildsystems/git-version.in b/contrib/buildsystems/git-version.in
new file mode 100644
index 0000000000..9750505ae7
--- /dev/null
+++ b/contrib/buildsystems/git-version.in
@@ -0,0 +1 @@
+@GIT_MAJOR_VERSION@.@GIT_MINOR_VERSION@.@GIT_MICRO_VERSION@
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 3d4dff3185..b3b6aa3bae 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2331,7 +2331,7 @@ _git_mergetool ()
return
;;
--*)
- __gitcomp "--tool= --prompt --no-prompt --gui --no-gui"
+ __gitcomp "--tool= --tool-help --prompt --no-prompt --gui --no-gui"
return
;;
esac
diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build
new file mode 100644
index 0000000000..3a9ddab594
--- /dev/null
+++ b/contrib/completion/meson.build
@@ -0,0 +1,16 @@
+foreach script : [
+ 'git-completion.bash',
+ 'git-completion.tcsh',
+ 'git-completion.zsh',
+ 'git-prompt.sh'
+]
+ if meson.version().version_compare('>=1.3.0')
+ test_dependencies += fs.copyfile(script)
+ else
+ configure_file(
+ input: script,
+ output: script,
+ copy: true,
+ )
+ endif
+endforeach
diff --git a/contrib/diff-highlight/DiffHighlight.pm b/contrib/diff-highlight/DiffHighlight.pm
index 636add6968..3d061bc0b7 100644
--- a/contrib/diff-highlight/DiffHighlight.pm
+++ b/contrib/diff-highlight/DiffHighlight.pm
@@ -1,6 +1,6 @@
package DiffHighlight;
-use 5.008001;
+require v5.26;
use warnings FATAL => 'all';
use strict;
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 0000000000..a7b77b87c2
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1 @@
+subdir('completion')
diff --git a/contrib/mw-to-git/Git/Mediawiki.pm b/contrib/mw-to-git/Git/Mediawiki.pm
index ff7811225e..629c0cea44 100644
--- a/contrib/mw-to-git/Git/Mediawiki.pm
+++ b/contrib/mw-to-git/Git/Mediawiki.pm
@@ -1,6 +1,6 @@
package Git::Mediawiki;
-use 5.008001;
+require v5.26;
use strict;
use POSIX;
use Git;
diff --git a/daemon.c b/daemon.c
index a40e435c63..756c3f0b02 100644
--- a/daemon.c
+++ b/daemon.c
@@ -152,6 +152,7 @@ static const char *path_ok(const char *directory, struct hostinfo *hi)
size_t rlen;
const char *path;
const char *dir;
+ unsigned enter_repo_flags;
dir = directory;
@@ -242,14 +243,15 @@ static const char *path_ok(const char *directory, struct hostinfo *hi)
dir = rpath;
}
- path = enter_repo(dir, strict_paths);
+ enter_repo_flags = strict_paths ? ENTER_REPO_STRICT : 0;
+ path = enter_repo(dir, enter_repo_flags);
if (!path && base_path && base_path_relaxed) {
/*
* if we fail and base_path_relaxed is enabled, try without
* prefixing the base path
*/
dir = directory;
- path = enter_repo(dir, strict_paths);
+ path = enter_repo(dir, enter_repo_flags);
}
if (!path) {
diff --git a/diff.c b/diff.c
index dceac20d18..266ddf18e7 100644
--- a/diff.c
+++ b/diff.c
@@ -4041,7 +4041,8 @@ static int reuse_worktree_file(struct index_state *istate,
* objects however would tend to be slower as they need
* to be individually opened and inflated.
*/
- if (!FAST_WORKING_DIRECTORY && !want_file && has_object_pack(oid))
+ if (!FAST_WORKING_DIRECTORY && !want_file &&
+ has_object_pack(istate->repo, oid))
return 0;
/*
diff --git a/environment.c b/environment.c
index a2ce998081..8389a27270 100644
--- a/environment.c
+++ b/environment.c
@@ -49,9 +49,6 @@ int fsync_object_files = -1;
int use_fsync = -1;
enum fsync_method fsync_method = FSYNC_METHOD_DEFAULT;
enum fsync_component fsync_components = FSYNC_COMPONENTS_DEFAULT;
-size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE;
-size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT;
-size_t delta_base_cache_limit = 96 * 1024 * 1024;
unsigned long big_file_threshold = 512 * 1024 * 1024;
char *editor_program;
char *askpass_program;
diff --git a/environment.h b/environment.h
index 923e12661e..2f43340f0b 100644
--- a/environment.h
+++ b/environment.h
@@ -165,7 +165,6 @@ extern int zlib_compression_level;
extern int pack_compression_level;
extern size_t packed_git_window_size;
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;
diff --git a/fetch-pack.c b/fetch-pack.c
index fe1fb3c1b7..c095f3a84b 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1857,8 +1857,8 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
return ref;
}
-static int fetch_pack_config_cb(const char *var, const char *value,
- const struct config_context *ctx, void *cb)
+int fetch_pack_fsck_config(const char *var, const char *value,
+ struct strbuf *msg_types)
{
const char *msg_id;
@@ -1866,9 +1866,9 @@ static int fetch_pack_config_cb(const char *var, const char *value,
char *path ;
if (git_config_pathname(&path, var, value))
- return 1;
- strbuf_addf(&fsck_msg_types, "%cskiplist=%s",
- fsck_msg_types.len ? ',' : '=', path);
+ return 0;
+ strbuf_addf(msg_types, "%cskiplist=%s",
+ msg_types->len ? ',' : '=', path);
free(path);
return 0;
}
@@ -1877,14 +1877,24 @@ static int fetch_pack_config_cb(const char *var, const char *value,
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 ? ',' : '=', msg_id, value);
+ strbuf_addf(msg_types, "%c%s=%s",
+ msg_types->len ? ',' : '=', msg_id, value);
else
warning("Skipping unknown msg id '%s'", msg_id);
return 0;
}
- return git_default_config(var, value, ctx, cb);
+ return 1;
+}
+
+static int fetch_pack_config_cb(const char *var, const char *value,
+ const struct config_context *ctx, void *cb)
+{
+ int ret = fetch_pack_fsck_config(var, value, &fsck_msg_types);
+ if (ret > 0)
+ return git_default_config(var, value, ctx, cb);
+
+ return ret;
}
static void fetch_pack_config(void)
diff --git a/fetch-pack.h b/fetch-pack.h
index b5c579cdae..9d3470366f 100644
--- a/fetch-pack.h
+++ b/fetch-pack.h
@@ -106,4 +106,15 @@ int report_unmatched_refs(struct ref **sought, int nr_sought);
*/
int fetch_pack_fsck_objects(void);
+/*
+ * Check if the provided config variable pertains to fetch fsck and if so append
+ * the configuration to the provided strbuf.
+ *
+ * When a fetch fsck config option is successfully processed the function
+ * returns 0. If the provided config option is unrelated to fetch fsck, 1 is
+ * returned. Errors return -1.
+ */
+int fetch_pack_fsck_config(const char *var, const char *value,
+ struct strbuf *msg_types);
+
#endif
diff --git a/fsck.c b/fsck.c
index 3756f52459..87ce999a49 100644
--- a/fsck.c
+++ b/fsck.c
@@ -1295,7 +1295,7 @@ static int fsck_blobs(struct oidset *blobs_found, struct oidset *blobs_done,
buf = repo_read_object_file(the_repository, oid, &type, &size);
if (!buf) {
- if (is_promisor_object(oid))
+ if (is_promisor_object(the_repository, oid))
continue;
ret |= report(options,
oid, OBJ_BLOB, msg_missing,
diff --git a/fsck.h b/fsck.h
index 500b4c04d2..a44c231a5f 100644
--- a/fsck.h
+++ b/fsck.h
@@ -31,8 +31,10 @@ enum fsck_msg_type {
FUNC(BAD_NAME, ERROR) \
FUNC(BAD_OBJECT_SHA1, ERROR) \
FUNC(BAD_PARENT_SHA1, ERROR) \
+ FUNC(BAD_REF_CONTENT, ERROR) \
FUNC(BAD_REF_FILETYPE, ERROR) \
FUNC(BAD_REF_NAME, ERROR) \
+ FUNC(BAD_REFERENT_NAME, ERROR) \
FUNC(BAD_TIMEZONE, ERROR) \
FUNC(BAD_TREE, ERROR) \
FUNC(BAD_TREE_SHA1, ERROR) \
@@ -84,6 +86,10 @@ enum fsck_msg_type {
FUNC(MAILMAP_SYMLINK, INFO) \
FUNC(BAD_TAG_NAME, INFO) \
FUNC(MISSING_TAGGER_ENTRY, INFO) \
+ FUNC(SYMLINK_REF, INFO) \
+ FUNC(REF_MISSING_NEWLINE, INFO) \
+ FUNC(SYMREF_TARGET_IS_NOT_A_REF, INFO) \
+ FUNC(TRAILING_REF_CONTENT, INFO) \
/* ignored (elevated when requested) */ \
FUNC(EXTRA_HEADER_ENTRY, IGNORE)
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 205541e0f7..b923a5aab8 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -64,7 +64,7 @@ define_category_names () {
print_command_list () {
echo "static struct cmdname_help command_list[] = {"
- echo "$1" |
+ echo "$2" |
while read cmd rest
do
synopsis=
@@ -76,7 +76,7 @@ print_command_list () {
break
;;
esac
- done <"Documentation/$cmd.txt"
+ done <"$1/Documentation/$cmd.txt"
printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
printf " | CAT_%s" $rest
@@ -93,18 +93,28 @@ do
shift
done
-commands="$(command_list "$1")"
-categories="$(category_list "$commands")"
+if test "$#" -ne 2
+then
+ die "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+fi
+
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+{
+ commands="$(command_list "$SOURCE_DIR"/command-list.txt)"
+ categories="$(category_list "$commands")"
-echo "/* Automatically generated by generate-cmdlist.sh */
-struct cmdname_help {
- const char *name;
- const char *help;
- uint32_t category;
-};
-"
-define_categories "$categories"
-echo
-define_category_names "$categories"
-echo
-print_command_list "$commands"
+ echo "/* Automatically generated by generate-cmdlist.sh */
+ struct cmdname_help {
+ const char *name;
+ const char *help;
+ uint32_t category;
+ };
+ "
+ define_categories "$categories"
+ echo
+ define_category_names "$categories"
+ echo
+ print_command_list "$SOURCE_DIR" "$commands"
+} >"$OUTPUT"
diff --git a/generate-configlist.sh b/generate-configlist.sh
index 8692fe5cf4..579422619c 100755
--- a/generate-configlist.sh
+++ b/generate-configlist.sh
@@ -1,13 +1,19 @@
#!/bin/sh
-echo "/* Automatically generated by generate-configlist.sh */"
-echo
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+ exit 1
+fi
print_config_list () {
cat <<EOF
static const char *config_name_list[] = {
EOF
- grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt |
+ grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.txt "$SOURCE_DIR"/Documentation/config/*.txt |
sed '/deprecated/d; s/::$//; s/, */\n/g' |
sort |
sed 's/^.*$/ "&",/'
@@ -17,5 +23,9 @@ EOF
EOF
}
-echo
-print_config_list
+{
+ echo "/* Automatically generated by generate-configlist.sh */"
+ echo
+ echo
+ print_config_list
+} >"$OUTPUT"
diff --git a/generate-hooklist.sh b/generate-hooklist.sh
index 2f9f54eb54..e22068c2fa 100755
--- a/generate-hooklist.sh
+++ b/generate-hooklist.sh
@@ -2,6 +2,17 @@
#
# Usage: ./generate-hooklist.sh >hook-list.h
+SOURCE_DIR="$1"
+OUTPUT="$2"
+
+if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT"
+then
+ echo >&2 "USAGE: $0 <SOURCE_DIR> <OUTPUT>"
+ exit 1
+fi
+
+{
+
cat <<EOF
/* Automatically generated by generate-hooklist.sh */
@@ -11,10 +22,12 @@ EOF
sed -n \
-e '/^~~~~*$/ {x; s/^.*$/ "&",/; p;}' \
-e 'x' \
- <Documentation/githooks.txt |
+ <"$SOURCE_DIR"/Documentation/githooks.txt |
LC_ALL=C sort
cat <<EOF
NULL,
};
EOF
+
+} >"$OUTPUT"
diff --git a/generate-perl.sh b/generate-perl.sh
new file mode 100755
index 0000000000..65f122ebfc
--- /dev/null
+++ b/generate-perl.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 5
+then
+ echo >&2 "USAGE: $0 <GIT_BUILD_OPTIONS> <GIT_VERSION_FILE> <PERL_HEADER> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
+GIT_BUILD_OPTIONS="$1"
+GIT_VERSION_FILE="$2"
+PERL_HEADER="$3"
+INPUT="$4"
+OUTPUT="$5"
+
+. "$GIT_BUILD_OPTIONS"
+. "$GIT_VERSION_FILE"
+
+sed -e '1{' \
+ -e " /^#!.*perl/!b" \
+ -e " s|#!.*perl|#!$PERL_PATH|" \
+ -e " r $PERL_HEADER" \
+ -e ' G' \
+ -e '}' \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|g" \
+ -e "s|@LOCALEDIR@|$PERL_LOCALEDIR|g" \
+ -e "s|@NO_GETTEXT@|$NO_GETTEXT|g" \
+ -e "s|@NO_PERL_CPAN_FALLBACKS@|$NO_PERL_CPAN_FALLBACKS|g" \
+ "$INPUT" >"$OUTPUT"
+
+case "$INPUT" in
+*.perl)
+ chmod a+x "$OUTPUT";;
+*)
+ ;;
+esac
diff --git a/generate-python.sh b/generate-python.sh
new file mode 100755
index 0000000000..31ac115689
--- /dev/null
+++ b/generate-python.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo >&2 "USAGE: $0 <GIT_BUILD_OPTIONS> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
+GIT_BUILD_OPTIONS="$1"
+INPUT="$2"
+OUTPUT="$3"
+
+. "$GIT_BUILD_OPTIONS"
+
+sed -e "1s|#!.*python|#!$PYTHON_PATH|" \
+ "$INPUT" >"$OUTPUT+"
+chmod a+x "$OUTPUT+"
+mv "$OUTPUT+" "$OUTPUT"
diff --git a/generate-script.sh b/generate-script.sh
new file mode 100755
index 0000000000..a149e4f0ba
--- /dev/null
+++ b/generate-script.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+ echo >&2 "USAGE: $0 <INPUT> <OUTPUT> <GIT-BUILD-OPTIONS>"
+ exit 1
+fi
+
+INPUT="$1"
+OUTPUT="$2"
+BUILD_OPTIONS="$3"
+
+. "$BUILD_OPTIONS"
+
+sed -e "1s|#!.*/sh|#!$SHELL_PATH|" \
+ -e "s|@SHELL_PATH@|$SHELL_PATH|" \
+ -e "s|@DIFF@|$DIFF|" \
+ -e "s|@LOCALEDIR@|$LOCALEDIR|g" \
+ -e "s/@USE_GETTEXT_SCHEME@/$USE_GETTEXT_SCHEME/g" \
+ -e "$BROKEN_PATH_FIX" \
+ -e "s|@GITWEBDIR@|$GITWEBDIR|g" \
+ -e "s|@PERL_PATH@|$PERL_PATH|g" \
+ -e "s|@PAGER_ENV@|$PAGER_ENV|g" \
+ "$INPUT" >"$OUTPUT"
+
+case "$(basename "$INPUT")" in
+git-mergetool--lib.sh|git-sh-i18n.sh|git-sh-setup.sh)
+ ;;
+*)
+ chmod a+x "$OUTPUT"
+ ;;
+esac
diff --git a/git-archimport.perl b/git-archimport.perl
index f5a317b899..6d0169cb6a 100755
--- a/git-archimport.perl
+++ b/git-archimport.perl
@@ -54,7 +54,7 @@ and can contain multiple, unrelated branches.
=cut
-use 5.008001;
+require v5.26;
use strict;
use warnings;
use Getopt::Std;
diff --git a/git-compat-util.h b/git-compat-util.h
index e4a306dd56..a06d4f3809 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -1527,26 +1527,6 @@ int cmd_main(int, const char **);
int common_exit(const char *file, int line, int code);
#define exit(code) exit(common_exit(__FILE__, __LINE__, (code)))
-/*
- * You can mark a stack variable with UNLEAK(var) to avoid it being
- * reported as a leak by tools like LSAN or valgrind. The argument
- * should generally be the variable itself (not its address and not what
- * it points to). It's safe to use this on pointers which may already
- * have been freed, or on pointers which may still be in use.
- *
- * Use this _only_ for a variable that leaks by going out of scope at
- * program exit (so only from cmd_* functions or their direct helpers).
- * Normal functions, especially those which may be called multiple
- * times, should actually free their memory. This is only meant as
- * an annotation, and does nothing in non-leak-checking builds.
- */
-#ifdef SUPPRESS_ANNOTATED_LEAKS
-void unleak_memory(const void *ptr, size_t len);
-#define UNLEAK(var) unleak_memory(&(var), sizeof(var))
-#else
-#define UNLEAK(var) do {} while (0)
-#endif
-
#define z_const
#include <zlib.h>
diff --git a/git-curl-compat.h b/git-curl-compat.h
index e1d0bdd273..703756ba85 100644
--- a/git-curl-compat.h
+++ b/git-curl-compat.h
@@ -29,104 +29,6 @@
*/
/**
- * CURL_SOCKOPT_OK was added in 7.21.5, released in April 2011.
- */
-#if LIBCURL_VERSION_NUM < 0x071505
-#define CURL_SOCKOPT_OK 0
-#endif
-
-/**
- * CURLOPT_TCP_KEEPALIVE was added in 7.25.0, released in March 2012.
- */
-#if LIBCURL_VERSION_NUM >= 0x071900
-#define GITCURL_HAVE_CURLOPT_TCP_KEEPALIVE 1
-#endif
-
-
-/**
- * CURLOPT_LOGIN_OPTIONS was added in 7.34.0, released in December
- * 2013.
- *
- * If we start requiring 7.34.0 we might also be able to remove the
- * code conditional on USE_CURL_FOR_IMAP_SEND in imap-send.c, see
- * 1e16b255b95 (git-imap-send: use libcurl for implementation,
- * 2014-11-09) and the check it added for "072200" in the Makefile.
-
- */
-#if LIBCURL_VERSION_NUM >= 0x072200
-#define GIT_CURL_HAVE_CURLOPT_LOGIN_OPTIONS 1
-#endif
-
-/**
- * CURL_SSLVERSION_TLSv1_[012] was added in 7.34.0, released in
- * December 2013.
- */
-#if LIBCURL_VERSION_NUM >= 0x072200
-#define GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_0
-#endif
-
-/**
- * CURLOPT_PINNEDPUBLICKEY was added in 7.39.0, released in November
- * 2014. CURLE_SSL_PINNEDPUBKEYNOTMATCH was added in that same version.
- */
-#if LIBCURL_VERSION_NUM >= 0x072c00
-#define GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY 1
-#define GIT_CURL_HAVE_CURLE_SSL_PINNEDPUBKEYNOTMATCH 1
-#endif
-
-/**
- * CURL_HTTP_VERSION_2 was added in 7.43.0, released in June 2015.
- *
- * The CURL_HTTP_VERSION_2 alias (but not CURL_HTTP_VERSION_2_0) has
- * always been a macro, not an enum field (checked on curl version
- * 7.78.0)
- */
-#if LIBCURL_VERSION_NUM >= 0x072b00
-#define GIT_CURL_HAVE_CURL_HTTP_VERSION_2 1
-#endif
-
-/**
- * CURLSSLOPT_NO_REVOKE was added in 7.44.0, released in August 2015.
- *
- * The CURLSSLOPT_NO_REVOKE is, has always been a macro, not an enum
- * field (checked on curl version 7.78.0)
- */
-#if LIBCURL_VERSION_NUM >= 0x072c00
-#define GIT_CURL_HAVE_CURLSSLOPT_NO_REVOKE 1
-#endif
-
-/**
- * CURLOPT_PROXY_CAINFO was added in 7.52.0, released in August 2017.
- */
-#if LIBCURL_VERSION_NUM >= 0x073400
-#define GIT_CURL_HAVE_CURLOPT_PROXY_CAINFO 1
-#endif
-
-/**
- * CURLOPT_PROXY_{KEYPASSWD,SSLCERT,SSLKEY} was added in 7.52.0,
- * released in August 2017.
- */
-#if LIBCURL_VERSION_NUM >= 0x073400
-#define GIT_CURL_HAVE_CURLOPT_PROXY_KEYPASSWD 1
-#endif
-
-/**
- * CURL_SSLVERSION_TLSv1_3 was added in 7.53.0, released in February
- * 2017.
- */
-#if LIBCURL_VERSION_NUM >= 0x073400
-#define GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_3 1
-#endif
-
-/**
- * CURLSSLSET_{NO_BACKENDS,OK,TOO_LATE,UNKNOWN_BACKEND} were added in
- * 7.56.0, released in September 2017.
- */
-#if LIBCURL_VERSION_NUM >= 0x073800
-#define GIT_CURL_HAVE_CURLSSLSET_NO_BACKENDS
-#endif
-
-/**
* Versions before curl 7.66.0 (September 2019) required manually setting the
* transfer-encoding for a streaming POST; after that this is handled
* automatically.
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 1e03ba94d1..edf02f9964 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use 5.008001;
+require v5.26;
use strict;
use warnings;
use Getopt::Std;
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 211ec8459a..e10ad5334e 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -13,7 +13,7 @@
# The head revision is on branch "origin" by default.
# You can change that with the '-o' option.
-use 5.008001;
+require v5.26;
use strict;
use warnings;
use Getopt::Long;
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 124f598bdc..a4e1bad33c 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -15,7 +15,7 @@
####
####
-use 5.008001;
+require v5.26;
use strict;
use warnings;
use bytes;
@@ -26,7 +26,7 @@ use File::Path qw/rmtree/;
use File::Basename;
use Getopt::Long qw(:config require_order no_ignore_case);
-my $VERSION = '@@GIT_VERSION@@';
+my $VERSION = '@GIT_VERSION@';
my $log = GITCVS::log->new();
my $cfg;
diff --git a/git-difftool--helper.sh b/git-difftool--helper.sh
index dd0c9a5b7f..d32e47cc09 100755
--- a/git-difftool--helper.sh
+++ b/git-difftool--helper.sh
@@ -61,9 +61,7 @@ launch_merge_tool () {
export BASE
eval $GIT_DIFFTOOL_EXTCMD '"$LOCAL"' '"$REMOTE"'
else
- initialize_merge_tool "$merge_tool"
- # ignore the error from the above --- run_merge_tool
- # will diagnose unusable tool by itself
+ initialize_merge_tool "$merge_tool" || exit 1
run_merge_tool "$merge_tool"
fi
}
@@ -87,9 +85,7 @@ if test -n "$GIT_DIFFTOOL_DIRDIFF"
then
LOCAL="$1"
REMOTE="$2"
- initialize_merge_tool "$merge_tool"
- # ignore the error from the above --- run_merge_tool
- # will diagnose unusable tool by itself
+ initialize_merge_tool "$merge_tool" || exit 1
run_merge_tool "$merge_tool" false
status=$?
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 8dbe21d588..5ad50160bb 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -3,7 +3,7 @@
# Copyright (c) 2006 Eric Wong
#
-PERL='@@PERL@@'
+PERL='@PERL_PATH@'
OPTIONS_KEEPDASHDASH=
OPTIONS_STUCKLONG=
OPTIONS_SPEC="\
@@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f'
-# Default is @@GITWEBDIR@@
-test -z "$root" && root='@@GITWEBDIR@@'
+# Default is @GITWEBDIR@
+test -z "$root" && root='@GITWEBDIR@'
# any untaken local port will do...
test -z "$port" && port=1234
@@ -716,7 +716,7 @@ EOF
gitweb_conf() {
cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
-#!@@PERL@@
+#!@PERL_PATH@
our \$projectroot = "$(dirname "$fqgitdir")";
our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 1ff26170ff..11ea181259 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -159,7 +159,7 @@ check_unchanged () {
}
valid_tool () {
- setup_tool "$1" && return 0
+ setup_tool "$1" 2>/dev/null && return 0
cmd=$(get_merge_tool_cmd "$1")
test -n "$cmd"
}
@@ -250,7 +250,12 @@ setup_tool () {
. "$MERGE_TOOLS_DIR/${tool%[0-9]}"
else
setup_user_tool
- return $?
+ rc=$?
+ if test $rc -ne 0
+ then
+ echo >&2 "error: ${TOOL_MODE}tool.$tool.cmd not set for tool '$tool'"
+ fi
+ return $rc
fi
# Now let the user override the default command for the tool. If
@@ -259,6 +264,7 @@ setup_tool () {
if ! list_tool_variants | grep -q "^$tool$"
then
+ echo "error: unknown tool variant '$tool'" >&2
return 1
fi
@@ -474,7 +480,7 @@ get_merge_tool_path () {
merge_tool="$1"
if ! valid_tool "$merge_tool"
then
- echo >&2 "Unknown merge tool $merge_tool"
+ echo >&2 "Unknown $TOOL_MODE tool $merge_tool"
exit 1
fi
if diff_mode
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 01640a044b..775ba8ea11 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -112,7 +112,7 @@ find_matching_ref='
}
'
-set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
+set fnord $(git ls-remote "$url" | @PERL_PATH@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev")
remote_sha1=$2
ref=$3
diff --git a/git-send-email.perl b/git-send-email.perl
index c835d4c11a..798d59b84f 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -16,7 +16,7 @@
# and second line is the subject of the message.
#
-use 5.008001;
+require v5.26;
use strict;
use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
use Getopt::Long;
@@ -1501,7 +1501,7 @@ sub gen_header {
@recipients = unique_email_list(@recipients,@cc,@initial_bcc);
@recipients = (map { extract_valid_address_or_die($_) } @recipients);
my $date = format_2822_time($time++);
- my $gitversion = '@@GIT_VERSION@@';
+ my $gitversion = '@GIT_VERSION@';
if ($gitversion =~ m/..GIT_VERSION../) {
$gitversion = Git::version();
}
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index a15c0620db..ae4b2d6ba9 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -9,7 +9,7 @@ TEXTDOMAIN=git
export TEXTDOMAIN
if test -z "$GIT_TEXTDOMAINDIR"
then
- TEXTDOMAINDIR="@@LOCALEDIR@@"
+ TEXTDOMAINDIR="@LOCALEDIR@"
else
TEXTDOMAINDIR="$GIT_TEXTDOMAINDIR"
fi
@@ -17,9 +17,9 @@ export TEXTDOMAINDIR
# First decide what scheme to use...
GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
-if test -n "@@USE_GETTEXT_SCHEME@@"
+if test -n "@USE_GETTEXT_SCHEME@"
then
- GIT_INTERNAL_GETTEXT_SH_SCHEME="@@USE_GETTEXT_SCHEME@@"
+ GIT_INTERNAL_GETTEXT_SH_SCHEME="@USE_GETTEXT_SCHEME@"
elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS"
then
: no probing necessary
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index ce273fe0e4..19aef72ec2 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -41,7 +41,7 @@ git_broken_path_fix () {
esac
}
-# @@BROKEN_PATH_FIX@@
+# @BROKEN_PATH_FIX@
# Source git-sh-i18n for gettext support.
. "$(git --exec-path)/git-sh-i18n"
@@ -154,7 +154,7 @@ git_pager() {
else
GIT_PAGER=cat
fi
- for vardef in @@PAGER_ENV@@
+ for vardef in @PAGER_ENV@
do
var=${vardef%%=*}
eval ": \"\${$vardef}\" && export $var"
@@ -280,7 +280,7 @@ get_author_ident_from_commit () {
# remove lines from $1 that are not in $2, leaving only common lines.
create_virtual_base() {
sz0=$(wc -c <"$1")
- @@DIFF@@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
+ @DIFF@ -u -La/"$1" -Lb/"$1" "$1" "$2" | git apply --no-add
sz1=$(wc -c <"$1")
# If we do not have enough common material, it is not
diff --git a/git-svn.perl b/git-svn.perl
index 01e7a70de1..32c648c395 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# Copyright (C) 2006, Eric Wong <normalperson@yhbt.net>
# License: GPL v2 or later
-use 5.008001;
+require v5.26;
use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
use strict;
use vars qw/ $AUTHOR $VERSION
@@ -9,7 +9,7 @@ use vars qw/ $AUTHOR $VERSION
$_revision $_repository
$_q $_authors $_authors_prog %users/;
$AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
-$VERSION = '@@GIT_VERSION@@';
+$VERSION = '@GIT_VERSION@';
use Carp qw/croak/;
use File::Basename qw/dirname basename/;
diff --git a/git.c b/git.c
index c2c1b8e22c..46b3c740c5 100644
--- a/git.c
+++ b/git.c
@@ -362,7 +362,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
return (*argv) - orig_argv;
}
-static int handle_alias(int *argcp, const char ***argv)
+static int handle_alias(struct strvec *args)
{
int envchanged = 0, ret = 0, saved_errno = errno;
int count, option_count;
@@ -370,10 +370,10 @@ static int handle_alias(int *argcp, const char ***argv)
const char *alias_command;
char *alias_string;
- alias_command = (*argv)[0];
+ alias_command = args->v[0];
alias_string = alias_lookup(alias_command);
if (alias_string) {
- if (*argcp > 1 && !strcmp((*argv)[1], "-h"))
+ if (args->nr > 1 && !strcmp(args->v[1], "-h"))
fprintf_ln(stderr, _("'%s' is aliased to '%s'"),
alias_command, alias_string);
if (alias_string[0] == '!') {
@@ -390,7 +390,7 @@ static int handle_alias(int *argcp, const char ***argv)
child.wait_after_clean = 1;
child.trace2_child_class = "shell_alias";
strvec_push(&child.args, alias_string + 1);
- strvec_pushv(&child.args, (*argv) + 1);
+ strvec_pushv(&child.args, args->v + 1);
trace2_cmd_alias(alias_command, child.args.v);
trace2_cmd_name("_run_shell_alias_");
@@ -423,15 +423,13 @@ static int handle_alias(int *argcp, const char ***argv)
trace_argv_printf(new_argv,
"trace: alias expansion: %s =>",
alias_command);
-
- REALLOC_ARRAY(new_argv, count + *argcp);
- /* insert after command name */
- COPY_ARRAY(new_argv + count, *argv + 1, *argcp);
-
trace2_cmd_alias(alias_command, new_argv);
- *argv = new_argv;
- *argcp += count - 1;
+ /* Replace the alias with the new arguments. */
+ strvec_splice(args, 0, 1, new_argv, count);
+
+ free(alias_string);
+ free(new_argv);
ret = 1;
}
@@ -698,63 +696,57 @@ void load_builtin_commands(const char *prefix, struct cmdnames *cmds)
}
#ifdef STRIP_EXTENSION
-static void strip_extension(const char **argv)
+static void strip_extension(struct strvec *args)
{
size_t len;
- if (strip_suffix(argv[0], STRIP_EXTENSION, &len))
- argv[0] = xmemdupz(argv[0], len);
+ if (strip_suffix(args->v[0], STRIP_EXTENSION, &len)) {
+ char *stripped = xmemdupz(args->v[0], len);
+ strvec_replace(args, 0, stripped);
+ free(stripped);
+ }
}
#else
#define strip_extension(cmd)
#endif
-static void handle_builtin(int argc, const char **argv)
+static void handle_builtin(struct strvec *args)
{
- struct strvec args = STRVEC_INIT;
- const char **argv_copy = NULL;
const char *cmd;
struct cmd_struct *builtin;
- strip_extension(argv);
- cmd = argv[0];
+ strip_extension(args);
+ cmd = args->v[0];
/* Turn "git cmd --help" into "git help --exclude-guides cmd" */
- if (argc > 1 && !strcmp(argv[1], "--help")) {
- int i;
-
- argv[1] = argv[0];
- argv[0] = cmd = "help";
-
- for (i = 0; i < argc; i++) {
- strvec_push(&args, argv[i]);
- if (!i)
- strvec_push(&args, "--exclude-guides");
- }
+ if (args->nr > 1 && !strcmp(args->v[1], "--help")) {
+ const char *exclude_guides_arg[] = { "--exclude-guides" };
+
+ strvec_replace(args, 1, args->v[0]);
+ strvec_replace(args, 0, "help");
+ cmd = "help";
+ strvec_splice(args, 2, 0, exclude_guides_arg,
+ ARRAY_SIZE(exclude_guides_arg));
+ }
- argc++;
+ builtin = get_builtin(cmd);
+ if (builtin) {
+ const char **argv_copy = NULL;
+ int ret;
/*
* `run_builtin()` will modify the argv array, so we need to
* create a shallow copy such that we can free all of its
* strings.
*/
- CALLOC_ARRAY(argv_copy, argc + 1);
- COPY_ARRAY(argv_copy, args.v, argc);
+ if (args->nr)
+ DUP_ARRAY(argv_copy, args->v, args->nr + 1);
- argv = argv_copy;
- }
-
- builtin = get_builtin(cmd);
- if (builtin) {
- int ret = run_builtin(builtin, argc, argv, the_repository);
- strvec_clear(&args);
+ ret = run_builtin(builtin, args->nr, argv_copy, the_repository);
+ strvec_clear(args);
free(argv_copy);
exit(ret);
}
-
- strvec_clear(&args);
- free(argv_copy);
}
static void execv_dashed_external(const char **argv)
@@ -800,10 +792,10 @@ static void execv_dashed_external(const char **argv)
exit(128);
}
-static int run_argv(int *argcp, const char ***argv)
+static int run_argv(struct strvec *args)
{
int done_alias = 0;
- struct string_list cmd_list = STRING_LIST_INIT_NODUP;
+ struct string_list cmd_list = STRING_LIST_INIT_DUP;
struct string_list_item *seen;
while (1) {
@@ -817,8 +809,8 @@ static int run_argv(int *argcp, const char ***argv)
* process.
*/
if (!done_alias)
- handle_builtin(*argcp, *argv);
- else if (get_builtin(**argv)) {
+ handle_builtin(args);
+ else if (get_builtin(args->v[0])) {
struct child_process cmd = CHILD_PROCESS_INIT;
int i;
@@ -834,8 +826,8 @@ static int run_argv(int *argcp, const char ***argv)
commit_pager_choice();
strvec_push(&cmd.args, "git");
- for (i = 0; i < *argcp; i++)
- strvec_push(&cmd.args, (*argv)[i]);
+ for (i = 0; i < args->nr; i++)
+ strvec_push(&cmd.args, args->v[i]);
trace_argv_printf(cmd.args.v, "trace: exec:");
@@ -850,13 +842,13 @@ static int run_argv(int *argcp, const char ***argv)
i = run_command(&cmd);
if (i >= 0 || errno != ENOENT)
exit(i);
- die("could not execute builtin %s", **argv);
+ die("could not execute builtin %s", args->v[0]);
}
/* .. then try the external ones */
- execv_dashed_external(*argv);
+ execv_dashed_external(args->v);
- seen = unsorted_string_list_lookup(&cmd_list, *argv[0]);
+ seen = unsorted_string_list_lookup(&cmd_list, args->v[0]);
if (seen) {
int i;
struct strbuf sb = STRBUF_INIT;
@@ -873,14 +865,14 @@ static int run_argv(int *argcp, const char ***argv)
" not terminate:%s"), cmd_list.items[0].string, sb.buf);
}
- string_list_append(&cmd_list, *argv[0]);
+ string_list_append(&cmd_list, args->v[0]);
/*
* It could be an alias -- this works around the insanity
* of overriding "git log" with "git show" by having
* alias.log = show
*/
- if (!handle_alias(argcp, argv))
+ if (!handle_alias(args))
break;
done_alias = 1;
}
@@ -892,6 +884,7 @@ static int run_argv(int *argcp, const char ***argv)
int cmd_main(int argc, const char **argv)
{
+ struct strvec args = STRVEC_INIT;
const char *cmd;
int done_help = 0;
@@ -917,8 +910,10 @@ int cmd_main(int argc, const char **argv)
* that one cannot handle it.
*/
if (skip_prefix(cmd, "git-", &cmd)) {
- argv[0] = cmd;
- handle_builtin(argc, argv);
+ strvec_push(&args, cmd);
+ strvec_pushv(&args, argv + 1);
+ handle_builtin(&args);
+ strvec_clear(&args);
die(_("cannot handle %s as a builtin"), cmd);
}
@@ -951,25 +946,34 @@ int cmd_main(int argc, const char **argv)
*/
setup_path();
+ for (size_t i = 0; i < argc; i++)
+ strvec_push(&args, argv[i]);
+
while (1) {
- int was_alias = run_argv(&argc, &argv);
+ int was_alias = run_argv(&args);
if (errno != ENOENT)
break;
if (was_alias) {
fprintf(stderr, _("expansion of alias '%s' failed; "
"'%s' is not a git command\n"),
- cmd, argv[0]);
+ cmd, args.v[0]);
+ strvec_clear(&args);
exit(1);
}
if (!done_help) {
- cmd = argv[0] = help_unknown_cmd(cmd);
+ char *assumed = help_unknown_cmd(cmd);
+ strvec_replace(&args, 0, assumed);
+ free(assumed);
+ cmd = args.v[0];
done_help = 1;
- } else
+ } else {
break;
+ }
}
fprintf(stderr, _("failed to run command '%s': %s\n"),
cmd, strerror(errno));
+ strvec_clear(&args);
return 1;
}
diff --git a/git.rc b/git.rc.in
index cc3fdc6cc6..e69444eef3 100644
--- a/git.rc
+++ b/git.rc.in
@@ -1,6 +1,6 @@
1 VERSIONINFO
-FILEVERSION MAJOR,MINOR,MICRO,PATCHLEVEL
-PRODUCTVERSION MAJOR,MINOR,MICRO,PATCHLEVEL
+FILEVERSION @GIT_MAJOR_VERSION@,@GIT_MINOR_VERSION@,@GIT_MICRO_VERSION@,@GIT_PATCH_LEVEL@
+PRODUCTVERSION @GIT_MAJOR_VERSION@,@GIT_MINOR_VERSION@,@GIT_MICRO_VERSION@,@GIT_PATCH_LEVEL@
BEGIN
BLOCK "StringFileInfo"
BEGIN
@@ -11,7 +11,7 @@ BEGIN
VALUE "InternalName", "git\0"
VALUE "OriginalFilename", "git.exe\0"
VALUE "ProductName", "Git\0"
- VALUE "ProductVersion", GIT_VERSION "\0"
+ VALUE "ProductVersion", "@GIT_VERSION@\0"
END
END
diff --git a/gitk-git/gitk b/gitk-git/gitk
index 7a087f123d..47a7c1d29c 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -1969,6 +1969,10 @@ proc confirm_popup {msg {owner .}} {
return $confirm_ok
}
+proc haveselectionclipboard {} {
+ return [expr {[tk windowingsystem] eq "x11"}]
+}
+
proc setoptions {} {
global use_ttk
@@ -2089,7 +2093,7 @@ proc makewindow {} {
global diffcontextstring diffcontext
global ignorespace
global maincursor textcursor curtextcursor
- global rowctxmenu fakerowmenu mergemax wrapcomment
+ global rowctxmenu fakerowmenu mergemax wrapcomment wrapdefault
global highlight_files gdttype
global searchstring sstring
global bgcolor fgcolor bglist fglist diffcolors diffbgcolors selectbgcolor
@@ -2223,7 +2227,7 @@ proc makewindow {} {
set sha1entry .tf.bar.sha1
set entries $sha1entry
set sha1but .tf.bar.sha1label
- button $sha1but -text "[mc "SHA1 ID:"] " -state disabled -relief flat \
+ button $sha1but -text "[mc "Commit ID:"] " -state disabled -relief flat \
-command gotocommit -width 8
$sha1but conf -disabledforeground [$sha1but cget -foreground]
pack .tf.bar.sha1label -side left
@@ -2431,7 +2435,7 @@ proc makewindow {} {
set ctext .bleft.bottom.ctext
text $ctext -background $bgcolor -foreground $fgcolor \
-state disabled -undo 0 -font textfont \
- -yscrollcommand scrolltext -wrap none \
+ -yscrollcommand scrolltext -wrap $wrapdefault \
-xscrollcommand ".bleft.bottom.sbhorizontal set"
if {$have_tk85} {
$ctext conf -tabstyle wordprocessor
@@ -7344,7 +7348,7 @@ proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
global mergemax numcommits pending_select
global cmitmode showneartags allcommits
global targetrow targetid lastscrollrows
- global autoselect autosellen jump_to_here
+ global autocopy autoselect autosellen jump_to_here
global vinlinediff
unset -nocomplain pending_select
@@ -7410,9 +7414,13 @@ proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
$sha1entry delete 0 end
$sha1entry insert 0 $id
- if {$autoselect} {
+ if {$autoselect && [haveselectionclipboard]} {
$sha1entry selection range 0 $autosellen
}
+ if {$autocopy} {
+ clipboard clear
+ clipboard append [string range $id 0 [expr $autosellen - 1]]
+ }
rhighlight_sel $id
$ctext conf -state normal
@@ -8756,7 +8764,7 @@ proc sha1change {n1 n2 op} {
if {$state == "normal"} {
$sha1but conf -state normal -relief raised -text "[mc "Goto:"] "
} else {
- $sha1but conf -state disabled -relief flat -text "[mc "SHA1 ID:"] "
+ $sha1but conf -state disabled -relief flat -text "[mc "Commit ID:"] "
}
}
@@ -8775,7 +8783,7 @@ proc gotocommit {} {
set matches [longid $id]
if {$matches ne {}} {
if {[llength $matches] > 1} {
- error_popup [mc "Short SHA1 id %s is ambiguous" $id]
+ error_popup [mc "Short commit ID %s is ambiguous" $id]
return
}
set id [lindex $matches 0]
@@ -8792,7 +8800,7 @@ proc gotocommit {} {
return
}
if {[regexp {^[0-9a-fA-F]{4,}$} $sha1string]} {
- set msg [mc "SHA1 id %s is not known" $sha1string]
+ set msg [mc "Commit ID %s is not known" $sha1string]
} else {
set msg [mc "Revision %s is not in the current view" $sha1string]
}
@@ -11576,12 +11584,13 @@ proc create_prefs_page {w} {
proc prefspage_general {notebook} {
global NS maxwidth maxgraphpct showneartags showlocalchanges
- global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs
+ global tabstop wrapcomment wrapdefault limitdiffs
+ global autocopy autoselect autosellen extdifftool perfile_attrs
global hideremotes want_ttk have_ttk maxrefs web_browser
set page [create_prefs_page $notebook.general]
- ${NS}::label $page.ldisp -text [mc "Commit list display options"]
+ ${NS}::label $page.ldisp -text [mc "Commit list display options"] -font mainfontbold
grid $page.ldisp - -sticky w -pady 10
${NS}::label $page.spacer -text " "
${NS}::label $page.maxwidthl -text [mc "Maximum graph width (lines)"]
@@ -11594,19 +11603,38 @@ proc prefspage_general {notebook} {
${NS}::checkbutton $page.showlocal -text [mc "Show local changes"] \
-variable showlocalchanges
grid x $page.showlocal -sticky w
- ${NS}::checkbutton $page.autoselect -text [mc "Auto-select SHA1 (length)"] \
- -variable autoselect
- spinbox $page.autosellen -from 1 -to 40 -width 4 -textvariable autosellen
- grid x $page.autoselect $page.autosellen -sticky w
${NS}::checkbutton $page.hideremotes -text [mc "Hide remote refs"] \
-variable hideremotes
grid x $page.hideremotes -sticky w
- ${NS}::label $page.ddisp -text [mc "Diff display options"]
+ ${NS}::checkbutton $page.autocopy -text [mc "Copy commit ID to clipboard"] \
+ -variable autocopy
+ grid x $page.autocopy -sticky w
+ if {[haveselectionclipboard]} {
+ ${NS}::checkbutton $page.autoselect -text [mc "Copy commit ID to X11 selection"] \
+ -variable autoselect
+ grid x $page.autoselect -sticky w
+ }
+ spinbox $page.autosellen -from 1 -to 40 -width 4 -textvariable autosellen
+ ${NS}::label $page.autosellenl -text [mc "Length of commit ID to copy"]
+ grid x $page.autosellenl $page.autosellen -sticky w
+
+ ${NS}::label $page.ddisp -text [mc "Diff display options"] -font mainfontbold
grid $page.ddisp - -sticky w -pady 10
${NS}::label $page.tabstopl -text [mc "Tab spacing"]
spinbox $page.tabstop -from 1 -to 20 -width 4 -textvariable tabstop
grid x $page.tabstopl $page.tabstop -sticky w
+
+ ${NS}::label $page.wrapcommentl -text [mc "Wrap comment text"]
+ ${NS}::combobox $page.wrapcomment -values {none char word} -state readonly \
+ -textvariable wrapcomment
+ grid x $page.wrapcommentl $page.wrapcomment -sticky w
+
+ ${NS}::label $page.wrapdefaultl -text [mc "Wrap other text"]
+ ${NS}::combobox $page.wrapdefault -values {none char word} -state readonly \
+ -textvariable wrapdefault
+ grid x $page.wrapdefaultl $page.wrapdefault -sticky w
+
${NS}::checkbutton $page.ntag -text [mc "Display nearby tags/heads"] \
-variable showneartags
grid x $page.ntag -sticky w
@@ -11635,7 +11663,7 @@ proc prefspage_general {notebook} {
pack configure $page.webbrowserf.l -padx 10
grid x $page.webbrowserf $page.webbrowser -sticky ew
- ${NS}::label $page.lgen -text [mc "General options"]
+ ${NS}::label $page.lgen -text [mc "General options"] -font mainfontbold
grid $page.lgen - -sticky w -pady 10
${NS}::checkbutton $page.want_ttk -variable want_ttk \
-text [mc "Use themed widgets"]
@@ -11654,7 +11682,7 @@ proc prefspage_colors {notebook} {
set page [create_prefs_page $notebook.colors]
- ${NS}::label $page.cdisp -text [mc "Colors: press to choose"]
+ ${NS}::label $page.cdisp -text [mc "Colors: press to choose"] -font mainfontbold
grid $page.cdisp - -sticky w -pady 10
label $page.ui -padx 40 -relief sunk -background $uicolor
${NS}::button $page.uibut -text [mc "Interface"] \
@@ -11712,7 +11740,7 @@ proc prefspage_colors {notebook} {
proc prefspage_fonts {notebook} {
global NS
set page [create_prefs_page $notebook.fonts]
- ${NS}::label $page.cfont -text [mc "Fonts: press to choose"]
+ ${NS}::label $page.cfont -text [mc "Fonts: press to choose"] -font mainfontbold
grid $page.cfont - -sticky w -pady 10
mkfontdisp mainfont $page [mc "Main font"]
mkfontdisp textfont $page [mc "Diff display font"]
@@ -11725,7 +11753,7 @@ proc doprefs {} {
global oldprefs prefstop showneartags showlocalchanges
global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs
- global hideremotes want_ttk have_ttk
+ global hideremotes want_ttk have_ttk wrapcomment wrapdefault
set top .gitkprefs
set prefstop $top
@@ -11734,7 +11762,7 @@ proc doprefs {} {
return
}
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
- limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
+ limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault} {
set oldprefs($v) [set $v]
}
ttk_toplevel $top
@@ -11860,7 +11888,7 @@ proc prefscan {} {
global oldprefs prefstop
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
- limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
+ limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault} {
global $v
set $v $oldprefs($v)
}
@@ -11874,7 +11902,8 @@ proc prefsok {} {
global oldprefs prefstop showneartags showlocalchanges
global fontpref mainfont textfont uifont
global limitdiffs treediffs perfile_attrs
- global hideremotes
+ global hideremotes wrapcomment wrapdefault
+ global ctext
catch {destroy $prefstop}
unset prefstop
@@ -11923,6 +11952,12 @@ proc prefsok {} {
if {$hideremotes != $oldprefs(hideremotes)} {
rereadrefs
}
+ if {$wrapcomment != $oldprefs(wrapcomment)} {
+ $ctext tag conf comment -wrap $wrapcomment
+ }
+ if {$wrapdefault != $oldprefs(wrapdefault)} {
+ $ctext configure -wrap $wrapdefault
+ }
}
proc formatdate {d} {
@@ -12392,6 +12427,7 @@ set downarrowlen 5
set mingaplen 100
set cmitmode "patch"
set wrapcomment "none"
+set wrapdefault "none"
set showneartags 1
set hideremotes 0
set maxrefs 20
@@ -12400,6 +12436,7 @@ set maxlinelen 200
set showlocalchanges 1
set limitdiffs 1
set datetimeformat "%Y-%m-%d %H:%M:%S"
+set autocopy 0
set autoselect 1
set autosellen 40
set perfile_attrs 0
@@ -12497,7 +12534,8 @@ config_check_tmp_exists 50
set config_variables {
mainfont textfont uifont tabstop findmergefiles maxgraphpct maxwidth
- cmitmode wrapcomment autoselect autosellen showneartags maxrefs visiblerefs
+ cmitmode wrapcomment wrapdefault autocopy autoselect autosellen
+ showneartags maxrefs visiblerefs
hideremotes showlocalchanges datetimeformat limitdiffs uicolor want_ttk
bgcolor fgcolor uifgcolor uifgdisabledcolor colors diffcolors mergecolors
markbgcolor diffcontext selectbgcolor foundbgcolor currentsearchhitbgcolor
@@ -12687,7 +12725,7 @@ catch {
wm iconphoto . -default gitlogo gitlogo32
}
# wait for the window to become visible
-tkwait visibility .
+if {![winfo viewable .]} {tkwait visibility .}
set_window_title
update
readrefs
diff --git a/gitk-git/po/sv.po b/gitk-git/po/sv.po
index 2a06fe5bbc..5afbe6da1d 100644
--- a/gitk-git/po/sv.po
+++ b/gitk-git/po/sv.po
@@ -3,14 +3,14 @@
# This file is distributed under the same license as the gitk package.
#
# Mikael Magnusson <mikachu@gmail.com>, 2008.
-# Peter Krefting <peter@softwolves.pp.se>, 2008, 2009, 2010, 2012, 2013, 2015.
+# Peter Krefting <peter@softwolves.pp.se>, 2008-2023.
#
msgid ""
msgstr ""
"Project-Id-Version: sv\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-12-09 09:40+0100\n"
-"PO-Revision-Date: 2015-12-11 09:46+0100\n"
+"POT-Creation-Date: 2023-10-26 21:39+0100\n"
+"PO-Revision-Date: 2023-10-26 21:42+0100\n"
"Last-Translator: Peter Krefting <peter@softwolves.pp.se>\n"
"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
"Language: sv\n"
@@ -18,35 +18,35 @@ 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 2.91.6\n"
+"X-Generator: Gtranslator 3.38.0\n"
-#: gitk:140
+#: gitk:139
msgid "Couldn't get list of unmerged files:"
msgstr "Kunde inte hämta lista över ej sammanslagna filer:"
-#: gitk:212 gitk:2381
+#: gitk:211 gitk:2406
msgid "Color words"
msgstr "Färga ord"
-#: gitk:217 gitk:2381 gitk:8221 gitk:8254
+#: gitk:216 gitk:2406 gitk:8307 gitk:8340
msgid "Markup words"
msgstr "Märk upp ord"
-#: gitk:324
+#: gitk:323
msgid "Error parsing revisions:"
msgstr "Fel vid tolkning av revisioner:"
-#: gitk:380
+#: gitk:379
msgid "Error executing --argscmd command:"
msgstr "Fel vid körning av --argscmd-kommando:"
-#: gitk:393
+#: gitk:392
msgid "No files selected: --merge specified but no files are unmerged."
msgstr ""
"Inga filer valdes: --merge angavs men det finns inga filer som inte har "
"slagits samman."
-#: gitk:396
+#: gitk:395
msgid ""
"No files selected: --merge specified but no unmerged files are within file "
"limit."
@@ -54,322 +54,326 @@ msgstr ""
"Inga filer valdes: --merge angavs men det finns inga filer inom "
"filbegränsningen."
-#: gitk:418 gitk:566
+#: gitk:417 gitk:565
msgid "Error executing git log:"
msgstr "Fel vid körning av git log:"
-#: gitk:436 gitk:582
+#: gitk:435 gitk:581
msgid "Reading"
msgstr "Läser"
-#: gitk:496 gitk:4526
+#: gitk:495 gitk:4572
msgid "Reading commits..."
msgstr "Läser incheckningar..."
-#: gitk:499 gitk:1637 gitk:4529
+#: gitk:498 gitk:1640 gitk:4575
msgid "No commits selected"
msgstr "Inga incheckningar markerade"
-#: gitk:1445 gitk:4046 gitk:12447
+#: gitk:1448 gitk:4092 gitk:12674
msgid "Command line"
msgstr "Kommandorad"
-#: gitk:1511
+#: gitk:1514
msgid "Can't parse git log output:"
msgstr "Kan inte tolka utdata från git log:"
-#: gitk:1740
+#: gitk:1743
msgid "No commit information available"
msgstr "Ingen incheckningsinformation är tillgänglig"
-#: gitk:1903 gitk:1932 gitk:4316 gitk:9684 gitk:11256 gitk:11536
+#: gitk:1910 gitk:1939 gitk:4362 gitk:9847 gitk:11451 gitk:11751
msgid "OK"
msgstr "OK"
-#: gitk:1934 gitk:4318 gitk:9197 gitk:9276 gitk:9406 gitk:9455 gitk:9686
-#: gitk:11257 gitk:11537
+#: gitk:1941 gitk:4364 gitk:9283 gitk:9362 gitk:9492 gitk:9578 gitk:9849
+#: gitk:11452 gitk:11752
msgid "Cancel"
msgstr "Avbryt"
-#: gitk:2069
+#: gitk:2090
msgid "&Update"
msgstr "&Uppdatera"
-#: gitk:2070
+#: gitk:2091
msgid "&Reload"
msgstr "Läs &om"
-#: gitk:2071
+#: gitk:2092
msgid "Reread re&ferences"
msgstr "Läs om &referenser"
-#: gitk:2072
+#: gitk:2093
msgid "&List references"
msgstr "&Visa referenser"
-#: gitk:2074
+#: gitk:2095
msgid "Start git &gui"
msgstr "Starta git &gui"
-#: gitk:2076
+#: gitk:2097
msgid "&Quit"
msgstr "&Avsluta"
-#: gitk:2068
+#: gitk:2089
msgid "&File"
msgstr "&Arkiv"
-#: gitk:2080
+#: gitk:2101
msgid "&Preferences"
msgstr "&Inställningar"
-#: gitk:2079
+#: gitk:2100
msgid "&Edit"
msgstr "&Redigera"
-#: gitk:2084
+#: gitk:2105
msgid "&New view..."
msgstr "&Ny vy..."
-#: gitk:2085
+#: gitk:2106
msgid "&Edit view..."
msgstr "&Ändra vy..."
-#: gitk:2086
+#: gitk:2107
msgid "&Delete view"
msgstr "&Ta bort vy"
-#: gitk:2088
+#: gitk:2109
msgid "&All files"
msgstr "&Alla filer"
-#: gitk:2083
+#: gitk:2104
msgid "&View"
msgstr "&Visa"
-#: gitk:2093 gitk:2103
+#: gitk:2114 gitk:2124
msgid "&About gitk"
msgstr "&Om gitk"
-#: gitk:2094 gitk:2108
+#: gitk:2115 gitk:2129
msgid "&Key bindings"
msgstr "&Tangentbordsbindningar"
-#: gitk:2092 gitk:2107
+#: gitk:2113 gitk:2128
msgid "&Help"
msgstr "&Hjälp"
-#: gitk:2185 gitk:8653
+#: gitk:2206 gitk:8739
msgid "SHA1 ID:"
msgstr "SHA1-id:"
-#: gitk:2229
+#: gitk:2250
msgid "Row"
msgstr "Rad"
-#: gitk:2267
+#: gitk:2288
msgid "Find"
msgstr "Sök"
-#: gitk:2295
+#: gitk:2316
msgid "commit"
msgstr "incheckning"
-#: gitk:2299 gitk:2301 gitk:4688 gitk:4711 gitk:4735 gitk:6756 gitk:6828
-#: gitk:6913
+#: gitk:2320 gitk:2322 gitk:4734 gitk:4757 gitk:4781 gitk:6802 gitk:6874
+#: gitk:6959
msgid "containing:"
msgstr "som innehåller:"
-#: gitk:2302 gitk:3527 gitk:3532 gitk:4764
+#: gitk:2323 gitk:3573 gitk:3578 gitk:4810
msgid "touching paths:"
msgstr "som rör sökväg:"
-#: gitk:2303 gitk:4778
+#: gitk:2324 gitk:4824
msgid "adding/removing string:"
msgstr "som lägger/till tar bort sträng:"
-#: gitk:2304 gitk:4780
+#: gitk:2325 gitk:4826
msgid "changing lines matching:"
msgstr "ändrar rader som matchar:"
-#: gitk:2313 gitk:2315 gitk:4767
+#: gitk:2334 gitk:2336 gitk:4813
msgid "Exact"
msgstr "Exakt"
-#: gitk:2315 gitk:4855 gitk:6724
+#: gitk:2336 gitk:4901 gitk:6770
msgid "IgnCase"
msgstr "IgnVersaler"
-#: gitk:2315 gitk:4737 gitk:4853 gitk:6720
+#: gitk:2336 gitk:4783 gitk:4899 gitk:6766
msgid "Regexp"
msgstr "Reg.uttr."
-#: gitk:2317 gitk:2318 gitk:4875 gitk:4905 gitk:4912 gitk:6849 gitk:6917
+#: gitk:2338 gitk:2339 gitk:4921 gitk:4951 gitk:4958 gitk:6895 gitk:6963
msgid "All fields"
msgstr "Alla fält"
-#: gitk:2318 gitk:4872 gitk:4905 gitk:6787
+#: gitk:2339 gitk:4918 gitk:4951 gitk:6833
msgid "Headline"
msgstr "Rubrik"
-#: gitk:2319 gitk:4872 gitk:6787 gitk:6917 gitk:7390
+#: gitk:2340 gitk:4918 gitk:6833 gitk:6963 gitk:7471
msgid "Comments"
msgstr "Kommentarer"
-#: gitk:2319 gitk:4872 gitk:4877 gitk:4912 gitk:6787 gitk:7325 gitk:8831
-#: gitk:8846
+#: gitk:2340 gitk:4918 gitk:4923 gitk:4958 gitk:6833 gitk:7406 gitk:8917
+#: gitk:8932
msgid "Author"
msgstr "Författare"
-#: gitk:2319 gitk:4872 gitk:6787 gitk:7327
+#: gitk:2340 gitk:4918 gitk:6833 gitk:7408
msgid "Committer"
msgstr "Incheckare"
-#: gitk:2350
+#: gitk:2374
msgid "Search"
msgstr "Sök"
-#: gitk:2358
+#: gitk:2382
msgid "Diff"
msgstr "Diff"
-#: gitk:2360
+#: gitk:2384
msgid "Old version"
msgstr "Gammal version"
-#: gitk:2362
+#: gitk:2386
msgid "New version"
msgstr "Ny version"
-#: gitk:2364
+#: gitk:2389
msgid "Lines of context"
msgstr "Rader sammanhang"
-#: gitk:2374
+#: gitk:2399
msgid "Ignore space change"
msgstr "Ignorera ändringar i blanksteg"
-#: gitk:2378 gitk:2380 gitk:7960 gitk:8207
+#: gitk:2403 gitk:2405 gitk:8041 gitk:8293
msgid "Line diff"
msgstr "Rad-diff"
-#: gitk:2445
+#: gitk:2478
msgid "Patch"
msgstr "Patch"
-#: gitk:2447
+#: gitk:2480
msgid "Tree"
msgstr "Träd"
-#: gitk:2617 gitk:2638
+#: gitk:2650 gitk:2671
msgid "Diff this -> selected"
msgstr "Diff denna -> markerad"
-#: gitk:2618 gitk:2639
+#: gitk:2651 gitk:2672
msgid "Diff selected -> this"
msgstr "Diff markerad -> denna"
-#: gitk:2619 gitk:2640
+#: gitk:2652 gitk:2673
msgid "Make patch"
msgstr "Skapa patch"
-#: gitk:2620 gitk:9255
+#: gitk:2653 gitk:9341
msgid "Create tag"
msgstr "Skapa tagg"
-#: gitk:2621
-msgid "Copy commit summary"
-msgstr "Kopiera incheckningssammanfattning"
+#: gitk:2654
+msgid "Copy commit reference"
+msgstr "Kopiera incheckningsreferens"
-#: gitk:2622 gitk:9386
+#: gitk:2655 gitk:9472
msgid "Write commit to file"
msgstr "Skriv incheckning till fil"
-#: gitk:2623 gitk:9443
+#: gitk:2656
msgid "Create new branch"
msgstr "Skapa ny gren"
-#: gitk:2624
+#: gitk:2657
msgid "Cherry-pick this commit"
msgstr "Plocka denna incheckning"
-#: gitk:2625
+#: gitk:2658
msgid "Reset HEAD branch to here"
msgstr "Återställ HEAD-grenen hit"
-#: gitk:2626
+#: gitk:2659
msgid "Mark this commit"
msgstr "Markera denna incheckning"
-#: gitk:2627
+#: gitk:2660
msgid "Return to mark"
msgstr "Återgå till markering"
-#: gitk:2628
+#: gitk:2661
msgid "Find descendant of this and mark"
msgstr "Hitta efterföljare till denna och markera"
-#: gitk:2629
+#: gitk:2662
msgid "Compare with marked commit"
msgstr "Jämför med markerad incheckning"
-#: gitk:2630 gitk:2641
+#: gitk:2663 gitk:2674
msgid "Diff this -> marked commit"
msgstr "Diff denna -> markerad incheckning"
-#: gitk:2631 gitk:2642
+#: gitk:2664 gitk:2675
msgid "Diff marked commit -> this"
msgstr "Diff markerad incheckning -> denna"
-#: gitk:2632
+#: gitk:2665
msgid "Revert this commit"
msgstr "Ångra denna incheckning"
-#: gitk:2648
+#: gitk:2681
msgid "Check out this branch"
msgstr "Checka ut denna gren"
-#: gitk:2649
+#: gitk:2682
+msgid "Rename this branch"
+msgstr "Byt namn på denna gren"
+
+#: gitk:2683
msgid "Remove this branch"
msgstr "Ta bort denna gren"
-#: gitk:2650
+#: gitk:2684
msgid "Copy branch name"
msgstr "Kopiera namn på gren"
-#: gitk:2657
+#: gitk:2691
msgid "Highlight this too"
msgstr "Markera även detta"
-#: gitk:2658
+#: gitk:2692
msgid "Highlight this only"
msgstr "Markera bara detta"
-#: gitk:2659
+#: gitk:2693
msgid "External diff"
msgstr "Extern diff"
-#: gitk:2660
+#: gitk:2694
msgid "Blame parent commit"
msgstr "Klandra föräldraincheckning"
-#: gitk:2661
+#: gitk:2695
msgid "Copy path"
msgstr "Kopiera sökväg"
-#: gitk:2668
+#: gitk:2702
msgid "Show origin of this line"
msgstr "Visa ursprunget för den här raden"
-#: gitk:2669
+#: gitk:2703
msgid "Run git gui blame on this line"
msgstr "Kör git gui blame på den här raden"
-#: gitk:3013
+#: gitk:3057
msgid "About gitk"
msgstr "Om gitk"
-#: gitk:3015
+#: gitk:3059
msgid ""
"\n"
"Gitk - a commit viewer for git\n"
@@ -385,525 +389,529 @@ msgstr ""
"\n"
"Använd och vidareförmedla enligt villkoren i GNU General Public License"
-#: gitk:3023 gitk:3090 gitk:9872
+#: gitk:3067 gitk:3134 gitk:10062
msgid "Close"
msgstr "Stäng"
-#: gitk:3044
+#: gitk:3088
msgid "Gitk key bindings"
msgstr "Tangentbordsbindningar för Gitk"
-#: gitk:3047
+#: gitk:3091
msgid "Gitk key bindings:"
msgstr "Tangentbordsbindningar för Gitk:"
-#: gitk:3049
+#: gitk:3093
#, tcl-format
msgid "<%s-Q>\t\tQuit"
msgstr "<%s-Q>\t\tAvsluta"
-#: gitk:3050
+#: gitk:3094
#, tcl-format
msgid "<%s-W>\t\tClose window"
msgstr "<%s-W>\t\tStäng fönster"
-#: gitk:3051
+#: gitk:3095
msgid "<Home>\t\tMove to first commit"
msgstr "<Home>\t\tGå till första incheckning"
-#: gitk:3052
+#: gitk:3096
msgid "<End>\t\tMove to last commit"
msgstr "<End>\t\tGå till sista incheckning"
-#: gitk:3053
+#: gitk:3097
msgid "<Up>, p, k\tMove up one commit"
msgstr "<Upp>, p, k\tGå en incheckning upp"
-#: gitk:3054
+#: gitk:3098
msgid "<Down>, n, j\tMove down one commit"
msgstr "<Ned>, n, j\tGå en incheckning ned"
-#: gitk:3055
+#: gitk:3099
msgid "<Left>, z, h\tGo back in history list"
msgstr "<Vänster>, z, h\tGå bakåt i historiken"
-#: gitk:3056
+#: gitk:3100
msgid "<Right>, x, l\tGo forward in history list"
msgstr "<Höger>, x, l\tGå framåt i historiken"
-#: gitk:3057
+#: gitk:3101
#, tcl-format
msgid "<%s-n>\tGo to n-th parent of current commit in history list"
msgstr "<%s-n>\tGå till aktuell inchecknings n:te förälder i historielistan"
-#: gitk:3058
+#: gitk:3102
msgid "<PageUp>\tMove up one page in commit list"
msgstr "<PageUp>\tGå upp en sida i incheckningslistan"
-#: gitk:3059
+#: gitk:3103
msgid "<PageDown>\tMove down one page in commit list"
msgstr "<PageDown>\tGå ned en sida i incheckningslistan"
-#: gitk:3060
+#: gitk:3104
#, tcl-format
msgid "<%s-Home>\tScroll to top of commit list"
msgstr "<%s-Home>\tRulla till början av incheckningslistan"
-#: gitk:3061
+#: gitk:3105
#, tcl-format
msgid "<%s-End>\tScroll to bottom of commit list"
msgstr "<%s-End>\tRulla till slutet av incheckningslistan"
-#: gitk:3062
+#: gitk:3106
#, tcl-format
msgid "<%s-Up>\tScroll commit list up one line"
msgstr "<%s-Upp>\tRulla incheckningslistan upp ett steg"
-#: gitk:3063
+#: gitk:3107
#, tcl-format
msgid "<%s-Down>\tScroll commit list down one line"
msgstr "<%s-Ned>\tRulla incheckningslistan ned ett steg"
-#: gitk:3064
+#: gitk:3108
#, tcl-format
msgid "<%s-PageUp>\tScroll commit list up one page"
msgstr "<%s-PageUp>\tRulla incheckningslistan upp en sida"
-#: gitk:3065
+#: gitk:3109
#, tcl-format
msgid "<%s-PageDown>\tScroll commit list down one page"
msgstr "<%s-PageDown>\tRulla incheckningslistan ned en sida"
-#: gitk:3066
+#: gitk:3110
msgid "<Shift-Up>\tFind backwards (upwards, later commits)"
msgstr "<Skift-Upp>\tSök bakåt (uppåt, senare incheckningar)"
-#: gitk:3067
+#: gitk:3111
msgid "<Shift-Down>\tFind forwards (downwards, earlier commits)"
msgstr "<Skift-Ned>\tSök framåt (nedåt, tidigare incheckningar)"
-#: gitk:3068
+#: gitk:3112
msgid "<Delete>, b\tScroll diff view up one page"
msgstr "<Delete>, b\tRulla diffvisningen upp en sida"
-#: gitk:3069
+#: gitk:3113
msgid "<Backspace>\tScroll diff view up one page"
msgstr "<Baksteg>\tRulla diffvisningen upp en sida"
-#: gitk:3070
+#: gitk:3114
msgid "<Space>\t\tScroll diff view down one page"
msgstr "<Blanksteg>\tRulla diffvisningen ned en sida"
-#: gitk:3071
+#: gitk:3115
msgid "u\t\tScroll diff view up 18 lines"
msgstr "u\t\tRulla diffvisningen upp 18 rader"
-#: gitk:3072
+#: gitk:3116
msgid "d\t\tScroll diff view down 18 lines"
msgstr "d\t\tRulla diffvisningen ned 18 rader"
-#: gitk:3073
+#: gitk:3117
#, tcl-format
msgid "<%s-F>\t\tFind"
msgstr "<%s-F>\t\tSök"
-#: gitk:3074
+#: gitk:3118
#, tcl-format
msgid "<%s-G>\t\tMove to next find hit"
msgstr "<%s-G>\t\tGå till nästa sökträff"
-#: gitk:3075
+#: gitk:3119
msgid "<Return>\tMove to next find hit"
msgstr "<Return>\t\tGå till nästa sökträff"
-#: gitk:3076
+#: gitk:3120
msgid "g\t\tGo to commit"
msgstr "g\t\tGå till incheckning"
-#: gitk:3077
+#: gitk:3121
msgid "/\t\tFocus the search box"
msgstr "/\t\tFokusera sökrutan"
-#: gitk:3078
+#: gitk:3122
msgid "?\t\tMove to previous find hit"
msgstr "?\t\tGå till föregående sökträff"
-#: gitk:3079
+#: gitk:3123
msgid "f\t\tScroll diff view to next file"
msgstr "f\t\tRulla diffvisningen till nästa fil"
-#: gitk:3080
+#: gitk:3124
#, tcl-format
msgid "<%s-S>\t\tSearch for next hit in diff view"
msgstr "<%s-S>\t\tGå till nästa sökträff i diffvisningen"
-#: gitk:3081
+#: gitk:3125
#, tcl-format
msgid "<%s-R>\t\tSearch for previous hit in diff view"
msgstr "<%s-R>\t\tGå till föregående sökträff i diffvisningen"
-#: gitk:3082
+#: gitk:3126
#, tcl-format
msgid "<%s-KP+>\tIncrease font size"
msgstr "<%s-Num+>\tÖka teckenstorlek"
-#: gitk:3083
+#: gitk:3127
#, tcl-format
msgid "<%s-plus>\tIncrease font size"
msgstr "<%s-plus>\tÖka teckenstorlek"
-#: gitk:3084
+#: gitk:3128
#, tcl-format
msgid "<%s-KP->\tDecrease font size"
msgstr "<%s-Num->\tMinska teckenstorlek"
-#: gitk:3085
+#: gitk:3129
#, tcl-format
msgid "<%s-minus>\tDecrease font size"
msgstr "<%s-minus>\tMinska teckenstorlek"
-#: gitk:3086
+#: gitk:3130
msgid "<F5>\t\tUpdate"
msgstr "<F5>\t\tUppdatera"
-#: gitk:3551 gitk:3560
+#: gitk:3597 gitk:3606
#, tcl-format
msgid "Error creating temporary directory %s:"
msgstr "Fel vid skapande av temporär katalog %s:"
-#: gitk:3573
+#: gitk:3619
#, tcl-format
msgid "Error getting \"%s\" from %s:"
-msgstr "Fel vid hämtning av \"%s\" från %s:"
+msgstr "Fel vid hämtning av ”%s” från %s:"
-#: gitk:3636
+#: gitk:3682
msgid "command failed:"
msgstr "kommando misslyckades:"
-#: gitk:3785
+#: gitk:3831
msgid "No such commit"
msgstr "Incheckning saknas"
-#: gitk:3799
+#: gitk:3845
msgid "git gui blame: command failed:"
msgstr "git gui blame: kommando misslyckades:"
-#: gitk:3830
+#: gitk:3876
#, tcl-format
msgid "Couldn't read merge head: %s"
msgstr "Kunde inte läsa sammanslagningshuvud: %s"
-#: gitk:3838
+#: gitk:3884
#, tcl-format
msgid "Error reading index: %s"
msgstr "Fel vid läsning av index: %s"
-#: gitk:3863
+#: gitk:3909
#, tcl-format
msgid "Couldn't start git blame: %s"
msgstr "Kunde inte starta git blame: %s"
-#: gitk:3866 gitk:6755
+#: gitk:3912 gitk:6801
msgid "Searching"
msgstr "Söker"
-#: gitk:3898
+#: gitk:3944
#, tcl-format
msgid "Error running git blame: %s"
msgstr "Fel vid körning av git blame: %s"
-#: gitk:3926
+#: gitk:3972
#, tcl-format
msgid "That line comes from commit %s, which is not in this view"
msgstr "Raden kommer från incheckningen %s, som inte finns i denna vy"
-#: gitk:3940
+#: gitk:3986
msgid "External diff viewer failed:"
msgstr "Externt diff-verktyg misslyckades:"
-#: gitk:4044
+#: gitk:4090
msgid "All files"
msgstr "Alla filer"
-#: gitk:4068
+#: gitk:4114
msgid "View"
msgstr "Visa"
-#: gitk:4071
+#: gitk:4117
msgid "Gitk view definition"
msgstr "Definition av Gitk-vy"
-#: gitk:4075
+#: gitk:4121
msgid "Remember this view"
msgstr "Spara denna vy"
-#: gitk:4076
+#: gitk:4122
msgid "References (space separated list):"
msgstr "Referenser (blankstegsavdelad lista):"
-#: gitk:4077
+#: gitk:4123
msgid "Branches & tags:"
msgstr "Grenar & taggar:"
-#: gitk:4078
+#: gitk:4124
msgid "All refs"
msgstr "Alla referenser"
-#: gitk:4079
+#: gitk:4125
msgid "All (local) branches"
msgstr "Alla (lokala) grenar"
-#: gitk:4080
+#: gitk:4126
msgid "All tags"
msgstr "Alla taggar"
-#: gitk:4081
+#: gitk:4127
msgid "All remote-tracking branches"
msgstr "Alla fjärrspårande grenar"
-#: gitk:4082
+#: gitk:4128
msgid "Commit Info (regular expressions):"
msgstr "Incheckningsinfo (reguljära uttryck):"
-#: gitk:4083
+#: gitk:4129
msgid "Author:"
msgstr "Författare:"
-#: gitk:4084
+#: gitk:4130
msgid "Committer:"
msgstr "Incheckare:"
-#: gitk:4085
+#: gitk:4131
msgid "Commit Message:"
msgstr "Incheckningsmeddelande:"
-#: gitk:4086
+#: gitk:4132
msgid "Matches all Commit Info criteria"
msgstr "Motsvarar alla kriterier för incheckningsinfo"
-#: gitk:4087
+#: gitk:4133
msgid "Matches no Commit Info criteria"
msgstr "Motsvarar inga kriterier för incheckningsinfo"
-#: gitk:4088
+#: gitk:4134
msgid "Changes to Files:"
msgstr "Ändringar av filer:"
-#: gitk:4089
+#: gitk:4135
msgid "Fixed String"
msgstr "Fast sträng"
-#: gitk:4090
+#: gitk:4136
msgid "Regular Expression"
msgstr "Reguljärt uttryck"
-#: gitk:4091
+#: gitk:4137
msgid "Search string:"
msgstr "Söksträng:"
-#: gitk:4092
+#: gitk:4138
msgid ""
"Commit Dates (\"2 weeks ago\", \"2009-03-17 15:27:38\", \"March 17, 2009 "
"15:27:38\"):"
msgstr ""
-"Incheckingsdatum (\"2 weeks ago\", \"2009-03-17 15:27:38\", \"March 17, 2009 "
-"15:27:38\"):"
+"Incheckningsdatum (”2 weeks ago”, ”2009-03-17 15:27:38”, ”March 17, 2009 "
+"15:27:38”):"
-#: gitk:4093
+#: gitk:4139
msgid "Since:"
msgstr "Från:"
-#: gitk:4094
+#: gitk:4140
msgid "Until:"
msgstr "Till:"
-#: gitk:4095
+#: gitk:4141
msgid "Limit and/or skip a number of revisions (positive integer):"
msgstr "Begränsa och/eller hoppa över ett antal revisioner (positivt heltal):"
-#: gitk:4096
+#: gitk:4142
msgid "Number to show:"
msgstr "Antal att visa:"
-#: gitk:4097
+#: gitk:4143
msgid "Number to skip:"
msgstr "Antal att hoppa över:"
-#: gitk:4098
+#: gitk:4144
msgid "Miscellaneous options:"
msgstr "Diverse alternativ:"
-#: gitk:4099
+#: gitk:4145
msgid "Strictly sort by date"
msgstr "Strikt datumsortering"
-#: gitk:4100
+#: gitk:4146
msgid "Mark branch sides"
msgstr "Markera sidogrenar"
-#: gitk:4101
+#: gitk:4147
msgid "Limit to first parent"
msgstr "Begränsa till första förälder"
-#: gitk:4102
+#: gitk:4148
msgid "Simple history"
msgstr "Enkel historik"
-#: gitk:4103
+#: gitk:4149
msgid "Additional arguments to git log:"
msgstr "Ytterligare argument till git log:"
-#: gitk:4104
+#: gitk:4150
msgid "Enter files and directories to include, one per line:"
msgstr "Ange filer och kataloger att ta med, en per rad:"
-#: gitk:4105
+#: gitk:4151
msgid "Command to generate more commits to include:"
msgstr "Kommando för att generera fler incheckningar att ta med:"
-#: gitk:4229
+#: gitk:4275
msgid "Gitk: edit view"
msgstr "Gitk: redigera vy"
-#: gitk:4237
+#: gitk:4283
msgid "-- criteria for selecting revisions"
msgstr " - kriterier för val av revisioner"
-#: gitk:4242
+#: gitk:4288
msgid "View Name"
msgstr "Namn på vy"
-#: gitk:4317
+#: gitk:4363
msgid "Apply (F5)"
msgstr "Använd (F5)"
-#: gitk:4355
+#: gitk:4401
msgid "Error in commit selection arguments:"
msgstr "Fel i argument för val av incheckningar:"
-#: gitk:4410 gitk:4463 gitk:4925 gitk:4939 gitk:6209 gitk:12388 gitk:12389
+#: gitk:4456 gitk:4509 gitk:4971 gitk:4985 gitk:6255 gitk:12615 gitk:12616
msgid "None"
msgstr "Inget"
-#: gitk:5022 gitk:5027
+#: gitk:5068 gitk:5073
msgid "Descendant"
msgstr "Avkomling"
-#: gitk:5023
+#: gitk:5069
msgid "Not descendant"
msgstr "Inte avkomling"
-#: gitk:5030 gitk:5035
+#: gitk:5076 gitk:5081
msgid "Ancestor"
msgstr "Förfader"
-#: gitk:5031
+#: gitk:5077
msgid "Not ancestor"
msgstr "Inte förfader"
-#: gitk:5325
+#: gitk:5371
msgid "Local changes checked in to index but not committed"
msgstr "Lokala ändringar sparade i indexet men inte incheckade"
-#: gitk:5361
+#: gitk:5407
msgid "Local uncommitted changes, not checked in to index"
msgstr "Lokala ändringar, ej sparade i indexet"
-#: gitk:7135
+#: gitk:7155
+msgid "Error starting web browser:"
+msgstr "Fel när webbläsaren skulle startas:"
+
+#: gitk:7216
msgid "and many more"
msgstr "med många flera"
-#: gitk:7138
+#: gitk:7219
msgid "many"
msgstr "många"
-#: gitk:7329
+#: gitk:7410
msgid "Tags:"
msgstr "Taggar:"
-#: gitk:7346 gitk:7352 gitk:8826
+#: gitk:7427 gitk:7433 gitk:8912
msgid "Parent"
msgstr "Förälder"
-#: gitk:7357
+#: gitk:7438
msgid "Child"
msgstr "Barn"
-#: gitk:7366
+#: gitk:7447
msgid "Branch"
msgstr "Gren"
-#: gitk:7369
+#: gitk:7450
msgid "Follows"
msgstr "Följer"
-#: gitk:7372
+#: gitk:7453
msgid "Precedes"
msgstr "Föregår"
-#: gitk:7967
+#: gitk:8048
#, tcl-format
msgid "Error getting diffs: %s"
msgstr "Fel vid hämtning av diff: %s"
-#: gitk:8651
+#: gitk:8737
msgid "Goto:"
msgstr "Gå till:"
-#: gitk:8672
+#: gitk:8758
#, tcl-format
msgid "Short SHA1 id %s is ambiguous"
msgstr "Förkortat SHA1-id %s är tvetydigt"
-#: gitk:8679
+#: gitk:8765
#, tcl-format
msgid "Revision %s is not known"
msgstr "Revisionen %s är inte känd"
-#: gitk:8689
+#: gitk:8775
#, tcl-format
msgid "SHA1 id %s is not known"
msgstr "SHA-id:t %s är inte känt"
-#: gitk:8691
+#: gitk:8777
#, tcl-format
msgid "Revision %s is not in the current view"
msgstr "Revisionen %s finns inte i den nuvarande vyn"
-#: gitk:8833 gitk:8848
+#: gitk:8919 gitk:8934
msgid "Date"
msgstr "Datum"
-#: gitk:8836
+#: gitk:8922
msgid "Children"
msgstr "Barn"
-#: gitk:8899
+#: gitk:8985
#, tcl-format
msgid "Reset %s branch to here"
msgstr "Återställ grenen %s hit"
-#: gitk:8901
+#: gitk:8987
msgid "Detached head: can't reset"
msgstr "Frånkopplad head: kan inte återställa"
-#: gitk:9006 gitk:9012
+#: gitk:9092 gitk:9098
msgid "Skipping merge commit "
msgstr "Hoppar över sammanslagningsincheckning "
-#: gitk:9021 gitk:9026
+#: gitk:9107 gitk:9112
msgid "Error getting patch ID for "
msgstr "Fel vid hämtning av patch-id för "
-#: gitk:9022 gitk:9027
+#: gitk:9108 gitk:9113
msgid " - stopping\n"
msgstr " - stannar\n"
-#: gitk:9032 gitk:9035 gitk:9043 gitk:9057 gitk:9066
+#: gitk:9118 gitk:9121 gitk:9129 gitk:9143 gitk:9152
msgid "Commit "
msgstr "Incheckning "
-#: gitk:9036
+#: gitk:9122
msgid ""
" is the same patch as\n"
" "
@@ -911,7 +919,7 @@ msgstr ""
" är samma patch som\n"
" "
-#: gitk:9044
+#: gitk:9130
msgid ""
" differs from\n"
" "
@@ -919,7 +927,7 @@ msgstr ""
" skiljer sig från\n"
" "
-#: gitk:9046
+#: gitk:9132
msgid ""
"Diff of commits:\n"
"\n"
@@ -927,141 +935,158 @@ msgstr ""
"Skillnad mellan incheckningar:\n"
"\n"
-#: gitk:9058 gitk:9067
+#: gitk:9144 gitk:9153
#, tcl-format
msgid " has %s children - stopping\n"
msgstr " har %s barn - stannar\n"
-#: gitk:9086
+#: gitk:9172
#, tcl-format
msgid "Error writing commit to file: %s"
msgstr "Fel vid skrivning av incheckning till fil: %s"
-#: gitk:9092
+#: gitk:9178
#, tcl-format
msgid "Error diffing commits: %s"
msgstr "Fel vid jämförelse av incheckningar: %s"
-#: gitk:9138
+#: gitk:9224
msgid "Top"
msgstr "Topp"
-#: gitk:9139
+#: gitk:9225
msgid "From"
msgstr "Från"
-#: gitk:9144
+#: gitk:9230
msgid "To"
msgstr "Till"
-#: gitk:9168
+#: gitk:9254
msgid "Generate patch"
msgstr "Generera patch"
-#: gitk:9170
+#: gitk:9256
msgid "From:"
msgstr "Från:"
-#: gitk:9179
+#: gitk:9265
msgid "To:"
msgstr "Till:"
-#: gitk:9188
+#: gitk:9274
msgid "Reverse"
msgstr "Vänd"
-#: gitk:9190 gitk:9400
+#: gitk:9276 gitk:9486
msgid "Output file:"
msgstr "Utdatafil:"
-#: gitk:9196
+#: gitk:9282
msgid "Generate"
msgstr "Generera"
-#: gitk:9234
+#: gitk:9320
msgid "Error creating patch:"
msgstr "Fel vid generering av patch:"
-#: gitk:9257 gitk:9388 gitk:9445
+#: gitk:9343 gitk:9474 gitk:9562
msgid "ID:"
msgstr "Id:"
-#: gitk:9266
+#: gitk:9352
msgid "Tag name:"
msgstr "Taggnamn:"
-#: gitk:9269
+#: gitk:9355
msgid "Tag message is optional"
msgstr "Taggmeddelandet är valfritt"
-#: gitk:9271
+#: gitk:9357
msgid "Tag message:"
msgstr "Taggmeddelande:"
-#: gitk:9275 gitk:9454
+#: gitk:9361 gitk:9532
msgid "Create"
msgstr "Skapa"
-#: gitk:9293
+#: gitk:9379
msgid "No tag name specified"
msgstr "Inget taggnamn angavs"
-#: gitk:9297
+#: gitk:9383
#, tcl-format
msgid "Tag \"%s\" already exists"
-msgstr "Taggen \"%s\" finns redan"
+msgstr "Taggen ”%s” finns redan"
-#: gitk:9307
+#: gitk:9393
msgid "Error creating tag:"
msgstr "Fel vid skapande av tagg:"
-#: gitk:9397
+#: gitk:9483
msgid "Command:"
msgstr "Kommando:"
-#: gitk:9405
+#: gitk:9491
msgid "Write"
msgstr "Skriv"
-#: gitk:9423
+#: gitk:9509
msgid "Error writing commit:"
msgstr "Fel vid skrivning av incheckning:"
-#: gitk:9450
+#: gitk:9531
+msgid "Create branch"
+msgstr "Skapa gren"
+
+#: gitk:9547
+#, tcl-format
+msgid "Rename branch %s"
+msgstr "Byt namn på grenen %s"
+
+#: gitk:9548
+msgid "Rename"
+msgstr "Byt namn"
+
+#: gitk:9572
msgid "Name:"
msgstr "Namn:"
-#: gitk:9473
+#: gitk:9596
msgid "Please specify a name for the new branch"
msgstr "Ange ett namn för den nya grenen"
-#: gitk:9478
+#: gitk:9601
#, tcl-format
msgid "Branch '%s' already exists. Overwrite?"
-msgstr "Grenen \"%s\" finns redan. Skriva över?"
+msgstr "Grenen ”%s” finns redan. Skriva över?"
+
+#: gitk:9645
+msgid "Please specify a new name for the branch"
+msgstr "Ange ett nytt namn för grenen"
-#: gitk:9545
+#: gitk:9708
#, tcl-format
msgid "Commit %s is already included in branch %s -- really re-apply it?"
msgstr ""
"Incheckningen %s finns redan på grenen %s -- skall den verkligen appliceras "
"på nytt?"
-#: gitk:9550
+#: gitk:9713
msgid "Cherry-picking"
msgstr "Plockar"
-#: gitk:9559
+#: gitk:9722
#, tcl-format
msgid ""
"Cherry-pick failed because of local changes to file '%s'.\n"
"Please commit, reset or stash your changes and try again."
msgstr ""
-"Cherry-pick misslyckades på grund av lokala ändringar i filen \"%s\".\n"
+"Cherry-pick misslyckades på grund av lokala ändringar i filen ”%s”.\n"
"Checka in, återställ eller spara undan (stash) dina ändringar och försök "
"igen."
-#: gitk:9565
+#: gitk:9728
msgid ""
"Cherry-pick failed because of merge conflict.\n"
"Do you wish to run git citool to resolve it?"
@@ -1069,20 +1094,20 @@ msgstr ""
"Cherry-pick misslyckades på grund av en sammanslagningskonflikt.\n"
"Vill du köra git citool för att lösa den?"
-#: gitk:9581 gitk:9639
+#: gitk:9744 gitk:9802
msgid "No changes committed"
msgstr "Inga ändringar incheckade"
-#: gitk:9608
+#: gitk:9771
#, tcl-format
msgid "Commit %s is not included in branch %s -- really revert it?"
msgstr "Incheckningen %s finns inte på grenen %s -- vill du verkligen ångra?"
-#: gitk:9613
+#: gitk:9776
msgid "Reverting"
msgstr "Ångrar"
-#: gitk:9621
+#: gitk:9784
#, tcl-format
msgid ""
"Revert failed because of local changes to the following files:%s Please "
@@ -1092,7 +1117,7 @@ msgstr ""
"Checka in, återställ eller spara undan (stash) dina ändringar och försök "
"igen."
-#: gitk:9625
+#: gitk:9788
msgid ""
"Revert failed because of merge conflict.\n"
" Do you wish to run git citool to resolve it?"
@@ -1100,28 +1125,28 @@ msgstr ""
"Misslyckades med att ångra på grund av en sammanslagningskonflikt.\n"
" Vill du köra git citool för att lösa den?"
-#: gitk:9668
+#: gitk:9831
msgid "Confirm reset"
msgstr "Bekräfta återställning"
-#: gitk:9670
+#: gitk:9833
#, tcl-format
msgid "Reset branch %s to %s?"
msgstr "Återställa grenen %s till %s?"
-#: gitk:9672
+#: gitk:9835
msgid "Reset type:"
msgstr "Typ av återställning:"
-#: gitk:9675
+#: gitk:9838
msgid "Soft: Leave working tree and index untouched"
msgstr "Mjuk: Rör inte utcheckning och index"
-#: gitk:9678
+#: gitk:9841
msgid "Mixed: Leave working tree untouched, reset index"
msgstr "Blandad: Rör inte utcheckning, återställ index"
-#: gitk:9681
+#: gitk:9844
msgid ""
"Hard: Reset working tree and index\n"
"(discard ALL local changes)"
@@ -1129,19 +1154,24 @@ msgstr ""
"Hård: Återställ utcheckning och index\n"
"(förkastar ALLA lokala ändringar)"
-#: gitk:9698
+#: gitk:9861
msgid "Resetting"
msgstr "Återställer"
-#: gitk:9758
+#: gitk:9934
+#, tcl-format
+msgid "A local branch named %s exists already"
+msgstr "Det finns redan en lokal gren som heter %s"
+
+#: gitk:9942
msgid "Checking out"
msgstr "Checkar ut"
-#: gitk:9811
+#: gitk:10001
msgid "Cannot delete the currently checked-out branch"
msgstr "Kan inte ta bort den just nu utcheckade grenen"
-#: gitk:9817
+#: gitk:10007
#, tcl-format
msgid ""
"The commits on branch %s aren't on any other branch.\n"
@@ -1150,16 +1180,16 @@ msgstr ""
"Incheckningarna på grenen %s existerar inte på någon annan gren.\n"
"Vill du verkligen ta bort grenen %s?"
-#: gitk:9848
+#: gitk:10038
#, tcl-format
msgid "Tags and heads: %s"
msgstr "Taggar och huvuden: %s"
-#: gitk:9865
+#: gitk:10055
msgid "Filter"
msgstr "Filter"
-#: gitk:10161
+#: gitk:10356
msgid ""
"Error reading commit topology information; branch and preceding/following "
"tag information will be incomplete."
@@ -1167,201 +1197,221 @@ msgstr ""
"Fel vid läsning av information om incheckningstopologi; information om "
"grenar och föregående/senare taggar kommer inte vara komplett."
-#: gitk:11138
+#: gitk:11333
msgid "Tag"
msgstr "Tagg"
-#: gitk:11142
+#: gitk:11337
msgid "Id"
msgstr "Id"
-#: gitk:11225
+#: gitk:11420
msgid "Gitk font chooser"
msgstr "Teckensnittsväljare för Gitk"
-#: gitk:11242
+#: gitk:11437
msgid "B"
msgstr "F"
-#: gitk:11245
+#: gitk:11440
msgid "I"
msgstr "K"
-#: gitk:11363
+#: gitk:11558
msgid "Commit list display options"
msgstr "Alternativ för incheckningslistvy"
-#: gitk:11366
+#: gitk:11561
msgid "Maximum graph width (lines)"
msgstr "Maximal grafbredd (rader)"
-#: gitk:11370
+#: gitk:11565
#, no-tcl-format
msgid "Maximum graph width (% of pane)"
msgstr "Maximal grafbredd (% av ruta)"
-#: gitk:11373
+#: gitk:11568
msgid "Show local changes"
msgstr "Visa lokala ändringar"
-#: gitk:11376
+#: gitk:11571
msgid "Auto-select SHA1 (length)"
msgstr "Välj SHA1 (längd) automatiskt"
-#: gitk:11380
+#: gitk:11575
msgid "Hide remote refs"
msgstr "Dölj fjärr-referenser"
-#: gitk:11384
+#: gitk:11579
msgid "Diff display options"
msgstr "Alternativ för diffvy"
-#: gitk:11386
+#: gitk:11581
msgid "Tab spacing"
msgstr "Blanksteg för tabulatortecken"
-#: gitk:11389
+#: gitk:11584
msgid "Display nearby tags/heads"
msgstr "Visa närliggande taggar/huvuden"
-#: gitk:11392
+#: gitk:11587
msgid "Maximum # tags/heads to show"
msgstr "Maximalt antal taggar/huvuden att visa"
-#: gitk:11395
+#: gitk:11590
msgid "Limit diffs to listed paths"
msgstr "Begränsa diff till listade sökvägar"
-#: gitk:11398
+#: gitk:11593
msgid "Support per-file encodings"
msgstr "Stöd för filspecifika teckenkodningar"
-#: gitk:11404 gitk:11551
+#: gitk:11599 gitk:11766
msgid "External diff tool"
msgstr "Externt diff-verktyg"
-#: gitk:11405
+#: gitk:11600
msgid "Choose..."
msgstr "Välj..."
-#: gitk:11410
+#: gitk:11607
+msgid "Web browser"
+msgstr "Webbläsare"
+
+#: gitk:11612
msgid "General options"
msgstr "Allmänna inställningar"
-#: gitk:11413
+#: gitk:11615
msgid "Use themed widgets"
msgstr "Använd tema på fönsterelement"
-#: gitk:11415
+#: gitk:11617
msgid "(change requires restart)"
msgstr "(ändringen kräver omstart)"
-#: gitk:11417
+#: gitk:11619
msgid "(currently unavailable)"
msgstr "(för närvarande inte tillgängligt)"
-#: gitk:11428
+#: gitk:11631
msgid "Colors: press to choose"
msgstr "Färger: tryck för att välja"
-#: gitk:11431
+#: gitk:11634
msgid "Interface"
msgstr "Gränssnitt"
-#: gitk:11432
+#: gitk:11635
msgid "interface"
msgstr "gränssnitt"
-#: gitk:11435
+#: gitk:11638
msgid "Background"
msgstr "Bakgrund"
-#: gitk:11436 gitk:11466
+#: gitk:11639 gitk:11681
msgid "background"
msgstr "bakgrund"
-#: gitk:11439
+#: gitk:11642
msgid "Foreground"
msgstr "Förgrund"
-#: gitk:11440
+#: gitk:11643
msgid "foreground"
msgstr "förgrund"
-#: gitk:11443
+#: gitk:11646
msgid "Diff: old lines"
msgstr "Diff: gamla rader"
-#: gitk:11444
+#: gitk:11647
msgid "diff old lines"
msgstr "diff gamla rader"
-#: gitk:11448
+#: gitk:11651
+msgid "Diff: old lines bg"
+msgstr "Diff: gamla rader bg"
+
+#: gitk:11653
+msgid "diff old lines bg"
+msgstr "diff gamla rader bg"
+
+#: gitk:11657
msgid "Diff: new lines"
msgstr "Diff: nya rader"
-#: gitk:11449
+#: gitk:11658
msgid "diff new lines"
msgstr "diff nya rader"
-#: gitk:11453
+#: gitk:11662
+msgid "Diff: new lines bg"
+msgstr "Diff: nya rader bg"
+
+#: gitk:11664
+msgid "diff new lines bg"
+msgstr "diff nya rader bg"
+
+#: gitk:11668
msgid "Diff: hunk header"
msgstr "Diff: delhuvud"
-#: gitk:11455
+#: gitk:11670
msgid "diff hunk header"
msgstr "diff delhuvud"
-#: gitk:11459
+#: gitk:11674
msgid "Marked line bg"
msgstr "Markerad rad bakgrund"
-#: gitk:11461
+#: gitk:11676
msgid "marked line background"
msgstr "markerad rad bakgrund"
-#: gitk:11465
+#: gitk:11680
msgid "Select bg"
msgstr "Markerad bakgrund"
-#: gitk:11474
+#: gitk:11689
msgid "Fonts: press to choose"
msgstr "Teckensnitt: tryck för att välja"
-#: gitk:11476
+#: gitk:11691
msgid "Main font"
msgstr "Huvudteckensnitt"
-#: gitk:11477
+#: gitk:11692
msgid "Diff display font"
msgstr "Teckensnitt för diffvisning"
-#: gitk:11478
+#: gitk:11693
msgid "User interface font"
msgstr "Teckensnitt för användargränssnitt"
-#: gitk:11500
+#: gitk:11715
msgid "Gitk preferences"
msgstr "Inställningar för Gitk"
-#: gitk:11509
+#: gitk:11724
msgid "General"
msgstr "Allmänt"
-#: gitk:11510
+#: gitk:11725
msgid "Colors"
msgstr "Färger"
-#: gitk:11511
+#: gitk:11726
msgid "Fonts"
msgstr "Teckensnitt"
-#: gitk:11561
+#: gitk:11776
#, tcl-format
msgid "Gitk: choose color for %s"
msgstr "Gitk: välj färg för %s"
-#: gitk:12074
+#: gitk:12289
msgid ""
"Sorry, gitk cannot run with this version of Tcl/Tk.\n"
" Gitk requires at least Tcl/Tk 8.4."
@@ -1369,45 +1419,15 @@ msgstr ""
"Gitk kan tyvärr inte köra med denna version av Tcl/Tk.\n"
" Gitk kräver åtminstone Tcl/Tk 8.4."
-#: gitk:12284
+#: gitk:12507
msgid "Cannot find a git repository here."
msgstr "Hittar inget git-arkiv här."
-#: gitk:12331
+#: gitk:12554
#, tcl-format
msgid "Ambiguous argument '%s': both revision and filename"
-msgstr "Tvetydigt argument \"%s\": både revision och filnamn"
+msgstr "Tvetydigt argument ”%s”: både revision och filnamn"
-#: gitk:12343
+#: gitk:12566
msgid "Bad arguments to gitk:"
msgstr "Felaktiga argument till gitk:"
-
-#~ msgid "mc"
-#~ msgstr "mc"
-
-#~ msgid "next"
-#~ msgstr "nästa"
-
-#~ msgid "prev"
-#~ msgstr "föreg"
-
-#~ msgid "CDate"
-#~ msgstr "Skapat datum"
-
-#~ msgid "Cannot find the git directory \"%s\"."
-#~ msgstr "Hittar inte git-katalogen \"%s\"."
-
-#~ msgid "SHA1 ID: "
-#~ msgstr "SHA1-id: "
-
-#~ msgid "- stopping\n"
-#~ msgstr "- stannar\n"
-
-#~ msgid "Tag/Head %s is not known"
-#~ msgstr "Tagg/huvud %s är okänt"
-
-#~ msgid "/\t\tMove to next find hit, or redo find"
-#~ msgstr "/\t\tGå till nästa sökträff, eller sök på nytt"
-
-#~ msgid "Name"
-#~ msgstr "Namn"
diff --git a/gitweb/GITWEB-BUILD-OPTIONS.in b/gitweb/GITWEB-BUILD-OPTIONS.in
new file mode 100644
index 0000000000..41ac20654c
--- /dev/null
+++ b/gitweb/GITWEB-BUILD-OPTIONS.in
@@ -0,0 +1,24 @@
+PERL_PATH=@PERL_PATH@
+JSMIN=@JSMIN@
+CSSMIN=@CSSMIN@
+GIT_BINDIR=@GIT_BINDIR@
+GITWEB_CONFIG=@GITWEB_CONFIG@
+GITWEB_CONFIG_SYSTEM=@GITWEB_CONFIG_SYSTEM@
+GITWEB_CONFIG_COMMON=@GITWEB_CONFIG_COMMON@
+GITWEB_HOME_LINK_STR=@GITWEB_HOME_LINK_STR@
+GITWEB_SITENAME=@GITWEB_SITENAME@
+GITWEB_PROJECTROOT=@GITWEB_PROJECTROOT@
+GITWEB_PROJECT_MAXDEPTH=@GITWEB_PROJECT_MAXDEPTH@
+GITWEB_EXPORT_OK=@GITWEB_EXPORT_OK@
+GITWEB_STRICT_EXPORT=@GITWEB_STRICT_EXPORT@
+GITWEB_BASE_URL=@GITWEB_BASE_URL@
+GITWEB_LIST=@GITWEB_LIST@
+GITWEB_HOMETEXT=@GITWEB_HOMETEXT@
+GITWEB_CSS=@GITWEB_CSS@
+GITWEB_LOGO=@GITWEB_LOGO@
+GITWEB_FAVICON=@GITWEB_FAVICON@
+GITWEB_JS=@GITWEB_JS@
+GITWEB_SITE_HTML_HEAD_STRING=@GITWEB_SITE_HTML_HEAD_STRING@
+GITWEB_SITE_HEADER=@GITWEB_SITE_HEADER@
+GITWEB_SITE_FOOTER=@GITWEB_SITE_FOOTER@
+HIGHLIGHT_BIN=@HIGHLIGHT_BIN@
diff --git a/gitweb/Makefile b/gitweb/Makefile
index 3b68ab2d67..d5748e9359 100644
--- a/gitweb/Makefile
+++ b/gitweb/Makefile
@@ -77,48 +77,48 @@ GITWEB_JSLIB_FILES += static/js/javascript-detection.js
GITWEB_JSLIB_FILES += static/js/adjust-timezone.js
GITWEB_JSLIB_FILES += static/js/blame_incremental.js
-
-GITWEB_REPLACE = \
- -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
- -e 's|++GIT_BINDIR++|$(bindir)|g' \
- -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
- -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
- -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \
- -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
- -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
- -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
- -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
- -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
- -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
- -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
- -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
- -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
- -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
- -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
- -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
- -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
- -e 's|++GITWEB_SITE_HTML_HEAD_STRING++|$(GITWEB_SITE_HTML_HEAD_STRING)|g' \
- -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
- -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
- -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
-
.PHONY: FORCE
$(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS: FORCE
- @rm -f $@+
- @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+
+ @sed -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|' \
+ -e 's|@JSMIN@|$(JSMIN)|' \
+ -e 's|@CSSMIN@|$(CSSMIN)|' \
+ -e 's|@GIT_VERSION@|$(GIT_VERSION)|' \
+ -e 's|@GIT_BINDIR@|$(bindir)|' \
+ -e 's|@GITWEB_CONFIG@|$(GITWEB_CONFIG)|' \
+ -e 's|@GITWEB_CONFIG_SYSTEM@|$(GITWEB_CONFIG_SYSTEM)|' \
+ -e 's|@GITWEB_CONFIG_COMMON@|$(GITWEB_CONFIG_COMMON)|' \
+ -e 's|@GITWEB_HOME_LINK_STR@|$(GITWEB_HOME_LINK_STR)|' \
+ -e 's|@GITWEB_SITENAME@|$(GITWEB_SITENAME)|' \
+ -e 's|@GITWEB_PROJECTROOT@|$(GITWEB_PROJECTROOT)|' \
+ -e 's|@GITWEB_PROJECT_MAXDEPTH@|$(GITWEB_PROJECT_MAXDEPTH)|' \
+ -e 's|@GITWEB_EXPORT_OK@|$(GITWEB_EXPORT_OK)|' \
+ -e 's|@GITWEB_STRICT_EXPORT@|$(GITWEB_STRICT_EXPORT)|' \
+ -e 's|@GITWEB_BASE_URL@|$(GITWEB_BASE_URL)|' \
+ -e 's|@GITWEB_LIST@|$(GITWEB_LIST)|' \
+ -e 's|@GITWEB_HOMETEXT@|$(GITWEB_HOMETEXT)|' \
+ -e 's|@GITWEB_CSS@|$(GITWEB_CSS)|' \
+ -e 's|@GITWEB_LOGO@|$(GITWEB_LOGO)|' \
+ -e 's|@GITWEB_FAVICON@|$(GITWEB_FAVICON)|' \
+ -e 's|@GITWEB_JS@|$(GITWEB_JS)|' \
+ -e 's|@GITWEB_SITE_HTML_HEAD_STRING@|$(GITWEB_SITE_HTML_HEAD_STRING)|' \
+ -e 's|@GITWEB_SITE_HEADER@|$(GITWEB_SITE_HEADER)|' \
+ -e 's|@GITWEB_SITE_FOOTER@|$(GITWEB_SITE_FOOTER)|' \
+ -e 's|@HIGHLIGHT_BIN@|$(HIGHLIGHT_BIN)|' \
+ $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS.in >"$@+"
@cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@
+$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)GITWEB-BUILD-OPTIONS
+$(MAK_DIR_GITWEB)gitweb.cgi: GIT-VERSION-FILE
$(MAK_DIR_GITWEB)gitweb.cgi: $(MAK_DIR_GITWEB)gitweb.perl
$(QUIET_GEN)$(RM) $@ $@+ && \
- sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
- $(GITWEB_REPLACE) $< >$@+ && \
- chmod +x $@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb-cgi.sh $(MAK_DIR_GITWEB)/GITWEB-BUILD-OPTIONS ./GIT-VERSION-FILE $< $@+ && \
mv $@+ $@
+$(MAK_DIR_GITWEB)static/gitweb.js: $(MAK_DIR_GITWEB)generate-gitweb-js.sh
$(MAK_DIR_GITWEB)static/gitweb.js: $(addprefix $(MAK_DIR_GITWEB),$(GITWEB_JSLIB_FILES))
$(QUIET_GEN)$(RM) $@ $@+ && \
- cat $^ >$@+ && \
+ $(MAK_DIR_GITWEB)generate-gitweb-js.sh $@+ $^ && \
mv $@+ $@
### Installation rules
diff --git a/gitweb/generate-gitweb-cgi.sh b/gitweb/generate-gitweb-cgi.sh
new file mode 100755
index 0000000000..ede9038c33
--- /dev/null
+++ b/gitweb/generate-gitweb-cgi.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 4
+then
+ echo >&2 "USAGE: $0 <GITWEB-BUILD-OPTIONS> <GIT-VERSION-FILE> <INPUT> <OUTPUT>"
+ exit 1
+fi
+
+GITWEB_BUILD_OPTIONS="$1"
+GIT_VERSION_FILE="$2"
+INPUT="$3"
+OUTPUT="$4"
+
+. "$GITWEB_BUILD_OPTIONS"
+. "$GIT_VERSION_FILE"
+
+sed -e "1s|#!/usr/bin/perl|#!$PERL_PATH|" \
+ -e "s|@PERL_PATH@|$PERL_PATH|" \
+ -e "s|@JSMIN@|$JSMIN|" \
+ -e "s|@CSSMIN@|$CSSMIN|" \
+ -e "s|@GIT_VERSION@|$GIT_VERSION|" \
+ -e "s|@GIT_BINDIR@|$GIT_BINDIR|" \
+ -e "s|@GITWEB_CONFIG@|$GITWEB_CONFIG|" \
+ -e "s|@GITWEB_CONFIG_SYSTEM@|$GITWEB_CONFIG_SYSTEM|" \
+ -e "s|@GITWEB_CONFIG_COMMON@|$GITWEB_CONFIG_COMMON|" \
+ -e "s|@GITWEB_HOME_LINK_STR@|$GITWEB_HOME_LINK_STR|" \
+ -e "s|@GITWEB_SITENAME@|$GITWEB_SITENAME|" \
+ -e "s|@GITWEB_PROJECTROOT@|$GITWEB_PROJECTROOT|" \
+ -e "s|@GITWEB_PROJECT_MAXDEPTH@|$GITWEB_PROJECT_MAXDEPTH|" \
+ -e "s|@GITWEB_EXPORT_OK@|$GITWEB_EXPORT_OK|" \
+ -e "s|@GITWEB_STRICT_EXPORT@|$GITWEB_STRICT_EXPORT|" \
+ -e "s|@GITWEB_BASE_URL@|$GITWEB_BASE_URL|" \
+ -e "s|@GITWEB_LIST@|$GITWEB_LIST|" \
+ -e "s|@GITWEB_HOMETEXT@|$GITWEB_HOMETEXT|" \
+ -e "s|@GITWEB_CSS@|$GITWEB_CSS|" \
+ -e "s|@GITWEB_LOGO@|$GITWEB_LOGO|" \
+ -e "s|@GITWEB_FAVICON@|$GITWEB_FAVICON|" \
+ -e "s|@GITWEB_JS@|$GITWEB_JS|" \
+ -e "s|@GITWEB_SITE_HTML_HEAD_STRING@|$GITWEB_SITE_HTML_HEAD_STRING|" \
+ -e "s|@GITWEB_SITE_HEADER@|$GITWEB_SITE_HEADER|" \
+ -e "s|@GITWEB_SITE_FOOTER@|$GITWEB_SITE_FOOTER|" \
+ -e "s|@HIGHLIGHT_BIN@|$HIGHLIGHT_BIN|" \
+ "$INPUT" >"$OUTPUT"
+
+chmod a+x "$OUTPUT"
diff --git a/gitweb/generate-gitweb-js.sh b/gitweb/generate-gitweb-js.sh
new file mode 100755
index 0000000000..01bb22b04b
--- /dev/null
+++ b/gitweb/generate-gitweb-js.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if test "$#" -lt 2
+then
+ echo >&2 "USAGE: $0 <OUTPUT> <INPUT>..."
+ exit 1
+fi
+
+OUTPUT="$1"
+shift
+
+cat "$@" >"$OUTPUT"
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b09a8d0523..b5490dfecf 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -7,7 +7,7 @@
#
# This program is licensed under the GPLv2
-use 5.008001;
+require v5.26;
use strict;
use warnings;
# handle ACL in file access tests
@@ -35,7 +35,7 @@ BEGIN {
CGI->compile() if $ENV{'MOD_PERL'};
}
-our $version = "++GIT_VERSION++";
+our $version = "@GIT_VERSION@";
our ($my_url, $my_uri, $base_url, $path_info, $home_link);
sub evaluate_uri {
@@ -80,46 +80,46 @@ sub evaluate_uri {
# core git executable to use
# this can just be "git" if your webserver has a sensible PATH
-our $GIT = "++GIT_BINDIR++/git";
+our $GIT = "@GIT_BINDIR@/git";
# absolute fs-path which will be prepended to the project path
#our $projectroot = "/pub/scm";
-our $projectroot = "++GITWEB_PROJECTROOT++";
+our $projectroot = "@GITWEB_PROJECTROOT@";
# fs traversing limit for getting project list
# the number is relative to the projectroot
-our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++";
+our $project_maxdepth = @GITWEB_PROJECT_MAXDEPTH@;
# string of the home link on top of all pages
-our $home_link_str = "++GITWEB_HOME_LINK_STR++";
+our $home_link_str = "@GITWEB_HOME_LINK_STR@";
# extra breadcrumbs preceding the home link
our @extra_breadcrumbs = ();
# name of your site or organization to appear in page titles
# replace this with something more descriptive for clearer bookmarks
-our $site_name = "++GITWEB_SITENAME++"
+our $site_name = "@GITWEB_SITENAME@"
|| ($ENV{'SERVER_NAME'} || "Untitled") . " Git";
# html snippet to include in the <head> section of each page
-our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++";
+our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@";
# filename of html text to include at top of each page
-our $site_header = "++GITWEB_SITE_HEADER++";
+our $site_header = "@GITWEB_SITE_HEADER@";
# html text to include at home page
-our $home_text = "++GITWEB_HOMETEXT++";
+our $home_text = "@GITWEB_HOMETEXT@";
# filename of html text to include at bottom of each page
-our $site_footer = "++GITWEB_SITE_FOOTER++";
+our $site_footer = "@GITWEB_SITE_FOOTER@";
# URI of stylesheets
-our @stylesheets = ("++GITWEB_CSS++");
+our @stylesheets = ("@GITWEB_CSS@");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
-our $logo = "++GITWEB_LOGO++";
+our $logo = "@GITWEB_LOGO@";
# URI of GIT favicon, assumed to be image/png type
-our $favicon = "++GITWEB_FAVICON++";
+our $favicon = "@GITWEB_FAVICON@";
# URI of gitweb.js (JavaScript code for gitweb)
-our $javascript = "++GITWEB_JS++";
+our $javascript = "@GITWEB_JS@";
# URI and label (title) of GIT logo link
#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
@@ -128,7 +128,7 @@ our $logo_url = "https://git-scm.com/";
our $logo_label = "git homepage";
# source of projects list
-our $projects_list = "++GITWEB_LIST++";
+our $projects_list = "@GITWEB_LIST@";
# the width (in characters) of the projects list "Description" column
our $projects_list_description_width = 25;
@@ -147,7 +147,7 @@ our $default_projects_order = "project";
# show repository only if this file exists
# (only effective if this variable evaluates to true)
-our $export_ok = "++GITWEB_EXPORT_OK++";
+our $export_ok = "@GITWEB_EXPORT_OK@";
# don't generate age column on the projects list page
our $omit_age_column = 0;
@@ -161,11 +161,11 @@ our $omit_owner=0;
our $export_auth_hook = undef;
# only allow viewing of repositories also shown on the overview page
-our $strict_export = "++GITWEB_STRICT_EXPORT++";
+our $strict_export = "@GITWEB_STRICT_EXPORT@";
# list of git base URLs used for URL to where fetch project from,
# i.e. full URL is "$git_base_url/$project"
-our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++");
+our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@");
# default blob_plain mimetype and default charset for text/plain blob
our $default_blob_plain_mimetype = 'text/plain';
@@ -200,7 +200,7 @@ our $prevent_xss = 0;
# 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++";
+our $highlight_bin = "@HIGHLIGHT_BIN@";
# information about snapshot formats that gitweb is capable of serving
our %known_snapshot_formats = (
@@ -741,9 +741,9 @@ sub read_config_file {
our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
sub evaluate_gitweb_config {
- our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
- our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
- our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
+ our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@";
+ our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@";
+ our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@";
# Protect against duplications of file names, to not read config twice.
# Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
@@ -1188,7 +1188,7 @@ sub evaluate_and_validate_params {
if ($search_use_regexp) {
$search_regexp = $searchtext;
if (!eval { qr/$search_regexp/; 1; }) {
- (my $error = $@) =~ s/ at \S+ line \d+.*\n?//;
+ my $error = $@ =~ s/ at \S+ line \d+.*\n?//r;
die_error(400, "Invalid search regexp '$search_regexp'",
esc_html($error));
}
@@ -2094,7 +2094,7 @@ sub format_log_line_html {
(
# The output of "git describe", e.g. v2.10.0-297-gf6727b0
# or hadoop-20160921-113441-20-g094fb7d
- (?<!-) # see strbuf_check_tag_ref(). Tags can't start with -
+ (?<!-) # see check_tag_ref(). Tags can't start with -
[A-Za-z0-9.-]+
(?!\.) # refs can't end with ".", see check_refname_format()
-g$regex
@@ -2700,7 +2700,7 @@ sub git_cmd {
# Try to avoid using this function wherever possible.
sub quote_command {
return join(' ',
- map { my $a = $_; $a =~ s/(['!])/'\\$1'/g; "'$a'" } @_ );
+ map { my $a = $_ =~ s/(['!])/'\\$1'/gr; "'$a'" } @_ );
}
# get HEAD ref of given project as hash
diff --git a/gitweb/meson.build b/gitweb/meson.build
new file mode 100644
index 0000000000..89b403dc9d
--- /dev/null
+++ b/gitweb/meson.build
@@ -0,0 +1,89 @@
+gitweb_config = configuration_data()
+gitweb_config.set_quoted('PERL_PATH', perl.full_path())
+gitweb_config.set_quoted('CSSMIN', '')
+gitweb_config.set_quoted('JSMIN', '')
+gitweb_config.set_quoted('GIT_BINDIR', get_option('prefix') / get_option('bindir'))
+gitweb_config.set_quoted('GITWEB_CONFIG', get_option('gitweb_config'))
+gitweb_config.set_quoted('GITWEB_CONFIG_SYSTEM', get_option('gitweb_config_system'))
+gitweb_config.set_quoted('GITWEB_CONFIG_COMMON', get_option('gitweb_config_common'))
+gitweb_config.set_quoted('GITWEB_HOME_LINK_STR', get_option('gitweb_home_link_str'))
+gitweb_config.set_quoted('GITWEB_SITENAME', get_option('gitweb_sitename'))
+gitweb_config.set_quoted('GITWEB_PROJECTROOT', get_option('gitweb_projectroot'))
+gitweb_config.set_quoted('GITWEB_PROJECT_MAXDEPTH', get_option('gitweb_project_maxdepth'))
+gitweb_config.set_quoted('GITWEB_EXPORT_OK', get_option('gitweb_export_ok'))
+gitweb_config.set_quoted('GITWEB_STRICT_EXPORT', get_option('gitweb_strict_export'))
+gitweb_config.set_quoted('GITWEB_BASE_URL', get_option('gitweb_base_url'))
+gitweb_config.set_quoted('GITWEB_LIST', get_option('gitweb_list'))
+gitweb_config.set_quoted('GITWEB_HOMETEXT', get_option('gitweb_hometext'))
+gitweb_config.set_quoted('GITWEB_CSS', get_option('gitweb_css'))
+gitweb_config.set_quoted('GITWEB_LOGO', get_option('gitweb_logo'))
+gitweb_config.set_quoted('GITWEB_FAVICON', get_option('gitweb_favicon'))
+gitweb_config.set_quoted('GITWEB_JS', get_option('gitweb_js'))
+gitweb_config.set_quoted('GITWEB_SITE_HTML_HEAD_STRING', get_option('gitweb_site_html_head_string'))
+gitweb_config.set_quoted('GITWEB_SITE_HEADER', get_option('gitweb_site_header'))
+gitweb_config.set_quoted('GITWEB_SITE_FOOTER', get_option('gitweb_site_footer'))
+gitweb_config.set_quoted('HIGHLIGHT_BIN', get_option('highlight_bin'))
+
+configure_file(
+ input: 'GITWEB-BUILD-OPTIONS.in',
+ output: 'GITWEB-BUILD-OPTIONS',
+ configuration: gitweb_config,
+)
+
+test_dependencies += custom_target(
+ input: 'gitweb.perl',
+ output: 'gitweb.cgi',
+ command: [
+ shell,
+ meson.current_source_dir() / 'generate-gitweb-cgi.sh',
+ meson.current_build_dir() / 'GITWEB-BUILD-OPTIONS',
+ git_version_file.full_path(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb',
+ depends: [git_version_file],
+)
+
+javascript_files = [
+ meson.current_source_dir() / 'static/js/adjust-timezone.js',
+ meson.current_source_dir() / 'static/js/blame_incremental.js',
+ meson.current_source_dir() / 'static/js/javascript-detection.js',
+ meson.current_source_dir() / 'static/js/lib/common-lib.js',
+ meson.current_source_dir() / 'static/js/lib/cookies.js',
+ meson.current_source_dir() / 'static/js/lib/datetime.js',
+]
+
+test_dependencies += custom_target(
+ input: javascript_files,
+ output: 'gitweb.js',
+ command: [
+ shell,
+ meson.current_source_dir() / 'generate-gitweb-js.sh',
+ '@OUTPUT@',
+ ] + javascript_files,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb/static',
+)
+
+foreach asset : [
+ 'static/git-favicon.png',
+ 'static/git-logo.png',
+ 'static/gitweb.css',
+]
+ if meson.version().version_compare('>=1.3.0')
+ fs.copyfile(asset,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
+ )
+ else
+ configure_file(
+ input: asset,
+ output: fs.stem(asset),
+ copy: true,
+ install: true,
+ install_dir: get_option('datadir') / 'gitweb' / fs.parent(asset),
+ )
+ endif
+endforeach
diff --git a/help.c b/help.c
index 4ad4ebdd2c..8a830ba35c 100644
--- a/help.c
+++ b/help.c
@@ -546,8 +546,10 @@ int is_in_cmdlist(struct cmdnames *c, const char *s)
return 0;
}
-static int autocorrect;
-static struct cmdnames aliases;
+struct help_unknown_cmd_config {
+ int autocorrect;
+ struct cmdnames aliases;
+};
#define AUTOCORRECT_PROMPT (-3)
#define AUTOCORRECT_NEVER (-2)
@@ -555,28 +557,29 @@ static struct cmdnames aliases;
static int git_unknown_cmd_config(const char *var, const char *value,
const struct config_context *ctx,
- void *cb UNUSED)
+ void *cb)
{
+ struct help_unknown_cmd_config *cfg = cb;
const char *p;
if (!strcmp(var, "help.autocorrect")) {
if (!value)
return config_error_nonbool(var);
if (!strcmp(value, "never")) {
- autocorrect = AUTOCORRECT_NEVER;
+ cfg->autocorrect = AUTOCORRECT_NEVER;
} else if (!strcmp(value, "immediate")) {
- autocorrect = AUTOCORRECT_IMMEDIATELY;
+ cfg->autocorrect = AUTOCORRECT_IMMEDIATELY;
} else if (!strcmp(value, "prompt")) {
- autocorrect = AUTOCORRECT_PROMPT;
+ cfg->autocorrect = AUTOCORRECT_PROMPT;
} else {
int v = git_config_int(var, value, ctx->kvi);
- autocorrect = (v < 0)
+ cfg->autocorrect = (v < 0)
? AUTOCORRECT_IMMEDIATELY : v;
}
}
/* Also use aliases for command lookup */
if (skip_prefix(var, "alias.", &p))
- add_cmdname(&aliases, p, strlen(p));
+ add_cmdname(&cfg->aliases, p, strlen(p));
return 0;
}
@@ -609,32 +612,30 @@ static const char bad_interpreter_advice[] =
N_("'%s' appears to be a git command, but we were not\n"
"able to execute it. Maybe git-%s is broken?");
-const char *help_unknown_cmd(const char *cmd)
+char *help_unknown_cmd(const char *cmd)
{
+ struct help_unknown_cmd_config cfg = { 0 };
int i, n, best_similarity = 0;
- struct cmdnames main_cmds, other_cmds;
+ struct cmdnames main_cmds = { 0 };
+ struct cmdnames other_cmds = { 0 };
struct cmdname_help *common_cmds;
- memset(&main_cmds, 0, sizeof(main_cmds));
- memset(&other_cmds, 0, sizeof(other_cmds));
- memset(&aliases, 0, sizeof(aliases));
-
- read_early_config(the_repository, git_unknown_cmd_config, NULL);
+ read_early_config(the_repository, git_unknown_cmd_config, &cfg);
/*
* Disable autocorrection prompt in a non-interactive session
*/
- if ((autocorrect == AUTOCORRECT_PROMPT) && (!isatty(0) || !isatty(2)))
- autocorrect = AUTOCORRECT_NEVER;
+ if ((cfg.autocorrect == AUTOCORRECT_PROMPT) && (!isatty(0) || !isatty(2)))
+ cfg.autocorrect = AUTOCORRECT_NEVER;
- if (autocorrect == AUTOCORRECT_NEVER) {
+ if (cfg.autocorrect == AUTOCORRECT_NEVER) {
fprintf_ln(stderr, _("git: '%s' is not a git command. See 'git --help'."), cmd);
exit(1);
}
load_command_list("git-", &main_cmds, &other_cmds);
- add_cmd_list(&main_cmds, &aliases);
+ add_cmd_list(&main_cmds, &cfg.aliases);
add_cmd_list(&main_cmds, &other_cmds);
QSORT(main_cmds.names, main_cmds.cnt, cmdname_compare);
uniq(&main_cmds);
@@ -693,20 +694,19 @@ const char *help_unknown_cmd(const char *cmd)
n++)
; /* still counting */
}
- if (autocorrect && n == 1 && SIMILAR_ENOUGH(best_similarity)) {
- const char *assumed = main_cmds.names[0]->name;
- main_cmds.names[0] = NULL;
- cmdnames_release(&main_cmds);
+ if (cfg.autocorrect && n == 1 && SIMILAR_ENOUGH(best_similarity)) {
+ char *assumed = xstrdup(main_cmds.names[0]->name);
+
fprintf_ln(stderr,
_("WARNING: You called a Git command named '%s', "
"which does not exist."),
cmd);
- if (autocorrect == AUTOCORRECT_IMMEDIATELY)
+ if (cfg.autocorrect == AUTOCORRECT_IMMEDIATELY)
fprintf_ln(stderr,
_("Continuing under the assumption that "
"you meant '%s'."),
assumed);
- else if (autocorrect == AUTOCORRECT_PROMPT) {
+ else if (cfg.autocorrect == AUTOCORRECT_PROMPT) {
char *answer;
struct strbuf msg = STRBUF_INIT;
strbuf_addf(&msg, _("Run '%s' instead [y/N]? "), assumed);
@@ -719,9 +719,13 @@ const char *help_unknown_cmd(const char *cmd)
fprintf_ln(stderr,
_("Continuing in %0.1f seconds, "
"assuming that you meant '%s'."),
- (float)autocorrect/10.0, assumed);
- sleep_millisec(autocorrect * 100);
+ (float)cfg.autocorrect/10.0, assumed);
+ sleep_millisec(cfg.autocorrect * 100);
}
+
+ cmdnames_release(&cfg.aliases);
+ cmdnames_release(&main_cmds);
+ cmdnames_release(&other_cmds);
return assumed;
}
diff --git a/help.h b/help.h
index e716ee27ea..67207b3073 100644
--- a/help.h
+++ b/help.h
@@ -32,7 +32,7 @@ void list_all_other_cmds(struct string_list *list);
void list_cmds_by_category(struct string_list *list,
const char *category);
void list_cmds_by_config(struct string_list *list);
-const char *help_unknown_cmd(const char *cmd);
+char *help_unknown_cmd(const char *cmd);
void load_command_list(const char *prefix,
struct cmdnames *main_cmds,
struct cmdnames *other_cmds);
diff --git a/hook.c b/hook.c
index a9320cb0ce..9ddbdee06d 100644
--- a/hook.c
+++ b/hook.c
@@ -39,7 +39,7 @@ const char *find_hook(struct repository *r, const char *name)
advise(_("The '%s' hook was ignored because "
"it's not set as executable.\n"
"You can disable this warning with "
- "`git config advice.ignoredHook false`."),
+ "`git config set advice.ignoredHook false`."),
path.buf);
}
}
diff --git a/http.c b/http.c
index 58242b9d2d..c7a55ae9cd 100644
--- a/http.c
+++ b/http.c
@@ -53,22 +53,16 @@ static struct {
{ "sslv2", CURL_SSLVERSION_SSLv2 },
{ "sslv3", CURL_SSLVERSION_SSLv3 },
{ "tlsv1", CURL_SSLVERSION_TLSv1 },
-#ifdef GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_0
{ "tlsv1.0", CURL_SSLVERSION_TLSv1_0 },
{ "tlsv1.1", CURL_SSLVERSION_TLSv1_1 },
{ "tlsv1.2", CURL_SSLVERSION_TLSv1_2 },
-#endif
-#ifdef GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_3
{ "tlsv1.3", CURL_SSLVERSION_TLSv1_3 },
-#endif
};
static char *ssl_key;
static char *ssl_key_type;
static char *ssl_capath;
static char *curl_no_proxy;
-#ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
static char *ssl_pinnedkey;
-#endif
static char *ssl_cainfo;
static long curl_low_speed_limit = -1;
static long curl_low_speed_time = -1;
@@ -512,12 +506,7 @@ static int http_options(const char *var, const char *value,
}
if (!strcmp("http.pinnedpubkey", var)) {
-#ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
return git_config_pathname(&ssl_pinnedkey, var, value);
-#else
- warning(_("Public key pinning not supported with cURL < 7.39.0"));
- return 0;
-#endif
}
if (!strcmp("http.extraheader", var)) {
@@ -701,7 +690,6 @@ static int has_cert_password(void)
return 1;
}
-#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_KEYPASSWD
static int has_proxy_cert_password(void)
{
if (http_proxy_ssl_cert == NULL || proxy_ssl_cert_password_required != 1)
@@ -715,37 +703,12 @@ static int has_proxy_cert_password(void)
}
return 1;
}
-#endif
-#ifdef GITCURL_HAVE_CURLOPT_TCP_KEEPALIVE
static void set_curl_keepalive(CURL *c)
{
curl_easy_setopt(c, CURLOPT_TCP_KEEPALIVE, 1);
}
-#else
-static int sockopt_callback(void *client, curl_socket_t fd, curlsocktype type)
-{
- int ka = 1;
- int rc;
- socklen_t len = (socklen_t)sizeof(ka);
-
- if (type != CURLSOCKTYPE_IPCXN)
- return 0;
-
- rc = setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&ka, len);
- if (rc < 0)
- warning_errno("unable to set SO_KEEPALIVE on socket");
-
- return CURL_SOCKOPT_OK;
-}
-
-static void set_curl_keepalive(CURL *c)
-{
- curl_easy_setopt(c, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
-}
-#endif
-
/* Return 1 if redactions have been made, 0 otherwise. */
static int redact_sensitive_header(struct strbuf *header, size_t offset)
{
@@ -1014,7 +977,6 @@ static long get_curl_allowed_protocols(int from_user, struct strbuf *list)
return bits;
}
-#ifdef GIT_CURL_HAVE_CURL_HTTP_VERSION_2
static int get_curl_http_version_opt(const char *version_string, long *opt)
{
int i;
@@ -1037,8 +999,6 @@ static int get_curl_http_version_opt(const char *version_string, long *opt)
return -1; /* not found */
}
-#endif
-
static CURL *get_curl_handle(void)
{
CURL *result = curl_easy_init();
@@ -1056,7 +1016,6 @@ static CURL *get_curl_handle(void)
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2);
}
-#ifdef GIT_CURL_HAVE_CURL_HTTP_VERSION_2
if (curl_http_version) {
long opt;
if (!get_curl_http_version_opt(curl_http_version, &opt)) {
@@ -1064,7 +1023,6 @@ static CURL *get_curl_handle(void)
curl_easy_setopt(result, CURLOPT_HTTP_VERSION, opt);
}
}
-#endif
curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
curl_easy_setopt(result, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
@@ -1087,11 +1045,7 @@ static CURL *get_curl_handle(void)
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
!http_schannel_check_revoke) {
-#ifdef GIT_CURL_HAVE_CURLSSLOPT_NO_REVOKE
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
-#else
- warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
-#endif
}
if (http_proactive_auth != PROACTIVE_AUTH_NONE)
@@ -1131,23 +1085,17 @@ static CURL *get_curl_handle(void)
curl_easy_setopt(result, CURLOPT_SSLKEYTYPE, ssl_key_type);
if (ssl_capath)
curl_easy_setopt(result, CURLOPT_CAPATH, ssl_capath);
-#ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
if (ssl_pinnedkey)
curl_easy_setopt(result, CURLOPT_PINNEDPUBLICKEY, ssl_pinnedkey);
-#endif
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
!http_schannel_use_ssl_cainfo) {
curl_easy_setopt(result, CURLOPT_CAINFO, NULL);
-#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_CAINFO
curl_easy_setopt(result, CURLOPT_PROXY_CAINFO, NULL);
-#endif
} else if (ssl_cainfo != NULL || http_proxy_ssl_ca_info != NULL) {
if (ssl_cainfo)
curl_easy_setopt(result, CURLOPT_CAINFO, ssl_cainfo);
-#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_CAINFO
if (http_proxy_ssl_ca_info)
curl_easy_setopt(result, CURLOPT_PROXY_CAINFO, http_proxy_ssl_ca_info);
-#endif
}
if (curl_low_speed_limit > 0 && curl_low_speed_time > 0) {
@@ -1243,7 +1191,6 @@ static CURL *get_curl_handle(void)
else if (starts_with(curl_http_proxy, "socks"))
curl_easy_setopt(result,
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
-#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_KEYPASSWD
else if (starts_with(curl_http_proxy, "https")) {
curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS);
@@ -1256,7 +1203,6 @@ static CURL *get_curl_handle(void)
if (has_proxy_cert_password())
curl_easy_setopt(result, CURLOPT_PROXY_KEYPASSWD, proxy_cert_auth.password);
}
-#endif
if (strstr(curl_http_proxy, "://"))
credential_from_url(&proxy_auth, curl_http_proxy);
else {
@@ -1330,7 +1276,6 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
free(normalized_url);
string_list_clear(&config.vars, 1);
-#ifdef GIT_CURL_HAVE_CURLSSLSET_NO_BACKENDS
if (http_ssl_backend) {
const curl_ssl_backend **backends;
struct strbuf buf = STRBUF_INIT;
@@ -1355,7 +1300,6 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
break; /* Okay! */
}
}
-#endif
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
die("curl_global_init failed");
@@ -1852,10 +1796,8 @@ static int handle_curl_result(struct slot_results *results)
*/
credential_reject(&cert_auth);
return HTTP_NOAUTH;
-#ifdef GIT_CURL_HAVE_CURLE_SSL_PINNEDPUBKEYNOTMATCH
} else if (results->curl_result == CURLE_SSL_PINNEDPUBKEYNOTMATCH) {
return HTTP_NOMATCHPUBLICKEY;
-#endif
} else if (missing_target(results))
return HTTP_MISSING_TARGET;
else if (results->http_code == 401) {
@@ -2439,7 +2381,7 @@ static int fetch_and_setup_pack_index(struct packed_git **packs_head,
if (!tmp_idx)
return -1;
- new_pack = parse_pack_index(sha1, tmp_idx);
+ new_pack = parse_pack_index(the_repository, sha1, tmp_idx);
if (!new_pack) {
unlink(tmp_idx);
free(tmp_idx);
@@ -2581,7 +2523,7 @@ struct http_pack_request *new_direct_http_pack_request(
preq->url = url;
- odb_pack_name(&preq->tmpfile, packed_git_hash, "pack");
+ odb_pack_name(the_repository, &preq->tmpfile, packed_git_hash, "pack");
strbuf_addstr(&preq->tmpfile, ".temp");
preq->packfile = fopen(preq->tmpfile.buf, "a");
if (!preq->packfile) {
diff --git a/imap-send.c b/imap-send.c
index 488c06e613..25c68fd90d 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1420,15 +1420,11 @@ static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred)
curl_easy_setopt(curl, CURLOPT_PORT, srvc->port);
if (srvc->auth_method) {
-#ifndef GIT_CURL_HAVE_CURLOPT_LOGIN_OPTIONS
- warning("No LOGIN_OPTIONS support in this cURL version");
-#else
struct strbuf auth = STRBUF_INIT;
strbuf_addstr(&auth, "AUTH=");
strbuf_addstr(&auth, srvc->auth_method);
curl_easy_setopt(curl, CURLOPT_LOGIN_OPTIONS, auth.buf);
strbuf_release(&auth);
-#endif
}
if (!srvc->use_ssl)
diff --git a/line-log.c b/line-log.c
index bca9bd8040..bc67b75d10 100644
--- a/line-log.c
+++ b/line-log.c
@@ -1237,6 +1237,7 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm
* don't follow any other path in history
*/
add_line_range(rev, parents[i], cand[i]);
+ free_commit_list(commit->parents);
commit_list_append(parents[i], &commit->parents);
ret = 0;
diff --git a/list-objects.c b/list-objects.c
index 985d008799..d11a389b3a 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -41,7 +41,8 @@ static void show_object(struct traversal_context *ctx,
{
if (!ctx->show_object)
return;
- if (ctx->revs->unpacked && has_object_pack(&object->oid))
+ if (ctx->revs->unpacked && has_object_pack(ctx->revs->repo,
+ &object->oid))
return;
ctx->show_object(object, name, ctx->show_data);
@@ -74,7 +75,7 @@ static void process_blob(struct traversal_context *ctx,
*/
if (ctx->revs->exclude_promisor_objects &&
!repo_has_object_file(the_repository, &obj->oid) &&
- is_promisor_object(&obj->oid))
+ is_promisor_object(ctx->revs->repo, &obj->oid))
return;
pathlen = path->len;
@@ -179,7 +180,7 @@ static void process_tree(struct traversal_context *ctx,
* an incomplete list of missing objects.
*/
if (revs->exclude_promisor_objects &&
- is_promisor_object(&obj->oid))
+ is_promisor_object(revs->repo, &obj->oid))
return;
if (!revs->do_not_die_on_missing_objects)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000000..0dccebcdf1
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,1901 @@
+# Meson build system
+# ==================
+#
+# The Meson build system is an alternative to our Makefile that you can use to
+# build, test and install Git. Using Meson results in a couple of benefits:
+#
+# - Out-of-tree builds.
+# - Better integration into IDEs.
+# - Easy-to-use autoconfiguration of available features on your system.
+#
+# To use Meson from the command line you need to have both Meson and Ninja
+# installed. Alternatively, if you do not have Python available on your system,
+# you can also use Muon instead of Meson and Samurai instead of Ninja, both of
+# which are drop-ins replacement that only depend on C.
+#
+# Basic usage
+# ===========
+#
+# In the most trivial case, you can configure, build and install Git like this:
+#
+# 1. Set up the build directory. This only needs to happen once per build
+# directory you want to have. You can also configure multiple different
+# build directories with different configurations.
+#
+# $ meson setup build/
+#
+# The build directory gets ignored by Git automatically as Meson will write
+# a ".gitignore" file into it. From hereon, we will assume that you execute
+# commands inside this build directory.
+#
+# 2. Compile Git. You can either use Meson, Ninja or Samurai to do this, so all
+# of the following invocations are equivalent:
+#
+# $ meson compile
+# $ ninja
+# $ samu
+#
+# The different invocations should ultimately not make much of a difference.
+# Using Meson also works with other generators though, like when the build
+# directory has been set up for use with Microsoft Visual Studio.
+#
+# Ninja and Samurai use multiple jobs by default, scaling with the number of
+# processor cores available. You can pass the `-jN` flag to change this.
+#
+# Meson automatically picks up ccache and sccache when these are installed
+# when setting up the build directory. You can override this behaviour when
+# setting up the build directory by setting the `CC` environment variable to
+# your desired compiler.
+#
+# 3. Execute tests. Again, you can either use Meson, Ninja or Samurai to do this:
+#
+# $ meson test
+# $ ninja test
+# $ samu test
+#
+# It is recommended to use Meson in this case though as it also provides you
+# additional features that the other build systems don't have available.
+# You can e.g. pass additional arguments to the test executables or run
+# individual tests:
+#
+# # Execute the t0000-basic integration test and t-reftable-stack unit test.
+# $ meson test t0000-basic t-reftable-stack
+#
+# # Execute all reftable unit tests.
+# $ meson test t-reftable-*
+#
+# # Execute all tests and stop with the first failure.
+# $ meson test --maxfail 1
+#
+# # Execute single test interactively such that features like `debug ()` work.
+# $ meson test -i --test-args='-ix' t1400-update-ref
+#
+# Test execution is parallelized by default and scales with the number of
+# processor cores available. You can change the number of processes by passing
+# the `-jN` flag to `meson test`.
+#
+# 4. Install the Git distribution. Again, this can be done via Meson, Ninja or
+# Samurai:
+#
+# $ meson install
+# $ ninja install
+# $ samu install
+#
+# The prefix into which Git shall be installed is defined when setting up
+# the build directory. More on that in the "Configuration" section.
+#
+# Meson supports multiple backends. The default backend generates Ninja build
+# instructions, but it also supports the generation of Microsoft Visual
+# Studio solutions as well as Xcode projects by passing the `--backend` option
+# to `meson setup`. IDEs like Eclipse and Visual Studio Code provide plugins to
+# import Meson files directly.
+#
+# Configuration
+# =============
+#
+# The exact configuration of Git is determined when setting up the build
+# directory via `meson setup`. Unless told otherwise, Meson will automatically
+# detect the availability of various bits and pieces. There are two different
+# kinds of options that can be used to further tweak the build:
+#
+# - Built-in options provided by Meson.
+#
+# - Options defined by the project in the "meson_options.txt" file.
+#
+# Both kinds of options can be inspected by running `meson configure` in the
+# build directory, which will give you a list of the current value for all
+# options.
+#
+# Options can be configured either when setting up the build directory or can
+# be changed in preexisting build directories:
+#
+# # Set up a new build directory with optimized settings that will be
+# # installed into an alternative prefix.
+# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER build
+#
+# # Set up a new build directory with a higher warning level. Level 2 is
+# # mostly equivalent to setting DEVELOPER=1, level 3 and "everything"
+# # will enable even more warnings.
+# $ meson setup -Dwarning_level=2 build
+#
+# # Set up a new build directory with 'address' and 'undefined' sanitizers
+# # using Clang.
+# $ CC=clang meson setup -Db_sanitize=address,undefined build
+#
+# # Disable tests in a preexisting build directory.
+# $ meson configure -Dtests=false
+#
+# # Disable features based on Python
+# $ meson configure -Dpython=disabled
+#
+# Options have a type like booleans, choices, strings or features. Features are
+# somewhat special as they can have one of three values: enabled, disabled or
+# auto. While the first two values are self-explanatory, "auto" will enable or
+# disable the feature based on the availability of prerequisites to support it.
+# Python-based features for example will be enabled automatically when a Python
+# interpreter could be found. The default value of such features can be changed
+# via `meson setup --auto-features={enabled,disabled,auto}`, which will set the
+# value of all features with a value of "auto" to the provided one by default.
+#
+# It is also possible to store a set of configuration options in machine files.
+# This can be useful in case you regularly want to reuse the same set of options:
+#
+# [binaries]
+# c = ['clang']
+# ar = ['ar']
+#
+# [project options]
+# gettext = 'disabled'
+# default_editor = 'vim'
+#
+# [built-in options]
+# b_lto = true
+# b_sanitize = 'address,undefined'
+#
+# These machine files can be passed to `meson setup` via the `--native-file`
+# option.
+#
+# Subproject wrappers
+# ===================
+#
+# Subproject wrappers are a feature provided by Meson that allows the automatic
+# fallback to a "wrapped" dependency in case the dependency is not provided by
+# the system. For example if the system is lacking curl, then Meson will use
+# "subprojects/curl.wrap" to set up curl as a subproject and compile and link
+# the dependency into Git itself. This is especially helpful on systems like
+# Windows, where you typically don't have such dependencies installed.
+#
+# The use of subproject wrappers can be disabled by executing `meson setup`
+# with the `--wrap-mode nofallback` option.
+
+project('git', 'c',
+ meson_version: '>=0.61.0',
+ version: 'v2.47.GIT',
+)
+
+fs = import('fs')
+
+program_path = []
+# Git for Windows provides all the tools we need to build Git.
+if host_machine.system() == 'windows'
+ program_path += [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ]
+endif
+
+cygpath = find_program('cygpath', dirs: program_path, required: false)
+diff = find_program('diff', dirs: program_path)
+shell = find_program('sh', dirs: program_path)
+tar = find_program('tar', dirs: program_path)
+
+script_environment = environment()
+foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
+ program = find_program(tool, dirs: program_path)
+ script_environment.prepend('PATH', fs.parent(program.full_path()))
+endforeach
+
+git = find_program('git', dirs: program_path, required: false)
+if git.found()
+ script_environment.prepend('PATH', fs.parent(git.full_path()))
+endif
+
+if get_option('sane_tool_path') != ''
+ script_environment.prepend('PATH', get_option('sane_tool_path'))
+endif
+
+compiler = meson.get_compiler('c')
+
+libgit_sources = [
+ 'abspath.c',
+ 'add-interactive.c',
+ 'add-patch.c',
+ 'advice.c',
+ 'alias.c',
+ 'alloc.c',
+ 'apply.c',
+ 'archive-tar.c',
+ 'archive-zip.c',
+ 'archive.c',
+ 'attr.c',
+ 'base85.c',
+ 'bisect.c',
+ 'blame.c',
+ 'blob.c',
+ 'bloom.c',
+ 'branch.c',
+ 'bulk-checkin.c',
+ 'bundle-uri.c',
+ 'bundle.c',
+ 'cache-tree.c',
+ 'cbtree.c',
+ 'chdir-notify.c',
+ 'checkout.c',
+ 'chunk-format.c',
+ 'color.c',
+ 'column.c',
+ 'combine-diff.c',
+ 'commit-graph.c',
+ 'commit-reach.c',
+ 'commit.c',
+ 'compat/nonblock.c',
+ 'compat/obstack.c',
+ 'compat/terminal.c',
+ 'compat/zlib-uncompress2.c',
+ 'config.c',
+ 'connect.c',
+ 'connected.c',
+ 'convert.c',
+ 'copy.c',
+ 'credential.c',
+ 'csum-file.c',
+ 'ctype.c',
+ 'date.c',
+ 'decorate.c',
+ 'delta-islands.c',
+ 'diagnose.c',
+ 'diff-delta.c',
+ 'diff-merges.c',
+ 'diff-lib.c',
+ 'diff-no-index.c',
+ 'diff.c',
+ 'diffcore-break.c',
+ 'diffcore-delta.c',
+ 'diffcore-order.c',
+ 'diffcore-pickaxe.c',
+ 'diffcore-rename.c',
+ 'diffcore-rotate.c',
+ 'dir-iterator.c',
+ 'dir.c',
+ 'editor.c',
+ 'entry.c',
+ 'environment.c',
+ 'ewah/bitmap.c',
+ 'ewah/ewah_bitmap.c',
+ 'ewah/ewah_io.c',
+ 'ewah/ewah_rlw.c',
+ 'exec-cmd.c',
+ 'fetch-negotiator.c',
+ 'fetch-pack.c',
+ 'fmt-merge-msg.c',
+ 'fsck.c',
+ 'fsmonitor.c',
+ 'fsmonitor-ipc.c',
+ 'fsmonitor-settings.c',
+ 'gettext.c',
+ 'git-zlib.c',
+ 'gpg-interface.c',
+ 'graph.c',
+ 'grep.c',
+ 'hash-lookup.c',
+ 'hashmap.c',
+ 'help.c',
+ 'hex.c',
+ 'hex-ll.c',
+ 'hook.c',
+ 'ident.c',
+ 'json-writer.c',
+ 'kwset.c',
+ 'levenshtein.c',
+ 'line-log.c',
+ 'line-range.c',
+ 'linear-assignment.c',
+ 'list-objects-filter-options.c',
+ 'list-objects-filter.c',
+ 'list-objects.c',
+ 'lockfile.c',
+ 'log-tree.c',
+ 'loose.c',
+ 'ls-refs.c',
+ 'mailinfo.c',
+ 'mailmap.c',
+ 'match-trees.c',
+ 'mem-pool.c',
+ 'merge-blobs.c',
+ 'merge-ll.c',
+ 'merge-ort.c',
+ 'merge-ort-wrappers.c',
+ 'merge-recursive.c',
+ 'merge.c',
+ 'midx.c',
+ 'midx-write.c',
+ 'name-hash.c',
+ 'negotiator/default.c',
+ 'negotiator/noop.c',
+ 'negotiator/skipping.c',
+ 'notes-cache.c',
+ 'notes-merge.c',
+ 'notes-utils.c',
+ 'notes.c',
+ 'object-file-convert.c',
+ 'object-file.c',
+ 'object-name.c',
+ 'object.c',
+ 'oid-array.c',
+ 'oidmap.c',
+ 'oidset.c',
+ 'oidtree.c',
+ 'pack-bitmap-write.c',
+ 'pack-bitmap.c',
+ 'pack-check.c',
+ 'pack-mtimes.c',
+ 'pack-objects.c',
+ 'pack-revindex.c',
+ 'pack-write.c',
+ 'packfile.c',
+ 'pager.c',
+ 'parallel-checkout.c',
+ 'parse.c',
+ 'parse-options-cb.c',
+ 'parse-options.c',
+ 'patch-delta.c',
+ 'patch-ids.c',
+ 'path.c',
+ 'pathspec.c',
+ 'pkt-line.c',
+ 'preload-index.c',
+ 'pretty.c',
+ 'prio-queue.c',
+ 'progress.c',
+ 'promisor-remote.c',
+ 'prompt.c',
+ 'protocol.c',
+ 'protocol-caps.c',
+ 'prune-packed.c',
+ 'pseudo-merge.c',
+ 'quote.c',
+ 'range-diff.c',
+ 'reachable.c',
+ 'read-cache.c',
+ 'rebase-interactive.c',
+ 'rebase.c',
+ 'ref-filter.c',
+ 'reflog-walk.c',
+ 'reflog.c',
+ 'refs.c',
+ 'refs/debug.c',
+ 'refs/files-backend.c',
+ 'refs/reftable-backend.c',
+ 'refs/iterator.c',
+ 'refs/packed-backend.c',
+ 'refs/ref-cache.c',
+ 'refspec.c',
+ 'reftable/basics.c',
+ 'reftable/error.c',
+ 'reftable/block.c',
+ 'reftable/blocksource.c',
+ 'reftable/iter.c',
+ 'reftable/merged.c',
+ 'reftable/pq.c',
+ 'reftable/reader.c',
+ 'reftable/record.c',
+ 'reftable/stack.c',
+ 'reftable/system.c',
+ 'reftable/tree.c',
+ 'reftable/writer.c',
+ 'remote.c',
+ 'replace-object.c',
+ 'repo-settings.c',
+ 'repository.c',
+ 'rerere.c',
+ 'reset.c',
+ 'resolve-undo.c',
+ 'revision.c',
+ 'run-command.c',
+ 'send-pack.c',
+ 'sequencer.c',
+ 'serve.c',
+ 'server-info.c',
+ 'setup.c',
+ 'shallow.c',
+ 'sideband.c',
+ 'sigchain.c',
+ 'sparse-index.c',
+ 'split-index.c',
+ 'stable-qsort.c',
+ 'statinfo.c',
+ 'strbuf.c',
+ 'streaming.c',
+ 'string-list.c',
+ 'strmap.c',
+ 'strvec.c',
+ 'sub-process.c',
+ 'submodule-config.c',
+ 'submodule.c',
+ 'symlinks.c',
+ 'tag.c',
+ 'tempfile.c',
+ 'thread-utils.c',
+ 'tmp-objdir.c',
+ 'trace.c',
+ 'trace2.c',
+ 'trace2/tr2_cfg.c',
+ 'trace2/tr2_cmd_name.c',
+ 'trace2/tr2_ctr.c',
+ 'trace2/tr2_dst.c',
+ 'trace2/tr2_sid.c',
+ 'trace2/tr2_sysenv.c',
+ 'trace2/tr2_tbuf.c',
+ 'trace2/tr2_tgt_event.c',
+ 'trace2/tr2_tgt_normal.c',
+ 'trace2/tr2_tgt_perf.c',
+ 'trace2/tr2_tls.c',
+ 'trace2/tr2_tmr.c',
+ 'trailer.c',
+ 'transport-helper.c',
+ 'transport.c',
+ 'tree-diff.c',
+ 'tree-walk.c',
+ 'tree.c',
+ 'unpack-trees.c',
+ 'upload-pack.c',
+ 'url.c',
+ 'urlmatch.c',
+ 'usage.c',
+ 'userdiff.c',
+ 'utf8.c',
+ 'varint.c',
+ 'versioncmp.c',
+ 'walker.c',
+ 'wildmatch.c',
+ 'worktree.c',
+ 'wrapper.c',
+ 'write-or-die.c',
+ 'ws.c',
+ 'wt-status.c',
+ 'xdiff-interface.c',
+ 'xdiff/xdiffi.c',
+ 'xdiff/xemit.c',
+ 'xdiff/xhistogram.c',
+ 'xdiff/xmerge.c',
+ 'xdiff/xpatience.c',
+ 'xdiff/xprepare.c',
+ 'xdiff/xutils.c',
+]
+
+builtin_sources = [
+ 'builtin/add.c',
+ 'builtin/am.c',
+ 'builtin/annotate.c',
+ 'builtin/apply.c',
+ 'builtin/archive.c',
+ 'builtin/bisect.c',
+ 'builtin/blame.c',
+ 'builtin/branch.c',
+ 'builtin/bugreport.c',
+ 'builtin/bundle.c',
+ 'builtin/cat-file.c',
+ 'builtin/check-attr.c',
+ 'builtin/check-ignore.c',
+ 'builtin/check-mailmap.c',
+ 'builtin/check-ref-format.c',
+ 'builtin/checkout--worker.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/count-objects.c',
+ 'builtin/credential-cache--daemon.c',
+ 'builtin/credential-cache.c',
+ 'builtin/credential-store.c',
+ 'builtin/credential.c',
+ 'builtin/describe.c',
+ 'builtin/diagnose.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-pack.c',
+ 'builtin/fetch.c',
+ 'builtin/fmt-merge-msg.c',
+ 'builtin/for-each-ref.c',
+ 'builtin/for-each-repo.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/help.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/mailsplit.c',
+ 'builtin/merge-base.c',
+ 'builtin/merge-file.c',
+ 'builtin/merge-index.c',
+ 'builtin/merge-ours.c',
+ 'builtin/merge-recursive.c',
+ 'builtin/merge-tree.c',
+ 'builtin/merge.c',
+ 'builtin/mktag.c',
+ 'builtin/mktree.c',
+ 'builtin/multi-pack-index.c',
+ 'builtin/mv.c',
+ 'builtin/name-rev.c',
+ 'builtin/notes.c',
+ 'builtin/pack-objects.c',
+ 'builtin/pack-redundant.c',
+ 'builtin/pack-refs.c',
+ 'builtin/patch-id.c',
+ 'builtin/prune-packed.c',
+ 'builtin/prune.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/refs.c',
+ 'builtin/remote-ext.c',
+ 'builtin/remote-fd.c',
+ 'builtin/remote.c',
+ 'builtin/repack.c',
+ 'builtin/replace.c',
+ 'builtin/replay.c',
+ '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/shortlog.c',
+ 'builtin/show-branch.c',
+ 'builtin/show-index.c',
+ 'builtin/show-ref.c',
+ 'builtin/sparse-checkout.c',
+ 'builtin/stash.c',
+ 'builtin/stripspace.c',
+ 'builtin/submodule--helper.c',
+ 'builtin/symbolic-ref.c',
+ 'builtin/tag.c',
+ 'builtin/unpack-file.c',
+ 'builtin/unpack-objects.c',
+ 'builtin/update-index.c',
+ 'builtin/update-ref.c',
+ 'builtin/update-server-info.c',
+ 'builtin/upload-archive.c',
+ 'builtin/upload-pack.c',
+ 'builtin/var.c',
+ 'builtin/verify-commit.c',
+ 'builtin/verify-pack.c',
+ 'builtin/verify-tag.c',
+ 'builtin/worktree.c',
+ 'builtin/write-tree.c',
+]
+
+libgit_sources += custom_target(
+ input: 'command-list.txt',
+ output: 'command-list.h',
+ command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ output: 'config-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-configlist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+libgit_sources += custom_target(
+ input: 'Documentation/githooks.txt',
+ output: 'hook-list.h',
+ command: [
+ shell,
+ meson.current_source_dir() + '/generate-hooklist.sh',
+ meson.current_source_dir(),
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate
+# build options to our tests.
+build_options_config = configuration_data()
+build_options_config.set('GIT_INTEROP_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_LARGE_REPO', '')
+build_options_config.set('GIT_PERF_MAKE_COMMAND', '')
+build_options_config.set('GIT_PERF_MAKE_OPTS', '')
+build_options_config.set('GIT_PERF_REPEAT_COUNT', '')
+build_options_config.set('GIT_PERF_REPO', '')
+build_options_config.set('GIT_TEST_CMP_USE_COPIED_CONTEXT', '')
+build_options_config.set('GIT_TEST_INDEX_VERSION', '')
+build_options_config.set('GIT_TEST_OPTS', '')
+build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
+build_options_config.set('GIT_TEST_UTF8_LOCALE', '')
+build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
+if get_option('sane_tool_path') != ''
+ build_options_config.set_quoted('BROKEN_PATH_FIX', 's|^\# @BROKEN_PATH_FIX@$|git_broken_path_fix "' + get_option('sane_tool_path') + '"|')
+else
+ build_options_config.set_quoted('BROKEN_PATH_FIX', '/^\# @BROKEN_PATH_FIX@$/d')
+endif
+
+test_output_directory = get_option('test_output_directory')
+if test_output_directory == ''
+ test_output_directory = meson.project_build_root() / 'test-output'
+endif
+
+# These variables are used for building libgit.a.
+libgit_c_args = [
+ '-DBINDIR="' + get_option('bindir') + '"',
+ '-DDEFAULT_EDITOR="' + get_option('default_editor') + '"',
+ '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
+ '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"',
+ '-DDEFAULT_PAGER="' + get_option('default_pager') + '"',
+ '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
+ '-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
+ '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
+ '-DGIT_EXEC_PATH="' + get_option('prefix') / get_option('libexecdir') / 'git-core"',
+ '-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
+ '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
+ '-DGIT_INFO_PATH="' + get_option('infodir') + '"',
+ '-DGIT_LOCALE_PATH="' + get_option('localedir') + '"',
+ '-DGIT_MAN_PATH="' + get_option('mandir') + '"',
+ '-DPAGER_ENV="' + get_option('pager_environment') + '"',
+ '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"',
+]
+libgit_include_directories = [ '.' ]
+libgit_dependencies = [ ]
+
+# Treat any warning level above 1 the same as we treat DEVELOPER=1 in our
+# Makefile.
+if get_option('warning_level') in ['2','3', 'everything'] and compiler.get_argument_syntax() == 'gcc'
+ foreach cflag : [
+ '-Wdeclaration-after-statement',
+ '-Wformat-security',
+ '-Wold-style-definition',
+ '-Woverflow',
+ '-Wpointer-arith',
+ '-Wstrict-prototypes',
+ '-Wunused',
+ '-Wvla',
+ '-Wwrite-strings',
+ '-fno-common',
+ '-Wtautological-constant-out-of-range-compare',
+ # If a function is public, there should be a prototype and the right
+ # header file should be included. If not, it should be static.
+ '-Wmissing-prototypes',
+ # These are disabled because we have these all over the place.
+ '-Wno-empty-body',
+ '-Wno-missing-field-initializers',
+ '-Wno-sign-compare',
+ ]
+ if compiler.has_argument(cflag)
+ libgit_c_args += cflag
+ endif
+ endforeach
+endif
+
+if get_option('b_sanitize').contains('address')
+ build_options_config.set('SANITIZE_ADDRESS', 'YesCompiledWithIt')
+else
+ build_options_config.set('SANITIZE_ADDRESS', '')
+endif
+if get_option('b_sanitize').contains('leak')
+ libgit_c_args += '-DSUPPRESS_ANNOTATED_LEAKS'
+ build_options_config.set('SANITIZE_LEAK', 'YesCompiledWithIt')
+else
+ build_options_config.set('SANITIZE_LEAK', '')
+endif
+if get_option('b_sanitize').contains('undefined')
+ libgit_c_args += '-DSHA1DC_FORCE_ALIGNED_ACCESS'
+endif
+
+executable_suffix = ''
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ executable_suffix = '.exe'
+ libgit_c_args += '-DSTRIP_EXTENSION="' + executable_suffix + '"'
+endif
+build_options_config.set_quoted('X', executable_suffix)
+
+python = import('python').find_installation('python3', required: get_option('python'))
+if python.found()
+ build_options_config.set('NO_PYTHON', '')
+else
+ libgit_c_args += '-DNO_PYTHON'
+ build_options_config.set('NO_PYTHON', '1')
+endif
+
+# Perl is used for two different things: our test harness and to provide some
+# features. It is optional if you want to neither execute tests nor use any of
+# these optional features.
+perl_required = get_option('perl')
+if get_option('tests')
+ perl_required = true
+endif
+
+# Note that we only set NO_PERL if the Perl features were disabled by the user.
+# It may not be set when we have found Perl, but only use it to run tests.
+perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required)
+perl_features_enabled = perl.found() and get_option('perl').allowed()
+if perl_features_enabled
+ build_options_config.set('NO_PERL', '')
+
+ if get_option('runtime_prefix')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ else
+ build_options_config.set_quoted('PERL_LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
+ endif
+
+ if get_option('perl_cpan_fallback')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+ else
+ build_options_config.set_quoted('NO_PERL_CPAN_FALLBACKS', 'YesPlease')
+ endif
+else
+ libgit_c_args += '-DNO_PERL'
+ build_options_config.set('NO_PERL', '1')
+ build_options_config.set('PERL_LOCALEDIR', '')
+ build_options_config.set('NO_PERL_CPAN_FALLBACKS', '')
+endif
+
+zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled'])
+if zlib.version().version_compare('<1.2.0')
+ libgit_c_args += '-DNO_DEFLATE_BOUND'
+endif
+libgit_dependencies += zlib
+
+threads = dependency('threads', required: false)
+if threads.found()
+ libgit_dependencies += threads
+ build_options_config.set('NO_PTHREADS', '')
+else
+ libgit_c_args += '-DNO_PTHREADS'
+ build_options_config.set('NO_PTHREADS', '1')
+endif
+
+msgfmt = find_program('msgfmt', dirs: program_path, required: false)
+gettext_option = get_option('gettext').disable_auto_if(not msgfmt.found())
+if not msgfmt.found() and gettext_option.enabled()
+ error('Internationalization via libintl requires msgfmt')
+endif
+
+if gettext_option.allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext')
+ if host_machine.cpu_family() == 'x86_64'
+ libintl_prefix = '/usr/local'
+ elif host_machine.cpu_family() == 'aarch64'
+ libintl_prefix = '/opt/homebrew'
+ else
+ error('Homebrew workaround not supported on current architecture')
+ endif
+
+ intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: gettext_option)
+ if intl.found()
+ intl = declare_dependency(
+ dependencies: intl,
+ include_directories: libintl_prefix / 'include',
+ )
+ endif
+else
+ intl = dependency('intl', required: gettext_option)
+endif
+if intl.found()
+ libgit_dependencies += intl
+ build_options_config.set('NO_GETTEXT', '')
+ build_options_config.set('USE_GETTEXT_SCHEME', '')
+
+ # POSIX nowadays requires `nl_langinfo()`, but some systems still don't have
+ # the function available. On such systems we instead fall back to libcharset.
+ # On native Windows systems we use our own emulation.
+ if host_machine.system() != 'windows' and not compiler.has_function('nl_langinfo')
+ libcharset = compiler.find_library('charset', required: true)
+ libgit_dependencies += libcharset
+ libgit_c_args += '-DHAVE_LIBCHARSET_H'
+ endif
+else
+ libgit_c_args += '-DNO_GETTEXT'
+ build_options_config.set('NO_GETTEXT', '1')
+ build_options_config.set('USE_GETTEXT_SCHEME', 'fallthrough')
+endif
+
+iconv = dependency('iconv', required: get_option('iconv'))
+if iconv.found()
+ libgit_dependencies += iconv
+ build_options_config.set('NO_ICONV', '')
+
+ have_old_iconv = false
+ if not compiler.compiles('''
+ #include <iconv.h>
+
+ extern size_t iconv(iconv_t cd,
+ char **inbuf, size_t *inbytesleft,
+ char **outbuf, size_t *outbytesleft);
+ ''', name: 'old iconv interface', dependencies: [iconv])
+ libgit_c_args += '-DOLD_ICONV'
+ have_old_iconv = true
+ endif
+
+ iconv_omits_bom_source = '''#
+ #include <iconv.h>
+
+ int main(int argc, const char **argv)
+ {
+ '''
+ if have_old_iconv
+ iconv_omits_bom_source += '''
+ typedef const char *iconv_ibp;
+ '''
+ else
+ iconv_omits_bom_source += '''
+ typedef char *iconv_ibp;
+ '''
+ endif
+ iconv_omits_bom_source += '''
+ int v;
+ iconv_t conv;
+ char in[] = "a"; iconv_ibp pin = in;
+ char out[20] = ""; char *pout = out;
+ size_t isz = sizeof in;
+ size_t osz = sizeof out;
+
+ conv = iconv_open("UTF-16", "UTF-8");
+ iconv(conv, &pin, &isz, &pout, &osz);
+ iconv_close(conv);
+ v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
+ return v != 0xfe + 0xff;
+ }
+ '''
+
+ if compiler.run(iconv_omits_bom_source,
+ dependencies: iconv,
+ name: 'iconv omits BOM',
+ ).returncode() != 0
+ libgit_c_args += '-DICONV_OMITS_BOM'
+ endif
+else
+ libgit_c_args += '-DNO_ICONV'
+ build_options_config.set('NO_ICONV', '1')
+endif
+
+pcre2 = dependency('libpcre2-8', required: get_option('pcre2'), default_options: ['default_library=static', 'test=false'])
+if pcre2.found()
+ libgit_dependencies += pcre2
+ libgit_c_args += '-DUSE_LIBPCRE2'
+ build_options_config.set('USE_LIBPCRE2', '1')
+else
+ build_options_config.set('USE_LIBPCRE2', '')
+endif
+
+curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled', 'tool=disabled'])
+use_curl_for_imap_send = false
+if curl.found()
+ if curl.version().version_compare('>=7.34.0')
+ libgit_c_args += '-DUSE_CURL_FOR_IMAP_SEND'
+ use_curl_for_imap_send = true
+ endif
+
+ libgit_dependencies += curl
+ libgit_c_args += '-DCURL_DISABLE_TYPECHECK'
+ build_options_config.set('NO_CURL', '')
+else
+ libgit_c_args += '-DNO_CURL'
+ build_options_config.set('NO_CURL', '1')
+endif
+
+expat = dependency('expat', required: get_option('expat'), default_options: ['default_library=static', 'build_tests=false'])
+if expat.found()
+ libgit_dependencies += expat
+
+ if expat.version().version_compare('<=1.2')
+ libgit_c_args += '-DEXPAT_NEEDS_XMLPARSE_H'
+ endif
+ build_options_config.set('NO_EXPAT', '')
+else
+ libgit_c_args += '-DNO_EXPAT'
+ build_options_config.set('NO_EXPAT', '1')
+endif
+
+if not compiler.has_header('sys/select.h')
+ libgit_c_args += '-DNO_SYS_SELECT_H'
+endif
+
+has_poll_h = compiler.has_header('poll.h')
+if not has_poll_h
+ libgit_c_args += '-DNO_POLL_H'
+endif
+
+has_sys_poll_h = compiler.has_header('sys/poll.h')
+if not has_sys_poll_h
+ libgit_c_args += '-DNO_SYS_POLL_H'
+endif
+
+if not has_poll_h and not has_sys_poll_h
+ libgit_c_args += '-DNO_POLL'
+ libgit_sources += 'compat/poll/poll.c'
+ libgit_include_directories += 'compat/poll'
+endif
+
+if not compiler.has_header('inttypes.h')
+ libgit_c_args += '-DNO_INTTYPES_H'
+endif
+
+if compiler.has_header('alloca.h')
+ libgit_c_args += '-DHAVE_ALLOCA_H'
+endif
+
+if compiler.has_header('sys/sysinfo.h')
+ libgit_c_args += '-DHAVE_SYSINFO'
+endif
+
+# Windows has libgen.h and a basename implementation, but we still need our own
+# implementation to threat things like drive prefixes specially.
+if host_machine.system() == 'windows' or not compiler.has_header('libgen.h')
+ libgit_c_args += '-DNO_LIBGEN_H'
+ libgit_sources += 'compat/basename.c'
+endif
+
+if compiler.has_header('paths.h')
+ libgit_c_args += '-DHAVE_PATHS_H'
+endif
+
+if compiler.has_header('strings.h')
+ libgit_c_args += '-DHAVE_STRINGS_H'
+endif
+
+networking_dependencies = [ ]
+if host_machine.system() == 'windows'
+ winsock = compiler.find_library('ws2_32', required: false)
+ if winsock.found()
+ networking_dependencies += winsock
+ endif
+else
+ libresolv = compiler.find_library('resolv', required: false)
+ if libresolv.found()
+ networking_dependencies += libresolv
+ endif
+endif
+libgit_dependencies += networking_dependencies
+
+foreach symbol : ['inet_ntop', 'inet_pton', 'strerror']
+ if not compiler.has_function(symbol, dependencies: networking_dependencies)
+ libgit_c_args += '-DNO_' + symbol.to_upper()
+ endif
+endforeach
+
+has_ipv6 = compiler.has_function('getaddrinfo', dependencies: networking_dependencies)
+if not has_ipv6
+ libgit_c_args += '-DNO_IPV6'
+endif
+
+if not compiler.compiles('''
+ #ifdef _WIN32
+ # include <winsock2.h>
+ #else
+ # include <sys/types.h>
+ # include <sys/socket.h>
+ #endif
+
+ void func(void)
+ {
+ struct sockaddr_storage x;
+ }
+''', name: 'struct sockaddr_storage')
+ if has_ipv6
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in6'
+ else
+ libgit_c_args += '-Dsockaddr_storage=sockaddr_in'
+ endif
+endif
+
+if compiler.has_function('socket', dependencies: networking_dependencies)
+ libgit_sources += [
+ 'unix-socket.c',
+ 'unix-stream-server.c',
+ ]
+ build_options_config.set('NO_UNIX_SOCKETS', '')
+else
+ libgit_c_args += '-DNO_UNIX_SOCKETS'
+ build_options_config.set('NO_UNIX_SOCKETS', '1')
+endif
+
+if not compiler.has_function('pread')
+ libgit_c_args += '-DNO_PREAD'
+ libgit_sources += 'compat/pread.c'
+endif
+
+if host_machine.system() == 'darwin'
+ libgit_sources += 'compat/precompose_utf8.c'
+ libgit_c_args += '-DPRECOMPOSE_UNICODE'
+ libgit_c_args += '-DPROTECT_HFS_DEFAULT'
+endif
+
+# Configure general compatibility wrappers.
+if host_machine.system() == 'cygwin'
+ libgit_sources += [
+ 'compat/win32/path-utils.c',
+ ]
+elif host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/mingw.c',
+ 'compat/winansi.c',
+ 'compat/win32/flush.c',
+ 'compat/win32/path-utils.c',
+ 'compat/win32/pthread.c',
+ 'compat/win32/syslog.c',
+ 'compat/win32/dirent.c',
+ 'compat/win32mmap.c',
+ 'compat/nedmalloc/nedmalloc.c',
+ ]
+
+ libgit_c_args += [
+ '-DDETECT_MSYS_TTY',
+ '-DENSURE_MSYSTEM_IS_SET',
+ '-DNATIVE_CRLF',
+ '-DNOGDI',
+ '-DNO_POSIX_GOODIES',
+ '-DWIN32',
+ '-D_CONSOLE',
+ '-D_CONSOLE_DETECT_MSYS_TTY',
+ '-D__USE_MINGW_ANSI_STDIO=0',
+ ]
+
+ libgit_dependencies += compiler.find_library('ntdll')
+ libgit_include_directories += 'compat/win32'
+ if compiler.get_id() == 'msvc'
+ libgit_include_directories += 'compat/vcbuild/include'
+ endif
+endif
+
+if host_machine.system() == 'linux'
+ libgit_sources += 'compat/linux/procinfo.c'
+elif host_machine.system() == 'windows'
+ libgit_sources += 'compat/win32/trace2_win32_process_info.c'
+else
+ libgit_sources += 'compat/stub/procinfo.c'
+endif
+
+if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
+ libgit_c_args += [
+ '-DUNRELIABLE_FSTAT',
+ '-DMMAP_PREVENTS_DELETE',
+ '-DOBJECT_CREATION_MODE=1',
+ ]
+endif
+
+# Configure the simple-ipc subsystem required fro the fsmonitor.
+if host_machine.system() == 'windows'
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-win32.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+else
+ libgit_sources += [
+ 'compat/simple-ipc/ipc-shared.c',
+ 'compat/simple-ipc/ipc-unix-socket.c',
+ ]
+ libgit_c_args += '-DSUPPORTS_SIMPLE_IPC'
+endif
+
+fsmonitor_backend = ''
+if host_machine.system() == 'windows'
+ fsmonitor_backend = 'win32'
+elif host_machine.system() == 'darwin'
+ fsmonitor_backend = 'darwin'
+ libgit_dependencies += dependency('CoreServices')
+endif
+if fsmonitor_backend != ''
+ libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND'
+ libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS'
+
+ libgit_sources += [
+ 'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c',
+ 'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c',
+ ]
+endif
+build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend)
+build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend)
+
+if not get_option('b_sanitize').contains('address') and get_option('regex').allowed() and compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include <regex.h>') != ''
+ build_options_config.set('NO_REGEX', '')
+
+ if compiler.get_define('REG_ENHANCED', prefix: '#include <regex.h>') != ''
+ libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS'
+ libgit_sources += 'compat/regcomp_enhanced.c'
+ endif
+elif not get_option('regex').enabled()
+ libgit_c_args += [
+ '-DNO_REGEX',
+ '-DGAWK',
+ '-DNO_MBSUPPORT',
+ ]
+ build_options_config.set('NO_REGEX', '1')
+ libgit_sources += 'compat/regex/regex.c'
+ libgit_include_directories += 'compat/regex'
+else
+ error('Native regex support requested but not found')
+endif
+
+# setitimer and friends are provided by compat/mingw.c.
+if host_machine.system() != 'windows'
+ if not compiler.compiles('''
+ #include <sys/time.h>
+ void func(void)
+ {
+ struct itimerval value;
+ }
+ ''', name: 'struct itimerval')
+ libgit_c_args += '-DNO_STRUCT_ITIMERVAL'
+ libgit_c_args += '-DNO_SETITIMER'
+ elif not compiler.has_function('setitimer')
+ libgit_c_args += '-DNO_SETITIMER'
+ endif
+endif
+
+if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DUSE_ST_TIMESPEC'
+elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_NSEC'
+endif
+
+if not compiler.has_member('struct stat', 'st_blocks', prefix: '#include <sys/stat.h>')
+ libgit_c_args += '-DNO_ST_BLOCKS_IN_STRUCT_STAT'
+endif
+
+if not compiler.has_member('struct dirent', 'd_type', prefix: '#include <dirent.h>')
+ libgit_c_args += '-DNO_D_TYPE_IN_DIRENT'
+endif
+
+if not compiler.has_member('struct passwd', 'pw_gecos', prefix: '#include <pwd.h>')
+ libgit_c_args += '-DNO_GECOS_IN_PWENT'
+endif
+
+if compiler.has_function('sync_file_range')
+ libgit_c_args += '-DHAVE_SYNC_FILE_RANGE'
+endif
+
+if not compiler.has_function('strcasestr')
+ libgit_c_args += '-DNO_STRCASESTR'
+ libgit_sources += 'compat/strcasestr.c'
+endif
+
+if not compiler.has_function('memmem')
+ libgit_c_args += '-DNO_MEMMEM'
+ libgit_sources += 'compat/memmem.c'
+endif
+
+if not compiler.has_function('strlcpy')
+ libgit_c_args += '-DNO_STRLCPY'
+ libgit_sources += 'compat/strlcpy.c'
+endif
+
+if not compiler.has_function('strdup')
+ libgit_c_args += '-DOVERRIDE_STRDUP'
+ libgit_sources += 'compat/strdup.c'
+endif
+
+if not compiler.has_function('strtoumax')
+ libgit_c_args += '-DNO_STRTOUMAX'
+ libgit_sources += [
+ 'compat/strtoumax.c',
+ 'compat/strtoimax.c',
+ ]
+endif
+
+if not compiler.has_function('strtoull')
+ libgit_c_args += '-DNO_STRTOULL'
+endif
+
+if not compiler.has_function('setenv')
+ libgit_c_args += '-DNO_SETENV'
+ libgit_sources += 'compat/setenv.c'
+endif
+
+if not compiler.has_function('qsort')
+ libgit_c_args += '-DINTERNAL_QSORT'
+endif
+libgit_sources += 'compat/qsort_s.c'
+
+# unsetenv is provided by compat/mingw.c.
+if host_machine.system() != 'windows' and not compiler.has_function('unsetenv')
+ libgit_c_args += '-DNO_UNSETENV'
+ libgit_sources += 'compat/unsetenv.c'
+endif
+
+if not compiler.has_function('mkdtemp')
+ libgit_c_args += '-DNO_MKDTEMP'
+ libgit_sources += 'compat/mkdtemp.c'
+endif
+
+if not compiler.has_function('initgroups')
+ libgit_c_args += '-DNO_INITGROUPS'
+endif
+
+if compiler.has_function('getdelim')
+ libgit_c_args += '-DHAVE_GETDELIM'
+endif
+
+if host_machine.system() == 'windows'
+ libgit_c_args += '-DUSE_WIN32_MMAP'
+elif not compiler.has_function('mmap')
+ libgit_c_args += '-DNO_MMAP'
+ libgit_sources += 'compat/mmap.c'
+endif
+
+if compiler.has_function('clock_gettime')
+ libgit_c_args += '-DHAVE_CLOCK_GETTIME'
+endif
+
+if compiler.compiles('''
+ #include <time.h>
+
+ void func(void)
+ {
+ clockid_t id = CLOCK_MONOTONIC;
+ }
+''', name: 'monotonic clock')
+ libgit_c_args += '-DHAVE_CLOCK_MONOTONIC'
+endif
+
+if not compiler.compiles('''
+ #include <inttypes.h>
+
+ void func(void)
+ {
+ uintmax_t x = 0;
+ }
+''', name: 'uintmax_t')
+ libgit_c_args += '-DNO_UINTMAX_T'
+endif
+
+has_bsd_sysctl = false
+if compiler.has_header('sys/sysctl.h')
+ if compiler.compiles('''
+ #include <stddef.h>
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ int val, mib[2] = { 0 };
+ size_t len = sizeof(val);
+ sysctl(mib, 2, &val, &len, NULL, 0);
+ }
+ ''', name: 'BSD sysctl')
+ libgit_c_args += '-DHAVE_BSD_SYSCTL'
+ has_bsd_sysctl = true
+ endif
+endif
+
+if not meson.is_cross_build() and compiler.run('''
+ #include <stdio.h>
+
+ int main(int argc, const char **argv)
+ {
+ FILE *f = fopen(".", "r");
+ return f ? 0 : 1;
+ }
+''', name: 'fread reads directories').returncode() == 0
+ libgit_c_args += '-DFREAD_READS_DIRECTORIES'
+ libgit_sources += 'compat/fopen.c'
+endif
+
+if not meson.is_cross_build() and fs.exists('/dev/tty')
+ libgit_c_args += '-DHAVE_DEV_TTY'
+endif
+
+https_backend = get_option('https_backend')
+
+security_framework = dependency('Security', required: https_backend == 'CommonCrypto')
+core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
+if https_backend == 'auto' and security_framework.found()
+ https_backend = 'CommonCrypto'
+endif
+
+openssl_required = https_backend == 'openssl' or get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
+openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
+if https_backend == 'auto' and openssl.found()
+ https_backend = 'openssl'
+endif
+
+if https_backend == 'CommonCrypto'
+ libgit_dependencies += security_framework
+ libgit_dependencies += core_foundation_framework
+ libgit_c_args += '-DAPPLE_COMMON_CRYPTO'
+elif https_backend == 'openssl'
+ libgit_dependencies += openssl
+else
+ # We either couldn't find any dependencies with 'auto' or the user requested
+ # 'none'. Both cases are benign.
+endif
+
+if https_backend != 'openssl'
+ libgit_c_args += '-DNO_OPENSSL'
+endif
+
+sha1_backend = get_option('sha1_backend')
+if sha1_backend == 'sha1dc'
+ libgit_c_args += '-DSHA1_DC'
+ libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1'
+ libgit_c_args += '-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="git-compat-util.h"'
+ libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h"'
+
+ libgit_sources += [
+ 'sha1dc_git.c',
+ 'sha1dc/sha1.c',
+ 'sha1dc/ubc_check.c',
+ ]
+elif sha1_backend == 'common-crypto'
+ libgit_c_args += '-DCOMMON_DIGEST_FOR_OPENSSL'
+ libgit_c_args += '-DSHA1_APPLE'
+ # Apple CommonCrypto requires chunking
+ libgit_c_args += '-DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L'
+elif sha1_backend == 'openssl'
+ libgit_c_args += '-DSHA1_OPENSSL'
+ libgit_dependencies += openssl
+elif sha1_backend == 'block'
+ libgit_c_args += '-DSHA1_BLK'
+ libgit_sources += 'block-sha1/sha1.c'
+else
+ error('Unhandled SHA1 backend ' + sha1_backend)
+endif
+
+sha256_backend = get_option('sha256_backend')
+if sha256_backend == 'openssl'
+ libgit_c_args += '-DSHA256_OPENSSL'
+ libgit_dependencies += openssl
+elif sha256_backend == 'nettle'
+ nettle = dependency('nettle')
+ libgit_dependencies += nettle
+ libgit_c_args += '-DSHA256_NETTLE'
+elif sha256_backend == 'gcrypt'
+ gcrypt = dependency('gcrypt')
+ libgit_dependencies += gcrypt
+ libgit_c_args += '-DSHA256_GCRYPT'
+elif sha256_backend == 'block'
+ libgit_c_args += '-DSHA256_BLK'
+ libgit_sources += 'sha256/block/sha256.c'
+else
+ error('Unhandled SHA256 backend ' + sha256_backend)
+endif
+
+if compiler.has_header_symbol('stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM'
+elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf')
+ libgit_c_args += '-DHAVE_ARC4RANDOM_BSD'
+elif compiler.has_function('getrandom', prefix: '#include <sys/random.h>')
+ libgit_c_args += '-DHAVE_GETRANDOM'
+elif compiler.has_function('getentropy', prefix: '#include <unistd.h>')
+ libgit_c_args += '-DHAVE_GETENTROPY'
+elif compiler.has_function('RtlGenRandom', prefix: '#include <windows.h>\n#include <ntsecapi.h>')
+ libgit_c_args += '-DHAVE_RTLGENRANDOM'
+elif openssl.found()
+ libgit_c_args += '-DHAVE_OPENSSL_CSPRNG'
+endif
+
+if get_option('runtime_prefix')
+ libgit_c_args += '-DRUNTIME_PREFIX'
+ build_options_config.set('RUNTIME_PREFIX', 'true')
+
+ if compiler.has_header('mach-o/dyld.h')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if has_bsd_sysctl and compiler.compiles('''
+ #include <sys/sysctl.h>
+
+ void func(void)
+ {
+ KERN_PROC_PATHNAME; KERN_PROC;
+ }
+ ''', name: 'BSD KERN_PROC_PATHNAME')
+ libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
+ endif
+
+ if host_machine.system() == 'linux'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe' + '"'
+ elif host_machine.system() == 'openbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/file' + '"'
+ elif host_machine.system() == 'netbsd'
+ libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/exe' + '"'
+ endif
+
+ if host_machine.system() == 'windows' and compiler.compiles('''
+ #include <stdlib.h>
+
+ void func(void)
+ {
+ _wpgmptr;
+ }
+ ''', name: 'Win32 _wpgmptr')
+ libgit_c_args += '-DHAVE_WPGMPTR'
+ endif
+else
+ build_options_config.set('RUNTIME_PREFIX', 'false')
+endif
+
+foreach key, value : {
+ 'DIFF': diff.full_path(),
+ 'GIT_TEST_CMP': diff.full_path() + ' -u',
+ 'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl',
+ 'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools',
+ 'GIT_TEST_POPATH': meson.project_source_root() / 'po',
+ 'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates',
+ 'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po',
+ 'PAGER_ENV': get_option('pager_environment'),
+ 'PERL_PATH': perl.found() ? perl.full_path() : '',
+ 'PYTHON_PATH': python.found () ? python.full_path() : '',
+ 'SHELL_PATH': shell.full_path(),
+ 'TAR': tar.full_path(),
+ 'TEST_OUTPUT_DIRECTORY': test_output_directory,
+ 'TEST_SHELL_PATH': shell.full_path(),
+}
+ if value != '' and cygpath.found()
+ value = run_command(cygpath, value, check: true).stdout().strip()
+ endif
+ build_options_config.set_quoted(key, value)
+endforeach
+
+configure_file(
+ input: 'GIT-BUILD-OPTIONS.in',
+ output: 'GIT-BUILD-OPTIONS',
+ configuration: build_options_config,
+)
+
+git_version_file = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'GIT-VERSION-FILE.in',
+ output: 'GIT-VERSION-FILE',
+ build_always_stale: true,
+)
+
+version_def_h = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'version-def.h.in',
+ output: 'version-def.h',
+ # Depend on GIT-VERSION-FILE so that we don't always try to rebuild this
+ # target for the same commit.
+ depends: [git_version_file],
+)
+
+# Build a separate library for "version.c" so that we do not have to rebuild
+# everything when the current Git commit changes.
+libgit_version_library = static_library('git-version',
+ sources: [
+ 'version.c',
+ version_def_h,
+ ],
+ c_args: libgit_c_args,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit_library = static_library('git',
+ sources: libgit_sources,
+ c_args: libgit_c_args,
+ link_with: libgit_version_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+libgit = declare_dependency(
+ compile_args: libgit_c_args,
+ link_with: libgit_library,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+
+common_main_sources = ['common-main.c']
+common_main_link_args = [ ]
+if host_machine.system() == 'windows'
+ git_rc = custom_target(
+ command: [
+ shell,
+ meson.current_source_dir() / 'GIT-VERSION-GEN',
+ meson.current_source_dir(),
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ input: meson.current_source_dir() / 'git.rc.in',
+ output: 'git.rc',
+ depends: [git_version_file],
+ )
+
+ common_main_sources += import('windows').compile_resources(git_rc,
+ include_directories: [meson.current_source_dir()],
+ )
+ if compiler.get_argument_syntax() == 'gcc'
+ common_main_link_args += [
+ '-municode',
+ '-Wl,-nxcompat',
+ '-Wl,-dynamicbase',
+ '-Wl,-pic-executable,-e,mainCRTStartup',
+ ]
+ elif compiler.get_argument_syntax() == 'msvc'
+ common_main_link_args += [
+ '/ENTRY:wmainCRTStartup',
+ 'invalidcontinue.obj',
+ ]
+ else
+ error('Unsupported compiler ' + compiler.get_id())
+ endif
+endif
+common_main_library = static_library('common-main',
+ sources: common_main_sources,
+ c_args: libgit_c_args,
+ dependencies: libgit_dependencies,
+ include_directories: libgit_include_directories,
+)
+common_main = declare_dependency(
+ link_with: common_main_library,
+ link_args: common_main_link_args,
+)
+
+bin_wrappers = [ ]
+test_dependencies = [ ]
+
+git = executable('git',
+ sources: builtin_sources + 'git.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+bin_wrappers += git
+
+test_dependencies += executable('git-daemon',
+ sources: 'daemon.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-sh-i18n--envsubst',
+ sources: 'sh-i18n--envsubst.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('git-shell',
+ sources: 'shell.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+test_dependencies += executable('git-http-backend',
+ sources: 'http-backend.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+bin_wrappers += executable('scalar',
+ sources: 'scalar.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+if get_option('curl').enabled()
+ curl_sources = [
+ 'http.c',
+ 'http-walker.c',
+ ]
+
+ git_remote_http = executable('git-remote-http',
+ sources: curl_sources + 'remote-curl.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ test_dependencies += git_remote_http
+
+ test_dependencies += executable('git-http-fetch',
+ sources: curl_sources + 'http-fetch.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+
+ if expat.found()
+ test_dependencies += executable('git-http-push',
+ sources: curl_sources + 'http-push.c',
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ endif
+
+ foreach alias : [ 'git-remote-https', 'git-remote-ftp', 'git-remote-ftps' ]
+ test_dependencies += executable(alias,
+ objects: git_remote_http.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git-remote-http',
+ )
+ endforeach
+endif
+
+imap_send_sources = ['imap-send.c']
+if use_curl_for_imap_send
+ imap_send_sources += curl_sources
+endif
+
+test_dependencies += executable('git-imap-send',
+ sources: imap_send_sources,
+ dependencies: [libgit, common_main],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+)
+
+foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ]
+ bin_wrappers += executable(alias,
+ objects: git.extract_all_objects(recursive: false),
+ dependencies: [libgit, common_main],
+ )
+
+ install_symlink(alias + executable_suffix,
+ install_dir: get_option('libexecdir') / 'git-core',
+ pointing_to: 'git',
+ )
+endforeach
+
+foreach symlink : [
+ 'git',
+ 'git-receive-pack',
+ 'git-shell',
+ 'git-upload-archive',
+ 'git-upload-pack',
+ 'scalar',
+]
+ if meson.version().version_compare('>=1.3.0')
+ pointing_to = fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir'))
+ else
+ pointing_to = '../libexec/git-core' / symlink
+ endif
+
+ install_symlink(symlink,
+ install_dir: get_option('bindir'),
+ pointing_to: pointing_to,
+ )
+endforeach
+
+scripts_sh = [
+ 'git-difftool--helper.sh',
+ 'git-filter-branch.sh',
+ 'git-merge-octopus.sh',
+ 'git-merge-one-file.sh',
+ 'git-merge-resolve.sh',
+ 'git-mergetool--lib.sh',
+ 'git-mergetool.sh',
+ 'git-quiltimport.sh',
+ 'git-request-pull.sh',
+ 'git-sh-i18n.sh',
+ 'git-sh-setup.sh',
+ 'git-submodule.sh',
+ 'git-web--browse.sh',
+]
+if perl_features_enabled
+ scripts_sh += 'git-instaweb.sh'
+endif
+
+foreach script : scripts_sh
+ test_dependencies += custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-script.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+endforeach
+
+if perl_features_enabled
+ scripts_perl = [
+ 'git-archimport.perl',
+ 'git-cvsexportcommit.perl',
+ 'git-cvsimport.perl',
+ 'git-cvsserver.perl',
+ 'git-send-email.perl',
+ 'git-svn.perl',
+ ]
+
+ pathsep = ':'
+ if host_machine.system() == 'windows'
+ pathsep = ';'
+ endif
+
+ perl_header_template = 'perl/header_templates/fixed_prefix.template.pl'
+ if get_option('runtime_prefix')
+ perl_header_template = 'perl/header_templates/runtime_prefix.template.pl'
+ endif
+
+ perl_header = configure_file(
+ input: perl_header_template,
+ output: 'GIT-PERL-HEADER',
+ configuration: {
+ 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core',
+ 'PERLLIBDIR_REL': get_option('datadir') / 'perl5',
+ 'LOCALEDIR_REL': get_option('datadir') / 'locale',
+ 'INSTLIBDIR': get_option('datadir') / 'perl5',
+ 'PATHSEP': pathsep,
+ },
+ )
+
+ generate_perl_command = [
+ shell,
+ meson.project_source_root() / 'generate-perl.sh',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ git_version_file.full_path(),
+ perl_header,
+ '@INPUT@',
+ '@OUTPUT@',
+ ]
+
+ foreach script : scripts_perl
+ generated_script = custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ depends: [git_version_file],
+ )
+ test_dependencies += generated_script
+
+ if script == 'git-cvsserver.perl'
+ bin_wrappers += generated_script
+
+ if meson.version().version_compare('>=1.3.0')
+ pointing_to = fs.relative_to(get_option('libexecdir') / 'git-core' / fs.stem(script), get_option('bindir'))
+ else
+ pointing_to = '../libexec/git-core' / fs.stem(script)
+ endif
+
+ install_symlink(fs.stem(script),
+ install_dir: get_option('bindir'),
+ pointing_to: pointing_to,
+ )
+ endif
+ endforeach
+
+ subdir('perl')
+endif
+
+if python.found()
+ scripts_python = [
+ 'git-p4.py'
+ ]
+
+ foreach script : scripts_python
+ generated_python = custom_target(
+ input: script,
+ output: fs.stem(script),
+ command: [
+ shell,
+ meson.project_source_root() / 'generate-python.sh',
+ meson.project_build_root() / 'GIT-BUILD-OPTIONS',
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ install: true,
+ install_dir: get_option('libexecdir') / 'git-core',
+ )
+ test_dependencies += generated_python
+ endforeach
+endif
+
+mergetools = [
+ 'mergetools/araxis',
+ 'mergetools/bc',
+ 'mergetools/codecompare',
+ 'mergetools/deltawalker',
+ 'mergetools/diffmerge',
+ 'mergetools/diffuse',
+ 'mergetools/ecmerge',
+ 'mergetools/emerge',
+ 'mergetools/examdiff',
+ 'mergetools/guiffy',
+ 'mergetools/gvimdiff',
+ 'mergetools/kdiff3',
+ 'mergetools/kompare',
+ 'mergetools/meld',
+ 'mergetools/nvimdiff',
+ 'mergetools/opendiff',
+ 'mergetools/p4merge',
+ 'mergetools/smerge',
+ 'mergetools/tkdiff',
+ 'mergetools/tortoisemerge',
+ 'mergetools/vimdiff',
+ 'mergetools/vscode',
+ 'mergetools/winmerge',
+ 'mergetools/xxdiff',
+]
+
+foreach mergetool : mergetools
+ install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools')
+endforeach
+
+if intl.found()
+ subdir('po')
+endif
+subdir('contrib')
+subdir('gitweb')
+subdir('templates')
+
+# Everything but the bin-wrappers need to come before this target such that we
+# can properly set up test dependencies. The bin-wrappers themselves are set up
+# at configuration time, so these are fine.
+if get_option('tests')
+ subdir('t')
+endif
+
+subdir('bin-wrappers')
+if get_option('docs') != []
+ subdir('Documentation')
+endif
+
+summary({
+ 'curl': curl.found(),
+ 'expat': expat.found(),
+ 'gettext': intl.found(),
+ 'https': https_backend,
+ 'iconv': iconv.found(),
+ 'pcre2': pcre2.found(),
+ 'perl': perl_features_enabled,
+ 'python': python.found(),
+}, section: 'Auto-detected features')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000000..32a72139ba
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,81 @@
+# Configuration for how Git behaves at runtime.
+option('default_pager', type: 'string', value: 'less',
+ description: 'Fall-back pager.')
+option('default_editor', type: 'string', value: 'vi',
+ description: 'Fall-back editor.')
+option('gitconfig', type: 'string', value: '/etc/gitconfig',
+ description: 'Path to the global git configuration file.')
+option('gitattributes', type: 'string', value: '/etc/gitattributes',
+ description: 'Path to the global git attributes file.')
+option('pager_environment', type: 'string', value: 'LESS=FRX LV=-c',
+ description: 'Environment used when spawning the pager')
+option('perl_cpan_fallback', type: 'boolean', value: true,
+ description: 'Install bundled copies of CPAN modules that serve as a fallback in case the modules are not available on the system.')
+option('runtime_prefix', type: 'boolean', value: false,
+ description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.')
+option('sane_tool_path', type: 'string', value: '',
+ description: 'A colon-separated list of paths to prepend to PATH if your tools in /usr/bin are broken.')
+
+# Features supported by Git.
+option('curl', type: 'feature', value: 'enabled',
+ description: 'Build helpers used to access remotes with the HTTP transport.')
+option('expat', type: 'feature', value: 'enabled',
+ description: 'Build helpers used to push to remotes with the HTTP transport.')
+option('gettext', type: 'feature', value: 'auto',
+ description: 'Build translation files.')
+option('iconv', type: 'feature', value: 'auto',
+ description: 'Support reencoding strings with different encodings.')
+option('pcre2', type: 'feature', value: 'enabled',
+ description: 'Support Perl-compatible regular expressions in e.g. git-grep(1).')
+option('perl', type: 'feature', value: 'auto',
+ description: 'Build tools written in Perl.')
+option('python', type: 'feature', value: 'auto',
+ description: 'Build tools written in Python.')
+option('regex', type: 'feature', value: 'auto',
+ description: 'Use the system-provided regex library instead of the bundled one.')
+
+# Backends.
+option('https_backend', type: 'combo', value: 'auto', choices: ['auto', 'openssl', 'CommonCrypto', 'none'],
+ description: 'The HTTPS backend to use when connecting to remotes.')
+option('sha1_backend', type: 'combo', choices: ['openssl', 'block', 'sha1dc', 'common-crypto'], value: 'sha1dc',
+ description: 'The backend used for hashing objects with the SHA1 object format')
+option('sha256_backend', type: 'combo', choices: ['openssl', 'nettle', 'gcrypt', 'block'], value: 'block',
+ description: 'The backend used for hashing objects with the SHA256 object format')
+
+# Build tweaks.
+option('macos_use_homebrew_gettext', type: 'boolean', value: true,
+ description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')
+
+# gitweb configuration.
+option('gitweb_config', type: 'string', value: 'gitweb_config.perl')
+option('gitweb_config_system', type: 'string', value: '/etc/gitweb.conf')
+option('gitweb_config_common', type: 'string', value: '/etc/gitweb-common.conf')
+option('gitweb_home_link_str', type: 'string', value: 'projects')
+option('gitweb_sitename', type: 'string', value: '')
+option('gitweb_projectroot', type: 'string', value: '/pub/git')
+option('gitweb_project_maxdepth', type: 'string', value: '2007')
+option('gitweb_export_ok', type: 'string', value: '')
+option('gitweb_strict_export', type: 'string', value: '')
+option('gitweb_base_url', type: 'string', value: '')
+option('gitweb_list', type: 'string', value: '')
+option('gitweb_hometext', type: 'string', value: 'indextext.html')
+option('gitweb_css', type: 'string', value: 'static/gitweb.css')
+option('gitweb_logo', type: 'string', value: 'static/git-logo.png')
+option('gitweb_favicon', type: 'string', value: 'static/git-favicon.png')
+option('gitweb_js', type: 'string', value: 'static/gitweb.js')
+option('gitweb_site_html_head_string', type: 'string', value: '')
+option('gitweb_site_header', type: 'string', value: '')
+option('gitweb_site_footer', type: 'string', value: '')
+option('highlight_bin', type: 'string', value: 'highlight')
+
+# Documentation.
+option('docs', type: 'array', choices: ['man', 'html'], value: [],
+ description: 'Which documenattion formats to build and install.')
+option('default_help_format', type: 'combo', choices: ['man', 'html'], value: 'man',
+ description: 'Default format used when executing git-help(1).')
+
+# Testing.
+option('tests', type: 'boolean', value: true,
+ description: 'Enable building tests. This requires Perl, but is separate from the "perl" option such that you can build tests without Perl features enabled.')
+option('test_output_directory', type: 'string',
+ description: 'Path to the directory used to store test outputs')
diff --git a/midx-write.c b/midx-write.c
index b3a5f6c516..bcd1d50eb0 100644
--- a/midx-write.c
+++ b/midx-write.c
@@ -1,5 +1,3 @@
-#define USE_THE_REPOSITORY_VARIABLE
-
#include "git-compat-util.h"
#include "abspath.h"
#include "config.h"
@@ -35,13 +33,13 @@ extern void clear_incremental_midx_files_ext(const char *object_dir,
extern int cmp_idx_or_pack_name(const char *idx_or_pack_name,
const char *idx_name);
-static size_t write_midx_header(struct hashfile *f,
- unsigned char num_chunks,
+static size_t write_midx_header(const struct git_hash_algo *hash_algo,
+ struct hashfile *f, unsigned char num_chunks,
uint32_t num_packs)
{
hashwrite_be32(f, MIDX_SIGNATURE);
hashwrite_u8(f, MIDX_VERSION);
- hashwrite_u8(f, oid_version(the_hash_algo));
+ hashwrite_u8(f, oid_version(hash_algo));
hashwrite_u8(f, num_chunks);
hashwrite_u8(f, 0); /* unused */
hashwrite_be32(f, num_packs);
@@ -110,6 +108,8 @@ struct write_midx_context {
uint32_t num_multi_pack_indexes_before;
struct string_list *to_include;
+
+ struct repository *repo;
};
static int should_include_pack(const struct write_midx_context *ctx,
@@ -154,7 +154,7 @@ static void add_pack_to_midx(const char *full_path, size_t full_path_len,
return;
ALLOC_GROW(ctx->info, ctx->nr + 1, ctx->alloc);
- p = add_packed_git(full_path, full_path_len, 0);
+ p = add_packed_git(ctx->repo, full_path, full_path_len, 0);
if (!p) {
warning(_("failed to add packfile '%s'"),
full_path);
@@ -480,7 +480,7 @@ static int write_midx_oid_lookup(struct hashfile *f,
void *data)
{
struct write_midx_context *ctx = data;
- unsigned char hash_len = the_hash_algo->rawsz;
+ unsigned char hash_len = ctx->repo->hash_algo->rawsz;
struct pack_midx_entry *list = ctx->entries;
uint32_t i;
@@ -605,7 +605,7 @@ static uint32_t *midx_pack_order(struct write_midx_context *ctx)
uint32_t *pack_order, base_objects = 0;
uint32_t i;
- trace2_region_enter("midx", "midx_pack_order", the_repository);
+ trace2_region_enter("midx", "midx_pack_order", ctx->repo);
if (ctx->incremental && ctx->base_midx)
base_objects = ctx->base_midx->num_objects +
@@ -640,7 +640,7 @@ static uint32_t *midx_pack_order(struct write_midx_context *ctx)
}
free(data);
- trace2_region_leave("midx", "midx_pack_order", the_repository);
+ trace2_region_leave("midx", "midx_pack_order", ctx->repo);
return pack_order;
}
@@ -651,9 +651,10 @@ static void write_midx_reverse_index(char *midx_name, unsigned char *midx_hash,
struct strbuf buf = STRBUF_INIT;
char *tmp_file;
- trace2_region_enter("midx", "write_midx_reverse_index", the_repository);
+ trace2_region_enter("midx", "write_midx_reverse_index", ctx->repo);
- strbuf_addf(&buf, "%s-%s.rev", midx_name, hash_to_hex(midx_hash));
+ strbuf_addf(&buf, "%s-%s.rev", midx_name, hash_to_hex_algop(midx_hash,
+ ctx->repo->hash_algo));
tmp_file = write_rev_file_order(NULL, ctx->pack_order, ctx->entries_nr,
midx_hash, WRITE_REV);
@@ -664,7 +665,7 @@ static void write_midx_reverse_index(char *midx_name, unsigned char *midx_hash,
strbuf_release(&buf);
free(tmp_file);
- trace2_region_leave("midx", "write_midx_reverse_index", the_repository);
+ trace2_region_leave("midx", "write_midx_reverse_index", ctx->repo);
}
static void prepare_midx_packing_data(struct packing_data *pdata,
@@ -672,10 +673,10 @@ static void prepare_midx_packing_data(struct packing_data *pdata,
{
uint32_t i;
- trace2_region_enter("midx", "prepare_midx_packing_data", the_repository);
+ trace2_region_enter("midx", "prepare_midx_packing_data", ctx->repo);
memset(pdata, 0, sizeof(struct packing_data));
- prepare_packing_data(the_repository, pdata);
+ prepare_packing_data(ctx->repo, pdata);
for (i = 0; i < ctx->entries_nr; i++) {
uint32_t pos = ctx->pack_order[i];
@@ -686,7 +687,7 @@ static void prepare_midx_packing_data(struct packing_data *pdata,
ctx->info[ctx->pack_perm[from->pack_int_id]].p);
}
- trace2_region_leave("midx", "prepare_midx_packing_data", the_repository);
+ trace2_region_leave("midx", "prepare_midx_packing_data", ctx->repo);
}
static int add_ref_to_pending(const char *refname, const char *referent UNUSED,
@@ -702,7 +703,7 @@ static int add_ref_to_pending(const char *refname, const char *referent UNUSED,
return 0;
}
- if (!peel_iterated_oid(the_repository, oid, &peeled))
+ if (!peel_iterated_oid(revs->repo, oid, &peeled))
oid = &peeled;
object = parse_object_or_die(oid, refname);
@@ -760,7 +761,7 @@ static int read_refs_snapshot(const char *refs_snapshot,
hex = &buf.buf[1];
}
- if (parse_oid_hex(hex, &oid, &end) < 0)
+ if (parse_oid_hex_algop(hex, &oid, &end, revs->repo->hash_algo) < 0)
die(_("could not parse line: %s"), buf.buf);
if (*end)
die(_("malformed line: %s"), buf.buf);
@@ -776,6 +777,7 @@ static int read_refs_snapshot(const char *refs_snapshot,
strbuf_release(&buf);
return 0;
}
+
static struct commit **find_commits_for_midx_bitmap(uint32_t *indexed_commits_nr_p,
const char *refs_snapshot,
struct write_midx_context *ctx)
@@ -783,17 +785,16 @@ static struct commit **find_commits_for_midx_bitmap(uint32_t *indexed_commits_nr
struct rev_info revs;
struct bitmap_commit_cb cb = {0};
- trace2_region_enter("midx", "find_commits_for_midx_bitmap",
- the_repository);
+ trace2_region_enter("midx", "find_commits_for_midx_bitmap", ctx->repo);
cb.ctx = ctx;
- repo_init_revisions(the_repository, &revs, NULL);
+ repo_init_revisions(ctx->repo, &revs, NULL);
if (refs_snapshot) {
read_refs_snapshot(refs_snapshot, &revs);
} else {
setup_revisions(0, NULL, &revs, NULL);
- refs_for_each_ref(get_main_ref_store(the_repository),
+ refs_for_each_ref(get_main_ref_store(ctx->repo),
add_ref_to_pending, &revs);
}
@@ -821,13 +822,12 @@ static struct commit **find_commits_for_midx_bitmap(uint32_t *indexed_commits_nr
release_revisions(&revs);
- trace2_region_leave("midx", "find_commits_for_midx_bitmap",
- the_repository);
+ trace2_region_leave("midx", "find_commits_for_midx_bitmap", ctx->repo);
return cb.commits;
}
-static int write_midx_bitmap(const char *midx_name,
+static int write_midx_bitmap(struct repository *r, const char *midx_name,
const unsigned char *midx_hash,
struct packing_data *pdata,
struct commit **commits,
@@ -840,9 +840,9 @@ static int write_midx_bitmap(const char *midx_name,
struct bitmap_writer writer;
struct pack_idx_entry **index;
char *bitmap_name = xstrfmt("%s-%s.bitmap", midx_name,
- hash_to_hex(midx_hash));
+ hash_to_hex_algop(midx_hash, r->hash_algo));
- trace2_region_enter("midx", "write_midx_bitmap", the_repository);
+ trace2_region_enter("midx", "write_midx_bitmap", r);
if (flags & MIDX_WRITE_BITMAP_HASH_CACHE)
options |= BITMAP_OPT_HASH_CACHE;
@@ -859,7 +859,7 @@ static int write_midx_bitmap(const char *midx_name,
for (i = 0; i < pdata->nr_objects; i++)
index[i] = &pdata->objects[i].idx;
- bitmap_writer_init(&writer, the_repository, pdata);
+ bitmap_writer_init(&writer, r, pdata);
bitmap_writer_show_progress(&writer, flags & MIDX_PROGRESS);
bitmap_writer_build_type_index(&writer, index);
@@ -892,7 +892,7 @@ cleanup:
free(bitmap_name);
bitmap_writer_free(&writer);
- trace2_region_leave("midx", "write_midx_bitmap", the_repository);
+ trace2_region_leave("midx", "write_midx_bitmap", r);
return ret;
}
@@ -944,7 +944,7 @@ static int fill_packs_from_midx(struct write_midx_context *ctx,
*/
if (flags & MIDX_WRITE_REV_INDEX ||
preferred_pack_name) {
- if (prepare_midx_pack(the_repository, m,
+ if (prepare_midx_pack(ctx->repo, m,
m->num_packs_in_base + i)) {
error(_("could not load pack"));
return 1;
@@ -991,9 +991,10 @@ static int link_midx_to_chain(struct multi_pack_index *m)
for (i = 0; i < ARRAY_SIZE(midx_exts); i++) {
const unsigned char *hash = get_midx_checksum(m);
- get_midx_filename_ext(&from, m->object_dir, hash,
- midx_exts[i].non_split);
- get_split_midx_filename_ext(&to, m->object_dir, hash,
+ get_midx_filename_ext(m->repo->hash_algo, &from, m->object_dir,
+ hash, midx_exts[i].non_split);
+ get_split_midx_filename_ext(m->repo->hash_algo, &to,
+ m->object_dir, hash,
midx_exts[i].split);
if (link(from.buf, to.buf) < 0 && errno != ENOENT) {
@@ -1012,9 +1013,8 @@ done:
return ret;
}
-static void clear_midx_files(const char *object_dir,
- const char **hashes,
- uint32_t hashes_nr,
+static void clear_midx_files(struct repository *r, const char *object_dir,
+ const char **hashes, uint32_t hashes_nr,
unsigned incremental)
{
/*
@@ -1039,7 +1039,7 @@ static void clear_midx_files(const char *object_dir,
}
if (incremental)
- get_midx_filename(&buf, object_dir);
+ get_midx_filename(r->hash_algo, &buf, object_dir);
else
get_midx_chain_filename(&buf, object_dir);
@@ -1049,7 +1049,7 @@ static void clear_midx_files(const char *object_dir,
strbuf_release(&buf);
}
-static int write_midx_internal(const char *object_dir,
+static int write_midx_internal(struct repository *r, const char *object_dir,
struct string_list *packs_to_include,
struct string_list *packs_to_drop,
const char *preferred_pack_name,
@@ -1070,7 +1070,9 @@ static int write_midx_internal(const char *object_dir,
const char **keep_hashes = NULL;
struct chunkfile *cf;
- trace2_region_enter("midx", "write_midx_internal", the_repository);
+ trace2_region_enter("midx", "write_midx_internal", r);
+
+ ctx.repo = r;
ctx.incremental = !!(flags & MIDX_WRITE_INCREMENTAL);
if (ctx.incremental && (flags & MIDX_WRITE_BITMAP))
@@ -1081,14 +1083,13 @@ static int write_midx_internal(const char *object_dir,
"%s/pack/multi-pack-index.d/tmp_midx_XXXXXX",
object_dir);
else
- get_midx_filename(&midx_name, object_dir);
+ get_midx_filename(r->hash_algo, &midx_name, object_dir);
if (safe_create_leading_directories(midx_name.buf))
die_errno(_("unable to create leading directories of %s"),
midx_name.buf);
if (!packs_to_include || ctx.incremental) {
- struct multi_pack_index *m = lookup_multi_pack_index(the_repository,
- object_dir);
+ struct multi_pack_index *m = lookup_multi_pack_index(r, object_dir);
if (m && !midx_checksum_valid(m)) {
warning(_("ignoring existing multi-pack-index; checksum mismatch"));
m = NULL;
@@ -1351,7 +1352,7 @@ static int write_midx_internal(const char *object_dir,
add_chunk(cf, MIDX_CHUNKID_OIDFANOUT, MIDX_CHUNK_FANOUT_SIZE,
write_midx_oid_fanout);
add_chunk(cf, MIDX_CHUNKID_OIDLOOKUP,
- st_mult(ctx.entries_nr, the_hash_algo->rawsz),
+ st_mult(ctx.entries_nr, r->hash_algo->rawsz),
write_midx_oid_lookup);
add_chunk(cf, MIDX_CHUNKID_OBJECTOFFSETS,
st_mult(ctx.entries_nr, MIDX_CHUNK_OFFSET_WIDTH),
@@ -1373,7 +1374,8 @@ static int write_midx_internal(const char *object_dir,
write_midx_bitmapped_packs);
}
- write_midx_header(f, get_num_chunks(cf), ctx.nr - dropped_packs);
+ write_midx_header(r->hash_algo, f, get_num_chunks(cf),
+ ctx.nr - dropped_packs);
write_chunkfile(cf, &ctx);
finalize_hashfile(f, midx_hash, FSYNC_COMPONENT_PACK_METADATA,
@@ -1405,7 +1407,7 @@ static int write_midx_internal(const char *object_dir,
FREE_AND_NULL(ctx.entries);
ctx.entries_nr = 0;
- if (write_midx_bitmap(midx_name.buf, midx_hash, &pdata,
+ if (write_midx_bitmap(r, midx_name.buf, midx_hash, &pdata,
commits, commits_nr, ctx.pack_order,
flags) < 0) {
error(_("could not write multi-pack bitmap"));
@@ -1438,8 +1440,8 @@ static int write_midx_internal(const char *object_dir,
if (link_midx_to_chain(ctx.base_midx) < 0)
return -1;
- get_split_midx_filename_ext(&final_midx_name, object_dir,
- midx_hash, MIDX_EXT_MIDX);
+ get_split_midx_filename_ext(r->hash_algo, &final_midx_name,
+ object_dir, midx_hash, MIDX_EXT_MIDX);
if (rename_tempfile(&incr, final_midx_name.buf) < 0) {
error_errno(_("unable to rename new multi-pack-index layer"));
@@ -1449,12 +1451,13 @@ static int write_midx_internal(const char *object_dir,
strbuf_release(&final_midx_name);
keep_hashes[ctx.num_multi_pack_indexes_before] =
- xstrdup(hash_to_hex(midx_hash));
+ xstrdup(hash_to_hex_algop(midx_hash, r->hash_algo));
for (i = 0; i < ctx.num_multi_pack_indexes_before; i++) {
uint32_t j = ctx.num_multi_pack_indexes_before - i - 1;
- keep_hashes[j] = xstrdup(hash_to_hex(get_midx_checksum(m)));
+ keep_hashes[j] = xstrdup(hash_to_hex_algop(get_midx_checksum(m),
+ r->hash_algo));
m = m->base_midx;
}
@@ -1462,16 +1465,16 @@ static int write_midx_internal(const char *object_dir,
fprintf(get_lock_file_fp(&lk), "%s\n", keep_hashes[i]);
} else {
keep_hashes[ctx.num_multi_pack_indexes_before] =
- xstrdup(hash_to_hex(midx_hash));
+ xstrdup(hash_to_hex_algop(midx_hash, r->hash_algo));
}
if (ctx.m || ctx.base_midx)
- close_object_store(the_repository->objects);
+ close_object_store(ctx.repo->objects);
if (commit_lock_file(&lk) < 0)
die_errno(_("could not write multi-pack-index"));
- clear_midx_files(object_dir, keep_hashes,
+ clear_midx_files(r, object_dir, keep_hashes,
ctx.num_multi_pack_indexes_before + 1,
ctx.incremental);
@@ -1495,27 +1498,26 @@ cleanup:
}
strbuf_release(&midx_name);
- trace2_region_leave("midx", "write_midx_internal", the_repository);
+ trace2_region_leave("midx", "write_midx_internal", r);
return result;
}
-int write_midx_file(const char *object_dir,
+int write_midx_file(struct repository *r, const char *object_dir,
const char *preferred_pack_name,
- const char *refs_snapshot,
- unsigned flags)
+ const char *refs_snapshot, unsigned flags)
{
- return write_midx_internal(object_dir, NULL, NULL, preferred_pack_name,
- refs_snapshot, flags);
+ return write_midx_internal(r, object_dir, NULL, NULL,
+ preferred_pack_name, refs_snapshot,
+ flags);
}
-int write_midx_file_only(const char *object_dir,
+int write_midx_file_only(struct repository *r, const char *object_dir,
struct string_list *packs_to_include,
const char *preferred_pack_name,
- const char *refs_snapshot,
- unsigned flags)
+ const char *refs_snapshot, unsigned flags)
{
- return write_midx_internal(object_dir, packs_to_include, NULL,
+ return write_midx_internal(r, object_dir, packs_to_include, NULL,
preferred_pack_name, refs_snapshot, flags);
}
@@ -1572,7 +1574,8 @@ int expire_midx_packs(struct repository *r, const char *object_dir, unsigned fla
free(count);
if (packs_to_drop.nr)
- result = write_midx_internal(object_dir, NULL, &packs_to_drop, NULL, NULL, flags);
+ result = write_midx_internal(r, object_dir, NULL,
+ &packs_to_drop, NULL, NULL, flags);
string_list_clear(&packs_to_drop, 0);
@@ -1769,7 +1772,8 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
goto cleanup;
}
- result = write_midx_internal(object_dir, NULL, NULL, NULL, NULL, flags);
+ result = write_midx_internal(r, object_dir, NULL, NULL, NULL, NULL,
+ flags);
cleanup:
free(include_pack);
diff --git a/midx.c b/midx.c
index e82d4f2e65..e0eae1c25e 100644
--- a/midx.c
+++ b/midx.c
@@ -1,5 +1,3 @@
-#define USE_THE_REPOSITORY_VARIABLE
-
#include "git-compat-util.h"
#include "config.h"
#include "dir.h"
@@ -25,20 +23,22 @@ int cmp_idx_or_pack_name(const char *idx_or_pack_name,
const unsigned char *get_midx_checksum(struct multi_pack_index *m)
{
- return m->data + m->data_len - the_hash_algo->rawsz;
+ return m->data + m->data_len - m->repo->hash_algo->rawsz;
}
-void get_midx_filename(struct strbuf *out, const char *object_dir)
+void get_midx_filename(const struct git_hash_algo *hash_algo,
+ struct strbuf *out, const char *object_dir)
{
- get_midx_filename_ext(out, object_dir, NULL, NULL);
+ get_midx_filename_ext(hash_algo, out, object_dir, NULL, NULL);
}
-void get_midx_filename_ext(struct strbuf *out, const char *object_dir,
+void get_midx_filename_ext(const struct git_hash_algo *hash_algo,
+ struct strbuf *out, const char *object_dir,
const unsigned char *hash, const char *ext)
{
strbuf_addf(out, "%s/pack/multi-pack-index", object_dir);
if (ext)
- strbuf_addf(out, "-%s.%s", hash_to_hex(hash), ext);
+ strbuf_addf(out, "-%s.%s", hash_to_hex_algop(hash, hash_algo), ext);
}
static int midx_read_oid_fanout(const unsigned char *chunk_start,
@@ -92,9 +92,8 @@ static int midx_read_object_offsets(const unsigned char *chunk_start,
return 0;
}
-#define MIDX_MIN_SIZE (MIDX_HEADER_SIZE + the_hash_algo->rawsz)
-
-static struct multi_pack_index *load_multi_pack_index_one(const char *object_dir,
+static struct multi_pack_index *load_multi_pack_index_one(struct repository *r,
+ const char *object_dir,
const char *midx_name,
int local)
{
@@ -119,7 +118,7 @@ static struct multi_pack_index *load_multi_pack_index_one(const char *object_dir
midx_size = xsize_t(st.st_size);
- if (midx_size < MIDX_MIN_SIZE) {
+ if (midx_size < (MIDX_HEADER_SIZE + r->hash_algo->rawsz)) {
error(_("multi-pack-index file %s is too small"), midx_name);
goto cleanup_fail;
}
@@ -131,6 +130,7 @@ static struct multi_pack_index *load_multi_pack_index_one(const char *object_dir
m->data = midx_map;
m->data_len = midx_size;
m->local = local;
+ m->repo = r;
m->signature = get_be32(m->data);
if (m->signature != MIDX_SIGNATURE)
@@ -143,12 +143,12 @@ static struct multi_pack_index *load_multi_pack_index_one(const char *object_dir
m->version);
hash_version = m->data[MIDX_BYTE_HASH_VERSION];
- if (hash_version != oid_version(the_hash_algo)) {
+ if (hash_version != oid_version(r->hash_algo)) {
error(_("multi-pack-index hash version %u does not match version %u"),
- hash_version, oid_version(the_hash_algo));
+ hash_version, oid_version(r->hash_algo));
goto cleanup_fail;
}
- m->hash_len = the_hash_algo->rawsz;
+ m->hash_len = r->hash_algo->rawsz;
m->num_chunks = m->data[MIDX_BYTE_NUM_CHUNKS];
@@ -205,8 +205,8 @@ static struct multi_pack_index *load_multi_pack_index_one(const char *object_dir
m->pack_names[i]);
}
- trace2_data_intmax("midx", the_repository, "load/num_packs", m->num_packs);
- trace2_data_intmax("midx", the_repository, "load/num_objects", m->num_objects);
+ trace2_data_intmax("midx", r, "load/num_packs", m->num_packs);
+ trace2_data_intmax("midx", r, "load/num_objects", m->num_objects);
free_chunkfile(cf);
return m;
@@ -232,15 +232,18 @@ void get_midx_chain_filename(struct strbuf *buf, const char *object_dir)
strbuf_addstr(buf, "/multi-pack-index-chain");
}
-void get_split_midx_filename_ext(struct strbuf *buf, const char *object_dir,
+void get_split_midx_filename_ext(const struct git_hash_algo *hash_algo,
+ struct strbuf *buf, const char *object_dir,
const unsigned char *hash, const char *ext)
{
get_midx_chain_dirname(buf, object_dir);
- strbuf_addf(buf, "/multi-pack-index-%s.%s", hash_to_hex(hash), ext);
+ strbuf_addf(buf, "/multi-pack-index-%s.%s",
+ hash_to_hex_algop(hash, hash_algo), ext);
}
-static int open_multi_pack_index_chain(const char *chain_file,
- int *fd, struct stat *st)
+static int open_multi_pack_index_chain(const struct git_hash_algo *hash_algo,
+ const char *chain_file, int *fd,
+ struct stat *st)
{
*fd = git_open(chain_file);
if (*fd < 0)
@@ -249,7 +252,7 @@ static int open_multi_pack_index_chain(const char *chain_file,
close(*fd);
return 0;
}
- if (st->st_size < the_hash_algo->hexsz) {
+ if (st->st_size < hash_algo->hexsz) {
close(*fd);
if (!st->st_size) {
/* treat empty files the same as missing */
@@ -291,7 +294,8 @@ static int add_midx_to_chain(struct multi_pack_index *midx,
return 1;
}
-static struct multi_pack_index *load_midx_chain_fd_st(const char *object_dir,
+static struct multi_pack_index *load_midx_chain_fd_st(struct repository *r,
+ const char *object_dir,
int local,
int fd, struct stat *st,
int *incomplete_chain)
@@ -302,7 +306,7 @@ static struct multi_pack_index *load_midx_chain_fd_st(const char *object_dir,
uint32_t i, count;
FILE *fp = xfdopen(fd, "r");
- count = st->st_size / (the_hash_algo->hexsz + 1);
+ count = st->st_size / (r->hash_algo->hexsz + 1);
for (i = 0; i < count; i++) {
struct multi_pack_index *m;
@@ -311,7 +315,7 @@ static struct multi_pack_index *load_midx_chain_fd_st(const char *object_dir,
if (strbuf_getline_lf(&buf, fp) == EOF)
break;
- if (get_oid_hex(buf.buf, &layer)) {
+ if (get_oid_hex_algop(buf.buf, &layer, r->hash_algo)) {
warning(_("invalid multi-pack-index chain: line '%s' "
"not a hash"),
buf.buf);
@@ -322,9 +326,9 @@ static struct multi_pack_index *load_midx_chain_fd_st(const char *object_dir,
valid = 0;
strbuf_reset(&buf);
- get_split_midx_filename_ext(&buf, object_dir, layer.hash,
- MIDX_EXT_MIDX);
- m = load_multi_pack_index_one(object_dir, buf.buf, local);
+ get_split_midx_filename_ext(r->hash_algo, &buf, object_dir,
+ layer.hash, MIDX_EXT_MIDX);
+ m = load_multi_pack_index_one(r, object_dir, buf.buf, local);
if (m) {
if (add_midx_to_chain(m, midx_chain)) {
@@ -347,7 +351,8 @@ static struct multi_pack_index *load_midx_chain_fd_st(const char *object_dir,
return midx_chain;
}
-static struct multi_pack_index *load_multi_pack_index_chain(const char *object_dir,
+static struct multi_pack_index *load_multi_pack_index_chain(struct repository *r,
+ const char *object_dir,
int local)
{
struct strbuf chain_file = STRBUF_INIT;
@@ -356,10 +361,10 @@ static struct multi_pack_index *load_multi_pack_index_chain(const char *object_d
struct multi_pack_index *m = NULL;
get_midx_chain_filename(&chain_file, object_dir);
- if (open_multi_pack_index_chain(chain_file.buf, &fd, &st)) {
+ if (open_multi_pack_index_chain(r->hash_algo, chain_file.buf, &fd, &st)) {
int incomplete;
/* ownership of fd is taken over by load function */
- m = load_midx_chain_fd_st(object_dir, local, fd, &st,
+ m = load_midx_chain_fd_st(r, object_dir, local, fd, &st,
&incomplete);
}
@@ -367,17 +372,19 @@ static struct multi_pack_index *load_multi_pack_index_chain(const char *object_d
return m;
}
-struct multi_pack_index *load_multi_pack_index(const char *object_dir,
+struct multi_pack_index *load_multi_pack_index(struct repository *r,
+ const char *object_dir,
int local)
{
struct strbuf midx_name = STRBUF_INIT;
struct multi_pack_index *m;
- get_midx_filename(&midx_name, object_dir);
+ get_midx_filename(r->hash_algo, &midx_name, object_dir);
- m = load_multi_pack_index_one(object_dir, midx_name.buf, local);
+ m = load_multi_pack_index_one(r, object_dir,
+ midx_name.buf, local);
if (!m)
- m = load_multi_pack_index_chain(object_dir, local);
+ m = load_multi_pack_index_chain(r, object_dir, local);
strbuf_release(&midx_name);
@@ -464,7 +471,7 @@ int prepare_midx_pack(struct repository *r, struct multi_pack_index *m,
strhash(key.buf), key.buf,
struct packed_git, packmap_ent);
if (!p) {
- p = add_packed_git(pack_name.buf, pack_name.len, m->local);
+ p = add_packed_git(r, pack_name.buf, pack_name.len, m->local);
if (p) {
install_packed_git(r, p);
list_add_tail(&p->mru, &r->objects->packed_git_mru);
@@ -519,7 +526,7 @@ int bsearch_one_midx(const struct object_id *oid, struct multi_pack_index *m,
uint32_t *result)
{
int ret = bsearch_hash(oid->hash, m->chunk_oid_fanout,
- m->chunk_oid_lookup, the_hash_algo->rawsz,
+ m->chunk_oid_lookup, m->repo->hash_algo->rawsz,
result);
if (result)
*result += m->num_objects_in_base;
@@ -550,7 +557,7 @@ struct object_id *nth_midxed_object_oid(struct object_id *oid,
n = midx_for_object(&m, n);
oidread(oid, m->chunk_oid_lookup + st_mult(m->hash_len, n),
- the_repository->hash_algo);
+ m->repo->hash_algo);
return oid;
}
@@ -721,7 +728,7 @@ int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, i
if (!strcmp(object_dir, m_search->object_dir))
return 1;
- m = load_multi_pack_index(object_dir, local);
+ m = load_multi_pack_index(r, object_dir, local);
if (m) {
struct multi_pack_index *mp = r->objects->multi_pack_index;
@@ -815,7 +822,7 @@ void clear_midx_file(struct repository *r)
{
struct strbuf midx = STRBUF_INIT;
- get_midx_filename(&midx, r->objects->odb->path);
+ get_midx_filename(r->hash_algo, &midx, r->objects->odb->path);
if (r->objects && r->objects->multi_pack_index) {
close_midx(r->objects->multi_pack_index);
@@ -875,7 +882,7 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
struct pair_pos_vs_id *pairs = NULL;
uint32_t i;
struct progress *progress = NULL;
- struct multi_pack_index *m = load_multi_pack_index(object_dir, 1);
+ struct multi_pack_index *m = load_multi_pack_index(r, object_dir, 1);
struct multi_pack_index *curr;
verify_midx_error = 0;
@@ -884,7 +891,7 @@ int verify_midx_file(struct repository *r, const char *object_dir, unsigned flag
struct stat sb;
struct strbuf filename = STRBUF_INIT;
- get_midx_filename(&filename, object_dir);
+ get_midx_filename(r->hash_algo, &filename, object_dir);
if (!stat(filename.buf, &sb)) {
error(_("multi-pack-index file exists, but failed to parse"));
diff --git a/midx.h b/midx.h
index 42d4f8d149..9d1374cbd5 100644
--- a/midx.h
+++ b/midx.h
@@ -7,6 +7,7 @@ struct object_id;
struct pack_entry;
struct repository;
struct bitmapped_pack;
+struct git_hash_algo;
#define MIDX_SIGNATURE 0x4d494458 /* "MIDX" */
#define MIDX_VERSION 1
@@ -71,6 +72,9 @@ struct multi_pack_index {
const char **pack_names;
struct packed_git **packs;
+
+ struct repository *repo;
+
char object_dir[FLEX_ARRAY];
};
@@ -86,15 +90,20 @@ struct multi_pack_index {
#define MIDX_EXT_MIDX "midx"
const unsigned char *get_midx_checksum(struct multi_pack_index *m);
-void get_midx_filename(struct strbuf *out, const char *object_dir);
-void get_midx_filename_ext(struct strbuf *out, const char *object_dir,
+void get_midx_filename(const struct git_hash_algo *hash_algo,
+ struct strbuf *out, const char *object_dir);
+void get_midx_filename_ext(const struct git_hash_algo *hash_algo,
+ struct strbuf *out, const char *object_dir,
const unsigned char *hash, const char *ext);
void get_midx_chain_dirname(struct strbuf *buf, const char *object_dir);
void get_midx_chain_filename(struct strbuf *buf, const char *object_dir);
-void get_split_midx_filename_ext(struct strbuf *buf, const char *object_dir,
+void get_split_midx_filename_ext(const struct git_hash_algo *hash_algo,
+ struct strbuf *buf, const char *object_dir,
const unsigned char *hash, const char *ext);
-struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local);
+struct multi_pack_index *load_multi_pack_index(struct repository *r,
+ const char *object_dir,
+ int local);
int prepare_midx_pack(struct repository *r, struct multi_pack_index *m, uint32_t pack_int_id);
struct packed_git *nth_midxed_pack(struct multi_pack_index *m,
uint32_t pack_int_id);
@@ -120,15 +129,13 @@ int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, i
* Variant of write_midx_file which writes a MIDX containing only the packs
* specified in packs_to_include.
*/
-int write_midx_file(const char *object_dir,
- const char *preferred_pack_name,
- const char *refs_snapshot,
+int write_midx_file(struct repository *r, const char *object_dir,
+ const char *preferred_pack_name, const char *refs_snapshot,
unsigned flags);
-int write_midx_file_only(const char *object_dir,
+int write_midx_file_only(struct repository *r, const char *object_dir,
struct string_list *packs_to_include,
const char *preferred_pack_name,
- const char *refs_snapshot,
- unsigned flags);
+ const char *refs_snapshot, unsigned flags);
void clear_midx_file(struct repository *r);
int verify_midx_file(struct repository *r, const char *object_dir, unsigned flags);
int expire_midx_packs(struct repository *r, const char *object_dir, unsigned flags);
diff --git a/object-name.c b/object-name.c
index c892fbe80a..a563635a8c 100644
--- a/object-name.c
+++ b/object-name.c
@@ -952,7 +952,7 @@ static int get_oid_basic(struct repository *r, const char *str, int len,
"\n"
"where \"$br\" is somehow empty and a 40-hex ref is created. Please\n"
"examine these refs and maybe delete them. Turn this message off by\n"
- "running \"git config advice.objectNameWarning false\"");
+ "running \"git config set advice.objectNameWarning false\"");
struct object_id tmp_oid;
char *real_ref = NULL;
int refs_found = 0;
@@ -1401,7 +1401,7 @@ static int get_oid_oneline(struct repository *r,
const char *prefix, struct object_id *oid,
const struct commit_list *list)
{
- struct commit_list *copy = NULL;
+ struct commit_list *copy = NULL, **copy_tail = &copy;
const struct commit_list *l;
int found = 0;
int negative = 0;
@@ -1423,7 +1423,7 @@ static int get_oid_oneline(struct repository *r,
for (l = list; l; l = l->next) {
l->item->object.flags |= ONELINE_SEEN;
- commit_list_insert(l->item, &copy);
+ copy_tail = &commit_list_insert(l->item, copy_tail)->next;
}
while (copy) {
const char *p, *buf;
@@ -1734,42 +1734,6 @@ int repo_interpret_branch_name(struct repository *r,
return -1;
}
-void strbuf_branchname(struct strbuf *sb, const char *name, unsigned allowed)
-{
- int len = strlen(name);
- struct interpret_branch_name_options options = {
- .allowed = allowed
- };
- int used = repo_interpret_branch_name(the_repository, name, len, sb,
- &options);
-
- if (used < 0)
- used = 0;
- strbuf_add(sb, name + used, len - used);
-}
-
-int strbuf_check_branch_ref(struct strbuf *sb, const char *name)
-{
- if (startup_info->have_repository)
- strbuf_branchname(sb, name, INTERPRET_BRANCH_LOCAL);
- else
- strbuf_addstr(sb, name);
-
- /*
- * This splice must be done even if we end up rejecting the
- * name; builtin/branch.c::copy_or_rename_branch() still wants
- * to see what the name expanded to so that "branch -m" can be
- * used as a tool to correct earlier mistakes.
- */
- strbuf_splice(sb, 0, 0, "refs/heads/", 11);
-
- if (*name == '-' ||
- !strcmp(sb->buf, "refs/heads/HEAD"))
- return -1;
-
- return check_refname_format(sb->buf, 0);
-}
-
void object_context_release(struct object_context *ctx)
{
free(ctx->path);
diff --git a/object-store-ll.h b/object-store-ll.h
index 53b8e693b1..cd3bd5bd99 100644
--- a/object-store-ll.h
+++ b/object-store-ll.h
@@ -10,6 +10,7 @@
struct oidmap;
struct oidtree;
struct strbuf;
+struct repository;
struct object_directory {
struct object_directory *next;
@@ -135,6 +136,10 @@ struct packed_git {
*/
const uint32_t *mtimes_map;
size_t mtimes_size;
+
+ /* repo denotes the repository this packfile belongs to */
+ struct repository *repo;
+
/* something like ".git/objects/pack/xxxxx.pack" */
char pack_name[FLEX_ARRAY]; /* more */
};
@@ -545,7 +550,7 @@ typedef int each_packed_object_fn(const struct object_id *oid,
int for_each_object_in_pack(struct packed_git *p,
each_packed_object_fn, void *data,
enum for_each_object_flags flags);
-int for_each_packed_object(each_packed_object_fn, void *,
- enum for_each_object_flags flags);
+int for_each_packed_object(struct repository *repo, each_packed_object_fn cb,
+ void *data, enum for_each_object_flags flags);
#endif /* OBJECT_STORE_LL_H */
diff --git a/oss-fuzz/.gitignore b/oss-fuzz/.gitignore
index a877c11f42..f2d74de457 100644
--- a/oss-fuzz/.gitignore
+++ b/oss-fuzz/.gitignore
@@ -1,5 +1,8 @@
fuzz-commit-graph
fuzz-config
+fuzz-credential-from-url-gently
fuzz-date
fuzz-pack-headers
fuzz-pack-idx
+fuzz-parse-attr-line
+fuzz-url-decode-mem
diff --git a/oss-fuzz/fuzz-credential-from-url-gently.c b/oss-fuzz/fuzz-credential-from-url-gently.c
new file mode 100644
index 0000000000..c872f9ad2d
--- /dev/null
+++ b/oss-fuzz/fuzz-credential-from-url-gently.c
@@ -0,0 +1,32 @@
+#include "git-compat-util.h"
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+#include "credential.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
+
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+ struct credential c;
+ char *buf;
+
+ buf = malloc(size + 1);
+ if (!buf)
+ return 0;
+
+ memcpy(buf, data, size);
+ buf[size] = 0;
+
+ // start fuzzing
+ credential_init(&c);
+ credential_from_url_gently(&c, buf, 1);
+
+ // cleanup
+ credential_clear(&c);
+ free(buf);
+
+ return 0;
+}
diff --git a/oss-fuzz/fuzz-parse-attr-line.c b/oss-fuzz/fuzz-parse-attr-line.c
new file mode 100644
index 0000000000..45a4c4e53c
--- /dev/null
+++ b/oss-fuzz/fuzz-parse-attr-line.c
@@ -0,0 +1,39 @@
+#include "git-compat-util.h"
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include "attr.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
+
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+ struct match_attr *res;
+ char *buf;
+
+ buf = malloc(size + 1);
+ if (!buf)
+ return 0;
+
+ memcpy(buf, data, size);
+ buf[size] = 0;
+
+ res = parse_attr_line(buf, "dummy", 0, 0);
+
+ if (res) {
+ int j;
+ for (j = 0; j < res->num_attr; j++) {
+ const char *setto = res->state[j].setto;
+ if (ATTR_TRUE(setto) || ATTR_FALSE(setto) ||
+ ATTR_UNSET(setto))
+ ;
+ else
+ free((char *)setto);
+ }
+ free(res);
+ }
+ free(buf);
+
+ return 0;
+}
diff --git a/oss-fuzz/fuzz-url-decode-mem.c b/oss-fuzz/fuzz-url-decode-mem.c
new file mode 100644
index 0000000000..2342aa993b
--- /dev/null
+++ b/oss-fuzz/fuzz-url-decode-mem.c
@@ -0,0 +1,43 @@
+#include "git-compat-util.h"
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdio.h>
+#include "url.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
+
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+ char *buf;
+ char *r;
+ const char *pbuf;
+
+ buf = malloc(size + 1);
+ if (!buf)
+ return 0;
+
+ memcpy(buf, data, size);
+ buf[size] = 0;
+
+ // start fuzzing
+ r = url_decode(buf);
+ free(r);
+
+ r = url_percent_decode(buf);
+ free(r);
+
+ pbuf = (const char*) buf;
+ r = url_decode_parameter_name(&pbuf);
+ free(r);
+
+ pbuf = (const char*) buf;
+ r = url_decode_parameter_value(&pbuf);
+ free(r);
+
+ // cleanup
+ free(buf);
+
+ return 0;
+}
diff --git a/pack-bitmap.c b/pack-bitmap.c
index 4fa9dfc771..7aa2410d9b 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -1,5 +1,3 @@
-#define USE_THE_REPOSITORY_VARIABLE
-
#include "git-compat-util.h"
#include "commit.h"
#include "gettext.h"
@@ -177,12 +175,21 @@ static uint32_t bitmap_num_objects(struct bitmap_index *index)
return index->pack->num_objects;
}
+static struct repository *bitmap_repo(struct bitmap_index *bitmap_git)
+{
+ if (bitmap_is_midx(bitmap_git))
+ return bitmap_git->midx->repo;
+ return bitmap_git->pack->repo;
+}
+
static int load_bitmap_header(struct bitmap_index *index)
{
struct bitmap_disk_header *header = (void *)index->map;
- size_t header_size = sizeof(*header) - GIT_MAX_RAWSZ + the_hash_algo->rawsz;
+ const struct git_hash_algo *hash_algo = bitmap_repo(index)->hash_algo;
+
+ size_t header_size = sizeof(*header) - GIT_MAX_RAWSZ + hash_algo->rawsz;
- if (index->map_size < header_size + the_hash_algo->rawsz)
+ if (index->map_size < header_size + hash_algo->rawsz)
return error(_("corrupted bitmap index (too small)"));
if (memcmp(header->magic, BITMAP_IDX_SIGNATURE, sizeof(BITMAP_IDX_SIGNATURE)) != 0)
@@ -196,7 +203,7 @@ static int load_bitmap_header(struct bitmap_index *index)
{
uint32_t flags = ntohs(header->options);
size_t cache_size = st_mult(bitmap_num_objects(index), sizeof(uint32_t));
- unsigned char *index_end = index->map + index->map_size - the_hash_algo->rawsz;
+ unsigned char *index_end = index->map + index->map_size - hash_algo->rawsz;
if ((flags & BITMAP_OPT_FULL_DAG) == 0)
BUG("unsupported options for bitmap index file "
@@ -368,8 +375,8 @@ static int load_bitmap_entries_v1(struct bitmap_index *index)
char *midx_bitmap_filename(struct multi_pack_index *midx)
{
struct strbuf buf = STRBUF_INIT;
- get_midx_filename_ext(&buf, midx->object_dir, get_midx_checksum(midx),
- MIDX_EXT_BITMAP);
+ get_midx_filename_ext(midx->repo->hash_algo, &buf, midx->object_dir,
+ get_midx_checksum(midx), MIDX_EXT_BITMAP);
return strbuf_detach(&buf, NULL);
}
@@ -408,8 +415,8 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
if (bitmap_git->pack || bitmap_git->midx) {
struct strbuf buf = STRBUF_INIT;
- get_midx_filename(&buf, midx->object_dir);
- trace2_data_string("bitmap", the_repository,
+ get_midx_filename(midx->repo->hash_algo, &buf, midx->object_dir);
+ trace2_data_string("bitmap", bitmap_repo(bitmap_git),
"ignoring extra midx bitmap file", buf.buf);
close(fd);
strbuf_release(&buf);
@@ -427,7 +434,7 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
goto cleanup;
if (!hasheq(get_midx_checksum(bitmap_git->midx), bitmap_git->checksum,
- the_repository->hash_algo)) {
+ bitmap_repo(bitmap_git)->hash_algo)) {
error(_("checksum doesn't match in MIDX and bitmap"));
goto cleanup;
}
@@ -438,7 +445,9 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
}
for (i = 0; i < bitmap_git->midx->num_packs; i++) {
- if (prepare_midx_pack(the_repository, bitmap_git->midx, i)) {
+ if (prepare_midx_pack(bitmap_repo(bitmap_git),
+ bitmap_git->midx,
+ i)) {
warning(_("could not open pack %s"),
bitmap_git->midx->pack_names[i]);
goto cleanup;
@@ -492,8 +501,9 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
}
if (bitmap_git->pack || bitmap_git->midx) {
- trace2_data_string("bitmap", the_repository,
- "ignoring extra bitmap file", packfile->pack_name);
+ trace2_data_string("bitmap", bitmap_repo(bitmap_git),
+ "ignoring extra bitmap file",
+ packfile->pack_name);
close(fd);
return -1;
}
@@ -518,8 +528,8 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
return -1;
}
- trace2_data_string("bitmap", the_repository, "opened bitmap file",
- packfile->pack_name);
+ trace2_data_string("bitmap", bitmap_repo(bitmap_git),
+ "opened bitmap file", packfile->pack_name);
return 0;
}
@@ -649,7 +659,7 @@ struct bitmap_index *prepare_bitmap_git(struct repository *r)
struct bitmap_index *prepare_midx_bitmap_git(struct multi_pack_index *midx)
{
- struct repository *r = the_repository;
+ struct repository *r = midx->repo;
struct bitmap_index *bitmap_git = xcalloc(1, sizeof(*bitmap_git));
if (!open_midx_bitmap_1(bitmap_git, midx) && !load_bitmap(r, bitmap_git))
@@ -1213,6 +1223,7 @@ static struct bitmap *find_boundary_objects(struct bitmap_index *bitmap_git,
{
struct bitmap_boundary_cb cb;
struct object_list *root;
+ struct repository *repo;
unsigned int i;
unsigned int tmp_blobs, tmp_trees, tmp_tags;
int any_missing = 0;
@@ -1222,6 +1233,8 @@ static struct bitmap *find_boundary_objects(struct bitmap_index *bitmap_git,
cb.base = bitmap_new();
object_array_init(&cb.boundary);
+ repo = bitmap_repo(bitmap_git);
+
revs->ignore_missing_links = 1;
if (bitmap_git->pseudo_merges.nr) {
@@ -1270,7 +1283,7 @@ static struct bitmap *find_boundary_objects(struct bitmap_index *bitmap_git,
tmp_blobs = revs->blob_objects;
tmp_trees = revs->tree_objects;
- tmp_tags = revs->blob_objects;
+ tmp_tags = revs->tag_objects;
revs->blob_objects = 0;
revs->tree_objects = 0;
revs->tag_objects = 0;
@@ -1280,19 +1293,19 @@ static struct bitmap *find_boundary_objects(struct bitmap_index *bitmap_git,
* revision walk to (a) OR in any bitmaps that are UNINTERESTING
* between the tips and boundary, and (b) record the boundary.
*/
- trace2_region_enter("pack-bitmap", "boundary-prepare", the_repository);
+ trace2_region_enter("pack-bitmap", "boundary-prepare", repo);
if (prepare_revision_walk(revs))
die("revision walk setup failed");
- trace2_region_leave("pack-bitmap", "boundary-prepare", the_repository);
+ trace2_region_leave("pack-bitmap", "boundary-prepare", repo);
- trace2_region_enter("pack-bitmap", "boundary-traverse", the_repository);
+ trace2_region_enter("pack-bitmap", "boundary-traverse", repo);
revs->boundary = 1;
traverse_commit_list_filtered(revs,
show_boundary_commit,
show_boundary_object,
&cb, NULL);
revs->boundary = 0;
- trace2_region_leave("pack-bitmap", "boundary-traverse", the_repository);
+ trace2_region_leave("pack-bitmap", "boundary-traverse", repo);
revs->blob_objects = tmp_blobs;
revs->tree_objects = tmp_trees;
@@ -1304,7 +1317,7 @@ static struct bitmap *find_boundary_objects(struct bitmap_index *bitmap_git,
/*
* Then add the boundary commit(s) as fill-in traversal tips.
*/
- trace2_region_enter("pack-bitmap", "boundary-fill-in", the_repository);
+ trace2_region_enter("pack-bitmap", "boundary-fill-in", repo);
for (i = 0; i < cb.boundary.nr; i++) {
struct object *obj = cb.boundary.objects[i].item;
if (bitmap_walk_contains(bitmap_git, cb.base, &obj->oid))
@@ -1314,7 +1327,7 @@ static struct bitmap *find_boundary_objects(struct bitmap_index *bitmap_git,
}
if (revs->pending.nr)
cb.base = fill_in_bitmap(bitmap_git, revs, cb.base, NULL);
- trace2_region_leave("pack-bitmap", "boundary-fill-in", the_repository);
+ trace2_region_leave("pack-bitmap", "boundary-fill-in", repo);
cleanup:
object_array_clear(&cb.boundary);
@@ -1718,7 +1731,8 @@ static unsigned long get_size_by_pos(struct bitmap_index *bitmap_git,
ofs = pack_pos_to_offset(pack, pos);
}
- if (packed_object_info(the_repository, pack, ofs, &oi) < 0) {
+ if (packed_object_info(bitmap_repo(bitmap_git), pack, ofs,
+ &oi) < 0) {
struct object_id oid;
nth_bitmap_object_oid(bitmap_git, &oid,
pack_pos_to_index(pack, pos));
@@ -1727,7 +1741,8 @@ static unsigned long get_size_by_pos(struct bitmap_index *bitmap_git,
} else {
struct eindex *eindex = &bitmap_git->ext_index;
struct object *obj = eindex->objects[pos - bitmap_num_objects(bitmap_git)];
- if (oid_object_info_extended(the_repository, &obj->oid, &oi, 0) < 0)
+ if (oid_object_info_extended(bitmap_repo(bitmap_git), &obj->oid,
+ &oi, 0) < 0)
die(_("unable to get size of %s"), oid_to_hex(&obj->oid));
}
@@ -1889,7 +1904,8 @@ static void filter_packed_objects_from_bitmap(struct bitmap_index *bitmap_git,
bitmap_unset(result, i);
for (i = 0; i < eindex->count; ++i) {
- if (has_object_pack(&eindex->objects[i]->oid))
+ if (has_object_pack(bitmap_repo(bitmap_git),
+ &eindex->objects[i]->oid))
bitmap_unset(result, objects_nr + i);
}
}
@@ -1907,6 +1923,7 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs,
struct bitmap *haves_bitmap = NULL;
struct bitmap_index *bitmap_git;
+ struct repository *repo;
/*
* We can't do pathspec limiting with bitmaps, because we don't know
@@ -1980,18 +1997,20 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs,
if (!use_boundary_traversal)
object_array_clear(&revs->pending);
+ repo = bitmap_repo(bitmap_git);
+
if (haves) {
if (use_boundary_traversal) {
- trace2_region_enter("pack-bitmap", "haves/boundary", the_repository);
+ trace2_region_enter("pack-bitmap", "haves/boundary", repo);
haves_bitmap = find_boundary_objects(bitmap_git, revs, haves);
- trace2_region_leave("pack-bitmap", "haves/boundary", the_repository);
+ trace2_region_leave("pack-bitmap", "haves/boundary", repo);
} else {
- trace2_region_enter("pack-bitmap", "haves/classic", the_repository);
+ trace2_region_enter("pack-bitmap", "haves/classic", repo);
revs->ignore_missing_links = 1;
haves_bitmap = find_objects(bitmap_git, revs, haves, NULL);
reset_revision_walk();
revs->ignore_missing_links = 0;
- trace2_region_leave("pack-bitmap", "haves/classic", the_repository);
+ trace2_region_leave("pack-bitmap", "haves/classic", repo);
}
if (!haves_bitmap)
@@ -2025,17 +2044,17 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs,
object_list_free(&wants);
object_list_free(&haves);
- trace2_data_intmax("bitmap", the_repository, "pseudo_merges_satisfied",
+ trace2_data_intmax("bitmap", repo, "pseudo_merges_satisfied",
pseudo_merges_satisfied_nr);
- trace2_data_intmax("bitmap", the_repository, "pseudo_merges_cascades",
+ trace2_data_intmax("bitmap", repo, "pseudo_merges_cascades",
pseudo_merges_cascades_nr);
- trace2_data_intmax("bitmap", the_repository, "bitmap/hits",
+ trace2_data_intmax("bitmap", repo, "bitmap/hits",
existing_bitmaps_hits_nr);
- trace2_data_intmax("bitmap", the_repository, "bitmap/misses",
+ trace2_data_intmax("bitmap", repo, "bitmap/misses",
existing_bitmaps_misses_nr);
- trace2_data_intmax("bitmap", the_repository, "bitmap/roots_with_bitmap",
+ trace2_data_intmax("bitmap", repo, "bitmap/roots_with_bitmap",
roots_with_bitmaps_nr);
- trace2_data_intmax("bitmap", the_repository, "bitmap/roots_without_bitmap",
+ trace2_data_intmax("bitmap", repo, "bitmap/roots_without_bitmap",
roots_without_bitmaps_nr);
return bitmap_git;
@@ -2256,7 +2275,7 @@ void reuse_partial_packfile_from_bitmap(struct bitmap_index *bitmap_git,
struct bitmap **reuse_out,
int multi_pack_reuse)
{
- struct repository *r = the_repository;
+ struct repository *r = bitmap_repo(bitmap_git);
struct bitmapped_pack *packs = NULL;
struct bitmap *result = bitmap_git->result;
struct bitmap *reuse;
@@ -2792,7 +2811,7 @@ int rebuild_bitmap(const uint32_t *reposition,
uint32_t *create_bitmap_mapping(struct bitmap_index *bitmap_git,
struct packing_data *mapping)
{
- struct repository *r = the_repository;
+ struct repository *r = bitmap_repo(bitmap_git);
uint32_t i, num_objects;
uint32_t *reposition;
@@ -2948,7 +2967,8 @@ static off_t get_disk_usage_for_extended(struct bitmap_index *bitmap_git)
st_add(bitmap_num_objects(bitmap_git), i)))
continue;
- if (oid_object_info_extended(the_repository, &obj->oid, &oi, 0) < 0)
+ if (oid_object_info_extended(bitmap_repo(bitmap_git), &obj->oid,
+ &oi, 0) < 0)
die(_("unable to get disk usage of '%s'"),
oid_to_hex(&obj->oid));
diff --git a/pack-objects.h b/pack-objects.h
index b9898a4e64..3f6f504203 100644
--- a/pack-objects.h
+++ b/pack-objects.h
@@ -7,7 +7,8 @@
struct repository;
-#define DEFAULT_DELTA_CACHE_SIZE (256 * 1024 * 1024)
+#define DEFAULT_DELTA_CACHE_SIZE (256 * 1024 * 1024)
+#define DEFAULT_DELTA_BASE_CACHE_LIMIT (96 * 1024 * 1024)
#define OE_DFS_STATE_BITS 2
#define OE_DEPTH_BITS 12
diff --git a/pack-revindex.c b/pack-revindex.c
index 22d3c23464..d3832478d9 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -383,7 +383,7 @@ int load_midx_revindex(struct multi_pack_index *m)
trace2_data_string("load_midx_revindex", the_repository,
"source", "rev");
- get_midx_filename_ext(&revindex_name, m->object_dir,
+ get_midx_filename_ext(m->repo->hash_algo, &revindex_name, m->object_dir,
get_midx_checksum(m), MIDX_EXT_REV);
ret = load_revindex_from_disk(revindex_name.buf,
diff --git a/pack-write.c b/pack-write.c
index 8c7dfddc5a..98a8c0e785 100644
--- a/pack-write.c
+++ b/pack-write.c
@@ -21,6 +21,7 @@ void reset_pack_idx_option(struct pack_idx_option *opts)
memset(opts, 0, sizeof(*opts));
opts->version = 2;
opts->off32_limit = 0x7fffffff;
+ opts->delta_base_cache_limit = DEFAULT_DELTA_BASE_CACHE_LIMIT;
}
static int sha1_compare(const void *_a, const void *_b)
diff --git a/pack.h b/pack.h
index 02bbdfb19c..a8da040629 100644
--- a/pack.h
+++ b/pack.h
@@ -58,6 +58,8 @@ struct pack_idx_option {
*/
int anomaly_alloc, anomaly_nr;
uint32_t *anomaly;
+
+ size_t delta_base_cache_limit;
};
void reset_pack_idx_option(struct pack_idx_option *);
diff --git a/packfile.c b/packfile.c
index 9560f0a33c..9c4bd81a8c 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1,4 +1,3 @@
-#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
#include "environment.h"
@@ -25,13 +24,12 @@
#include "pack-revindex.h"
#include "promisor-remote.h"
-char *odb_pack_name(struct strbuf *buf,
- const unsigned char *hash,
- const char *ext)
+char *odb_pack_name(struct repository *r, struct strbuf *buf,
+ const unsigned char *hash, const char *ext)
{
strbuf_reset(buf);
- strbuf_addf(buf, "%s/pack/pack-%s.%s", repo_get_object_directory(the_repository),
- hash_to_hex(hash), ext);
+ strbuf_addf(buf, "%s/pack/pack-%s.%s", repo_get_object_directory(r),
+ hash_to_hex_algop(hash, r->hash_algo), ext);
return buf->buf;
}
@@ -47,15 +45,15 @@ static size_t pack_mapped;
#define SZ_FMT PRIuMAX
static inline uintmax_t sz_fmt(size_t s) { return s; }
-void pack_report(void)
+void pack_report(struct repository *repo)
{
fprintf(stderr,
"pack_report: getpagesize() = %10" SZ_FMT "\n"
"pack_report: core.packedGitWindowSize = %10" SZ_FMT "\n"
"pack_report: core.packedGitLimit = %10" SZ_FMT "\n",
sz_fmt(getpagesize()),
- sz_fmt(packed_git_window_size),
- sz_fmt(packed_git_limit));
+ sz_fmt(repo->settings.packed_git_window_size),
+ sz_fmt(repo->settings.packed_git_limit));
fprintf(stderr,
"pack_report: pack_used_ctr = %10u\n"
"pack_report: pack_mmap_calls = %10u\n"
@@ -79,7 +77,7 @@ static int check_packed_git_idx(const char *path, struct packed_git *p)
size_t idx_size;
int fd = git_open(path), ret;
struct stat st;
- const unsigned int hashsz = the_hash_algo->rawsz;
+ const unsigned int hashsz = p->repo->hash_algo->rawsz;
if (fd < 0)
return -1;
@@ -217,11 +215,12 @@ uint32_t get_pack_fanout(struct packed_git *p, uint32_t value)
return ntohl(level1_ofs[value]);
}
-static struct packed_git *alloc_packed_git(int extra)
+static struct packed_git *alloc_packed_git(struct repository *r, int extra)
{
struct packed_git *p = xmalloc(st_add(sizeof(*p), extra));
memset(p, 0, sizeof(*p));
p->pack_fd = -1;
+ p->repo = r;
return p;
}
@@ -233,15 +232,16 @@ static char *pack_path_from_idx(const char *idx_path)
return xstrfmt("%.*s.pack", (int)len, idx_path);
}
-struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path)
+struct packed_git *parse_pack_index(struct repository *r, unsigned char *sha1,
+ const char *idx_path)
{
char *path = pack_path_from_idx(idx_path);
size_t alloc = st_add(strlen(path), 1);
- struct packed_git *p = alloc_packed_git(alloc);
+ struct packed_git *p = alloc_packed_git(r, alloc);
memcpy(p->pack_name, path, alloc); /* includes NUL */
free(path);
- hashcpy(p->hash, sha1, the_repository->hash_algo);
+ hashcpy(p->hash, sha1, p->repo->hash_algo);
if (check_packed_git_idx(idx_path, p)) {
free(p);
return NULL;
@@ -276,7 +276,7 @@ static int unuse_one_window(struct packed_git *current)
if (current)
scan_windows(current, &lru_p, &lru_w, &lru_l);
- for (p = the_repository->objects->packed_git; p; p = p->next)
+ for (p = current->repo->objects->packed_git; p; p = p->next)
scan_windows(p, &lru_p, &lru_w, &lru_l);
if (lru_p) {
munmap(lru_w->base, lru_w->len);
@@ -458,13 +458,13 @@ static void find_lru_pack(struct packed_git *p, struct packed_git **lru_p, struc
*accept_windows_inuse = has_windows_inuse;
}
-static int close_one_pack(void)
+static int close_one_pack(struct repository *r)
{
struct packed_git *p, *lru_p = NULL;
struct pack_window *mru_w = NULL;
int accept_windows_inuse = 1;
- for (p = the_repository->objects->packed_git; p; p = p->next) {
+ for (p = r->objects->packed_git; p; p = p->next) {
if (p->pack_fd == -1)
continue;
find_lru_pack(p, &lru_p, &mru_w, &accept_windows_inuse);
@@ -538,7 +538,7 @@ static int open_packed_git_1(struct packed_git *p)
unsigned char hash[GIT_MAX_RAWSZ];
unsigned char *idx_hash;
ssize_t read_result;
- const unsigned hashsz = the_hash_algo->rawsz;
+ const unsigned hashsz = p->repo->hash_algo->rawsz;
if (open_pack_index(p))
return error("packfile %s index unavailable", p->pack_name);
@@ -553,7 +553,7 @@ static int open_packed_git_1(struct packed_git *p)
pack_max_fds = 1;
}
- while (pack_max_fds <= pack_open_fds && close_one_pack())
+ while (pack_max_fds <= pack_open_fds && close_one_pack(p->repo))
; /* nothing */
p->pack_fd = git_open(p->pack_name);
@@ -595,7 +595,7 @@ static int open_packed_git_1(struct packed_git *p)
if (read_result != hashsz)
return error("packfile %s signature is unavailable", p->pack_name);
idx_hash = ((unsigned char *)p->index_data) + p->index_size - hashsz * 2;
- if (!hasheq(hash, idx_hash, the_repository->hash_algo))
+ if (!hasheq(hash, idx_hash, p->repo->hash_algo))
return error("packfile %s does not match index", p->pack_name);
return 0;
}
@@ -608,7 +608,8 @@ static int open_packed_git(struct packed_git *p)
return -1;
}
-static int in_window(struct pack_window *win, off_t offset)
+static int in_window(struct repository *r, struct pack_window *win,
+ off_t offset)
{
/* We must promise at least one full hash after the
* offset is available from this window, otherwise the offset
@@ -618,7 +619,7 @@ static int in_window(struct pack_window *win, off_t offset)
*/
off_t win_off = win->offset;
return win_off <= offset
- && (offset + the_hash_algo->rawsz) <= (win_off + win->len);
+ && (offset + r->hash_algo->rawsz) <= (win_off + win->len);
}
unsigned char *use_pack(struct packed_git *p,
@@ -635,21 +636,28 @@ unsigned char *use_pack(struct packed_git *p,
*/
if (!p->pack_size && p->pack_fd == -1 && open_packed_git(p))
die("packfile %s cannot be accessed", p->pack_name);
- if (offset > (p->pack_size - the_hash_algo->rawsz))
+ if (offset > (p->pack_size - p->repo->hash_algo->rawsz))
die("offset beyond end of packfile (truncated pack?)");
if (offset < 0)
die(_("offset before end of packfile (broken .idx?)"));
- if (!win || !in_window(win, offset)) {
+ if (!win || !in_window(p->repo, win, offset)) {
if (win)
win->inuse_cnt--;
for (win = p->windows; win; win = win->next) {
- if (in_window(win, offset))
+ if (in_window(p->repo, win, offset))
break;
}
if (!win) {
- size_t window_align = packed_git_window_size / 2;
+ size_t window_align;
off_t len;
+ struct repo_settings *settings;
+
+ /* lazy load the settings in case it hasn't been setup */
+ prepare_repo_settings(p->repo);
+ settings = &p->repo->settings;
+
+ window_align = settings->packed_git_window_size / 2;
if (p->pack_fd == -1 && open_packed_git(p))
die("packfile %s cannot be accessed", p->pack_name);
@@ -657,11 +665,12 @@ unsigned char *use_pack(struct packed_git *p,
CALLOC_ARRAY(win, 1);
win->offset = (offset / window_align) * window_align;
len = p->pack_size - win->offset;
- if (len > packed_git_window_size)
- len = packed_git_window_size;
+ if (len > settings->packed_git_window_size)
+ len = settings->packed_git_window_size;
win->len = (size_t)len;
pack_mapped += win->len;
- while (packed_git_limit < pack_mapped
+
+ while (settings->packed_git_limit < pack_mapped
&& unuse_one_window(p))
; /* nothing */
win->base = xmmap_gently(NULL, win->len,
@@ -703,11 +712,13 @@ void unuse_pack(struct pack_window **w_cursor)
}
}
-struct packed_git *add_packed_git(const char *path, size_t path_len, int local)
+struct packed_git *add_packed_git(struct repository *r, const char *path,
+ size_t path_len, int local)
{
struct stat st;
size_t alloc;
struct packed_git *p;
+ struct object_id oid;
/*
* Make sure a corresponding .pack file exists and that
@@ -721,7 +732,7 @@ struct packed_git *add_packed_git(const char *path, size_t path_len, int local)
* the use xsnprintf double-checks that)
*/
alloc = st_add3(path_len, strlen(".promisor"), 1);
- p = alloc_packed_git(alloc);
+ p = alloc_packed_git(r, alloc);
memcpy(p->pack_name, path, path_len);
xsnprintf(p->pack_name + path_len, alloc - path_len, ".keep");
@@ -748,9 +759,13 @@ struct packed_git *add_packed_git(const char *path, size_t path_len, int local)
p->pack_size = st.st_size;
p->pack_local = local;
p->mtime = st.st_mtime;
- if (path_len < the_hash_algo->hexsz ||
- get_hash_hex(path + path_len - the_hash_algo->hexsz, p->hash))
- hashclr(p->hash, the_repository->hash_algo);
+ if (path_len < r->hash_algo->hexsz ||
+ get_oid_hex_algop(path + path_len - r->hash_algo->hexsz, &oid,
+ r->hash_algo))
+ hashclr(p->hash, r->hash_algo);
+ else
+ hashcpy(p->hash, oid.hash, r->hash_algo);
+
return p;
}
@@ -877,7 +892,7 @@ static void prepare_pack(const char *full_name, size_t full_name_len,
/* Don't reopen a pack we already have. */
if (!hashmap_get(&data->r->objects->pack_map, &hent, pack_name)) {
- p = add_packed_git(full_name, full_name_len, data->local);
+ p = add_packed_git(data->r, full_name, full_name_len, data->local);
if (p)
install_packed_git(data->r, p);
}
@@ -1240,9 +1255,9 @@ off_t get_delta_base(struct packed_git *p,
} else if (type == OBJ_REF_DELTA) {
/* The base entry _must_ be in the same pack */
struct object_id oid;
- oidread(&oid, base_info, the_repository->hash_algo);
+ oidread(&oid, base_info, p->repo->hash_algo);
base_offset = find_pack_entry_one(&oid, p);
- *curpos += the_hash_algo->rawsz;
+ *curpos += p->repo->hash_algo->rawsz;
} else
die("I am totally screwed");
return base_offset;
@@ -1263,7 +1278,7 @@ static int get_delta_base_oid(struct packed_git *p,
{
if (type == OBJ_REF_DELTA) {
unsigned char *base = use_pack(p, w_curs, curpos, NULL);
- oidread(oid, base, the_repository->hash_algo);
+ oidread(oid, base, p->repo->hash_algo);
return 0;
} else if (type == OBJ_OFS_DELTA) {
uint32_t base_pos;
@@ -1488,7 +1503,9 @@ void clear_delta_base_cache(void)
}
static void add_delta_base_cache(struct packed_git *p, off_t base_offset,
- void *base, unsigned long base_size, enum object_type type)
+ void *base, unsigned long base_size,
+ unsigned long delta_base_cache_limit,
+ enum object_type type)
{
struct delta_base_cache_entry *ent;
struct list_head *lru, *tmp;
@@ -1605,7 +1622,7 @@ int packed_object_info(struct repository *r, struct packed_git *p,
goto out;
}
} else
- oidclr(oi->delta_base_oid, the_repository->hash_algo);
+ oidclr(oi->delta_base_oid, p->repo->hash_algo);
}
oi->whence = in_delta_base_cache(p, obj_offset) ? OI_DBCACHED :
@@ -1690,6 +1707,8 @@ void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
int delta_stack_nr = 0, delta_stack_alloc = UNPACK_ENTRY_STACK_PREALLOC;
int base_from_cache = 0;
+ prepare_repo_settings(p->repo);
+
write_pack_access_log(p, obj_offset);
/* PHASE 1: drill down to the innermost base object */
@@ -1870,7 +1889,9 @@ void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
* before we are done using it.
*/
if (!external_base)
- add_delta_base_cache(p, base_obj_offset, base, base_size, type);
+ add_delta_base_cache(p, base_obj_offset, base, base_size,
+ p->repo->settings.delta_base_cache_limit,
+ type);
free(delta_data);
free(external_base);
@@ -1894,7 +1915,7 @@ int bsearch_pack(const struct object_id *oid, const struct packed_git *p, uint32
{
const unsigned char *index_fanout = p->index_data;
const unsigned char *index_lookup;
- const unsigned int hashsz = the_hash_algo->rawsz;
+ const unsigned int hashsz = p->repo->hash_algo->rawsz;
int index_lookup_width;
if (!index_fanout)
@@ -1919,7 +1940,7 @@ int nth_packed_object_id(struct object_id *oid,
uint32_t n)
{
const unsigned char *index = p->index_data;
- const unsigned int hashsz = the_hash_algo->rawsz;
+ const unsigned int hashsz = p->repo->hash_algo->rawsz;
if (!index) {
if (open_pack_index(p))
return -1;
@@ -1930,11 +1951,10 @@ int nth_packed_object_id(struct object_id *oid,
index += 4 * 256;
if (p->index_version == 1) {
oidread(oid, index + st_add(st_mult(hashsz + 4, n), 4),
- the_repository->hash_algo);
+ p->repo->hash_algo);
} else {
index += 8;
- oidread(oid, index + st_mult(hashsz, n),
- the_repository->hash_algo);
+ oidread(oid, index + st_mult(hashsz, n), p->repo->hash_algo);
}
return 0;
}
@@ -1956,7 +1976,7 @@ void check_pack_index_ptr(const struct packed_git *p, const void *vptr)
off_t nth_packed_object_offset(const struct packed_git *p, uint32_t n)
{
const unsigned char *index = p->index_data;
- const unsigned int hashsz = the_hash_algo->rawsz;
+ const unsigned int hashsz = p->repo->hash_algo->rawsz;
index += 4 * 256;
if (p->index_version == 1) {
return ntohl(*((uint32_t *)(index + st_mult(hashsz + 4, n))));
@@ -2136,16 +2156,17 @@ int find_kept_pack_entry(struct repository *r,
return 0;
}
-int has_object_pack(const struct object_id *oid)
+int has_object_pack(struct repository *r, const struct object_id *oid)
{
struct pack_entry e;
- return find_pack_entry(the_repository, oid, &e);
+ return find_pack_entry(r, oid, &e);
}
-int has_object_kept_pack(const struct object_id *oid, unsigned flags)
+int has_object_kept_pack(struct repository *r, const struct object_id *oid,
+ unsigned flags)
{
struct pack_entry e;
- return find_kept_pack_entry(the_repository, oid, flags, &e);
+ return find_kept_pack_entry(r, oid, flags, &e);
}
int for_each_object_in_pack(struct packed_git *p,
@@ -2156,7 +2177,7 @@ int for_each_object_in_pack(struct packed_git *p,
int r = 0;
if (flags & FOR_EACH_OBJECT_PACK_ORDER) {
- if (load_pack_revindex(the_repository, p))
+ if (load_pack_revindex(p->repo, p))
return -1;
}
@@ -2192,15 +2213,14 @@ int for_each_object_in_pack(struct packed_git *p,
return r;
}
-int for_each_packed_object(each_packed_object_fn cb, void *data,
- enum for_each_object_flags flags)
+int for_each_packed_object(struct repository *repo, each_packed_object_fn cb,
+ void *data, enum for_each_object_flags flags)
{
struct packed_git *p;
int r = 0;
int pack_errors = 0;
- prepare_packed_git(the_repository);
- for (p = get_all_packs(the_repository); p; p = p->next) {
+ for (p = get_all_packs(repo); p; p = p->next) {
if ((flags & FOR_EACH_OBJECT_LOCAL_ONLY) && !p->pack_local)
continue;
if ((flags & FOR_EACH_OBJECT_PROMISOR_ONLY) &&
@@ -2224,7 +2244,7 @@ int for_each_packed_object(each_packed_object_fn cb, void *data,
}
static int add_promisor_object(const struct object_id *oid,
- struct packed_git *pack UNUSED,
+ struct packed_git *pack,
uint32_t pos UNUSED,
void *set_)
{
@@ -2232,12 +2252,12 @@ static int add_promisor_object(const struct object_id *oid,
struct object *obj;
int we_parsed_object;
- obj = lookup_object(the_repository, oid);
+ obj = lookup_object(pack->repo, oid);
if (obj && obj->parsed) {
we_parsed_object = 0;
} else {
we_parsed_object = 1;
- obj = parse_object(the_repository, oid);
+ obj = parse_object(pack->repo, oid);
}
if (!obj)
@@ -2278,14 +2298,14 @@ static int add_promisor_object(const struct object_id *oid,
return 0;
}
-int is_promisor_object(const struct object_id *oid)
+int is_promisor_object(struct repository *r, const struct object_id *oid)
{
static struct oidset promisor_objects;
static int promisor_objects_prepared;
if (!promisor_objects_prepared) {
- if (repo_has_promisor_remote(the_repository)) {
- for_each_packed_object(add_promisor_object,
+ if (repo_has_promisor_remote(r)) {
+ for_each_packed_object(r, add_promisor_object,
&promisor_objects,
FOR_EACH_OBJECT_PROMISOR_ONLY |
FOR_EACH_OBJECT_PACK_ORDER);
diff --git a/packfile.h b/packfile.h
index 08f88a7ff5..58104fa009 100644
--- a/packfile.h
+++ b/packfile.h
@@ -29,7 +29,8 @@ struct pack_entry {
*
* Example: odb_pack_name(out, sha1, "idx") => ".git/objects/pack/pack-1234..idx"
*/
-char *odb_pack_name(struct strbuf *buf, const unsigned char *sha1, const char *ext);
+char *odb_pack_name(struct repository *r, struct strbuf *buf,
+ const unsigned char *hash, const char *ext);
/*
* Return the basename of the packfile, omitting any containing directory
@@ -46,7 +47,8 @@ const char *pack_basename(struct packed_git *p);
* and does not add the resulting packed_git struct to the internal list of
* packs. You probably want add_packed_git() instead.
*/
-struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path);
+struct packed_git *parse_pack_index(struct repository *r, 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_name, void *data);
@@ -87,7 +89,7 @@ unsigned long repo_approximate_object_count(struct repository *r);
struct packed_git *find_oid_pack(const struct object_id *oid,
struct packed_git *packs);
-void pack_report(void);
+void pack_report(struct repository *repo);
/*
* mmap the index file for the specified packfile (if it is not
@@ -113,7 +115,8 @@ void close_pack(struct packed_git *);
void close_object_store(struct raw_object_store *o);
void unuse_pack(struct pack_window **);
void clear_delta_base_cache(void);
-struct packed_git *add_packed_git(const char *path, size_t path_len, int local);
+struct packed_git *add_packed_git(struct repository *r, const char *path,
+ size_t path_len, int local);
/*
* Unlink the .pack and associated extension files.
@@ -190,14 +193,15 @@ const struct packed_git *has_packed_and_bad(struct repository *, const struct ob
int find_pack_entry(struct repository *r, const struct object_id *oid, struct pack_entry *e);
int find_kept_pack_entry(struct repository *r, const struct object_id *oid, unsigned flags, struct pack_entry *e);
-int has_object_pack(const struct object_id *oid);
-int has_object_kept_pack(const struct object_id *oid, unsigned flags);
+int has_object_pack(struct repository *r, const struct object_id *oid);
+int has_object_kept_pack(struct repository *r, const struct object_id *oid,
+ unsigned flags);
/*
* Return 1 if an object in a promisor packfile is or refers to the given
* object, 0 otherwise.
*/
-int is_promisor_object(const struct object_id *oid);
+int is_promisor_object(struct repository *r, const struct object_id *oid);
/*
* Expose a function for fuzz testing.
diff --git a/parse-options.h b/parse-options.h
index ae15342390..f0801d4532 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -3,6 +3,8 @@
#include "gettext.h"
+struct repository;
+
/**
* Refer to Documentation/technical/api-parse-options.txt for the API doc.
*/
@@ -73,7 +75,7 @@ typedef enum parse_opt_result parse_opt_ll_cb(struct parse_opt_ctx_t *ctx,
const char *arg, int unset);
typedef int parse_opt_subcommand_fn(int argc, const char **argv,
- const char *prefix);
+ const char *prefix, struct repository *repo);
/*
* `type`::
diff --git a/path.c b/path.c
index 93491bab14..4dcf3c8d40 100644
--- a/path.c
+++ b/path.c
@@ -684,7 +684,7 @@ return_null:
* links. User relative paths are also returned as they are given,
* except DWIM suffixing.
*/
-const char *enter_repo(const char *path, int strict)
+const char *enter_repo(const char *path, unsigned flags)
{
static struct strbuf validated_path = STRBUF_INIT;
static struct strbuf used_path = STRBUF_INIT;
@@ -692,7 +692,7 @@ const char *enter_repo(const char *path, int strict)
if (!path)
return NULL;
- if (!strict) {
+ if (!(flags & ENTER_REPO_STRICT)) {
static const char *suffix[] = {
"/.git", "", ".git/.git", ".git", NULL,
};
@@ -736,7 +736,8 @@ const char *enter_repo(const char *path, int strict)
if (!suffix[i])
return NULL;
gitfile = read_gitfile(used_path.buf);
- die_upon_dubious_ownership(gitfile, NULL, used_path.buf);
+ if (!(flags & ENTER_REPO_ANY_OWNER_OK))
+ die_upon_dubious_ownership(gitfile, NULL, used_path.buf);
if (gitfile) {
strbuf_reset(&used_path);
strbuf_addstr(&used_path, gitfile);
@@ -747,7 +748,8 @@ const char *enter_repo(const char *path, int strict)
}
else {
const char *gitfile = read_gitfile(path);
- die_upon_dubious_ownership(gitfile, NULL, path);
+ if (!(flags & ENTER_REPO_ANY_OWNER_OK))
+ die_upon_dubious_ownership(gitfile, NULL, path);
if (gitfile)
path = gitfile;
if (chdir(path))
diff --git a/path.h b/path.h
index e91d19fff6..5f6c85e5f8 100644
--- a/path.h
+++ b/path.h
@@ -156,7 +156,22 @@ int calc_shared_perm(int mode);
int adjust_shared_perm(const char *path);
char *interpolate_path(const char *path, int real_home);
-const char *enter_repo(const char *path, int strict);
+
+/* The bits are as follows:
+ *
+ * - ENTER_REPO_STRICT: callers that require exact paths (as opposed
+ * to allowing known suffixes like ".git", ".git/.git" to be
+ * omitted) can set this bit.
+ *
+ * - ENTER_REPO_ANY_OWNER_OK: callers that are willing to run without
+ * ownership check can set this bit.
+ */
+enum {
+ ENTER_REPO_STRICT = (1<<0),
+ ENTER_REPO_ANY_OWNER_OK = (1<<1),
+};
+
+const char *enter_repo(const char *path, unsigned flags);
const char *remove_leading_path(const char *in, const char *prefix);
const char *relative_path(const char *in, const char *prefix, struct strbuf *sb);
int normalize_path_copy_len(char *dst, const char *src, int *prefix_len);
diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build
new file mode 100644
index 0000000000..129cff161c
--- /dev/null
+++ b/perl/FromCPAN/Mail/meson.build
@@ -0,0 +1,7 @@
+test_dependencies += custom_target(
+ input: 'Address.pm',
+ output: 'Address.pm',
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/FromCPAN/Mail',
+)
diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build
new file mode 100644
index 0000000000..4e7ea909df
--- /dev/null
+++ b/perl/FromCPAN/meson.build
@@ -0,0 +1,9 @@
+test_dependencies += custom_target(
+ input: 'Error.pm',
+ output: 'Error.pm',
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/FromCPAN',
+)
+
+subdir('Mail')
diff --git a/perl/Git.pm b/perl/Git.pm
index 667152c6c6..6f47d653ab 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -7,7 +7,7 @@ Git - Perl interface to the Git version control system
package Git;
-use 5.008001;
+require v5.26;
use strict;
use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm
index 475e90a6df..162230af81 100644
--- a/perl/Git/I18N.pm
+++ b/perl/Git/I18N.pm
@@ -1,5 +1,5 @@
package Git::I18N;
-use 5.008001;
+require v5.26;
use strict;
use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
BEGIN {
@@ -20,14 +20,14 @@ our @EXPORT_OK = @EXPORT;
# this "'@@' [...] '@@'" pattern.
use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@';
use constant NO_GETTEXT => (
- q[@@NO_GETTEXT@@] ne ''
+ q[@NO_GETTEXT@] ne ''
and
- q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR
+ q[@NO_GETTEXT@] ne NO_GETTEXT_STR
);
sub __bootstrap_locale_messages {
our $TEXTDOMAIN = 'git';
- our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@';
+ our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@';
die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT;
require POSIX;
diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm
index 8c7fa805f9..92d63c71d2 100644
--- a/perl/Git/LoadCPAN.pm
+++ b/perl/Git/LoadCPAN.pm
@@ -1,5 +1,5 @@
package Git::LoadCPAN;
-use 5.008001;
+require v5.26;
use strict;
use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
@@ -31,11 +31,11 @@ C<git.git> repository. Use it for anything else at your peril!
# Makefile, and allows for detecting whether the module is loaded from
# perl/Git as opposed to perl/build/Git, which is useful for one-off
# testing without having Error.pm et al installed.
-use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@';
+use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@';
use constant NO_PERL_CPAN_FALLBACKS => (
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne ''
+ q[@NO_PERL_CPAN_FALLBACKS@] ne ''
and
- q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR
+ q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR
);
sub import {
diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build
new file mode 100644
index 0000000000..7da5b37adb
--- /dev/null
+++ b/perl/Git/LoadCPAN/Mail/meson.build
@@ -0,0 +1,7 @@
+test_dependencies += custom_target(
+ input: 'Address.pm',
+ output: 'Address.pm',
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN/Mail',
+)
diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build
new file mode 100644
index 0000000000..9468c073ae
--- /dev/null
+++ b/perl/Git/LoadCPAN/meson.build
@@ -0,0 +1,9 @@
+test_dependencies += custom_target(
+ input: 'Error.pm',
+ output: 'Error.pm',
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN',
+)
+
+subdir('Mail')
diff --git a/perl/Git/Packet.pm b/perl/Git/Packet.pm
index d896e69523..00fd9c484a 100644
--- a/perl/Git/Packet.pm
+++ b/perl/Git/Packet.pm
@@ -1,5 +1,5 @@
package Git::Packet;
-use 5.008001;
+require v5.26;
use strict;
use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
BEGIN {
diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build
new file mode 100644
index 0000000000..515ab3dd92
--- /dev/null
+++ b/perl/Git/SVN/Memoize/meson.build
@@ -0,0 +1,7 @@
+test_dependencies += custom_target(
+ input: 'YAML.pm',
+ output: 'YAML.pm',
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/SVN',
+)
diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build
new file mode 100644
index 0000000000..8338531041
--- /dev/null
+++ b/perl/Git/SVN/meson.build
@@ -0,0 +1,20 @@
+foreach source : [
+ 'Editor.pm',
+ 'Fetcher.pm',
+ 'GlobSpec.pm',
+ 'Log.pm',
+ 'Migration.pm',
+ 'Prompt.pm',
+ 'Ra.pm',
+ 'Utils.pm',
+]
+ test_dependencies += custom_target(
+ input: source,
+ output: source,
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git/SVN',
+ )
+endforeach
+
+subdir('Memoize')
diff --git a/perl/Git/meson.build b/perl/Git/meson.build
new file mode 100644
index 0000000000..259209d730
--- /dev/null
+++ b/perl/Git/meson.build
@@ -0,0 +1,18 @@
+foreach source : [
+ 'I18N.pm',
+ 'IndexInfo.pm',
+ 'LoadCPAN.pm',
+ 'Packet.pm',
+ 'SVN.pm',
+]
+ test_dependencies += custom_target(
+ input: source,
+ output: source,
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5/Git',
+ )
+endforeach
+
+subdir('LoadCPAN')
+subdir('SVN')
diff --git a/perl/header_templates/fixed_prefix.template.pl b/perl/header_templates/fixed_prefix.template.pl
index 857b4391a4..d571ca5cde 100644
--- a/perl/header_templates/fixed_prefix.template.pl
+++ b/perl/header_templates/fixed_prefix.template.pl
@@ -1 +1 @@
-use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@'));
+use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@'));
diff --git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
index 9d28b3d863..e6f8e661a1 100644
--- a/perl/header_templates/runtime_prefix.template.pl
+++ b/perl/header_templates/runtime_prefix.template.pl
@@ -3,7 +3,7 @@
# This finds our Git::* libraries relative to the script's runtime path.
sub __git_system_path {
my ($relpath) = @_;
- my $gitexecdir_relative = '@@GITEXECDIR_REL@@';
+ my $gitexecdir_relative = '@GITEXECDIR_REL@';
# GIT_EXEC_PATH is supplied by `git` or the test suite.
my $exec_path;
@@ -24,11 +24,11 @@ sub __git_system_path {
}
BEGIN {
- use lib split /@@PATHSEP@@/,
+ use lib split /@PATHSEP@/,
(
$ENV{GITPERLLIB} ||
do {
- my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@');
+ my $perllibdir = __git_system_path('@PERLLIBDIR_REL@');
(-e $perllibdir) || die("Invalid system path ($relpath): $path");
$perllibdir;
}
@@ -36,7 +36,7 @@ BEGIN {
# Export the system locale directory to the I18N module. The locale directory
# is only installed if NO_GETTEXT is set.
- $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@');
+ $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@');
}
# END RUNTIME_PREFIX generated code.
diff --git a/perl/meson.build b/perl/meson.build
new file mode 100644
index 0000000000..c22d6f8a1a
--- /dev/null
+++ b/perl/meson.build
@@ -0,0 +1,12 @@
+test_dependencies += custom_target(
+ input: 'Git.pm',
+ output: 'Git.pm',
+ command: generate_perl_command,
+ install: true,
+ install_dir: get_option('datadir') / 'perl5',
+)
+
+subdir('Git')
+if get_option('perl_cpan_fallback')
+ subdir('FromCPAN')
+endif
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000000..d7154b6395
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,27 @@
+i18n = import('i18n')
+
+translations = i18n.gettext('git',
+ languages: [
+ 'bg',
+ 'ca',
+ 'de',
+ 'el',
+ 'es',
+ 'fr',
+ 'id',
+ 'is',
+ 'it',
+ 'ko',
+ 'pl',
+ 'pt_PT',
+ 'ru',
+ 'sv',
+ 'tr',
+ 'uk',
+ 'vi',
+ 'zh_CN',
+ 'zh_TW',
+ ],
+ install: true,
+)
+test_dependencies += translations[0]
diff --git a/promisor-remote.c b/promisor-remote.c
index 9345ae3db2..c714f4f007 100644
--- a/promisor-remote.c
+++ b/promisor-remote.c
@@ -283,7 +283,7 @@ void promisor_remote_get_direct(struct repository *repo,
}
for (i = 0; i < remaining_nr; i++) {
- if (is_promisor_object(&remaining_oids[i]))
+ if (is_promisor_object(repo, &remaining_oids[i]))
die(_("could not fetch %s from promisor remote"),
oid_to_hex(&remaining_oids[i]));
}
diff --git a/prune-packed.c b/prune-packed.c
index 2bb99c29df..d1c65ab10e 100644
--- a/prune-packed.c
+++ b/prune-packed.c
@@ -24,7 +24,7 @@ static int prune_object(const struct object_id *oid, const char *path,
{
int *opts = data;
- if (!has_object_pack(oid))
+ if (!has_object_pack(the_repository, oid))
return 0;
if (*opts & PRUNE_PACKED_DRY_RUN)
diff --git a/reachable.c b/reachable.c
index 3e9b3dd0a4..ecf7ccf504 100644
--- a/reachable.c
+++ b/reachable.c
@@ -239,7 +239,7 @@ static int want_recent_object(struct recent_data *data,
const struct object_id *oid)
{
if (data->ignore_in_core_kept_packs &&
- has_object_kept_pack(oid, IN_CORE_KEEP_PACKS))
+ has_object_kept_pack(data->revs->repo, oid, IN_CORE_KEEP_PACKS))
return 0;
return 1;
}
@@ -324,7 +324,7 @@ int add_unseen_recent_objects_to_traversal(struct rev_info *revs,
if (ignore_in_core_kept_packs)
flags |= FOR_EACH_OBJECT_SKIP_IN_CORE_KEPT_PACKS;
- r = for_each_packed_object(add_recent_packed, &data, flags);
+ r = for_each_packed_object(revs->repo, add_recent_packed, &data, flags);
done:
oidset_clear(&data.extra_recent_oids);
diff --git a/refs.c b/refs.c
index 7866cd7378..bc0a60c186 100644
--- a/refs.c
+++ b/refs.c
@@ -318,9 +318,10 @@ int check_refname_format(const char *refname, int flags)
return check_or_sanitize_refname(refname, flags, NULL);
}
-int refs_fsck(struct ref_store *refs, struct fsck_options *o)
+int refs_fsck(struct ref_store *refs, struct fsck_options *o,
+ struct worktree *wt)
{
- return refs->be->fsck(refs, o);
+ return refs->be->fsck(refs, o, wt);
}
void sanitize_refname_component(const char *refname, struct strbuf *out)
@@ -697,6 +698,53 @@ static char *substitute_branch_name(struct repository *r,
return NULL;
}
+void copy_branchname(struct strbuf *sb, const char *name, unsigned allowed)
+{
+ int len = strlen(name);
+ struct interpret_branch_name_options options = {
+ .allowed = allowed
+ };
+ int used = repo_interpret_branch_name(the_repository, name, len, sb,
+ &options);
+
+ if (used < 0)
+ used = 0;
+ strbuf_add(sb, name + used, len - used);
+}
+
+int check_branch_ref(struct strbuf *sb, const char *name)
+{
+ if (startup_info->have_repository)
+ copy_branchname(sb, name, INTERPRET_BRANCH_LOCAL);
+ else
+ strbuf_addstr(sb, name);
+
+ /*
+ * This splice must be done even if we end up rejecting the
+ * name; builtin/branch.c::copy_or_rename_branch() still wants
+ * to see what the name expanded to so that "branch -m" can be
+ * used as a tool to correct earlier mistakes.
+ */
+ strbuf_splice(sb, 0, 0, "refs/heads/", 11);
+
+ if (*name == '-' ||
+ !strcmp(sb->buf, "refs/heads/HEAD"))
+ return -1;
+
+ return check_refname_format(sb->buf, 0);
+}
+
+int check_tag_ref(struct strbuf *sb, const char *name)
+{
+ if (name[0] == '-' || !strcmp(name, "HEAD"))
+ return -1;
+
+ strbuf_reset(sb);
+ strbuf_addf(sb, "refs/tags/%s", name);
+
+ return check_refname_format(sb->buf, 0);
+}
+
int repo_dwim_ref(struct repository *r, const char *str, int len,
struct object_id *oid, char **ref, int nonfatal_dangling_mark)
{
@@ -918,7 +966,7 @@ int refs_delete_ref(struct ref_store *refs, const char *msg,
struct ref_transaction *transaction;
struct strbuf err = STRBUF_INIT;
- transaction = ref_store_transaction_begin(refs, &err);
+ transaction = ref_store_transaction_begin(refs, 0, &err);
if (!transaction ||
ref_transaction_delete(transaction, refname, old_oid,
NULL, flags, msg, &err) ||
@@ -1116,6 +1164,7 @@ int read_ref_at(struct ref_store *refs, const char *refname,
}
struct ref_transaction *ref_store_transaction_begin(struct ref_store *refs,
+ unsigned int flags,
struct strbuf *err)
{
struct ref_transaction *tr;
@@ -1123,6 +1172,7 @@ struct ref_transaction *ref_store_transaction_begin(struct ref_store *refs,
CALLOC_ARRAY(tr, 1);
tr->ref_store = refs;
+ tr->flags = flags;
return tr;
}
@@ -1186,8 +1236,9 @@ struct ref_update *ref_transaction_add_update(
oidcpy(&update->new_oid, new_oid);
if ((flags & REF_HAVE_OLD) && old_oid)
oidcpy(&update->old_oid, old_oid);
+ if (!(flags & REF_SKIP_CREATE_REFLOG))
+ update->msg = normalize_reflog_message(msg);
- update->msg = normalize_reflog_message(msg);
return update;
}
@@ -1309,7 +1360,7 @@ int refs_update_ref(struct ref_store *refs, const char *msg,
struct strbuf err = STRBUF_INIT;
int ret = 0;
- t = ref_store_transaction_begin(refs, &err);
+ t = ref_store_transaction_begin(refs, 0, &err);
if (!t ||
ref_transaction_update(t, refname, new_oid, old_oid, NULL, NULL,
flags, msg, &err) ||
@@ -1788,7 +1839,7 @@ static int refs_read_special_head(struct ref_store *ref_store,
}
result = parse_loose_ref_contents(ref_store->repo->hash_algo, content.buf,
- oid, referent, type, failure_errno);
+ oid, referent, type, NULL, failure_errno);
done:
strbuf_release(&full_path);
@@ -2116,19 +2167,53 @@ int peel_iterated_oid(struct repository *r, const struct object_id *base, struct
int refs_update_symref(struct ref_store *refs, const char *ref,
const char *target, const char *logmsg)
{
+ return refs_update_symref_extended(refs, ref, target, logmsg, NULL, 0);
+}
+
+int refs_update_symref_extended(struct ref_store *refs, const char *ref,
+ const char *target, const char *logmsg,
+ struct strbuf *referent, int create_only)
+{
struct ref_transaction *transaction;
struct strbuf err = STRBUF_INIT;
- int ret = 0;
+ int ret = 0, prepret = 0;
- transaction = ref_store_transaction_begin(refs, &err);
- if (!transaction ||
- ref_transaction_update(transaction, ref, NULL, NULL,
- target, NULL, REF_NO_DEREF,
- logmsg, &err) ||
- ref_transaction_commit(transaction, &err)) {
+ transaction = ref_store_transaction_begin(refs, 0, &err);
+ if (!transaction) {
+ error_return:
ret = error("%s", err.buf);
+ goto cleanup;
}
+ if (create_only) {
+ if (ref_transaction_create(transaction, ref, NULL, target,
+ REF_NO_DEREF, logmsg, &err))
+ goto error_return;
+ prepret = ref_transaction_prepare(transaction, &err);
+ if (prepret && prepret != TRANSACTION_CREATE_EXISTS)
+ goto error_return;
+ } else {
+ if (ref_transaction_update(transaction, ref, NULL, NULL,
+ target, NULL, REF_NO_DEREF,
+ logmsg, &err) ||
+ ref_transaction_prepare(transaction, &err))
+ goto error_return;
+ }
+
+ if (referent && refs_read_symbolic_ref(refs, ref, referent) == NOT_A_SYMREF) {
+ struct object_id oid;
+ if (!refs_read_ref(refs, ref, &oid)) {
+ strbuf_addstr(referent, oid_to_hex(&oid));
+ ret = NOT_A_SYMREF;
+ }
+ }
+
+ if (prepret == TRANSACTION_CREATE_EXISTS)
+ goto cleanup;
+ if (ref_transaction_commit(transaction, &err))
+ goto error_return;
+
+cleanup:
strbuf_release(&err);
if (transaction)
ref_transaction_free(transaction);
@@ -2316,7 +2401,7 @@ int ref_transaction_commit(struct ref_transaction *transaction,
}
ret = refs->be->transaction_finish(refs, transaction, err);
- if (!ret)
+ if (!ret && !(transaction->flags & REF_TRANSACTION_FLAG_INITIAL))
run_transaction_hook(transaction, "committed");
return ret;
}
@@ -2325,6 +2410,7 @@ int refs_verify_refname_available(struct ref_store *refs,
const char *refname,
const struct string_list *extras,
const struct string_list *skip,
+ unsigned int initial_transaction,
struct strbuf *err)
{
const char *slash;
@@ -2333,8 +2419,6 @@ int refs_verify_refname_available(struct ref_store *refs,
struct strbuf referent = STRBUF_INIT;
struct object_id oid;
unsigned int type;
- struct ref_iterator *iter;
- int ok;
int ret = -1;
/*
@@ -2364,7 +2448,8 @@ int refs_verify_refname_available(struct ref_store *refs,
if (skip && string_list_has_string(skip, dirname.buf))
continue;
- if (!refs_read_raw_ref(refs, dirname.buf, &oid, &referent,
+ if (!initial_transaction &&
+ !refs_read_raw_ref(refs, dirname.buf, &oid, &referent,
&type, &ignore_errno)) {
strbuf_addf(err, _("'%s' exists; cannot create '%s'"),
dirname.buf, refname);
@@ -2389,21 +2474,26 @@ int refs_verify_refname_available(struct ref_store *refs,
strbuf_addstr(&dirname, refname + dirname.len);
strbuf_addch(&dirname, '/');
- iter = refs_ref_iterator_begin(refs, dirname.buf, NULL, 0,
- DO_FOR_EACH_INCLUDE_BROKEN);
- while ((ok = ref_iterator_advance(iter)) == ITER_OK) {
- if (skip &&
- string_list_has_string(skip, iter->refname))
- continue;
+ if (!initial_transaction) {
+ struct ref_iterator *iter;
+ int ok;
- strbuf_addf(err, _("'%s' exists; cannot create '%s'"),
- iter->refname, refname);
- ref_iterator_abort(iter);
- goto cleanup;
- }
+ iter = refs_ref_iterator_begin(refs, dirname.buf, NULL, 0,
+ DO_FOR_EACH_INCLUDE_BROKEN);
+ while ((ok = ref_iterator_advance(iter)) == ITER_OK) {
+ if (skip &&
+ string_list_has_string(skip, iter->refname))
+ continue;
- if (ok != ITER_DONE)
- BUG("error while iterating over references");
+ strbuf_addf(err, _("'%s' exists; cannot create '%s'"),
+ iter->refname, refname);
+ ref_iterator_abort(iter);
+ goto cleanup;
+ }
+
+ if (ok != ITER_DONE)
+ BUG("error while iterating over references");
+ }
extra_refname = find_descendant_ref(dirname.buf, extras, skip);
if (extra_refname)
@@ -2487,14 +2577,6 @@ int refs_reflog_expire(struct ref_store *refs,
cleanup_fn, policy_cb_data);
}
-int initial_ref_transaction_commit(struct ref_transaction *transaction,
- struct strbuf *err)
-{
- struct ref_store *refs = transaction->ref_store;
-
- return refs->be->initial_transaction_commit(refs, transaction, err);
-}
-
void ref_transaction_for_each_queued_update(struct ref_transaction *transaction,
ref_transaction_for_each_queued_update_fn cb,
void *cb_data)
@@ -2530,7 +2612,7 @@ int refs_delete_refs(struct ref_store *refs, const char *logmsg,
* individual updates can't fail, so we can pack all of the
* updates into a single transaction.
*/
- transaction = ref_store_transaction_begin(refs, &err);
+ transaction = ref_store_transaction_begin(refs, 0, &err);
if (!transaction) {
ret = error("%s", err.buf);
goto out;
@@ -2836,7 +2918,8 @@ int repo_migrate_ref_storage_format(struct repository *repo,
if (ret < 0)
goto done;
- transaction = ref_store_transaction_begin(new_refs, errbuf);
+ transaction = ref_store_transaction_begin(new_refs, REF_TRANSACTION_FLAG_INITIAL,
+ errbuf);
if (!transaction)
goto done;
@@ -2861,13 +2944,6 @@ int repo_migrate_ref_storage_format(struct repository *repo,
if (ret < 0)
goto done;
- /*
- * TODO: we might want to migrate to `initial_ref_transaction_commit()`
- * here, which is more efficient for the files backend because it would
- * write new refs into the packed-refs file directly. At this point,
- * the files backend doesn't handle pseudo-refs and symrefs correctly
- * though, so this requires some more work.
- */
ret = ref_transaction_commit(transaction, errbuf);
if (ret < 0)
goto done;
@@ -2951,4 +3027,3 @@ int ref_update_expects_existing_old_ref(struct ref_update *update)
return (update->flags & REF_HAVE_OLD) &&
(!is_null_oid(&update->old_oid) || update->old_target);
}
-
diff --git a/refs.h b/refs.h
index 108dfc93b3..09be47afbe 100644
--- a/refs.h
+++ b/refs.h
@@ -83,6 +83,17 @@ int refs_read_ref_full(struct ref_store *refs, const char *refname,
int refs_read_ref(struct ref_store *refs, const char *refname, struct object_id *oid);
+#define NOT_A_SYMREF -2
+
+/*
+ * Read the symbolic ref named "refname" and write its immediate referent into
+ * the provided buffer. Referent is left empty if "refname" is not a symbolic
+ * ref. It does not resolve the symbolic reference recursively in case the
+ * target is also a symbolic ref.
+ *
+ * Returns 0 on success, -2 if the "refname" is not a symbolic ref,
+ * -1 otherwise.
+ */
int refs_read_symbolic_ref(struct ref_store *ref_store, const char *refname,
struct strbuf *referent);
@@ -101,13 +112,16 @@ int refs_read_symbolic_ref(struct ref_store *ref_store, const char *refname,
* both "foo" and with "foo/bar/baz" but not with "foo/bar" or
* "foo/barbados".
*
+ * If `initial_transaction` is truish, then all collision checks with
+ * preexisting refs are skipped.
+ *
* extras and skip must be sorted.
*/
-
int refs_verify_refname_available(struct ref_store *refs,
const char *refname,
const struct string_list *extras,
const struct string_list *skip,
+ unsigned int initial_transaction,
struct strbuf *err);
int refs_ref_exists(struct ref_store *refs, const char *refname);
@@ -181,6 +195,35 @@ int repo_dwim_log(struct repository *r, const char *str, int len, struct object_
char *repo_default_branch_name(struct repository *r, int quiet);
/*
+ * Copy "name" to "sb", expanding any special @-marks as handled by
+ * repo_interpret_branch_name(). The result is a non-qualified branch name
+ * (so "foo" or "origin/master" instead of "refs/heads/foo" or
+ * "refs/remotes/origin/master").
+ *
+ * Note that the resulting name may not be a syntactically valid refname.
+ *
+ * If "allowed" is non-zero, restrict the set of allowed expansions. See
+ * repo_interpret_branch_name() for details.
+ */
+void copy_branchname(struct strbuf *sb, const char *name,
+ unsigned allowed);
+
+/*
+ * Like copy_branchname() above, but confirm that the result is
+ * syntactically valid to be used as a local branch name in refs/heads/.
+ *
+ * The return value is "0" if the result is valid, and "-1" otherwise.
+ */
+int check_branch_ref(struct strbuf *sb, const char *name);
+
+/*
+ * Similar for a tag name in refs/tags/.
+ *
+ * The return value is "0" if the result is valid, and "-1" otherwise.
+ */
+int check_tag_ref(struct strbuf *sb, const char *name);
+
+/*
* A ref_transaction represents a collection of reference updates that
* should succeed or fail together.
*
@@ -214,11 +257,9 @@ char *repo_default_branch_name(struct repository *r, int quiet);
*
* Or
*
- * - Call `initial_ref_transaction_commit()` if the ref database is
- * known to be empty and have no other writers (e.g. during
- * clone). This is likely to be much faster than
- * `ref_transaction_commit()`. `ref_transaction_prepare()` should
- * *not* be called before `initial_ref_transaction_commit()`.
+ * - Call `ref_transaction_begin()` with REF_TRANSACTION_FLAG_INITIAL if the
+ * ref database is known to be empty and have no other writers (e.g. during
+ * clone). This is likely to be much faster than without the flag.
*
* - Then finally, call `ref_transaction_free()` to free the
* `ref_transaction` data structure.
@@ -234,7 +275,7 @@ char *repo_default_branch_name(struct repository *r, int quiet);
* struct strbuf err = STRBUF_INIT;
* int ret = 0;
*
- * transaction = ref_store_transaction_begin(refs, &err);
+ * transaction = ref_store_transaction_begin(refs, 0, &err);
* if (!transaction ||
* ref_transaction_update(...) ||
* ref_transaction_create(...) ||
@@ -549,7 +590,8 @@ int check_refname_format(const char *refname, int flags);
* reflogs are consistent, and non-zero otherwise. The errors will be
* written to stderr.
*/
-int refs_fsck(struct ref_store *refs, struct fsck_options *o);
+int refs_fsck(struct ref_store *refs, struct fsck_options *o,
+ struct worktree *wt);
/*
* Apply the rules from check_refname_format, but mutate the result until it
@@ -573,17 +615,37 @@ int refs_copy_existing_ref(struct ref_store *refs, const char *oldref,
int refs_update_symref(struct ref_store *refs, const char *refname,
const char *target, const char *logmsg);
+int refs_update_symref_extended(struct ref_store *refs, const char *refname,
+ const char *target, const char *logmsg,
+ struct strbuf *referent, int create_only);
+
enum action_on_err {
UPDATE_REFS_MSG_ON_ERR,
UPDATE_REFS_DIE_ON_ERR,
UPDATE_REFS_QUIET_ON_ERR
};
+enum ref_transaction_flag {
+ /*
+ * The ref transaction is part of the initial creation of the ref store
+ * and can thus assume that the ref store is completely empty. This
+ * allows the backend to perform the transaction more efficiently by
+ * skipping certain checks.
+ *
+ * It is a bug to set this flag when there might be other processes
+ * accessing the repository or if there are existing references that
+ * might conflict with the ones being created. All old_oid values must
+ * either be absent or null_oid.
+ */
+ REF_TRANSACTION_FLAG_INITIAL = (1 << 0),
+};
+
/*
* Begin a reference transaction. The reference transaction must
* be freed by calling ref_transaction_free().
*/
struct ref_transaction *ref_store_transaction_begin(struct ref_store *refs,
+ unsigned int flags,
struct strbuf *err);
/*
@@ -758,8 +820,10 @@ int ref_transaction_verify(struct ref_transaction *transaction,
/* Naming conflict (for example, the ref names A and A/B conflict). */
#define TRANSACTION_NAME_CONFLICT -1
+/* When only creation was requested, but the ref already exists. */
+#define TRANSACTION_CREATE_EXISTS -2
/* All other errors. */
-#define TRANSACTION_GENERIC_ERROR -2
+#define TRANSACTION_GENERIC_ERROR -3
/*
* Perform the preparatory stages of committing `transaction`. Acquire
@@ -798,20 +862,6 @@ int ref_transaction_abort(struct ref_transaction *transaction,
struct strbuf *err);
/*
- * Like ref_transaction_commit(), but optimized for creating
- * references when originally initializing a repository (e.g., by "git
- * clone"). It writes the new references directly to packed-refs
- * without locking the individual references.
- *
- * It is a bug to call this function when there might be other
- * processes accessing the repository or if there are existing
- * references that might conflict with the ones being created. All
- * old_oid values must either be absent or null_oid.
- */
-int initial_ref_transaction_commit(struct ref_transaction *transaction,
- struct strbuf *err);
-
-/*
* Execute the given callback function for each of the reference updates which
* have been queued in the given transaction. `old_oid` and `new_oid` may be
* `NULL` pointers depending on whether the update has these object IDs set or
diff --git a/refs/debug.c b/refs/debug.c
index 45e2e784a0..a893ae0c90 100644
--- a/refs/debug.c
+++ b/refs/debug.c
@@ -118,18 +118,6 @@ static int debug_transaction_abort(struct ref_store *refs,
return res;
}
-static int debug_initial_transaction_commit(struct ref_store *refs,
- struct ref_transaction *transaction,
- struct strbuf *err)
-{
- struct debug_ref_store *drefs = (struct debug_ref_store *)refs;
- int res;
- transaction->ref_store = drefs->refs;
- res = drefs->refs->be->initial_transaction_commit(drefs->refs,
- transaction, err);
- return res;
-}
-
static int debug_pack_refs(struct ref_store *ref_store, struct pack_refs_opts *opts)
{
struct debug_ref_store *drefs = (struct debug_ref_store *)ref_store;
@@ -420,10 +408,11 @@ static int debug_reflog_expire(struct ref_store *ref_store, const char *refname,
}
static int debug_fsck(struct ref_store *ref_store,
- struct fsck_options *o)
+ struct fsck_options *o,
+ struct worktree *wt)
{
struct debug_ref_store *drefs = (struct debug_ref_store *)ref_store;
- int res = drefs->refs->be->fsck(drefs->refs, o);
+ int res = drefs->refs->be->fsck(drefs->refs, o, wt);
trace_printf_key(&trace_refs, "fsck: %d\n", res);
return res;
}
@@ -443,7 +432,6 @@ struct ref_storage_be refs_be_debug = {
.transaction_prepare = debug_transaction_prepare,
.transaction_finish = debug_transaction_finish,
.transaction_abort = debug_transaction_abort,
- .initial_transaction_commit = debug_initial_transaction_commit,
.pack_refs = debug_pack_refs,
.rename_ref = debug_rename_ref,
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 0824c0b8a9..4e3545de49 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "../git-compat-util.h"
+#include "../abspath.h"
#include "../config.h"
#include "../copy.h"
#include "../environment.h"
@@ -23,6 +24,7 @@
#include "../dir.h"
#include "../chdir-notify.h"
#include "../setup.h"
+#include "../worktree.h"
#include "../wrapper.h"
#include "../write-or-die.h"
#include "../revision.h"
@@ -568,7 +570,7 @@ stat_ref:
buf = sb_contents.buf;
ret = parse_loose_ref_contents(ref_store->repo->hash_algo, buf,
- oid, referent, type, &myerr);
+ oid, referent, type, NULL, &myerr);
out:
if (ret && !myerr)
@@ -596,16 +598,15 @@ static int files_read_symbolic_ref(struct ref_store *ref_store, const char *refn
unsigned int type;
ret = read_ref_internal(ref_store, refname, &oid, referent, &type, &failure_errno, 1);
- if (ret)
- return ret;
-
- return !(type & REF_ISSYMREF);
+ if (!ret && !(type & REF_ISSYMREF))
+ return NOT_A_SYMREF;
+ return ret;
}
int parse_loose_ref_contents(const struct git_hash_algo *algop,
const char *buf, struct object_id *oid,
struct strbuf *referent, unsigned int *type,
- int *failure_errno)
+ const char **trailing, int *failure_errno)
{
const char *p;
if (skip_prefix(buf, "ref:", &buf)) {
@@ -627,6 +628,10 @@ int parse_loose_ref_contents(const struct git_hash_algo *algop,
*failure_errno = EINVAL;
return -1;
}
+
+ if (trailing)
+ *trailing = p;
+
return 0;
}
@@ -706,7 +711,7 @@ retry:
* reason to expect this error to be transitory.
*/
if (refs_verify_refname_available(&refs->base, refname,
- extras, NULL, err)) {
+ extras, NULL, 0, err)) {
if (mustexist) {
/*
* To the user the relevant error is
@@ -813,7 +818,7 @@ retry:
REMOVE_DIR_EMPTY_ONLY)) {
if (refs_verify_refname_available(
&refs->base, refname,
- extras, NULL, err)) {
+ extras, NULL, 0, err)) {
/*
* The error message set by
* verify_refname_available() is OK.
@@ -850,7 +855,7 @@ retry:
*/
if (refs_verify_refname_available(
refs->packed_ref_store, refname,
- extras, NULL, err)) {
+ extras, NULL, 0, err)) {
ret = TRANSACTION_NAME_CONFLICT;
goto error_return;
}
@@ -1159,7 +1164,7 @@ static struct ref_lock *lock_ref_oid_basic(struct files_ref_store *refs,
*/
if (is_null_oid(&lock->old_oid) &&
refs_verify_refname_available(refs->packed_ref_store, refname,
- NULL, NULL, err))
+ NULL, NULL, 0, err))
goto error_return;
lock->ref_name = xstrdup(refname);
@@ -1252,7 +1257,7 @@ static void prune_ref(struct files_ref_store *refs, struct ref_to_prune *r)
if (check_refname_format(r->name, 0))
return;
- transaction = ref_store_transaction_begin(&refs->base, &err);
+ transaction = ref_store_transaction_begin(&refs->base, 0, &err);
if (!transaction)
goto cleanup;
ref_transaction_add_update(
@@ -1396,7 +1401,8 @@ static int files_pack_refs(struct ref_store *ref_store,
if (!should_pack_refs(refs, opts))
return 0;
- transaction = ref_store_transaction_begin(refs->packed_ref_store, &err);
+ transaction = ref_store_transaction_begin(refs->packed_ref_store,
+ 0, &err);
if (!transaction)
return -1;
@@ -1537,7 +1543,7 @@ static int refs_rename_ref_available(struct ref_store *refs,
string_list_insert(&skip, old_refname);
ok = !refs_verify_refname_available(refs, new_refname,
- NULL, &skip, &err);
+ NULL, &skip, 0, &err);
if (!ok)
error("%s", err.buf);
@@ -2502,14 +2508,18 @@ static int split_symref_update(struct ref_update *update,
static int check_old_oid(struct ref_update *update, struct object_id *oid,
struct strbuf *err)
{
+ int ret = TRANSACTION_GENERIC_ERROR;
+
if (!(update->flags & REF_HAVE_OLD) ||
oideq(oid, &update->old_oid))
return 0;
- if (is_null_oid(&update->old_oid))
+ if (is_null_oid(&update->old_oid)) {
strbuf_addf(err, "cannot lock ref '%s': "
"reference already exists",
ref_update_original_update_refname(update));
+ ret = TRANSACTION_CREATE_EXISTS;
+ }
else if (is_null_oid(oid))
strbuf_addf(err, "cannot lock ref '%s': "
"reference is missing but expected %s",
@@ -2522,7 +2532,7 @@ static int check_old_oid(struct ref_update *update, struct object_id *oid,
oid_to_hex(oid),
oid_to_hex(&update->old_oid));
- return -1;
+ return ret;
}
/*
@@ -2602,9 +2612,11 @@ static int lock_ref_for_update(struct files_ref_store *refs,
ret = TRANSACTION_GENERIC_ERROR;
goto out;
}
- } else if (check_old_oid(update, &lock->old_oid, err)) {
- ret = TRANSACTION_GENERIC_ERROR;
- goto out;
+ } else {
+ ret = check_old_oid(update, &lock->old_oid, err);
+ if (ret) {
+ goto out;
+ }
}
} else {
/*
@@ -2635,9 +2647,11 @@ static int lock_ref_for_update(struct files_ref_store *refs,
update->old_target);
ret = TRANSACTION_GENERIC_ERROR;
goto out;
- } else if (check_old_oid(update, &lock->old_oid, err)) {
- ret = TRANSACTION_GENERIC_ERROR;
- goto out;
+ } else {
+ ret = check_old_oid(update, &lock->old_oid, err);
+ if (ret) {
+ goto out;
+ }
}
/*
@@ -2780,6 +2794,8 @@ static int files_transaction_prepare(struct ref_store *ref_store,
assert(err);
+ if (transaction->flags & REF_TRANSACTION_FLAG_INITIAL)
+ goto cleanup;
if (!transaction->nr)
goto cleanup;
@@ -2867,7 +2883,8 @@ static int files_transaction_prepare(struct ref_store *ref_store,
*/
if (!packed_transaction) {
packed_transaction = ref_store_transaction_begin(
- refs->packed_ref_store, err);
+ refs->packed_ref_store,
+ transaction->flags, err);
if (!packed_transaction) {
ret = TRANSACTION_GENERIC_ERROR;
goto cleanup;
@@ -2973,6 +2990,127 @@ static int parse_and_write_reflog(struct files_ref_store *refs,
return 0;
}
+static int ref_present(const char *refname, const char *referent UNUSED,
+ const struct object_id *oid UNUSED,
+ int flags UNUSED,
+ void *cb_data)
+{
+ struct string_list *affected_refnames = cb_data;
+
+ return string_list_has_string(affected_refnames, refname);
+}
+
+static int files_transaction_finish_initial(struct files_ref_store *refs,
+ struct ref_transaction *transaction,
+ struct strbuf *err)
+{
+ size_t i;
+ int ret = 0;
+ struct string_list affected_refnames = STRING_LIST_INIT_NODUP;
+ struct ref_transaction *packed_transaction = NULL;
+ struct ref_transaction *loose_transaction = NULL;
+
+ assert(err);
+
+ if (transaction->state != REF_TRANSACTION_PREPARED)
+ BUG("commit called for transaction that is not prepared");
+
+ /* Fail if a refname appears more than once in the transaction: */
+ for (i = 0; i < transaction->nr; i++)
+ string_list_append(&affected_refnames,
+ transaction->updates[i]->refname);
+ string_list_sort(&affected_refnames);
+ if (ref_update_reject_duplicates(&affected_refnames, err)) {
+ ret = TRANSACTION_GENERIC_ERROR;
+ goto cleanup;
+ }
+
+ /*
+ * It's really undefined to call this function in an active
+ * repository or when there are existing references: we are
+ * only locking and changing packed-refs, so (1) any
+ * simultaneous processes might try to change a reference at
+ * the same time we do, and (2) any existing loose versions of
+ * the references that we are setting would have precedence
+ * over our values. But some remote helpers create the remote
+ * "HEAD" and "master" branches before calling this function,
+ * so here we really only check that none of the references
+ * that we are creating already exists.
+ */
+ if (refs_for_each_rawref(&refs->base, ref_present,
+ &affected_refnames))
+ BUG("initial ref transaction called with existing refs");
+
+ packed_transaction = ref_store_transaction_begin(refs->packed_ref_store,
+ transaction->flags, err);
+ if (!packed_transaction) {
+ ret = TRANSACTION_GENERIC_ERROR;
+ goto cleanup;
+ }
+
+ for (i = 0; i < transaction->nr; i++) {
+ struct ref_update *update = transaction->updates[i];
+
+ if ((update->flags & REF_HAVE_OLD) &&
+ !is_null_oid(&update->old_oid))
+ BUG("initial ref transaction with old_sha1 set");
+
+ if (refs_verify_refname_available(&refs->base, update->refname,
+ &affected_refnames, NULL, 1, err)) {
+ ret = TRANSACTION_NAME_CONFLICT;
+ goto cleanup;
+ }
+
+ /*
+ * packed-refs don't support symbolic refs and root refs, so we
+ * have to queue these references via the loose transaction.
+ */
+ if (update->new_target || is_root_ref(update->refname)) {
+ if (!loose_transaction) {
+ loose_transaction = ref_store_transaction_begin(&refs->base, 0, err);
+ if (!loose_transaction) {
+ ret = TRANSACTION_GENERIC_ERROR;
+ goto cleanup;
+ }
+ }
+
+ ref_transaction_add_update(loose_transaction, update->refname,
+ update->flags & ~REF_HAVE_OLD,
+ update->new_target ? NULL : &update->new_oid, NULL,
+ update->new_target, NULL, NULL);
+ } else {
+ ref_transaction_add_update(packed_transaction, update->refname,
+ update->flags & ~REF_HAVE_OLD,
+ &update->new_oid, &update->old_oid,
+ NULL, NULL, NULL);
+ }
+ }
+
+ if (packed_refs_lock(refs->packed_ref_store, 0, err) ||
+ ref_transaction_commit(packed_transaction, err)) {
+ ret = TRANSACTION_GENERIC_ERROR;
+ goto cleanup;
+ }
+ packed_refs_unlock(refs->packed_ref_store);
+
+ if (loose_transaction) {
+ if (ref_transaction_prepare(loose_transaction, err) ||
+ ref_transaction_commit(loose_transaction, err)) {
+ ret = TRANSACTION_GENERIC_ERROR;
+ goto cleanup;
+ }
+ }
+
+cleanup:
+ if (loose_transaction)
+ ref_transaction_free(loose_transaction);
+ if (packed_transaction)
+ ref_transaction_free(packed_transaction);
+ transaction->state = REF_TRANSACTION_CLOSED;
+ string_list_clear(&affected_refnames, 0);
+ return ret;
+}
+
static int files_transaction_finish(struct ref_store *ref_store,
struct ref_transaction *transaction,
struct strbuf *err)
@@ -2988,6 +3126,8 @@ static int files_transaction_finish(struct ref_store *ref_store,
assert(err);
+ if (transaction->flags & REF_TRANSACTION_FLAG_INITIAL)
+ return files_transaction_finish_initial(refs, transaction, err);
if (!transaction->nr) {
transaction->state = REF_TRANSACTION_CLOSED;
return 0;
@@ -3121,106 +3261,6 @@ static int files_transaction_abort(struct ref_store *ref_store,
return 0;
}
-static int ref_present(const char *refname, const char *referent UNUSED,
- const struct object_id *oid UNUSED,
- int flags UNUSED,
- void *cb_data)
-{
- struct string_list *affected_refnames = cb_data;
-
- return string_list_has_string(affected_refnames, refname);
-}
-
-static int files_initial_transaction_commit(struct ref_store *ref_store,
- struct ref_transaction *transaction,
- struct strbuf *err)
-{
- struct files_ref_store *refs =
- files_downcast(ref_store, REF_STORE_WRITE,
- "initial_ref_transaction_commit");
- size_t i;
- int ret = 0;
- struct string_list affected_refnames = STRING_LIST_INIT_NODUP;
- struct ref_transaction *packed_transaction = NULL;
-
- assert(err);
-
- if (transaction->state != REF_TRANSACTION_OPEN)
- BUG("commit called for transaction that is not open");
-
- /* Fail if a refname appears more than once in the transaction: */
- for (i = 0; i < transaction->nr; i++)
- string_list_append(&affected_refnames,
- transaction->updates[i]->refname);
- string_list_sort(&affected_refnames);
- if (ref_update_reject_duplicates(&affected_refnames, err)) {
- ret = TRANSACTION_GENERIC_ERROR;
- goto cleanup;
- }
-
- /*
- * It's really undefined to call this function in an active
- * repository or when there are existing references: we are
- * only locking and changing packed-refs, so (1) any
- * simultaneous processes might try to change a reference at
- * the same time we do, and (2) any existing loose versions of
- * the references that we are setting would have precedence
- * over our values. But some remote helpers create the remote
- * "HEAD" and "master" branches before calling this function,
- * so here we really only check that none of the references
- * that we are creating already exists.
- */
- if (refs_for_each_rawref(&refs->base, ref_present,
- &affected_refnames))
- BUG("initial ref transaction called with existing refs");
-
- packed_transaction = ref_store_transaction_begin(refs->packed_ref_store, err);
- if (!packed_transaction) {
- ret = TRANSACTION_GENERIC_ERROR;
- goto cleanup;
- }
-
- for (i = 0; i < transaction->nr; i++) {
- struct ref_update *update = transaction->updates[i];
-
- if ((update->flags & REF_HAVE_OLD) &&
- !is_null_oid(&update->old_oid))
- BUG("initial ref transaction with old_sha1 set");
- if (refs_verify_refname_available(&refs->base, update->refname,
- &affected_refnames, NULL,
- err)) {
- ret = TRANSACTION_NAME_CONFLICT;
- goto cleanup;
- }
-
- /*
- * Add a reference creation for this reference to the
- * packed-refs transaction:
- */
- ref_transaction_add_update(packed_transaction, update->refname,
- update->flags & ~REF_HAVE_OLD,
- &update->new_oid, &update->old_oid,
- NULL, NULL, NULL);
- }
-
- if (packed_refs_lock(refs->packed_ref_store, 0, err)) {
- ret = TRANSACTION_GENERIC_ERROR;
- goto cleanup;
- }
-
- if (initial_ref_transaction_commit(packed_transaction, err)) {
- ret = TRANSACTION_GENERIC_ERROR;
- }
-
- packed_refs_unlock(refs->packed_ref_store);
-cleanup:
- if (packed_transaction)
- ref_transaction_free(packed_transaction);
- transaction->state = REF_TRANSACTION_CLOSED;
- string_list_clear(&affected_refnames, 0);
- return ret;
-}
-
struct expire_reflog_cb {
reflog_expiry_should_prune_fn *should_prune_fn;
void *policy_cb;
@@ -3501,12 +3541,153 @@ static int files_ref_store_remove_on_disk(struct ref_store *ref_store,
*/
typedef int (*files_fsck_refs_fn)(struct ref_store *ref_store,
struct fsck_options *o,
- const char *refs_check_dir,
+ const char *refname,
struct dir_iterator *iter);
+static int files_fsck_symref_target(struct fsck_options *o,
+ struct fsck_ref_report *report,
+ struct strbuf *referent,
+ unsigned int symbolic_link)
+{
+ int is_referent_root;
+ char orig_last_byte;
+ size_t orig_len;
+ int ret = 0;
+
+ orig_len = referent->len;
+ orig_last_byte = referent->buf[orig_len - 1];
+ if (!symbolic_link)
+ strbuf_rtrim(referent);
+
+ is_referent_root = is_root_ref(referent->buf);
+ if (!is_referent_root &&
+ !starts_with(referent->buf, "refs/") &&
+ !starts_with(referent->buf, "worktrees/")) {
+ ret = fsck_report_ref(o, report,
+ FSCK_MSG_SYMREF_TARGET_IS_NOT_A_REF,
+ "points to non-ref target '%s'", referent->buf);
+
+ }
+
+ if (!is_referent_root && check_refname_format(referent->buf, 0)) {
+ ret = fsck_report_ref(o, report,
+ FSCK_MSG_BAD_REFERENT_NAME,
+ "points to invalid refname '%s'", referent->buf);
+ goto out;
+ }
+
+ if (symbolic_link)
+ goto out;
+
+ if (referent->len == orig_len ||
+ (referent->len < orig_len && orig_last_byte != '\n')) {
+ ret = fsck_report_ref(o, report,
+ FSCK_MSG_REF_MISSING_NEWLINE,
+ "misses LF at the end");
+ }
+
+ if (referent->len != orig_len && referent->len != orig_len - 1) {
+ ret = fsck_report_ref(o, report,
+ FSCK_MSG_TRAILING_REF_CONTENT,
+ "has trailing whitespaces or newlines");
+ }
+
+out:
+ return ret;
+}
+
+static int files_fsck_refs_content(struct ref_store *ref_store,
+ struct fsck_options *o,
+ const char *target_name,
+ struct dir_iterator *iter)
+{
+ struct strbuf ref_content = STRBUF_INIT;
+ struct strbuf abs_gitdir = STRBUF_INIT;
+ struct strbuf referent = STRBUF_INIT;
+ struct fsck_ref_report report = { 0 };
+ const char *trailing = NULL;
+ unsigned int type = 0;
+ int failure_errno = 0;
+ struct object_id oid;
+ int ret = 0;
+
+ report.path = target_name;
+
+ if (S_ISLNK(iter->st.st_mode)) {
+ const char *relative_referent_path = NULL;
+
+ ret = fsck_report_ref(o, &report,
+ FSCK_MSG_SYMLINK_REF,
+ "use deprecated symbolic link for symref");
+
+ strbuf_add_absolute_path(&abs_gitdir, ref_store->repo->gitdir);
+ strbuf_normalize_path(&abs_gitdir);
+ if (!is_dir_sep(abs_gitdir.buf[abs_gitdir.len - 1]))
+ strbuf_addch(&abs_gitdir, '/');
+
+ strbuf_add_real_path(&ref_content, iter->path.buf);
+ skip_prefix(ref_content.buf, abs_gitdir.buf,
+ &relative_referent_path);
+
+ if (relative_referent_path)
+ strbuf_addstr(&referent, relative_referent_path);
+ else
+ strbuf_addbuf(&referent, &ref_content);
+
+ ret |= files_fsck_symref_target(o, &report, &referent, 1);
+ goto cleanup;
+ }
+
+ if (strbuf_read_file(&ref_content, iter->path.buf, 0) < 0) {
+ /*
+ * Ref file could be removed by another concurrent process. We should
+ * ignore this error and continue to the next ref.
+ */
+ if (errno == ENOENT)
+ goto cleanup;
+
+ ret = error_errno(_("cannot read ref file '%s'"), iter->path.buf);
+ goto cleanup;
+ }
+
+ if (parse_loose_ref_contents(ref_store->repo->hash_algo,
+ ref_content.buf, &oid, &referent,
+ &type, &trailing, &failure_errno)) {
+ strbuf_rtrim(&ref_content);
+ ret = fsck_report_ref(o, &report,
+ FSCK_MSG_BAD_REF_CONTENT,
+ "%s", ref_content.buf);
+ goto cleanup;
+ }
+
+ if (!(type & REF_ISSYMREF)) {
+ if (!*trailing) {
+ ret = fsck_report_ref(o, &report,
+ FSCK_MSG_REF_MISSING_NEWLINE,
+ "misses LF at the end");
+ goto cleanup;
+ }
+ if (*trailing != '\n' || *(trailing + 1)) {
+ ret = fsck_report_ref(o, &report,
+ FSCK_MSG_TRAILING_REF_CONTENT,
+ "has trailing garbage: '%s'", trailing);
+ goto cleanup;
+ }
+ } else {
+ ret = files_fsck_symref_target(o, &report, &referent, 0);
+ goto cleanup;
+ }
+
+cleanup:
+ strbuf_release(&ref_content);
+ strbuf_release(&referent);
+ strbuf_release(&abs_gitdir);
+ return ret;
+}
+
static int files_fsck_refs_name(struct ref_store *ref_store UNUSED,
struct fsck_options *o,
- const char *refs_check_dir,
+ const char *refname,
struct dir_iterator *iter)
{
struct strbuf sb = STRBUF_INIT;
@@ -3519,11 +3700,13 @@ static int files_fsck_refs_name(struct ref_store *ref_store UNUSED,
if (iter->basename[0] != '.' && ends_with(iter->basename, ".lock"))
goto cleanup;
- if (check_refname_format(iter->basename, REFNAME_ALLOW_ONELEVEL)) {
- struct fsck_ref_report report = { .path = NULL };
+ /*
+ * This works right now because we never check the root refs.
+ */
+ if (check_refname_format(refname, 0)) {
+ struct fsck_ref_report report = { 0 };
- strbuf_addf(&sb, "%s/%s", refs_check_dir, iter->relative_path);
- report.path = sb.buf;
+ report.path = refname;
ret = fsck_report_ref(o, &report,
FSCK_MSG_BAD_REF_NAME,
"invalid refname format");
@@ -3537,8 +3720,10 @@ cleanup:
static int files_fsck_refs_dir(struct ref_store *ref_store,
struct fsck_options *o,
const char *refs_check_dir,
+ struct worktree *wt,
files_fsck_refs_fn *fsck_refs_fn)
{
+ struct strbuf refname = STRBUF_INIT;
struct strbuf sb = STRBUF_INIT;
struct dir_iterator *iter;
int iter_status;
@@ -3557,11 +3742,18 @@ static int files_fsck_refs_dir(struct ref_store *ref_store,
continue;
} else if (S_ISREG(iter->st.st_mode) ||
S_ISLNK(iter->st.st_mode)) {
+ strbuf_reset(&refname);
+
+ if (!is_main_worktree(wt))
+ strbuf_addf(&refname, "worktrees/%s/", wt->id);
+ strbuf_addf(&refname, "%s/%s", refs_check_dir,
+ iter->relative_path);
+
if (o->verbose)
- fprintf_ln(stderr, "Checking %s/%s",
- refs_check_dir, iter->relative_path);
+ fprintf_ln(stderr, "Checking %s", refname.buf);
+
for (size_t i = 0; fsck_refs_fn[i]; i++) {
- if (fsck_refs_fn[i](ref_store, o, refs_check_dir, iter))
+ if (fsck_refs_fn[i](ref_store, o, refname.buf, iter))
ret = -1;
}
} else {
@@ -3578,30 +3770,34 @@ static int files_fsck_refs_dir(struct ref_store *ref_store,
out:
strbuf_release(&sb);
+ strbuf_release(&refname);
return ret;
}
static int files_fsck_refs(struct ref_store *ref_store,
- struct fsck_options *o)
+ struct fsck_options *o,
+ struct worktree *wt)
{
files_fsck_refs_fn fsck_refs_fn[]= {
files_fsck_refs_name,
+ files_fsck_refs_content,
NULL,
};
if (o->verbose)
fprintf_ln(stderr, _("Checking references consistency"));
- return files_fsck_refs_dir(ref_store, o, "refs", fsck_refs_fn);
+ return files_fsck_refs_dir(ref_store, o, "refs", wt, fsck_refs_fn);
}
static int files_fsck(struct ref_store *ref_store,
- struct fsck_options *o)
+ struct fsck_options *o,
+ struct worktree *wt)
{
struct files_ref_store *refs =
files_downcast(ref_store, REF_STORE_READ, "fsck");
- return files_fsck_refs(ref_store, o) |
- refs->packed_ref_store->be->fsck(refs->packed_ref_store, o);
+ return files_fsck_refs(ref_store, o, wt) |
+ refs->packed_ref_store->be->fsck(refs->packed_ref_store, o, wt);
}
struct ref_storage_be refs_be_files = {
@@ -3614,7 +3810,6 @@ struct ref_storage_be refs_be_files = {
.transaction_prepare = files_transaction_prepare,
.transaction_finish = files_transaction_finish,
.transaction_abort = files_transaction_abort,
- .initial_transaction_commit = files_initial_transaction_commit,
.pack_refs = files_pack_refs,
.rename_ref = files_rename_ref,
diff --git a/refs/packed-backend.c b/refs/packed-backend.c
index 07c57fd541..3406f1e71d 100644
--- a/refs/packed-backend.c
+++ b/refs/packed-backend.c
@@ -13,6 +13,7 @@
#include "../lockfile.h"
#include "../chdir-notify.h"
#include "../statinfo.h"
+#include "../worktree.h"
#include "../wrapper.h"
#include "../write-or-die.h"
#include "../trace2.h"
@@ -1730,13 +1731,6 @@ cleanup:
return ret;
}
-static int packed_initial_transaction_commit(struct ref_store *ref_store UNUSED,
- struct ref_transaction *transaction,
- struct strbuf *err)
-{
- return ref_transaction_commit(transaction, err);
-}
-
static int packed_pack_refs(struct ref_store *ref_store UNUSED,
struct pack_refs_opts *pack_opts UNUSED)
{
@@ -1754,8 +1748,13 @@ static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *ref_s
}
static int packed_fsck(struct ref_store *ref_store UNUSED,
- struct fsck_options *o UNUSED)
+ struct fsck_options *o UNUSED,
+ struct worktree *wt)
{
+
+ if (!is_main_worktree(wt))
+ return 0;
+
return 0;
}
@@ -1769,7 +1768,6 @@ struct ref_storage_be refs_be_packed = {
.transaction_prepare = packed_transaction_prepare,
.transaction_finish = packed_transaction_finish,
.transaction_abort = packed_transaction_abort,
- .initial_transaction_commit = packed_initial_transaction_commit,
.pack_refs = packed_pack_refs,
.rename_ref = NULL,
diff --git a/refs/ref-cache.c b/refs/ref-cache.c
index 35bae7e05d..02f09e4df8 100644
--- a/refs/ref-cache.c
+++ b/refs/ref-cache.c
@@ -68,8 +68,9 @@ static void free_ref_entry(struct ref_entry *entry)
* trigger the reading of loose refs.
*/
clear_ref_dir(&entry->u.subdir);
+ } else {
+ free(entry->u.value.referent);
}
- free(entry->u.value.referent);
free(entry);
}
diff --git a/refs/refs-internal.h b/refs/refs-internal.h
index 2313c830d8..66e66e0fc1 100644
--- a/refs/refs-internal.h
+++ b/refs/refs-internal.h
@@ -193,6 +193,7 @@ struct ref_transaction {
size_t nr;
enum ref_transaction_state state;
void *backend_data;
+ unsigned int flags;
};
/*
@@ -653,7 +654,8 @@ typedef int read_symbolic_ref_fn(struct ref_store *ref_store, const char *refnam
struct strbuf *referent);
typedef int fsck_fn(struct ref_store *ref_store,
- struct fsck_options *o);
+ struct fsck_options *o,
+ struct worktree *wt);
struct ref_storage_be {
const char *name;
@@ -665,7 +667,6 @@ struct ref_storage_be {
ref_transaction_prepare_fn *transaction_prepare;
ref_transaction_finish_fn *transaction_finish;
ref_transaction_abort_fn *transaction_abort;
- ref_transaction_commit_fn *initial_transaction_commit;
pack_refs_fn *pack_refs;
rename_ref_fn *rename_ref;
@@ -673,6 +674,11 @@ struct ref_storage_be {
ref_iterator_begin_fn *iterator_begin;
read_raw_ref_fn *read_raw_ref;
+
+ /*
+ * Please refer to `refs_read_symbolic_ref()` for the expected
+ * behaviour.
+ */
read_symbolic_ref_fn *read_symbolic_ref;
reflog_iterator_begin_fn *reflog_iterator_begin;
@@ -715,7 +721,7 @@ struct ref_store {
int parse_loose_ref_contents(const struct git_hash_algo *algop,
const char *buf, struct object_id *oid,
struct strbuf *referent, unsigned int *type,
- int *failure_errno);
+ const char **trailing, int *failure_errno);
/*
* Fill in the generic part of refs and add it to our collection of
diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
index 38eb14d591..8a2a5b847c 100644
--- a/refs/reftable-backend.c
+++ b/refs/reftable-backend.c
@@ -15,6 +15,7 @@
#include "../object.h"
#include "../path.h"
#include "../refs.h"
+#include "../reftable/reftable-basics.h"
#include "../reftable/reftable-stack.h"
#include "../reftable/reftable-record.h"
#include "../reftable/reftable-error.h"
@@ -23,6 +24,7 @@
#include "../setup.h"
#include "../strmap.h"
#include "../trace2.h"
+#include "../write-or-die.h"
#include "parse.h"
#include "refs-internal.h"
@@ -32,24 +34,111 @@
*/
#define REF_UPDATE_VIA_HEAD (1 << 8)
+struct reftable_backend {
+ struct reftable_stack *stack;
+ struct reftable_iterator it;
+};
+
+static void reftable_backend_on_reload(void *payload)
+{
+ struct reftable_backend *be = payload;
+ reftable_iterator_destroy(&be->it);
+}
+
+static int reftable_backend_init(struct reftable_backend *be,
+ const char *path,
+ const struct reftable_write_options *_opts)
+{
+ struct reftable_write_options opts = *_opts;
+ opts.on_reload = reftable_backend_on_reload;
+ opts.on_reload_payload = be;
+ return reftable_new_stack(&be->stack, path, &opts);
+}
+
+static void reftable_backend_release(struct reftable_backend *be)
+{
+ reftable_stack_destroy(be->stack);
+ be->stack = NULL;
+ reftable_iterator_destroy(&be->it);
+}
+
+static int reftable_backend_read_ref(struct reftable_backend *be,
+ const char *refname,
+ struct object_id *oid,
+ struct strbuf *referent,
+ unsigned int *type)
+{
+ struct reftable_ref_record ref = {0};
+ int ret;
+
+ if (!be->it.ops) {
+ ret = reftable_stack_init_ref_iterator(be->stack, &be->it);
+ if (ret)
+ goto done;
+ }
+
+ ret = reftable_iterator_seek_ref(&be->it, refname);
+ if (ret)
+ goto done;
+
+ ret = reftable_iterator_next_ref(&be->it, &ref);
+ if (ret)
+ goto done;
+
+ if (strcmp(ref.refname, refname)) {
+ ret = 1;
+ 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)) {
+ unsigned int hash_id;
+
+ switch (reftable_stack_hash_id(be->stack)) {
+ case REFTABLE_HASH_SHA1:
+ hash_id = GIT_HASH_SHA1;
+ break;
+ case REFTABLE_HASH_SHA256:
+ hash_id = GIT_HASH_SHA256;
+ break;
+ default:
+ BUG("unhandled hash ID %d", reftable_stack_hash_id(be->stack));
+ }
+
+ oidread(oid, reftable_ref_record_val1(&ref),
+ &hash_algos[hash_id]);
+ } 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;
+}
+
struct reftable_ref_store {
struct ref_store base;
/*
- * The main stack refers to the common dir and thus contains common
+ * The main backend refers to the common dir and thus contains common
* refs as well as refs of the main repository.
*/
- struct reftable_stack *main_stack;
+ struct reftable_backend main_backend;
/*
- * The worktree stack refers to the gitdir in case the refdb is opened
+ * The worktree backend 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;
+ struct reftable_backend worktree_backend;
/*
- * Map of worktree stacks by their respective worktree names. The map
+ * Map of worktree backends by their respective worktree names. The map
* is populated lazily when we try to resolve `worktrees/$worktree` refs.
*/
- struct strmap worktree_stacks;
+ struct strmap worktree_backends;
struct reftable_write_options write_options;
unsigned int store_flags;
@@ -95,21 +184,25 @@ static struct reftable_ref_store *reftable_be_downcast(struct ref_store *ref_sto
* 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)
+static int backend_for(struct reftable_backend **out,
+ struct reftable_ref_store *store,
+ const char *refname,
+ const char **rewritten_ref,
+ int reload)
{
+ struct reftable_backend *be;
const char *wtname;
int wtname_len;
- if (!refname)
- return store->main_stack;
+ if (!refname) {
+ be = &store->main_backend;
+ goto out;
+ }
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
@@ -123,40 +216,55 @@ static struct reftable_stack *stack_for(struct reftable_ref_store *store,
/*
* 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
+ * `worktree_backends` and once via `worktree_backend`. 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) {
+ be = strmap_get(&store->worktree_backends, wtname_buf.buf);
+ if (!be) {
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);
+ CALLOC_ARRAY(be, 1);
+ store->err = reftable_backend_init(be, wt_dir.buf,
+ &store->write_options);
assert(store->err != REFTABLE_API_ERROR);
- strmap_put(&store->worktree_stacks, wtname_buf.buf, stack);
+
+ strmap_put(&store->worktree_backends, wtname_buf.buf, be);
}
strbuf_release(&wt_dir);
- return stack;
+ goto out;
}
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;
+ if (!store->worktree_backend.stack)
+ be = &store->main_backend;
+ else
+ be = &store->worktree_backend;
+ goto out;
case REF_WORKTREE_MAIN:
case REF_WORKTREE_SHARED:
- return store->main_stack;
+ be = &store->main_backend;
+ goto out;
default:
BUG("unhandled worktree reference type");
}
+
+out:
+ if (reload) {
+ int ret = reftable_stack_reload(be->stack);
+ if (ret)
+ return ret;
+ }
+ *out = be;
+
+ return 0;
}
static int should_write_log(struct reftable_ref_store *refs, const char *refname)
@@ -205,38 +313,6 @@ static void fill_reftable_log_record(struct reftable_log_record *log, const stru
log->value.update.tz_offset = sign * atoi(tz_begin);
}
-static int read_ref_without_reload(struct reftable_ref_store *refs,
- 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),
- refs->base.repo->hash_algo);
- } 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 int reftable_be_config(const char *var, const char *value,
const struct config_context *ctx,
void *_opts)
@@ -272,6 +348,11 @@ static int reftable_be_config(const char *var, const char *value,
return 0;
}
+static int reftable_be_fsync(int fd)
+{
+ return fsync_component(FSYNC_COMPONENT_REFERENCE, fd);
+}
+
static struct ref_store *reftable_be_init(struct repository *repo,
const char *gitdir,
unsigned int store_flags)
@@ -285,15 +366,25 @@ static struct ref_store *reftable_be_init(struct repository *repo,
umask(mask);
base_ref_store_init(&refs->base, repo, gitdir, &refs_be_reftable);
- strmap_init(&refs->worktree_stacks);
+ strmap_init(&refs->worktree_backends);
refs->store_flags = store_flags;
refs->log_all_ref_updates = repo_settings_get_log_all_ref_updates(repo);
- refs->write_options.hash_id = repo->hash_algo->format_id;
+ switch (repo->hash_algo->format_id) {
+ case GIT_SHA1_FORMAT_ID:
+ refs->write_options.hash_id = REFTABLE_HASH_SHA1;
+ break;
+ case GIT_SHA256_FORMAT_ID:
+ refs->write_options.hash_id = REFTABLE_HASH_SHA256;
+ break;
+ default:
+ BUG("unknown hash algorithm %d", repo->hash_algo->format_id);
+ }
refs->write_options.default_permissions = calc_shared_perm(0666 & ~mask);
refs->write_options.disable_auto_compact =
!git_env_bool("GIT_TEST_REFTABLE_AUTOCOMPACTION", 1);
refs->write_options.lock_timeout_ms = 100;
+ refs->write_options.fsync = reftable_be_fsync;
git_config(reftable_be_config, &refs->write_options);
@@ -320,8 +411,8 @@ static struct ref_store *reftable_be_init(struct repository *repo,
strbuf_realpath(&path, gitdir, 0);
}
strbuf_addstr(&path, "/reftable");
- refs->err = reftable_new_stack(&refs->main_stack, path.buf,
- &refs->write_options);
+ refs->err = reftable_backend_init(&refs->main_backend, path.buf,
+ &refs->write_options);
if (refs->err)
goto done;
@@ -337,8 +428,8 @@ static struct ref_store *reftable_be_init(struct repository *repo,
strbuf_reset(&path);
strbuf_addf(&path, "%s/reftable", gitdir);
- refs->err = reftable_new_stack(&refs->worktree_stack, path.buf,
- &refs->write_options);
+ refs->err = reftable_backend_init(&refs->worktree_backend, path.buf,
+ &refs->write_options);
if (refs->err)
goto done;
}
@@ -357,19 +448,17 @@ static void reftable_be_release(struct ref_store *ref_store)
struct strmap_entry *entry;
struct hashmap_iter iter;
- if (refs->main_stack) {
- reftable_stack_destroy(refs->main_stack);
- refs->main_stack = NULL;
- }
+ if (refs->main_backend.stack)
+ reftable_backend_release(&refs->main_backend);
+ if (refs->worktree_backend.stack)
+ reftable_backend_release(&refs->worktree_backend);
- if (refs->worktree_stack) {
- reftable_stack_destroy(refs->worktree_stack);
- refs->worktree_stack = NULL;
+ strmap_for_each_entry(&refs->worktree_backends, &iter, entry) {
+ struct reftable_backend *be = entry->value;
+ reftable_backend_release(be);
+ free(be);
}
-
- strmap_for_each_entry(&refs->worktree_stacks, &iter, entry)
- reftable_stack_destroy(entry->value);
- strmap_clear(&refs->worktree_stacks, 0);
+ strmap_clear(&refs->worktree_backends, 0);
}
static int reftable_be_create_on_disk(struct ref_store *ref_store,
@@ -764,7 +853,7 @@ static struct ref_iterator *reftable_be_iterator_begin(struct ref_store *ref_sto
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,
+ main_iter = ref_iterator_for_stack(refs, refs->main_backend.stack, prefix,
exclude_patterns, flags);
/*
@@ -772,14 +861,14 @@ static struct ref_iterator *reftable_be_iterator_begin(struct ref_store *ref_sto
* right now. If we aren't, then we return the common reftable
* iterator, only.
*/
- if (!refs->worktree_stack)
+ if (!refs->worktree_backend.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,
+ worktree_iter = ref_iterator_for_stack(refs, refs->worktree_backend.stack, prefix,
exclude_patterns, flags);
return merge_ref_iterator_begin(&worktree_iter->base, &main_iter->base,
ref_iterator_select, NULL);
@@ -794,17 +883,17 @@ static int reftable_be_read_raw_ref(struct ref_store *ref_store,
{
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);
+ struct reftable_backend *be;
int ret;
if (refs->err < 0)
return refs->err;
- ret = reftable_stack_reload(stack);
+ ret = backend_for(&be, refs, refname, &refname, 1);
if (ret)
return ret;
- ret = read_ref_without_reload(refs, stack, refname, oid, referent, type);
+ ret = reftable_backend_read_ref(be, refname, oid, referent, type);
if (ret < 0)
return ret;
if (ret > 0) {
@@ -821,21 +910,22 @@ static int reftable_be_read_symbolic_ref(struct ref_store *ref_store,
{
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};
+ struct reftable_backend *be;
+ struct object_id oid;
+ unsigned int type = 0;
int ret;
- ret = reftable_stack_reload(stack);
+ ret = backend_for(&be, refs, refname, &refname, 1);
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 = reftable_backend_read_ref(be, refname, &oid, referent, &type);
+ if (ret)
ret = -1;
-
- reftable_ref_record_release(&ref);
+ else if (type == REF_ISSYMREF)
+ ; /* happy */
+ else
+ ret = NOT_A_SYMREF;
return ret;
}
@@ -846,7 +936,7 @@ struct reftable_transaction_update {
struct write_transaction_table_arg {
struct reftable_ref_store *refs;
- struct reftable_stack *stack;
+ struct reftable_backend *be;
struct reftable_addition *addition;
struct reftable_transaction_update *updates;
size_t updates_nr;
@@ -881,27 +971,37 @@ static int prepare_transaction_update(struct write_transaction_table_arg **out,
struct ref_update *update,
struct strbuf *err)
{
- struct reftable_stack *stack = stack_for(refs, update->refname, NULL);
struct write_transaction_table_arg *arg = NULL;
+ struct reftable_backend *be;
size_t i;
int ret;
/*
+ * This function gets called in a loop, and we don't want to repeatedly
+ * reload the stack for every single ref update. Instead, we manually
+ * reload further down in the case where we haven't yet prepared the
+ * specific `reftable_backend`.
+ */
+ ret = backend_for(&be, refs, update->refname, NULL, 0);
+ if (ret)
+ return 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)
+ if (tx_data->args[i].be == be)
arg = &tx_data->args[i];
if (!arg) {
struct reftable_addition *addition;
- ret = reftable_stack_reload(stack);
+ ret = reftable_stack_reload(be->stack);
if (ret)
return ret;
- ret = reftable_stack_new_addition(&addition, stack,
+ ret = reftable_stack_new_addition(&addition, be->stack,
REFTABLE_STACK_NEW_ADDITION_RELOAD);
if (ret) {
if (ret == REFTABLE_LOCK_ERROR)
@@ -913,7 +1013,7 @@ static int prepare_transaction_update(struct write_transaction_table_arg **out,
tx_data->args_alloc);
arg = &tx_data->args[tx_data->args_nr++];
arg->refs = refs;
- arg->stack = stack;
+ arg->be = be;
arg->addition = addition;
arg->updates = NULL;
arg->updates_nr = 0;
@@ -968,6 +1068,7 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store,
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 reftable_backend *be;
struct object_id head_oid;
unsigned int head_type = 0;
size_t i;
@@ -1014,8 +1115,23 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store,
goto done;
}
- ret = read_ref_without_reload(refs, stack_for(refs, "HEAD", NULL), "HEAD",
- &head_oid, &head_referent, &head_type);
+ /*
+ * TODO: it's dubious whether we should reload the stack that "HEAD"
+ * belongs to or not. In theory, it may happen that we only modify
+ * stacks which are _not_ part of the "HEAD" stack. In that case we
+ * wouldn't have prepared any transaction for its stack and would not
+ * have reloaded it, which may mean that it is stale.
+ *
+ * On the other hand, reloading that stack without locking it feels
+ * wrong, too, as the value of "HEAD" could be modified concurrently at
+ * any point in time.
+ */
+ ret = backend_for(&be, refs, "HEAD", NULL, 0);
+ if (ret)
+ goto done;
+
+ ret = reftable_backend_read_ref(be, "HEAD", &head_oid,
+ &head_referent, &head_type);
if (ret < 0)
goto done;
ret = 0;
@@ -1023,10 +1139,18 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store,
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);
+ /*
+ * There is no need to reload the respective backends here as
+ * we have already reloaded them when preparing the transaction
+ * update. And given that the stacks have been locked there
+ * shouldn't have been any concurrent modifications of the
+ * stack.
+ */
+ ret = backend_for(&be, refs, u->refname, &rewritten_ref, 0);
+ if (ret)
+ goto done;
/* Verify that the new object ID is valid. */
if ((u->flags & REF_HAVE_NEW) && !is_null_oid(&u->new_oid) &&
@@ -1082,8 +1206,8 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store,
string_list_insert(&affected_refnames, new_update->refname);
}
- ret = read_ref_without_reload(refs, stack, rewritten_ref,
- &current_oid, &referent, &u->type);
+ ret = reftable_backend_read_ref(be, rewritten_ref,
+ &current_oid, &referent, &u->type);
if (ret < 0)
goto done;
if (ret > 0 && !ref_update_expects_existing_old_ref(u)) {
@@ -1097,7 +1221,9 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store,
* at a later point.
*/
ret = refs_verify_refname_available(ref_store, u->refname,
- &affected_refnames, NULL, err);
+ &affected_refnames, NULL,
+ transaction->flags & REF_TRANSACTION_FLAG_INITIAL,
+ err);
if (ret < 0)
goto done;
@@ -1206,10 +1332,13 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store,
goto done;
}
} else if ((u->flags & REF_HAVE_OLD) && !oideq(&current_oid, &u->old_oid)) {
- if (is_null_oid(&u->old_oid))
+ ret = TRANSACTION_NAME_CONFLICT;
+ if (is_null_oid(&u->old_oid)) {
strbuf_addf(err, _("cannot lock ref '%s': "
"reference already exists"),
ref_update_original_update_refname(u));
+ ret = TRANSACTION_CREATE_EXISTS;
+ }
else if (is_null_oid(&current_oid))
strbuf_addf(err, _("cannot lock ref '%s': "
"reference is missing but expected %s"),
@@ -1221,7 +1350,6 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store,
ref_update_original_update_refname(u),
oid_to_hex(&current_oid),
oid_to_hex(&u->old_oid));
- ret = -1;
goto done;
}
@@ -1284,7 +1412,7 @@ static int transaction_update_cmp(const void *a, const void *b)
static int write_transaction_table(struct reftable_writer *writer, void *cb_data)
{
struct write_transaction_table_arg *arg = cb_data;
- uint64_t ts = reftable_stack_next_update_index(arg->stack);
+ uint64_t ts = reftable_stack_next_update_index(arg->be->stack);
struct reftable_log_record *logs = NULL;
struct ident_split committer_ident = {0};
size_t logs_nr = 0, logs_alloc = 0, i;
@@ -1320,7 +1448,7 @@ static int write_transaction_table(struct reftable_writer *writer, void *cb_data
struct reftable_log_record log = {0};
struct reftable_iterator it = {0};
- ret = reftable_stack_init_log_iterator(arg->stack, &it);
+ ret = reftable_stack_init_log_iterator(arg->be->stack, &it);
if (ret < 0)
goto done;
@@ -1490,13 +1618,6 @@ done:
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)
{
@@ -1508,9 +1629,9 @@ static int reftable_be_pack_refs(struct ref_store *ref_store,
if (refs->err)
return refs->err;
- stack = refs->worktree_stack;
+ stack = refs->worktree_backend.stack;
if (!stack)
- stack = refs->main_stack;
+ stack = refs->main_backend.stack;
if (opts->flags & PACK_REFS_AUTO)
ret = reftable_stack_auto_compact(stack);
@@ -1541,7 +1662,7 @@ struct write_create_symref_arg {
struct write_copy_arg {
struct reftable_ref_store *refs;
- struct reftable_stack *stack;
+ struct reftable_backend *be;
const char *oldname;
const char *newname;
const char *logmsg;
@@ -1566,7 +1687,7 @@ static int write_copy_table(struct reftable_writer *writer, void *cb_data)
if (split_ident_line(&committer_ident, committer_info, strlen(committer_info)))
BUG("failed splitting committer info");
- if (reftable_stack_read_ref(arg->stack, arg->oldname, &old_ref)) {
+ if (reftable_stack_read_ref(arg->be->stack, arg->oldname, &old_ref)) {
ret = error(_("refname %s not found"), arg->oldname);
goto done;
}
@@ -1591,7 +1712,7 @@ static int write_copy_table(struct reftable_writer *writer, void *cb_data)
if (arg->delete_old)
string_list_insert(&skip, arg->oldname);
ret = refs_verify_refname_available(&arg->refs->base, arg->newname,
- NULL, &skip, &errbuf);
+ NULL, &skip, 0, &errbuf);
if (ret < 0) {
error("%s", errbuf.buf);
goto done;
@@ -1605,7 +1726,7 @@ static int write_copy_table(struct reftable_writer *writer, void *cb_data)
* 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);
+ deletion_ts = creation_ts = reftable_stack_next_update_index(arg->be->stack);
if (arg->delete_old)
creation_ts++;
reftable_writer_set_limits(writer, deletion_ts, creation_ts);
@@ -1648,8 +1769,8 @@ static int write_copy_table(struct reftable_writer *writer, void *cb_data)
memcpy(logs[logs_nr].value.update.old_hash, old_ref.value.val1, GIT_MAX_RAWSZ);
logs_nr++;
- ret = read_ref_without_reload(arg->refs, arg->stack, "HEAD", &head_oid,
- &head_referent, &head_type);
+ ret = reftable_backend_read_ref(arg->be, "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);
@@ -1692,7 +1813,7 @@ static int write_copy_table(struct reftable_writer *writer, void *cb_data)
* 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_stack_init_log_iterator(arg->stack, &it);
+ ret = reftable_stack_init_log_iterator(arg->be->stack, &it);
if (ret < 0)
goto done;
@@ -1765,10 +1886,8 @@ static int reftable_be_rename_ref(struct ref_store *ref_store,
{
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,
@@ -1780,10 +1899,10 @@ static int reftable_be_rename_ref(struct ref_store *ref_store,
if (ret < 0)
goto done;
- ret = reftable_stack_reload(stack);
+ ret = backend_for(&arg.be, refs, newrefname, &newrefname, 1);
if (ret)
goto done;
- ret = reftable_stack_add(stack, &write_copy_table, &arg);
+ ret = reftable_stack_add(arg.be->stack, &write_copy_table, &arg);
done:
assert(ret != REFTABLE_API_ERROR);
@@ -1797,10 +1916,8 @@ static int reftable_be_copy_ref(struct ref_store *ref_store,
{
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,
@@ -1811,10 +1928,10 @@ static int reftable_be_copy_ref(struct ref_store *ref_store,
if (ret < 0)
goto done;
- ret = reftable_stack_reload(stack);
+ ret = backend_for(&arg.be, refs, newrefname, &newrefname, 1);
if (ret)
goto done;
- ret = reftable_stack_add(stack, &write_copy_table, &arg);
+ ret = reftable_stack_add(arg.be->stack, &write_copy_table, &arg);
done:
assert(ret != REFTABLE_API_ERROR);
@@ -1935,11 +2052,11 @@ static struct ref_iterator *reftable_be_reflog_iterator_begin(struct ref_store *
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)
+ main_iter = reflog_iterator_for_stack(refs, refs->main_backend.stack);
+ if (!refs->worktree_backend.stack)
return &main_iter->base;
- worktree_iter = reflog_iterator_for_stack(refs, refs->worktree_stack);
+ worktree_iter = reflog_iterator_for_stack(refs, refs->worktree_backend.stack);
return merge_ref_iterator_begin(&worktree_iter->base, &main_iter->base,
ref_iterator_select, NULL);
@@ -1978,15 +2095,23 @@ static int reftable_be_for_each_reflog_ent_reverse(struct ref_store *ref_store,
{
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_log_record log = {0};
struct reftable_iterator it = {0};
+ struct reftable_backend *be;
int ret;
if (refs->err < 0)
return refs->err;
- ret = reftable_stack_init_log_iterator(stack, &it);
+ /*
+ * TODO: we should adapt this callsite to reload the stack. There is no
+ * obvious reason why we shouldn't.
+ */
+ ret = backend_for(&be, refs, refname, &refname, 0);
+ if (ret)
+ goto done;
+
+ ret = reftable_stack_init_log_iterator(be->stack, &it);
if (ret < 0)
goto done;
@@ -2018,16 +2143,24 @@ static int reftable_be_for_each_reflog_ent(struct ref_store *ref_store,
{
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_log_record *logs = NULL;
struct reftable_iterator it = {0};
+ struct reftable_backend *be;
size_t logs_alloc = 0, logs_nr = 0, i;
int ret;
if (refs->err < 0)
return refs->err;
- ret = reftable_stack_init_log_iterator(stack, &it);
+ /*
+ * TODO: we should adapt this callsite to reload the stack. There is no
+ * obvious reason why we shouldn't.
+ */
+ ret = backend_for(&be, refs, refname, &refname, 0);
+ if (ret)
+ goto done;
+
+ ret = reftable_stack_init_log_iterator(be->stack, &it);
if (ret < 0)
goto done;
@@ -2067,20 +2200,20 @@ static int reftable_be_reflog_exists(struct ref_store *ref_store,
{
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_log_record log = {0};
struct reftable_iterator it = {0};
+ struct reftable_backend *be;
int ret;
ret = refs->err;
if (ret < 0)
goto done;
- ret = reftable_stack_reload(stack);
+ ret = backend_for(&be, refs, refname, &refname, 1);
if (ret < 0)
goto done;
- ret = reftable_stack_init_log_iterator(stack, &it);
+ ret = reftable_stack_init_log_iterator(be->stack, &it);
if (ret < 0)
goto done;
@@ -2152,10 +2285,9 @@ static int reftable_be_create_reflog(struct ref_store *ref_store,
{
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 reftable_backend *be;
struct write_reflog_existence_arg arg = {
.refs = refs,
- .stack = stack,
.refname = refname,
};
int ret;
@@ -2164,11 +2296,12 @@ static int reftable_be_create_reflog(struct ref_store *ref_store,
if (ret < 0)
goto done;
- ret = reftable_stack_reload(stack);
+ ret = backend_for(&be, refs, refname, &refname, 1);
if (ret)
goto done;
+ arg.stack = be->stack;
- ret = reftable_stack_add(stack, &write_reflog_existence_table, &arg);
+ ret = reftable_stack_add(be->stack, &write_reflog_existence_table, &arg);
done:
return ret;
@@ -2226,17 +2359,18 @@ static int reftable_be_delete_reflog(struct ref_store *ref_store,
{
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 reftable_backend *be;
struct write_reflog_delete_arg arg = {
- .stack = stack,
.refname = refname,
};
int ret;
- ret = reftable_stack_reload(stack);
+ ret = backend_for(&be, refs, refname, &refname, 1);
if (ret)
return ret;
- ret = reftable_stack_add(stack, &write_reflog_delete_table, &arg);
+ arg.stack = be->stack;
+
+ ret = reftable_stack_add(be->stack, &write_reflog_delete_table, &arg);
assert(ret != REFTABLE_API_ERROR);
return ret;
@@ -2335,26 +2469,27 @@ static int reftable_be_reflog_expire(struct ref_store *ref_store,
*/
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_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 reftable_backend *be;
struct object_id oid = {0};
+ struct strbuf referent = STRBUF_INIT;
uint8_t *last_hash = NULL;
size_t logs_nr = 0, logs_alloc = 0, i;
+ unsigned int type = 0;
int ret;
if (refs->err < 0)
return refs->err;
- ret = reftable_stack_reload(stack);
+ ret = backend_for(&be, refs, refname, &refname, 1);
if (ret < 0)
goto done;
- ret = reftable_stack_init_log_iterator(stack, &it);
+ ret = reftable_stack_init_log_iterator(be->stack, &it);
if (ret < 0)
goto done;
@@ -2362,16 +2497,13 @@ static int reftable_be_reflog_expire(struct ref_store *ref_store,
if (ret < 0)
goto done;
- ret = reftable_stack_new_addition(&add, stack, 0);
+ ret = reftable_stack_new_addition(&add, be->stack, 0);
if (ret < 0)
goto done;
- ret = reftable_stack_read_ref(stack, refname, &ref_record);
+ ret = reftable_backend_read_ref(be, refname, &oid, &referent, &type);
if (ret < 0)
goto done;
- if (reftable_ref_record_val1(&ref_record))
- oidread(&oid, reftable_ref_record_val1(&ref_record),
- ref_store->repo->hash_algo);
prepare_fn(refname, &oid, policy_cb_data);
while (1) {
@@ -2438,15 +2570,14 @@ static int reftable_be_reflog_expire(struct ref_store *ref_store,
}
}
- if (flags & EXPIRE_REFLOGS_UPDATE_REF && last_hash &&
- reftable_ref_record_val1(&ref_record))
+ if (flags & EXPIRE_REFLOGS_UPDATE_REF && last_hash && !is_null_oid(&oid))
oidread(&arg.update_oid, last_hash, ref_store->repo->hash_algo);
arg.refs = refs;
arg.records = rewritten;
arg.len = logs_nr;
- arg.stack = stack,
- arg.refname = refname,
+ arg.stack = be->stack;
+ arg.refname = refname;
ret = reftable_addition_add(add, &write_reflog_expiry_table, &arg);
if (ret < 0)
@@ -2464,18 +2595,19 @@ done:
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]);
+ strbuf_release(&referent);
free(logs);
free(rewritten);
return ret;
}
static int reftable_be_fsck(struct ref_store *ref_store UNUSED,
- struct fsck_options *o UNUSED)
+ struct fsck_options *o UNUSED,
+ struct worktree *wt UNUSED)
{
return 0;
}
@@ -2490,7 +2622,6 @@ struct ref_storage_be refs_be_reftable = {
.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,
.rename_ref = reftable_be_rename_ref,
diff --git a/reftable/basics.c b/reftable/basics.c
index bc4fcc9144..70b1091d14 100644
--- a/reftable/basics.c
+++ b/reftable/basics.c
@@ -17,6 +17,8 @@ static void (*reftable_free_ptr)(void *);
void *reftable_malloc(size_t sz)
{
+ if (!sz)
+ return NULL;
if (reftable_malloc_ptr)
return (*reftable_malloc_ptr)(sz);
return malloc(sz);
@@ -24,6 +26,11 @@ void *reftable_malloc(size_t sz)
void *reftable_realloc(void *p, size_t sz)
{
+ if (!sz) {
+ reftable_free(p);
+ return NULL;
+ }
+
if (reftable_realloc_ptr)
return (*reftable_realloc_ptr)(p, sz);
return realloc(p, sz);
@@ -271,14 +278,15 @@ int common_prefix_size(struct reftable_buf *a, struct reftable_buf *b)
return p;
}
-int hash_size(uint32_t id)
+int hash_size(enum reftable_hash id)
{
+ if (!id)
+ return REFTABLE_HASH_SIZE_SHA1;
switch (id) {
- case 0:
- case GIT_SHA1_FORMAT_ID:
- return GIT_SHA1_RAWSZ;
- case GIT_SHA256_FORMAT_ID:
- return GIT_SHA256_RAWSZ;
+ case REFTABLE_HASH_SHA1:
+ return REFTABLE_HASH_SIZE_SHA1;
+ case REFTABLE_HASH_SHA256:
+ return REFTABLE_HASH_SIZE_SHA256;
}
abort();
}
diff --git a/reftable/basics.h b/reftable/basics.h
index 7aa46d7c30..36beda2c25 100644
--- a/reftable/basics.h
+++ b/reftable/basics.h
@@ -148,6 +148,14 @@ char *reftable_strdup(const char *str);
/* Find the longest shared prefix size of `a` and `b` */
int common_prefix_size(struct reftable_buf *a, struct reftable_buf *b);
-int hash_size(uint32_t id);
+int hash_size(enum reftable_hash id);
+
+/*
+ * Format IDs that identify the hash function used by a reftable. Note that
+ * these constants end up on disk and thus mustn't change. The format IDs are
+ * "sha1" and "s256" in big endian, respectively.
+ */
+#define REFTABLE_FORMAT_ID_SHA1 ((uint32_t) 0x73686131)
+#define REFTABLE_FORMAT_ID_SHA256 ((uint32_t) 0x73323536)
#endif
diff --git a/reftable/block.c b/reftable/block.c
index f5b432566a..0198078485 100644
--- a/reftable/block.c
+++ b/reftable/block.c
@@ -70,14 +70,14 @@ static int block_writer_register_restart(struct block_writer *w, int n,
return 0;
}
-int block_writer_init(struct block_writer *bw, uint8_t typ, uint8_t *buf,
+int block_writer_init(struct block_writer *bw, uint8_t typ, uint8_t *block,
uint32_t block_size, uint32_t header_off, int hash_size)
{
- bw->buf = buf;
+ bw->block = block;
bw->hash_size = hash_size;
bw->block_size = block_size;
bw->header_off = header_off;
- bw->buf[header_off] = typ;
+ bw->block[header_off] = typ;
bw->next = header_off + 4;
bw->restart_interval = 16;
bw->entries = 0;
@@ -95,7 +95,7 @@ int block_writer_init(struct block_writer *bw, uint8_t typ, uint8_t *buf,
uint8_t block_writer_type(struct block_writer *bw)
{
- return bw->buf[bw->header_off];
+ return bw->block[bw->header_off];
}
/* Adds the reftable_record to the block. Returns -1 if it does not fit, 0 on
@@ -107,27 +107,24 @@ int block_writer_add(struct block_writer *w, struct reftable_record *rec)
struct reftable_buf last =
w->entries % w->restart_interval == 0 ? empty : w->last_key;
struct string_view out = {
- .buf = w->buf + w->next,
+ .buf = w->block + w->next,
.len = w->block_size - w->next,
};
-
struct string_view start = out;
-
int is_restart = 0;
- struct reftable_buf key = REFTABLE_BUF_INIT;
int n = 0;
int err;
- err = reftable_record_key(rec, &key);
+ err = reftable_record_key(rec, &w->scratch);
if (err < 0)
goto done;
- if (!key.len) {
+ if (!w->scratch.len) {
err = REFTABLE_API_ERROR;
goto done;
}
- n = reftable_encode_key(&is_restart, out, last, key,
+ n = reftable_encode_key(&is_restart, out, last, w->scratch,
reftable_record_val_type(rec));
if (n < 0) {
err = -1;
@@ -143,9 +140,8 @@ int block_writer_add(struct block_writer *w, struct reftable_record *rec)
string_view_consume(&out, n);
err = block_writer_register_restart(w, start.len - out.len, is_restart,
- &key);
+ &w->scratch);
done:
- reftable_buf_release(&key);
return err;
}
@@ -153,13 +149,13 @@ int block_writer_finish(struct block_writer *w)
{
int i;
for (i = 0; i < w->restart_len; i++) {
- put_be24(w->buf + w->next, w->restarts[i]);
+ put_be24(w->block + w->next, w->restarts[i]);
w->next += 3;
}
- put_be16(w->buf + w->next, w->restart_len);
+ put_be16(w->block + w->next, w->restart_len);
w->next += 2;
- put_be24(w->buf + 1 + w->header_off, w->next);
+ put_be24(w->block + 1 + w->header_off, w->next);
/*
* Log records are stored zlib-compressed. Note that the compression
@@ -188,7 +184,7 @@ int block_writer_finish(struct block_writer *w)
w->zstream->next_out = w->compressed;
w->zstream->avail_out = compressed_len;
- w->zstream->next_in = w->buf + block_header_skip;
+ w->zstream->next_in = w->block + block_header_skip;
w->zstream->avail_in = src_len;
/*
@@ -206,7 +202,7 @@ int block_writer_finish(struct block_writer *w)
* adjust the `next` pointer to point right after the
* compressed data.
*/
- memcpy(w->buf + block_header_skip, w->compressed,
+ memcpy(w->block + block_header_skip, w->compressed,
w->zstream->total_out);
w->next = w->zstream->total_out + block_header_skip;
}
@@ -569,6 +565,7 @@ void block_writer_release(struct block_writer *bw)
REFTABLE_FREE_AND_NULL(bw->zstream);
REFTABLE_FREE_AND_NULL(bw->restarts);
REFTABLE_FREE_AND_NULL(bw->compressed);
+ reftable_buf_release(&bw->scratch);
reftable_buf_release(&bw->last_key);
/* the block is not owned. */
}
diff --git a/reftable/block.h b/reftable/block.h
index 9a3effa513..0431e8591f 100644
--- a/reftable/block.h
+++ b/reftable/block.h
@@ -22,7 +22,7 @@ struct block_writer {
unsigned char *compressed;
size_t compressed_cap;
- uint8_t *buf;
+ uint8_t *block;
uint32_t block_size;
/* Offset of the global header. Nonzero in the first block only. */
@@ -39,13 +39,15 @@ struct block_writer {
uint32_t restart_cap;
struct reftable_buf last_key;
+ /* Scratch buffer used to avoid allocations. */
+ struct reftable_buf scratch;
int entries;
};
/*
- * initializes the blockwriter to write `typ` entries, using `buf` as temporary
- * storage. `buf` is not owned by the block_writer. */
-int block_writer_init(struct block_writer *bw, uint8_t typ, uint8_t *buf,
+ * initializes the blockwriter to write `typ` entries, using `block` as temporary
+ * storage. `block` is not owned by the block_writer. */
+int block_writer_init(struct block_writer *bw, uint8_t typ, uint8_t *block,
uint32_t block_size, uint32_t header_off, int hash_size);
/* returns the block type (eg. 'r' for ref records. */
diff --git a/reftable/merged.c b/reftable/merged.c
index 514d6facf4..e72b39e178 100644
--- a/reftable/merged.c
+++ b/reftable/merged.c
@@ -66,6 +66,8 @@ static int merged_iter_seek(struct merged_iter *mi, struct reftable_record *want
int err;
mi->advance_index = -1;
+ while (!merged_iter_pqueue_is_empty(mi->pq))
+ merged_iter_pqueue_remove(&mi->pq);
for (size_t i = 0; i < mi->subiters_len; i++) {
err = iterator_seek(&mi->subiters[i].iter, want);
@@ -181,7 +183,7 @@ static void iterator_from_merged_iter(struct reftable_iterator *it,
int reftable_merged_table_new(struct reftable_merged_table **dest,
struct reftable_reader **readers, size_t n,
- uint32_t hash_id)
+ enum reftable_hash hash_id)
{
struct reftable_merged_table *m = NULL;
uint64_t last_max = 0;
@@ -238,14 +240,16 @@ int merged_table_init_iter(struct reftable_merged_table *mt,
struct reftable_iterator *it,
uint8_t typ)
{
- struct merged_subiter *subiters;
+ struct merged_subiter *subiters = NULL;
struct merged_iter *mi = NULL;
int ret;
- REFTABLE_CALLOC_ARRAY(subiters, mt->readers_len);
- if (!subiters) {
- ret = REFTABLE_OUT_OF_MEMORY_ERROR;
- goto out;
+ if (mt->readers_len) {
+ REFTABLE_CALLOC_ARRAY(subiters, mt->readers_len);
+ if (!subiters) {
+ ret = REFTABLE_OUT_OF_MEMORY_ERROR;
+ goto out;
+ }
}
for (size_t i = 0; i < mt->readers_len; i++) {
@@ -293,7 +297,7 @@ int reftable_merged_table_init_log_iterator(struct reftable_merged_table *mt,
return merged_table_init_iter(mt, it, BLOCK_TYPE_LOG);
}
-uint32_t reftable_merged_table_hash_id(struct reftable_merged_table *mt)
+enum reftable_hash reftable_merged_table_hash_id(struct reftable_merged_table *mt)
{
return mt->hash_id;
}
diff --git a/reftable/merged.h b/reftable/merged.h
index 89bd0c4b35..0b7d939e92 100644
--- a/reftable/merged.h
+++ b/reftable/merged.h
@@ -10,11 +10,12 @@ https://developers.google.com/open-source/licenses/bsd
#define MERGED_H
#include "system.h"
+#include "reftable-basics.h"
struct reftable_merged_table {
struct reftable_reader **readers;
size_t readers_len;
- uint32_t hash_id;
+ enum reftable_hash hash_id;
/* If unset, produce deletions. This is useful for compaction. For the
* full stack, deletions should be produced. */
diff --git a/reftable/reader.c b/reftable/reader.c
index 90dc950b57..ea82955c9b 100644
--- a/reftable/reader.c
+++ b/reftable/reader.c
@@ -67,7 +67,7 @@ static int reader_get_block(struct reftable_reader *r,
return block_source_read_block(&r->source, dest, off, sz);
}
-uint32_t reftable_reader_hash_id(struct reftable_reader *r)
+enum reftable_hash reftable_reader_hash_id(struct reftable_reader *r)
{
return r->hash_id;
}
@@ -107,18 +107,20 @@ static int parse_footer(struct reftable_reader *r, uint8_t *footer,
f += 8;
if (r->version == 1) {
- r->hash_id = GIT_SHA1_FORMAT_ID;
+ r->hash_id = REFTABLE_HASH_SHA1;
} else {
- r->hash_id = get_be32(f);
- switch (r->hash_id) {
- case GIT_SHA1_FORMAT_ID:
+ switch (get_be32(f)) {
+ case REFTABLE_FORMAT_ID_SHA1:
+ r->hash_id = REFTABLE_HASH_SHA1;
break;
- case GIT_SHA256_FORMAT_ID:
+ case REFTABLE_FORMAT_ID_SHA256:
+ r->hash_id = REFTABLE_HASH_SHA256;
break;
default:
err = REFTABLE_FORMAT_ERROR;
goto done;
}
+
f += 4;
}
diff --git a/reftable/reader.h b/reftable/reader.h
index 010fbfe851..d2b48a4849 100644
--- a/reftable/reader.h
+++ b/reftable/reader.h
@@ -37,8 +37,8 @@ struct reftable_reader {
/* Size of the file, excluding the footer. */
uint64_t size;
- /* 'sha1' for SHA1, 's256' for SHA-256 */
- uint32_t hash_id;
+ /* The hash function used for ref records. */
+ enum reftable_hash hash_id;
uint32_t block_size;
uint64_t min_update_index;
diff --git a/reftable/reftable-basics.h b/reftable/reftable-basics.h
index 6e8e636b71..e0397ed583 100644
--- a/reftable/reftable-basics.h
+++ b/reftable/reftable-basics.h
@@ -11,6 +11,19 @@
#include <stddef.h>
+/*
+ * Hash functions understood by the reftable library. Note that the values are
+ * arbitrary and somewhat random such that we can easily detect cases where the
+ * hash hasn't been properly set up.
+ */
+enum reftable_hash {
+ REFTABLE_HASH_SHA1 = 89,
+ REFTABLE_HASH_SHA256 = 247,
+};
+#define REFTABLE_HASH_SIZE_SHA1 20
+#define REFTABLE_HASH_SIZE_SHA256 32
+#define REFTABLE_HASH_SIZE_MAX REFTABLE_HASH_SIZE_SHA256
+
/* Overrides the functions to use for memory management. */
void reftable_set_alloc(void *(*malloc)(size_t),
void *(*realloc)(void *, size_t), void (*free)(void *));
diff --git a/reftable/reftable-merged.h b/reftable/reftable-merged.h
index a970d5dd89..f2d01c3ef8 100644
--- a/reftable/reftable-merged.h
+++ b/reftable/reftable-merged.h
@@ -34,7 +34,7 @@ struct reftable_reader;
*/
int reftable_merged_table_new(struct reftable_merged_table **dest,
struct reftable_reader **readers, size_t n,
- uint32_t hash_id);
+ enum reftable_hash hash_id);
/* Initialize a merged table iterator for reading refs. */
int reftable_merged_table_init_ref_iterator(struct reftable_merged_table *mt,
@@ -56,6 +56,6 @@ reftable_merged_table_min_update_index(struct reftable_merged_table *mt);
void reftable_merged_table_free(struct reftable_merged_table *m);
/* return the hash ID of the merged table. */
-uint32_t reftable_merged_table_hash_id(struct reftable_merged_table *m);
+enum reftable_hash reftable_merged_table_hash_id(struct reftable_merged_table *m);
#endif
diff --git a/reftable/reftable-reader.h b/reftable/reftable-reader.h
index 6a2d0b693f..0085fbb903 100644
--- a/reftable/reftable-reader.h
+++ b/reftable/reftable-reader.h
@@ -54,7 +54,7 @@ int reftable_reader_init_log_iterator(struct reftable_reader *r,
struct reftable_iterator *it);
/* returns the hash ID used in this table. */
-uint32_t reftable_reader_hash_id(struct reftable_reader *r);
+enum reftable_hash reftable_reader_hash_id(struct reftable_reader *r);
/* return an iterator for the refs pointing to `oid`. */
int reftable_reader_refs_for(struct reftable_reader *r,
diff --git a/reftable/reftable-record.h b/reftable/reftable-record.h
index 2d42463c58..ddd48eb579 100644
--- a/reftable/reftable-record.h
+++ b/reftable/reftable-record.h
@@ -9,7 +9,7 @@ https://developers.google.com/open-source/licenses/bsd
#ifndef REFTABLE_RECORD_H
#define REFTABLE_RECORD_H
-#include "hash.h"
+#include "reftable-basics.h"
#include <stdint.h>
/*
@@ -40,10 +40,10 @@ struct reftable_ref_record {
#define REFTABLE_NR_REF_VALUETYPES 4
} value_type;
union {
- unsigned char val1[GIT_MAX_RAWSZ];
+ unsigned char val1[REFTABLE_HASH_SIZE_MAX];
struct {
- unsigned char value[GIT_MAX_RAWSZ]; /* first hash */
- unsigned char target_value[GIT_MAX_RAWSZ]; /* second hash */
+ unsigned char value[REFTABLE_HASH_SIZE_MAX]; /* first hash */
+ unsigned char target_value[REFTABLE_HASH_SIZE_MAX]; /* second hash */
} val2;
char *symref; /* referent, malloced 0-terminated string */
} value;
@@ -85,8 +85,8 @@ struct reftable_log_record {
union {
struct {
- unsigned char new_hash[GIT_MAX_RAWSZ];
- unsigned char old_hash[GIT_MAX_RAWSZ];
+ unsigned char new_hash[REFTABLE_HASH_SIZE_MAX];
+ unsigned char old_hash[REFTABLE_HASH_SIZE_MAX];
char *name;
char *email;
uint64_t time;
diff --git a/reftable/reftable-stack.h b/reftable/reftable-stack.h
index 54787f2ef5..ae14270ea7 100644
--- a/reftable/reftable-stack.h
+++ b/reftable/reftable-stack.h
@@ -149,4 +149,7 @@ struct reftable_compaction_stats {
struct reftable_compaction_stats *
reftable_stack_compaction_stats(struct reftable_stack *st);
+/* Return the hash of the stack. */
+enum reftable_hash reftable_stack_hash_id(struct reftable_stack *st);
+
#endif
diff --git a/reftable/reftable-writer.h b/reftable/reftable-writer.h
index e4fc953788..5f9afa620b 100644
--- a/reftable/reftable-writer.h
+++ b/reftable/reftable-writer.h
@@ -33,7 +33,7 @@ struct reftable_write_options {
/* 4-byte identifier ("sha1", "s256") of the hash.
* Defaults to SHA1 if unset
*/
- uint32_t hash_id;
+ enum reftable_hash hash_id;
/* Default mode for creating files. If unset, use 0666 (+umask) */
unsigned int default_permissions;
@@ -62,6 +62,21 @@ struct reftable_write_options {
* negative value will cause us to block indefinitely.
*/
long lock_timeout_ms;
+
+ /*
+ * Optional callback used to fsync files to disk. Falls back to using
+ * fsync(3P) when unset.
+ */
+ int (*fsync)(int fd);
+
+ /*
+ * Callback function to execute whenever the stack is being reloaded.
+ * This can be used e.g. to discard cached information that relies on
+ * the old stack's data. The payload data will be passed as argument to
+ * the callback.
+ */
+ void (*on_reload)(void *payload);
+ void *on_reload_payload;
};
/* reftable_block_stats holds statistics for a single block type */
diff --git a/reftable/stack.c b/reftable/stack.c
index c33979536e..634f0c5425 100644
--- a/reftable/stack.c
+++ b/reftable/stack.c
@@ -8,7 +8,6 @@ https://developers.google.com/open-source/licenses/bsd
#include "stack.h"
-#include "../write-or-die.h"
#include "system.h"
#include "constants.h"
#include "merged.h"
@@ -17,7 +16,6 @@ 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,
@@ -43,17 +41,28 @@ static int stack_filename(struct reftable_buf *dest, struct reftable_stack *st,
return 0;
}
-static ssize_t reftable_fd_write(void *arg, const void *data, size_t sz)
+static int stack_fsync(const struct reftable_write_options *opts, int fd)
{
- int *fdp = (int *)arg;
- return write_in_full(*fdp, data, sz);
+ if (opts->fsync)
+ return opts->fsync(fd);
+ return fsync(fd);
}
-static int reftable_fd_flush(void *arg)
+struct fd_writer {
+ const struct reftable_write_options *opts;
+ int fd;
+};
+
+static ssize_t fd_writer_write(void *arg, const void *data, size_t sz)
{
- int *fdp = (int *)arg;
+ struct fd_writer *writer = arg;
+ return write_in_full(writer->fd, data, sz);
+}
- return fsync_component(FSYNC_COMPONENT_REFERENCE, *fdp);
+static int fd_writer_flush(void *arg)
+{
+ struct fd_writer *writer = arg;
+ return stack_fsync(writer->opts, writer->fd);
}
int reftable_new_stack(struct reftable_stack **dest, const char *dir,
@@ -73,7 +82,7 @@ int reftable_new_stack(struct reftable_stack **dest, const char *dir,
if (_opts)
opts = *_opts;
if (opts.hash_id == 0)
- opts.hash_id = GIT_SHA1_FORMAT_ID;
+ opts.hash_id = REFTABLE_HASH_SHA1;
*dest = NULL;
@@ -261,9 +270,9 @@ static int reftable_stack_reload_once(struct reftable_stack *st,
int reuse_open)
{
size_t cur_len = !st->merged ? 0 : st->merged->readers_len;
- struct reftable_reader **cur;
+ struct reftable_reader **cur = NULL;
struct reftable_reader **reused = NULL;
- struct reftable_reader **new_readers;
+ struct reftable_reader **new_readers = NULL;
size_t reused_len = 0, reused_alloc = 0, names_len;
size_t new_readers_len = 0;
struct reftable_merged_table *new_merged = NULL;
@@ -271,18 +280,22 @@ static int reftable_stack_reload_once(struct reftable_stack *st,
int err = 0;
size_t i;
- cur = stack_copy_readers(st, cur_len);
- if (!cur) {
- err = REFTABLE_OUT_OF_MEMORY_ERROR;
- goto done;
+ if (cur_len) {
+ cur = stack_copy_readers(st, cur_len);
+ if (!cur) {
+ err = REFTABLE_OUT_OF_MEMORY_ERROR;
+ goto done;
+ }
}
names_len = names_length(names);
- new_readers = reftable_calloc(names_len, sizeof(*new_readers));
- if (!new_readers) {
- err = REFTABLE_OUT_OF_MEMORY_ERROR;
- goto done;
+ if (names_len) {
+ new_readers = reftable_calloc(names_len, sizeof(*new_readers));
+ if (!new_readers) {
+ err = REFTABLE_OUT_OF_MEMORY_ERROR;
+ goto done;
+ }
}
while (*names) {
@@ -539,6 +552,10 @@ out:
close(fd);
free_names(names);
free_names(names_after);
+
+ if (st->opts.on_reload)
+ st->opts.on_reload(st->opts.on_reload_payload);
+
return err;
}
@@ -648,7 +665,7 @@ static int format_name(struct reftable_buf *dest, uint64_t min, uint64_t max)
}
struct reftable_addition {
- struct lock_file tables_list_lock;
+ struct reftable_flock tables_list_lock;
struct reftable_stack *stack;
char **new_tables;
@@ -667,10 +684,8 @@ static int reftable_stack_init_addition(struct reftable_addition *add,
add->stack = st;
- err = hold_lock_file_for_update_timeout(&add->tables_list_lock,
- st->list_file,
- LOCK_NO_DEREF,
- st->opts.lock_timeout_ms);
+ err = flock_acquire(&add->tables_list_lock, st->list_file,
+ st->opts.lock_timeout_ms);
if (err < 0) {
if (errno == EEXIST) {
err = REFTABLE_LOCK_ERROR;
@@ -680,7 +695,7 @@ static int reftable_stack_init_addition(struct reftable_addition *add,
goto done;
}
if (st->opts.default_permissions) {
- if (chmod(get_lock_file_path(&add->tables_list_lock),
+ if (chmod(add->tables_list_lock.path,
st->opts.default_permissions) < 0) {
err = REFTABLE_IO_ERROR;
goto done;
@@ -724,7 +739,7 @@ static void reftable_addition_close(struct reftable_addition *add)
add->new_tables_len = 0;
add->new_tables_cap = 0;
- rollback_lock_file(&add->tables_list_lock);
+ flock_release(&add->tables_list_lock);
reftable_buf_release(&nm);
}
@@ -740,7 +755,6 @@ void reftable_addition_destroy(struct reftable_addition *add)
int reftable_addition_commit(struct reftable_addition *add)
{
struct reftable_buf table_list = REFTABLE_BUF_INIT;
- int lock_file_fd = get_lock_file_fd(&add->tables_list_lock);
int err = 0;
size_t i;
@@ -758,20 +772,20 @@ int reftable_addition_commit(struct reftable_addition *add)
goto done;
}
- err = write_in_full(lock_file_fd, table_list.buf, table_list.len);
+ err = write_in_full(add->tables_list_lock.fd, table_list.buf, table_list.len);
reftable_buf_release(&table_list);
if (err < 0) {
err = REFTABLE_IO_ERROR;
goto done;
}
- err = fsync_component(FSYNC_COMPONENT_REFERENCE, lock_file_fd);
+ err = stack_fsync(&add->stack->opts, add->tables_list_lock.fd);
if (err < 0) {
err = REFTABLE_IO_ERROR;
goto done;
}
- err = commit_lock_file(&add->tables_list_lock);
+ err = flock_commit(&add->tables_list_lock);
if (err < 0) {
err = REFTABLE_IO_ERROR;
goto done;
@@ -857,9 +871,11 @@ int reftable_addition_add(struct reftable_addition *add,
struct reftable_buf tab_file_name = REFTABLE_BUF_INIT;
struct reftable_buf next_name = REFTABLE_BUF_INIT;
struct reftable_writer *wr = NULL;
- struct tempfile *tab_file = NULL;
+ struct reftable_tmpfile tab_file = REFTABLE_TMPFILE_INIT;
+ struct fd_writer writer = {
+ .opts = &add->stack->opts,
+ };
int err = 0;
- int tab_fd;
reftable_buf_reset(&next_name);
@@ -875,22 +891,20 @@ int reftable_addition_add(struct reftable_addition *add,
if (err < 0)
goto done;
- tab_file = mks_tempfile(temp_tab_file_name.buf);
- if (!tab_file) {
- err = REFTABLE_IO_ERROR;
+ err = tmpfile_from_pattern(&tab_file, temp_tab_file_name.buf);
+ if (err < 0)
goto done;
- }
if (add->stack->opts.default_permissions) {
- if (chmod(get_tempfile_path(tab_file),
+ if (chmod(tab_file.path,
add->stack->opts.default_permissions)) {
err = REFTABLE_IO_ERROR;
goto done;
}
}
- tab_fd = get_tempfile_fd(tab_file);
- err = reftable_writer_new(&wr, reftable_fd_write, reftable_fd_flush,
- &tab_fd, &add->stack->opts);
+ writer.fd = tab_file.fd;
+ err = reftable_writer_new(&wr, fd_writer_write, fd_writer_flush,
+ &writer, &add->stack->opts);
if (err < 0)
goto done;
@@ -906,11 +920,9 @@ int reftable_addition_add(struct reftable_addition *add,
if (err < 0)
goto done;
- err = close_tempfile_gently(tab_file);
- if (err < 0) {
- err = REFTABLE_IO_ERROR;
+ err = tmpfile_close(&tab_file);
+ if (err < 0)
goto done;
- }
if (wr->min_update_index < add->next_update_index) {
err = REFTABLE_API_ERROR;
@@ -933,11 +945,9 @@ int reftable_addition_add(struct reftable_addition *add,
On windows, this relies on rand() picking a unique destination name.
Maybe we should do retry loop as well?
*/
- err = rename_tempfile(&tab_file, tab_file_name.buf);
- if (err < 0) {
- err = REFTABLE_IO_ERROR;
+ err = tmpfile_rename(&tab_file, tab_file_name.buf);
+ if (err < 0)
goto done;
- }
REFTABLE_ALLOC_GROW(add->new_tables, add->new_tables_len + 1,
add->new_tables_cap);
@@ -948,7 +958,7 @@ int reftable_addition_add(struct reftable_addition *add,
add->new_tables[add->new_tables_len++] = reftable_buf_detach(&next_name);
done:
- delete_tempfile(&tab_file);
+ tmpfile_delete(&tab_file);
reftable_buf_release(&temp_tab_file_name);
reftable_buf_release(&tab_file_name);
reftable_buf_release(&next_name);
@@ -968,13 +978,16 @@ uint64_t reftable_stack_next_update_index(struct reftable_stack *st)
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 reftable_tmpfile *tab_file_out)
{
struct reftable_buf next_name = REFTABLE_BUF_INIT;
struct reftable_buf tab_file_path = REFTABLE_BUF_INIT;
struct reftable_writer *wr = NULL;
- struct tempfile *tab_file;
- int tab_fd, err = 0;
+ struct fd_writer writer= {
+ .opts = &st->opts,
+ };
+ struct reftable_tmpfile tab_file = REFTABLE_TMPFILE_INIT;
+ int err = 0;
err = format_name(&next_name, reftable_reader_min_update_index(st->readers[first]),
reftable_reader_max_update_index(st->readers[last]));
@@ -989,21 +1002,19 @@ static int stack_compact_locked(struct reftable_stack *st,
if (err < 0)
goto done;
- tab_file = mks_tempfile(tab_file_path.buf);
- if (!tab_file) {
- err = REFTABLE_IO_ERROR;
+ err = tmpfile_from_pattern(&tab_file, tab_file_path.buf);
+ if (err < 0)
goto done;
- }
- tab_fd = get_tempfile_fd(tab_file);
if (st->opts.default_permissions &&
- chmod(get_tempfile_path(tab_file), st->opts.default_permissions) < 0) {
+ chmod(tab_file.path, st->opts.default_permissions) < 0) {
err = REFTABLE_IO_ERROR;
goto done;
}
- err = reftable_writer_new(&wr, reftable_fd_write, reftable_fd_flush,
- &tab_fd, &st->opts);
+ writer.fd = tab_file.fd;
+ err = reftable_writer_new(&wr, fd_writer_write, fd_writer_flush,
+ &writer, &st->opts);
if (err < 0)
goto done;
@@ -1015,15 +1026,15 @@ static int stack_compact_locked(struct reftable_stack *st,
if (err < 0)
goto done;
- err = close_tempfile_gently(tab_file);
+ err = tmpfile_close(&tab_file);
if (err < 0)
goto done;
*tab_file_out = tab_file;
- tab_file = NULL;
+ tab_file = REFTABLE_TMPFILE_INIT;
done:
- delete_tempfile(&tab_file);
+ tmpfile_delete(&tab_file);
reftable_writer_free(wr);
reftable_buf_release(&next_name);
reftable_buf_release(&tab_file_path);
@@ -1154,9 +1165,9 @@ static int stack_compact_range(struct reftable_stack *st,
struct reftable_buf new_table_name = REFTABLE_BUF_INIT;
struct reftable_buf new_table_path = REFTABLE_BUF_INIT;
struct reftable_buf table_name = REFTABLE_BUF_INIT;
- struct lock_file tables_list_lock = LOCK_INIT;
- struct lock_file *table_locks = NULL;
- struct tempfile *new_table = NULL;
+ struct reftable_flock tables_list_lock = REFTABLE_FLOCK_INIT;
+ struct reftable_flock *table_locks = NULL;
+ struct reftable_tmpfile new_table = REFTABLE_TMPFILE_INIT;
int is_empty_table = 0, err = 0;
size_t first_to_replace, last_to_replace;
size_t i, nlocks = 0;
@@ -1173,10 +1184,7 @@ static int stack_compact_range(struct reftable_stack *st,
* 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_timeout(&tables_list_lock,
- st->list_file,
- LOCK_NO_DEREF,
- st->opts.lock_timeout_ms);
+ err = flock_acquire(&tables_list_lock, st->list_file, st->opts.lock_timeout_ms);
if (err < 0) {
if (errno == EEXIST)
err = REFTABLE_LOCK_ERROR;
@@ -1199,19 +1207,20 @@ static int stack_compact_range(struct reftable_stack *st,
* older process is still busy compacting tables which are preexisting
* from the point of view of the newer process.
*/
- REFTABLE_CALLOC_ARRAY(table_locks, last - first + 1);
+ REFTABLE_ALLOC_ARRAY(table_locks, last - first + 1);
if (!table_locks) {
err = REFTABLE_OUT_OF_MEMORY_ERROR;
goto done;
}
+ for (i = 0; i < last - first + 1; i++)
+ table_locks[i] = REFTABLE_FLOCK_INIT;
for (i = last + 1; i > first; i--) {
err = stack_filename(&table_name, st, reader_name(st->readers[i - 1]));
if (err < 0)
goto done;
- err = hold_lock_file_for_update(&table_locks[nlocks],
- table_name.buf, LOCK_NO_DEREF);
+ err = flock_acquire(&table_locks[nlocks], table_name.buf, 0);
if (err < 0) {
/*
* When the table is locked already we may do a
@@ -1247,7 +1256,7 @@ static int stack_compact_range(struct reftable_stack *st,
* run into file descriptor exhaustion when we compress a lot
* of tables.
*/
- err = close_lock_file_gently(&table_locks[nlocks++]);
+ err = flock_close(&table_locks[nlocks++]);
if (err < 0) {
err = REFTABLE_IO_ERROR;
goto done;
@@ -1259,7 +1268,7 @@ static int stack_compact_range(struct reftable_stack *st,
* "tables.list" lock while compacting the locked tables. This allows
* concurrent updates to the stack to proceed.
*/
- err = rollback_lock_file(&tables_list_lock);
+ err = flock_release(&tables_list_lock);
if (err < 0) {
err = REFTABLE_IO_ERROR;
goto done;
@@ -1282,10 +1291,7 @@ static int stack_compact_range(struct reftable_stack *st,
* "tables.list". We'll then replace the compacted range of tables with
* the new table.
*/
- err = hold_lock_file_for_update_timeout(&tables_list_lock,
- st->list_file,
- LOCK_NO_DEREF,
- st->opts.lock_timeout_ms);
+ err = flock_acquire(&tables_list_lock, st->list_file, st->opts.lock_timeout_ms);
if (err < 0) {
if (errno == EEXIST)
err = REFTABLE_LOCK_ERROR;
@@ -1295,7 +1301,7 @@ static int stack_compact_range(struct reftable_stack *st,
}
if (st->opts.default_permissions) {
- if (chmod(get_lock_file_path(&tables_list_lock),
+ if (chmod(tables_list_lock.path,
st->opts.default_permissions) < 0) {
err = REFTABLE_IO_ERROR;
goto done;
@@ -1424,11 +1430,9 @@ static int stack_compact_range(struct reftable_stack *st,
if (err < 0)
goto done;
- err = rename_tempfile(&new_table, new_table_path.buf);
- if (err < 0) {
- err = REFTABLE_IO_ERROR;
+ err = tmpfile_rename(&new_table, new_table_path.buf);
+ if (err < 0)
goto done;
- }
}
/*
@@ -1452,7 +1456,7 @@ static int stack_compact_range(struct reftable_stack *st,
goto done;
}
- err = write_in_full(get_lock_file_fd(&tables_list_lock),
+ err = write_in_full(tables_list_lock.fd,
tables_list_buf.buf, tables_list_buf.len);
if (err < 0) {
err = REFTABLE_IO_ERROR;
@@ -1460,14 +1464,14 @@ static int stack_compact_range(struct reftable_stack *st,
goto done;
}
- err = fsync_component(FSYNC_COMPONENT_REFERENCE, get_lock_file_fd(&tables_list_lock));
+ err = stack_fsync(&st->opts, tables_list_lock.fd);
if (err < 0) {
err = REFTABLE_IO_ERROR;
unlink(new_table_path.buf);
goto done;
}
- err = commit_lock_file(&tables_list_lock);
+ err = flock_commit(&tables_list_lock);
if (err < 0) {
err = REFTABLE_IO_ERROR;
unlink(new_table_path.buf);
@@ -1488,19 +1492,24 @@ static int stack_compact_range(struct reftable_stack *st,
* readers, so it is expected that unlinking tables may fail.
*/
for (i = 0; i < nlocks; i++) {
- struct lock_file *table_lock = &table_locks[i];
- char *table_path = get_locked_file_path(table_lock);
- unlink(table_path);
- reftable_free(table_path);
+ struct reftable_flock *table_lock = &table_locks[i];
+
+ reftable_buf_reset(&table_name);
+ err = reftable_buf_add(&table_name, table_lock->path,
+ strlen(table_lock->path) - strlen(".lock"));
+ if (err)
+ continue;
+
+ unlink(table_name.buf);
}
done:
- rollback_lock_file(&tables_list_lock);
+ flock_release(&tables_list_lock);
for (i = 0; table_locks && i < nlocks; i++)
- rollback_lock_file(&table_locks[i]);
+ flock_release(&table_locks[i]);
reftable_free(table_locks);
- delete_tempfile(&new_table);
+ tmpfile_delete(&new_table);
reftable_buf_release(&new_table_name);
reftable_buf_release(&new_table_path);
reftable_buf_release(&tables_list_buf);
@@ -1603,7 +1612,7 @@ struct segment suggest_compaction_segment(uint64_t *sizes, size_t n,
static uint64_t *stack_table_sizes_for_compaction(struct reftable_stack *st)
{
- int version = (st->opts.hash_id == GIT_SHA1_FORMAT_ID) ? 1 : 2;
+ int version = (st->opts.hash_id == REFTABLE_HASH_SHA1) ? 1 : 2;
int overhead = header_size(version) - 1;
uint64_t *sizes;
@@ -1622,6 +1631,9 @@ int reftable_stack_auto_compact(struct reftable_stack *st)
struct segment seg;
uint64_t *sizes;
+ if (st->merged->readers_len < 2)
+ return 0;
+
sizes = stack_table_sizes_for_compaction(st);
if (!sizes)
return REFTABLE_OUT_OF_MEMORY_ERROR;
@@ -1790,3 +1802,8 @@ done:
reftable_addition_destroy(add);
return err;
}
+
+enum reftable_hash reftable_stack_hash_id(struct reftable_stack *st)
+{
+ return reftable_merged_table_hash_id(st->merged);
+}
diff --git a/reftable/system.c b/reftable/system.c
new file mode 100644
index 0000000000..adf8e4d30b
--- /dev/null
+++ b/reftable/system.c
@@ -0,0 +1,126 @@
+#include "system.h"
+#include "basics.h"
+#include "reftable-error.h"
+#include "../lockfile.h"
+#include "../tempfile.h"
+
+int tmpfile_from_pattern(struct reftable_tmpfile *out, const char *pattern)
+{
+ struct tempfile *tempfile;
+
+ tempfile = mks_tempfile(pattern);
+ if (!tempfile)
+ return REFTABLE_IO_ERROR;
+
+ out->path = tempfile->filename.buf;
+ out->fd = tempfile->fd;
+ out->priv = tempfile;
+
+ return 0;
+}
+
+int tmpfile_close(struct reftable_tmpfile *t)
+{
+ struct tempfile *tempfile = t->priv;
+ int ret = close_tempfile_gently(tempfile);
+ t->fd = -1;
+ if (ret < 0)
+ return REFTABLE_IO_ERROR;
+ return 0;
+}
+
+int tmpfile_delete(struct reftable_tmpfile *t)
+{
+ struct tempfile *tempfile = t->priv;
+ int ret = delete_tempfile(&tempfile);
+ *t = REFTABLE_TMPFILE_INIT;
+ if (ret < 0)
+ return REFTABLE_IO_ERROR;
+ return 0;
+}
+
+int tmpfile_rename(struct reftable_tmpfile *t, const char *path)
+{
+ struct tempfile *tempfile = t->priv;
+ int ret = rename_tempfile(&tempfile, path);
+ *t = REFTABLE_TMPFILE_INIT;
+ if (ret < 0)
+ return REFTABLE_IO_ERROR;
+ return 0;
+}
+
+int flock_acquire(struct reftable_flock *l, const char *target_path,
+ long timeout_ms)
+{
+ struct lock_file *lockfile;
+ int err;
+
+ lockfile = reftable_malloc(sizeof(*lockfile));
+ if (!lockfile)
+ return REFTABLE_OUT_OF_MEMORY_ERROR;
+
+ err = hold_lock_file_for_update_timeout(lockfile, target_path, LOCK_NO_DEREF,
+ timeout_ms);
+ if (err < 0) {
+ reftable_free(lockfile);
+ if (errno == EEXIST)
+ return REFTABLE_LOCK_ERROR;
+ return -1;
+ }
+
+ l->fd = get_lock_file_fd(lockfile);
+ l->path = get_lock_file_path(lockfile);
+ l->priv = lockfile;
+
+ return 0;
+}
+
+int flock_close(struct reftable_flock *l)
+{
+ struct lock_file *lockfile = l->priv;
+ int ret;
+
+ if (!lockfile)
+ return REFTABLE_API_ERROR;
+
+ ret = close_lock_file_gently(lockfile);
+ l->fd = -1;
+ if (ret < 0)
+ return REFTABLE_IO_ERROR;
+
+ return 0;
+}
+
+int flock_release(struct reftable_flock *l)
+{
+ struct lock_file *lockfile = l->priv;
+ int ret;
+
+ if (!lockfile)
+ return 0;
+
+ ret = rollback_lock_file(lockfile);
+ reftable_free(lockfile);
+ *l = REFTABLE_FLOCK_INIT;
+ if (ret < 0)
+ return REFTABLE_IO_ERROR;
+
+ return 0;
+}
+
+int flock_commit(struct reftable_flock *l)
+{
+ struct lock_file *lockfile = l->priv;
+ int ret;
+
+ if (!lockfile)
+ return REFTABLE_API_ERROR;
+
+ ret = commit_lock_file(lockfile);
+ reftable_free(lockfile);
+ *l = REFTABLE_FLOCK_INIT;
+ if (ret < 0)
+ return REFTABLE_IO_ERROR;
+
+ return 0;
+}
diff --git a/reftable/system.h b/reftable/system.h
index 5ec8583343..7d5f803eeb 100644
--- a/reftable/system.h
+++ b/reftable/system.h
@@ -12,11 +12,90 @@ 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 "tempfile.h"
-#include "hash.h" /* hash ID, sizes.*/
-#include "dir.h" /* remove_dir_recursively, for tests.*/
-int hash_size(uint32_t id);
+/*
+ * An implementation-specific temporary file. By making this specific to the
+ * implementation it becomes possible to tie temporary files into any kind of
+ * signal or atexit handlers for cleanup on abnormal situations.
+ */
+struct reftable_tmpfile {
+ const char *path;
+ int fd;
+ void *priv;
+};
+#define REFTABLE_TMPFILE_INIT ((struct reftable_tmpfile) { .fd = -1, })
+
+/*
+ * Create a temporary file from a pattern similar to how mkstemp(3p) would.
+ * The `pattern` shall not be modified. On success, the structure at `out` has
+ * been initialized such that it is ready for use. Returns 0 on success, a
+ * reftable error code on error.
+ */
+int tmpfile_from_pattern(struct reftable_tmpfile *out, const char *pattern);
+
+/*
+ * Close the temporary file's file descriptor without removing the file itself.
+ * This is a no-op in case the file has already been closed beforehand. Returns
+ * 0 on success, a reftable error code on error.
+ */
+int tmpfile_close(struct reftable_tmpfile *t);
+
+/*
+ * Close the temporary file and delete it. This is a no-op in case the file has
+ * already been deleted or renamed beforehand. Returns 0 on success, a reftable
+ * error code on error.
+ */
+int tmpfile_delete(struct reftable_tmpfile *t);
+
+/*
+ * Rename the temporary file to the provided path. The temporary file must be
+ * active. Return 0 on success, a reftable error code on error. Deactivates the
+ * temporary file.
+ */
+int tmpfile_rename(struct reftable_tmpfile *t, const char *path);
+
+/*
+ * An implementation-specific file lock. Same as with `reftable_tmpfile`,
+ * making this specific to the implementation makes it possible to tie this
+ * into signal or atexit handlers such that we know to clean up stale locks on
+ * abnormal exits.
+ */
+struct reftable_flock {
+ const char *path;
+ int fd;
+ void *priv;
+};
+#define REFTABLE_FLOCK_INIT ((struct reftable_flock){ .fd = -1, })
+
+/*
+ * Acquire the lock for the given target path by exclusively creating a file
+ * with ".lock" appended to it. If that lock exists, we wait up to `timeout_ms`
+ * to acquire the lock. If `timeout_ms` is 0 we don't wait, if it is negative
+ * we block indefinitely.
+ *
+ * Retrun 0 on success, a reftable error code on error.
+ */
+int flock_acquire(struct reftable_flock *l, const char *target_path,
+ long timeout_ms);
+
+/*
+ * Close the lockfile's file descriptor without removing the lock itself. This
+ * is a no-op in case the lockfile has already been closed beforehand. Returns
+ * 0 on success, a reftable error code on error.
+ */
+int flock_close(struct reftable_flock *l);
+
+/*
+ * Release the lock by unlinking the lockfile. This is a no-op in case the
+ * lockfile has already been released or committed beforehand. Returns 0 on
+ * success, a reftable error code on error.
+ */
+int flock_release(struct reftable_flock *l);
+
+/*
+ * Commit the lock by renaming the lockfile into place. Returns 0 on success, a
+ * reftable error code on error.
+ */
+int flock_commit(struct reftable_flock *l);
#endif
diff --git a/reftable/writer.c b/reftable/writer.c
index f87086777c..624e90fb53 100644
--- a/reftable/writer.c
+++ b/reftable/writer.c
@@ -79,7 +79,7 @@ static void options_set_defaults(struct reftable_write_options *opts)
}
if (opts->hash_id == 0) {
- opts->hash_id = GIT_SHA1_FORMAT_ID;
+ opts->hash_id = REFTABLE_HASH_SHA1;
}
if (opts->block_size == 0) {
opts->block_size = DEFAULT_BLOCK_SIZE;
@@ -88,7 +88,7 @@ static void options_set_defaults(struct reftable_write_options *opts)
static int writer_version(struct reftable_writer *w)
{
- return (w->opts.hash_id == 0 || w->opts.hash_id == GIT_SHA1_FORMAT_ID) ?
+ return (w->opts.hash_id == 0 || w->opts.hash_id == REFTABLE_HASH_SHA1) ?
1 :
2;
}
@@ -103,8 +103,22 @@ static int writer_write_header(struct reftable_writer *w, uint8_t *dest)
put_be64(dest + 8, w->min_update_index);
put_be64(dest + 16, w->max_update_index);
if (writer_version(w) == 2) {
- put_be32(dest + 24, w->opts.hash_id);
+ uint32_t hash_id;
+
+ switch (w->opts.hash_id) {
+ case REFTABLE_HASH_SHA1:
+ hash_id = REFTABLE_FORMAT_ID_SHA1;
+ break;
+ case REFTABLE_HASH_SHA256:
+ hash_id = REFTABLE_FORMAT_ID_SHA256;
+ break;
+ default:
+ return -1;
+ }
+
+ put_be32(dest + 24, hash_id);
}
+
return header_size(writer_version(w));
}
@@ -148,6 +162,7 @@ int reftable_writer_new(struct reftable_writer **out,
reftable_buf_init(&wp->block_writer_data.last_key);
reftable_buf_init(&wp->last_key);
+ reftable_buf_init(&wp->scratch);
REFTABLE_CALLOC_ARRAY(wp->block, opts.block_size);
if (!wp->block) {
reftable_free(wp);
@@ -180,6 +195,7 @@ static void writer_release(struct reftable_writer *w)
w->block_writer = NULL;
writer_clear_index(w);
reftable_buf_release(&w->last_key);
+ reftable_buf_release(&w->scratch);
}
}
@@ -249,20 +265,19 @@ static int writer_index_hash(struct reftable_writer *w, struct reftable_buf *has
static int writer_add_record(struct reftable_writer *w,
struct reftable_record *rec)
{
- struct reftable_buf key = REFTABLE_BUF_INIT;
int err;
- err = reftable_record_key(rec, &key);
+ err = reftable_record_key(rec, &w->scratch);
if (err < 0)
goto done;
- if (reftable_buf_cmp(&w->last_key, &key) >= 0) {
+ if (reftable_buf_cmp(&w->last_key, &w->scratch) >= 0) {
err = REFTABLE_API_ERROR;
goto done;
}
reftable_buf_reset(&w->last_key);
- err = reftable_buf_add(&w->last_key, key.buf, key.len);
+ err = reftable_buf_add(&w->last_key, w->scratch.buf, w->scratch.len);
if (err < 0)
goto done;
@@ -312,7 +327,6 @@ static int writer_add_record(struct reftable_writer *w,
}
done:
- reftable_buf_release(&key);
return err;
}
@@ -325,7 +339,6 @@ int reftable_writer_add_ref(struct reftable_writer *w,
.ref = *ref
},
};
- struct reftable_buf buf = REFTABLE_BUF_INIT;
int err;
if (!ref->refname ||
@@ -340,24 +353,25 @@ int reftable_writer_add_ref(struct reftable_writer *w,
goto out;
if (!w->opts.skip_index_objects && reftable_ref_record_val1(ref)) {
- err = reftable_buf_add(&buf, (char *)reftable_ref_record_val1(ref),
+ reftable_buf_reset(&w->scratch);
+ err = reftable_buf_add(&w->scratch, (char *)reftable_ref_record_val1(ref),
hash_size(w->opts.hash_id));
if (err < 0)
goto out;
- err = writer_index_hash(w, &buf);
+ err = writer_index_hash(w, &w->scratch);
if (err < 0)
goto out;
}
if (!w->opts.skip_index_objects && reftable_ref_record_val2(ref)) {
- reftable_buf_reset(&buf);
- err = reftable_buf_add(&buf, reftable_ref_record_val2(ref),
+ reftable_buf_reset(&w->scratch);
+ err = reftable_buf_add(&w->scratch, reftable_ref_record_val2(ref),
hash_size(w->opts.hash_id));
if (err < 0)
goto out;
- err = writer_index_hash(w, &buf);
+ err = writer_index_hash(w, &w->scratch);
if (err < 0)
goto out;
}
@@ -365,7 +379,6 @@ int reftable_writer_add_ref(struct reftable_writer *w,
err = 0;
out:
- reftable_buf_release(&buf);
return err;
}
diff --git a/reftable/writer.h b/reftable/writer.h
index e8a6fbb785..1f4788a430 100644
--- a/reftable/writer.h
+++ b/reftable/writer.h
@@ -20,6 +20,8 @@ struct reftable_writer {
void *write_arg;
int pending_padding;
struct reftable_buf last_key;
+ /* Scratch buffer used to avoid allocations. */
+ struct reftable_buf scratch;
/* offset of next block to write. */
uint64_t next;
diff --git a/remote.c b/remote.c
index 10104d11e3..4ec5d3f47b 100644
--- a/remote.c
+++ b/remote.c
@@ -514,6 +514,24 @@ static int handle_config(const char *key, const char *value,
} else if (!strcmp(subkey, "serveroption")) {
return parse_transport_option(key, value,
&remote->server_options);
+ } else if (!strcmp(subkey, "followremotehead")) {
+ const char *no_warn_branch;
+ if (!strcmp(value, "never"))
+ remote->follow_remote_head = FOLLOW_REMOTE_NEVER;
+ else if (!strcmp(value, "create"))
+ remote->follow_remote_head = FOLLOW_REMOTE_CREATE;
+ else if (!strcmp(value, "warn")) {
+ remote->follow_remote_head = FOLLOW_REMOTE_WARN;
+ remote->no_warn_branch = NULL;
+ } else if (skip_prefix(value, "warn-if-not-", &no_warn_branch)) {
+ remote->follow_remote_head = FOLLOW_REMOTE_WARN;
+ remote->no_warn_branch = no_warn_branch;
+ } else if (!strcmp(value, "always")) {
+ remote->follow_remote_head = FOLLOW_REMOTE_ALWAYS;
+ } else {
+ warning(_("unrecognized followRemoteHEAD value '%s' ignored"),
+ value);
+ }
}
return 0;
}
diff --git a/remote.h b/remote.h
index a7e5c4e07c..bda10dd5c8 100644
--- a/remote.h
+++ b/remote.h
@@ -59,6 +59,13 @@ struct remote_state {
void remote_state_clear(struct remote_state *remote_state);
struct remote_state *remote_state_new(void);
+ enum follow_remote_head_settings {
+ FOLLOW_REMOTE_NEVER = -1,
+ FOLLOW_REMOTE_CREATE = 0,
+ FOLLOW_REMOTE_WARN = 1,
+ FOLLOW_REMOTE_ALWAYS = 2,
+ };
+
struct remote {
struct hashmap_entry ent;
@@ -107,6 +114,9 @@ struct remote {
char *http_proxy_authmethod;
struct string_list server_options;
+
+ enum follow_remote_head_settings follow_remote_head;
+ const char *no_warn_branch;
};
/**
diff --git a/repo-settings.c b/repo-settings.c
index 4699b4b365..9d16d5399e 100644
--- a/repo-settings.c
+++ b/repo-settings.c
@@ -3,6 +3,7 @@
#include "repo-settings.h"
#include "repository.h"
#include "midx.h"
+#include "pack-objects.h"
static void repo_cfg_bool(struct repository *r, const char *key, int *dest,
int def)
@@ -26,6 +27,7 @@ void prepare_repo_settings(struct repository *r)
const char *strval;
int manyfiles;
int read_changed_paths;
+ unsigned long ulongval;
if (!r->gitdir)
BUG("Cannot add settings for uninitialized repository");
@@ -123,6 +125,22 @@ void prepare_repo_settings(struct repository *r)
* removed.
*/
r->settings.command_requires_full_index = 1;
+
+ if (!repo_config_get_ulong(r, "core.deltabasecachelimit", &ulongval))
+ r->settings.delta_base_cache_limit = ulongval;
+
+ if (!repo_config_get_ulong(r, "core.packedgitwindowsize", &ulongval)) {
+ int pgsz_x2 = getpagesize() * 2;
+
+ /* This value must be multiple of (pagesize * 2) */
+ ulongval /= pgsz_x2;
+ if (ulongval < 1)
+ ulongval = 1;
+ r->settings.packed_git_window_size = ulongval * pgsz_x2;
+ }
+
+ if (!repo_config_get_ulong(r, "core.packedgitlimit", &ulongval))
+ r->settings.packed_git_limit = ulongval;
}
enum log_refs_config repo_settings_get_log_all_ref_updates(struct repository *repo)
diff --git a/repo-settings.h b/repo-settings.h
index 51d6156a11..93ea0c3274 100644
--- a/repo-settings.h
+++ b/repo-settings.h
@@ -57,12 +57,19 @@ struct repo_settings {
int core_multi_pack_index;
int warn_ambiguous_refs; /* lazily loaded via accessor */
+
+ size_t delta_base_cache_limit;
+ size_t packed_git_window_size;
+ size_t packed_git_limit;
};
#define REPO_SETTINGS_INIT { \
.index_version = -1, \
.core_untracked_cache = UNTRACKED_CACHE_KEEP, \
.fetch_negotiation_algorithm = FETCH_NEGOTIATION_CONSECUTIVE, \
.warn_ambiguous_refs = -1, \
+ .delta_base_cache_limit = DEFAULT_DELTA_BASE_CACHE_LIMIT, \
+ .packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE, \
+ .packed_git_limit = DEFAULT_PACKED_GIT_LIMIT, \
}
void prepare_repo_settings(struct repository *r);
diff --git a/repository.c b/repository.c
index f988b8ae68..1a6a62bbd0 100644
--- a/repository.c
+++ b/repository.c
@@ -283,6 +283,7 @@ int repo_init(struct repository *repo,
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;
+ repo->repository_format_relative_worktrees = format.relative_worktrees;
/* take ownership of format.partial_clone */
repo->repository_format_partial_clone = format.partial_clone;
diff --git a/repository.h b/repository.h
index 24a66a496a..c4c92b2ab9 100644
--- a/repository.h
+++ b/repository.h
@@ -150,6 +150,7 @@ struct repository {
/* Configurations */
int repository_format_worktree_config;
+ int repository_format_relative_worktrees;
/* Indicate if a repository has a different 'commondir' from 'gitdir' */
unsigned different_commondir:1;
diff --git a/revision.c b/revision.c
index 8df75b8224..57ca521c55 100644
--- a/revision.c
+++ b/revision.c
@@ -51,8 +51,8 @@
volatile show_early_output_fn_t show_early_output;
-static const char *term_bad;
-static const char *term_good;
+static char *term_bad;
+static char *term_good;
implement_shared_commit_slab(revision_sources, char *);
@@ -390,7 +390,8 @@ static struct object *get_reference(struct rev_info *revs, const char *name,
if (!object) {
if (revs->ignore_missing)
return NULL;
- if (revs->exclude_promisor_objects && is_promisor_object(oid))
+ if (revs->exclude_promisor_objects &&
+ is_promisor_object(revs->repo, oid))
return NULL;
if (revs->do_not_die_on_missing_objects) {
oidset_insert(&revs->missing_commits, oid);
@@ -432,7 +433,7 @@ static struct commit *handle_commit(struct rev_info *revs,
if (revs->ignore_missing_links || (flags & UNINTERESTING))
return NULL;
if (revs->exclude_promisor_objects &&
- is_promisor_object(&tag->tagged->oid))
+ is_promisor_object(revs->repo, &tag->tagged->oid))
return NULL;
if (revs->do_not_die_on_missing_objects && oid) {
oidset_insert(&revs->missing_commits, oid);
@@ -1211,7 +1212,7 @@ static int process_parents(struct rev_info *revs, struct commit *commit,
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)) {
+ is_promisor_object(revs->repo, &p->object.oid)) {
if (revs->first_parent_only)
break;
continue;
@@ -3920,7 +3921,7 @@ int prepare_revision_walk(struct rev_info *revs)
revs->treesame.name = "treesame";
if (revs->exclude_promisor_objects) {
- for_each_packed_object(mark_uninteresting, revs,
+ for_each_packed_object(revs->repo, mark_uninteresting, revs,
FOR_EACH_OBJECT_PROMISOR_ONLY);
}
@@ -4108,10 +4109,10 @@ enum commit_action get_commit_action(struct rev_info *revs, struct commit *commi
{
if (commit->object.flags & SHOWN)
return commit_ignore;
- if (revs->unpacked && has_object_pack(&commit->object.oid))
+ if (revs->unpacked && has_object_pack(revs->repo, &commit->object.oid))
return commit_ignore;
if (revs->no_kept_objects) {
- if (has_object_kept_pack(&commit->object.oid,
+ if (has_object_kept_pack(revs->repo, &commit->object.oid,
revs->keep_pack_cache_flags))
return commit_ignore;
}
diff --git a/sequencer.c b/sequencer.c
index 353d804999..459066e43b 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -662,7 +662,7 @@ static int fast_forward_to(struct repository *r,
strbuf_addf(&sb, "%s: fast-forward", action_name(opts));
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction ||
ref_transaction_update(transaction, "HEAD",
to, unborn && !is_rebase_i(opts) ?
@@ -1297,7 +1297,7 @@ int update_head_with_reflog(const struct commit *old_head,
}
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- err);
+ 0, err);
if (!transaction ||
ref_transaction_update(transaction, "HEAD", new_head,
old_head ? &old_head->object.oid : null_oid(),
@@ -1941,10 +1941,10 @@ static int seen_squash(struct replay_ctx *ctx)
static void update_comment_bufs(struct strbuf *buf1, struct strbuf *buf2, int n)
{
- strbuf_setlen(buf1, 2);
+ strbuf_setlen(buf1, strlen(comment_line_str) + 1);
strbuf_addf(buf1, _(nth_commit_msg_fmt), n);
strbuf_addch(buf1, '\n');
- strbuf_setlen(buf2, 2);
+ strbuf_setlen(buf2, strlen(comment_line_str) + 1);
strbuf_addf(buf2, _(skip_nth_commit_msg_fmt), n);
strbuf_addch(buf2, '\n');
}
@@ -1963,8 +1963,12 @@ static void update_squash_message_for_fixup(struct strbuf *msg)
size_t orig_msg_len;
int i = 1;
- strbuf_addf(&buf1, "# %s\n", _(first_commit_msg_str));
- strbuf_addf(&buf2, "# %s\n", _(skip_first_commit_msg_str));
+ strbuf_add_commented_lines(&buf1, _(first_commit_msg_str),
+ strlen(_(first_commit_msg_str)),
+ comment_line_str);
+ strbuf_add_commented_lines(&buf2, _(skip_first_commit_msg_str),
+ strlen(_(skip_first_commit_msg_str)),
+ comment_line_str);
s = start = orig_msg = strbuf_detach(msg, &orig_msg_len);
while (s) {
const char *next;
@@ -2341,8 +2345,8 @@ static int do_pick_commit(struct repository *r,
next = parent;
next_label = msg.parent_label;
if (opts->commit_use_reference) {
- strbuf_addstr(&ctx->message,
- "# *** SAY WHY WE ARE REVERTING ON THE TITLE LINE ***");
+ strbuf_commented_addf(&ctx->message, comment_line_str,
+ "*** 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
@@ -2352,12 +2356,13 @@ static int do_pick_commit(struct repository *r,
!starts_with(orig_subject, "Revert \"")) {
strbuf_addstr(&ctx->message, "Reapply \"");
strbuf_addstr(&ctx->message, orig_subject);
+ strbuf_addstr(&ctx->message, "\n");
} else {
strbuf_addstr(&ctx->message, "Revert \"");
strbuf_addstr(&ctx->message, msg.subject);
- strbuf_addstr(&ctx->message, "\"");
+ strbuf_addstr(&ctx->message, "\"\n");
}
- strbuf_addstr(&ctx->message, "\n\nThis reverts commit ");
+ strbuf_addstr(&ctx->message, "\nThis reverts commit ");
refer_to_commit(opts, &ctx->message, commit);
if (commit->parents && commit->parents->next) {
@@ -3890,7 +3895,7 @@ static int do_label(struct repository *r, const char *name, int len)
strbuf_addf(&ref_name, "refs/rewritten/%.*s", len, name);
strbuf_addf(&msg, "rebase (label) '%.*s'", len, name);
- transaction = ref_store_transaction_begin(refs, &err);
+ transaction = ref_store_transaction_begin(refs, 0, &err);
if (!transaction) {
error("%s", err.buf);
ret = -1;
@@ -6382,8 +6387,9 @@ static int add_decorations_to_list(const struct commit *commit,
/* If the branch is checked out, then leave a comment instead. */
if ((path = branch_checked_out(decoration->name))) {
item->command = TODO_COMMENT;
- strbuf_addf(ctx->buf, "# Ref %s checked out at '%s'\n",
- decoration->name, path);
+ strbuf_commented_addf(ctx->buf, comment_line_str,
+ "Ref %s checked out at '%s'\n",
+ decoration->name, path);
} else {
struct string_list_item *sti;
item->command = TODO_UPDATE_REF;
diff --git a/setup.c b/setup.c
index 7b648de027..39ff48d9dc 100644
--- a/setup.c
+++ b/setup.c
@@ -683,6 +683,9 @@ static enum extension_result handle_extension(const char *var,
"extensions.refstorage", value);
data->ref_storage_format = format;
return EXTENSION_OK;
+ } else if (!strcmp(ext, "relativeworktrees")) {
+ data->relative_worktrees = git_config_bool(var, value);
+ return EXTENSION_OK;
}
return EXTENSION_UNKNOWN;
}
@@ -1854,6 +1857,8 @@ const char *setup_git_directory_gently(int *nongit_ok)
repo_fmt.ref_storage_format);
the_repository->repository_format_worktree_config =
repo_fmt.worktree_config;
+ the_repository->repository_format_relative_worktrees =
+ repo_fmt.relative_worktrees;
/* take ownership of repo_fmt.partial_clone */
the_repository->repository_format_partial_clone =
repo_fmt.partial_clone;
@@ -1950,6 +1955,8 @@ void check_repository_format(struct repository_format *fmt)
fmt->ref_storage_format);
the_repository->repository_format_worktree_config =
fmt->worktree_config;
+ the_repository->repository_format_relative_worktrees =
+ fmt->relative_worktrees;
the_repository->repository_format_partial_clone =
xstrdup_or_null(fmt->partial_clone);
clear_repository_format(&repo_fmt);
@@ -2204,8 +2211,8 @@ void initialize_repository_version(int hash_algo,
enum ref_storage_format ref_storage_format,
int reinit)
{
- char repo_version_string[10];
- int repo_version = GIT_REPO_VERSION;
+ struct strbuf repo_version = STRBUF_INIT;
+ int target_version = GIT_REPO_VERSION;
/*
* Note that we initialize the repository version to 1 when the ref
@@ -2216,12 +2223,7 @@ void initialize_repository_version(int hash_algo,
*/
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 */
- xsnprintf(repo_version_string, sizeof(repo_version_string),
- "%d", repo_version);
- git_config_set("core.repositoryformatversion", repo_version_string);
+ target_version = GIT_REPO_VERSION_READ;
if (hash_algo != GIT_HASH_SHA1 && hash_algo != GIT_HASH_UNKNOWN)
git_config_set("extensions.objectformat",
@@ -2234,6 +2236,25 @@ void initialize_repository_version(int hash_algo,
ref_storage_format_to_name(ref_storage_format));
else if (reinit)
git_config_set_gently("extensions.refstorage", NULL);
+
+ if (reinit) {
+ struct strbuf config = STRBUF_INIT;
+ struct repository_format repo_fmt = REPOSITORY_FORMAT_INIT;
+
+ strbuf_git_common_path(&config, the_repository, "config");
+ read_repository_format(&repo_fmt, config.buf);
+
+ if (repo_fmt.v1_only_extensions.nr)
+ target_version = GIT_REPO_VERSION_READ;
+
+ strbuf_release(&config);
+ clear_repository_format(&repo_fmt);
+ }
+
+ strbuf_addf(&repo_version, "%d", target_version);
+ git_config_set("core.repositoryformatversion", repo_version.buf);
+
+ strbuf_release(&repo_version);
}
static int is_reinit(void)
@@ -2333,7 +2354,7 @@ static int create_default_files(const char *template_path,
adjust_shared_perm(repo_get_git_dir(the_repository));
}
- initialize_repository_version(fmt->hash_algo, fmt->ref_storage_format, 0);
+ initialize_repository_version(fmt->hash_algo, fmt->ref_storage_format, reinit);
/* Check filemode trustability */
path = git_path_buf(&buf, "config");
diff --git a/setup.h b/setup.h
index e496ab3e4d..18dc3b7368 100644
--- a/setup.h
+++ b/setup.h
@@ -129,6 +129,7 @@ struct repository_format {
int precious_objects;
char *partial_clone; /* value of extensions.partialclone */
int worktree_config;
+ int relative_worktrees;
int is_bare;
int hash_algo;
int compat_hash_algo;
diff --git a/split-index.c b/split-index.c
index 120c8190b1..cfbc773e6c 100644
--- a/split-index.c
+++ b/split-index.c
@@ -97,7 +97,11 @@ void move_cache_to_base_index(struct index_state *istate)
mem_pool_combine(istate->ce_mem_pool, istate->split_index->base->ce_mem_pool);
}
- ALLOC_ARRAY(si->base, 1);
+ if (si->base)
+ release_index(si->base);
+ else
+ ALLOC_ARRAY(si->base, 1);
+
index_state_init(si->base, istate->repo);
si->base->version = istate->version;
/* zero timestamp disables racy test in ce_write_index() */
diff --git a/strbuf.h b/strbuf.h
index 003f880ff7..4dc05b4ba7 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -637,28 +637,6 @@ static inline void strbuf_complete_line(struct strbuf *sb)
strbuf_complete(sb, '\n');
}
-/*
- * Copy "name" to "sb", expanding any special @-marks as handled by
- * repo_interpret_branch_name(). The result is a non-qualified branch name
- * (so "foo" or "origin/master" instead of "refs/heads/foo" or
- * "refs/remotes/origin/master").
- *
- * Note that the resulting name may not be a syntactically valid refname.
- *
- * If "allowed" is non-zero, restrict the set of allowed expansions. See
- * repo_interpret_branch_name() for details.
- */
-void strbuf_branchname(struct strbuf *sb, const char *name,
- unsigned allowed);
-
-/*
- * Like strbuf_branchname() above, but confirm that the result is
- * syntactically valid to be used as a local branch name in refs/heads/.
- *
- * The return value is "0" if the result is valid, and "-1" otherwise.
- */
-int strbuf_check_branch_ref(struct strbuf *sb, const char *name);
-
typedef int (*char_predicate)(char ch);
void strbuf_addstr_urlencode(struct strbuf *sb, const char *name,
diff --git a/strvec.c b/strvec.c
index f712070f57..d67596e571 100644
--- a/strvec.c
+++ b/strvec.c
@@ -56,6 +56,28 @@ void strvec_pushv(struct strvec *array, const char **items)
strvec_push(array, *items);
}
+void strvec_splice(struct strvec *array, size_t idx, size_t len,
+ const char **replacement, size_t replacement_len)
+{
+ if (idx + len > array->nr)
+ BUG("range outside of array boundary");
+ if (replacement_len > len) {
+ if (array->v == empty_strvec)
+ array->v = NULL;
+ ALLOC_GROW(array->v, array->nr + (replacement_len - len) + 1,
+ array->alloc);
+ array->v[array->nr + (replacement_len - len)] = NULL;
+ }
+ for (size_t i = 0; i < len; i++)
+ free((char *)array->v[idx + i]);
+ if ((replacement_len != len) && array->nr)
+ memmove(array->v + idx + replacement_len, array->v + idx + len,
+ (array->nr - idx - len + 1) * sizeof(char *));
+ array->nr += replacement_len - len;
+ for (size_t i = 0; i < replacement_len; i++)
+ array->v[idx + i] = xstrdup(replacement[i]);
+}
+
const char *strvec_replace(struct strvec *array, size_t idx, const char *replacement)
{
char *to_free;
diff --git a/strvec.h b/strvec.h
index 4b73c1f092..f74e061e14 100644
--- a/strvec.h
+++ b/strvec.h
@@ -67,6 +67,15 @@ void strvec_pushl(struct strvec *, ...);
/* Push a null-terminated array of strings onto the end of the array. */
void strvec_pushv(struct strvec *, const char **);
+/*
+ * Replace `len` values starting at `idx` with the provided replacement
+ * strings. If `len` is zero this is effectively an insert at the given `idx`.
+ * If `replacement_len` is zero this is effectively a delete of `len` items
+ * starting at `idx`.
+ */
+void strvec_splice(struct strvec *array, size_t idx, size_t len,
+ const char **replacement, size_t replacement_len);
+
/**
* Replace the value at the given index with a new value. The index must be
* valid. Returns a pointer to the inserted value.
diff --git a/subprojects/.gitignore b/subprojects/.gitignore
new file mode 100644
index 0000000000..63ea916ef5
--- /dev/null
+++ b/subprojects/.gitignore
@@ -0,0 +1 @@
+/*/
diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap
new file mode 100644
index 0000000000..f7e384b85c
--- /dev/null
+++ b/subprojects/curl.wrap
@@ -0,0 +1,13 @@
+[wrap-file]
+directory = curl-8.10.1
+source_url = https://github.com/curl/curl/releases/download/curl-8_10_1/curl-8.10.1.tar.xz
+source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/curl_8.10.1-1/curl-8.10.1.tar.xz
+source_filename = curl-8.10.1.tar.xz
+source_hash = 73a4b0e99596a09fa5924a4fb7e4b995a85fda0d18a2c02ab9cf134bebce04ee
+patch_filename = curl_8.10.1-1_patch.zip
+patch_url = https://wrapdb.mesonbuild.com/v2/curl_8.10.1-1/get_patch
+patch_hash = 707c28f35fc9b0e8d68c0c2800712007612f922a31da9637ce706a2159f3ddd8
+wrapdb_version = 8.10.1-1
+
+[provide]
+dependency_names = libcurl
diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap
new file mode 100644
index 0000000000..2e0427dcfd
--- /dev/null
+++ b/subprojects/expat.wrap
@@ -0,0 +1,13 @@
+[wrap-file]
+directory = expat-2.6.3
+source_url = https://github.com/libexpat/libexpat/releases/download/R_2_6_3/expat-2.6.3.tar.xz
+source_filename = expat-2.6.3.tar.bz2
+source_hash = 274db254a6979bde5aad404763a704956940e465843f2a9bd9ed7af22e2c0efc
+patch_filename = expat_2.6.3-1_patch.zip
+patch_url = https://wrapdb.mesonbuild.com/v2/expat_2.6.3-1/get_patch
+patch_hash = cf017fbe105e31428b2768360bd9be39094df4e948a1e8d1c54b6f7c76460cb1
+source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/expat_2.6.3-1/expat-2.6.3.tar.bz2
+wrapdb_version = 2.6.3-1
+
+[provide]
+expat = expat_dep
diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap
new file mode 100644
index 0000000000..873d55106e
--- /dev/null
+++ b/subprojects/openssl.wrap
@@ -0,0 +1,15 @@
+[wrap-file]
+directory = openssl-3.0.8
+source_url = https://www.openssl.org/source/openssl-3.0.8.tar.gz
+source_filename = openssl-3.0.8.tar.gz
+source_hash = 6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e
+patch_filename = openssl_3.0.8-3_patch.zip
+patch_url = https://wrapdb.mesonbuild.com/v2/openssl_3.0.8-3/get_patch
+patch_hash = 300da189e106942347d61a4a4295aa2edbcf06184f8d13b4cee0bed9fb936963
+source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-3/openssl-3.0.8.tar.gz
+wrapdb_version = 3.0.8-3
+
+[provide]
+libcrypto = libcrypto_dep
+libssl = libssl_dep
+openssl = openssl_dep
diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap
new file mode 100644
index 0000000000..7e18447254
--- /dev/null
+++ b/subprojects/pcre2.wrap
@@ -0,0 +1,16 @@
+[wrap-file]
+directory = pcre2-10.44
+source_url = https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.tar.bz2
+source_filename = pcre2-10.44.tar.bz2
+source_hash = d34f02e113cf7193a1ebf2770d3ac527088d485d4e047ed10e5d217c6ef5de96
+patch_filename = pcre2_10.44-2_patch.zip
+patch_url = https://wrapdb.mesonbuild.com/v2/pcre2_10.44-2/get_patch
+patch_hash = 4336d422ee9043847e5e10dbbbd01940d4c9e5027f31ccdc33a7898a1ca94009
+source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/pcre2_10.44-2/pcre2-10.44.tar.bz2
+wrapdb_version = 10.44-2
+
+[provide]
+libpcre2-8 = libpcre2_8
+libpcre2-16 = libpcre2_16
+libpcre2-32 = libpcre2_32
+libpcre2-posix = libpcre2_posix
diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
new file mode 100644
index 0000000000..aa14de1774
--- /dev/null
+++ b/subprojects/zlib.wrap
@@ -0,0 +1,13 @@
+[wrap-file]
+directory = zlib-1.3.1
+source_url = http://zlib.net/fossils/zlib-1.3.1.tar.gz
+source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3.1-1/zlib-1.3.1.tar.gz
+source_filename = zlib-1.3.1.tar.gz
+source_hash = 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23
+patch_filename = zlib_1.3.1-1_patch.zip
+patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.1-1/get_patch
+patch_hash = e79b98eb24a75392009cec6f99ca5cdca9881ff20bfa174e8b8926d5c7a47095
+wrapdb_version = 1.3.1-1
+
+[provide]
+zlib = zlib_dep
diff --git a/t/README b/t/README
index 8c0319b58e..e84824dc00 100644
--- a/t/README
+++ b/t/README
@@ -368,27 +368,6 @@ excluded as so much relies on it, but this might change in the future.
GIT_TEST_SPLIT_INDEX=<boolean> forces split-index mode on the whole
test suite. Accept any boolean values that are accepted by git-config.
-GIT_TEST_PASSING_SANITIZE_LEAK=true skips those tests that haven't
-declared themselves as leak-free by setting
-"TEST_PASSES_SANITIZE_LEAK=true" before sourcing "test-lib.sh". This
-test mode is used by the "linux-leaks" CI target.
-
-GIT_TEST_PASSING_SANITIZE_LEAK=check checks that our
-"TEST_PASSES_SANITIZE_LEAK=true" markings are current. Rather than
-skipping those tests that haven't set "TEST_PASSES_SANITIZE_LEAK=true"
-before sourcing "test-lib.sh" this mode runs them with
-"--invert-exit-code". This is used to check that there's a one-to-one
-mapping between "TEST_PASSES_SANITIZE_LEAK=true" and those tests that
-pass under "SANITIZE=leak". This is especially useful when testing a
-series that fixes various memory leaks with "git rebase -x".
-
-GIT_TEST_PASSING_SANITIZE_LEAK=check when combined with "--immediate"
-will run to completion faster, and result in the same failing
-tests.
-
-GIT_TEST_PASSING_SANITIZE_LEAK=check-failing behaves the same as "check",
-but skips all tests which are already marked as leak-free.
-
GIT_TEST_PROTOCOL_VERSION=<n>, when set, makes 'protocol.version'
default to n.
diff --git a/t/helper/meson.build b/t/helper/meson.build
new file mode 100644
index 0000000000..5e83884246
--- /dev/null
+++ b/t/helper/meson.build
@@ -0,0 +1,91 @@
+test_tool_sources = [
+ '../unit-tests/test-lib.c',
+ 'test-advise.c',
+ 'test-bitmap.c',
+ 'test-bloom.c',
+ 'test-bundle-uri.c',
+ 'test-cache-tree.c',
+ 'test-chmtime.c',
+ 'test-config.c',
+ 'test-crontab.c',
+ 'test-csprng.c',
+ 'test-date.c',
+ 'test-delete-gpgsig.c',
+ 'test-delta.c',
+ 'test-dir-iterator.c',
+ 'test-drop-caches.c',
+ 'test-dump-cache-tree.c',
+ 'test-dump-fsmonitor.c',
+ 'test-dump-split-index.c',
+ 'test-dump-untracked-cache.c',
+ 'test-env-helper.c',
+ 'test-example-tap.c',
+ 'test-find-pack.c',
+ 'test-fsmonitor-client.c',
+ 'test-genrandom.c',
+ 'test-genzeros.c',
+ 'test-getcwd.c',
+ 'test-hash-speed.c',
+ 'test-hash.c',
+ 'test-hashmap.c',
+ 'test-hexdump.c',
+ 'test-json-writer.c',
+ 'test-lazy-init-name-hash.c',
+ 'test-match-trees.c',
+ 'test-mergesort.c',
+ 'test-mktemp.c',
+ 'test-online-cpus.c',
+ 'test-pack-mtimes.c',
+ 'test-parse-options.c',
+ 'test-parse-pathspec-file.c',
+ 'test-partial-clone.c',
+ 'test-path-utils.c',
+ 'test-pcre2-config.c',
+ 'test-pkt-line.c',
+ 'test-proc-receive.c',
+ 'test-progress.c',
+ 'test-reach.c',
+ 'test-read-cache.c',
+ 'test-read-graph.c',
+ 'test-read-midx.c',
+ 'test-ref-store.c',
+ 'test-reftable.c',
+ 'test-regex.c',
+ 'test-repository.c',
+ 'test-revision-walking.c',
+ 'test-rot13-filter.c',
+ 'test-run-command.c',
+ 'test-scrap-cache-tree.c',
+ 'test-serve-v2.c',
+ 'test-sha1.c',
+ 'test-sha256.c',
+ 'test-sigchain.c',
+ 'test-simple-ipc.c',
+ 'test-string-list.c',
+ 'test-submodule-config.c',
+ 'test-submodule-nested-repo-config.c',
+ 'test-submodule.c',
+ 'test-subprocess.c',
+ 'test-tool.c',
+ 'test-trace2.c',
+ 'test-truncate.c',
+ 'test-userdiff.c',
+ 'test-wildmatch.c',
+ 'test-windows-named-pipe.c',
+ 'test-write-cache.c',
+ 'test-xml-encode.c',
+]
+
+test_tool = executable('test-tool',
+ sources: test_tool_sources,
+ dependencies: [libgit, common_main],
+)
+bin_wrappers += test_tool
+test_dependencies += test_tool
+
+test_fake_ssh = executable('test-fake-ssh',
+ sources: 'test-fake-ssh.c',
+ dependencies: [libgit, common_main],
+)
+bin_wrappers += test_fake_ssh
+test_dependencies += test_fake_ssh
diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c
index 5250913d99..5da359486c 100644
--- a/t/helper/test-parse-options.c
+++ b/t/helper/test-parse-options.c
@@ -282,14 +282,16 @@ int cmd__parse_options_flags(int argc, const char **argv)
return parse_options_flags__cmd(argc, argv, test_flags);
}
-static int subcmd_one(int argc, const char **argv, const char *prefix UNUSED)
+static int subcmd_one(int argc, const char **argv, const char *prefix UNUSED,
+ struct repository *repo UNUSED)
{
printf("fn: subcmd_one\n");
print_args(argc, argv);
return 0;
}
-static int subcmd_two(int argc, const char **argv, const char *prefix UNUSED)
+static int subcmd_two(int argc, const char **argv, const char *prefix UNUSED,
+ struct repository *repo UNUSED)
{
printf("fn: subcmd_two\n");
print_args(argc, argv);
@@ -319,7 +321,7 @@ static int parse_subcommand__cmd(int argc, const char **argv,
printf("opt: %d\n", opt);
- return fn(argc, argv, NULL);
+ return fn(argc, argv, NULL, NULL);
}
int cmd__parse_subcommand(int argc, const char **argv)
diff --git a/t/helper/test-read-graph.c b/t/helper/test-read-graph.c
index 9018c9f541..811dde1cb3 100644
--- a/t/helper/test-read-graph.c
+++ b/t/helper/test-read-graph.c
@@ -97,7 +97,6 @@ int cmd__read_graph(int argc, const char **argv)
}
done:
- UNLEAK(graph);
-
+ free_commit_graph(graph);
return ret;
}
diff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c
index 438fb9fc61..fc63236961 100644
--- a/t/helper/test-read-midx.c
+++ b/t/helper/test-read-midx.c
@@ -18,7 +18,7 @@ static int read_midx_file(const char *object_dir, const char *checksum,
struct multi_pack_index *m;
setup_git_directory();
- m = load_multi_pack_index(object_dir, 1);
+ m = load_multi_pack_index(the_repository, object_dir, 1);
if (!m)
return 1;
@@ -82,7 +82,7 @@ static int read_midx_checksum(const char *object_dir)
struct multi_pack_index *m;
setup_git_directory();
- m = load_multi_pack_index(object_dir, 1);
+ m = load_multi_pack_index(the_repository, object_dir, 1);
if (!m)
return 1;
printf("%s\n", hash_to_hex(get_midx_checksum(m)));
@@ -98,7 +98,7 @@ static int read_midx_preferred_pack(const char *object_dir)
setup_git_directory();
- midx = load_multi_pack_index(object_dir, 1);
+ midx = load_multi_pack_index(the_repository, object_dir, 1);
if (!midx)
return 1;
@@ -121,7 +121,7 @@ static int read_midx_bitmapped_packs(const char *object_dir)
setup_git_directory();
- midx = load_multi_pack_index(object_dir, 1);
+ midx = load_multi_pack_index(the_repository, object_dir, 1);
if (!midx)
return 1;
diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c
index 65346dee55..240f6fc29d 100644
--- a/t/helper/test-ref-store.c
+++ b/t/helper/test-ref-store.c
@@ -199,7 +199,7 @@ static int cmd_verify_ref(struct ref_store *refs, const char **argv)
struct strbuf err = STRBUF_INIT;
int ret;
- ret = refs_verify_refname_available(refs, refname, NULL, NULL, &err);
+ ret = refs_verify_refname_available(refs, refname, NULL, NULL, 0, &err);
if (err.len)
puts(err.buf);
return ret;
diff --git a/t/helper/test-reftable.c b/t/helper/test-reftable.c
index 5c8849d115..3c72ed985b 100644
--- a/t/helper/test-reftable.c
+++ b/t/helper/test-reftable.c
@@ -156,7 +156,7 @@ int cmd__dump_reftable(int argc, const char **argv)
int opt_dump_blocks = 0;
int opt_dump_table = 0;
int opt_dump_stack = 0;
- uint32_t opt_hash_id = GIT_SHA1_FORMAT_ID;
+ uint32_t opt_hash_id = REFTABLE_HASH_SHA1;
const char *arg = NULL, *argv0 = argv[0];
for (; argc > 1; argv++, argc--)
@@ -167,7 +167,7 @@ int cmd__dump_reftable(int argc, const char **argv)
else if (!strcmp("-t", argv[1]))
opt_dump_table = 1;
else if (!strcmp("-6", argv[1]))
- opt_hash_id = GIT_SHA256_FORMAT_ID;
+ opt_hash_id = REFTABLE_HASH_SHA256;
else if (!strcmp("-s", argv[1]))
opt_dump_stack = 1;
else if (!strcmp("-?", argv[1]) || !strcmp("-h", argv[1])) {
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index cc6bb2cdea..7a734c6973 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -6,8 +6,8 @@
. ./test-lib.sh
-GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale"
-GIT_PO_PATH="$GIT_BUILD_DIR/po"
+GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
+GIT_PO_PATH="$GIT_TEST_POPATH"
export GIT_TEXTDOMAINDIR GIT_PO_PATH
if test -n "$GIT_TEST_INSTALLED"
diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh
index ea28971e8e..2fde2353fd 100644
--- a/t/lib-git-svn.sh
+++ b/t/lib-git-svn.sh
@@ -1,7 +1,3 @@
-if test -z "$TEST_FAILS_SANITIZE_LEAK"
-then
- TEST_PASSES_SANITIZE_LEAK=true
-fi
. ./test-lib.sh
if test -n "$NO_SVN_TESTS"
diff --git a/t/meson.build b/t/meson.build
new file mode 100644
index 0000000000..13fe854ba0
--- /dev/null
+++ b/t/meson.build
@@ -0,0 +1,1114 @@
+clar_test_suites = [
+ 'unit-tests/ctype.c',
+ 'unit-tests/strvec.c',
+]
+
+clar_sources = [
+ 'unit-tests/clar/clar.c',
+ 'unit-tests/unit-test.c',
+]
+
+clar_decls_h = custom_target(
+ input: clar_test_suites,
+ output: 'clar-decls.h',
+ command : [
+ shell,
+ meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh',
+ '@OUTPUT@',
+ '@INPUT@',
+ ],
+ env: script_environment,
+)
+clar_sources += clar_decls_h
+
+clar_sources += custom_target(
+ input: clar_decls_h,
+ output: 'clar.suite',
+ command : [
+ shell,
+ meson.current_source_dir() + '/unit-tests/generate-clar-suites.sh',
+ '@INPUT@',
+ '@OUTPUT@',
+ ],
+ env: script_environment,
+)
+
+clar_unit_tests = executable('unit-tests',
+ sources: clar_sources + clar_test_suites,
+ dependencies: [libgit, common_main],
+)
+test('unit-tests', clar_unit_tests)
+
+unit_test_programs = [
+ 'unit-tests/t-example-decorate.c',
+ 'unit-tests/t-hash.c',
+ 'unit-tests/t-hashmap.c',
+ 'unit-tests/t-mem-pool.c',
+ 'unit-tests/t-oid-array.c',
+ 'unit-tests/t-oidmap.c',
+ 'unit-tests/t-oidtree.c',
+ 'unit-tests/t-prio-queue.c',
+ 'unit-tests/t-reftable-basics.c',
+ 'unit-tests/t-reftable-block.c',
+ 'unit-tests/t-reftable-merged.c',
+ 'unit-tests/t-reftable-pq.c',
+ 'unit-tests/t-reftable-reader.c',
+ 'unit-tests/t-reftable-readwrite.c',
+ 'unit-tests/t-reftable-record.c',
+ 'unit-tests/t-reftable-stack.c',
+ 'unit-tests/t-reftable-tree.c',
+ 'unit-tests/t-strbuf.c',
+ 'unit-tests/t-strcmp-offset.c',
+ 'unit-tests/t-trailer.c',
+ 'unit-tests/t-urlmatch-normalization.c',
+]
+
+foreach unit_test_program : unit_test_programs
+ unit_test_name = fs.stem(unit_test_program)
+ unit_test = executable(unit_test_name,
+ sources: [
+ 'unit-tests/test-lib.c',
+ 'unit-tests/lib-oid.c',
+ 'unit-tests/lib-reftable.c',
+ unit_test_program,
+ ],
+ dependencies: [libgit, common_main],
+ )
+ test(unit_test_name, unit_test,
+ workdir: meson.current_source_dir(),
+ timeout: 0,
+ )
+endforeach
+
+subdir('helper')
+
+integration_tests = [
+ 't0000-basic.sh',
+ 't0001-init.sh',
+ 't0002-gitfile.sh',
+ 't0003-attributes.sh',
+ 't0004-unwritable.sh',
+ 't0005-signals.sh',
+ 't0006-date.sh',
+ 't0007-git-var.sh',
+ 't0008-ignores.sh',
+ 't0010-racy-git.sh',
+ 't0012-help.sh',
+ 't0013-sha1dc.sh',
+ 't0014-alias.sh',
+ 't0017-env-helper.sh',
+ 't0018-advice.sh',
+ 't0019-json-writer.sh',
+ 't0020-crlf.sh',
+ 't0021-conversion.sh',
+ 't0022-crlf-rename.sh',
+ 't0023-crlf-am.sh',
+ 't0024-crlf-archive.sh',
+ 't0025-crlf-renormalize.sh',
+ 't0026-eol-config.sh',
+ 't0027-auto-crlf.sh',
+ 't0028-working-tree-encoding.sh',
+ 't0029-core-unsetenvvars.sh',
+ 't0030-stripspace.sh',
+ 't0033-safe-directory.sh',
+ 't0034-root-safe-directory.sh',
+ 't0035-safe-bare-repository.sh',
+ 't0040-parse-options.sh',
+ 't0041-usage.sh',
+ 't0050-filesystem.sh',
+ 't0051-windows-named-pipe.sh',
+ 't0052-simple-ipc.sh',
+ 't0055-beyond-symlinks.sh',
+ 't0056-git-C.sh',
+ 't0060-path-utils.sh',
+ 't0061-run-command.sh',
+ 't0062-revision-walking.sh',
+ 't0063-string-list.sh',
+ 't0066-dir-iterator.sh',
+ 't0067-parse_pathspec_file.sh',
+ 't0068-for-each-repo.sh',
+ 't0070-fundamental.sh',
+ 't0071-sort.sh',
+ 't0080-unit-test-output.sh',
+ 't0081-find-pack.sh',
+ 't0090-cache-tree.sh',
+ 't0091-bugreport.sh',
+ 't0092-diagnose.sh',
+ 't0095-bloom.sh',
+ 't0100-previous.sh',
+ 't0101-at-syntax.sh',
+ 't0200-gettext-basic.sh',
+ 't0201-gettext-fallbacks.sh',
+ 't0202-gettext-perl.sh',
+ 't0203-gettext-setlocale-sanity.sh',
+ 't0204-gettext-reencode-sanity.sh',
+ 't0210-trace2-normal.sh',
+ 't0211-trace2-perf.sh',
+ 't0212-trace2-event.sh',
+ 't0300-credentials.sh',
+ 't0301-credential-cache.sh',
+ 't0302-credential-store.sh',
+ 't0303-credential-external.sh',
+ 't0410-partial-clone.sh',
+ 't0411-clone-from-partial.sh',
+ 't0450-txt-doc-vs-help.sh',
+ 't0500-progress-display.sh',
+ 't0600-reffiles-backend.sh',
+ 't0601-reffiles-pack-refs.sh',
+ 't0602-reffiles-fsck.sh',
+ 't0610-reftable-basics.sh',
+ 't0611-reftable-httpd.sh',
+ 't0612-reftable-jgit-compatibility.sh',
+ 't0613-reftable-write-options.sh',
+ 't1000-read-tree-m-3way.sh',
+ 't1001-read-tree-m-2way.sh',
+ 't1002-read-tree-m-u-2way.sh',
+ 't1003-read-tree-prefix.sh',
+ 't1004-read-tree-m-u-wf.sh',
+ 't1005-read-tree-reset.sh',
+ 't1006-cat-file.sh',
+ 't1007-hash-object.sh',
+ 't1008-read-tree-overlay.sh',
+ 't1009-read-tree-new-index.sh',
+ 't1010-mktree.sh',
+ 't1011-read-tree-sparse-checkout.sh',
+ 't1012-read-tree-df.sh',
+ 't1013-read-tree-submodule.sh',
+ 't1014-read-tree-confusing.sh',
+ 't1015-read-index-unmerged.sh',
+ 't1016-compatObjectFormat.sh',
+ 't1020-subdirectory.sh',
+ 't1021-rerere-in-workdir.sh',
+ 't1022-read-tree-partial-clone.sh',
+ 't1050-large.sh',
+ 't1051-large-conversion.sh',
+ 't1060-object-corruption.sh',
+ 't1090-sparse-checkout-scope.sh',
+ 't1091-sparse-checkout-builtin.sh',
+ 't1092-sparse-checkout-compatibility.sh',
+ 't1100-commit-tree-options.sh',
+ 't1300-config.sh',
+ 't1301-shared-repo.sh',
+ 't1302-repo-version.sh',
+ 't1303-wacky-config.sh',
+ 't1304-default-acl.sh',
+ 't1305-config-include.sh',
+ 't1306-xdg-files.sh',
+ 't1307-config-blob.sh',
+ 't1308-config-set.sh',
+ 't1309-early-config.sh',
+ 't1310-config-default.sh',
+ 't1350-config-hooks-path.sh',
+ 't1400-update-ref.sh',
+ 't1401-symbolic-ref.sh',
+ 't1402-check-ref-format.sh',
+ 't1403-show-ref.sh',
+ 't1404-update-ref-errors.sh',
+ 't1405-main-ref-store.sh',
+ 't1406-submodule-ref-store.sh',
+ 't1407-worktree-ref-store.sh',
+ 't1408-packed-refs.sh',
+ 't1409-avoid-packing-refs.sh',
+ 't1410-reflog.sh',
+ 't1411-reflog-show.sh',
+ 't1412-reflog-loop.sh',
+ 't1413-reflog-detach.sh',
+ 't1414-reflog-walk.sh',
+ 't1415-worktree-refs.sh',
+ 't1416-ref-transaction-hooks.sh',
+ 't1417-reflog-updateref.sh',
+ 't1418-reflog-exists.sh',
+ 't1419-exclude-refs.sh',
+ 't1420-lost-found.sh',
+ 't1430-bad-ref-name.sh',
+ 't1450-fsck.sh',
+ 't1451-fsck-buffer.sh',
+ 't1460-refs-migrate.sh',
+ 't1500-rev-parse.sh',
+ 't1501-work-tree.sh',
+ 't1502-rev-parse-parseopt.sh',
+ 't1503-rev-parse-verify.sh',
+ 't1504-ceiling-dirs.sh',
+ 't1505-rev-parse-last.sh',
+ 't1506-rev-parse-diagnosis.sh',
+ 't1507-rev-parse-upstream.sh',
+ 't1508-at-combinations.sh',
+ 't1509-root-work-tree.sh',
+ 't1510-repo-setup.sh',
+ 't1511-rev-parse-caret.sh',
+ 't1512-rev-parse-disambiguation.sh',
+ 't1513-rev-parse-prefix.sh',
+ 't1514-rev-parse-push.sh',
+ 't1515-rev-parse-outside-repo.sh',
+ 't1517-outside-repo.sh',
+ 't1600-index.sh',
+ 't1601-index-bogus.sh',
+ 't1700-split-index.sh',
+ 't1701-racy-split-index.sh',
+ 't1800-hook.sh',
+ 't2000-conflict-when-checking-files-out.sh',
+ 't2002-checkout-cache-u.sh',
+ 't2003-checkout-cache-mkdir.sh',
+ 't2004-checkout-cache-temp.sh',
+ 't2005-checkout-index-symlinks.sh',
+ 't2006-checkout-index-basic.sh',
+ 't2007-checkout-symlink.sh',
+ 't2008-checkout-subdir.sh',
+ 't2009-checkout-statinfo.sh',
+ 't2010-checkout-ambiguous.sh',
+ 't2011-checkout-invalid-head.sh',
+ 't2012-checkout-last.sh',
+ 't2013-checkout-submodule.sh',
+ 't2014-checkout-switch.sh',
+ 't2015-checkout-unborn.sh',
+ 't2016-checkout-patch.sh',
+ 't2017-checkout-orphan.sh',
+ 't2018-checkout-branch.sh',
+ 't2019-checkout-ambiguous-ref.sh',
+ 't2020-checkout-detach.sh',
+ 't2021-checkout-overwrite.sh',
+ 't2022-checkout-paths.sh',
+ 't2023-checkout-m.sh',
+ 't2024-checkout-dwim.sh',
+ 't2025-checkout-no-overlay.sh',
+ 't2026-checkout-pathspec-file.sh',
+ 't2027-checkout-track.sh',
+ 't2030-unresolve-info.sh',
+ 't2050-git-dir-relative.sh',
+ 't2060-switch.sh',
+ 't2070-restore.sh',
+ 't2071-restore-patch.sh',
+ 't2072-restore-pathspec-file.sh',
+ 't2080-parallel-checkout-basics.sh',
+ 't2081-parallel-checkout-collisions.sh',
+ 't2082-parallel-checkout-attributes.sh',
+ 't2100-update-cache-badpath.sh',
+ 't2101-update-index-reupdate.sh',
+ 't2102-update-index-symlinks.sh',
+ 't2103-update-index-ignore-missing.sh',
+ 't2104-update-index-skip-worktree.sh',
+ 't2105-update-index-gitfile.sh',
+ 't2106-update-index-assume-unchanged.sh',
+ 't2107-update-index-basic.sh',
+ 't2108-update-index-refresh-racy.sh',
+ 't2200-add-update.sh',
+ 't2201-add-update-typechange.sh',
+ 't2202-add-addremove.sh',
+ 't2203-add-intent.sh',
+ 't2204-add-ignored.sh',
+ 't2205-add-worktree-config.sh',
+ 't2300-cd-to-toplevel.sh',
+ 't2400-worktree-add.sh',
+ 't2401-worktree-prune.sh',
+ 't2402-worktree-list.sh',
+ 't2403-worktree-move.sh',
+ 't2404-worktree-config.sh',
+ 't2405-worktree-submodule.sh',
+ 't2406-worktree-repair.sh',
+ 't2407-worktree-heads.sh',
+ 't2500-untracked-overwriting.sh',
+ 't2501-cwd-empty.sh',
+ 't3000-ls-files-others.sh',
+ 't3001-ls-files-others-exclude.sh',
+ 't3002-ls-files-dashpath.sh',
+ 't3003-ls-files-exclude.sh',
+ 't3004-ls-files-basic.sh',
+ 't3005-ls-files-relative.sh',
+ 't3006-ls-files-long.sh',
+ 't3007-ls-files-recurse-submodules.sh',
+ 't3008-ls-files-lazy-init-name-hash.sh',
+ 't3009-ls-files-others-nonsubmodule.sh',
+ 't3010-ls-files-killed-modified.sh',
+ 't3011-common-prefixes-and-directory-traversal.sh',
+ 't3012-ls-files-dedup.sh',
+ 't3013-ls-files-format.sh',
+ 't3020-ls-files-error-unmatch.sh',
+ 't3040-subprojects-basic.sh',
+ 't3050-subprojects-fetch.sh',
+ 't3060-ls-files-with-tree.sh',
+ 't3070-wildmatch.sh',
+ 't3100-ls-tree-restrict.sh',
+ 't3101-ls-tree-dirname.sh',
+ 't3102-ls-tree-wildcards.sh',
+ 't3103-ls-tree-misc.sh',
+ 't3104-ls-tree-format.sh',
+ 't3105-ls-tree-output.sh',
+ 't3200-branch.sh',
+ 't3201-branch-contains.sh',
+ 't3202-show-branch.sh',
+ 't3203-branch-output.sh',
+ 't3204-branch-name-interpretation.sh',
+ 't3205-branch-color.sh',
+ 't3206-range-diff.sh',
+ 't3207-branch-submodule.sh',
+ 't3211-peel-ref.sh',
+ 't3300-funny-names.sh',
+ 't3301-notes.sh',
+ 't3302-notes-index-expensive.sh',
+ 't3303-notes-subtrees.sh',
+ 't3304-notes-mixed.sh',
+ 't3305-notes-fanout.sh',
+ 't3306-notes-prune.sh',
+ 't3307-notes-man.sh',
+ 't3308-notes-merge.sh',
+ 't3309-notes-merge-auto-resolve.sh',
+ 't3310-notes-merge-manual-resolve.sh',
+ 't3311-notes-merge-fanout.sh',
+ 't3320-notes-merge-worktrees.sh',
+ 't3321-notes-stripspace.sh',
+ 't3400-rebase.sh',
+ 't3401-rebase-and-am-rename.sh',
+ 't3402-rebase-merge.sh',
+ 't3403-rebase-skip.sh',
+ 't3404-rebase-interactive.sh',
+ 't3405-rebase-malformed.sh',
+ 't3406-rebase-message.sh',
+ 't3407-rebase-abort.sh',
+ 't3408-rebase-multi-line.sh',
+ 't3409-rebase-environ.sh',
+ 't3412-rebase-root.sh',
+ 't3413-rebase-hook.sh',
+ 't3415-rebase-autosquash.sh',
+ 't3416-rebase-onto-threedots.sh',
+ 't3417-rebase-whitespace-fix.sh',
+ 't3418-rebase-continue.sh',
+ 't3419-rebase-patch-id.sh',
+ 't3420-rebase-autostash.sh',
+ 't3421-rebase-topology-linear.sh',
+ 't3422-rebase-incompatible-options.sh',
+ 't3423-rebase-reword.sh',
+ 't3424-rebase-empty.sh',
+ 't3425-rebase-topology-merges.sh',
+ 't3426-rebase-submodule.sh',
+ 't3427-rebase-subtree.sh',
+ 't3428-rebase-signoff.sh',
+ 't3429-rebase-edit-todo.sh',
+ 't3430-rebase-merges.sh',
+ 't3431-rebase-fork-point.sh',
+ 't3432-rebase-fast-forward.sh',
+ 't3433-rebase-across-mode-change.sh',
+ 't3434-rebase-i18n.sh',
+ 't3435-rebase-gpg-sign.sh',
+ 't3436-rebase-more-options.sh',
+ 't3437-rebase-fixup-options.sh',
+ 't3438-rebase-broken-files.sh',
+ 't3500-cherry.sh',
+ 't3501-revert-cherry-pick.sh',
+ 't3502-cherry-pick-merge.sh',
+ 't3503-cherry-pick-root.sh',
+ 't3504-cherry-pick-rerere.sh',
+ 't3505-cherry-pick-empty.sh',
+ 't3506-cherry-pick-ff.sh',
+ 't3507-cherry-pick-conflict.sh',
+ 't3508-cherry-pick-many-commits.sh',
+ 't3509-cherry-pick-merge-df.sh',
+ 't3510-cherry-pick-sequence.sh',
+ 't3511-cherry-pick-x.sh',
+ 't3512-cherry-pick-submodule.sh',
+ 't3513-revert-submodule.sh',
+ 't3514-cherry-pick-revert-gpg.sh',
+ 't3600-rm.sh',
+ 't3601-rm-pathspec-file.sh',
+ 't3602-rm-sparse-checkout.sh',
+ 't3650-replay-basics.sh',
+ 't3700-add.sh',
+ 't3701-add-interactive.sh',
+ 't3702-add-edit.sh',
+ 't3703-add-magic-pathspec.sh',
+ 't3704-add-pathspec-file.sh',
+ 't3705-add-sparse-checkout.sh',
+ 't3800-mktag.sh',
+ 't3900-i18n-commit.sh',
+ 't3901-i18n-patch.sh',
+ 't3902-quoted.sh',
+ 't3903-stash.sh',
+ 't3904-stash-patch.sh',
+ 't3905-stash-include-untracked.sh',
+ 't3906-stash-submodule.sh',
+ 't3907-stash-show-config.sh',
+ 't3908-stash-in-worktree.sh',
+ 't3909-stash-pathspec-file.sh',
+ 't3910-mac-os-precompose.sh',
+ 't3920-crlf-messages.sh',
+ 't4000-diff-format.sh',
+ 't4001-diff-rename.sh',
+ 't4002-diff-basic.sh',
+ 't4003-diff-rename-1.sh',
+ 't4004-diff-rename-symlink.sh',
+ 't4005-diff-rename-2.sh',
+ 't4006-diff-mode.sh',
+ 't4007-rename-3.sh',
+ 't4008-diff-break-rewrite.sh',
+ 't4009-diff-rename-4.sh',
+ 't4010-diff-pathspec.sh',
+ 't4011-diff-symlink.sh',
+ 't4012-diff-binary.sh',
+ 't4013-diff-various.sh',
+ 't4014-format-patch.sh',
+ 't4015-diff-whitespace.sh',
+ 't4016-diff-quote.sh',
+ 't4017-diff-retval.sh',
+ 't4018-diff-funcname.sh',
+ 't4019-diff-wserror.sh',
+ 't4020-diff-external.sh',
+ 't4021-format-patch-numbered.sh',
+ 't4022-diff-rewrite.sh',
+ 't4023-diff-rename-typechange.sh',
+ 't4024-diff-optimize-common.sh',
+ 't4025-hunk-header.sh',
+ 't4026-color.sh',
+ 't4027-diff-submodule.sh',
+ 't4028-format-patch-mime-headers.sh',
+ 't4029-diff-trailing-space.sh',
+ 't4030-diff-textconv.sh',
+ 't4031-diff-rewrite-binary.sh',
+ 't4032-diff-inter-hunk-context.sh',
+ 't4033-diff-patience.sh',
+ 't4034-diff-words.sh',
+ 't4035-diff-quiet.sh',
+ 't4036-format-patch-signer-mime.sh',
+ 't4037-diff-r-t-dirs.sh',
+ 't4038-diff-combined.sh',
+ 't4039-diff-assume-unchanged.sh',
+ 't4040-whitespace-status.sh',
+ 't4041-diff-submodule-option.sh',
+ 't4042-diff-textconv-caching.sh',
+ 't4043-diff-rename-binary.sh',
+ 't4044-diff-index-unique-abbrev.sh',
+ 't4045-diff-relative.sh',
+ 't4046-diff-unmerged.sh',
+ 't4047-diff-dirstat.sh',
+ 't4048-diff-combined-binary.sh',
+ 't4049-diff-stat-count.sh',
+ 't4050-diff-histogram.sh',
+ 't4051-diff-function-context.sh',
+ 't4052-stat-output.sh',
+ 't4053-diff-no-index.sh',
+ 't4054-diff-bogus-tree.sh',
+ 't4055-diff-context.sh',
+ 't4056-diff-order.sh',
+ 't4057-diff-combined-paths.sh',
+ 't4058-diff-duplicates.sh',
+ 't4059-diff-submodule-not-initialized.sh',
+ 't4060-diff-submodule-option-diff-format.sh',
+ 't4061-diff-indent.sh',
+ 't4062-diff-pickaxe.sh',
+ 't4063-diff-blobs.sh',
+ 't4064-diff-oidfind.sh',
+ 't4065-diff-anchored.sh',
+ 't4066-diff-emit-delay.sh',
+ 't4067-diff-partial-clone.sh',
+ 't4068-diff-symmetric-merge-base.sh',
+ 't4069-remerge-diff.sh',
+ 't4100-apply-stat.sh',
+ 't4101-apply-nonl.sh',
+ 't4102-apply-rename.sh',
+ 't4103-apply-binary.sh',
+ 't4104-apply-boundary.sh',
+ 't4105-apply-fuzz.sh',
+ 't4106-apply-stdin.sh',
+ 't4107-apply-ignore-whitespace.sh',
+ 't4108-apply-threeway.sh',
+ 't4109-apply-multifrag.sh',
+ 't4110-apply-scan.sh',
+ 't4111-apply-subdir.sh',
+ 't4112-apply-renames.sh',
+ 't4113-apply-ending.sh',
+ 't4114-apply-typechange.sh',
+ 't4115-apply-symlink.sh',
+ 't4116-apply-reverse.sh',
+ 't4117-apply-reject.sh',
+ 't4118-apply-empty-context.sh',
+ 't4119-apply-config.sh',
+ 't4120-apply-popt.sh',
+ 't4121-apply-diffs.sh',
+ 't4122-apply-symlink-inside.sh',
+ 't4123-apply-shrink.sh',
+ 't4124-apply-ws-rule.sh',
+ 't4125-apply-ws-fuzz.sh',
+ 't4126-apply-empty.sh',
+ 't4127-apply-same-fn.sh',
+ 't4128-apply-root.sh',
+ 't4129-apply-samemode.sh',
+ 't4130-apply-criss-cross-rename.sh',
+ 't4131-apply-fake-ancestor.sh',
+ 't4132-apply-removal.sh',
+ 't4133-apply-filenames.sh',
+ 't4134-apply-submodule.sh',
+ 't4135-apply-weird-filenames.sh',
+ 't4136-apply-check.sh',
+ 't4137-apply-submodule.sh',
+ 't4138-apply-ws-expansion.sh',
+ 't4139-apply-escape.sh',
+ 't4140-apply-ita.sh',
+ 't4141-apply-too-large.sh',
+ 't4150-am.sh',
+ 't4151-am-abort.sh',
+ 't4152-am-subjects.sh',
+ 't4153-am-resume-override-opts.sh',
+ 't4200-rerere.sh',
+ 't4201-shortlog.sh',
+ 't4202-log.sh',
+ 't4203-mailmap.sh',
+ 't4204-patch-id.sh',
+ 't4205-log-pretty-formats.sh',
+ 't4206-log-follow-harder-copies.sh',
+ 't4207-log-decoration-colors.sh',
+ 't4208-log-magic-pathspec.sh',
+ 't4209-log-pickaxe.sh',
+ 't4210-log-i18n.sh',
+ 't4211-line-log.sh',
+ 't4212-log-corrupt.sh',
+ 't4213-log-tabexpand.sh',
+ 't4214-log-graph-octopus.sh',
+ 't4215-log-skewed-merges.sh',
+ 't4216-log-bloom.sh',
+ 't4217-log-limit.sh',
+ 't4252-am-options.sh',
+ 't4253-am-keep-cr-dos.sh',
+ 't4254-am-corrupt.sh',
+ 't4255-am-submodule.sh',
+ 't4256-am-format-flowed.sh',
+ 't4257-am-interactive.sh',
+ 't4258-am-quoted-cr.sh',
+ 't4300-merge-tree.sh',
+ 't4301-merge-tree-write-tree.sh',
+ 't5000-tar-tree.sh',
+ 't5001-archive-attr.sh',
+ 't5002-archive-attr-pattern.sh',
+ 't5003-archive-zip.sh',
+ 't5004-archive-corner-cases.sh',
+ 't5100-mailinfo.sh',
+ 't5150-request-pull.sh',
+ 't5200-update-server-info.sh',
+ 't5300-pack-object.sh',
+ 't5301-sliding-window.sh',
+ 't5302-pack-index.sh',
+ 't5303-pack-corruption-resilience.sh',
+ 't5304-prune.sh',
+ 't5305-include-tag.sh',
+ 't5306-pack-nobase.sh',
+ 't5307-pack-missing-commit.sh',
+ 't5308-pack-detect-duplicates.sh',
+ 't5309-pack-delta-cycles.sh',
+ 't5310-pack-bitmaps.sh',
+ 't5311-pack-bitmaps-shallow.sh',
+ 't5312-prune-corruption.sh',
+ 't5313-pack-bounds-checks.sh',
+ 't5314-pack-cycle-detection.sh',
+ 't5315-pack-objects-compression.sh',
+ 't5316-pack-delta-depth.sh',
+ 't5317-pack-objects-filter-objects.sh',
+ 't5318-commit-graph.sh',
+ 't5319-multi-pack-index.sh',
+ 't5320-delta-islands.sh',
+ 't5321-pack-large-objects.sh',
+ 't5322-pack-objects-sparse.sh',
+ 't5323-pack-redundant.sh',
+ 't5324-split-commit-graph.sh',
+ 't5325-reverse-index.sh',
+ 't5326-multi-pack-bitmaps.sh',
+ 't5327-multi-pack-bitmaps-rev.sh',
+ 't5328-commit-graph-64bit-time.sh',
+ 't5329-pack-objects-cruft.sh',
+ 't5330-no-lazy-fetch-with-commit-graph.sh',
+ 't5331-pack-objects-stdin.sh',
+ 't5332-multi-pack-reuse.sh',
+ 't5333-pseudo-merge-bitmaps.sh',
+ 't5334-incremental-multi-pack-index.sh',
+ 't5351-unpack-large-objects.sh',
+ 't5400-send-pack.sh',
+ 't5401-update-hooks.sh',
+ 't5402-post-merge-hook.sh',
+ 't5403-post-checkout-hook.sh',
+ 't5404-tracking-branches.sh',
+ 't5405-send-pack-rewind.sh',
+ 't5406-remote-rejects.sh',
+ 't5407-post-rewrite-hook.sh',
+ 't5408-send-pack-stdin.sh',
+ 't5409-colorize-remote-messages.sh',
+ 't5410-receive-pack-alternates.sh',
+ 't5411-proc-receive-hook.sh',
+ 't5500-fetch-pack.sh',
+ 't5501-fetch-push-alternates.sh',
+ 't5502-quickfetch.sh',
+ 't5503-tagfollow.sh',
+ 't5504-fetch-receive-strict.sh',
+ 't5505-remote.sh',
+ 't5506-remote-groups.sh',
+ 't5507-remote-environment.sh',
+ 't5509-fetch-push-namespaces.sh',
+ 't5510-fetch.sh',
+ 't5511-refspec.sh',
+ 't5512-ls-remote.sh',
+ 't5513-fetch-track.sh',
+ 't5514-fetch-multiple.sh',
+ 't5515-fetch-merge-logic.sh',
+ 't5516-fetch-push.sh',
+ 't5517-push-mirror.sh',
+ 't5518-fetch-exit-status.sh',
+ 't5519-push-alternates.sh',
+ 't5520-pull.sh',
+ 't5521-pull-options.sh',
+ 't5522-pull-symlink.sh',
+ 't5523-push-upstream.sh',
+ 't5524-pull-msg.sh',
+ 't5525-fetch-tagopt.sh',
+ 't5526-fetch-submodules.sh',
+ 't5527-fetch-odd-refs.sh',
+ 't5528-push-default.sh',
+ 't5529-push-errors.sh',
+ 't5530-upload-pack-error.sh',
+ 't5531-deep-submodule-push.sh',
+ 't5532-fetch-proxy.sh',
+ 't5533-push-cas.sh',
+ 't5534-push-signed.sh',
+ 't5535-fetch-push-symref.sh',
+ 't5536-fetch-conflicts.sh',
+ 't5537-fetch-shallow.sh',
+ 't5538-push-shallow.sh',
+ 't5539-fetch-http-shallow.sh',
+ 't5540-http-push-webdav.sh',
+ 't5541-http-push-smart.sh',
+ 't5542-push-http-shallow.sh',
+ 't5543-atomic-push.sh',
+ 't5544-pack-objects-hook.sh',
+ 't5545-push-options.sh',
+ 't5546-receive-limits.sh',
+ 't5547-push-quarantine.sh',
+ 't5548-push-porcelain.sh',
+ 't5549-fetch-push-http.sh',
+ 't5550-http-fetch-dumb.sh',
+ 't5551-http-fetch-smart.sh',
+ 't5552-skipping-fetch-negotiator.sh',
+ 't5553-set-upstream.sh',
+ 't5554-noop-fetch-negotiator.sh',
+ 't5555-http-smart-common.sh',
+ 't5557-http-get.sh',
+ 't5558-clone-bundle-uri.sh',
+ 't5559-http-fetch-smart-http2.sh',
+ 't5560-http-backend-noserver.sh',
+ 't5561-http-backend.sh',
+ 't5562-http-backend-content-length.sh',
+ 't5563-simple-http-auth.sh',
+ 't5564-http-proxy.sh',
+ 't5570-git-daemon.sh',
+ 't5571-pre-push-hook.sh',
+ 't5572-pull-submodule.sh',
+ 't5573-pull-verify-signatures.sh',
+ 't5574-fetch-output.sh',
+ 't5580-unc-paths.sh',
+ 't5581-http-curl-verbose.sh',
+ 't5582-fetch-negative-refspec.sh',
+ 't5583-push-branches.sh',
+ 't5600-clone-fail-cleanup.sh',
+ 't5601-clone.sh',
+ 't5602-clone-remote-exec.sh',
+ 't5603-clone-dirname.sh',
+ 't5604-clone-reference.sh',
+ 't5605-clone-local.sh',
+ 't5606-clone-options.sh',
+ 't5607-clone-bundle.sh',
+ 't5608-clone-2gb.sh',
+ 't5609-clone-branch.sh',
+ 't5610-clone-detached.sh',
+ 't5611-clone-config.sh',
+ 't5612-clone-refspec.sh',
+ 't5613-info-alternate.sh',
+ 't5614-clone-submodules-shallow.sh',
+ 't5615-alternate-env.sh',
+ 't5616-partial-clone.sh',
+ 't5617-clone-submodules-remote.sh',
+ 't5618-alternate-refs.sh',
+ 't5619-clone-local-ambiguous-transport.sh',
+ 't5700-protocol-v1.sh',
+ 't5701-git-serve.sh',
+ 't5702-protocol-v2.sh',
+ 't5703-upload-pack-ref-in-want.sh',
+ 't5704-protocol-violations.sh',
+ 't5705-session-id-in-capabilities.sh',
+ 't5730-protocol-v2-bundle-uri-file.sh',
+ 't5731-protocol-v2-bundle-uri-git.sh',
+ 't5732-protocol-v2-bundle-uri-http.sh',
+ 't5750-bundle-uri-parse.sh',
+ 't5801-remote-helpers.sh',
+ 't5802-connect-helper.sh',
+ 't5810-proto-disable-local.sh',
+ 't5811-proto-disable-git.sh',
+ 't5812-proto-disable-http.sh',
+ 't5813-proto-disable-ssh.sh',
+ 't5814-proto-disable-ext.sh',
+ 't5815-submodule-protos.sh',
+ 't5900-repo-selection.sh',
+ 't6000-rev-list-misc.sh',
+ 't6001-rev-list-graft.sh',
+ 't6002-rev-list-bisect.sh',
+ 't6003-rev-list-topo-order.sh',
+ 't6004-rev-list-path-optim.sh',
+ 't6005-rev-list-count.sh',
+ 't6006-rev-list-format.sh',
+ 't6007-rev-list-cherry-pick-file.sh',
+ 't6008-rev-list-submodule.sh',
+ 't6009-rev-list-parent.sh',
+ 't6010-merge-base.sh',
+ 't6011-rev-list-with-bad-commit.sh',
+ 't6012-rev-list-simplify.sh',
+ 't6013-rev-list-reverse-parents.sh',
+ 't6014-rev-list-all.sh',
+ 't6016-rev-list-graph-simplify-history.sh',
+ 't6017-rev-list-stdin.sh',
+ 't6018-rev-list-glob.sh',
+ 't6019-rev-list-ancestry-path.sh',
+ 't6020-bundle-misc.sh',
+ 't6021-rev-list-exclude-hidden.sh',
+ 't6022-rev-list-missing.sh',
+ 't6030-bisect-porcelain.sh',
+ 't6040-tracking-info.sh',
+ 't6041-bisect-submodule.sh',
+ 't6050-replace.sh',
+ 't6060-merge-index.sh',
+ 't6100-rev-list-in-order.sh',
+ 't6101-rev-parse-parents.sh',
+ 't6102-rev-list-unexpected-objects.sh',
+ 't6110-rev-list-sparse.sh',
+ 't6111-rev-list-treesame.sh',
+ 't6112-rev-list-filters-objects.sh',
+ 't6113-rev-list-bitmap-filters.sh',
+ 't6114-keep-packs.sh',
+ 't6115-rev-list-du.sh',
+ 't6120-describe.sh',
+ 't6130-pathspec-noglob.sh',
+ 't6131-pathspec-icase.sh',
+ 't6132-pathspec-exclude.sh',
+ 't6133-pathspec-rev-dwim.sh',
+ 't6134-pathspec-in-submodule.sh',
+ 't6135-pathspec-with-attrs.sh',
+ 't6136-pathspec-in-bare.sh',
+ 't6200-fmt-merge-msg.sh',
+ 't6300-for-each-ref.sh',
+ 't6301-for-each-ref-errors.sh',
+ 't6302-for-each-ref-filter.sh',
+ 't6400-merge-df.sh',
+ 't6401-merge-criss-cross.sh',
+ 't6402-merge-rename.sh',
+ 't6403-merge-file.sh',
+ 't6404-recursive-merge.sh',
+ 't6405-merge-symlinks.sh',
+ 't6406-merge-attr.sh',
+ 't6407-merge-binary.sh',
+ 't6408-merge-up-to-date.sh',
+ 't6409-merge-subtree.sh',
+ 't6411-merge-filemode.sh',
+ 't6412-merge-large-rename.sh',
+ 't6413-merge-crlf.sh',
+ 't6414-merge-rename-nocruft.sh',
+ 't6415-merge-dir-to-symlink.sh',
+ 't6416-recursive-corner-cases.sh',
+ 't6417-merge-ours-theirs.sh',
+ 't6418-merge-text-auto.sh',
+ 't6419-merge-ignorecase.sh',
+ 't6421-merge-partial-clone.sh',
+ 't6422-merge-rename-corner-cases.sh',
+ 't6423-merge-rename-directories.sh',
+ 't6424-merge-unrelated-index-changes.sh',
+ 't6425-merge-rename-delete.sh',
+ 't6426-merge-skip-unneeded-updates.sh',
+ 't6427-diff3-conflict-markers.sh',
+ 't6428-merge-conflicts-sparse.sh',
+ 't6429-merge-sequence-rename-caching.sh',
+ 't6430-merge-recursive.sh',
+ 't6431-merge-criscross.sh',
+ 't6432-merge-recursive-space-options.sh',
+ 't6433-merge-toplevel.sh',
+ 't6434-merge-recursive-rename-options.sh',
+ 't6435-merge-sparse.sh',
+ 't6436-merge-overwrite.sh',
+ 't6437-submodule-merge.sh',
+ 't6438-submodule-directory-file-conflicts.sh',
+ 't6439-merge-co-error-msgs.sh',
+ 't6500-gc.sh',
+ 't6501-freshen-objects.sh',
+ 't6600-test-reach.sh',
+ 't6700-tree-depth.sh',
+ 't7001-mv.sh',
+ 't7002-mv-sparse-checkout.sh',
+ 't7003-filter-branch.sh',
+ 't7004-tag.sh',
+ 't7005-editor.sh',
+ 't7006-pager.sh',
+ 't7007-show.sh',
+ 't7008-filter-branch-null-sha1.sh',
+ 't7010-setup.sh',
+ 't7011-skip-worktree-reading.sh',
+ 't7012-skip-worktree-writing.sh',
+ 't7030-verify-tag.sh',
+ 't7031-verify-tag-signed-ssh.sh',
+ 't7060-wtstatus.sh',
+ 't7061-wtstatus-ignore.sh',
+ 't7062-wtstatus-ignorecase.sh',
+ 't7063-status-untracked-cache.sh',
+ 't7064-wtstatus-pv2.sh',
+ 't7101-reset-empty-subdirs.sh',
+ 't7102-reset.sh',
+ 't7103-reset-bare.sh',
+ 't7104-reset-hard.sh',
+ 't7105-reset-patch.sh',
+ 't7106-reset-unborn-branch.sh',
+ 't7107-reset-pathspec-file.sh',
+ 't7110-reset-merge.sh',
+ 't7111-reset-table.sh',
+ 't7112-reset-submodule.sh',
+ 't7113-post-index-change-hook.sh',
+ 't7201-co.sh',
+ 't7300-clean.sh',
+ 't7301-clean-interactive.sh',
+ 't7400-submodule-basic.sh',
+ 't7401-submodule-summary.sh',
+ 't7402-submodule-rebase.sh',
+ 't7403-submodule-sync.sh',
+ 't7406-submodule-update.sh',
+ 't7407-submodule-foreach.sh',
+ 't7408-submodule-reference.sh',
+ 't7409-submodule-detached-work-tree.sh',
+ 't7411-submodule-config.sh',
+ 't7412-submodule-absorbgitdirs.sh',
+ 't7413-submodule-is-active.sh',
+ 't7414-submodule-mistakes.sh',
+ 't7416-submodule-dash-url.sh',
+ 't7417-submodule-path-url.sh',
+ 't7418-submodule-sparse-gitmodules.sh',
+ 't7419-submodule-set-branch.sh',
+ 't7420-submodule-set-url.sh',
+ 't7421-submodule-summary-add.sh',
+ 't7422-submodule-output.sh',
+ 't7423-submodule-symlinks.sh',
+ 't7424-submodule-mixed-ref-formats.sh',
+ 't7450-bad-git-dotfiles.sh',
+ 't7500-commit-template-squash-signoff.sh',
+ 't7501-commit-basic-functionality.sh',
+ 't7502-commit-porcelain.sh',
+ 't7503-pre-commit-and-pre-merge-commit-hooks.sh',
+ 't7504-commit-msg-hook.sh',
+ 't7505-prepare-commit-msg-hook.sh',
+ 't7506-status-submodule.sh',
+ 't7507-commit-verbose.sh',
+ 't7508-status.sh',
+ 't7509-commit-authorship.sh',
+ 't7510-signed-commit.sh',
+ 't7511-status-index.sh',
+ 't7512-status-help.sh',
+ 't7513-interpret-trailers.sh',
+ 't7514-commit-patch.sh',
+ 't7515-status-symlinks.sh',
+ 't7516-commit-races.sh',
+ 't7517-per-repo-email.sh',
+ 't7518-ident-corner-cases.sh',
+ 't7519-status-fsmonitor.sh',
+ 't7520-ignored-hook-warning.sh',
+ 't7521-ignored-mode.sh',
+ 't7524-commit-summary.sh',
+ 't7525-status-rename.sh',
+ 't7526-commit-pathspec-file.sh',
+ 't7527-builtin-fsmonitor.sh',
+ 't7528-signed-commit-ssh.sh',
+ 't7600-merge.sh',
+ 't7601-merge-pull-config.sh',
+ 't7602-merge-octopus-many.sh',
+ 't7603-merge-reduce-heads.sh',
+ 't7604-merge-custom-message.sh',
+ 't7605-merge-resolve.sh',
+ 't7606-merge-custom.sh',
+ 't7607-merge-state.sh',
+ 't7608-merge-messages.sh',
+ 't7609-mergetool--lib.sh',
+ 't7610-mergetool.sh',
+ 't7611-merge-abort.sh',
+ 't7612-merge-verify-signatures.sh',
+ 't7614-merge-signoff.sh',
+ 't7615-diff-algo-with-mergy-operations.sh',
+ 't7700-repack.sh',
+ 't7701-repack-unpack-unreachable.sh',
+ 't7702-repack-cyclic-alternate.sh',
+ 't7703-repack-geometric.sh',
+ 't7704-repack-cruft.sh',
+ 't7800-difftool.sh',
+ 't7810-grep.sh',
+ 't7811-grep-open.sh',
+ 't7812-grep-icase-non-ascii.sh',
+ 't7813-grep-icase-iso.sh',
+ 't7814-grep-recurse-submodules.sh',
+ 't7815-grep-binary.sh',
+ 't7816-grep-binary-pattern.sh',
+ 't7817-grep-sparse-checkout.sh',
+ 't7900-maintenance.sh',
+ 't8001-annotate.sh',
+ 't8002-blame.sh',
+ 't8003-blame-corner-cases.sh',
+ 't8004-blame-with-conflicts.sh',
+ 't8005-blame-i18n.sh',
+ 't8006-blame-textconv.sh',
+ 't8007-cat-file-textconv.sh',
+ 't8008-blame-formats.sh',
+ 't8009-blame-vs-topicbranches.sh',
+ 't8010-cat-file-filters.sh',
+ 't8011-blame-split-file.sh',
+ 't8012-blame-colors.sh',
+ 't8013-blame-ignore-revs.sh',
+ 't8014-blame-ignore-fuzzy.sh',
+ 't9001-send-email.sh',
+ 't9002-column.sh',
+ 't9003-help-autocorrect.sh',
+ 't9100-git-svn-basic.sh',
+ 't9101-git-svn-props.sh',
+ 't9102-git-svn-deep-rmdir.sh',
+ 't9103-git-svn-tracked-directory-removed.sh',
+ 't9104-git-svn-follow-parent.sh',
+ 't9105-git-svn-commit-diff.sh',
+ 't9106-git-svn-commit-diff-clobber.sh',
+ 't9107-git-svn-migrate.sh',
+ 't9108-git-svn-glob.sh',
+ 't9109-git-svn-multi-glob.sh',
+ 't9110-git-svn-use-svm-props.sh',
+ 't9111-git-svn-use-svnsync-props.sh',
+ 't9112-git-svn-md5less-file.sh',
+ 't9113-git-svn-dcommit-new-file.sh',
+ 't9114-git-svn-dcommit-merge.sh',
+ 't9115-git-svn-dcommit-funky-renames.sh',
+ 't9116-git-svn-log.sh',
+ 't9117-git-svn-init-clone.sh',
+ 't9118-git-svn-funky-branch-names.sh',
+ 't9119-git-svn-info.sh',
+ 't9120-git-svn-clone-with-percent-escapes.sh',
+ 't9121-git-svn-fetch-renamed-dir.sh',
+ 't9122-git-svn-author.sh',
+ 't9123-git-svn-rebuild-with-rewriteroot.sh',
+ 't9124-git-svn-dcommit-auto-props.sh',
+ 't9125-git-svn-multi-glob-branch-names.sh',
+ 't9126-git-svn-follow-deleted-readded-directory.sh',
+ 't9127-git-svn-partial-rebuild.sh',
+ 't9128-git-svn-cmd-branch.sh',
+ 't9129-git-svn-i18n-commitencoding.sh',
+ 't9130-git-svn-authors-file.sh',
+ 't9131-git-svn-empty-symlink.sh',
+ 't9132-git-svn-broken-symlink.sh',
+ 't9133-git-svn-nested-git-repo.sh',
+ 't9134-git-svn-ignore-paths.sh',
+ 't9135-git-svn-moved-branch-empty-file.sh',
+ 't9136-git-svn-recreated-branch-empty-file.sh',
+ 't9137-git-svn-dcommit-clobber-series.sh',
+ 't9138-git-svn-authors-prog.sh',
+ 't9139-git-svn-non-utf8-commitencoding.sh',
+ 't9140-git-svn-reset.sh',
+ 't9141-git-svn-multiple-branches.sh',
+ 't9142-git-svn-shallow-clone.sh',
+ 't9143-git-svn-gc.sh',
+ 't9144-git-svn-old-rev_map.sh',
+ 't9145-git-svn-master-branch.sh',
+ 't9146-git-svn-empty-dirs.sh',
+ 't9147-git-svn-include-paths.sh',
+ 't9148-git-svn-propset.sh',
+ 't9150-svk-mergetickets.sh',
+ 't9151-svn-mergeinfo.sh',
+ 't9152-svn-empty-dirs-after-gc.sh',
+ 't9153-git-svn-rewrite-uuid.sh',
+ 't9154-git-svn-fancy-glob.sh',
+ 't9155-git-svn-fetch-deleted-tag.sh',
+ 't9156-git-svn-fetch-deleted-tag-2.sh',
+ 't9157-git-svn-fetch-merge.sh',
+ 't9158-git-svn-mergeinfo.sh',
+ 't9159-git-svn-no-parent-mergeinfo.sh',
+ 't9160-git-svn-preserve-empty-dirs.sh',
+ 't9161-git-svn-mergeinfo-push.sh',
+ 't9162-git-svn-dcommit-interactive.sh',
+ 't9163-git-svn-reset-clears-caches.sh',
+ 't9164-git-svn-dcommit-concurrent.sh',
+ 't9165-git-svn-fetch-merge-branch-of-branch.sh',
+ 't9166-git-svn-fetch-merge-branch-of-branch2.sh',
+ 't9167-git-svn-cmd-branch-subproject.sh',
+ 't9168-git-svn-partially-globbed-names.sh',
+ 't9169-git-svn-dcommit-crlf.sh',
+ 't9200-git-cvsexportcommit.sh',
+ 't9210-scalar.sh',
+ 't9211-scalar-clone.sh',
+ 't9300-fast-import.sh',
+ 't9301-fast-import-notes.sh',
+ 't9302-fast-import-unpack-limit.sh',
+ 't9303-fast-import-compression.sh',
+ 't9304-fast-import-marks.sh',
+ 't9350-fast-export.sh',
+ 't9351-fast-export-anonymize.sh',
+ 't9400-git-cvsserver-server.sh',
+ 't9401-git-cvsserver-crlf.sh',
+ 't9402-git-cvsserver-refs.sh',
+ 't9500-gitweb-standalone-no-errors.sh',
+ 't9501-gitweb-standalone-http-status.sh',
+ 't9502-gitweb-standalone-parse-output.sh',
+ 't9600-cvsimport.sh',
+ 't9601-cvsimport-vendor-branch.sh',
+ 't9602-cvsimport-branches-tags.sh',
+ 't9603-cvsimport-patchsets.sh',
+ 't9604-cvsimport-timestamps.sh',
+ 't9700-perl-git.sh',
+ 't9800-git-p4-basic.sh',
+ 't9801-git-p4-branch.sh',
+ 't9802-git-p4-filetype.sh',
+ 't9803-git-p4-shell-metachars.sh',
+ 't9804-git-p4-label.sh',
+ 't9805-git-p4-skip-submit-edit.sh',
+ 't9806-git-p4-options.sh',
+ 't9807-git-p4-submit.sh',
+ 't9808-git-p4-chdir.sh',
+ 't9809-git-p4-client-view.sh',
+ 't9810-git-p4-rcs.sh',
+ 't9811-git-p4-label-import.sh',
+ 't9812-git-p4-wildcards.sh',
+ 't9813-git-p4-preserve-users.sh',
+ 't9814-git-p4-rename.sh',
+ 't9815-git-p4-submit-fail.sh',
+ 't9816-git-p4-locked.sh',
+ 't9817-git-p4-exclude.sh',
+ 't9818-git-p4-block.sh',
+ 't9819-git-p4-case-folding.sh',
+ 't9820-git-p4-editor-handling.sh',
+ 't9821-git-p4-path-variations.sh',
+ 't9822-git-p4-path-encoding.sh',
+ 't9823-git-p4-mock-lfs.sh',
+ 't9824-git-p4-git-lfs.sh',
+ 't9825-git-p4-handle-utf16-without-bom.sh',
+ 't9826-git-p4-keep-empty-commits.sh',
+ 't9827-git-p4-change-filetype.sh',
+ 't9828-git-p4-map-user.sh',
+ 't9829-git-p4-jobs.sh',
+ 't9830-git-p4-symlink-dir.sh',
+ 't9831-git-p4-triggers.sh',
+ 't9832-unshelve.sh',
+ 't9833-errors.sh',
+ 't9834-git-p4-file-dir-bug.sh',
+ 't9835-git-p4-metadata-encoding-python2.sh',
+ 't9836-git-p4-metadata-encoding-python3.sh',
+ 't9850-shell.sh',
+ 't9901-git-web--browse.sh',
+ 't9902-completion.sh',
+ 't9903-bash-prompt.sh',
+]
+
+# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it get added
+# to the PATH variable. And given that drive prefixes contain a colon we'd
+# otherwise end up with a broken PATH if we didn't convert it.
+git_build_dir = meson.project_build_root()
+if cygpath.found()
+ git_build_dir = run_command(cygpath, git_build_dir, check: true).stdout().strip()
+endif
+
+test_environment = script_environment
+test_environment.set('GIT_BUILD_DIR', git_build_dir)
+
+foreach integration_test : integration_tests
+ test(fs.stem(integration_test), shell,
+ args: [ integration_test ],
+ workdir: meson.current_source_dir(),
+ env: test_environment,
+ depends: test_dependencies + bin_wrappers,
+ timeout: 0,
+ )
+endforeach
diff --git a/t/perf/p5311-pack-bitmaps-fetch.sh b/t/perf/p5311-pack-bitmaps-fetch.sh
index 426fab87e3..047efb995d 100755
--- a/t/perf/p5311-pack-bitmaps-fetch.sh
+++ b/t/perf/p5311-pack-bitmaps-fetch.sh
@@ -39,7 +39,7 @@ test_fetch_bitmaps () {
'
test_size "size $title" '
- wc -c <tmp.pack
+ test_file_size tmp.pack
'
test_perf "client $title (lookup=$1)" '
diff --git a/t/perf/p5332-multi-pack-reuse.sh b/t/perf/p5332-multi-pack-reuse.sh
index 5c6c575d62..d1c89a8b7d 100755
--- a/t/perf/p5332-multi-pack-reuse.sh
+++ b/t/perf/p5332-multi-pack-reuse.sh
@@ -73,7 +73,7 @@ do
"
test_size "clone size for $nr_packs-pack scenario ($reuse-pack reuse)" '
- wc -c <result
+ test_file_size result
'
done
done
diff --git a/t/perf/p6100-describe.sh b/t/perf/p6100-describe.sh
new file mode 100755
index 0000000000..069f91ce49
--- /dev/null
+++ b/t/perf/p6100-describe.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+test_description='performance of git-describe'
+. ./perf-lib.sh
+
+test_perf_default_repo
+
+# clear out old tags and give us a known state
+test_expect_success 'set up tags' '
+ git for-each-ref --format="delete %(refname)" refs/tags >to-delete &&
+ git update-ref --stdin <to-delete &&
+ new=$(git rev-list -1000 HEAD | tail -n 1) &&
+ git tag -m new new $new &&
+ old=$(git rev-list HEAD | tail -n 1) &&
+ git tag -m old old $old
+'
+
+test_perf 'describe HEAD' '
+ git describe HEAD
+'
+
+test_perf 'describe HEAD with one max candidate' '
+ git describe --candidates=1 HEAD
+'
+
+test_perf 'describe HEAD with one tag' '
+ git describe --match=new HEAD
+'
+
+test_done
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 0178aa62a4..72a0c2e7d4 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -2,7 +2,6 @@
test_description='git init'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
check_config () {
@@ -434,6 +433,12 @@ test_expect_success SYMLINKS 're-init to move gitdir symlink' '
sep_git_dir_worktree () {
test_when_finished "rm -rf mainwt linkwt seprepo" &&
git init mainwt &&
+ if test "relative" = $2
+ then
+ test_config -C mainwt worktree.useRelativePaths true
+ else
+ test_config -C mainwt worktree.useRelativePaths false
+ fi
test_commit -C mainwt gumby &&
git -C mainwt worktree add --detach ../linkwt &&
git -C "$1" init --separate-git-dir ../seprepo &&
@@ -442,12 +447,20 @@ sep_git_dir_worktree () {
test_cmp expect actual
}
-test_expect_success 're-init to move gitdir with linked worktrees' '
- sep_git_dir_worktree mainwt
+test_expect_success 're-init to move gitdir with linked worktrees (absolute)' '
+ sep_git_dir_worktree mainwt absolute
+'
+
+test_expect_success 're-init to move gitdir within linked worktree (absolute)' '
+ sep_git_dir_worktree linkwt absolute
+'
+
+test_expect_success 're-init to move gitdir with linked worktrees (relative)' '
+ sep_git_dir_worktree mainwt relative
'
-test_expect_success 're-init to move gitdir within linked worktree' '
- sep_git_dir_worktree linkwt
+test_expect_success 're-init to move gitdir within linked worktree (relative)' '
+ sep_git_dir_worktree linkwt relative
'
test_expect_success MINGW '.git hidden' '
diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh
index bf3bf604ab..dfbcdddbcc 100755
--- a/t/t0002-gitfile.sh
+++ b/t/t0002-gitfile.sh
@@ -7,7 +7,6 @@ Verify that plumbing commands work when .git is a file
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
objpath() {
diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
index 66ccb5889d..3c98b622f2 100755
--- a/t/t0003-attributes.sh
+++ b/t/t0003-attributes.sh
@@ -2,7 +2,6 @@
test_description=gitattributes
-TEST_PASSES_SANITIZE_LEAK=true
TEST_CREATE_REPO_NO_TEMPLATE=1
. ./test-lib.sh
diff --git a/t/t0004-unwritable.sh b/t/t0004-unwritable.sh
index 8114fac73b..3bdafbae0f 100755
--- a/t/t0004-unwritable.sh
+++ b/t/t0004-unwritable.sh
@@ -2,7 +2,6 @@
test_description='detect unwritable repository and fail correctly'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t0005-signals.sh b/t/t0005-signals.sh
index eba75a2490..afba0fc3fc 100755
--- a/t/t0005-signals.sh
+++ b/t/t0005-signals.sh
@@ -2,7 +2,6 @@
test_description='signals work as we expect'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cat >expect <<EOF
diff --git a/t/t0006-date.sh b/t/t0006-date.sh
index fd373e1b39..53ced36df4 100755
--- a/t/t0006-date.sh
+++ b/t/t0006-date.sh
@@ -2,7 +2,6 @@
test_description='test date parsing and printing'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# arbitrary reference time: 2009-08-30 19:20:00
diff --git a/t/t0007-git-var.sh b/t/t0007-git-var.sh
index 9fc5882387..2b60317758 100755
--- a/t/t0007-git-var.sh
+++ b/t/t0007-git-var.sh
@@ -2,7 +2,6 @@
test_description='basic sanity checks for git var'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
sane_unset_all_editors () {
diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
index 02a18d4fdb..c9376dffb5 100755
--- a/t/t0008-ignores.sh
+++ b/t/t0008-ignores.sh
@@ -2,7 +2,6 @@
test_description=check-ignore
-TEST_PASSES_SANITIZE_LEAK=true
TEST_CREATE_REPO_NO_TEMPLATE=1
. ./test-lib.sh
diff --git a/t/t0010-racy-git.sh b/t/t0010-racy-git.sh
index 84172a3739..45229f57b8 100755
--- a/t/t0010-racy-git.sh
+++ b/t/t0010-racy-git.sh
@@ -2,7 +2,6 @@
test_description='racy GIT'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# This test can give false success if your machine is sufficiently
diff --git a/t/t0012-help.sh b/t/t0012-help.sh
index 9eae0d8356..1d273d91c2 100755
--- a/t/t0012-help.sh
+++ b/t/t0012-help.sh
@@ -2,7 +2,6 @@
test_description='help'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
configure_help () {
diff --git a/t/t0013-sha1dc.sh b/t/t0013-sha1dc.sh
index 08814173cb..ce3d81227a 100755
--- a/t/t0013-sha1dc.sh
+++ b/t/t0013-sha1dc.sh
@@ -2,7 +2,6 @@
test_description='test sha1 collision detection'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
TEST_DATA="$TEST_DIRECTORY/t0013"
diff --git a/t/t0017-env-helper.sh b/t/t0017-env-helper.sh
index f3a16859cc..32fe848179 100755
--- a/t/t0017-env-helper.sh
+++ b/t/t0017-env-helper.sh
@@ -2,7 +2,6 @@
test_description='test test-tool env-helper'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t0018-advice.sh b/t/t0018-advice.sh
index fac52322a7..f68e08d0b1 100755
--- a/t/t0018-advice.sh
+++ b/t/t0018-advice.sh
@@ -5,13 +5,12 @@ test_description='Test advise_if_enabled functionality'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=trunk
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'advice should be printed when config variable is unset' '
cat >expect <<-\EOF &&
hint: This is a piece of advice
- hint: Disable this message with "git config advice.nestedTag false"
+ hint: Disable this message with "git config set advice.nestedTag false"
EOF
test-tool advise "This is a piece of advice" 2>actual &&
test_cmp expect actual
diff --git a/t/t0019-json-writer.sh b/t/t0019-json-writer.sh
index 19a730c29e..3a4e1cc7e3 100755
--- a/t/t0019-json-writer.sh
+++ b/t/t0019-json-writer.sh
@@ -2,7 +2,6 @@
test_description='test json-writer JSON generation'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'unit test of json-writer routines' '
diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh
index 81946e87cc..fd1cae09ed 100755
--- a/t/t0020-crlf.sh
+++ b/t/t0020-crlf.sh
@@ -5,7 +5,6 @@ test_description='CRLF conversion'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
has_cr() {
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 9e6c6ee0d4..3f6433d304 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -5,7 +5,6 @@ test_description='blob conversion via gitattributes'
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-terminal.sh
diff --git a/t/t0022-crlf-rename.sh b/t/t0022-crlf-rename.sh
index 9fe9891251..9bd863a970 100755
--- a/t/t0022-crlf-rename.sh
+++ b/t/t0022-crlf-rename.sh
@@ -2,7 +2,6 @@
test_description='ignore CR in CRLF sequence while computing similiarity'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t0023-crlf-am.sh b/t/t0023-crlf-am.sh
index 575805513a..f9bbb91f64 100755
--- a/t/t0023-crlf-am.sh
+++ b/t/t0023-crlf-am.sh
@@ -2,7 +2,6 @@
test_description='Test am with auto.crlf'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cat >patchfile <<\EOF
diff --git a/t/t0024-crlf-archive.sh b/t/t0024-crlf-archive.sh
index a7f4de4a43..44958cb2c2 100755
--- a/t/t0024-crlf-archive.sh
+++ b/t/t0024-crlf-archive.sh
@@ -2,7 +2,6 @@
test_description='respect crlf in git archive'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t0025-crlf-renormalize.sh b/t/t0025-crlf-renormalize.sh
index f7202c192e..2e28feb69c 100755
--- a/t/t0025-crlf-renormalize.sh
+++ b/t/t0025-crlf-renormalize.sh
@@ -2,7 +2,6 @@
test_description='CRLF renormalization'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t0026-eol-config.sh b/t/t0026-eol-config.sh
index f426a185bb..493b01a0e7 100755
--- a/t/t0026-eol-config.sh
+++ b/t/t0026-eol-config.sh
@@ -2,7 +2,6 @@
test_description='CRLF conversion'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
has_cr() {
diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh
index 2f57c8669c..49dbf09da7 100755
--- a/t/t0027-auto-crlf.sh
+++ b/t/t0027-auto-crlf.sh
@@ -2,7 +2,6 @@
test_description='CRLF conversion all combinations'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
compare_files () {
diff --git a/t/t0028-working-tree-encoding.sh b/t/t0028-working-tree-encoding.sh
index 510da4ca12..50b3b4649b 100755
--- a/t/t0028-working-tree-encoding.sh
+++ b/t/t0028-working-tree-encoding.sh
@@ -5,7 +5,6 @@ test_description='working-tree-encoding conversion via gitattributes'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
TEST_CREATE_REPO_NO_TEMPLATE=1
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-encoding.sh"
diff --git a/t/t0029-core-unsetenvvars.sh b/t/t0029-core-unsetenvvars.sh
index 4e8e90dd98..baa1b7e85b 100755
--- a/t/t0029-core-unsetenvvars.sh
+++ b/t/t0029-core-unsetenvvars.sh
@@ -2,7 +2,6 @@
test_description='test the Windows-only core.unsetenvvars setting'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
if ! test_have_prereq MINGW
diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh
index f10f42ff1e..43155f6bd8 100755
--- a/t/t0030-stripspace.sh
+++ b/t/t0030-stripspace.sh
@@ -5,7 +5,6 @@
test_description='git stripspace'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
t40='A quick brown fox jumps over the lazy do'
diff --git a/t/t0033-safe-directory.sh b/t/t0033-safe-directory.sh
index e97a84764f..e103fe7109 100755
--- a/t/t0033-safe-directory.sh
+++ b/t/t0033-safe-directory.sh
@@ -2,7 +2,6 @@
test_description='verify safe.directory checks'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
GIT_TEST_ASSUME_DIFFERENT_OWNER=1
diff --git a/t/t0035-safe-bare-repository.sh b/t/t0035-safe-bare-repository.sh
index d3cb2a1cb9..ae7ef092ab 100755
--- a/t/t0035-safe-bare-repository.sh
+++ b/t/t0035-safe-bare-repository.sh
@@ -2,7 +2,6 @@
test_description='verify safe.bareRepository checks'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
pwd="$(pwd)"
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index 45a773642f..2fe3522305 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -5,7 +5,6 @@
test_description='our own option parser'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cat >expect <<\EOF
diff --git a/t/t0041-usage.sh b/t/t0041-usage.sh
index 1464294bd1..a0f6f134c7 100755
--- a/t/t0041-usage.sh
+++ b/t/t0041-usage.sh
@@ -5,7 +5,6 @@ test_description='Test commands behavior when given invalid argument value'
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 ' '
diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh
index 325eb1c3cd..5c9dc90d0b 100755
--- a/t/t0050-filesystem.sh
+++ b/t/t0050-filesystem.sh
@@ -5,7 +5,6 @@ test_description='Various filesystem issues'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
auml=$(printf '\303\244')
diff --git a/t/t0052-simple-ipc.sh b/t/t0052-simple-ipc.sh
index 1a36a53574..ff98be31a5 100755
--- a/t/t0052-simple-ipc.sh
+++ b/t/t0052-simple-ipc.sh
@@ -2,7 +2,6 @@
test_description='simple command server'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test-tool simple-ipc SUPPORTS_SIMPLE_IPC || {
diff --git a/t/t0055-beyond-symlinks.sh b/t/t0055-beyond-symlinks.sh
index c3eb1158ef..d0740038b8 100755
--- a/t/t0055-beyond-symlinks.sh
+++ b/t/t0055-beyond-symlinks.sh
@@ -2,7 +2,6 @@
test_description='update-index and add refuse to add beyond symlinks'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success SYMLINKS setup '
diff --git a/t/t0056-git-C.sh b/t/t0056-git-C.sh
index 752aa8c945..2630e756da 100755
--- a/t/t0056-git-C.sh
+++ b/t/t0056-git-C.sh
@@ -2,7 +2,6 @@
test_description='"-C <path>" option and its effects on other path-related options'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success '"git -C <path>" runs git from the directory <path>' '
diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
index 0afa3d0d31..dbb2e73bcd 100755
--- a/t/t0060-path-utils.sh
+++ b/t/t0060-path-utils.sh
@@ -5,7 +5,6 @@
test_description='Test various path utilities'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
norm_path() {
diff --git a/t/t0061-run-command.sh b/t/t0061-run-command.sh
index 20986b693c..76d4936a87 100755
--- a/t/t0061-run-command.sh
+++ b/t/t0061-run-command.sh
@@ -5,7 +5,6 @@
test_description='Test run command'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cat >hello-script <<-EOF
diff --git a/t/t0062-revision-walking.sh b/t/t0062-revision-walking.sh
index b9480c8178..8e215867b8 100755
--- a/t/t0062-revision-walking.sh
+++ b/t/t0062-revision-walking.sh
@@ -5,7 +5,6 @@
test_description='Test revision walking api'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cat >run_twice_expected <<-EOF
diff --git a/t/t0063-string-list.sh b/t/t0063-string-list.sh
index 1fee6d9010..aac63ba506 100755
--- a/t/t0063-string-list.sh
+++ b/t/t0063-string-list.sh
@@ -5,7 +5,6 @@
test_description='Test string list functionality'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_split () {
diff --git a/t/t0066-dir-iterator.sh b/t/t0066-dir-iterator.sh
index 7d0a0da8c0..df3e9f5fa5 100755
--- a/t/t0066-dir-iterator.sh
+++ b/t/t0066-dir-iterator.sh
@@ -2,7 +2,6 @@
test_description='Test the dir-iterator functionality'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t0067-parse_pathspec_file.sh b/t/t0067-parse_pathspec_file.sh
index 0188d0423a..7bab49f361 100755
--- a/t/t0067-parse_pathspec_file.sh
+++ b/t/t0067-parse_pathspec_file.sh
@@ -2,7 +2,6 @@
test_description='Test parse_pathspec_file()'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'one item from stdin' '
diff --git a/t/t0068-for-each-repo.sh b/t/t0068-for-each-repo.sh
index 95019e01ed..f2f3e50031 100755
--- a/t/t0068-for-each-repo.sh
+++ b/t/t0068-for-each-repo.sh
@@ -2,7 +2,6 @@
test_description='git for-each-repo builtin'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'run based on configured value' '
diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh
index 0ecec2ba71..6b9dcf984b 100755
--- a/t/t0070-fundamental.sh
+++ b/t/t0070-fundamental.sh
@@ -6,7 +6,6 @@ test_description='check that the most basic functions work
Verify wrappers and compatibility functions.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'mktemp to nonexistent directory prints filename' '
diff --git a/t/t0071-sort.sh b/t/t0071-sort.sh
index ba8ad1d1ca..2236a7e956 100755
--- a/t/t0071-sort.sh
+++ b/t/t0071-sort.sh
@@ -2,7 +2,6 @@
test_description='verify sort functions'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'DEFINE_LIST_SORT_DEBUG' '
diff --git a/t/t0080-unit-test-output.sh b/t/t0080-unit-test-output.sh
index 3c369c88e2..3db10f095c 100755
--- a/t/t0080-unit-test-output.sh
+++ b/t/t0080-unit-test-output.sh
@@ -2,7 +2,6 @@
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' - <<\EOT
diff --git a/t/t0081-find-pack.sh b/t/t0081-find-pack.sh
index 67b11216a3..5a628bf735 100755
--- a/t/t0081-find-pack.sh
+++ b/t/t0081-find-pack.sh
@@ -2,7 +2,6 @@
test_description='test `test-tool find-pack`'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index d8e2fc42e1..ab80c9ef13 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -6,7 +6,6 @@ Tests whether various commands properly update and/or rewrite the
cache-tree extension.
"
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cmp_cache_tree () {
diff --git a/t/t0091-bugreport.sh b/t/t0091-bugreport.sh
index fca39048fe..e11d819b62 100755
--- a/t/t0091-bugreport.sh
+++ b/t/t0091-bugreport.sh
@@ -2,7 +2,6 @@
test_description='git bugreport'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'create a report' '
diff --git a/t/t0092-diagnose.sh b/t/t0092-diagnose.sh
index 133e5747d6..6cabd6e67b 100755
--- a/t/t0092-diagnose.sh
+++ b/t/t0092-diagnose.sh
@@ -2,7 +2,6 @@
test_description='git diagnose'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success UNZIP 'creates diagnostics zip archive' '
diff --git a/t/t0095-bloom.sh b/t/t0095-bloom.sh
index c8d84ab606..8f0c3b7325 100755
--- a/t/t0095-bloom.sh
+++ b/t/t0095-bloom.sh
@@ -2,7 +2,6 @@
test_description='Testing the various Bloom filter computations in bloom.c'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'compute unseeded murmur3 hash for empty string' '
@@ -77,7 +76,7 @@ test_expect_success 'compute bloom key for test string 2' '
test_cmp expect actual
'
-test_expect_success !SANITIZE_LEAK 'get bloom filters for commit with no changes' '
+test_expect_success 'get bloom filters for commit with no changes' '
git init &&
git commit --allow-empty -m "c0" &&
cat >expect <<-\EOF &&
diff --git a/t/t0100-previous.sh b/t/t0100-previous.sh
index 70a3223f21..dd5d9b4e5e 100755
--- a/t/t0100-previous.sh
+++ b/t/t0100-previous.sh
@@ -5,7 +5,6 @@ test_description='previous branch syntax @{-n}'
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 'branch -d @{-1}' '
diff --git a/t/t0101-at-syntax.sh b/t/t0101-at-syntax.sh
index 878aadd64c..023b4c6f0b 100755
--- a/t/t0101-at-syntax.sh
+++ b/t/t0101-at-syntax.sh
@@ -2,7 +2,6 @@
test_description='various @{whatever} syntax tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t0200-gettext-basic.sh b/t/t0200-gettext-basic.sh
index 522fb2ae69..8853d8afb9 100755
--- a/t/t0200-gettext-basic.sh
+++ b/t/t0200-gettext-basic.sh
@@ -5,7 +5,6 @@
test_description='Gettext support for Git'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh
test_expect_success "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" '
diff --git a/t/t0201-gettext-fallbacks.sh b/t/t0201-gettext-fallbacks.sh
index 8724ce1052..6c74df0dc6 100755
--- a/t/t0201-gettext-fallbacks.sh
+++ b/t/t0201-gettext-fallbacks.sh
@@ -8,7 +8,6 @@ test_description='Gettext Shell fallbacks'
GIT_INTERNAL_GETTEXT_TEST_FALLBACKS=YesPlease
export GIT_INTERNAL_GETTEXT_TEST_FALLBACKS
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh
test_expect_success "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" '
diff --git a/t/t0202-gettext-perl.sh b/t/t0202-gettext-perl.sh
index 5a6f28051b..b15cb65d5d 100755
--- a/t/t0202-gettext-perl.sh
+++ b/t/t0202-gettext-perl.sh
@@ -5,7 +5,6 @@
test_description='Perl gettext interface (Git::I18N)'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh
. "$TEST_DIRECTORY"/lib-perl.sh
skip_all_if_no_Test_More
diff --git a/t/t0202/test.pl b/t/t0202/test.pl
index 47d96a2a13..5085a0eda5 100755
--- a/t/t0202/test.pl
+++ b/t/t0202/test.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-use 5.008001;
+require v5.26;
use lib (split(/:/, $ENV{GITPERLLIB}));
use strict;
use warnings;
diff --git a/t/t0203-gettext-setlocale-sanity.sh b/t/t0203-gettext-setlocale-sanity.sh
index 86cff324ff..0ce1f22eff 100755
--- a/t/t0203-gettext-setlocale-sanity.sh
+++ b/t/t0203-gettext-setlocale-sanity.sh
@@ -5,7 +5,6 @@
test_description="The Git C functions aren't broken by setlocale(3)"
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh
test_expect_success 'git show a ISO-8859-1 commit under C locale' '
diff --git a/t/t0204-gettext-reencode-sanity.sh b/t/t0204-gettext-reencode-sanity.sh
index 310a450012..28d92bb9b7 100755
--- a/t/t0204-gettext-reencode-sanity.sh
+++ b/t/t0204-gettext-reencode-sanity.sh
@@ -5,7 +5,6 @@
test_description="Gettext reencoding of our *.po/*.mo files works"
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh
# The constants used in a tricky observation for undefined behaviour
diff --git a/t/t0210-trace2-normal.sh b/t/t0210-trace2-normal.sh
index b9adc94aab..eff9a59dbd 100755
--- a/t/t0210-trace2-normal.sh
+++ b/t/t0210-trace2-normal.sh
@@ -2,7 +2,6 @@
test_description='test trace2 facility (normal target)'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Turn off any inherited trace2 settings for this test.
diff --git a/t/t0211-trace2-perf.sh b/t/t0211-trace2-perf.sh
index dddc130560..bac9046540 100755
--- a/t/t0211-trace2-perf.sh
+++ b/t/t0211-trace2-perf.sh
@@ -2,7 +2,6 @@
test_description='test trace2 facility (perf target)'
-TEST_PASSES_SANITIZE_LEAK=false
. ./test-lib.sh
# Turn off any inherited trace2 settings for this test.
diff --git a/t/t0212-trace2-event.sh b/t/t0212-trace2-event.sh
index 147643d582..1211db9f46 100755
--- a/t/t0212-trace2-event.sh
+++ b/t/t0212-trace2-event.sh
@@ -2,7 +2,6 @@
test_description='test trace2 facility'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Turn off any inherited trace2 settings for this test.
diff --git a/t/t0300-credentials.sh b/t/t0300-credentials.sh
index 6a76b7fdbd..17952e52d6 100755
--- a/t/t0300-credentials.sh
+++ b/t/t0300-credentials.sh
@@ -2,7 +2,6 @@
test_description='basic credential helper tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-credential.sh
diff --git a/t/t0301-credential-cache.sh b/t/t0301-credential-cache.sh
index 5d5b64205f..dc30289f75 100755
--- a/t/t0301-credential-cache.sh
+++ b/t/t0301-credential-cache.sh
@@ -2,7 +2,6 @@
test_description='credential-cache tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-credential.sh
diff --git a/t/t0302-credential-store.sh b/t/t0302-credential-store.sh
index f83db659e2..c1cd60edd0 100755
--- a/t/t0302-credential-store.sh
+++ b/t/t0302-credential-store.sh
@@ -2,7 +2,6 @@
test_description='credential-store tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-credential.sh
diff --git a/t/t0303-credential-external.sh b/t/t0303-credential-external.sh
index 8aadbe86c4..72ae405c3e 100755
--- a/t/t0303-credential-external.sh
+++ b/t/t0303-credential-external.sh
@@ -29,7 +29,6 @@ you can set GIT_TEST_CREDENTIAL_HELPER_SETUP to a sequence of shell
commands.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-credential.sh
diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
index e2b317db65..2a5bdbeeb8 100755
--- a/t/t0410-partial-clone.sh
+++ b/t/t0410-partial-clone.sh
@@ -2,7 +2,6 @@
test_description='partial clone'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-terminal.sh
diff --git a/t/t0411-clone-from-partial.sh b/t/t0411-clone-from-partial.sh
index 932bf2067d..196fc61784 100755
--- a/t/t0411-clone-from-partial.sh
+++ b/t/t0411-clone-from-partial.sh
@@ -2,7 +2,6 @@
test_description='check that local clone does not fetch from promisor remotes'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'create evil repo' '
@@ -29,7 +28,6 @@ test_expect_success 'local clone must not fetch from promisor remote and execute
test_must_fail git clone \
--upload-pack="GIT_TEST_ASSUME_DIFFERENT_OWNER=true git-upload-pack" \
evil clone1 2>err &&
- test_grep "detected dubious ownership" err &&
test_grep ! "fake-upload-pack running" err &&
test_path_is_missing script-executed
'
@@ -39,7 +37,6 @@ test_expect_success 'clone from file://... must not fetch from promisor remote a
test_must_fail git clone \
--upload-pack="GIT_TEST_ASSUME_DIFFERENT_OWNER=true git-upload-pack" \
"file://$(pwd)/evil" clone2 2>err &&
- test_grep "detected dubious ownership" err &&
test_grep ! "fake-upload-pack running" err &&
test_path_is_missing script-executed
'
@@ -49,7 +46,6 @@ test_expect_success 'fetch from file://... must not fetch from promisor remote a
test_must_fail git fetch \
--upload-pack="GIT_TEST_ASSUME_DIFFERENT_OWNER=true git-upload-pack" \
"file://$(pwd)/evil" 2>err &&
- test_grep "detected dubious ownership" err &&
test_grep ! "fake-upload-pack running" err &&
test_path_is_missing script-executed
'
diff --git a/t/t0450-txt-doc-vs-help.sh b/t/t0450-txt-doc-vs-help.sh
index f99a69ae1b..853101b86e 100755
--- a/t/t0450-txt-doc-vs-help.sh
+++ b/t/t0450-txt-doc-vs-help.sh
@@ -5,7 +5,6 @@ test_description='assert (unbuilt) Documentation/*.txt and -h output
Run this with --debug to see a summary of where we still fail to make
the two versions consistent with one another.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup: list of builtins' '
diff --git a/t/t0500-progress-display.sh b/t/t0500-progress-display.sh
index 1eb3a8306b..d1a498a216 100755
--- a/t/t0500-progress-display.sh
+++ b/t/t0500-progress-display.sh
@@ -2,7 +2,6 @@
test_description='progress display'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
show_cr () {
diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh
index bef2b70871..1e62c791d9 100755
--- a/t/t0600-reffiles-backend.sh
+++ b/t/t0600-reffiles-backend.sh
@@ -7,7 +7,6 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
GIT_TEST_DEFAULT_REF_FORMAT=files
export GIT_TEST_DEFAULT_REF_FORMAT
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t0601-reffiles-pack-refs.sh b/t/t0601-reffiles-pack-refs.sh
index d8cbd3f202..aa7f6ecd81 100755
--- a/t/t0601-reffiles-pack-refs.sh
+++ b/t/t0601-reffiles-pack-refs.sh
@@ -15,7 +15,6 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
GIT_TEST_DEFAULT_REF_FORMAT=files
export GIT_TEST_DEFAULT_REF_FORMAT
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'enable reflogs' '
diff --git a/t/t0602-reffiles-fsck.sh b/t/t0602-reffiles-fsck.sh
index 71a4d1a5ae..d4a08b823b 100755
--- a/t/t0602-reffiles-fsck.sh
+++ b/t/t0602-reffiles-fsck.sh
@@ -6,7 +6,6 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
GIT_TEST_DEFAULT_REF_FORMAT=files
export GIT_TEST_DEFAULT_REF_FORMAT
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
@@ -18,75 +17,583 @@ test_expect_success 'ref name should be checked' '
cd repo &&
git commit --allow-empty -m initial &&
+ git checkout -b default-branch &&
+ git tag default-tag &&
+ git tag multi_hierarchy/default-tag &&
+
+ cp $branch_dir_prefix/default-branch $branch_dir_prefix/@ &&
+ git refs verify 2>err &&
+ test_must_be_empty err &&
+ rm $branch_dir_prefix/@ &&
+
+ cp $tag_dir_prefix/default-tag $tag_dir_prefix/tag-1.lock &&
+ git refs verify 2>err &&
+ rm $tag_dir_prefix/tag-1.lock &&
+ test_must_be_empty err &&
+
+ cp $tag_dir_prefix/default-tag $tag_dir_prefix/.lock &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ error: refs/tags/.lock: badRefName: invalid refname format
+ EOF
+ rm $tag_dir_prefix/.lock &&
+ test_cmp expect err &&
+
+ for refname in ".refname-starts-with-dot" "~refname-has-stride"
+ do
+ cp $branch_dir_prefix/default-branch "$branch_dir_prefix/$refname" &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ error: refs/heads/$refname: badRefName: invalid refname format
+ EOF
+ rm "$branch_dir_prefix/$refname" &&
+ test_cmp expect err || return 1
+ done &&
+
+ for refname in ".refname-starts-with-dot" "~refname-has-stride"
+ do
+ cp $tag_dir_prefix/default-tag "$tag_dir_prefix/$refname" &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ error: refs/tags/$refname: badRefName: invalid refname format
+ EOF
+ rm "$tag_dir_prefix/$refname" &&
+ test_cmp expect err || return 1
+ done &&
+
+ for refname in ".refname-starts-with-dot" "~refname-has-stride"
+ do
+ cp $tag_dir_prefix/multi_hierarchy/default-tag "$tag_dir_prefix/multi_hierarchy/$refname" &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ error: refs/tags/multi_hierarchy/$refname: badRefName: invalid refname format
+ EOF
+ rm "$tag_dir_prefix/multi_hierarchy/$refname" &&
+ test_cmp expect err || return 1
+ done &&
+
+ for refname in ".refname-starts-with-dot" "~refname-has-stride"
+ do
+ mkdir "$branch_dir_prefix/$refname" &&
+ cp $branch_dir_prefix/default-branch "$branch_dir_prefix/$refname/default-branch" &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ error: refs/heads/$refname/default-branch: badRefName: invalid refname format
+ EOF
+ rm -r "$branch_dir_prefix/$refname" &&
+ test_cmp expect err || return 1
+ done
+'
+
+test_expect_success 'ref name check should be adapted into fsck messages' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ branch_dir_prefix=.git/refs/heads &&
+ cd repo &&
+ git commit --allow-empty -m initial &&
git checkout -b branch-1 &&
- git tag tag-1 &&
- git commit --allow-empty -m second &&
- git checkout -b branch-2 &&
- git tag tag-2 &&
- git tag multi_hierarchy/tag-2 &&
cp $branch_dir_prefix/branch-1 $branch_dir_prefix/.branch-1 &&
- test_must_fail git refs verify 2>err &&
+ git -c fsck.badRefName=warn refs verify 2>err &&
cat >expect <<-EOF &&
- error: refs/heads/.branch-1: badRefName: invalid refname format
+ warning: refs/heads/.branch-1: badRefName: invalid refname format
EOF
rm $branch_dir_prefix/.branch-1 &&
test_cmp expect err &&
- cp $branch_dir_prefix/branch-1 $branch_dir_prefix/@ &&
+ cp $branch_dir_prefix/branch-1 $branch_dir_prefix/.branch-1 &&
+ git -c fsck.badRefName=ignore refs verify 2>err &&
+ test_must_be_empty err
+'
+
+test_expect_success 'ref name check should work for multiple worktrees' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+
+ cd repo &&
+ test_commit initial &&
+ git checkout -b branch-1 &&
+ test_commit second &&
+ git checkout -b branch-2 &&
+ test_commit third &&
+ git checkout -b branch-3 &&
+ git worktree add ./worktree-1 branch-1 &&
+ git worktree add ./worktree-2 branch-2 &&
+ worktree1_refdir_prefix=.git/worktrees/worktree-1/refs/worktree &&
+ worktree2_refdir_prefix=.git/worktrees/worktree-2/refs/worktree &&
+
+ (
+ cd worktree-1 &&
+ git update-ref refs/worktree/branch-4 refs/heads/branch-3
+ ) &&
+ (
+ cd worktree-2 &&
+ git update-ref refs/worktree/branch-4 refs/heads/branch-3
+ ) &&
+
+ cp $worktree1_refdir_prefix/branch-4 $worktree1_refdir_prefix/'\'' branch-5'\'' &&
+ cp $worktree2_refdir_prefix/branch-4 $worktree2_refdir_prefix/'\''~branch-6'\'' &&
+
test_must_fail git refs verify 2>err &&
cat >expect <<-EOF &&
- error: refs/heads/@: badRefName: invalid refname format
+ error: worktrees/worktree-1/refs/worktree/ branch-5: badRefName: invalid refname format
+ error: worktrees/worktree-2/refs/worktree/~branch-6: badRefName: invalid refname format
EOF
- rm $branch_dir_prefix/@ &&
+ sort err >sorted_err &&
+ test_cmp expect sorted_err &&
+
+ for worktree in "worktree-1" "worktree-2"
+ do
+ (
+ cd $worktree &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ error: worktrees/worktree-1/refs/worktree/ branch-5: badRefName: invalid refname format
+ error: worktrees/worktree-2/refs/worktree/~branch-6: badRefName: invalid refname format
+ EOF
+ sort err >sorted_err &&
+ test_cmp expect sorted_err || return 1
+ )
+ done
+'
+
+test_expect_success 'regular ref content should be checked (individual)' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ branch_dir_prefix=.git/refs/heads &&
+ cd repo &&
+ test_commit default &&
+ mkdir -p "$branch_dir_prefix/a/b" &&
+
+ git refs verify 2>err &&
+ test_must_be_empty err &&
+
+ for bad_content in "$(git rev-parse main)x" "xfsazqfxcadas" "Xfsazqfxcadas"
+ do
+ printf "%s" $bad_content >$branch_dir_prefix/branch-bad &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ error: refs/heads/branch-bad: badRefContent: $bad_content
+ EOF
+ rm $branch_dir_prefix/branch-bad &&
+ test_cmp expect err || return 1
+ done &&
+
+ for bad_content in "$(git rev-parse main)x" "xfsazqfxcadas" "Xfsazqfxcadas"
+ do
+ printf "%s" $bad_content >$branch_dir_prefix/a/b/branch-bad &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ error: refs/heads/a/b/branch-bad: badRefContent: $bad_content
+ EOF
+ rm $branch_dir_prefix/a/b/branch-bad &&
+ test_cmp expect err || return 1
+ done &&
+
+ printf "%s" "$(git rev-parse main)" >$branch_dir_prefix/branch-no-newline &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: refs/heads/branch-no-newline: refMissingNewline: misses LF at the end
+ EOF
+ rm $branch_dir_prefix/branch-no-newline &&
test_cmp expect err &&
- cp $tag_dir_prefix/multi_hierarchy/tag-2 $tag_dir_prefix/multi_hierarchy/@ &&
- test_must_fail git refs verify 2>err &&
+ for trailing_content in " garbage" " more garbage"
+ do
+ printf "%s" "$(git rev-parse main)$trailing_content" >$branch_dir_prefix/branch-garbage &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: refs/heads/branch-garbage: trailingRefContent: has trailing garbage: '\''$trailing_content'\''
+ EOF
+ rm $branch_dir_prefix/branch-garbage &&
+ test_cmp expect err || return 1
+ done &&
+
+ printf "%s\n\n\n" "$(git rev-parse main)" >$branch_dir_prefix/branch-garbage-special &&
+ git refs verify 2>err &&
cat >expect <<-EOF &&
- error: refs/tags/multi_hierarchy/@: badRefName: invalid refname format
+ warning: refs/heads/branch-garbage-special: trailingRefContent: has trailing garbage: '\''
+
+
+ '\''
EOF
- rm $tag_dir_prefix/multi_hierarchy/@ &&
+ rm $branch_dir_prefix/branch-garbage-special &&
test_cmp expect err &&
- cp $tag_dir_prefix/tag-1 $tag_dir_prefix/tag-1.lock &&
+ printf "%s\n\n\n garbage" "$(git rev-parse main)" >$branch_dir_prefix/branch-garbage-special &&
git refs verify 2>err &&
- rm $tag_dir_prefix/tag-1.lock &&
- test_must_be_empty err &&
+ cat >expect <<-EOF &&
+ warning: refs/heads/branch-garbage-special: trailingRefContent: has trailing garbage: '\''
+
+
+ garbage'\''
+ EOF
+ rm $branch_dir_prefix/branch-garbage-special &&
+ test_cmp expect err
+'
+
+test_expect_success 'regular ref content should be checked (aggregate)' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ branch_dir_prefix=.git/refs/heads &&
+ tag_dir_prefix=.git/refs/tags &&
+ cd repo &&
+ test_commit default &&
+ mkdir -p "$branch_dir_prefix/a/b" &&
+
+ bad_content_1=$(git rev-parse main)x &&
+ bad_content_2=xfsazqfxcadas &&
+ bad_content_3=Xfsazqfxcadas &&
+ printf "%s" $bad_content_1 >$tag_dir_prefix/tag-bad-1 &&
+ printf "%s" $bad_content_2 >$tag_dir_prefix/tag-bad-2 &&
+ printf "%s" $bad_content_3 >$branch_dir_prefix/a/b/branch-bad &&
+ printf "%s" "$(git rev-parse main)" >$branch_dir_prefix/branch-no-newline &&
+ printf "%s garbage" "$(git rev-parse main)" >$branch_dir_prefix/branch-garbage &&
- cp $tag_dir_prefix/tag-1 $tag_dir_prefix/.lock &&
test_must_fail git refs verify 2>err &&
cat >expect <<-EOF &&
- error: refs/tags/.lock: badRefName: invalid refname format
+ error: refs/heads/a/b/branch-bad: badRefContent: $bad_content_3
+ error: refs/tags/tag-bad-1: badRefContent: $bad_content_1
+ error: refs/tags/tag-bad-2: badRefContent: $bad_content_2
+ warning: refs/heads/branch-garbage: trailingRefContent: has trailing garbage: '\'' garbage'\''
+ warning: refs/heads/branch-no-newline: refMissingNewline: misses LF at the end
EOF
- rm $tag_dir_prefix/.lock &&
+ sort err >sorted_err &&
+ test_cmp expect sorted_err
+'
+
+test_expect_success 'textual symref content should be checked (individual)' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ branch_dir_prefix=.git/refs/heads &&
+ cd repo &&
+ test_commit default &&
+ mkdir -p "$branch_dir_prefix/a/b" &&
+
+ for good_referent in "refs/heads/branch" "HEAD"
+ do
+ printf "ref: %s\n" $good_referent >$branch_dir_prefix/branch-good &&
+ git refs verify 2>err &&
+ rm $branch_dir_prefix/branch-good &&
+ test_must_be_empty err || return 1
+ done &&
+
+ for bad_referent in "refs/heads/.branch" "refs/heads/~branch" "refs/heads/?branch"
+ do
+ printf "ref: %s\n" $bad_referent >$branch_dir_prefix/branch-bad &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ error: refs/heads/branch-bad: badReferentName: points to invalid refname '\''$bad_referent'\''
+ EOF
+ rm $branch_dir_prefix/branch-bad &&
+ test_cmp expect err || return 1
+ done &&
+
+ printf "ref: refs/heads/branch" >$branch_dir_prefix/branch-no-newline &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: refs/heads/branch-no-newline: refMissingNewline: misses LF at the end
+ EOF
+ rm $branch_dir_prefix/branch-no-newline &&
+ test_cmp expect err &&
+
+ printf "ref: refs/heads/branch " >$branch_dir_prefix/a/b/branch-trailing-1 &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: refs/heads/a/b/branch-trailing-1: refMissingNewline: misses LF at the end
+ warning: refs/heads/a/b/branch-trailing-1: trailingRefContent: has trailing whitespaces or newlines
+ EOF
+ rm $branch_dir_prefix/a/b/branch-trailing-1 &&
+ test_cmp expect err &&
+
+ printf "ref: refs/heads/branch\n\n" >$branch_dir_prefix/a/b/branch-trailing-2 &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: refs/heads/a/b/branch-trailing-2: trailingRefContent: has trailing whitespaces or newlines
+ EOF
+ rm $branch_dir_prefix/a/b/branch-trailing-2 &&
+ test_cmp expect err &&
+
+ printf "ref: refs/heads/branch \n" >$branch_dir_prefix/a/b/branch-trailing-3 &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: refs/heads/a/b/branch-trailing-3: trailingRefContent: has trailing whitespaces or newlines
+ EOF
+ rm $branch_dir_prefix/a/b/branch-trailing-3 &&
+ test_cmp expect err &&
+
+ printf "ref: refs/heads/branch \n " >$branch_dir_prefix/a/b/branch-complicated &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: refs/heads/a/b/branch-complicated: refMissingNewline: misses LF at the end
+ warning: refs/heads/a/b/branch-complicated: trailingRefContent: has trailing whitespaces or newlines
+ EOF
+ rm $branch_dir_prefix/a/b/branch-complicated &&
test_cmp expect err
'
-test_expect_success 'ref name check should be adapted into fsck messages' '
+test_expect_success 'textual symref content should be checked (aggregate)' '
test_when_finished "rm -rf repo" &&
git init repo &&
branch_dir_prefix=.git/refs/heads &&
tag_dir_prefix=.git/refs/tags &&
cd repo &&
- git commit --allow-empty -m initial &&
- git checkout -b branch-1 &&
- git tag tag-1 &&
- git commit --allow-empty -m second &&
- git checkout -b branch-2 &&
- git tag tag-2 &&
+ test_commit default &&
+ mkdir -p "$branch_dir_prefix/a/b" &&
- cp $branch_dir_prefix/branch-1 $branch_dir_prefix/.branch-1 &&
- git -c fsck.badRefName=warn refs verify 2>err &&
+ printf "ref: refs/heads/branch\n" >$branch_dir_prefix/branch-good &&
+ printf "ref: HEAD\n" >$branch_dir_prefix/branch-head &&
+ printf "ref: refs/heads/branch" >$branch_dir_prefix/branch-no-newline-1 &&
+ printf "ref: refs/heads/branch " >$branch_dir_prefix/a/b/branch-trailing-1 &&
+ printf "ref: refs/heads/branch\n\n" >$branch_dir_prefix/a/b/branch-trailing-2 &&
+ printf "ref: refs/heads/branch \n" >$branch_dir_prefix/a/b/branch-trailing-3 &&
+ printf "ref: refs/heads/branch \n " >$branch_dir_prefix/a/b/branch-complicated &&
+ printf "ref: refs/heads/.branch\n" >$branch_dir_prefix/branch-bad-1 &&
+
+ test_must_fail git refs verify 2>err &&
cat >expect <<-EOF &&
- warning: refs/heads/.branch-1: badRefName: invalid refname format
+ error: refs/heads/branch-bad-1: badReferentName: points to invalid refname '\''refs/heads/.branch'\''
+ warning: refs/heads/a/b/branch-complicated: refMissingNewline: misses LF at the end
+ warning: refs/heads/a/b/branch-complicated: trailingRefContent: has trailing whitespaces or newlines
+ warning: refs/heads/a/b/branch-trailing-1: refMissingNewline: misses LF at the end
+ warning: refs/heads/a/b/branch-trailing-1: trailingRefContent: has trailing whitespaces or newlines
+ warning: refs/heads/a/b/branch-trailing-2: trailingRefContent: has trailing whitespaces or newlines
+ warning: refs/heads/a/b/branch-trailing-3: trailingRefContent: has trailing whitespaces or newlines
+ warning: refs/heads/branch-no-newline-1: refMissingNewline: misses LF at the end
EOF
- rm $branch_dir_prefix/.branch-1 &&
+ sort err >sorted_err &&
+ test_cmp expect sorted_err
+'
+
+test_expect_success 'the target of the textual symref should be checked' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ branch_dir_prefix=.git/refs/heads &&
+ tag_dir_prefix=.git/refs/tags &&
+ cd repo &&
+ test_commit default &&
+ mkdir -p "$branch_dir_prefix/a/b" &&
+
+ for good_referent in "refs/heads/branch" "HEAD" "refs/tags/tag"
+ do
+ printf "ref: %s\n" $good_referent >$branch_dir_prefix/branch-good &&
+ git refs verify 2>err &&
+ rm $branch_dir_prefix/branch-good &&
+ test_must_be_empty err || return 1
+ done &&
+
+ for nonref_referent in "refs-back/heads/branch" "refs-back/tags/tag" "reflogs/refs/heads/branch"
+ do
+ printf "ref: %s\n" $nonref_referent >$branch_dir_prefix/branch-bad-1 &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: refs/heads/branch-bad-1: symrefTargetIsNotARef: points to non-ref target '\''$nonref_referent'\''
+ EOF
+ rm $branch_dir_prefix/branch-bad-1 &&
+ test_cmp expect err || return 1
+ done
+'
+
+test_expect_success SYMLINKS 'symlink symref content should be checked' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ branch_dir_prefix=.git/refs/heads &&
+ tag_dir_prefix=.git/refs/tags &&
+ cd repo &&
+ test_commit default &&
+ mkdir -p "$branch_dir_prefix/a/b" &&
+
+ ln -sf ./main $branch_dir_prefix/branch-symbolic-good &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: refs/heads/branch-symbolic-good: symlinkRef: use deprecated symbolic link for symref
+ EOF
+ rm $branch_dir_prefix/branch-symbolic-good &&
test_cmp expect err &&
- cp $branch_dir_prefix/branch-1 $branch_dir_prefix/@ &&
- git -c fsck.badRefName=ignore refs verify 2>err &&
- test_must_be_empty err
+ ln -sf ../../logs/branch-escape $branch_dir_prefix/branch-symbolic &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: refs/heads/branch-symbolic: symlinkRef: use deprecated symbolic link for symref
+ warning: refs/heads/branch-symbolic: symrefTargetIsNotARef: points to non-ref target '\''logs/branch-escape'\''
+ EOF
+ rm $branch_dir_prefix/branch-symbolic &&
+ test_cmp expect err &&
+
+ ln -sf ./"branch " $branch_dir_prefix/branch-symbolic-bad &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: refs/heads/branch-symbolic-bad: symlinkRef: use deprecated symbolic link for symref
+ error: refs/heads/branch-symbolic-bad: badReferentName: points to invalid refname '\''refs/heads/branch '\''
+ EOF
+ rm $branch_dir_prefix/branch-symbolic-bad &&
+ test_cmp expect err &&
+
+ ln -sf ./".tag" $tag_dir_prefix/tag-symbolic-1 &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: refs/tags/tag-symbolic-1: symlinkRef: use deprecated symbolic link for symref
+ error: refs/tags/tag-symbolic-1: badReferentName: points to invalid refname '\''refs/tags/.tag'\''
+ EOF
+ rm $tag_dir_prefix/tag-symbolic-1 &&
+ test_cmp expect err
+'
+
+test_expect_success SYMLINKS 'symlink symref content should be checked (worktree)' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ cd repo &&
+ test_commit default &&
+ git branch branch-1 &&
+ git branch branch-2 &&
+ git branch branch-3 &&
+ git worktree add ./worktree-1 branch-2 &&
+ git worktree add ./worktree-2 branch-3 &&
+ main_worktree_refdir_prefix=.git/refs/heads &&
+ worktree1_refdir_prefix=.git/worktrees/worktree-1/refs/worktree &&
+ worktree2_refdir_prefix=.git/worktrees/worktree-2/refs/worktree &&
+
+ (
+ cd worktree-1 &&
+ git update-ref refs/worktree/branch-4 refs/heads/branch-1
+ ) &&
+ (
+ cd worktree-2 &&
+ git update-ref refs/worktree/branch-4 refs/heads/branch-1
+ ) &&
+
+ ln -sf ../../../../refs/heads/good-branch $worktree1_refdir_prefix/branch-symbolic-good &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: worktrees/worktree-1/refs/worktree/branch-symbolic-good: symlinkRef: use deprecated symbolic link for symref
+ EOF
+ rm $worktree1_refdir_prefix/branch-symbolic-good &&
+ test_cmp expect err &&
+
+ ln -sf ../../../../worktrees/worktree-1/good-branch $worktree2_refdir_prefix/branch-symbolic-good &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: worktrees/worktree-2/refs/worktree/branch-symbolic-good: symlinkRef: use deprecated symbolic link for symref
+ EOF
+ rm $worktree2_refdir_prefix/branch-symbolic-good &&
+ test_cmp expect err &&
+
+ ln -sf ../../worktrees/worktree-2/good-branch $main_worktree_refdir_prefix/branch-symbolic-good &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: refs/heads/branch-symbolic-good: symlinkRef: use deprecated symbolic link for symref
+ EOF
+ rm $main_worktree_refdir_prefix/branch-symbolic-good &&
+ test_cmp expect err &&
+
+ ln -sf ../../../../logs/branch-escape $worktree1_refdir_prefix/branch-symbolic &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: worktrees/worktree-1/refs/worktree/branch-symbolic: symlinkRef: use deprecated symbolic link for symref
+ warning: worktrees/worktree-1/refs/worktree/branch-symbolic: symrefTargetIsNotARef: points to non-ref target '\''logs/branch-escape'\''
+ EOF
+ rm $worktree1_refdir_prefix/branch-symbolic &&
+ test_cmp expect err &&
+
+ for bad_referent_name in ".tag" "branch "
+ do
+ ln -sf ./"$bad_referent_name" $worktree1_refdir_prefix/bad-symbolic &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: worktrees/worktree-1/refs/worktree/bad-symbolic: symlinkRef: use deprecated symbolic link for symref
+ error: worktrees/worktree-1/refs/worktree/bad-symbolic: badReferentName: points to invalid refname '\''worktrees/worktree-1/refs/worktree/$bad_referent_name'\''
+ EOF
+ rm $worktree1_refdir_prefix/bad-symbolic &&
+ test_cmp expect err &&
+
+ ln -sf ../../../../refs/heads/"$bad_referent_name" $worktree1_refdir_prefix/bad-symbolic &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: worktrees/worktree-1/refs/worktree/bad-symbolic: symlinkRef: use deprecated symbolic link for symref
+ error: worktrees/worktree-1/refs/worktree/bad-symbolic: badReferentName: points to invalid refname '\''refs/heads/$bad_referent_name'\''
+ EOF
+ rm $worktree1_refdir_prefix/bad-symbolic &&
+ test_cmp expect err &&
+
+ ln -sf ./"$bad_referent_name" $worktree2_refdir_prefix/bad-symbolic &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: worktrees/worktree-2/refs/worktree/bad-symbolic: symlinkRef: use deprecated symbolic link for symref
+ error: worktrees/worktree-2/refs/worktree/bad-symbolic: badReferentName: points to invalid refname '\''worktrees/worktree-2/refs/worktree/$bad_referent_name'\''
+ EOF
+ rm $worktree2_refdir_prefix/bad-symbolic &&
+ test_cmp expect err &&
+
+ ln -sf ../../../../refs/heads/"$bad_referent_name" $worktree2_refdir_prefix/bad-symbolic &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: worktrees/worktree-2/refs/worktree/bad-symbolic: symlinkRef: use deprecated symbolic link for symref
+ error: worktrees/worktree-2/refs/worktree/bad-symbolic: badReferentName: points to invalid refname '\''refs/heads/$bad_referent_name'\''
+ EOF
+ rm $worktree2_refdir_prefix/bad-symbolic &&
+ test_cmp expect err || return 1
+ done
+'
+
+test_expect_success 'ref content checks should work with worktrees' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ cd repo &&
+ test_commit default &&
+ git branch branch-1 &&
+ git branch branch-2 &&
+ git branch branch-3 &&
+ git worktree add ./worktree-1 branch-2 &&
+ git worktree add ./worktree-2 branch-3 &&
+ worktree1_refdir_prefix=.git/worktrees/worktree-1/refs/worktree &&
+ worktree2_refdir_prefix=.git/worktrees/worktree-2/refs/worktree &&
+
+ (
+ cd worktree-1 &&
+ git update-ref refs/worktree/branch-4 refs/heads/branch-1
+ ) &&
+ (
+ cd worktree-2 &&
+ git update-ref refs/worktree/branch-4 refs/heads/branch-1
+ ) &&
+
+ for bad_content in "$(git rev-parse HEAD)x" "xfsazqfxcadas" "Xfsazqfxcadas"
+ do
+ printf "%s" $bad_content >$worktree1_refdir_prefix/bad-branch-1 &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ error: worktrees/worktree-1/refs/worktree/bad-branch-1: badRefContent: $bad_content
+ EOF
+ rm $worktree1_refdir_prefix/bad-branch-1 &&
+ test_cmp expect err || return 1
+ done &&
+
+ for bad_content in "$(git rev-parse HEAD)x" "xfsazqfxcadas" "Xfsazqfxcadas"
+ do
+ printf "%s" $bad_content >$worktree2_refdir_prefix/bad-branch-2 &&
+ test_must_fail git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ error: worktrees/worktree-2/refs/worktree/bad-branch-2: badRefContent: $bad_content
+ EOF
+ rm $worktree2_refdir_prefix/bad-branch-2 &&
+ test_cmp expect err || return 1
+ done &&
+
+ printf "%s" "$(git rev-parse HEAD)" >$worktree1_refdir_prefix/branch-no-newline &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: worktrees/worktree-1/refs/worktree/branch-no-newline: refMissingNewline: misses LF at the end
+ EOF
+ rm $worktree1_refdir_prefix/branch-no-newline &&
+ test_cmp expect err &&
+
+ printf "%s garbage" "$(git rev-parse HEAD)" >$worktree1_refdir_prefix/branch-garbage &&
+ git refs verify 2>err &&
+ cat >expect <<-EOF &&
+ warning: worktrees/worktree-1/refs/worktree/branch-garbage: trailingRefContent: has trailing garbage: '\'' garbage'\''
+ EOF
+ rm $worktree1_refdir_prefix/branch-garbage &&
+ test_cmp expect err
'
test_done
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index eaf6fab6d2..4618ffc108 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -10,7 +10,6 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
GIT_TEST_DEFAULT_REF_FORMAT=reftable
export GIT_TEST_DEFAULT_REF_FORMAT
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
INVALID_OID=$(test_oid 001)
diff --git a/t/t0611-reftable-httpd.sh b/t/t0611-reftable-httpd.sh
index 2805995cc8..5e05b9c1f2 100755
--- a/t/t0611-reftable-httpd.sh
+++ b/t/t0611-reftable-httpd.sh
@@ -2,7 +2,6 @@
test_description='reftable HTTPD tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-httpd.sh
diff --git a/t/t0612-reftable-jgit-compatibility.sh b/t/t0612-reftable-jgit-compatibility.sh
index 84922153ab..d0d7e80b49 100755
--- a/t/t0612-reftable-jgit-compatibility.sh
+++ b/t/t0612-reftable-jgit-compatibility.sh
@@ -11,7 +11,6 @@ export GIT_TEST_DEFAULT_REF_FORMAT
GIT_TEST_SPLIT_INDEX=0
export GIT_TEST_SPLIT_INDEX
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
if ! test_have_prereq JGIT
diff --git a/t/t0613-reftable-write-options.sh b/t/t0613-reftable-write-options.sh
index b1c6c97524..e2708e11d5 100755
--- a/t/t0613-reftable-write-options.sh
+++ b/t/t0613-reftable-write-options.sh
@@ -16,7 +16,6 @@ export GIT_TEST_DEFAULT_HASH
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'default write options' '
diff --git a/t/t1000-read-tree-m-3way.sh b/t/t1000-read-tree-m-3way.sh
index 0e8c0dfbbe..b9dd21cfb6 100755
--- a/t/t1000-read-tree-m-3way.sh
+++ b/t/t1000-read-tree-m-3way.sh
@@ -72,7 +72,6 @@ In addition:
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-read-tree.sh
. "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh
diff --git a/t/t1001-read-tree-m-2way.sh b/t/t1001-read-tree-m-2way.sh
index 48a1550371..4a88bb9ef0 100755
--- a/t/t1001-read-tree-m-2way.sh
+++ b/t/t1001-read-tree-m-2way.sh
@@ -21,7 +21,6 @@ In the test, these paths are used:
yomin - not in H or M
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-read-tree.sh
diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh
index a7c2ed0d7c..df6ef53725 100755
--- a/t/t1002-read-tree-m-u-2way.sh
+++ b/t/t1002-read-tree-m-u-2way.sh
@@ -9,7 +9,6 @@ This is identical to t1001, but uses -u to update the work tree as well.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-read-tree.sh
diff --git a/t/t1003-read-tree-prefix.sh b/t/t1003-read-tree-prefix.sh
index c860c08ecb..66e2bf4aec 100755
--- a/t/t1003-read-tree-prefix.sh
+++ b/t/t1003-read-tree-prefix.sh
@@ -6,7 +6,6 @@
test_description='git read-tree --prefix test.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t1004-read-tree-m-u-wf.sh b/t/t1004-read-tree-m-u-wf.sh
index 2b9720b0fe..11bf10424f 100755
--- a/t/t1004-read-tree-m-u-wf.sh
+++ b/t/t1004-read-tree-m-u-wf.sh
@@ -5,7 +5,6 @@ test_description='read-tree -m -u checks working tree files'
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-read-tree.sh
diff --git a/t/t1005-read-tree-reset.sh b/t/t1005-read-tree-reset.sh
index 26be4a2b5a..6b5033d0ce 100755
--- a/t/t1005-read-tree-reset.sh
+++ b/t/t1005-read-tree-reset.sh
@@ -2,7 +2,6 @@
test_description='read-tree -u --reset'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-read-tree.sh
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index d36cd7c086..ff9bf213aa 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -2,7 +2,6 @@
test_description='git cat-file'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_cmdmode_usage () {
diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh
index d73a5cc237..a0481139de 100755
--- a/t/t1007-hash-object.sh
+++ b/t/t1007-hash-object.sh
@@ -2,7 +2,6 @@
test_description="git hash-object"
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
echo_without_newline() {
diff --git a/t/t1008-read-tree-overlay.sh b/t/t1008-read-tree-overlay.sh
index ad5936e54d..4512fb0b6e 100755
--- a/t/t1008-read-tree-overlay.sh
+++ b/t/t1008-read-tree-overlay.sh
@@ -5,7 +5,6 @@ test_description='test multi-tree read-tree without merging'
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-read-tree.sh
diff --git a/t/t1009-read-tree-new-index.sh b/t/t1009-read-tree-new-index.sh
index fc179ac5dd..2935f68f8d 100755
--- a/t/t1009-read-tree-new-index.sh
+++ b/t/t1009-read-tree-new-index.sh
@@ -5,7 +5,6 @@ test_description='test read-tree into a fresh index file'
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 '
diff --git a/t/t1010-mktree.sh b/t/t1010-mktree.sh
index 22875ba598..c291a2b33d 100755
--- a/t/t1010-mktree.sh
+++ b/t/t1010-mktree.sh
@@ -2,7 +2,6 @@
test_description='git mktree'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh
index 595b24c0ad..742f0fa909 100755
--- a/t/t1011-read-tree-sparse-checkout.sh
+++ b/t/t1011-read-tree-sparse-checkout.sh
@@ -12,7 +12,6 @@ test_description='sparse checkout tests
'
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-read-tree.sh
diff --git a/t/t1012-read-tree-df.sh b/t/t1012-read-tree-df.sh
index cde93d22cd..57f0770df1 100755
--- a/t/t1012-read-tree-df.sh
+++ b/t/t1012-read-tree-df.sh
@@ -2,7 +2,6 @@
test_description='read-tree D/F conflict corner cases'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-read-tree.sh
diff --git a/t/t1013-read-tree-submodule.sh b/t/t1013-read-tree-submodule.sh
index cf8b94ebed..bfc90d4cf2 100755
--- a/t/t1013-read-tree-submodule.sh
+++ b/t/t1013-read-tree-submodule.sh
@@ -2,7 +2,6 @@
test_description='read-tree can handle submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh
diff --git a/t/t1014-read-tree-confusing.sh b/t/t1014-read-tree-confusing.sh
index 8ea8d36818..0c0e6da5cf 100755
--- a/t/t1014-read-tree-confusing.sh
+++ b/t/t1014-read-tree-confusing.sh
@@ -2,7 +2,6 @@
test_description='check that read-tree rejects confusing paths'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'create base tree' '
diff --git a/t/t1015-read-index-unmerged.sh b/t/t1015-read-index-unmerged.sh
index da737a32a2..9b965d0294 100755
--- a/t/t1015-read-index-unmerged.sh
+++ b/t/t1015-read-index-unmerged.sh
@@ -2,7 +2,6 @@
test_description='Test various callers of read_index_unmerged'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup modify/delete + directory/file conflict' '
diff --git a/t/t1016-compatObjectFormat.sh b/t/t1016-compatObjectFormat.sh
index 32e0af392e..e88362fbe4 100755
--- a/t/t1016-compatObjectFormat.sh
+++ b/t/t1016-compatObjectFormat.sh
@@ -5,7 +5,6 @@
test_description='Test how well compatObjectFormat works'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-gpg.sh
diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index 45eef9457f..9fdbb2af80 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -6,7 +6,6 @@
test_description='Try various core-level commands in subdirectory.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-read-tree.sh
diff --git a/t/t1021-rerere-in-workdir.sh b/t/t1021-rerere-in-workdir.sh
index 69bf9476cb..0b892894eb 100755
--- a/t/t1021-rerere-in-workdir.sh
+++ b/t/t1021-rerere-in-workdir.sh
@@ -4,7 +4,6 @@ test_description='rerere run in a workdir'
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 SYMLINKS setup '
diff --git a/t/t1022-read-tree-partial-clone.sh b/t/t1022-read-tree-partial-clone.sh
index cca4380e43..d390d7d5f8 100755
--- a/t/t1022-read-tree-partial-clone.sh
+++ b/t/t1022-read-tree-partial-clone.sh
@@ -3,7 +3,6 @@
test_description='git read-tree in partial clones'
TEST_NO_CREATE_REPO=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'read-tree in partial clone prefetches in one batch' '
diff --git a/t/t1050-large.sh b/t/t1050-large.sh
index ed638f6644..c71932b024 100755
--- a/t/t1050-large.sh
+++ b/t/t1050-large.sh
@@ -3,7 +3,6 @@
test_description='adding and checking out large blobs'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'core.bigFileThreshold must be non-negative' '
diff --git a/t/t1051-large-conversion.sh b/t/t1051-large-conversion.sh
index f6709c9f56..361afb679b 100755
--- a/t/t1051-large-conversion.sh
+++ b/t/t1051-large-conversion.sh
@@ -2,7 +2,6 @@
test_description='test conversion filters on large files'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
set_attr() {
diff --git a/t/t1060-object-corruption.sh b/t/t1060-object-corruption.sh
index 5e0f0a334f..502a5ea1c5 100755
--- a/t/t1060-object-corruption.sh
+++ b/t/t1060-object-corruption.sh
@@ -2,7 +2,6 @@
test_description='see how we handle various forms of corruption'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# convert "1234abcd" to ".git/objects/12/34abcd"
diff --git a/t/t1090-sparse-checkout-scope.sh b/t/t1090-sparse-checkout-scope.sh
index da0e7714d5..3a14218b24 100755
--- a/t/t1090-sparse-checkout-scope.sh
+++ b/t/t1090-sparse-checkout-scope.sh
@@ -6,7 +6,6 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh
index 8c5cd651b4..ab3a105fff 100755
--- a/t/t1091-sparse-checkout-builtin.sh
+++ b/t/t1091-sparse-checkout-builtin.sh
@@ -8,7 +8,6 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
GIT_TEST_SPLIT_INDEX=false
export GIT_TEST_SPLIT_INDEX
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
list_files() {
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
index 2157f37da3..a4c7c41fc0 100755
--- a/t/t1092-sparse-checkout-compatibility.sh
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -5,7 +5,6 @@ test_description='compare full workdir to sparse workdir'
GIT_TEST_SPLIT_INDEX=0
GIT_TEST_SPARSE_INDEX=
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh
index 0f37a43fd3..ae66ba5bab 100755
--- a/t/t1100-commit-tree-options.sh
+++ b/t/t1100-commit-tree-options.sh
@@ -12,7 +12,6 @@ Also make sure that command line parser understands the normal
"flags first and then non flag arguments" command line.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cat >expected <<EOF
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index f13277c8f3..51a85e83c2 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -8,7 +8,6 @@ test_description='Test git config in different settings'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
for mode in legacy subcommands
diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh
index 29cf8a9661..630a47af21 100755
--- a/t/t1301-shared-repo.sh
+++ b/t/t1301-shared-repo.sh
@@ -9,7 +9,6 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Remove a default ACL from the test dir if possible.
diff --git a/t/t1302-repo-version.sh b/t/t1302-repo-version.sh
index 42caa0d297..69723b88ff 100755
--- a/t/t1302-repo-version.sh
+++ b/t/t1302-repo-version.sh
@@ -5,7 +5,6 @@
test_description='Test repository version check'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t1303-wacky-config.sh b/t/t1303-wacky-config.sh
index 0506f3d6bb..d971925ed0 100755
--- a/t/t1303-wacky-config.sh
+++ b/t/t1303-wacky-config.sh
@@ -2,7 +2,6 @@
test_description='Test wacky input to git config'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Leaving off the newline is intentional!
diff --git a/t/t1304-default-acl.sh b/t/t1304-default-acl.sh
index 31b89dd969..c69ae41306 100755
--- a/t/t1304-default-acl.sh
+++ b/t/t1304-default-acl.sh
@@ -9,7 +9,6 @@ test_description='Test repository with default ACL'
# => this must come before . ./test-lib.sh
umask 077
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# We need an arbitrary other user give permission to using ACLs. root
diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh
index 517d6c8693..8ff2b0c232 100755
--- a/t/t1305-config-include.sh
+++ b/t/t1305-config-include.sh
@@ -1,7 +1,6 @@
#!/bin/sh
test_description='test config file include directives'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Force setup_explicit_git_dir() to run until the end. This is needed
diff --git a/t/t1306-xdg-files.sh b/t/t1306-xdg-files.sh
index 53e5b290b9..40d3c42618 100755
--- a/t/t1306-xdg-files.sh
+++ b/t/t1306-xdg-files.sh
@@ -7,7 +7,6 @@
test_description='Compatibility with $XDG_CONFIG_HOME/git/ files'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'read config: xdg file exists and ~/.gitconfig doesn'\''t' '
diff --git a/t/t1307-config-blob.sh b/t/t1307-config-blob.sh
index b9852fe40e..5cb546dd00 100755
--- a/t/t1307-config-blob.sh
+++ b/t/t1307-config-blob.sh
@@ -2,7 +2,6 @@
test_description='support for reading config from a blob'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'create config blob' '
diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh
index 3bfec07f1a..e0e49053f0 100755
--- a/t/t1308-config-set.sh
+++ b/t/t1308-config-set.sh
@@ -2,7 +2,6 @@
test_description='Test git config-set API in different settings'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# 'check_config get_* section.key value' verifies that the entry for
diff --git a/t/t1309-early-config.sh b/t/t1309-early-config.sh
index 523aa99a1e..9710ee0ca4 100755
--- a/t/t1309-early-config.sh
+++ b/t/t1309-early-config.sh
@@ -2,7 +2,6 @@
test_description='Test read_early_config()'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'read early config' '
diff --git a/t/t1310-config-default.sh b/t/t1310-config-default.sh
index 1a90d31201..69e64c6c86 100755
--- a/t/t1310-config-default.sh
+++ b/t/t1310-config-default.sh
@@ -2,7 +2,6 @@
test_description='Test git config in different settings (with --default)'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'uses --default when entry missing' '
diff --git a/t/t1350-config-hooks-path.sh b/t/t1350-config-hooks-path.sh
index ceeb7ac3a4..45a0492917 100755
--- a/t/t1350-config-hooks-path.sh
+++ b/t/t1350-config-hooks-path.sh
@@ -2,7 +2,6 @@
test_description='Test the core.hooksPath configuration variable'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'set up a pre-commit hook in core.hooksPath' '
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index bb057596f1..e2316f1dd4 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -5,7 +5,6 @@
test_description='Test git update-ref and basic ref logging'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
Z=$ZERO_OID
diff --git a/t/t1401-symbolic-ref.sh b/t/t1401-symbolic-ref.sh
index 90af3f955c..a2a7e94716 100755
--- a/t/t1401-symbolic-ref.sh
+++ b/t/t1401-symbolic-ref.sh
@@ -2,7 +2,6 @@
test_description='basic symbolic-ref tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# If the tests munging HEAD fail, they can break detection of
diff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh
index 5ed9d7318e..cabc516ae9 100755
--- a/t/t1402-check-ref-format.sh
+++ b/t/t1402-check-ref-format.sh
@@ -2,7 +2,6 @@
test_description='Test git check-ref-format'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
valid_ref() {
diff --git a/t/t1403-show-ref.sh b/t/t1403-show-ref.sh
index 403f6b8f7d..9d698b3cc3 100755
--- a/t/t1403-show-ref.sh
+++ b/t/t1403-show-ref.sh
@@ -4,7 +4,6 @@ test_description='show-ref'
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 '
diff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh
index df90112618..28e6c380d7 100755
--- a/t/t1404-update-ref-errors.sh
+++ b/t/t1404-update-ref-errors.sh
@@ -2,7 +2,6 @@
test_description='Test git update-ref error handling'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Create some references, perhaps run pack-refs --all, then try to
diff --git a/t/t1405-main-ref-store.sh b/t/t1405-main-ref-store.sh
index a6bcd62ab6..6d8f401a2a 100755
--- a/t/t1405-main-ref-store.sh
+++ b/t/t1405-main-ref-store.sh
@@ -5,7 +5,6 @@ test_description='test main ref store api'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
RUN="test-tool ref-store main"
diff --git a/t/t1406-submodule-ref-store.sh b/t/t1406-submodule-ref-store.sh
index c01f0f14a1..9b9e5d0766 100755
--- a/t/t1406-submodule-ref-store.sh
+++ b/t/t1406-submodule-ref-store.sh
@@ -5,7 +5,6 @@ test_description='test submodule ref store api'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
RUN="test-tool ref-store submodule:sub"
diff --git a/t/t1407-worktree-ref-store.sh b/t/t1407-worktree-ref-store.sh
index 48b1c92a41..9d8e1a1343 100755
--- a/t/t1407-worktree-ref-store.sh
+++ b/t/t1407-worktree-ref-store.sh
@@ -5,7 +5,6 @@ test_description='test worktree ref store api'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
RWT="test-tool ref-store worktree:wt"
diff --git a/t/t1408-packed-refs.sh b/t/t1408-packed-refs.sh
index 9469c79a58..41ba1f1d7f 100755
--- a/t/t1408-packed-refs.sh
+++ b/t/t1408-packed-refs.sh
@@ -5,7 +5,6 @@ test_description='packed-refs entries are covered by loose refs'
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 '
diff --git a/t/t1409-avoid-packing-refs.sh b/t/t1409-avoid-packing-refs.sh
index 7748973733..e3c501848a 100755
--- a/t/t1409-avoid-packing-refs.sh
+++ b/t/t1409-avoid-packing-refs.sh
@@ -2,7 +2,6 @@
test_description='avoid rewriting packed-refs unnecessarily'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
if test_have_prereq !REFFILES
diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh
index 246a3f46ab..388fdf9ae5 100755
--- a/t/t1410-reflog.sh
+++ b/t/t1410-reflog.sh
@@ -7,7 +7,6 @@ test_description='Test prune and reflog expiration'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
check_have () {
diff --git a/t/t1411-reflog-show.sh b/t/t1411-reflog-show.sh
index da581ec19a..975c4ea83a 100755
--- a/t/t1411-reflog-show.sh
+++ b/t/t1411-reflog-show.sh
@@ -4,7 +4,6 @@ test_description='Test reflog display routines'
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' '
diff --git a/t/t1412-reflog-loop.sh b/t/t1412-reflog-loop.sh
index ff30874f94..f7d69b66ff 100755
--- a/t/t1412-reflog-loop.sh
+++ b/t/t1412-reflog-loop.sh
@@ -2,7 +2,6 @@
test_description='reflog walk shows repeated commits again'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup commits' '
diff --git a/t/t1413-reflog-detach.sh b/t/t1413-reflog-detach.sh
index d2a4822d46..934688a1ee 100755
--- a/t/t1413-reflog-detach.sh
+++ b/t/t1413-reflog-detach.sh
@@ -4,7 +4,6 @@ test_description='Test reflog interaction with detached HEAD'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
reset_state () {
diff --git a/t/t1414-reflog-walk.sh b/t/t1414-reflog-walk.sh
index 49d28166da..be6c3f472c 100755
--- a/t/t1414-reflog-walk.sh
+++ b/t/t1414-reflog-walk.sh
@@ -4,7 +4,6 @@ test_description='various tests of reflog walk (log -g) behavior'
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 'set up some reflog entries' '
diff --git a/t/t1415-worktree-refs.sh b/t/t1415-worktree-refs.sh
index eb4eec8bec..51d79bae83 100755
--- a/t/t1415-worktree-refs.sh
+++ b/t/t1415-worktree-refs.sh
@@ -2,7 +2,6 @@
test_description='per-worktree refs'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t1416-ref-transaction-hooks.sh b/t/t1416-ref-transaction-hooks.sh
index 262efec60e..8c777f7cf8 100755
--- a/t/t1416-ref-transaction-hooks.sh
+++ b/t/t1416-ref-transaction-hooks.sh
@@ -5,7 +5,6 @@ test_description='reference transaction 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 '
diff --git a/t/t1417-reflog-updateref.sh b/t/t1417-reflog-updateref.sh
index 0eb5e674bc..2f37402536 100755
--- a/t/t1417-reflog-updateref.sh
+++ b/t/t1417-reflog-updateref.sh
@@ -2,7 +2,6 @@
test_description='git reflog --updateref'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t1418-reflog-exists.sh b/t/t1418-reflog-exists.sh
index 2268bca3c1..d51ecd5e92 100755
--- a/t/t1418-reflog-exists.sh
+++ b/t/t1418-reflog-exists.sh
@@ -4,7 +4,6 @@ test_description='Test reflog display routines'
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' '
diff --git a/t/t1419-exclude-refs.sh b/t/t1419-exclude-refs.sh
index 3256e4462f..c04eeb7211 100755
--- a/t/t1419-exclude-refs.sh
+++ b/t/t1419-exclude-refs.sh
@@ -5,7 +5,6 @@ test_description='test exclude_patterns functionality in main ref store'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
for_each_ref__exclude () {
diff --git a/t/t1420-lost-found.sh b/t/t1420-lost-found.sh
index dbe15a0be1..2fb2f44f02 100755
--- a/t/t1420-lost-found.sh
+++ b/t/t1420-lost-found.sh
@@ -5,7 +5,6 @@
test_description='Test fsck --lost-found'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t1430-bad-ref-name.sh b/t/t1430-bad-ref-name.sh
index 0c00118c2b..3ab65f72cd 100755
--- a/t/t1430-bad-ref-name.sh
+++ b/t/t1430-bad-ref-name.sh
@@ -4,7 +4,6 @@ test_description='Test handling of ref names that check-ref-format rejects'
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 '
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 280cbf3e03..8a456b1142 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -6,7 +6,6 @@ test_description='git fsck random collection of tests
* (main) A
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t1451-fsck-buffer.sh b/t/t1451-fsck-buffer.sh
index 3413da40e4..3a3d33f405 100755
--- a/t/t1451-fsck-buffer.sh
+++ b/t/t1451-fsck-buffer.sh
@@ -15,7 +15,6 @@ These tests _might_ catch such overruns in normal use, but should be run with
ASan or valgrind for more confidence.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# the general idea for tags and commits is to build up the "base" file
diff --git a/t/t1460-refs-migrate.sh b/t/t1460-refs-migrate.sh
index f7c0783d30..1bfff3a7af 100755
--- a/t/t1460-refs-migrate.sh
+++ b/t/t1460-refs-migrate.sh
@@ -5,7 +5,6 @@ test_description='migration of ref storage backends'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_migration () {
@@ -237,7 +236,7 @@ test_expect_success 'migrating from reftable format deletes backend files' '
test_path_is_missing repo/.git/reftable &&
echo "ref: refs/heads/main" >expect &&
test_cmp expect repo/.git/HEAD &&
- test_path_is_file repo/.git/refs/heads/main
+ test_path_is_file repo/.git/packed-refs
'
test_done
diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
index 30c31918fd..58a4583088 100755
--- a/t/t1500-rev-parse.sh
+++ b/t/t1500-rev-parse.sh
@@ -4,7 +4,6 @@ test_description='test git rev-parse'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_one () {
@@ -310,4 +309,19 @@ test_expect_success '--short= truncates to the actual hash length' '
test_cmp expect actual
'
+test_expect_success ':/ and HEAD^{/} favor more recent matching commits' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit common-old &&
+ test_commit --no-tag common-new &&
+ git rev-parse HEAD >expect &&
+ git rev-parse :/common >actual &&
+ test_cmp expect actual &&
+ git rev-parse HEAD^{/common} >actual &&
+ test_cmp expect actual
+ )
+'
+
test_done
diff --git a/t/t1501-work-tree.sh b/t/t1501-work-tree.sh
index ae6528aece..8c94ac2e70 100755
--- a/t/t1501-work-tree.sh
+++ b/t/t1501-work-tree.sh
@@ -2,7 +2,6 @@
test_description='test separate work tree'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh
index 5eaa6428c4..3962f1d288 100755
--- a/t/t1502-rev-parse-parseopt.sh
+++ b/t/t1502-rev-parse-parseopt.sh
@@ -2,7 +2,6 @@
test_description='test git rev-parse --parseopt'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
check_invalid_long_option () {
diff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh
index 79df65ec7f..75a708f9ba 100755
--- a/t/t1503-rev-parse-verify.sh
+++ b/t/t1503-rev-parse-verify.sh
@@ -9,7 +9,6 @@ exec </dev/null
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
add_line_into_file()
diff --git a/t/t1504-ceiling-dirs.sh b/t/t1504-ceiling-dirs.sh
index c1679e31d8..e04420f436 100755
--- a/t/t1504-ceiling-dirs.sh
+++ b/t/t1504-ceiling-dirs.sh
@@ -2,7 +2,6 @@
test_description='test GIT_CEILING_DIRECTORIES'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_prefix() {
diff --git a/t/t1505-rev-parse-last.sh b/t/t1505-rev-parse-last.sh
index 4a5758f08a..2803ca9489 100755
--- a/t/t1505-rev-parse-last.sh
+++ b/t/t1505-rev-parse-last.sh
@@ -5,7 +5,6 @@ test_description='test @{-N} syntax'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh
index a3464976e3..722884e65f 100755
--- a/t/t1506-rev-parse-diagnosis.sh
+++ b/t/t1506-rev-parse-diagnosis.sh
@@ -7,7 +7,6 @@ exec </dev/null
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_did_you_mean ()
diff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh
index b9af6b3ac0..cb9ef7e329 100755
--- a/t/t1507-rev-parse-upstream.sh
+++ b/t/t1507-rev-parse-upstream.sh
@@ -5,7 +5,6 @@ test_description='test <branch>@{upstream} syntax'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
index e841309d0e..87a4286414 100755
--- a/t/t1508-at-combinations.sh
+++ b/t/t1508-at-combinations.sh
@@ -4,7 +4,6 @@ test_description='test various @{X} syntax combinations together'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
check() {
diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
index 591505a39c..bbfe05b8e4 100755
--- a/t/t1510-repo-setup.sh
+++ b/t/t1510-repo-setup.sh
@@ -43,7 +43,6 @@ A few rules for repo setup:
# This test heavily relies on the standard error of nested function calls.
test_untraceable=UnfortunatelyYes
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
here=$(pwd)
diff --git a/t/t1511-rev-parse-caret.sh b/t/t1511-rev-parse-caret.sh
index e7e78a4028..6ecfed86bc 100755
--- a/t/t1511-rev-parse-caret.sh
+++ b/t/t1511-rev-parse-caret.sh
@@ -5,7 +5,6 @@ test_description='tests for ref^{stuff}'
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' '
diff --git a/t/t1512-rev-parse-disambiguation.sh b/t/t1512-rev-parse-disambiguation.sh
index f9d68ce74e..70f1e0a998 100755
--- a/t/t1512-rev-parse-disambiguation.sh
+++ b/t/t1512-rev-parse-disambiguation.sh
@@ -23,7 +23,6 @@ one tagged as v1.0.0. They all have one regular file each.
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_cmp_failed_rev_parse () {
diff --git a/t/t1513-rev-parse-prefix.sh b/t/t1513-rev-parse-prefix.sh
index ba43387bf1..5f437be8c9 100755
--- a/t/t1513-rev-parse-prefix.sh
+++ b/t/t1513-rev-parse-prefix.sh
@@ -5,7 +5,6 @@ test_description='Tests for rev-parse --prefix'
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' '
diff --git a/t/t1514-rev-parse-push.sh b/t/t1514-rev-parse-push.sh
index a835a196aa..d868a08110 100755
--- a/t/t1514-rev-parse-push.sh
+++ b/t/t1514-rev-parse-push.sh
@@ -4,7 +4,6 @@ test_description='test <branch>@{push} syntax'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
resolve () {
diff --git a/t/t1515-rev-parse-outside-repo.sh b/t/t1515-rev-parse-outside-repo.sh
index cdb26a30d7..75e89c4b6e 100755
--- a/t/t1515-rev-parse-outside-repo.sh
+++ b/t/t1515-rev-parse-outside-repo.sh
@@ -2,7 +2,6 @@
test_description='check that certain rev-parse options work outside repo'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'set up non-repo directory' '
diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh
index 342defbb61..dbd8cd6906 100755
--- a/t/t1517-outside-repo.sh
+++ b/t/t1517-outside-repo.sh
@@ -2,7 +2,6 @@
test_description='check random commands outside repo'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'set up a non-repo directory and test file' '
diff --git a/t/t1600-index.sh b/t/t1600-index.sh
index 62e7fd1596..03239e9faa 100755
--- a/t/t1600-index.sh
+++ b/t/t1600-index.sh
@@ -2,7 +2,6 @@
test_description='index file specific tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
sane_unset GIT_TEST_SPLIT_INDEX
diff --git a/t/t1601-index-bogus.sh b/t/t1601-index-bogus.sh
index 5dcc101882..a45a8b4eb0 100755
--- a/t/t1601-index-bogus.sh
+++ b/t/t1601-index-bogus.sh
@@ -2,7 +2,6 @@
test_description='test handling of bogus index entries'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'create tree with null sha1' '
diff --git a/t/t1701-racy-split-index.sh b/t/t1701-racy-split-index.sh
index d8fa489998..5dc221ef38 100755
--- a/t/t1701-racy-split-index.sh
+++ b/t/t1701-racy-split-index.sh
@@ -5,7 +5,6 @@
test_description='racy split index'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t1800-hook.sh b/t/t1800-hook.sh
index 8b0234cf2d..4feaf0d7be 100755
--- a/t/t1800-hook.sh
+++ b/t/t1800-hook.sh
@@ -2,7 +2,6 @@
test_description='git-hook command'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-terminal.sh
diff --git a/t/t2000-conflict-when-checking-files-out.sh b/t/t2000-conflict-when-checking-files-out.sh
index 79fc97f1d7..f18616ad2b 100755
--- a/t/t2000-conflict-when-checking-files-out.sh
+++ b/t/t2000-conflict-when-checking-files-out.sh
@@ -21,7 +21,6 @@ test_description='git conflicts when checking files out test.'
# path1 is occupied by a non-directory. With "-f" flag, it should remove
# the conflicting paths and succeed.
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
show_files() {
diff --git a/t/t2002-checkout-cache-u.sh b/t/t2002-checkout-cache-u.sh
index fc95cf9048..70361c806e 100755
--- a/t/t2002-checkout-cache-u.sh
+++ b/t/t2002-checkout-cache-u.sh
@@ -8,7 +8,6 @@ test_description='git checkout-index -u test.
With -u flag, git checkout-index internally runs the equivalent of
git update-index --refresh on the checked out entry.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success \
diff --git a/t/t2003-checkout-cache-mkdir.sh b/t/t2003-checkout-cache-mkdir.sh
index f0fd441d81..ff163cf675 100755
--- a/t/t2003-checkout-cache-mkdir.sh
+++ b/t/t2003-checkout-cache-mkdir.sh
@@ -10,7 +10,6 @@ also verifies that such leading path may contain symlinks, unlike
the GIT controlled paths.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t2004-checkout-cache-temp.sh b/t/t2004-checkout-cache-temp.sh
index 98e818f09f..b92d96fdc4 100755
--- a/t/t2004-checkout-cache-temp.sh
+++ b/t/t2004-checkout-cache-temp.sh
@@ -8,7 +8,6 @@ test_description='git checkout-index --temp test.
With --temp flag, git checkout-index writes to temporary merge files
rather than the tracked path.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t2005-checkout-index-symlinks.sh b/t/t2005-checkout-index-symlinks.sh
index 67d18cfa10..91b08e0371 100755
--- a/t/t2005-checkout-index-symlinks.sh
+++ b/t/t2005-checkout-index-symlinks.sh
@@ -8,7 +8,6 @@ test_description='git checkout-index on filesystem w/o symlinks test.
This tests that git checkout-index creates a symbolic link as a plain
file if core.symlinks is false.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success \
diff --git a/t/t2006-checkout-index-basic.sh b/t/t2006-checkout-index-basic.sh
index 570ba38580..bac231b167 100755
--- a/t/t2006-checkout-index-basic.sh
+++ b/t/t2006-checkout-index-basic.sh
@@ -3,7 +3,6 @@
test_description='basic checkout-index tests
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'checkout-index --gobbledegook' '
diff --git a/t/t2007-checkout-symlink.sh b/t/t2007-checkout-symlink.sh
index bd9e9e7530..6f0b90ce12 100755
--- a/t/t2007-checkout-symlink.sh
+++ b/t/t2007-checkout-symlink.sh
@@ -7,7 +7,6 @@ test_description='git checkout to switch between branches with symlink<->dir'
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 '
diff --git a/t/t2008-checkout-subdir.sh b/t/t2008-checkout-subdir.sh
index 8a518a44ea..eadb9434ae 100755
--- a/t/t2008-checkout-subdir.sh
+++ b/t/t2008-checkout-subdir.sh
@@ -4,7 +4,6 @@
test_description='git checkout from subdirectories'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t2009-checkout-statinfo.sh b/t/t2009-checkout-statinfo.sh
index 71195dd28f..b0540636ae 100755
--- a/t/t2009-checkout-statinfo.sh
+++ b/t/t2009-checkout-statinfo.sh
@@ -5,7 +5,6 @@ test_description='checkout should leave clean stat info'
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' '
diff --git a/t/t2010-checkout-ambiguous.sh b/t/t2010-checkout-ambiguous.sh
index 82c3bfeac1..3a3d56018e 100755
--- a/t/t2010-checkout-ambiguous.sh
+++ b/t/t2010-checkout-ambiguous.sh
@@ -5,7 +5,6 @@ test_description='checkout and pathspecs/refspecs ambiguities'
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' '
diff --git a/t/t2011-checkout-invalid-head.sh b/t/t2011-checkout-invalid-head.sh
index 04f53b1ea1..61417c7567 100755
--- a/t/t2011-checkout-invalid-head.sh
+++ b/t/t2011-checkout-invalid-head.sh
@@ -5,7 +5,6 @@ test_description='checkout switching away from an invalid branch'
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' '
diff --git a/t/t2012-checkout-last.sh b/t/t2012-checkout-last.sh
index 4b6372f4c3..1f6c4ed042 100755
--- a/t/t2012-checkout-last.sh
+++ b/t/t2012-checkout-last.sh
@@ -5,7 +5,6 @@ test_description='checkout can switch to last branch and merge base'
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' '
diff --git a/t/t2013-checkout-submodule.sh b/t/t2013-checkout-submodule.sh
index 3c1d663d94..b2bdd1fcb4 100755
--- a/t/t2013-checkout-submodule.sh
+++ b/t/t2013-checkout-submodule.sh
@@ -2,7 +2,6 @@
test_description='checkout can handle submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh
diff --git a/t/t2014-checkout-switch.sh b/t/t2014-checkout-switch.sh
index c138bdde4f..3e757c6e4e 100755
--- a/t/t2014-checkout-switch.sh
+++ b/t/t2014-checkout-switch.sh
@@ -2,7 +2,6 @@
test_description='Peter MacMillan'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t2015-checkout-unborn.sh b/t/t2015-checkout-unborn.sh
index fb0e13881c..1820300c62 100755
--- a/t/t2015-checkout-unborn.sh
+++ b/t/t2015-checkout-unborn.sh
@@ -4,7 +4,6 @@ test_description='checkout from unborn branch'
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' '
diff --git a/t/t2016-checkout-patch.sh b/t/t2016-checkout-patch.sh
index c40b661ac1..c4f9bf09aa 100755
--- a/t/t2016-checkout-patch.sh
+++ b/t/t2016-checkout-patch.sh
@@ -2,7 +2,6 @@
test_description='git checkout --patch'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-patch-mode.sh
test_expect_success 'setup' '
diff --git a/t/t2017-checkout-orphan.sh b/t/t2017-checkout-orphan.sh
index a5c7358eea..80ac661815 100755
--- a/t/t2017-checkout-orphan.sh
+++ b/t/t2017-checkout-orphan.sh
@@ -10,7 +10,6 @@ Main Tests for --orphan functionality.'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
TEST_FILE=foo
diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh
index 43551cc148..a48ebdbf4d 100755
--- a/t/t2018-checkout-branch.sh
+++ b/t/t2018-checkout-branch.sh
@@ -3,7 +3,6 @@
test_description='checkout'
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Arguments: [!] <branch> <oid> [<checkout options>]
diff --git a/t/t2019-checkout-ambiguous-ref.sh b/t/t2019-checkout-ambiguous-ref.sh
index c67261e2b6..1fcef4be95 100755
--- a/t/t2019-checkout-ambiguous-ref.sh
+++ b/t/t2019-checkout-ambiguous-ref.sh
@@ -2,7 +2,6 @@
test_description='checkout handling of ambiguous (branch/tag) refs'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup ambiguous refs' '
diff --git a/t/t2020-checkout-detach.sh b/t/t2020-checkout-detach.sh
index 8d90d02850..28bbbe6c05 100755
--- a/t/t2020-checkout-detach.sh
+++ b/t/t2020-checkout-detach.sh
@@ -4,7 +4,6 @@ test_description='checkout into detached HEAD state'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
check_detached () {
diff --git a/t/t2021-checkout-overwrite.sh b/t/t2021-checkout-overwrite.sh
index ecfacf0f7f..a5c03d5d4a 100755
--- a/t/t2021-checkout-overwrite.sh
+++ b/t/t2021-checkout-overwrite.sh
@@ -2,7 +2,6 @@
test_description='checkout must not overwrite an untracked objects'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t2022-checkout-paths.sh b/t/t2022-checkout-paths.sh
index f1b709d58b..c49ba7f9bd 100755
--- a/t/t2022-checkout-paths.sh
+++ b/t/t2022-checkout-paths.sh
@@ -4,7 +4,6 @@ test_description='checkout $tree -- $paths'
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 '
diff --git a/t/t2023-checkout-m.sh b/t/t2023-checkout-m.sh
index 81e772fb4e..7b327b7544 100755
--- a/t/t2023-checkout-m.sh
+++ b/t/t2023-checkout-m.sh
@@ -7,7 +7,6 @@ Ensures that checkout -m on a resolved file restores the conflicted file'
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 '
diff --git a/t/t2024-checkout-dwim.sh b/t/t2024-checkout-dwim.sh
index 2caada3d83..a3b1449ef1 100755
--- a/t/t2024-checkout-dwim.sh
+++ b/t/t2024-checkout-dwim.sh
@@ -4,7 +4,6 @@ test_description='checkout <branch>
Ensures that checkout on an unborn branch does what the user expects'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Is the current branch "refs/heads/$1"?
diff --git a/t/t2025-checkout-no-overlay.sh b/t/t2025-checkout-no-overlay.sh
index 246609d54d..dda169bbc4 100755
--- a/t/t2025-checkout-no-overlay.sh
+++ b/t/t2025-checkout-no-overlay.sh
@@ -2,7 +2,6 @@
test_description='checkout --no-overlay <tree-ish> -- <pathspec>'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t2026-checkout-pathspec-file.sh b/t/t2026-checkout-pathspec-file.sh
index acd55217a6..161da054b6 100755
--- a/t/t2026-checkout-pathspec-file.sh
+++ b/t/t2026-checkout-pathspec-file.sh
@@ -2,7 +2,6 @@
test_description='checkout --pathspec-from-file'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_tick
diff --git a/t/t2027-checkout-track.sh b/t/t2027-checkout-track.sh
index 98f16c7239..a397790df5 100755
--- a/t/t2027-checkout-track.sh
+++ b/t/t2027-checkout-track.sh
@@ -5,7 +5,6 @@ test_description='tests for git branch --track'
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' '
diff --git a/t/t2030-unresolve-info.sh b/t/t2030-unresolve-info.sh
index b3f6bc97b5..be3fcdde07 100755
--- a/t/t2030-unresolve-info.sh
+++ b/t/t2030-unresolve-info.sh
@@ -5,7 +5,6 @@ test_description='undoing resolution'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
check_resolve_undo () {
diff --git a/t/t2050-git-dir-relative.sh b/t/t2050-git-dir-relative.sh
index 1f193cde96..21f4659a9d 100755
--- a/t/t2050-git-dir-relative.sh
+++ b/t/t2050-git-dir-relative.sh
@@ -12,7 +12,6 @@ into the subdir while keeping the worktree location,
and tries commits from the top and the subdir, checking
that the commit-hook still gets called.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
COMMIT_FILE="$(pwd)/output"
diff --git a/t/t2060-switch.sh b/t/t2060-switch.sh
index 77b2346291..c91c4db936 100755
--- a/t/t2060-switch.sh
+++ b/t/t2060-switch.sh
@@ -5,7 +5,6 @@ test_description='switch 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' '
diff --git a/t/t2070-restore.sh b/t/t2070-restore.sh
index ac404945d4..16d6348b69 100755
--- a/t/t2070-restore.sh
+++ b/t/t2070-restore.sh
@@ -5,7 +5,6 @@ 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' '
diff --git a/t/t2071-restore-patch.sh b/t/t2071-restore-patch.sh
index 42d5522119..27e85be40a 100755
--- a/t/t2071-restore-patch.sh
+++ b/t/t2071-restore-patch.sh
@@ -2,7 +2,6 @@
test_description='git restore --patch'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-patch-mode.sh
test_expect_success 'setup' '
diff --git a/t/t2072-restore-pathspec-file.sh b/t/t2072-restore-pathspec-file.sh
index 86c9c88788..8198a1e578 100755
--- a/t/t2072-restore-pathspec-file.sh
+++ b/t/t2072-restore-pathspec-file.sh
@@ -2,7 +2,6 @@
test_description='restore --pathspec-from-file'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_tick
diff --git a/t/t2080-parallel-checkout-basics.sh b/t/t2080-parallel-checkout-basics.sh
index 59e5570cb2..5ffe1a41e2 100755
--- a/t/t2080-parallel-checkout-basics.sh
+++ b/t/t2080-parallel-checkout-basics.sh
@@ -8,7 +8,6 @@ working tree.
'
TEST_NO_CREATE_REPO=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-parallel-checkout.sh"
diff --git a/t/t2081-parallel-checkout-collisions.sh b/t/t2081-parallel-checkout-collisions.sh
index 6acdb89d12..f6fcfc0c1e 100755
--- a/t/t2081-parallel-checkout-collisions.sh
+++ b/t/t2081-parallel-checkout-collisions.sh
@@ -11,7 +11,6 @@ The tests in this file exercise parallel checkout's collision detection code in
both these mechanics.
"
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-parallel-checkout.sh"
diff --git a/t/t2082-parallel-checkout-attributes.sh b/t/t2082-parallel-checkout-attributes.sh
index d02d6a5550..79fb11f139 100755
--- a/t/t2082-parallel-checkout-attributes.sh
+++ b/t/t2082-parallel-checkout-attributes.sh
@@ -10,7 +10,6 @@ properly (without access to the index or attribute stack).
'
TEST_NO_CREATE_REPO=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-parallel-checkout.sh"
. "$TEST_DIRECTORY/lib-encoding.sh"
diff --git a/t/t2100-update-cache-badpath.sh b/t/t2100-update-cache-badpath.sh
index 7915e7b821..2df3fdde8b 100755
--- a/t/t2100-update-cache-badpath.sh
+++ b/t/t2100-update-cache-badpath.sh
@@ -22,7 +22,6 @@ and tries to git update-index --add the following:
All of the attempts should fail.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
mkdir path2 path3
diff --git a/t/t2101-update-index-reupdate.sh b/t/t2101-update-index-reupdate.sh
index e3c7acdbf9..6c32d42c8c 100755
--- a/t/t2101-update-index-reupdate.sh
+++ b/t/t2101-update-index-reupdate.sh
@@ -6,7 +6,6 @@
test_description='git update-index --again test.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'update-index --add' '
diff --git a/t/t2102-update-index-symlinks.sh b/t/t2102-update-index-symlinks.sh
index c49cdfb6e5..9b11130ab9 100755
--- a/t/t2102-update-index-symlinks.sh
+++ b/t/t2102-update-index-symlinks.sh
@@ -8,7 +8,6 @@ test_description='git update-index on filesystem w/o symlinks test.
This tests that git update-index keeps the symbolic link property
even if a plain file is in the working tree if core.symlinks is false.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success \
diff --git a/t/t2103-update-index-ignore-missing.sh b/t/t2103-update-index-ignore-missing.sh
index e9451cd567..6938ecca86 100755
--- a/t/t2103-update-index-ignore-missing.sh
+++ b/t/t2103-update-index-ignore-missing.sh
@@ -2,7 +2,6 @@
test_description='update-index with options'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success basics '
diff --git a/t/t2104-update-index-skip-worktree.sh b/t/t2104-update-index-skip-worktree.sh
index 7ec7f30b44..7a0778ed98 100755
--- a/t/t2104-update-index-skip-worktree.sh
+++ b/t/t2104-update-index-skip-worktree.sh
@@ -5,7 +5,6 @@
test_description='skip-worktree bit test'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
sane_unset GIT_TEST_SPLIT_INDEX
diff --git a/t/t2105-update-index-gitfile.sh b/t/t2105-update-index-gitfile.sh
index 963ebe77eb..a7f3d47aec 100755
--- a/t/t2105-update-index-gitfile.sh
+++ b/t/t2105-update-index-gitfile.sh
@@ -6,7 +6,6 @@
test_description='git update-index for gitlink to .git file.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'submodule with absolute .git file' '
diff --git a/t/t2106-update-index-assume-unchanged.sh b/t/t2106-update-index-assume-unchanged.sh
index 95c004dc5c..6b2ccc21a9 100755
--- a/t/t2106-update-index-assume-unchanged.sh
+++ b/t/t2106-update-index-assume-unchanged.sh
@@ -3,7 +3,6 @@
test_description='git update-index --assume-unchanged test.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t2107-update-index-basic.sh b/t/t2107-update-index-basic.sh
index f0eab13f96..cc72ead79f 100755
--- a/t/t2107-update-index-basic.sh
+++ b/t/t2107-update-index-basic.sh
@@ -5,7 +5,6 @@ test_description='basic update-index tests
Tests for command-line parsing and basic operation.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'update-index --nonsense fails' '
diff --git a/t/t2108-update-index-refresh-racy.sh b/t/t2108-update-index-refresh-racy.sh
index bc5f2886fa..b31dd8ece5 100755
--- a/t/t2108-update-index-refresh-racy.sh
+++ b/t/t2108-update-index-refresh-racy.sh
@@ -2,7 +2,6 @@
test_description='update-index refresh tests related to racy timestamps'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
reset_files () {
diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh
index df235ac306..06e83d3333 100755
--- a/t/t2200-add-update.sh
+++ b/t/t2200-add-update.sh
@@ -14,7 +14,6 @@ only the updates to dir/sub.
Also tested are "git add -u" without limiting, and "git add -u"
without contents changes, and other conditions'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t2201-add-update-typechange.sh b/t/t2201-add-update-typechange.sh
index dba62d69c6..687be974d4 100755
--- a/t/t2201-add-update-typechange.sh
+++ b/t/t2201-add-update-typechange.sh
@@ -2,7 +2,6 @@
test_description='more git add -u'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t2202-add-addremove.sh b/t/t2202-add-addremove.sh
index 24c60bfd79..9ee659098c 100755
--- a/t/t2202-add-addremove.sh
+++ b/t/t2202-add-addremove.sh
@@ -2,7 +2,6 @@
test_description='git add --all'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh
index 8fa44a92a2..192ad14b5f 100755
--- a/t/t2203-add-intent.sh
+++ b/t/t2203-add-intent.sh
@@ -2,7 +2,6 @@
test_description='Intent to add'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'intent to add' '
diff --git a/t/t2204-add-ignored.sh b/t/t2204-add-ignored.sh
index b7cf1e492c..31eb233df5 100755
--- a/t/t2204-add-ignored.sh
+++ b/t/t2204-add-ignored.sh
@@ -2,7 +2,6 @@
test_description='giving ignored paths to git add'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t2205-add-worktree-config.sh b/t/t2205-add-worktree-config.sh
index 98265ba1b4..43d950de64 100755
--- a/t/t2205-add-worktree-config.sh
+++ b/t/t2205-add-worktree-config.sh
@@ -17,7 +17,6 @@ outside the repository. Two instances for which this can occur are tested:
repository can be added to the index.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success '1a: setup--config worktree' '
diff --git a/t/t2300-cd-to-toplevel.sh b/t/t2300-cd-to-toplevel.sh
index b40eeb263f..c8de6d8a19 100755
--- a/t/t2300-cd-to-toplevel.sh
+++ b/t/t2300-cd-to-toplevel.sh
@@ -2,7 +2,6 @@
test_description='cd_to_toplevel'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
EXEC_PATH="$(git --exec-path)"
diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh
index cfc4aeb179..90638fa886 100755
--- a/t/t2400-worktree-add.sh
+++ b/t/t2400-worktree-add.sh
@@ -6,7 +6,6 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh
@@ -1207,4 +1206,50 @@ test_expect_success '"add" with initialized submodule, with submodule.recurse se
git -C project-clone -c submodule.recurse worktree add ../project-5
'
+test_expect_success 'can create worktrees with relative paths' '
+ test_when_finished "git worktree remove relative" &&
+ test_config worktree.useRelativePaths false &&
+ git worktree add --relative-paths ./relative &&
+ echo "gitdir: ../.git/worktrees/relative" >expect &&
+ test_cmp expect relative/.git &&
+ echo "../../../relative/.git" >expect &&
+ test_cmp expect .git/worktrees/relative/gitdir
+'
+
+test_expect_success 'can create worktrees with absolute paths' '
+ test_config worktree.useRelativePaths true &&
+ git worktree add ./relative &&
+ echo "gitdir: ../.git/worktrees/relative" >expect &&
+ test_cmp expect relative/.git &&
+ git worktree add --no-relative-paths ./absolute &&
+ echo "gitdir: $(pwd)/.git/worktrees/absolute" >expect &&
+ test_cmp expect absolute/.git &&
+ echo "$(pwd)/absolute/.git" >expect &&
+ test_cmp expect .git/worktrees/absolute/gitdir
+'
+
+test_expect_success 'move repo without breaking relative internal links' '
+ test_when_finished rm -rf repo moved &&
+ git init repo &&
+ (
+ cd repo &&
+ test_commit initial &&
+ git worktree add --relative-paths wt1 &&
+ cd .. &&
+ mv repo moved &&
+ cd moved/wt1 &&
+ git worktree list >out 2>err &&
+ test_must_be_empty err
+ )
+'
+
+test_expect_success 'relative worktree sets extension config' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ git -C repo commit --allow-empty -m base &&
+ git -C repo worktree add --relative-paths ./foo &&
+ test_cmp_config -C repo 1 core.repositoryformatversion &&
+ test_cmp_config -C repo true extensions.relativeworktrees
+'
+
test_done
diff --git a/t/t2401-worktree-prune.sh b/t/t2401-worktree-prune.sh
index 976d048e3e..fe671d4197 100755
--- a/t/t2401-worktree-prune.sh
+++ b/t/t2401-worktree-prune.sh
@@ -5,7 +5,6 @@ test_description='prune $GIT_DIR/worktrees'
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 initialize '
@@ -120,11 +119,12 @@ test_expect_success 'prune duplicate (main/linked)' '
! test -d .git/worktrees/wt
'
-test_expect_success 'not prune proper worktrees when run inside linked worktree' '
+test_expect_success 'not prune proper worktrees inside linked worktree with relative paths' '
test_when_finished rm -rf repo wt_ext &&
git init repo &&
(
cd repo &&
+ git config worktree.useRelativePaths true &&
echo content >file &&
git add file &&
git commit -m msg &&
diff --git a/t/t2402-worktree-list.sh b/t/t2402-worktree-list.sh
index 33ea9cb21b..8ef1cad7f2 100755
--- a/t/t2402-worktree-list.sh
+++ b/t/t2402-worktree-list.sh
@@ -5,7 +5,6 @@ test_description='test git worktree list'
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' '
@@ -261,6 +260,7 @@ test_expect_success 'broken main worktree still at the top' '
'
test_expect_success 'linked worktrees are sorted' '
+ test_when_finished "rm -rf sorted" &&
mkdir sorted &&
git init sorted/main &&
(
@@ -280,6 +280,27 @@ test_expect_success 'linked worktrees are sorted' '
test_cmp expected sorted/main/actual
'
+test_expect_success 'linked worktrees with relative paths are shown with absolute paths' '
+ test_when_finished "rm -rf sorted" &&
+ mkdir sorted &&
+ git init sorted/main &&
+ (
+ cd sorted/main &&
+ test_tick &&
+ test_commit new &&
+ git worktree add --relative-paths ../first &&
+ git worktree add ../second &&
+ git worktree list --porcelain >out &&
+ grep ^worktree out >actual
+ ) &&
+ cat >expected <<-EOF &&
+ worktree $(pwd)/sorted/main
+ worktree $(pwd)/sorted/first
+ worktree $(pwd)/sorted/second
+ EOF
+ test_cmp expected sorted/main/actual
+'
+
test_expect_success 'worktree path when called in .git directory' '
git worktree list >list1 &&
git -C .git worktree list >list2 &&
diff --git a/t/t2403-worktree-move.sh b/t/t2403-worktree-move.sh
index 901342ea09..0bb33e8b1b 100755
--- a/t/t2403-worktree-move.sh
+++ b/t/t2403-worktree-move.sh
@@ -2,7 +2,6 @@
test_description='test git worktree move, remove, lock and unlock'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
@@ -247,4 +246,29 @@ test_expect_success 'not remove a repo with initialized submodule' '
)
'
+test_expect_success 'move worktree with absolute path to relative path' '
+ test_config worktree.useRelativePaths false &&
+ git worktree add ./absolute &&
+ git worktree move --relative-paths absolute relative &&
+ echo "gitdir: ../.git/worktrees/absolute" >expect &&
+ test_cmp expect relative/.git &&
+ echo "../../../relative/.git" >expect &&
+ test_cmp expect .git/worktrees/absolute/gitdir &&
+ test_config worktree.useRelativePaths true &&
+ git worktree move relative relative2 &&
+ echo "gitdir: ../.git/worktrees/absolute" >expect &&
+ test_cmp expect relative2/.git &&
+ echo "../../../relative2/.git" >expect &&
+ test_cmp expect .git/worktrees/absolute/gitdir
+'
+
+test_expect_success 'move worktree with relative path to absolute path' '
+ test_config worktree.useRelativePaths true &&
+ git worktree move --no-relative-paths relative2 absolute &&
+ echo "gitdir: $(pwd)/.git/worktrees/absolute" >expect &&
+ test_cmp expect absolute/.git &&
+ echo "$(pwd)/absolute/.git" >expect &&
+ test_cmp expect .git/worktrees/absolute/gitdir
+'
+
test_done
diff --git a/t/t2404-worktree-config.sh b/t/t2404-worktree-config.sh
index 842937bfb9..9536d10919 100755
--- a/t/t2404-worktree-config.sh
+++ b/t/t2404-worktree-config.sh
@@ -2,7 +2,6 @@
test_description="config file in multi worktree"
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t2405-worktree-submodule.sh b/t/t2405-worktree-submodule.sh
index 1d7f605633..11018f37c7 100755
--- a/t/t2405-worktree-submodule.sh
+++ b/t/t2405-worktree-submodule.sh
@@ -5,7 +5,6 @@ test_description='Combination of submodules and multiple worktrees'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
base_path=$(pwd -P)
diff --git a/t/t2406-worktree-repair.sh b/t/t2406-worktree-repair.sh
index 7686e60f6a..f5f19b3169 100755
--- a/t/t2406-worktree-repair.sh
+++ b/t/t2406-worktree-repair.sh
@@ -2,7 +2,6 @@
test_description='test git worktree repair'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
@@ -216,4 +215,43 @@ test_expect_success 'repair copied main and linked worktrees' '
test_cmp dup/linked.expect dup/linked/.git
'
+test_expect_success 'repair worktree with relative path with missing gitfile' '
+ test_when_finished "rm -rf main wt" &&
+ test_create_repo main &&
+ git -C main config worktree.useRelativePaths true &&
+ test_commit -C main init &&
+ git -C main worktree add --detach ../wt &&
+ rm wt/.git &&
+ test_path_is_missing wt/.git &&
+ git -C main worktree repair &&
+ echo "gitdir: ../main/.git/worktrees/wt" >expect &&
+ test_cmp expect wt/.git
+'
+
+test_expect_success 'repair absolute worktree to use relative paths' '
+ test_when_finished "rm -rf main side sidemoved" &&
+ test_create_repo main &&
+ test_commit -C main init &&
+ git -C main worktree add --detach ../side &&
+ echo "../../../../sidemoved/.git" >expect-gitdir &&
+ echo "gitdir: ../main/.git/worktrees/side" >expect-gitfile &&
+ mv side sidemoved &&
+ git -C main worktree repair --relative-paths ../sidemoved &&
+ test_cmp expect-gitdir main/.git/worktrees/side/gitdir &&
+ test_cmp expect-gitfile sidemoved/.git
+'
+
+test_expect_success 'repair relative worktree to use absolute paths' '
+ test_when_finished "rm -rf main side sidemoved" &&
+ test_create_repo main &&
+ test_commit -C main init &&
+ git -C main worktree add --relative-paths --detach ../side &&
+ echo "$(pwd)/sidemoved/.git" >expect-gitdir &&
+ echo "gitdir: $(pwd)/main/.git/worktrees/side" >expect-gitfile &&
+ mv side sidemoved &&
+ git -C main worktree repair ../sidemoved &&
+ test_cmp expect-gitdir main/.git/worktrees/side/gitdir &&
+ test_cmp expect-gitfile sidemoved/.git
+'
+
test_done
diff --git a/t/t2407-worktree-heads.sh b/t/t2407-worktree-heads.sh
index f6835c91dc..57c201869f 100755
--- a/t/t2407-worktree-heads.sh
+++ b/t/t2407-worktree-heads.sh
@@ -2,7 +2,6 @@
test_description='test operations trying to overwrite refs at worktree HEAD'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
@@ -49,7 +48,7 @@ test_expect_success 'refuse to overwrite: checked out in worktree' '
done
'
-test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in bisect' '
+test_expect_success 'refuse to overwrite: worktree in bisect' '
test_when_finished git -C wt-4 bisect reset &&
# Set up a bisect so HEAD no longer points to wt-4.
@@ -61,7 +60,7 @@ test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in bisect' '
grep "cannot force update the branch '\''wt-4'\'' used by worktree at.*wt-4" err
'
-test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase (apply)' '
+test_expect_success 'refuse to overwrite: worktree in rebase (apply)' '
test_when_finished git -C wt-2 rebase --abort &&
# This will fail part-way through due to a conflict.
@@ -71,7 +70,7 @@ test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase (app
grep "cannot force update the branch '\''wt-2'\'' used by worktree at.*wt-2" err
'
-test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase (merge)' '
+test_expect_success 'refuse to overwrite: worktree in rebase (merge)' '
test_when_finished git -C wt-2 rebase --abort &&
# This will fail part-way through due to a conflict.
@@ -81,7 +80,7 @@ test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase (mer
grep "cannot force update the branch '\''wt-2'\'' used by worktree at.*wt-2" err
'
-test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase with --update-refs' '
+test_expect_success 'refuse to overwrite: worktree in rebase with --update-refs' '
test_when_finished git -C wt-3 rebase --abort &&
git branch -f can-be-updated wt-3 &&
@@ -95,7 +94,7 @@ test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase with
done
'
-test_expect_success !SANITIZE_LEAK 'refuse to fetch over ref: checked out' '
+test_expect_success 'refuse to fetch over ref: checked out' '
test_must_fail git fetch server +refs/heads/wt-3:refs/heads/wt-3 2>err &&
grep "refusing to fetch into branch '\''refs/heads/wt-3'\''" err &&
@@ -105,7 +104,7 @@ test_expect_success !SANITIZE_LEAK 'refuse to fetch over ref: checked out' '
grep "refusing to fetch into branch" err
'
-test_expect_success !SANITIZE_LEAK 'refuse to fetch over ref: worktree in bisect' '
+test_expect_success 'refuse to fetch over ref: worktree in bisect' '
test_when_finished git -C wt-4 bisect reset &&
# Set up a bisect so HEAD no longer points to wt-4.
@@ -117,7 +116,7 @@ test_expect_success !SANITIZE_LEAK 'refuse to fetch over ref: worktree in bisect
grep "refusing to fetch into branch" err
'
-test_expect_success !SANITIZE_LEAK 'refuse to fetch over ref: worktree in rebase' '
+test_expect_success 'refuse to fetch over ref: worktree in rebase' '
test_when_finished git -C wt-3 rebase --abort &&
# This will fail part-way through due to a conflict.
@@ -157,7 +156,7 @@ test_expect_success 'refuse to overwrite when in error states' '
. "$TEST_DIRECTORY"/lib-rebase.sh
-test_expect_success !SANITIZE_LEAK 'refuse to overwrite during rebase with --update-refs' '
+test_expect_success 'refuse to overwrite during rebase with --update-refs' '
git commit --fixup HEAD~2 --allow-empty &&
(
set_cat_todo_editor &&
diff --git a/t/t2408-worktree-relative.sh b/t/t2408-worktree-relative.sh
deleted file mode 100755
index a3136db7e2..0000000000
--- a/t/t2408-worktree-relative.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-test_description='test worktrees linked with relative paths'
-
-TEST_PASSES_SANITIZE_LEAK=true
-. ./test-lib.sh
-
-test_expect_success 'links worktrees with relative paths' '
- test_when_finished rm -rf repo &&
- git init repo &&
- (
- cd repo &&
- test_commit initial &&
- git worktree add wt1 &&
- echo "../../../wt1/.git" >expected_gitdir &&
- cat .git/worktrees/wt1/gitdir >actual_gitdir &&
- echo "gitdir: ../.git/worktrees/wt1" >expected_git &&
- cat wt1/.git >actual_git &&
- test_cmp expected_gitdir actual_gitdir &&
- test_cmp expected_git actual_git
- )
-'
-
-test_expect_success 'move repo without breaking relative internal links' '
- test_when_finished rm -rf repo moved &&
- git init repo &&
- (
- cd repo &&
- test_commit initial &&
- git worktree add wt1 &&
- cd .. &&
- mv repo moved &&
- cd moved/wt1 &&
- git status >out 2>err &&
- test_must_be_empty err
- )
-'
-
-test_done
diff --git a/t/t2500-untracked-overwriting.sh b/t/t2500-untracked-overwriting.sh
index 714feb83be..5c0bf4d21f 100755
--- a/t/t2500-untracked-overwriting.sh
+++ b/t/t2500-untracked-overwriting.sh
@@ -2,7 +2,6 @@
test_description='Test handling of overwriting untracked files'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_setup_reset () {
diff --git a/t/t2501-cwd-empty.sh b/t/t2501-cwd-empty.sh
index 8af4e8cfe3..f6d8d7d03d 100755
--- a/t/t2501-cwd-empty.sh
+++ b/t/t2501-cwd-empty.sh
@@ -2,7 +2,6 @@
test_description='Test handling of the current working directory becoming empty'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh
index 11af4552f7..13f66fd649 100755
--- a/t/t3000-ls-files-others.sh
+++ b/t/t3000-ls-files-others.sh
@@ -16,7 +16,6 @@ filesystem.
path4 - an empty directory
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup ' '
diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh
index 1ed0aa967e..4b67646285 100755
--- a/t/t3001-ls-files-others-exclude.sh
+++ b/t/t3001-ls-files-others-exclude.sh
@@ -8,7 +8,6 @@ test_description='git ls-files --others --exclude
This test runs git ls-files --others and tests --exclude patterns.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
rm -fr one three
diff --git a/t/t3002-ls-files-dashpath.sh b/t/t3002-ls-files-dashpath.sh
index 4dd24550eb..31462cb441 100755
--- a/t/t3002-ls-files-dashpath.sh
+++ b/t/t3002-ls-files-dashpath.sh
@@ -13,7 +13,6 @@ filesystem.
-- - another file with a funny name.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3003-ls-files-exclude.sh b/t/t3003-ls-files-exclude.sh
index 7933dff9b3..ac3c811f46 100755
--- a/t/t3003-ls-files-exclude.sh
+++ b/t/t3003-ls-files-exclude.sh
@@ -2,7 +2,6 @@
test_description='ls-files --exclude does not affect index files'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'create repo with file' '
diff --git a/t/t3004-ls-files-basic.sh b/t/t3004-ls-files-basic.sh
index 12e41a7b40..a1078f8701 100755
--- a/t/t3004-ls-files-basic.sh
+++ b/t/t3004-ls-files-basic.sh
@@ -6,7 +6,6 @@ This test runs git ls-files with various unusual or malformed
command-line arguments.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'ls-files in empty repository' '
diff --git a/t/t3005-ls-files-relative.sh b/t/t3005-ls-files-relative.sh
index fbfa210a50..db13aabf62 100755
--- a/t/t3005-ls-files-relative.sh
+++ b/t/t3005-ls-files-relative.sh
@@ -5,7 +5,6 @@ test_description='ls-files tests with relative paths
This test runs git ls-files with various relative path arguments.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'prepare' '
diff --git a/t/t3006-ls-files-long.sh b/t/t3006-ls-files-long.sh
index 2aaf91ebc8..22c7256c3a 100755
--- a/t/t3006-ls-files-long.sh
+++ b/t/t3006-ls-files-long.sh
@@ -2,7 +2,6 @@
test_description='overly long paths'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t3007-ls-files-recurse-submodules.sh b/t/t3007-ls-files-recurse-submodules.sh
index f04bdc8c78..61771eec83 100755
--- a/t/t3007-ls-files-recurse-submodules.sh
+++ b/t/t3007-ls-files-recurse-submodules.sh
@@ -6,7 +6,6 @@ This test verifies the recurse-submodules feature correctly lists files from
submodules.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup directory structure and submodules' '
diff --git a/t/t3008-ls-files-lazy-init-name-hash.sh b/t/t3008-ls-files-lazy-init-name-hash.sh
index 51d3dffaa6..85f3704958 100755
--- a/t/t3008-ls-files-lazy-init-name-hash.sh
+++ b/t/t3008-ls-files-lazy-init-name-hash.sh
@@ -2,7 +2,6 @@
test_description='Test the lazy init name hash with various folder structures'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
if test 1 -eq $(test-tool online-cpus)
diff --git a/t/t3009-ls-files-others-nonsubmodule.sh b/t/t3009-ls-files-others-nonsubmodule.sh
index 14218b3424..963f3462b7 100755
--- a/t/t3009-ls-files-others-nonsubmodule.sh
+++ b/t/t3009-ls-files-others-nonsubmodule.sh
@@ -18,7 +18,6 @@ This test runs git ls-files --others with the following working tree:
git repository with a commit and an untracked file
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup: directories' '
diff --git a/t/t3010-ls-files-killed-modified.sh b/t/t3010-ls-files-killed-modified.sh
index 054178703d..7af4532cd1 100755
--- a/t/t3010-ls-files-killed-modified.sh
+++ b/t/t3010-ls-files-killed-modified.sh
@@ -42,7 +42,6 @@ We should report path0, path1, path2/file2, path3/file3, path7 and path8
modified without reporting path9 and path10. submod1 is also modified.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'git update-index --add to add various paths.' '
diff --git a/t/t3011-common-prefixes-and-directory-traversal.sh b/t/t3011-common-prefixes-and-directory-traversal.sh
index 69e44c387f..3da5b2b6e7 100755
--- a/t/t3011-common-prefixes-and-directory-traversal.sh
+++ b/t/t3011-common-prefixes-and-directory-traversal.sh
@@ -2,7 +2,6 @@
test_description='directory traversal handling, especially with common prefixes'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3012-ls-files-dedup.sh b/t/t3012-ls-files-dedup.sh
index 190e2f6eed..2682b1f43a 100755
--- a/t/t3012-ls-files-dedup.sh
+++ b/t/t3012-ls-files-dedup.sh
@@ -2,7 +2,6 @@
test_description='git ls-files --deduplicate test'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3013-ls-files-format.sh b/t/t3013-ls-files-format.sh
index 6e6ea0b6f3..8bdaacd85a 100755
--- a/t/t3013-ls-files-format.sh
+++ b/t/t3013-ls-files-format.sh
@@ -2,7 +2,6 @@
test_description='git ls-files --format test'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
for flag in -s -o -k -t --resolve-undo --deduplicate --eol
diff --git a/t/t3020-ls-files-error-unmatch.sh b/t/t3020-ls-files-error-unmatch.sh
index 133593d23c..ac82c9cee8 100755
--- a/t/t3020-ls-files-error-unmatch.sh
+++ b/t/t3020-ls-files-error-unmatch.sh
@@ -10,7 +10,6 @@ returns an error when a non-existent path is provided on the command
line.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3040-subprojects-basic.sh b/t/t3040-subprojects-basic.sh
index bd65dfcffc..768d702fbb 100755
--- a/t/t3040-subprojects-basic.sh
+++ b/t/t3040-subprojects-basic.sh
@@ -2,7 +2,6 @@
test_description='Basic subproject functionality'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup: create superproject' '
diff --git a/t/t3050-subprojects-fetch.sh b/t/t3050-subprojects-fetch.sh
index 3884694165..f1f09abdd9 100755
--- a/t/t3050-subprojects-fetch.sh
+++ b/t/t3050-subprojects-fetch.sh
@@ -2,7 +2,6 @@
test_description='fetching and pushing project with subproject'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t3060-ls-files-with-tree.sh b/t/t3060-ls-files-with-tree.sh
index 5a06732ca7..eb69da61fe 100755
--- a/t/t3060-ls-files-with-tree.sh
+++ b/t/t3060-ls-files-with-tree.sh
@@ -9,7 +9,6 @@ This test runs git ls-files --with-tree and in particular in
a scenario known to trigger a crash with some versions of git.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh
index 4dd42df38c..3da824117c 100755
--- a/t/t3070-wildmatch.sh
+++ b/t/t3070-wildmatch.sh
@@ -2,7 +2,6 @@
test_description='wildmatch tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
should_create_test_file() {
diff --git a/t/t3100-ls-tree-restrict.sh b/t/t3100-ls-tree-restrict.sh
index 436de44971..8f294d9832 100755
--- a/t/t3100-ls-tree-restrict.sh
+++ b/t/t3100-ls-tree-restrict.sh
@@ -17,7 +17,6 @@ The new path restriction code should do the right thing for path2 and
path2/baz. Also path0/ should snow nothing.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success \
diff --git a/t/t3101-ls-tree-dirname.sh b/t/t3101-ls-tree-dirname.sh
index 5af2dac0e4..ac44525810 100755
--- a/t/t3101-ls-tree-dirname.sh
+++ b/t/t3101-ls-tree-dirname.sh
@@ -20,7 +20,6 @@ Test the handling of multiple directories which have matching file
entries. Also test odd filename and missing entries handling.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3102-ls-tree-wildcards.sh b/t/t3102-ls-tree-wildcards.sh
index 3942db2290..1e16c6b8ea 100755
--- a/t/t3102-ls-tree-wildcards.sh
+++ b/t/t3102-ls-tree-wildcards.sh
@@ -2,7 +2,6 @@
test_description='ls-tree with(out) globs'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3103-ls-tree-misc.sh b/t/t3103-ls-tree-misc.sh
index 81c6343962..e7636f6908 100755
--- a/t/t3103-ls-tree-misc.sh
+++ b/t/t3103-ls-tree-misc.sh
@@ -7,7 +7,6 @@ Miscellaneous tests for git ls-tree.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3104-ls-tree-format.sh b/t/t3104-ls-tree-format.sh
index 3adb206a93..a1b2069a25 100755
--- a/t/t3104-ls-tree-format.sh
+++ b/t/t3104-ls-tree-format.sh
@@ -2,7 +2,6 @@
test_description='ls-tree --format'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-t3100.sh
diff --git a/t/t3105-ls-tree-output.sh b/t/t3105-ls-tree-output.sh
index ce2391e28b..8bdf400682 100755
--- a/t/t3105-ls-tree-output.sh
+++ b/t/t3105-ls-tree-output.sh
@@ -2,7 +2,6 @@
test_description='ls-tree output'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-t3100.sh
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index ccfa6a720d..a3a21c54cf 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -8,7 +8,6 @@ test_description='git branch assorted tests'
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-rebase.sh
@@ -1697,7 +1696,7 @@ 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"
+ hint: Disable this message with "git config set advice.refSyntax false"
EOF
test_must_fail git branch foo..bar >actual 2>&1 &&
test_cmp expect actual
diff --git a/t/t3201-branch-contains.sh b/t/t3201-branch-contains.sh
index 6e587d27d7..800fc33165 100755
--- a/t/t3201-branch-contains.sh
+++ b/t/t3201-branch-contains.sh
@@ -2,7 +2,6 @@
test_description='branch --contains <commit>, --no-contains <commit> --merged, and --no-merged'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t3202-show-branch.sh b/t/t3202-show-branch.sh
index 3b6dad0c46..a1139f79e2 100755
--- a/t/t3202-show-branch.sh
+++ b/t/t3202-show-branch.sh
@@ -2,7 +2,6 @@
test_description='test show-branch'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'error descriptions on empty repository' '
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index e627f08a17..500c9d0e72 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -2,7 +2,6 @@
test_description='git branch display tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-terminal.sh
diff --git a/t/t3204-branch-name-interpretation.sh b/t/t3204-branch-name-interpretation.sh
index 594e3e43e1..3399344f25 100755
--- a/t/t3204-branch-name-interpretation.sh
+++ b/t/t3204-branch-name-interpretation.sh
@@ -9,7 +9,6 @@ This script aims to check the behavior of those corner cases.
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
expect_branch() {
diff --git a/t/t3205-branch-color.sh b/t/t3205-branch-color.sh
index 0b61da92b3..da1c202fa7 100755
--- a/t/t3205-branch-color.sh
+++ b/t/t3205-branch-color.sh
@@ -1,7 +1,6 @@
#!/bin/sh
test_description='basic branch output coloring'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'set up some sample branches' '
diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
index 86010931ab..d2ca43d6aa 100755
--- a/t/t3206-range-diff.sh
+++ b/t/t3206-range-diff.sh
@@ -5,7 +5,6 @@ test_description='range-diff tests'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Note that because of the range-diff's heuristics, test_commit does more
diff --git a/t/t3207-branch-submodule.sh b/t/t3207-branch-submodule.sh
index 904eea7df5..fe72b24716 100755
--- a/t/t3207-branch-submodule.sh
+++ b/t/t3207-branch-submodule.sh
@@ -5,7 +5,6 @@ test_description='git branch submodule tests'
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-rebase.sh
diff --git a/t/t3211-peel-ref.sh b/t/t3211-peel-ref.sh
index 9cbc34fc58..37b9d26f4b 100755
--- a/t/t3211-peel-ref.sh
+++ b/t/t3211-peel-ref.sh
@@ -4,7 +4,6 @@ test_description='tests for the peel_ref optimization of packed-refs'
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 'create annotated tag in refs/tags' '
diff --git a/t/t3300-funny-names.sh b/t/t3300-funny-names.sh
index d3ac826283..f5bf16abcd 100755
--- a/t/t3300-funny-names.sh
+++ b/t/t3300-funny-names.sh
@@ -9,7 +9,6 @@ This test tries pathnames with funny characters in the working
tree, index, and tree objects.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
HT=' '
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index 813dfd8db9..d6c50460d0 100755
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
@@ -5,7 +5,6 @@
test_description='Test commit notes'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
write_script fake_editor <<\EOF
diff --git a/t/t3302-notes-index-expensive.sh b/t/t3302-notes-index-expensive.sh
index d0c4d38b4d..bb5fea02a0 100755
--- a/t/t3302-notes-index-expensive.sh
+++ b/t/t3302-notes-index-expensive.sh
@@ -8,7 +8,6 @@ test_description='Test commit notes index (expensive!)'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
create_repo () {
diff --git a/t/t3303-notes-subtrees.sh b/t/t3303-notes-subtrees.sh
index bc9b791d1b..eac193757b 100755
--- a/t/t3303-notes-subtrees.sh
+++ b/t/t3303-notes-subtrees.sh
@@ -5,7 +5,6 @@ test_description='Test commit notes organized in subtrees'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
number_of_commits=100
diff --git a/t/t3304-notes-mixed.sh b/t/t3304-notes-mixed.sh
index 2c3a245266..03dfcd3954 100755
--- a/t/t3304-notes-mixed.sh
+++ b/t/t3304-notes-mixed.sh
@@ -5,7 +5,6 @@ test_description='Test notes trees that also contain non-notes'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
number_of_commits=100
diff --git a/t/t3305-notes-fanout.sh b/t/t3305-notes-fanout.sh
index 1ec1fb6715..fcecdc94ff 100755
--- a/t/t3305-notes-fanout.sh
+++ b/t/t3305-notes-fanout.sh
@@ -2,7 +2,6 @@
test_description='Test that adding/removing many notes triggers automatic fanout restructuring'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
path_has_fanout() {
diff --git a/t/t3306-notes-prune.sh b/t/t3306-notes-prune.sh
index b6e9f643e3..8f4102ff9e 100755
--- a/t/t3306-notes-prune.sh
+++ b/t/t3306-notes-prune.sh
@@ -2,7 +2,6 @@
test_description='Test git notes prune'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup: create a few commits with notes' '
diff --git a/t/t3307-notes-man.sh b/t/t3307-notes-man.sh
index ae316502c4..1aa366a410 100755
--- a/t/t3307-notes-man.sh
+++ b/t/t3307-notes-man.sh
@@ -4,7 +4,6 @@ test_description='Examples from the git-notes man page
Make sure the manual is not full of lies.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3308-notes-merge.sh b/t/t3308-notes-merge.sh
index e1d05ff6bc..202702be1a 100755
--- a/t/t3308-notes-merge.sh
+++ b/t/t3308-notes-merge.sh
@@ -5,7 +5,6 @@
test_description='Test merging of notes trees'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t3309-notes-merge-auto-resolve.sh b/t/t3309-notes-merge-auto-resolve.sh
index f55277f499..9bd5dbf341 100755
--- a/t/t3309-notes-merge-auto-resolve.sh
+++ b/t/t3309-notes-merge-auto-resolve.sh
@@ -5,7 +5,6 @@
test_description='Test notes merging with auto-resolving strategies'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Set up a notes merge scenario with all kinds of potential conflicts
diff --git a/t/t3310-notes-merge-manual-resolve.sh b/t/t3310-notes-merge-manual-resolve.sh
index 04866b89be..597df5ebc0 100755
--- a/t/t3310-notes-merge-manual-resolve.sh
+++ b/t/t3310-notes-merge-manual-resolve.sh
@@ -5,7 +5,6 @@
test_description='Test notes merging with manual conflict resolution'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Set up a notes merge scenario with different kinds of conflicts
diff --git a/t/t3311-notes-merge-fanout.sh b/t/t3311-notes-merge-fanout.sh
index ce4144db0f..5b675417e9 100755
--- a/t/t3311-notes-merge-fanout.sh
+++ b/t/t3311-notes-merge-fanout.sh
@@ -5,7 +5,6 @@
test_description='Test notes merging at various fanout levels'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
verify_notes () {
diff --git a/t/t3320-notes-merge-worktrees.sh b/t/t3320-notes-merge-worktrees.sh
index 0fd33280cf..96243b7222 100755
--- a/t/t3320-notes-merge-worktrees.sh
+++ b/t/t3320-notes-merge-worktrees.sh
@@ -8,7 +8,6 @@ test_description='Test merging of notes trees in multiple worktrees'
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 commit' '
diff --git a/t/t3321-notes-stripspace.sh b/t/t3321-notes-stripspace.sh
index beca346056..c4a7839540 100755
--- a/t/t3321-notes-stripspace.sh
+++ b/t/t3321-notes-stripspace.sh
@@ -5,7 +5,6 @@
test_description='Test commit notes with stripspace behavior'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
MULTI_LF="$LF$LF$LF"
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 09f230eefb..c0c00fbb7b 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -11,7 +11,6 @@ among other things.
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
GIT_AUTHOR_NAME=author@name
@@ -456,4 +455,23 @@ test_expect_success 'rebase when inside worktree subdirectory' '
)
'
+test_expect_success 'git rebase --update-ref with core.commentChar and branch on worktree' '
+ test_when_finished git branch -D base topic2 &&
+ test_when_finished git checkout main &&
+ test_when_finished git branch -D wt-topic &&
+ test_when_finished git worktree remove wt-topic &&
+ git checkout main &&
+ git checkout -b base &&
+ git checkout -b topic2 &&
+ test_commit msg2 &&
+ git worktree add wt-topic &&
+ git checkout base &&
+ test_commit msg3 &&
+ git checkout topic2 &&
+ GIT_SEQUENCE_EDITOR="cat >actual" git -c core.commentChar=% \
+ rebase -i --update-refs base &&
+ test_grep "% Ref refs/heads/wt-topic checked out at" actual &&
+ test_grep "% Ref refs/heads/topic2 checked out at" actual
+'
+
test_done
diff --git a/t/t3401-rebase-and-am-rename.sh b/t/t3401-rebase-and-am-rename.sh
index 328c1d3a3f..f18bae9450 100755
--- a/t/t3401-rebase-and-am-rename.sh
+++ b/t/t3401-rebase-and-am-rename.sh
@@ -2,7 +2,6 @@
test_description='git rebase + directory rename tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh
diff --git a/t/t3402-rebase-merge.sh b/t/t3402-rebase-merge.sh
index 5c67d07ba3..761de63b6b 100755
--- a/t/t3402-rebase-merge.sh
+++ b/t/t3402-rebase-merge.sh
@@ -8,7 +8,6 @@ test_description='git rebase --merge test'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
T="A quick brown fox
diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh
index 4f1d6e8ea6..a1911c4a9d 100755
--- a/t/t3403-rebase-skip.sh
+++ b/t/t3403-rebase-skip.sh
@@ -8,7 +8,6 @@ test_description='git rebase --merge --skip tests'
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-rebase.sh
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 77cceda14a..ecfc02062c 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -26,7 +26,6 @@ Initial setup:
touch file "conflict".
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh
@@ -2259,20 +2258,20 @@ test_expect_success 'non-merge commands reject merge commits' '
error: ${SQ}pick${SQ} does not accept merge commits
hint: ${SQ}pick${SQ} does not take a merge commit. If you wanted to
hint: replay the merge, use ${SQ}merge -C${SQ} on the commit.
- hint: Disable this message with "git config advice.rebaseTodoError false"
+ hint: Disable this message with "git config set advice.rebaseTodoError false"
error: invalid line 1: pick $oid
error: ${SQ}reword${SQ} does not accept merge commits
hint: ${SQ}reword${SQ} does not take a merge commit. If you wanted to
hint: replay the merge and reword the commit message, use
hint: ${SQ}merge -c${SQ} on the commit
- hint: Disable this message with "git config advice.rebaseTodoError false"
+ hint: Disable this message with "git config set advice.rebaseTodoError false"
error: invalid line 2: reword $oid
error: ${SQ}edit${SQ} does not accept merge commits
hint: ${SQ}edit${SQ} does not take a merge commit. If you wanted to
hint: replay the merge, use ${SQ}merge -C${SQ} on the commit, and then
hint: ${SQ}break${SQ} to give the control back to you so that you can
hint: do ${SQ}git commit --amend && git rebase --continue${SQ}.
- hint: Disable this message with "git config advice.rebaseTodoError false"
+ hint: Disable this message with "git config set advice.rebaseTodoError false"
error: invalid line 3: edit $oid
error: cannot squash merge commit into another commit
error: invalid line 4: fixup $oid
diff --git a/t/t3405-rebase-malformed.sh b/t/t3405-rebase-malformed.sh
index 8979bc3407..2524331861 100755
--- a/t/t3405-rebase-malformed.sh
+++ b/t/t3405-rebase-malformed.sh
@@ -5,7 +5,6 @@ test_description='rebase should handle arbitrary git message'
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-rebase.sh
diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh
index 82108b67e6..a1d7fa7f7c 100755
--- a/t/t3406-rebase-message.sh
+++ b/t/t3406-rebase-message.sh
@@ -5,7 +5,6 @@ test_description='messages from rebase operation'
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' '
diff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh
index 2c3f38d45a..9f49c4228b 100755
--- a/t/t3407-rebase-abort.sh
+++ b/t/t3407-rebase-abort.sh
@@ -5,7 +5,6 @@ test_description='git rebase --abort tests'
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 '
diff --git a/t/t3408-rebase-multi-line.sh b/t/t3408-rebase-multi-line.sh
index 7b4607d72f..cde3562e3a 100755
--- a/t/t3408-rebase-multi-line.sh
+++ b/t/t3408-rebase-multi-line.sh
@@ -5,7 +5,6 @@ test_description='rebasing a commit with multi-line first paragraph.'
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 '
diff --git a/t/t3409-rebase-environ.sh b/t/t3409-rebase-environ.sh
index acaf5558db..83ffb39d9f 100755
--- a/t/t3409-rebase-environ.sh
+++ b/t/t3409-rebase-environ.sh
@@ -2,7 +2,6 @@
test_description='git rebase interactive environment'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3412-rebase-root.sh b/t/t3412-rebase-root.sh
index e75b3d0e07..58371d8a54 100755
--- a/t/t3412-rebase-root.sh
+++ b/t/t3412-rebase-root.sh
@@ -7,7 +7,6 @@ Tests if git rebase --root --onto <newparent> can rebase the root commit.
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
log_with_names () {
diff --git a/t/t3413-rebase-hook.sh b/t/t3413-rebase-hook.sh
index 426ff098e1..b4ff614987 100755
--- a/t/t3413-rebase-hook.sh
+++ b/t/t3413-rebase-hook.sh
@@ -5,7 +5,6 @@ test_description='git rebase with its hook(s)'
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 '
diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh
index 22452ff84c..fcc40d6fe1 100755
--- a/t/t3415-rebase-autosquash.sh
+++ b/t/t3415-rebase-autosquash.sh
@@ -5,7 +5,6 @@ test_description='auto squash'
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-rebase.sh
diff --git a/t/t3416-rebase-onto-threedots.sh b/t/t3416-rebase-onto-threedots.sh
index f8c4ed78c9..ea501f2b42 100755
--- a/t/t3416-rebase-onto-threedots.sh
+++ b/t/t3416-rebase-onto-threedots.sh
@@ -5,7 +5,6 @@ test_description='git rebase --onto A...B'
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-rebase.sh"
diff --git a/t/t3417-rebase-whitespace-fix.sh b/t/t3417-rebase-whitespace-fix.sh
index 22ee3a2045..96f2cf22fa 100755
--- a/t/t3417-rebase-whitespace-fix.sh
+++ b/t/t3417-rebase-whitespace-fix.sh
@@ -5,7 +5,6 @@ test_description='git rebase --whitespace=fix
This test runs git rebase --whitespace=fix and make sure that it works.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# prepare initial revision of "file" with a blank line at the end
diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh
index c0d29c2154..127216f722 100755
--- a/t/t3418-rebase-continue.sh
+++ b/t/t3418-rebase-continue.sh
@@ -5,7 +5,6 @@ test_description='git rebase --continue tests'
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-rebase.sh
diff --git a/t/t3419-rebase-patch-id.sh b/t/t3419-rebase-patch-id.sh
index 6c61f240cf..7181f176b8 100755
--- a/t/t3419-rebase-patch-id.sh
+++ b/t/t3419-rebase-patch-id.sh
@@ -5,7 +5,6 @@ test_description='git rebase - test patch id computation'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
scramble () {
diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh
index b43046b3b0..ad3ba6a984 100755
--- a/t/t3420-rebase-autostash.sh
+++ b/t/t3420-rebase-autostash.sh
@@ -7,7 +7,6 @@ test_description='git rebase --autostash tests'
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 '
diff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh
index 737af80bb3..f5b7807abd 100755
--- a/t/t3421-rebase-topology-linear.sh
+++ b/t/t3421-rebase-topology-linear.sh
@@ -2,7 +2,6 @@
test_description='basic rebase topology tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh
diff --git a/t/t3422-rebase-incompatible-options.sh b/t/t3422-rebase-incompatible-options.sh
index b40f26250b..b9408f9ba1 100755
--- a/t/t3422-rebase-incompatible-options.sh
+++ b/t/t3422-rebase-incompatible-options.sh
@@ -2,7 +2,6 @@
test_description='test if rebase detects and aborts on incompatible options'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3423-rebase-reword.sh b/t/t3423-rebase-reword.sh
index 2fab703d61..4859bb8f72 100755
--- a/t/t3423-rebase-reword.sh
+++ b/t/t3423-rebase-reword.sh
@@ -2,7 +2,6 @@
test_description='git rebase interactive with rewording'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh
diff --git a/t/t3424-rebase-empty.sh b/t/t3424-rebase-empty.sh
index 515c949ae3..1ee6b00fd5 100755
--- a/t/t3424-rebase-empty.sh
+++ b/t/t3424-rebase-empty.sh
@@ -2,7 +2,6 @@
test_description='git rebase of commits that start or become empty'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup test repository' '
diff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh
index a16428bdf5..675491234a 100755
--- a/t/t3425-rebase-topology-merges.sh
+++ b/t/t3425-rebase-topology-merges.sh
@@ -2,7 +2,6 @@
test_description='rebase topology tests with merges'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh
diff --git a/t/t3426-rebase-submodule.sh b/t/t3426-rebase-submodule.sh
index 94ea88e384..ba069dccbd 100755
--- a/t/t3426-rebase-submodule.sh
+++ b/t/t3426-rebase-submodule.sh
@@ -2,7 +2,6 @@
test_description='rebase can handle submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh
. "$TEST_DIRECTORY"/lib-rebase.sh
diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh
index 5e9046e3df..1b3e97c875 100755
--- a/t/t3427-rebase-subtree.sh
+++ b/t/t3427-rebase-subtree.sh
@@ -7,7 +7,6 @@ This test runs git rebase and tests the subtree strategy.
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-rebase.sh
diff --git a/t/t3428-rebase-signoff.sh b/t/t3428-rebase-signoff.sh
index 365436ebfc..6f57aed9fa 100755
--- a/t/t3428-rebase-signoff.sh
+++ b/t/t3428-rebase-signoff.sh
@@ -5,7 +5,6 @@ test_description='git rebase --signoff
This test runs git rebase --signoff and make sure that it works.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh
diff --git a/t/t3429-rebase-edit-todo.sh b/t/t3429-rebase-edit-todo.sh
index 8e0d03969a..abd66f3602 100755
--- a/t/t3429-rebase-edit-todo.sh
+++ b/t/t3429-rebase-edit-todo.sh
@@ -2,7 +2,6 @@
test_description='rebase should reread the todo file if an exec modifies it'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh
diff --git a/t/t3430-rebase-merges.sh b/t/t3430-rebase-merges.sh
index cb891eeb5f..2593711fec 100755
--- a/t/t3430-rebase-merges.sh
+++ b/t/t3430-rebase-merges.sh
@@ -21,7 +21,6 @@ Initial setup:
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-rebase.sh
. "$TEST_DIRECTORY"/lib-log-graph.sh
diff --git a/t/t3431-rebase-fork-point.sh b/t/t3431-rebase-fork-point.sh
index 7b9c135c6e..be09fc78c1 100755
--- a/t/t3431-rebase-fork-point.sh
+++ b/t/t3431-rebase-fork-point.sh
@@ -8,7 +8,6 @@ test_description='git rebase --fork-point test'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# A---B---D---E (main)
diff --git a/t/t3432-rebase-fast-forward.sh b/t/t3432-rebase-fast-forward.sh
index 7f1a5dd3de..5086e14c02 100755
--- a/t/t3432-rebase-fast-forward.sh
+++ b/t/t3432-rebase-fast-forward.sh
@@ -8,7 +8,6 @@ test_description='ensure rebase fast-forwards commits when possible'
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 '
diff --git a/t/t3433-rebase-across-mode-change.sh b/t/t3433-rebase-across-mode-change.sh
index c8172b0852..05df964670 100755
--- a/t/t3433-rebase-across-mode-change.sh
+++ b/t/t3433-rebase-across-mode-change.sh
@@ -2,7 +2,6 @@
test_description='git rebase across mode change'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3434-rebase-i18n.sh b/t/t3434-rebase-i18n.sh
index 97fc9a23f2..8c94fdffc4 100755
--- a/t/t3434-rebase-i18n.sh
+++ b/t/t3434-rebase-i18n.sh
@@ -17,7 +17,6 @@ Initial setup:
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 ICONV
diff --git a/t/t3435-rebase-gpg-sign.sh b/t/t3435-rebase-gpg-sign.sh
index 6e329fea7c..6aa2aeb628 100755
--- a/t/t3435-rebase-gpg-sign.sh
+++ b/t/t3435-rebase-gpg-sign.sh
@@ -8,7 +8,6 @@ test_description='test rebase --[no-]gpg-sign'
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-rebase.sh"
. "$TEST_DIRECTORY/lib-gpg.sh"
diff --git a/t/t3436-rebase-more-options.sh b/t/t3436-rebase-more-options.sh
index 4d9744e5fc..94671d3c46 100755
--- a/t/t3436-rebase-more-options.sh
+++ b/t/t3436-rebase-more-options.sh
@@ -5,7 +5,6 @@
test_description='tests to ensure compatibility between am and interactive backends'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh
diff --git a/t/t3437-rebase-fixup-options.sh b/t/t3437-rebase-fixup-options.sh
index 7929e2e2e3..5d306a4769 100755
--- a/t/t3437-rebase-fixup-options.sh
+++ b/t/t3437-rebase-fixup-options.sh
@@ -14,7 +14,6 @@ to the "fixup" command that works with "fixup!", "fixup -C" works with
"amend!" upon --autosquash.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh
@@ -127,6 +126,21 @@ test_expect_success 'fixup -C with conflicts gives correct message' '
test_cmp expected-author actual-author
'
+test_expect_success 'conflicting fixup -C after fixup with custom comment string' '
+ test_config core.commentString COMMENT &&
+ test_when_finished "test_might_fail git rebase --abort" &&
+ git checkout --detach A3 &&
+ test_must_fail env FAKE_LINES="1 fixup 2 fixup_-C 4" git rebase -i A &&
+ echo resolved >A &&
+ git add A &&
+ FAKE_COMMIT_AMEND=edited git rebase --continue &&
+ test_commit_message HEAD <<-\EOF
+ A3
+
+ edited
+ EOF
+'
+
test_expect_success 'skipping fixup -C after fixup gives correct message' '
test_when_finished "test_might_fail git rebase --abort" &&
git checkout --detach A3 &&
diff --git a/t/t3438-rebase-broken-files.sh b/t/t3438-rebase-broken-files.sh
index 821f08e5af..78d42f4c79 100755
--- a/t/t3438-rebase-broken-files.sh
+++ b/t/t3438-rebase-broken-files.sh
@@ -2,7 +2,6 @@
test_description='rebase behavior when on-disk files are broken'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'set up conflicting branches' '
diff --git a/t/t3500-cherry.sh b/t/t3500-cherry.sh
index 61ca87512d..78c3eac54b 100755
--- a/t/t3500-cherry.sh
+++ b/t/t3500-cherry.sh
@@ -11,7 +11,6 @@ checks that git cherry only returns the second patch in the local branch
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
GIT_AUTHOR_EMAIL=bogus_email_address
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index 411027fb58..8025a28cfd 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -5,7 +5,6 @@ test_description='miscellaneous basic tests for cherry-pick and revert'
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 '
@@ -178,7 +177,7 @@ test_expect_success 'advice from failed revert' '
hint: You can instead skip this commit with "git revert --skip".
hint: To abort and get back to the state before "git revert",
hint: run "git revert --abort".
- hint: Disable this message with "git config advice.mergeConflict false"
+ hint: Disable this message with "git config set advice.mergeConflict false"
EOF
test_commit --append --no-tag "double-add dream" dream dream &&
test_must_fail git revert HEAD^ 2>actual &&
@@ -228,6 +227,20 @@ test_expect_success 'identification of reverted commit (--reference)' '
test_cmp expect actual
'
+test_expect_success 'git revert --reference with core.commentChar' '
+ test_when_finished "git reset --hard to-ident" &&
+ git checkout --detach to-ident &&
+ GIT_EDITOR="head -n4 >actual" git -c core.commentChar=% revert \
+ --edit --reference HEAD &&
+ cat <<-EOF >expect &&
+ % *** SAY WHY WE ARE REVERTING ON THE TITLE LINE ***
+
+ This reverts commit $(git show -s --pretty=reference HEAD^).
+
+ EOF
+ test_cmp expect actual
+'
+
test_expect_success 'identification of reverted commit (revert.reference)' '
git checkout --detach to-ident &&
git -c revert.reference=true revert --no-edit HEAD &&
diff --git a/t/t3502-cherry-pick-merge.sh b/t/t3502-cherry-pick-merge.sh
index 1b2c0d6aca..5495eacfec 100755
--- a/t/t3502-cherry-pick-merge.sh
+++ b/t/t3502-cherry-pick-merge.sh
@@ -11,7 +11,6 @@ test_description='cherry picking and reverting a 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 setup '
diff --git a/t/t3503-cherry-pick-root.sh b/t/t3503-cherry-pick-root.sh
index 76d393dc8a..95fe4feaee 100755
--- a/t/t3503-cherry-pick-root.sh
+++ b/t/t3503-cherry-pick-root.sh
@@ -5,7 +5,6 @@ test_description='test cherry-picking (and reverting) a root commit'
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 '
diff --git a/t/t3504-cherry-pick-rerere.sh b/t/t3504-cherry-pick-rerere.sh
index 109016eba9..18aeba161c 100755
--- a/t/t3504-cherry-pick-rerere.sh
+++ b/t/t3504-cherry-pick-rerere.sh
@@ -5,7 +5,6 @@ test_description='cherry-pick should rerere for conflicts'
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 '
diff --git a/t/t3505-cherry-pick-empty.sh b/t/t3505-cherry-pick-empty.sh
index ead3fb4680..9748443530 100755
--- a/t/t3505-cherry-pick-empty.sh
+++ b/t/t3505-cherry-pick-empty.sh
@@ -5,7 +5,6 @@ test_description='test cherry-picking an empty commit'
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 '
diff --git a/t/t3506-cherry-pick-ff.sh b/t/t3506-cherry-pick-ff.sh
index b71bad17b8..7e11bd4a4c 100755
--- a/t/t3506-cherry-pick-ff.sh
+++ b/t/t3506-cherry-pick-ff.sh
@@ -5,7 +5,6 @@ test_description='test cherry-picking with --ff option'
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 '
diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh
index 10e9c91dbb..44596cb1e8 100755
--- a/t/t3507-cherry-pick-conflict.sh
+++ b/t/t3507-cherry-pick-conflict.sh
@@ -13,7 +13,6 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
pristine_detach () {
@@ -35,7 +34,7 @@ test_expect_success setup '
git commit --allow-empty --allow-empty-message &&
git tag empty &&
git checkout main &&
- git config advice.detachedhead false
+ git config set advice.detachedhead false
'
@@ -61,7 +60,7 @@ test_expect_success 'advice from failed cherry-pick' '
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
- hint: Disable this message with "git config advice.mergeConflict false"
+ hint: Disable this message with "git config set advice.mergeConflict false"
EOF
test_must_fail git cherry-pick picked 2>actual &&
@@ -76,7 +75,7 @@ test_expect_success 'advice from failed cherry-pick --no-commit' "
error: could not apply \$picked... picked
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
- hint: Disable this message with \"git config advice.mergeConflict false\"
+ hint: Disable this message with \"git config set advice.mergeConflict false\"
EOF
test_must_fail git cherry-pick --no-commit picked 2>actual &&
diff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh
index afa7727a4a..2d53ce754c 100755
--- a/t/t3508-cherry-pick-many-commits.sh
+++ b/t/t3508-cherry-pick-many-commits.sh
@@ -5,7 +5,6 @@ test_description='test cherry-picking many commits'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
check_head_differs_from() {
diff --git a/t/t3509-cherry-pick-merge-df.sh b/t/t3509-cherry-pick-merge-df.sh
index 171cc6d76b..f4159246e1 100755
--- a/t/t3509-cherry-pick-merge-df.sh
+++ b/t/t3509-cherry-pick-merge-df.sh
@@ -4,7 +4,6 @@ test_description='Test cherry-pick with directory/file conflicts'
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 'Initialize repository' '
diff --git a/t/t3510-cherry-pick-sequence.sh b/t/t3510-cherry-pick-sequence.sh
index 93c725bac3..66ff9db270 100755
--- a/t/t3510-cherry-pick-sequence.sh
+++ b/t/t3510-cherry-pick-sequence.sh
@@ -12,7 +12,6 @@ test_description='Test cherry-pick continuation features
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Repeat first match 10 times
@@ -26,7 +25,7 @@ pristine_detach () {
}
test_expect_success setup '
- git config advice.detachedhead false &&
+ git config set advice.detachedhead false &&
echo unrelated >unrelated &&
git add unrelated &&
test_commit initial foo a &&
diff --git a/t/t3511-cherry-pick-x.sh b/t/t3511-cherry-pick-x.sh
index dd5d92ef30..98ef13f0a3 100755
--- a/t/t3511-cherry-pick-x.sh
+++ b/t/t3511-cherry-pick-x.sh
@@ -2,7 +2,6 @@
test_description='Test cherry-pick -x and -s'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
pristine_detach () {
@@ -52,7 +51,7 @@ trailing empty lines
"
test_expect_success setup '
- git config advice.detachedhead false &&
+ git config set advice.detachedhead false &&
echo unrelated >unrelated &&
git add unrelated &&
test_commit initial foo a &&
diff --git a/t/t3512-cherry-pick-submodule.sh b/t/t3512-cherry-pick-submodule.sh
index 9387a22a9e..f22d1ddead 100755
--- a/t/t3512-cherry-pick-submodule.sh
+++ b/t/t3512-cherry-pick-submodule.sh
@@ -5,7 +5,6 @@ test_description='cherry-pick can handle submodules'
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-submodule-update.sh
diff --git a/t/t3513-revert-submodule.sh b/t/t3513-revert-submodule.sh
index e178968b40..8bfe3ed246 100755
--- a/t/t3513-revert-submodule.sh
+++ b/t/t3513-revert-submodule.sh
@@ -2,7 +2,6 @@
test_description='revert can handle submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh
diff --git a/t/t3514-cherry-pick-revert-gpg.sh b/t/t3514-cherry-pick-revert-gpg.sh
index 133dc07217..5b2e250eaa 100755
--- a/t/t3514-cherry-pick-revert-gpg.sh
+++ b/t/t3514-cherry-pick-revert-gpg.sh
@@ -5,7 +5,6 @@
test_description='test {cherry-pick,revert} --[no-]gpg-sign'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-gpg.sh"
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 31ac31d4bc..98259e2ada 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -8,7 +8,6 @@ test_description='Test of the various options to git rm.'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Setup some files to be removed, some with funny characters
diff --git a/t/t3601-rm-pathspec-file.sh b/t/t3601-rm-pathspec-file.sh
index 7cef12981c..31bd9960fc 100755
--- a/t/t3601-rm-pathspec-file.sh
+++ b/t/t3601-rm-pathspec-file.sh
@@ -2,7 +2,6 @@
test_description='rm --pathspec-from-file'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_tick
diff --git a/t/t3602-rm-sparse-checkout.sh b/t/t3602-rm-sparse-checkout.sh
index fcdefba48c..02c7acd617 100755
--- a/t/t3602-rm-sparse-checkout.sh
+++ b/t/t3602-rm-sparse-checkout.sh
@@ -2,7 +2,6 @@
test_description='git rm in sparse checked out working trees'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' "
@@ -21,7 +20,7 @@ test_expect_success 'setup' "
hint: If you intend to update such entries, try one of the following:
hint: * Use the --sparse option.
hint: * Disable or modify the sparsity rules.
- hint: Disable this message with \"git config advice.updateSparsePath false\"
+ hint: Disable this message with \"git config set advice.updateSparsePath false\"
EOF
echo b | cat sparse_error_header - >sparse_entry_b_error &&
diff --git a/t/t3650-replay-basics.sh b/t/t3650-replay-basics.sh
index 12bd3db4cb..389670262e 100755
--- a/t/t3650-replay-basics.sh
+++ b/t/t3650-replay-basics.sh
@@ -5,7 +5,6 @@ test_description='basic git replay tests'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
GIT_AUTHOR_NAME=author@name
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 839c904745..df580a5806 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -5,7 +5,6 @@
test_description='Test of git add, including the -- option.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-unique-files.sh
@@ -32,7 +31,7 @@ test_expect_success 'Test with no pathspecs' '
cat >expect <<-EOF &&
Nothing specified, nothing added.
hint: Maybe you wanted to say ${SQ}git add .${SQ}?
- hint: Disable this message with "git config advice.addEmptyPathspec false"
+ hint: Disable this message with "git config set advice.addEmptyPathspec false"
EOF
git add 2>actual &&
test_cmp expect actual
@@ -376,7 +375,7 @@ test_expect_success '"git add" a embedded repository' '
hint: git rm --cached inner1
hint:
hint: See "git help submodule" for more information.
- hint: Disable this message with "git config advice.addEmbeddedRepo false"
+ hint: Disable this message with "git config set advice.addEmbeddedRepo false"
warning: adding embedded git repository: inner2
EOF
test_cmp expect actual
@@ -414,7 +413,7 @@ cat >expect.err <<\EOF
The following paths are ignored by one of your .gitignore files:
ignored-file
hint: Use -f if you really want to add them.
-hint: Disable this message with "git config advice.addIgnoredFile false"
+hint: Disable this message with "git config set advice.addIgnoredFile false"
EOF
cat >expect.out <<\EOF
add 'track-this'
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index 718438ffc7..b8a05d95f3 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -4,7 +4,6 @@ test_description='add -i basic tests'
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-terminal.sh
diff --git a/t/t3702-add-edit.sh b/t/t3702-add-edit.sh
index 82bfb2fd2a..8bacacbac6 100755
--- a/t/t3702-add-edit.sh
+++ b/t/t3702-add-edit.sh
@@ -5,7 +5,6 @@
test_description='add -e basic tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t3703-add-magic-pathspec.sh b/t/t3703-add-magic-pathspec.sh
index d84071038e..3ef525a559 100755
--- a/t/t3703-add-magic-pathspec.sh
+++ b/t/t3703-add-magic-pathspec.sh
@@ -2,7 +2,6 @@
test_description='magic pathspec tests using git-add'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3704-add-pathspec-file.sh b/t/t3704-add-pathspec-file.sh
index 3aa59f6f63..b9c96e273f 100755
--- a/t/t3704-add-pathspec-file.sh
+++ b/t/t3704-add-pathspec-file.sh
@@ -2,7 +2,6 @@
test_description='add --pathspec-from-file'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_tick
diff --git a/t/t3705-add-sparse-checkout.sh b/t/t3705-add-sparse-checkout.sh
index 6ae45a788d..53a4782267 100755
--- a/t/t3705-add-sparse-checkout.sh
+++ b/t/t3705-add-sparse-checkout.sh
@@ -2,7 +2,6 @@
test_description='git add in sparse checked out working trees'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
SPARSE_ENTRY_BLOB=""
@@ -55,7 +54,7 @@ test_expect_success 'setup' "
hint: If you intend to update such entries, try one of the following:
hint: * Use the --sparse option.
hint: * Disable or modify the sparsity rules.
- hint: Disable this message with \"git config advice.updateSparsePath false\"
+ hint: Disable this message with \"git config set advice.updateSparsePath false\"
EOF
echo sparse_entry | cat sparse_error_header - >sparse_entry_error &&
diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh
index d3e428ff46..e3cf0ffbe5 100755
--- a/t/t3800-mktag.sh
+++ b/t/t3800-mktag.sh
@@ -4,7 +4,6 @@
test_description='git mktag: tag object verify test'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
###########################################################
diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh
index 9d4b5ab1f9..3c930ec202 100755
--- a/t/t3900-i18n-commit.sh
+++ b/t/t3900-i18n-commit.sh
@@ -5,7 +5,6 @@
test_description='commit and log output encodings'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
if ! test_have_prereq ICONV
diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh
index e0659c9293..f03601b49a 100755
--- a/t/t3901-i18n-patch.sh
+++ b/t/t3901-i18n-patch.sh
@@ -8,7 +8,6 @@ test_description='i18n settings and format-patch | am pipe'
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 ICONV
diff --git a/t/t3902-quoted.sh b/t/t3902-quoted.sh
index 72a5a565e9..f528008c36 100755
--- a/t/t3902-quoted.sh
+++ b/t/t3902-quoted.sh
@@ -5,7 +5,6 @@
test_description='quoted output'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
FN='濱野'
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index c87592ee2f..74666ff3e4 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -8,7 +8,6 @@ test_description='Test git stash'
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-unique-files.sh
diff --git a/t/t3904-stash-patch.sh b/t/t3904-stash-patch.sh
index aa5019fd6c..ae313e3c70 100755
--- a/t/t3904-stash-patch.sh
+++ b/t/t3904-stash-patch.sh
@@ -2,7 +2,6 @@
test_description='stash -p'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-patch-mode.sh
test_expect_success 'setup' '
diff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh
index a1733f45c3..1289ae3e07 100755
--- a/t/t3905-stash-include-untracked.sh
+++ b/t/t3905-stash-include-untracked.sh
@@ -5,7 +5,6 @@
test_description='Test git stash --include-untracked'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'stash save --include-untracked some dirty working directory' '
diff --git a/t/t3906-stash-submodule.sh b/t/t3906-stash-submodule.sh
index 0f61f01ef4..0f7348ec21 100755
--- a/t/t3906-stash-submodule.sh
+++ b/t/t3906-stash-submodule.sh
@@ -2,7 +2,6 @@
test_description='stash can handle submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh
diff --git a/t/t3907-stash-show-config.sh b/t/t3907-stash-show-config.sh
index 7a2eb98b86..10914bba7b 100755
--- a/t/t3907-stash-show-config.sh
+++ b/t/t3907-stash-show-config.sh
@@ -2,7 +2,6 @@
test_description='Test git stash show configuration.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3908-stash-in-worktree.sh b/t/t3908-stash-in-worktree.sh
index 347a89b030..2b2b366ef9 100755
--- a/t/t3908-stash-in-worktree.sh
+++ b/t/t3908-stash-in-worktree.sh
@@ -5,7 +5,6 @@
test_description='Test git stash in a worktree'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3909-stash-pathspec-file.sh b/t/t3909-stash-pathspec-file.sh
index 83269d0eb4..73f2dbdeb0 100755
--- a/t/t3909-stash-pathspec-file.sh
+++ b/t/t3909-stash-pathspec-file.sh
@@ -2,7 +2,6 @@
test_description='stash --pathspec-from-file'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_tick
diff --git a/t/t3920-crlf-messages.sh b/t/t3920-crlf-messages.sh
index 31877f00c7..e2e1251a05 100755
--- a/t/t3920-crlf-messages.sh
+++ b/t/t3920-crlf-messages.sh
@@ -2,7 +2,6 @@
test_description='Test ref-filter and pretty APIs for commit and tag messages using CRLF'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
LIB_CRLF_BRANCHES=""
diff --git a/t/t4000-diff-format.sh b/t/t4000-diff-format.sh
index 8d50331b8c..a51f881b1c 100755
--- a/t/t4000-diff-format.sh
+++ b/t/t4000-diff-format.sh
@@ -10,7 +10,6 @@ same command line parser, so testing one should be sufficient; pick
diff-files as a representative.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh
diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh
index cd1931dd55..4f520d600d 100755
--- a/t/t4001-diff-rename.sh
+++ b/t/t4001-diff-rename.sh
@@ -5,7 +5,6 @@
test_description='Test rename detection in diff engine.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh
diff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh
index cb3307010c..e44648e6f3 100755
--- a/t/t4002-diff-basic.sh
+++ b/t/t4002-diff-basic.sh
@@ -7,7 +7,6 @@ test_description='Test diff raw-output.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh
diff --git a/t/t4003-diff-rename-1.sh b/t/t4003-diff-rename-1.sh
index ebe091828c..fd4faee5d2 100755
--- a/t/t4003-diff-rename-1.sh
+++ b/t/t4003-diff-rename-1.sh
@@ -7,7 +7,6 @@ test_description='More rename detection
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
diff --git a/t/t4004-diff-rename-symlink.sh b/t/t4004-diff-rename-symlink.sh
index 1d70d4d221..faf3465deb 100755
--- a/t/t4004-diff-rename-symlink.sh
+++ b/t/t4004-diff-rename-symlink.sh
@@ -10,7 +10,6 @@ copy of symbolic links, but should not produce rename/copy followed
by an edit for them.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh
diff --git a/t/t4005-diff-rename-2.sh b/t/t4005-diff-rename-2.sh
index 5c756dc243..92d1141fbe 100755
--- a/t/t4005-diff-rename-2.sh
+++ b/t/t4005-diff-rename-2.sh
@@ -6,7 +6,6 @@
test_description='Same rename detection as t4003 but testing diff-raw.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
diff --git a/t/t4006-diff-mode.sh b/t/t4006-diff-mode.sh
index dbd4c0da21..2299b91fc4 100755
--- a/t/t4006-diff-mode.sh
+++ b/t/t4006-diff-mode.sh
@@ -7,7 +7,6 @@ test_description='Test mode change diffs.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
sed_script='s/\(:100644 100755\) \('"$OID_REGEX"'\) \2 /\1 X X /'
diff --git a/t/t4007-rename-3.sh b/t/t4007-rename-3.sh
index b86165cbac..e8faf0dd2e 100755
--- a/t/t4007-rename-3.sh
+++ b/t/t4007-rename-3.sh
@@ -7,7 +7,6 @@ test_description='Rename interaction with pathspec.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
diff --git a/t/t4008-diff-break-rewrite.sh b/t/t4008-diff-break-rewrite.sh
index b0ef0026e0..c187c52dab 100755
--- a/t/t4008-diff-break-rewrite.sh
+++ b/t/t4008-diff-break-rewrite.sh
@@ -22,7 +22,6 @@ With -B, this should be detected as two complete rewrites.
Further, with -B and -M together, these should turn into two renames.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
diff --git a/t/t4009-diff-rename-4.sh b/t/t4009-diff-rename-4.sh
index 3480781dab..59e71e3acd 100755
--- a/t/t4009-diff-rename-4.sh
+++ b/t/t4009-diff-rename-4.sh
@@ -7,7 +7,6 @@ test_description='Same rename detection as t4003 but testing diff-raw -z.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
diff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh
index 9d9650eba7..c84c3fa05b 100755
--- a/t/t4010-diff-pathspec.sh
+++ b/t/t4010-diff-pathspec.sh
@@ -10,7 +10,6 @@ Prepare:
path1/file1
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash
diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh
index bc8ba88719..ac837b6c9e 100755
--- a/t/t4011-diff-symlink.sh
+++ b/t/t4011-diff-symlink.sh
@@ -7,7 +7,6 @@ test_description='Test diff of symlinks.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh
diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh
index c64d9d2f40..d1d30ac2a9 100755
--- a/t/t4012-diff-binary.sh
+++ b/t/t4012-diff-binary.sh
@@ -6,7 +6,6 @@
test_description='Binary diff and apply
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cat >expect.binary-numstat <<\EOF
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 87d248d034..3855d68dbc 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -8,7 +8,6 @@ test_description='Various diff formatting options'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 1c46e963e4..884f83fb8a 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -8,7 +8,6 @@ test_description='various format-patch tests'
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-terminal.sh
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index 851cfe4f32..52e3e476ff 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -7,7 +7,6 @@ test_description='Test special whitespace in diff engine.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh
diff --git a/t/t4016-diff-quote.sh b/t/t4016-diff-quote.sh
index 5a8d887683..876271d682 100755
--- a/t/t4016-diff-quote.sh
+++ b/t/t4016-diff-quote.sh
@@ -6,7 +6,6 @@
test_description='Quoting paths in diff output.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
P0='pathname'
diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh
index 1cea73ef5a..c2863c99b7 100755
--- a/t/t4017-diff-retval.sh
+++ b/t/t4017-diff-retval.sh
@@ -5,7 +5,6 @@ test_description='Return value of diffs'
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' '
diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
index 8128c30e7f..e026fac1f4 100755
--- a/t/t4018-diff-funcname.sh
+++ b/t/t4018-diff-funcname.sh
@@ -5,7 +5,6 @@
test_description='Test custom diff function name patterns'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh
index d2b3109c2d..4001dacee3 100755
--- a/t/t4019-diff-wserror.sh
+++ b/t/t4019-diff-wserror.sh
@@ -2,7 +2,6 @@
test_description='diff whitespace error detection'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh
index 3baa52a9bf..f1efe482a5 100755
--- a/t/t4020-diff-external.sh
+++ b/t/t4020-diff-external.sh
@@ -2,7 +2,6 @@
test_description='external diff interface test'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
@@ -102,7 +101,7 @@ test_expect_success 'diff attribute' '
test_cmp expect actual
'
-test_expect_success !SANITIZE_LEAK 'diff attribute should apply only to diff' '
+test_expect_success 'diff attribute should apply only to diff' '
git log -p -1 HEAD >out &&
grep "^diff --git a/file b/file" out
@@ -129,7 +128,7 @@ test_expect_success 'diff attribute' '
test_cmp expect actual
'
-test_expect_success !SANITIZE_LEAK 'diff attribute should apply only to diff' '
+test_expect_success 'diff attribute should apply only to diff' '
git log -p -1 HEAD >out &&
grep "^diff --git a/file b/file" out
diff --git a/t/t4021-format-patch-numbered.sh b/t/t4021-format-patch-numbered.sh
index 1219aa226d..9be65fd444 100755
--- a/t/t4021-format-patch-numbered.sh
+++ b/t/t4021-format-patch-numbered.sh
@@ -5,7 +5,6 @@
test_description='Format-patch numbering options'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4022-diff-rewrite.sh b/t/t4022-diff-rewrite.sh
index 77bc36d5d8..6fed993ea0 100755
--- a/t/t4022-diff-rewrite.sh
+++ b/t/t4022-diff-rewrite.sh
@@ -2,7 +2,6 @@
test_description='rewrite diff'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff-data.sh
diff --git a/t/t4023-diff-rename-typechange.sh b/t/t4023-diff-rename-typechange.sh
index e6f4fe441e..787605ce3f 100755
--- a/t/t4023-diff-rename-typechange.sh
+++ b/t/t4023-diff-rename-typechange.sh
@@ -2,7 +2,6 @@
test_description='typechange rename detection'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh
diff --git a/t/t4024-diff-optimize-common.sh b/t/t4024-diff-optimize-common.sh
index e2f0eca4af..b98ac0a0c0 100755
--- a/t/t4024-diff-optimize-common.sh
+++ b/t/t4024-diff-optimize-common.sh
@@ -2,7 +2,6 @@
test_description='common tail optimization'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
z=zzzzzzzz ;# 8
diff --git a/t/t4025-hunk-header.sh b/t/t4025-hunk-header.sh
index 5397cb7d42..c39bb07a41 100755
--- a/t/t4025-hunk-header.sh
+++ b/t/t4025-hunk-header.sh
@@ -2,7 +2,6 @@
test_description='diff hunk header truncation'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
N='日本語'
diff --git a/t/t4026-color.sh b/t/t4026-color.sh
index b05f2a9b60..08f6805e1c 100755
--- a/t/t4026-color.sh
+++ b/t/t4026-color.sh
@@ -5,7 +5,6 @@
test_description='Test diff/status color escape codes'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
ESC=$(printf '\033')
diff --git a/t/t4027-diff-submodule.sh b/t/t4027-diff-submodule.sh
index 40164ae07d..295da987cc 100755
--- a/t/t4027-diff-submodule.sh
+++ b/t/t4027-diff-submodule.sh
@@ -2,7 +2,6 @@
test_description='difference in submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh
diff --git a/t/t4028-format-patch-mime-headers.sh b/t/t4028-format-patch-mime-headers.sh
index 60cb819c42..a06a747926 100755
--- a/t/t4028-format-patch-mime-headers.sh
+++ b/t/t4028-format-patch-mime-headers.sh
@@ -2,7 +2,6 @@
test_description='format-patch mime headers and extra headers do not conflict'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'create commit with utf-8 body' '
diff --git a/t/t4029-diff-trailing-space.sh b/t/t4029-diff-trailing-space.sh
index 5f8ffef74b..32b6e9a4e7 100755
--- a/t/t4029-diff-trailing-space.sh
+++ b/t/t4029-diff-trailing-space.sh
@@ -4,7 +4,6 @@
#
test_description='diff honors config option, diff.suppressBlankEmpty'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cat <<\EOF >expected ||
diff --git a/t/t4030-diff-textconv.sh b/t/t4030-diff-textconv.sh
index 29f6d610c2..daebf9796f 100755
--- a/t/t4030-diff-textconv.sh
+++ b/t/t4030-diff-textconv.sh
@@ -2,7 +2,6 @@
test_description='diff.*.textconv tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
find_diff() {
diff --git a/t/t4031-diff-rewrite-binary.sh b/t/t4031-diff-rewrite-binary.sh
index 1b8cd3e4c9..c4394a27b5 100755
--- a/t/t4031-diff-rewrite-binary.sh
+++ b/t/t4031-diff-rewrite-binary.sh
@@ -2,7 +2,6 @@
test_description='rewrite diff on binary file'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# We must be large enough to meet the MINIMUM_BREAK_SIZE
diff --git a/t/t4032-diff-inter-hunk-context.sh b/t/t4032-diff-inter-hunk-context.sh
index 7db92d0d9f..bada0cbd32 100755
--- a/t/t4032-diff-inter-hunk-context.sh
+++ b/t/t4032-diff-inter-hunk-context.sh
@@ -2,7 +2,6 @@
test_description='diff hunk fusing'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
f() {
diff --git a/t/t4033-diff-patience.sh b/t/t4033-diff-patience.sh
index f7be7f5ef0..113304dc59 100755
--- a/t/t4033-diff-patience.sh
+++ b/t/t4033-diff-patience.sh
@@ -2,7 +2,6 @@
test_description='patience diff algorithm'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff-alternative.sh
diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index 4dcd7e9925..f51d3557f1 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -2,7 +2,6 @@
test_description='word diff colors'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh
diff --git a/t/t4035-diff-quiet.sh b/t/t4035-diff-quiet.sh
index 76f8034c60..0352bf81a9 100755
--- a/t/t4035-diff-quiet.sh
+++ b/t/t4035-diff-quiet.sh
@@ -2,7 +2,6 @@
test_description='Return value of diffs'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t4036-format-patch-signer-mime.sh b/t/t4036-format-patch-signer-mime.sh
index 48655bcc78..98d9713d8b 100755
--- a/t/t4036-format-patch-signer-mime.sh
+++ b/t/t4036-format-patch-signer-mime.sh
@@ -2,7 +2,6 @@
test_description='format-patch -s should force MIME encoding as needed'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4037-diff-r-t-dirs.sh b/t/t4037-diff-r-t-dirs.sh
index b5f96fe23b..f5ce3b29a2 100755
--- a/t/t4037-diff-r-t-dirs.sh
+++ b/t/t4037-diff-r-t-dirs.sh
@@ -2,7 +2,6 @@
test_description='diff -r -t shows directory additions and deletions'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4038-diff-combined.sh b/t/t4038-diff-combined.sh
index 00190802d8..2ce26e585c 100755
--- a/t/t4038-diff-combined.sh
+++ b/t/t4038-diff-combined.sh
@@ -5,7 +5,6 @@ test_description='combined diff'
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-diff.sh
diff --git a/t/t4039-diff-assume-unchanged.sh b/t/t4039-diff-assume-unchanged.sh
index 78090e6852..0eb0314a8b 100755
--- a/t/t4039-diff-assume-unchanged.sh
+++ b/t/t4039-diff-assume-unchanged.sh
@@ -2,7 +2,6 @@
test_description='diff with assume-unchanged entries'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# external diff has been tested in t4020-diff-external.sh
diff --git a/t/t4040-whitespace-status.sh b/t/t4040-whitespace-status.sh
index eec3d73dc2..1b27a0e381 100755
--- a/t/t4040-whitespace-status.sh
+++ b/t/t4040-whitespace-status.sh
@@ -2,7 +2,6 @@
test_description='diff --exit-code with whitespace'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index aa149e0085..28f9d83d4c 100755
--- a/t/t4041-diff-submodule-option.sh
+++ b/t/t4041-diff-submodule-option.sh
@@ -12,7 +12,6 @@ This test tries to verify the sanity of the --submodule option of git diff.
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Test non-UTF-8 encoding in case iconv is available.
diff --git a/t/t4042-diff-textconv-caching.sh b/t/t4042-diff-textconv-caching.sh
index a179205394..ff0e73531b 100755
--- a/t/t4042-diff-textconv-caching.sh
+++ b/t/t4042-diff-textconv-caching.sh
@@ -2,7 +2,6 @@
test_description='test textconv caching'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cat >helper <<'EOF'
diff --git a/t/t4043-diff-rename-binary.sh b/t/t4043-diff-rename-binary.sh
index e486493908..2a2cf91352 100755
--- a/t/t4043-diff-rename-binary.sh
+++ b/t/t4043-diff-rename-binary.sh
@@ -5,7 +5,6 @@
test_description='Move a binary file'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t4044-diff-index-unique-abbrev.sh b/t/t4044-diff-index-unique-abbrev.sh
index 9f6043daba..8400bfbd3c 100755
--- a/t/t4044-diff-index-unique-abbrev.sh
+++ b/t/t4044-diff-index-unique-abbrev.sh
@@ -2,7 +2,6 @@
test_description='test unique sha1 abbreviation on "index from..to" line'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t4045-diff-relative.sh b/t/t4045-diff-relative.sh
index 9b46c4c1be..2c8493fe66 100755
--- a/t/t4045-diff-relative.sh
+++ b/t/t4045-diff-relative.sh
@@ -2,7 +2,6 @@
test_description='diff --relative tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t4046-diff-unmerged.sh b/t/t4046-diff-unmerged.sh
index afda629c98..7c27f05366 100755
--- a/t/t4046-diff-unmerged.sh
+++ b/t/t4046-diff-unmerged.sh
@@ -2,7 +2,6 @@
test_description='diff with unmerged index entries'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4047-diff-dirstat.sh b/t/t4047-diff-dirstat.sh
index 7b73462d53..a7ce8d3161 100755
--- a/t/t4047-diff-dirstat.sh
+++ b/t/t4047-diff-dirstat.sh
@@ -2,7 +2,6 @@
test_description='diff --dirstat tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# set up two commits where the second commit has these files
diff --git a/t/t4048-diff-combined-binary.sh b/t/t4048-diff-combined-binary.sh
index f399484bce..0260cf64f5 100755
--- a/t/t4048-diff-combined-binary.sh
+++ b/t/t4048-diff-combined-binary.sh
@@ -4,7 +4,6 @@ test_description='combined and merge diff handle binary files and textconv'
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 binary merge conflict' '
diff --git a/t/t4049-diff-stat-count.sh b/t/t4049-diff-stat-count.sh
index 0a4fc735d4..eceb47c859 100755
--- a/t/t4049-diff-stat-count.sh
+++ b/t/t4049-diff-stat-count.sh
@@ -3,7 +3,6 @@
test_description='diff --stat-count'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t4050-diff-histogram.sh b/t/t4050-diff-histogram.sh
index c61b30f96d..fd3e86a74f 100755
--- a/t/t4050-diff-histogram.sh
+++ b/t/t4050-diff-histogram.sh
@@ -2,7 +2,6 @@
test_description='histogram diff algorithm'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff-alternative.sh
diff --git a/t/t4051-diff-function-context.sh b/t/t4051-diff-function-context.sh
index 725278ad19..4838a1df8b 100755
--- a/t/t4051-diff-function-context.sh
+++ b/t/t4051-diff-function-context.sh
@@ -2,7 +2,6 @@
test_description='diff function context'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
dir="$TEST_DIRECTORY/t4051"
diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh
index 7badd72488..740bb97091 100755
--- a/t/t4052-stat-output.sh
+++ b/t/t4052-stat-output.sh
@@ -8,7 +8,6 @@ test_description='test --stat output of various commands'
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-terminal.sh
diff --git a/t/t4053-diff-no-index.sh b/t/t4053-diff-no-index.sh
index 651ec77660..5e5bad61ca 100755
--- a/t/t4053-diff-no-index.sh
+++ b/t/t4053-diff-no-index.sh
@@ -2,7 +2,6 @@
test_description='diff --no-index'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t4054-diff-bogus-tree.sh b/t/t4054-diff-bogus-tree.sh
index 05c88f8cdf..1131431fe0 100755
--- a/t/t4054-diff-bogus-tree.sh
+++ b/t/t4054-diff-bogus-tree.sh
@@ -2,7 +2,6 @@
test_description='test diff with a bogus tree containing the null sha1'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'create bogus tree' '
diff --git a/t/t4055-diff-context.sh b/t/t4055-diff-context.sh
index 3ea9ae99e0..f7ff234cf9 100755
--- a/t/t4055-diff-context.sh
+++ b/t/t4055-diff-context.sh
@@ -5,7 +5,6 @@
test_description='diff.context configuration'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t4056-diff-order.sh b/t/t4056-diff-order.sh
index 32c5fcb9a2..aec1d9d1b4 100755
--- a/t/t4056-diff-order.sh
+++ b/t/t4056-diff-order.sh
@@ -5,7 +5,6 @@ test_description='diff order & rotate'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
create_files () {
diff --git a/t/t4057-diff-combined-paths.sh b/t/t4057-diff-combined-paths.sh
index 9a7505cbb8..04b8a1542a 100755
--- a/t/t4057-diff-combined-paths.sh
+++ b/t/t4057-diff-combined-paths.sh
@@ -5,7 +5,6 @@ test_description='combined diff show only paths that are different to all parent
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# verify that diffc.expect matches output of
diff --git a/t/t4058-diff-duplicates.sh b/t/t4058-diff-duplicates.sh
index 18e5ac88c3..2fce4a9897 100755
--- a/t/t4058-diff-duplicates.sh
+++ b/t/t4058-diff-duplicates.sh
@@ -11,7 +11,6 @@
test_description='test tree diff when trees have duplicate entries'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# make_tree_entry <mode> <mode> <sha1>
diff --git a/t/t4059-diff-submodule-not-initialized.sh b/t/t4059-diff-submodule-not-initialized.sh
index 28fd3cdb15..0fe81056d5 100755
--- a/t/t4059-diff-submodule-not-initialized.sh
+++ b/t/t4059-diff-submodule-not-initialized.sh
@@ -9,7 +9,6 @@ This test tries to verify that add_submodule_odb works when the submodule was
initialized previously but the checkout has since been removed.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t4060-diff-submodule-option-diff-format.sh b/t/t4060-diff-submodule-option-diff-format.sh
index 918334fa4c..76b83101d3 100755
--- a/t/t4060-diff-submodule-option-diff-format.sh
+++ b/t/t4060-diff-submodule-option-diff-format.sh
@@ -10,7 +10,6 @@ test_description='Support for diff format verbose submodule difference in git di
This test tries to verify the sanity of --submodule=diff option of git diff.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Test non-UTF-8 encoding in case iconv is available.
diff --git a/t/t4061-diff-indent.sh b/t/t4061-diff-indent.sh
index 2942e5d9b9..7750b87ca1 100755
--- a/t/t4061-diff-indent.sh
+++ b/t/t4061-diff-indent.sh
@@ -6,7 +6,6 @@ test_description='Test diff indent heuristic.
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-diff.sh
diff --git a/t/t4062-diff-pickaxe.sh b/t/t4062-diff-pickaxe.sh
index a90b46b678..8ad3d79957 100755
--- a/t/t4062-diff-pickaxe.sh
+++ b/t/t4062-diff-pickaxe.sh
@@ -5,7 +5,6 @@
test_description='Pickaxe options'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4063-diff-blobs.sh b/t/t4063-diff-blobs.sh
index 7e6c9d6384..50fdb5ea52 100755
--- a/t/t4063-diff-blobs.sh
+++ b/t/t4063-diff-blobs.sh
@@ -2,7 +2,6 @@
test_description='test direct comparison of blobs via git-diff'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
run_diff () {
diff --git a/t/t4064-diff-oidfind.sh b/t/t4064-diff-oidfind.sh
index 846f285f77..e86bba679e 100755
--- a/t/t4064-diff-oidfind.sh
+++ b/t/t4064-diff-oidfind.sh
@@ -2,7 +2,6 @@
test_description='test finding specific blobs in the revision walking'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup ' '
diff --git a/t/t4065-diff-anchored.sh b/t/t4065-diff-anchored.sh
index 647537c12e..b3f510f040 100755
--- a/t/t4065-diff-anchored.sh
+++ b/t/t4065-diff-anchored.sh
@@ -2,7 +2,6 @@
test_description='anchored diff algorithm'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success '--anchored' '
diff --git a/t/t4066-diff-emit-delay.sh b/t/t4066-diff-emit-delay.sh
index 0ecb391541..a1de63b77f 100755
--- a/t/t4066-diff-emit-delay.sh
+++ b/t/t4066-diff-emit-delay.sh
@@ -4,7 +4,6 @@ test_description='test combined/stat/moved interaction'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# This test covers a weird 3-way interaction between "--cc -p", which will run
diff --git a/t/t4067-diff-partial-clone.sh b/t/t4067-diff-partial-clone.sh
index 7af3a08862..581250dd2d 100755
--- a/t/t4067-diff-partial-clone.sh
+++ b/t/t4067-diff-partial-clone.sh
@@ -2,7 +2,6 @@
test_description='behavior of diff when reading objects in a partial clone'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'git show batches blobs' '
diff --git a/t/t4068-diff-symmetric-merge-base.sh b/t/t4068-diff-symmetric-merge-base.sh
index 4d6565e728..eff63c16b0 100755
--- a/t/t4068-diff-symmetric-merge-base.sh
+++ b/t/t4068-diff-symmetric-merge-base.sh
@@ -5,7 +5,6 @@ test_description='behavior of diff with symmetric-diff setups and --merge-base'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# build these situations:
diff --git a/t/t4069-remerge-diff.sh b/t/t4069-remerge-diff.sh
index df342850a0..c6c94aef14 100755
--- a/t/t4069-remerge-diff.sh
+++ b/t/t4069-remerge-diff.sh
@@ -2,7 +2,6 @@
test_description='remerge-diff handling'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# This test is ort-specific
@@ -353,4 +352,11 @@ test_expect_success 'remerge-diff turns off history simplification' '
test_cmp expect actual
'
+test_expect_success 'remerge-diff with --reverse' '
+ git log -1 --remerge-diff --oneline ab_resolution^ >expect &&
+ git log -1 --remerge-diff --oneline ab_resolution >>expect &&
+ git log -2 --remerge-diff --oneline ab_resolution --reverse >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t4100-apply-stat.sh b/t/t4100-apply-stat.sh
index d503547732..146e73d8f5 100755
--- a/t/t4100-apply-stat.sh
+++ b/t/t4100-apply-stat.sh
@@ -7,7 +7,6 @@ test_description='git apply --stat --summary test, with --recount
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
UNC='s/^\(@@ -[1-9][0-9]*\),[0-9]* \(+[1-9][0-9]*\),[0-9]* @@/\1,999 \2,999 @@/'
diff --git a/t/t4101-apply-nonl.sh b/t/t4101-apply-nonl.sh
index b1169193ef..4df74baa24 100755
--- a/t/t4101-apply-nonl.sh
+++ b/t/t4101-apply-nonl.sh
@@ -7,7 +7,6 @@ test_description='git apply should handle files with incomplete lines.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# setup
diff --git a/t/t4102-apply-rename.sh b/t/t4102-apply-rename.sh
index d1e06fc1ac..e42a31c917 100755
--- a/t/t4102-apply-rename.sh
+++ b/t/t4102-apply-rename.sh
@@ -7,7 +7,6 @@ test_description='git apply handling copy/rename patch.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# setup
diff --git a/t/t4103-apply-binary.sh b/t/t4103-apply-binary.sh
index 144619ab87..d370ecfe0d 100755
--- a/t/t4103-apply-binary.sh
+++ b/t/t4103-apply-binary.sh
@@ -9,7 +9,6 @@ test_description='git apply handling binary patches
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' '
diff --git a/t/t4104-apply-boundary.sh b/t/t4104-apply-boundary.sh
index dc501aac38..71ef4132d1 100755
--- a/t/t4104-apply-boundary.sh
+++ b/t/t4104-apply-boundary.sh
@@ -5,7 +5,6 @@
test_description='git apply boundary tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
L="c d e f g h i j k l m n o p q r s t u v w x"
diff --git a/t/t4105-apply-fuzz.sh b/t/t4105-apply-fuzz.sh
index ed814a839e..b59785166d 100755
--- a/t/t4105-apply-fuzz.sh
+++ b/t/t4105-apply-fuzz.sh
@@ -3,7 +3,6 @@
test_description='apply with fuzz and offset'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
dotest () {
diff --git a/t/t4106-apply-stdin.sh b/t/t4106-apply-stdin.sh
index 5c150f3b0b..aa2fff7afa 100755
--- a/t/t4106-apply-stdin.sh
+++ b/t/t4106-apply-stdin.sh
@@ -3,7 +3,6 @@
test_description='git apply --numstat - <patch'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4107-apply-ignore-whitespace.sh b/t/t4107-apply-ignore-whitespace.sh
index 5e6e203aa5..94ba6dd4e0 100755
--- a/t/t4107-apply-ignore-whitespace.sh
+++ b/t/t4107-apply-ignore-whitespace.sh
@@ -5,7 +5,6 @@
test_description='git-apply --ignore-whitespace.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# This primes main.c file that indents without using HT at all.
diff --git a/t/t4108-apply-threeway.sh b/t/t4108-apply-threeway.sh
index c6302163d8..f30e85659d 100755
--- a/t/t4108-apply-threeway.sh
+++ b/t/t4108-apply-threeway.sh
@@ -5,7 +5,6 @@ test_description='git apply --3way'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
print_sanitized_conflicted_diff () {
diff --git a/t/t4109-apply-multifrag.sh b/t/t4109-apply-multifrag.sh
index 4dc6d8e7d3..ac523a5d56 100755
--- a/t/t4109-apply-multifrag.sh
+++ b/t/t4109-apply-multifrag.sh
@@ -7,7 +7,6 @@
test_description='git apply test patches with multiple fragments.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cp "$TEST_DIRECTORY/t4109/patch1.patch" .
diff --git a/t/t4110-apply-scan.sh b/t/t4110-apply-scan.sh
index 266302a182..cc17ff2ab9 100755
--- a/t/t4110-apply-scan.sh
+++ b/t/t4110-apply-scan.sh
@@ -8,7 +8,6 @@ test_description='git apply test for patches which require scanning forwards and
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'git apply scan' '
diff --git a/t/t4111-apply-subdir.sh b/t/t4111-apply-subdir.sh
index e9a87d761d..1618a6dbc7 100755
--- a/t/t4111-apply-subdir.sh
+++ b/t/t4111-apply-subdir.sh
@@ -2,7 +2,6 @@
test_description='patching from inconvenient places'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t4112-apply-renames.sh b/t/t4112-apply-renames.sh
index d53aa4222e..bb5d529bec 100755
--- a/t/t4112-apply-renames.sh
+++ b/t/t4112-apply-renames.sh
@@ -8,7 +8,6 @@ test_description='git apply should not get confused with rename/copy.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# setup
diff --git a/t/t4113-apply-ending.sh b/t/t4113-apply-ending.sh
index 2c65c6a169..66fa51591e 100755
--- a/t/t4113-apply-ending.sh
+++ b/t/t4113-apply-ending.sh
@@ -6,7 +6,6 @@
test_description='git apply trying to add an ending line.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# setup
diff --git a/t/t4114-apply-typechange.sh b/t/t4114-apply-typechange.sh
index 8ff3640766..da3e64f811 100755
--- a/t/t4114-apply-typechange.sh
+++ b/t/t4114-apply-typechange.sh
@@ -7,7 +7,6 @@ test_description='git apply should not get confused with type changes.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup repository and commits' '
diff --git a/t/t4115-apply-symlink.sh b/t/t4115-apply-symlink.sh
index cbef0a593f..769b0e4f9d 100755
--- a/t/t4115-apply-symlink.sh
+++ b/t/t4115-apply-symlink.sh
@@ -7,7 +7,6 @@ test_description='git apply symlinks and partial files
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4116-apply-reverse.sh b/t/t4116-apply-reverse.sh
index a9f4ddda6c..0784ba033a 100755
--- a/t/t4116-apply-reverse.sh
+++ b/t/t4116-apply-reverse.sh
@@ -8,7 +8,6 @@ test_description='git apply in reverse
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4117-apply-reject.sh b/t/t4117-apply-reject.sh
index 4d15ccd28e..c86d05a96f 100755
--- a/t/t4117-apply-reject.sh
+++ b/t/t4117-apply-reject.sh
@@ -7,7 +7,6 @@ test_description='git apply with rejects
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4118-apply-empty-context.sh b/t/t4118-apply-empty-context.sh
index 69c9c48e72..c1dcbd7d35 100755
--- a/t/t4118-apply-empty-context.sh
+++ b/t/t4118-apply-empty-context.sh
@@ -8,7 +8,6 @@ test_description='git apply with new style GNU diff with empty context
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4119-apply-config.sh b/t/t4119-apply-config.sh
index 208c961d37..f3b43e2216 100755
--- a/t/t4119-apply-config.sh
+++ b/t/t4119-apply-config.sh
@@ -8,7 +8,6 @@ test_description='git apply --whitespace=strip and configuration file.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4120-apply-popt.sh b/t/t4120-apply-popt.sh
index f788428540..697e86c0ff 100755
--- a/t/t4120-apply-popt.sh
+++ b/t/t4120-apply-popt.sh
@@ -5,7 +5,6 @@
test_description='git apply -p handling.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4121-apply-diffs.sh b/t/t4121-apply-diffs.sh
index a80cec9d11..b45454aaf4 100755
--- a/t/t4121-apply-diffs.sh
+++ b/t/t4121-apply-diffs.sh
@@ -4,7 +4,6 @@ test_description='git apply for contextually independent diffs'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
echo '1
diff --git a/t/t4122-apply-symlink-inside.sh b/t/t4122-apply-symlink-inside.sh
index 2089d84f64..3340ab4370 100755
--- a/t/t4122-apply-symlink-inside.sh
+++ b/t/t4122-apply-symlink-inside.sh
@@ -4,7 +4,6 @@ test_description='apply to deeper directory without getting fooled with symlink'
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 '
diff --git a/t/t4123-apply-shrink.sh b/t/t4123-apply-shrink.sh
index 3601c0c5dc..3ef84619f5 100755
--- a/t/t4123-apply-shrink.sh
+++ b/t/t4123-apply-shrink.sh
@@ -2,7 +2,6 @@
test_description='apply a patch that is larger than the preimage'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cat >F <<\EOF
diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh
index cdffee0273..485c7d2d12 100755
--- a/t/t4124-apply-ws-rule.sh
+++ b/t/t4124-apply-ws-rule.sh
@@ -2,7 +2,6 @@
test_description='core.whitespace rules and git apply'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
prepare_test_file () {
diff --git a/t/t4125-apply-ws-fuzz.sh b/t/t4125-apply-ws-fuzz.sh
index f248cc2a00..090987c89b 100755
--- a/t/t4125-apply-ws-fuzz.sh
+++ b/t/t4125-apply-ws-fuzz.sh
@@ -2,7 +2,6 @@
test_description='applying patch that has broken whitespaces in context'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4126-apply-empty.sh b/t/t4126-apply-empty.sh
index 56210b5609..eff783f8d6 100755
--- a/t/t4126-apply-empty.sh
+++ b/t/t4126-apply-empty.sh
@@ -2,7 +2,6 @@
test_description='apply empty'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4127-apply-same-fn.sh b/t/t4127-apply-same-fn.sh
index aa5cfae2b6..bd516c4aad 100755
--- a/t/t4127-apply-same-fn.sh
+++ b/t/t4127-apply-same-fn.sh
@@ -3,7 +3,6 @@
test_description='apply same filename'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
modify () {
diff --git a/t/t4128-apply-root.sh b/t/t4128-apply-root.sh
index ed94c90204..f6db5a79dd 100755
--- a/t/t4128-apply-root.sh
+++ b/t/t4128-apply-root.sh
@@ -2,7 +2,6 @@
test_description='apply same filename'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t4129-apply-samemode.sh b/t/t4129-apply-samemode.sh
index 87ffd2b8e1..2149ad5da4 100755
--- a/t/t4129-apply-samemode.sh
+++ b/t/t4129-apply-samemode.sh
@@ -3,7 +3,6 @@
test_description='applying patch with mode bits'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4130-apply-criss-cross-rename.sh b/t/t4130-apply-criss-cross-rename.sh
index f3ea632742..211ef1c7e7 100755
--- a/t/t4130-apply-criss-cross-rename.sh
+++ b/t/t4130-apply-criss-cross-rename.sh
@@ -2,7 +2,6 @@
test_description='git apply handling criss-cross rename patch.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
create_file() {
diff --git a/t/t4131-apply-fake-ancestor.sh b/t/t4131-apply-fake-ancestor.sh
index 40c92115a6..b1361ce546 100755
--- a/t/t4131-apply-fake-ancestor.sh
+++ b/t/t4131-apply-fake-ancestor.sh
@@ -5,7 +5,6 @@
test_description='git apply --build-fake-ancestor handling.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t4132-apply-removal.sh b/t/t4132-apply-removal.sh
index c1e3049c04..ab1628d27d 100755
--- a/t/t4132-apply-removal.sh
+++ b/t/t4132-apply-removal.sh
@@ -5,7 +5,6 @@
test_description='git-apply notices removal patches generated by GNU diff'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4133-apply-filenames.sh b/t/t4133-apply-filenames.sh
index c21ddb2946..3cab1038cf 100755
--- a/t/t4133-apply-filenames.sh
+++ b/t/t4133-apply-filenames.sh
@@ -6,7 +6,6 @@
test_description='git apply filename consistency check'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4134-apply-submodule.sh b/t/t4134-apply-submodule.sh
index aceb4c42b0..8cea75cf7b 100755
--- a/t/t4134-apply-submodule.sh
+++ b/t/t4134-apply-submodule.sh
@@ -6,7 +6,6 @@
test_description='git apply submodule tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4135-apply-weird-filenames.sh b/t/t4135-apply-weird-filenames.sh
index d3502c6fdd..6bc3fb97a7 100755
--- a/t/t4135-apply-weird-filenames.sh
+++ b/t/t4135-apply-weird-filenames.sh
@@ -2,7 +2,6 @@
test_description='git apply with weird postimage filenames'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t4136-apply-check.sh b/t/t4136-apply-check.sh
index dfec1c5f0f..82f2f2e475 100755
--- a/t/t4136-apply-check.sh
+++ b/t/t4136-apply-check.sh
@@ -3,7 +3,6 @@
test_description='git apply should exit non-zero with unrecognized input.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t4137-apply-submodule.sh b/t/t4137-apply-submodule.sh
index ebd0d4ad17..07d5262537 100755
--- a/t/t4137-apply-submodule.sh
+++ b/t/t4137-apply-submodule.sh
@@ -2,7 +2,6 @@
test_description='git apply handling submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh
diff --git a/t/t4138-apply-ws-expansion.sh b/t/t4138-apply-ws-expansion.sh
index 7981931b4e..8bbf8260fa 100755
--- a/t/t4138-apply-ws-expansion.sh
+++ b/t/t4138-apply-ws-expansion.sh
@@ -5,7 +5,6 @@
test_description='git apply test patches with whitespace expansion.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4139-apply-escape.sh b/t/t4139-apply-escape.sh
index e5c7439df1..e07fb9ef08 100755
--- a/t/t4139-apply-escape.sh
+++ b/t/t4139-apply-escape.sh
@@ -2,7 +2,6 @@
test_description='paths written by git-apply cannot escape the working tree'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# tests will try to write to ../foo, and we do not
diff --git a/t/t4140-apply-ita.sh b/t/t4140-apply-ita.sh
index b375aca0d7..c614eaf04c 100755
--- a/t/t4140-apply-ita.sh
+++ b/t/t4140-apply-ita.sh
@@ -2,7 +2,6 @@
test_description='git apply of i-t-a file'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4141-apply-too-large.sh b/t/t4141-apply-too-large.sh
index 20cc1209f6..eac6f7e151 100755
--- a/t/t4141-apply-too-large.sh
+++ b/t/t4141-apply-too-large.sh
@@ -2,7 +2,6 @@
test_description='git apply with too-large patch'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success EXPENSIVE 'git apply rejects patches that are too large' '
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 232e1394e8..5e2b6c80ea 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -5,7 +5,6 @@ test_description='git am running'
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: messages' '
diff --git a/t/t4151-am-abort.sh b/t/t4151-am-abort.sh
index 1825a89d6a..edb38da701 100755
--- a/t/t4151-am-abort.sh
+++ b/t/t4151-am-abort.sh
@@ -2,7 +2,6 @@
test_description='am --abort'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4152-am-subjects.sh b/t/t4152-am-subjects.sh
index 9f2edba1f8..768495b131 100755
--- a/t/t4152-am-subjects.sh
+++ b/t/t4152-am-subjects.sh
@@ -2,7 +2,6 @@
test_description='test subject preservation with format-patch | am'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
make_patches() {
diff --git a/t/t4153-am-resume-override-opts.sh b/t/t4153-am-resume-override-opts.sh
index dd6ad8f7a8..9bec989a0e 100755
--- a/t/t4153-am-resume-override-opts.sh
+++ b/t/t4153-am-resume-override-opts.sh
@@ -2,7 +2,6 @@
test_description='git-am command-line options override saved options'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
format_patch () {
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index 213b36fb96..b0a3e84984 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -25,7 +25,6 @@ test_description='git rerere
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' '
diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh
index 7f47f85c7f..5f23fc147b 100755
--- a/t/t4201-shortlog.sh
+++ b/t/t4201-shortlog.sh
@@ -9,7 +9,6 @@ test_description='git shortlog
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' '
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 35bec4089a..51f7beb59f 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -5,7 +5,6 @@ test_description='git log'
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-gpg.sh"
. "$TEST_DIRECTORY/lib-terminal.sh"
diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
index 2265ff8872..2421491931 100755
--- a/t/t4203-mailmap.sh
+++ b/t/t4203-mailmap.sh
@@ -5,7 +5,6 @@ test_description='.mailmap configurations'
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 commits and contacts file' '
diff --git a/t/t4204-patch-id.sh b/t/t4204-patch-id.sh
index 8e0f283c2b..605faea0c7 100755
--- a/t/t4204-patch-id.sh
+++ b/t/t4204-patch-id.sh
@@ -5,7 +5,6 @@ test_description='git patch-id'
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' '
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index f9a9c2145e..f81e42a84d 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -6,7 +6,6 @@
test_description='Test pretty formats'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Tested non-UTF-8 encoding
diff --git a/t/t4206-log-follow-harder-copies.sh b/t/t4206-log-follow-harder-copies.sh
index 9167b0351f..bcab71c8e8 100755
--- a/t/t4206-log-follow-harder-copies.sh
+++ b/t/t4206-log-follow-harder-copies.sh
@@ -7,7 +7,6 @@ test_description='Test --follow should always find copies hard in git log.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff.sh
diff --git a/t/t4207-log-decoration-colors.sh b/t/t4207-log-decoration-colors.sh
index 73ea9e5155..2e83cc820a 100755
--- a/t/t4207-log-decoration-colors.sh
+++ b/t/t4207-log-decoration-colors.sh
@@ -8,7 +8,6 @@ test_description='test "git log --decorate" colors'
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 '
@@ -59,7 +58,8 @@ ${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_reset}${c_remoteBranch}other/main${c_reset}${c_commit}, \
+${c_reset}${c_remoteBranch}other/HEAD${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}\
diff --git a/t/t4208-log-magic-pathspec.sh b/t/t4208-log-magic-pathspec.sh
index 2a46eb6bed..806b2809d4 100755
--- a/t/t4208-log-magic-pathspec.sh
+++ b/t/t4208-log-magic-pathspec.sh
@@ -5,7 +5,6 @@ test_description='magic pathspec tests using git-log'
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' '
diff --git a/t/t4209-log-pickaxe.sh b/t/t4209-log-pickaxe.sh
index b42fdc54fc..a675ace081 100755
--- a/t/t4209-log-pickaxe.sh
+++ b/t/t4209-log-pickaxe.sh
@@ -2,7 +2,6 @@
test_description='log --grep/--author/--regexp-ignore-case/-S/-G'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_log () {
diff --git a/t/t4210-log-i18n.sh b/t/t4210-log-i18n.sh
index 4a12b2b497..26dda0db38 100755
--- a/t/t4210-log-i18n.sh
+++ b/t/t4210-log-i18n.sh
@@ -2,7 +2,6 @@
test_description='test log with i18n features'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh
if ! test_have_prereq ICONV
diff --git a/t/t4212-log-corrupt.sh b/t/t4212-log-corrupt.sh
index e6b59123a3..64d818bc70 100755
--- a/t/t4212-log-corrupt.sh
+++ b/t/t4212-log-corrupt.sh
@@ -2,7 +2,6 @@
test_description='git log with invalid commit headers'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t4213-log-tabexpand.sh b/t/t4213-log-tabexpand.sh
index 590fce95e9..53a4af3244 100755
--- a/t/t4213-log-tabexpand.sh
+++ b/t/t4213-log-tabexpand.sh
@@ -2,7 +2,6 @@
test_description='log/show --expand-tabs'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
HT=" "
diff --git a/t/t4214-log-graph-octopus.sh b/t/t4214-log-graph-octopus.sh
index 7905597869..f70c46bbbf 100755
--- a/t/t4214-log-graph-octopus.sh
+++ b/t/t4214-log-graph-octopus.sh
@@ -5,7 +5,6 @@ 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
diff --git a/t/t4215-log-skewed-merges.sh b/t/t4215-log-skewed-merges.sh
index b877ac7235..28d0779a8c 100755
--- a/t/t4215-log-skewed-merges.sh
+++ b/t/t4215-log-skewed-merges.sh
@@ -2,7 +2,6 @@
test_description='git log --graph of skewed merges'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-log-graph.sh
diff --git a/t/t4216-log-bloom.sh b/t/t4216-log-bloom.sh
index 8d22338f6a..3f163dc396 100755
--- a/t/t4216-log-bloom.sh
+++ b/t/t4216-log-bloom.sh
@@ -4,7 +4,6 @@ test_description='git log for a path with Bloom filters'
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-chunk.sh
diff --git a/t/t4217-log-limit.sh b/t/t4217-log-limit.sh
index 613f0710e9..6e01e2629c 100755
--- a/t/t4217-log-limit.sh
+++ b/t/t4217-log-limit.sh
@@ -2,7 +2,6 @@
test_description='git log with filter options limiting the output'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup test' '
diff --git a/t/t4252-am-options.sh b/t/t4252-am-options.sh
index 5b680dc755..bda8822b3d 100755
--- a/t/t4252-am-options.sh
+++ b/t/t4252-am-options.sh
@@ -2,7 +2,6 @@
test_description='git am with options and not losing them'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
tm="$TEST_DIRECTORY/t4252"
diff --git a/t/t4253-am-keep-cr-dos.sh b/t/t4253-am-keep-cr-dos.sh
index 2bcdd9f34f..0ee69d2a0c 100755
--- a/t/t4253-am-keep-cr-dos.sh
+++ b/t/t4253-am-keep-cr-dos.sh
@@ -9,7 +9,6 @@ test_description='git-am mbox with dos line ending.
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Three patches which will be added as files with dos line ending.
diff --git a/t/t4254-am-corrupt.sh b/t/t4254-am-corrupt.sh
index cb03522d02..ae0a56cf5e 100755
--- a/t/t4254-am-corrupt.sh
+++ b/t/t4254-am-corrupt.sh
@@ -2,7 +2,6 @@
test_description='git am with corrupt input'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
if ! test_have_prereq ICONV
diff --git a/t/t4255-am-submodule.sh b/t/t4255-am-submodule.sh
index 04f3ccfc41..a7ba08f728 100755
--- a/t/t4255-am-submodule.sh
+++ b/t/t4255-am-submodule.sh
@@ -2,7 +2,6 @@
test_description='git am handling submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh
diff --git a/t/t4256-am-format-flowed.sh b/t/t4256-am-format-flowed.sh
index 92d8c8b651..ac9db285f3 100755
--- a/t/t4256-am-format-flowed.sh
+++ b/t/t4256-am-format-flowed.sh
@@ -2,7 +2,6 @@
test_description='test format=flowed support of git am'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t4257-am-interactive.sh b/t/t4257-am-interactive.sh
index f26d7fd2db..30a565cbea 100755
--- a/t/t4257-am-interactive.sh
+++ b/t/t4257-am-interactive.sh
@@ -2,7 +2,6 @@
test_description='am --interactive tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'set up patches to apply' '
diff --git a/t/t4258-am-quoted-cr.sh b/t/t4258-am-quoted-cr.sh
index 3573c9147f..201915b45a 100755
--- a/t/t4258-am-quoted-cr.sh
+++ b/t/t4258-am-quoted-cr.sh
@@ -2,7 +2,6 @@
test_description='test am --quoted-cr=<action>'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
DATA="$TEST_DIRECTORY/t4258"
diff --git a/t/t4300-merge-tree.sh b/t/t4300-merge-tree.sh
index 9c197260d5..27fbe193bc 100755
--- a/t/t4300-merge-tree.sh
+++ b/t/t4300-merge-tree.sh
@@ -5,7 +5,6 @@
test_description='git merge-tree'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t4301-merge-tree-write-tree.sh b/t/t4301-merge-tree-write-tree.sh
index 37f1cd7364..eea19907b5 100755
--- a/t/t4301-merge-tree-write-tree.sh
+++ b/t/t4301-merge-tree-write-tree.sh
@@ -2,7 +2,6 @@
test_description='git merge-tree --write-tree'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# This test is ort-specific
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index b9fda973f7..5465054f17 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -25,7 +25,6 @@ commit id embedding:
'
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
SUBSTFORMAT=%H%n
diff --git a/t/t5001-archive-attr.sh b/t/t5001-archive-attr.sh
index 7310774af5..e745076441 100755
--- a/t/t5001-archive-attr.sh
+++ b/t/t5001-archive-attr.sh
@@ -3,7 +3,6 @@
test_description='git archive attribute tests'
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
SUBSTFORMAT='%H (%h)%n'
diff --git a/t/t5002-archive-attr-pattern.sh b/t/t5002-archive-attr-pattern.sh
index 78ab75f1bc..97c93f6c44 100755
--- a/t/t5002-archive-attr-pattern.sh
+++ b/t/t5002-archive-attr-pattern.sh
@@ -2,7 +2,6 @@
test_description='git archive attribute pattern tests'
-TEST_PASSES_SANITIZE_LEAK=true
TEST_CREATE_REPO_NO_TEMPLATE=1
. ./test-lib.sh
diff --git a/t/t5003-archive-zip.sh b/t/t5003-archive-zip.sh
index 01f591c99b..961c6aac25 100755
--- a/t/t5003-archive-zip.sh
+++ b/t/t5003-archive-zip.sh
@@ -3,7 +3,6 @@
test_description='git archive --format=zip test'
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
SUBSTFORMAT=%H%n
diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh
index 9f2c6da80e..50344e17ca 100755
--- a/t/t5004-archive-corner-cases.sh
+++ b/t/t5004-archive-corner-cases.sh
@@ -2,7 +2,6 @@
test_description='test corner cases of git-archive'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# the 10knuls.tar file is used to test for an empty git generated tar
diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh
index 23b2f21872..e57e1ae739 100755
--- a/t/t5100-mailinfo.sh
+++ b/t/t5100-mailinfo.sh
@@ -5,7 +5,6 @@
test_description='git mailinfo and git mailsplit test'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
DATA="$TEST_DIRECTORY/t5100"
diff --git a/t/t5150-request-pull.sh b/t/t5150-request-pull.sh
index 86bee33160..cb67bac1c4 100755
--- a/t/t5150-request-pull.sh
+++ b/t/t5150-request-pull.sh
@@ -5,7 +5,6 @@ test_description='Test workflows involving pull request.'
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 PERL
diff --git a/t/t5200-update-server-info.sh b/t/t5200-update-server-info.sh
index cc51c73986..8365907055 100755
--- a/t/t5200-update-server-info.sh
+++ b/t/t5200-update-server-info.sh
@@ -2,7 +2,6 @@
test_description='Test git update-server-info'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' 'test_commit file'
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index c53f355e48..53dc3cbf90 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -5,7 +5,6 @@
test_description='git pack-object'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh
index 226490d60d..ff6b5159a3 100755
--- a/t/t5301-sliding-window.sh
+++ b/t/t5301-sliding-window.sh
@@ -5,7 +5,6 @@
test_description='mmap sliding window tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index d88e6f1691..413c99274c 100755
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
@@ -5,7 +5,6 @@
test_description='pack index with 64-bit offsets and object CRC'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t5303-pack-corruption-resilience.sh b/t/t5303-pack-corruption-resilience.sh
index b634bfb665..de58ca654a 100755
--- a/t/t5303-pack-corruption-resilience.sh
+++ b/t/t5303-pack-corruption-resilience.sh
@@ -5,7 +5,6 @@
test_description='resilience to pack corruptions with redundant objects'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Note: the test objects are created with knowledge of their pack encoding
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh
index e641df0116..1f1f664871 100755
--- a/t/t5304-prune.sh
+++ b/t/t5304-prune.sh
@@ -7,7 +7,6 @@ test_description='prune'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
day=$((60*60*24))
diff --git a/t/t5305-include-tag.sh b/t/t5305-include-tag.sh
index dc8fe55c82..44bd9ef45f 100755
--- a/t/t5305-include-tag.sh
+++ b/t/t5305-include-tag.sh
@@ -4,7 +4,6 @@ test_description='git pack-object --include-tag'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
TRASH=$(pwd)
diff --git a/t/t5306-pack-nobase.sh b/t/t5306-pack-nobase.sh
index 0d50c6b4bc..805d60ff31 100755
--- a/t/t5306-pack-nobase.sh
+++ b/t/t5306-pack-nobase.sh
@@ -7,7 +7,6 @@ test_description='git-pack-object with missing base
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Create A-B chain
diff --git a/t/t5307-pack-missing-commit.sh b/t/t5307-pack-missing-commit.sh
index 1e02c305c4..fa4bc269fe 100755
--- a/t/t5307-pack-missing-commit.sh
+++ b/t/t5307-pack-missing-commit.sh
@@ -2,7 +2,6 @@
test_description='pack should notice missing commit objects'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t5308-pack-detect-duplicates.sh b/t/t5308-pack-detect-duplicates.sh
index 655cafa054..0f84137867 100755
--- a/t/t5308-pack-detect-duplicates.sh
+++ b/t/t5308-pack-detect-duplicates.sh
@@ -2,7 +2,6 @@
test_description='handling of duplicate objects in incoming packfiles'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-pack.sh
diff --git a/t/t5309-pack-delta-cycles.sh b/t/t5309-pack-delta-cycles.sh
index 4e910c5b9d..60fc710bac 100755
--- a/t/t5309-pack-delta-cycles.sh
+++ b/t/t5309-pack-delta-cycles.sh
@@ -2,7 +2,6 @@
test_description='test index-pack handling of delta cycles in packfiles'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-pack.sh
diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
index 6bcbea64cc..eabfcd7ff6 100755
--- a/t/t5310-pack-bitmaps.sh
+++ b/t/t5310-pack-bitmaps.sh
@@ -2,7 +2,6 @@
test_description='exercise basic bitmap functionality'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-bitmap.sh
diff --git a/t/t5311-pack-bitmaps-shallow.sh b/t/t5311-pack-bitmaps-shallow.sh
index 4fe71fe8cd..012852c156 100755
--- a/t/t5311-pack-bitmaps-shallow.sh
+++ b/t/t5311-pack-bitmaps-shallow.sh
@@ -2,7 +2,6 @@
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
diff --git a/t/t5312-prune-corruption.sh b/t/t5312-prune-corruption.sh
index d8d2e30468..c37ef3818d 100755
--- a/t/t5312-prune-corruption.sh
+++ b/t/t5312-prune-corruption.sh
@@ -14,7 +14,6 @@ what currently happens. If that changes, these tests should be revisited.
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 'disable reflogs' '
diff --git a/t/t5313-pack-bounds-checks.sh b/t/t5313-pack-bounds-checks.sh
index 86fc73f9fb..5be01260d7 100755
--- a/t/t5313-pack-bounds-checks.sh
+++ b/t/t5313-pack-bounds-checks.sh
@@ -2,7 +2,6 @@
test_description='bounds-checking of access to mmapped on-disk file formats'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
clear_base () {
diff --git a/t/t5314-pack-cycle-detection.sh b/t/t5314-pack-cycle-detection.sh
index 82734b9a3c..9cd18c1e6b 100755
--- a/t/t5314-pack-cycle-detection.sh
+++ b/t/t5314-pack-cycle-detection.sh
@@ -50,7 +50,6 @@ will always find a delta for "file", because its lookup will always come
immediately after the lookup for "dummy".
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Create a pack containing the tree $1 and blob $1:file, with
diff --git a/t/t5315-pack-objects-compression.sh b/t/t5315-pack-objects-compression.sh
index c80ea9e8b7..8bacd96275 100755
--- a/t/t5315-pack-objects-compression.sh
+++ b/t/t5315-pack-objects-compression.sh
@@ -2,7 +2,6 @@
test_description='pack-object compression configuration'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t5316-pack-delta-depth.sh b/t/t5316-pack-delta-depth.sh
index eb4ef3dda4..32cf422745 100755
--- a/t/t5316-pack-delta-depth.sh
+++ b/t/t5316-pack-delta-depth.sh
@@ -2,7 +2,6 @@
test_description='pack-objects breaks long cross-pack delta chains'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# This mirrors a repeated push setup:
diff --git a/t/t5317-pack-objects-filter-objects.sh b/t/t5317-pack-objects-filter-objects.sh
index 79552d6ef7..501d715b9a 100755
--- a/t/t5317-pack-objects-filter-objects.sh
+++ b/t/t5317-pack-objects-filter-objects.sh
@@ -5,7 +5,6 @@ test_description='git pack-objects using object filtering'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Test blob:none filter.
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index 2916c07e3c..f68f64cd85 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -2,7 +2,6 @@
test_description='commit graph'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-chunk.sh
diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
index fbbc218d04..0f215ad2e8 100755
--- a/t/t5319-multi-pack-index.sh
+++ b/t/t5319-multi-pack-index.sh
@@ -2,7 +2,6 @@
test_description='multi-pack-indexes'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-chunk.sh
. "$TEST_DIRECTORY"/lib-midx.sh
diff --git a/t/t5320-delta-islands.sh b/t/t5320-delta-islands.sh
index 406363381f..2c961c7096 100755
--- a/t/t5320-delta-islands.sh
+++ b/t/t5320-delta-islands.sh
@@ -2,7 +2,6 @@
test_description='exercise delta islands'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# returns true iff $1 is a delta based on $2
diff --git a/t/t5321-pack-large-objects.sh b/t/t5321-pack-large-objects.sh
index 70770fe274..51aaca1fcf 100755
--- a/t/t5321-pack-large-objects.sh
+++ b/t/t5321-pack-large-objects.sh
@@ -7,7 +7,6 @@ test_description='git pack-object with "large" deltas
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-pack.sh
diff --git a/t/t5322-pack-objects-sparse.sh b/t/t5322-pack-objects-sparse.sh
index 770695c927..d39958c066 100755
--- a/t/t5322-pack-objects-sparse.sh
+++ b/t/t5322-pack-objects-sparse.sh
@@ -4,7 +4,6 @@ test_description='pack-objects object selection using sparse algorithm'
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 repo' '
diff --git a/t/t5323-pack-redundant.sh b/t/t5323-pack-redundant.sh
index 4e18f5490a..8dbbcc5e51 100755
--- a/t/t5323-pack-redundant.sh
+++ b/t/t5323-pack-redundant.sh
@@ -34,7 +34,6 @@ relationship between packs and objects is as follows:
Px2 | s s s x x x
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
main_repo=main.git
diff --git a/t/t5324-split-commit-graph.sh b/t/t5324-split-commit-graph.sh
index 1193726daa..a32be3867d 100755
--- a/t/t5324-split-commit-graph.sh
+++ b/t/t5324-split-commit-graph.sh
@@ -2,7 +2,6 @@
test_description='split commit graph'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-chunk.sh
diff --git a/t/t5325-reverse-index.sh b/t/t5325-reverse-index.sh
index 431a603ca0..285c8b4a49 100755
--- a/t/t5325-reverse-index.sh
+++ b/t/t5325-reverse-index.sh
@@ -2,7 +2,6 @@
test_description='on-disk reverse index'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# The below tests want control over the 'pack.writeReverseIndex' setting
diff --git a/t/t5326-multi-pack-bitmaps.sh b/t/t5326-multi-pack-bitmaps.sh
index 6eaa692f33..d27557b9b0 100755
--- a/t/t5326-multi-pack-bitmaps.sh
+++ b/t/t5326-multi-pack-bitmaps.sh
@@ -2,7 +2,6 @@
test_description='exercise basic multi-pack bitmap functionality'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "${TEST_DIRECTORY}/lib-bitmap.sh"
diff --git a/t/t5327-multi-pack-bitmaps-rev.sh b/t/t5327-multi-pack-bitmaps-rev.sh
index 994a8e6be4..9cac03a94b 100755
--- a/t/t5327-multi-pack-bitmaps-rev.sh
+++ b/t/t5327-multi-pack-bitmaps-rev.sh
@@ -2,7 +2,6 @@
test_description='exercise basic multi-pack bitmap functionality (.rev files)'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "${TEST_DIRECTORY}/lib-bitmap.sh"
diff --git a/t/t5328-commit-graph-64bit-time.sh b/t/t5328-commit-graph-64bit-time.sh
index fc6a242b56..a766a3e3f8 100755
--- a/t/t5328-commit-graph-64bit-time.sh
+++ b/t/t5328-commit-graph-64bit-time.sh
@@ -2,7 +2,6 @@
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
diff --git a/t/t5329-pack-objects-cruft.sh b/t/t5329-pack-objects-cruft.sh
index 54a4a49997..b71a0aef40 100755
--- a/t/t5329-pack-objects-cruft.sh
+++ b/t/t5329-pack-objects-cruft.sh
@@ -2,7 +2,6 @@
test_description='cruft pack related pack-objects tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
objdir=.git/objects
diff --git a/t/t5330-no-lazy-fetch-with-commit-graph.sh b/t/t5330-no-lazy-fetch-with-commit-graph.sh
index 21f36eb8c3..313eadba98 100755
--- a/t/t5330-no-lazy-fetch-with-commit-graph.sh
+++ b/t/t5330-no-lazy-fetch-with-commit-graph.sh
@@ -2,7 +2,6 @@
test_description='test for no lazy fetch with the commit-graph'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup: prepare a repository with a commit' '
diff --git a/t/t5331-pack-objects-stdin.sh b/t/t5331-pack-objects-stdin.sh
index 2dcf1eecee..b48c0cbe8f 100755
--- a/t/t5331-pack-objects-stdin.sh
+++ b/t/t5331-pack-objects-stdin.sh
@@ -4,7 +4,6 @@ test_description='pack-objects --stdin'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
packed_objects () {
diff --git a/t/t5332-multi-pack-reuse.sh b/t/t5332-multi-pack-reuse.sh
index e9d80186ec..57cad7708f 100755
--- a/t/t5332-multi-pack-reuse.sh
+++ b/t/t5332-multi-pack-reuse.sh
@@ -2,7 +2,6 @@
test_description='pack-objects multi-pack reuse'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-bitmap.sh
diff --git a/t/t5333-pseudo-merge-bitmaps.sh b/t/t5333-pseudo-merge-bitmaps.sh
index eca4a1eb8c..1dd6284756 100755
--- a/t/t5333-pseudo-merge-bitmaps.sh
+++ b/t/t5333-pseudo-merge-bitmaps.sh
@@ -4,7 +4,6 @@ test_description='pseudo-merge bitmaps'
GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=0
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_pseudo_merges () {
diff --git a/t/t5334-incremental-multi-pack-index.sh b/t/t5334-incremental-multi-pack-index.sh
index 471994c4bc..26257e5660 100755
--- a/t/t5334-incremental-multi-pack-index.sh
+++ b/t/t5334-incremental-multi-pack-index.sh
@@ -2,7 +2,6 @@
test_description='incremental multi-pack-index'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-midx.sh
diff --git a/t/t5351-unpack-large-objects.sh b/t/t5351-unpack-large-objects.sh
index 43cbcd5d49..d76eb4be93 100755
--- a/t/t5351-unpack-large-objects.sh
+++ b/t/t5351-unpack-large-objects.sh
@@ -5,7 +5,6 @@
test_description='git unpack-objects with large objects'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
prepare_dest () {
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index 248c74d8ef..3f81f16e13 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -9,7 +9,6 @@ test_description='See why rewinding head breaks send-pack
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cnt=64
diff --git a/t/t5401-update-hooks.sh b/t/t5401-update-hooks.sh
index 3c1ea6086e..723d1e17ec 100755
--- a/t/t5401-update-hooks.sh
+++ b/t/t5401-update-hooks.sh
@@ -5,7 +5,6 @@
test_description='Test the update hook infrastructure.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t5402-post-merge-hook.sh b/t/t5402-post-merge-hook.sh
index 46ebdfbeeb..915af2de95 100755
--- a/t/t5402-post-merge-hook.sh
+++ b/t/t5402-post-merge-hook.sh
@@ -7,7 +7,6 @@ test_description='Test the post-merge hook.'
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 '
diff --git a/t/t5403-post-checkout-hook.sh b/t/t5403-post-checkout-hook.sh
index cfaae54739..978f240cda 100755
--- a/t/t5403-post-checkout-hook.sh
+++ b/t/t5403-post-checkout-hook.sh
@@ -7,7 +7,6 @@ test_description='Test the post-checkout hook.'
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 '
diff --git a/t/t5404-tracking-branches.sh b/t/t5404-tracking-branches.sh
index 51737eeafe..cc07889667 100755
--- a/t/t5404-tracking-branches.sh
+++ b/t/t5404-tracking-branches.sh
@@ -5,7 +5,6 @@ test_description='tracking branch update checks for git push'
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' '
diff --git a/t/t5405-send-pack-rewind.sh b/t/t5405-send-pack-rewind.sh
index 1686ac13aa..11f03239a0 100755
--- a/t/t5405-send-pack-rewind.sh
+++ b/t/t5405-send-pack-rewind.sh
@@ -5,7 +5,6 @@ test_description='forced push to replace commit we do not have'
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 '
diff --git a/t/t5406-remote-rejects.sh b/t/t5406-remote-rejects.sh
index d6a9946633..dcbeb42082 100755
--- a/t/t5406-remote-rejects.sh
+++ b/t/t5406-remote-rejects.sh
@@ -2,7 +2,6 @@
test_description='remote push rejects are reported by client'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh
index e99e728236..ad7f8c6f00 100755
--- a/t/t5407-post-rewrite-hook.sh
+++ b/t/t5407-post-rewrite-hook.sh
@@ -7,7 +7,6 @@ test_description='Test the post-rewrite hook.'
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' '
diff --git a/t/t5408-send-pack-stdin.sh b/t/t5408-send-pack-stdin.sh
index c3695a4d4e..526a675045 100755
--- a/t/t5408-send-pack-stdin.sh
+++ b/t/t5408-send-pack-stdin.sh
@@ -2,7 +2,6 @@
test_description='send-pack --stdin tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
create_ref () {
diff --git a/t/t5409-colorize-remote-messages.sh b/t/t5409-colorize-remote-messages.sh
index 516b22fd96..fa5de4500a 100755
--- a/t/t5409-colorize-remote-messages.sh
+++ b/t/t5409-colorize-remote-messages.sh
@@ -2,7 +2,6 @@
test_description='remote messages are colorized on the client'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t5410-receive-pack-alternates.sh b/t/t5410-receive-pack-alternates.sh
index 7a45d4c311..0b28e4e452 100755
--- a/t/t5410-receive-pack-alternates.sh
+++ b/t/t5410-receive-pack-alternates.sh
@@ -5,7 +5,6 @@ test_description='git receive-pack with alternate ref filtering'
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' '
diff --git a/t/t5411-proc-receive-hook.sh b/t/t5411-proc-receive-hook.sh
index 13d2d310a9..92cf52c6d4 100755
--- a/t/t5411-proc-receive-hook.sh
+++ b/t/t5411-proc-receive-hook.sh
@@ -8,7 +8,6 @@ test_description='Test proc-receive hook'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/t5411/common-functions.sh
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 6552da78d1..2677cd5faa 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -8,7 +8,6 @@ test_description='Testing multi_ack pack fetching'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Test fetch-pack/upload-pack pair.
diff --git a/t/t5501-fetch-push-alternates.sh b/t/t5501-fetch-push-alternates.sh
index 0c8668a1b8..66f19a4ef2 100755
--- a/t/t5501-fetch-push-alternates.sh
+++ b/t/t5501-fetch-push-alternates.sh
@@ -4,7 +4,6 @@ test_description='fetch/push involving alternates'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
count_objects () {
diff --git a/t/t5502-quickfetch.sh b/t/t5502-quickfetch.sh
index 7b3ff21b98..b160f8b7fb 100755
--- a/t/t5502-quickfetch.sh
+++ b/t/t5502-quickfetch.sh
@@ -5,7 +5,6 @@ test_description='test quickfetch from local'
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 '
diff --git a/t/t5503-tagfollow.sh b/t/t5503-tagfollow.sh
index 5ebbaa4896..195fc64dd4 100755
--- a/t/t5503-tagfollow.sh
+++ b/t/t5503-tagfollow.sh
@@ -5,7 +5,6 @@ test_description='test automatic tag following'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# End state of the repository:
diff --git a/t/t5504-fetch-receive-strict.sh b/t/t5504-fetch-receive-strict.sh
index 138e6778a4..8212a70be8 100755
--- a/t/t5504-fetch-receive-strict.sh
+++ b/t/t5504-fetch-receive-strict.sh
@@ -4,7 +4,6 @@ test_description='fetch/receive strict mode'
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 and inject "corrupt or missing" object' '
@@ -171,7 +170,7 @@ test_expect_success 'fsck with invalid or bogus skipList input' '
test_must_fail git -c fsck.skipList=does-not-exist -c fsck.missingEmail=ignore fsck 2>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_grep "invalid object name: \[core\]" err
+ test_grep "invalid object name: " err
'
test_expect_success 'fsck with other accepted skipList input (comments & empty lines)' '
@@ -234,7 +233,7 @@ test_expect_success 'push with receive.fsck.skipList' '
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_grep "invalid object name: \[core\]" err &&
+ test_grep "invalid object name: " err &&
git --git-dir=dst/.git config receive.fsck.skipList SKIP &&
git push --porcelain dst bogus
@@ -263,7 +262,7 @@ test_expect_success 'fetch with fetch.fsck.skipList' '
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_grep "invalid object name: \[core\]" err &&
+ test_grep "invalid object name: " err &&
git --git-dir=dst/.git config fetch.fsck.skipList dst/.git/SKIP &&
git --git-dir=dst/.git fetch "file://$(pwd)" $refspec
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 532035933f..519f7973e3 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -2,7 +2,9 @@
test_description='git remote porcelain-ish'
-TEST_PASSES_SANITIZE_LEAK=true
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
. ./test-lib.sh
setup_repository () {
@@ -71,7 +73,7 @@ test_expect_success 'add another remote' '
cd test &&
git remote add -f second ../two &&
tokens_match "origin second" "$(git remote)" &&
- check_tracking_branch second main side another &&
+ check_tracking_branch second main side another HEAD &&
git for-each-ref "--format=%(refname)" refs/remotes |
sed -e "/^refs\/remotes\/origin\//d" \
-e "/^refs\/remotes\/second\//d" >actual &&
@@ -429,16 +431,90 @@ test_expect_success 'set-head --auto' '
)
'
+test_expect_success REFFILES 'set-head --auto failure' '
+ test_when_finished "rm -f test/.git/refs/remotes/origin/HEAD.lock" &&
+ (
+ cd test &&
+ touch .git/refs/remotes/origin/HEAD.lock &&
+ test_must_fail git remote set-head --auto origin 2>err &&
+ tail -n1 err >output &&
+ echo "error: Could not set up refs/remotes/origin/HEAD" >expect &&
+ test_cmp expect output
+ )
+'
+
+test_expect_success 'set-head --auto detects creation' '
+ (
+ cd test &&
+ git update-ref --no-deref -d refs/remotes/origin/HEAD &&
+ git remote set-head --auto origin >output &&
+ echo "${SQ}origin/HEAD${SQ} is now created and points to ${SQ}main${SQ}" >expect &&
+ test_cmp expect output
+ )
+'
+
+test_expect_success 'set-head --auto to update a non symbolic ref' '
+ (
+ cd test &&
+ git update-ref --no-deref -d refs/remotes/origin/HEAD &&
+ git update-ref refs/remotes/origin/HEAD HEAD &&
+ HEAD=$(git log --pretty="%H") &&
+ git remote set-head --auto origin >output &&
+ echo "${SQ}origin/HEAD${SQ} was detached at ${SQ}${HEAD}${SQ} and now points to ${SQ}main${SQ}" >expect &&
+ test_cmp expect output
+ )
+'
+
+test_expect_success 'set-head --auto detects no change' '
+ (
+ cd test &&
+ git remote set-head --auto origin >output &&
+ echo "${SQ}origin/HEAD${SQ} is unchanged and points to ${SQ}main${SQ}" >expect &&
+ test_cmp expect output
+ )
+'
+
+test_expect_success 'set-head --auto detects change' '
+ (
+ cd test &&
+ git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/ahead &&
+ git remote set-head --auto origin >output &&
+ echo "${SQ}origin/HEAD${SQ} has changed from ${SQ}ahead${SQ} and now points to ${SQ}main${SQ}" >expect &&
+ test_cmp expect output
+ )
+'
+
+test_expect_success 'set-head --auto detects strange ref' '
+ (
+ cd test &&
+ git symbolic-ref refs/remotes/origin/HEAD refs/heads/main &&
+ git remote set-head --auto origin >output &&
+ echo "${SQ}origin/HEAD${SQ} used to point to ${SQ}refs/heads/main${SQ} (which is not a remote branch), but now points to ${SQ}main${SQ}" >expect &&
+ test_cmp expect output
+ )
+'
+
test_expect_success 'set-head --auto has no problem w/multiple HEADs' '
(
cd test &&
git fetch two "refs/heads/*:refs/remotes/two/*" &&
git remote set-head --auto two >output 2>&1 &&
- echo "two/HEAD set to main" >expect &&
+ echo "${SQ}two/HEAD${SQ} is unchanged and points to ${SQ}main${SQ}" >expect &&
test_cmp expect output
)
'
+test_expect_success 'set-head changes followRemoteHEAD always to warn' '
+ (
+ cd test &&
+ git config set remote.origin.followRemoteHEAD "always" &&
+ git remote set-head --auto origin &&
+ git config get remote.origin.followRemoteHEAD >actual &&
+ echo "warn" >expect &&
+ test_cmp expect actual
+ )
+'
+
cat >test/expect <<\EOF
refs/remotes/origin/side2
EOF
@@ -453,6 +529,16 @@ test_expect_success 'set-head explicit' '
)
'
+test_expect_success 'set-head --auto reports change' '
+ (
+ cd test &&
+ git remote set-head origin side2 &&
+ git remote set-head --auto origin >output 2>&1 &&
+ echo "${SQ}origin/HEAD${SQ} has changed from ${SQ}side2${SQ} and now points to ${SQ}main${SQ}" >expect &&
+ test_cmp expect output
+ )
+'
+
cat >test/expect <<EOF
Pruning origin
URL: $(pwd)/one
@@ -493,6 +579,16 @@ test_expect_success 'add --mirror && prune' '
)
'
+test_expect_success 'add --mirror setting HEAD' '
+ mkdir headmirror &&
+ (
+ cd headmirror &&
+ git init --bare -b notmain &&
+ git remote add --mirror -f origin ../one &&
+ test "$(git symbolic-ref HEAD)" = "refs/heads/main"
+ )
+'
+
test_expect_success 'add --mirror=fetch' '
mkdir mirror-fetch &&
git init -b main mirror-fetch/parent &&
@@ -712,8 +808,10 @@ test_expect_success 'reject --no-no-tags' '
'
cat >one/expect <<\EOF
+ apis/HEAD -> apis/main
apis/main
apis/side
+ drosophila/HEAD -> drosophila/main
drosophila/another
drosophila/main
drosophila/side
@@ -731,11 +829,14 @@ test_expect_success 'update' '
'
cat >one/expect <<\EOF
+ drosophila/HEAD -> drosophila/main
drosophila/another
drosophila/main
drosophila/side
+ manduca/HEAD -> manduca/main
manduca/main
manduca/side
+ megaloprepus/HEAD -> megaloprepus/main
megaloprepus/main
megaloprepus/side
EOF
@@ -743,7 +844,7 @@ EOF
test_expect_success 'update with arguments' '
(
cd one &&
- for b in $(git branch -r)
+ for b in $(git branch -r | grep -v HEAD)
do
git branch -r -d $b || exit 1
done &&
@@ -775,10 +876,13 @@ test_expect_success 'update --prune' '
'
cat >one/expect <<-\EOF
+ apis/HEAD -> apis/main
apis/main
apis/side
+ manduca/HEAD -> manduca/main
manduca/main
manduca/side
+ megaloprepus/HEAD -> megaloprepus/main
megaloprepus/main
megaloprepus/side
EOF
@@ -786,7 +890,7 @@ EOF
test_expect_success 'update default' '
(
cd one &&
- for b in $(git branch -r)
+ for b in $(git branch -r | grep -v HEAD)
do
git branch -r -d $b || exit 1
done &&
@@ -798,6 +902,7 @@ test_expect_success 'update default' '
'
cat >one/expect <<\EOF
+ drosophila/HEAD -> drosophila/main
drosophila/another
drosophila/main
drosophila/side
@@ -806,7 +911,7 @@ EOF
test_expect_success 'update default (overridden, with funny whitespace)' '
(
cd one &&
- for b in $(git branch -r)
+ for b in $(git branch -r | grep -v HEAD)
do
git branch -r -d $b || exit 1
done &&
@@ -820,7 +925,7 @@ test_expect_success 'update default (overridden, with funny whitespace)' '
test_expect_success 'update (with remotes.default defined)' '
(
cd one &&
- for b in $(git branch -r)
+ for b in $(git branch -r | grep -v HEAD)
do
git branch -r -d $b || exit 1
done &&
diff --git a/t/t5506-remote-groups.sh b/t/t5506-remote-groups.sh
index 0e176175a3..16e9a1bc2f 100755
--- a/t/t5506-remote-groups.sh
+++ b/t/t5506-remote-groups.sh
@@ -4,7 +4,6 @@ test_description='git remote group handling'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
mark() {
diff --git a/t/t5507-remote-environment.sh b/t/t5507-remote-environment.sh
index c6a6957c50..a41d5b370b 100755
--- a/t/t5507-remote-environment.sh
+++ b/t/t5507-remote-environment.sh
@@ -2,7 +2,6 @@
test_description='check environment showed to remote side of transports'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'set up "remote" push situation' '
diff --git a/t/t5509-fetch-push-namespaces.sh b/t/t5509-fetch-push-namespaces.sh
index f029ae0d28..095df1a753 100755
--- a/t/t5509-fetch-push-namespaces.sh
+++ b/t/t5509-fetch-push-namespaces.sh
@@ -4,7 +4,6 @@ test_description='fetch/push involving ref namespaces'
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 '
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 0890b9f61c..2d9587059f 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -5,7 +5,6 @@ test_description='Per branch config variables affects "git fetch".
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-bundle.sh
@@ -75,6 +74,168 @@ test_expect_success "fetch test for-merge" '
cut -f -2 .git/FETCH_HEAD >actual &&
test_cmp expected actual'
+test_expect_success "fetch test remote HEAD" '
+ cd "$D" &&
+ cd two &&
+ git fetch &&
+ git rev-parse --verify refs/remotes/origin/HEAD &&
+ git rev-parse --verify refs/remotes/origin/main &&
+ head=$(git rev-parse refs/remotes/origin/HEAD) &&
+ branch=$(git rev-parse refs/remotes/origin/main) &&
+ test "z$head" = "z$branch"'
+
+test_expect_success "fetch test remote HEAD change" '
+ cd "$D" &&
+ cd two &&
+ git switch -c other &&
+ git push -u origin other &&
+ git rev-parse --verify refs/remotes/origin/HEAD &&
+ git rev-parse --verify refs/remotes/origin/main &&
+ git rev-parse --verify refs/remotes/origin/other &&
+ git remote set-head origin other &&
+ git fetch &&
+ head=$(git rev-parse refs/remotes/origin/HEAD) &&
+ branch=$(git rev-parse refs/remotes/origin/other) &&
+ test "z$head" = "z$branch"'
+
+test_expect_success "fetch test followRemoteHEAD never" '
+ test_when_finished "git config unset remote.origin.followRemoteHEAD" &&
+ (
+ cd "$D" &&
+ cd two &&
+ git update-ref --no-deref -d refs/remotes/origin/HEAD &&
+ git config set remote.origin.followRemoteHEAD "never" &&
+ git fetch &&
+ test_must_fail git rev-parse --verify refs/remotes/origin/HEAD
+ )
+'
+
+test_expect_success "fetch test followRemoteHEAD warn no change" '
+ test_when_finished "git config unset remote.origin.followRemoteHEAD" &&
+ (
+ cd "$D" &&
+ cd two &&
+ git rev-parse --verify refs/remotes/origin/other &&
+ git remote set-head origin other &&
+ git rev-parse --verify refs/remotes/origin/HEAD &&
+ git rev-parse --verify refs/remotes/origin/main &&
+ git config set remote.origin.followRemoteHEAD "warn" &&
+ git fetch >output &&
+ echo "${SQ}HEAD${SQ} at ${SQ}origin${SQ} is ${SQ}main${SQ}," \
+ "but we have ${SQ}other${SQ} locally." >expect &&
+ test_cmp expect output &&
+ head=$(git rev-parse refs/remotes/origin/HEAD) &&
+ branch=$(git rev-parse refs/remotes/origin/other) &&
+ test "z$head" = "z$branch"
+ )
+'
+
+test_expect_success "fetch test followRemoteHEAD warn create" '
+ test_when_finished "git config unset remote.origin.followRemoteHEAD" &&
+ (
+ cd "$D" &&
+ cd two &&
+ git update-ref --no-deref -d refs/remotes/origin/HEAD &&
+ git config set remote.origin.followRemoteHEAD "warn" &&
+ git rev-parse --verify refs/remotes/origin/main &&
+ output=$(git fetch) &&
+ test "z" = "z$output" &&
+ head=$(git rev-parse refs/remotes/origin/HEAD) &&
+ branch=$(git rev-parse refs/remotes/origin/main) &&
+ test "z$head" = "z$branch"
+ )
+'
+
+test_expect_success "fetch test followRemoteHEAD warn detached" '
+ test_when_finished "git config unset remote.origin.followRemoteHEAD" &&
+ (
+ cd "$D" &&
+ cd two &&
+ git update-ref --no-deref -d refs/remotes/origin/HEAD &&
+ git update-ref refs/remotes/origin/HEAD HEAD &&
+ HEAD=$(git log --pretty="%H") &&
+ git config set remote.origin.followRemoteHEAD "warn" &&
+ git fetch >output &&
+ echo "${SQ}HEAD${SQ} at ${SQ}origin${SQ} is ${SQ}main${SQ}," \
+ "but we have a detached HEAD pointing to" \
+ "${SQ}${HEAD}${SQ} locally." >expect &&
+ test_cmp expect output
+ )
+'
+
+test_expect_success "fetch test followRemoteHEAD warn quiet" '
+ test_when_finished "git config unset remote.origin.followRemoteHEAD" &&
+ (
+ cd "$D" &&
+ cd two &&
+ git rev-parse --verify refs/remotes/origin/other &&
+ git remote set-head origin other &&
+ git rev-parse --verify refs/remotes/origin/HEAD &&
+ git rev-parse --verify refs/remotes/origin/main &&
+ git config set remote.origin.followRemoteHEAD "warn" &&
+ output=$(git fetch --quiet) &&
+ test "z" = "z$output" &&
+ head=$(git rev-parse refs/remotes/origin/HEAD) &&
+ branch=$(git rev-parse refs/remotes/origin/other) &&
+ test "z$head" = "z$branch"
+ )
+'
+
+test_expect_success "fetch test followRemoteHEAD warn-if-not-branch branch is same" '
+ test_when_finished "git config unset remote.origin.followRemoteHEAD" &&
+ (
+ cd "$D" &&
+ cd two &&
+ git rev-parse --verify refs/remotes/origin/other &&
+ git remote set-head origin other &&
+ git rev-parse --verify refs/remotes/origin/HEAD &&
+ git rev-parse --verify refs/remotes/origin/main &&
+ git config set remote.origin.followRemoteHEAD "warn-if-not-main" &&
+ actual=$(git fetch) &&
+ test "z" = "z$actual" &&
+ head=$(git rev-parse refs/remotes/origin/HEAD) &&
+ branch=$(git rev-parse refs/remotes/origin/other) &&
+ test "z$head" = "z$branch"
+ )
+'
+
+test_expect_success "fetch test followRemoteHEAD warn-if-not-branch branch is different" '
+ test_when_finished "git config unset remote.origin.followRemoteHEAD" &&
+ (
+ cd "$D" &&
+ cd two &&
+ git rev-parse --verify refs/remotes/origin/other &&
+ git remote set-head origin other &&
+ git rev-parse --verify refs/remotes/origin/HEAD &&
+ git rev-parse --verify refs/remotes/origin/main &&
+ git config set remote.origin.followRemoteHEAD "warn-if-not-some/different-branch" &&
+ git fetch >actual &&
+ echo "${SQ}HEAD${SQ} at ${SQ}origin${SQ} is ${SQ}main${SQ}," \
+ "but we have ${SQ}other${SQ} locally." >expect &&
+ test_cmp expect actual &&
+ head=$(git rev-parse refs/remotes/origin/HEAD) &&
+ branch=$(git rev-parse refs/remotes/origin/other) &&
+ test "z$head" = "z$branch"
+ )
+'
+
+test_expect_success "fetch test followRemoteHEAD always" '
+ test_when_finished "git config unset remote.origin.followRemoteHEAD" &&
+ (
+ cd "$D" &&
+ cd two &&
+ git rev-parse --verify refs/remotes/origin/other &&
+ git remote set-head origin other &&
+ git rev-parse --verify refs/remotes/origin/HEAD &&
+ git rev-parse --verify refs/remotes/origin/main &&
+ git config set remote.origin.followRemoteHEAD "always" &&
+ git fetch &&
+ head=$(git rev-parse refs/remotes/origin/HEAD) &&
+ branch=$(git rev-parse refs/remotes/origin/main) &&
+ test "z$head" = "z$branch"
+ )
+'
+
test_expect_success 'fetch --prune on its own works as expected' '
cd "$D" &&
git clone . prune &&
@@ -165,6 +326,23 @@ test_expect_success 'fetch --prune --tags with refspec prunes based on refspec'
git rev-parse sometag
'
+test_expect_success 'fetch --tags gets tags even without a configured remote' '
+ REMOTE="$(pwd)/test_tag_1" &&
+ git init test_tag_1 &&
+ (
+ cd test_tag_1 &&
+ test_commit foo
+ ) &&
+ git init test_tag_2 &&
+ (
+ cd test_tag_2 &&
+ git fetch --tags "file://$REMOTE" &&
+ echo "foo" >expect &&
+ git tag >actual &&
+ test_cmp expect actual
+ )
+'
+
test_expect_success REFFILES 'fetch --prune fails to delete branches' '
cd "$D" &&
git clone . prune-fail &&
diff --git a/t/t5511-refspec.sh b/t/t5511-refspec.sh
index fc55681a3f..be025b90f9 100755
--- a/t/t5511-refspec.sh
+++ b/t/t5511-refspec.sh
@@ -2,7 +2,6 @@
test_description='refspec parsing'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_refspec () {
diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index 64b3491e4e..5930f55186 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -5,7 +5,6 @@ test_description='git ls-remote'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
generate_references () {
@@ -293,6 +292,8 @@ test_expect_success 'ls-remote with filtered symref (refname)' '
cat >expect <<-EOF &&
ref: refs/heads/main HEAD
$rev HEAD
+ ref: refs/remotes/origin/main refs/remotes/origin/HEAD
+ $rev refs/remotes/origin/HEAD
EOF
git ls-remote --symref . HEAD >actual &&
test_cmp expect actual
diff --git a/t/t5513-fetch-track.sh b/t/t5513-fetch-track.sh
index c46c4dbaef..65d1e05bd6 100755
--- a/t/t5513-fetch-track.sh
+++ b/t/t5513-fetch-track.sh
@@ -2,7 +2,6 @@
test_description='fetch follows remote-tracking branches correctly'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t5514-fetch-multiple.sh b/t/t5514-fetch-multiple.sh
index 579872c258..523aff6268 100755
--- a/t/t5514-fetch-multiple.sh
+++ b/t/t5514-fetch-multiple.sh
@@ -5,7 +5,6 @@ test_description='fetch --all works correctly'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
setup_repository () {
@@ -45,14 +44,17 @@ test_expect_success setup '
'
cat > test/expect << EOF
+ one/HEAD -> one/main
one/main
one/side
origin/HEAD -> origin/main
origin/main
origin/side
+ three/HEAD -> three/main
three/another
three/main
three/side
+ two/HEAD -> two/main
two/another
two/main
two/side
@@ -97,6 +99,7 @@ cat > expect << EOF
origin/HEAD -> origin/main
origin/main
origin/side
+ three/HEAD -> three/main
three/another
three/main
three/side
@@ -112,8 +115,10 @@ test_expect_success 'git fetch --multiple (but only one remote)' '
'
cat > expect << EOF
+ one/HEAD -> one/main
one/main
one/side
+ two/HEAD -> two/main
two/another
two/main
two/side
@@ -141,7 +146,7 @@ test_expect_success 'git fetch --multiple (bad remote names)' '
test_expect_success 'git fetch --all (skipFetchAll)' '
(cd test4 &&
- for b in $(git branch -r)
+ for b in $(git branch -r | grep -v HEAD)
do
git branch -r -d $b || exit 1
done &&
@@ -153,11 +158,14 @@ test_expect_success 'git fetch --all (skipFetchAll)' '
'
cat > expect << EOF
+ one/HEAD -> one/main
one/main
one/side
+ three/HEAD -> three/main
three/another
three/main
three/side
+ two/HEAD -> two/main
two/another
two/main
two/side
@@ -165,7 +173,7 @@ EOF
test_expect_success 'git fetch --multiple (ignoring skipFetchAll)' '
(cd test4 &&
- for b in $(git branch -r)
+ for b in $(git branch -r | grep -v HEAD)
do
git branch -r -d $b || exit 1
done &&
@@ -221,14 +229,17 @@ test_expect_success 'git fetch --multiple --jobs=0 picks a default' '
create_fetch_all_expect () {
cat >expect <<-\EOF
+ one/HEAD -> one/main
one/main
one/side
origin/HEAD -> origin/main
origin/main
origin/side
+ three/HEAD -> three/main
three/another
three/main
three/side
+ two/HEAD -> two/main
two/another
two/main
two/side
@@ -265,6 +276,7 @@ test_expect_success 'git fetch (fetch all remotes with fetch.all = true)' '
create_fetch_one_expect () {
cat >expect <<-\EOF
+ one/HEAD -> one/main
one/main
one/side
origin/HEAD -> origin/main
diff --git a/t/t5515-fetch-merge-logic.sh b/t/t5515-fetch-merge-logic.sh
index c100a809c5..320d26796d 100755
--- a/t/t5515-fetch-merge-logic.sh
+++ b/t/t5515-fetch-merge-logic.sh
@@ -14,7 +14,6 @@ export GIT_TEST_PROTOCOL_VERSION
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
build_script () {
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 331778bd42..041d7d806f 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -19,7 +19,6 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
D=$(pwd)
@@ -1395,7 +1394,8 @@ test_expect_success 'fetch follows tags by default' '
git tag -m "annotated" tag &&
git for-each-ref >tmp1 &&
sed -n "p; s|refs/heads/main$|refs/remotes/origin/main|p" tmp1 |
- sort -k 3 >../expect
+ sed -n "p; s|refs/heads/main$|refs/remotes/origin/HEAD|p" |
+ sort -k 4 >../expect
) &&
test_when_finished "rm -rf dst" &&
git init dst &&
diff --git a/t/t5517-push-mirror.sh b/t/t5517-push-mirror.sh
index 6d4944a728..a448e169bd 100755
--- a/t/t5517-push-mirror.sh
+++ b/t/t5517-push-mirror.sh
@@ -5,7 +5,6 @@ test_description='pushing to a mirror repository'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
D=$(pwd)
diff --git a/t/t5518-fetch-exit-status.sh b/t/t5518-fetch-exit-status.sh
index c13120088f..5c4ac2556e 100755
--- a/t/t5518-fetch-exit-status.sh
+++ b/t/t5518-fetch-exit-status.sh
@@ -8,7 +8,6 @@ test_description='fetch exit status test'
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 '
diff --git a/t/t5519-push-alternates.sh b/t/t5519-push-alternates.sh
index 72e97b15fa..20ba604dfd 100755
--- a/t/t5519-push-alternates.sh
+++ b/t/t5519-push-alternates.sh
@@ -5,7 +5,6 @@ test_description='push to a repository that borrows from elsewhere'
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 '
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 1098cbd0a1..47534f1062 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -5,7 +5,6 @@ test_description='pulling into void'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
modify () {
diff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh
index db00c4336b..5e420c208c 100755
--- a/t/t5521-pull-options.sh
+++ b/t/t5521-pull-options.sh
@@ -5,7 +5,6 @@ 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' '
diff --git a/t/t5522-pull-symlink.sh b/t/t5522-pull-symlink.sh
index cc5496e28f..9fb73a8c3e 100755
--- a/t/t5522-pull-symlink.sh
+++ b/t/t5522-pull-symlink.sh
@@ -2,7 +2,6 @@
test_description='pulling from symlinked subdir'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# The scenario we are building:
diff --git a/t/t5523-push-upstream.sh b/t/t5523-push-upstream.sh
index 4ad36a31e1..22d3e1162c 100755
--- a/t/t5523-push-upstream.sh
+++ b/t/t5523-push-upstream.sh
@@ -4,7 +4,6 @@ test_description='push with --set-upstream'
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-terminal.sh
diff --git a/t/t5524-pull-msg.sh b/t/t5524-pull-msg.sh
index 56716e29dd..b2be3605f5 100755
--- a/t/t5524-pull-msg.sh
+++ b/t/t5524-pull-msg.sh
@@ -2,7 +2,6 @@
test_description='git pull message generation'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
dollar='$Dollar'
diff --git a/t/t5525-fetch-tagopt.sh b/t/t5525-fetch-tagopt.sh
index 3a28f1ded5..45815f7378 100755
--- a/t/t5525-fetch-tagopt.sh
+++ b/t/t5525-fetch-tagopt.sh
@@ -2,7 +2,6 @@
test_description='tagopt variable affects "git fetch" and is overridden by commandline.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
setup_clone () {
diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
index 2cfb5bd6bb..5e566205ba 100755
--- a/t/t5526-fetch-submodules.sh
+++ b/t/t5526-fetch-submodules.sh
@@ -6,7 +6,6 @@ test_description='Recursive "git fetch" for submodules'
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
pwd=$(pwd)
diff --git a/t/t5527-fetch-odd-refs.sh b/t/t5527-fetch-odd-refs.sh
index 98ece27c6a..0de8eb5b6f 100755
--- a/t/t5527-fetch-odd-refs.sh
+++ b/t/t5527-fetch-odd-refs.sh
@@ -4,7 +4,6 @@ test_description='test fetching of oddly-named refs'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# afterwards we will have:
@@ -52,7 +51,8 @@ test_expect_success LONG_REF 'fetch handles extremely long refname' '
long
main
EOF
- git for-each-ref --format="%(subject)" refs/remotes/long >actual &&
+ git for-each-ref --format="%(subject)" refs/remotes/long \
+ --exclude=refs/remotes/long/HEAD >actual &&
test_cmp expect actual
'
diff --git a/t/t5528-push-default.sh b/t/t5528-push-default.sh
index 1305b1cc25..2bd8759a68 100755
--- a/t/t5528-push-default.sh
+++ b/t/t5528-push-default.sh
@@ -4,7 +4,6 @@ test_description='check various push.default settings'
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 bare remotes' '
diff --git a/t/t5529-push-errors.sh b/t/t5529-push-errors.sh
index 17d7257892..80b06a0cd2 100755
--- a/t/t5529-push-errors.sh
+++ b/t/t5529-push-errors.sh
@@ -5,7 +5,6 @@ test_description='detect some push errors early (before contacting remote)'
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 commits' '
diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh
index 7172780d55..558eedf25a 100755
--- a/t/t5530-upload-pack-error.sh
+++ b/t/t5530-upload-pack-error.sh
@@ -2,7 +2,6 @@
test_description='errors in upload-pack'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
D=$(pwd)
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
index dcfef67af4..05debd1134 100755
--- a/t/t5531-deep-submodule-push.sh
+++ b/t/t5531-deep-submodule-push.sh
@@ -8,7 +8,6 @@ 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_expect_success setup '
diff --git a/t/t5532-fetch-proxy.sh b/t/t5532-fetch-proxy.sh
index d664912799..3755822629 100755
--- a/t/t5532-fetch-proxy.sh
+++ b/t/t5532-fetch-proxy.sh
@@ -2,7 +2,6 @@
test_description='fetching via git:// using core.gitproxy'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup remote repo' '
diff --git a/t/t5533-push-cas.sh b/t/t5533-push-cas.sh
index 6365d99777..cba26a872d 100755
--- a/t/t5533-push-cas.sh
+++ b/t/t5533-push-cas.sh
@@ -5,7 +5,6 @@ test_description='compare & swap push force/delete safety'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
setup_srcdst_basic () {
diff --git a/t/t5534-push-signed.sh b/t/t5534-push-signed.sh
index d43aee0c32..c91a62b77a 100755
--- a/t/t5534-push-signed.sh
+++ b/t/t5534-push-signed.sh
@@ -5,7 +5,6 @@ test_description='signed push'
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-gpg.sh
diff --git a/t/t5535-fetch-push-symref.sh b/t/t5535-fetch-push-symref.sh
index 7122af7fdb..e8f6d233ff 100755
--- a/t/t5535-fetch-push-symref.sh
+++ b/t/t5535-fetch-push-symref.sh
@@ -2,7 +2,6 @@
test_description='avoiding conflicting update through symref aliasing'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t5536-fetch-conflicts.sh b/t/t5536-fetch-conflicts.sh
index 2dcbe79052..23bf696170 100755
--- a/t/t5536-fetch-conflicts.sh
+++ b/t/t5536-fetch-conflicts.sh
@@ -2,7 +2,6 @@
test_description='fetch handles conflicting refspecs correctly'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
D=$(pwd)
diff --git a/t/t5537-fetch-shallow.sh b/t/t5537-fetch-shallow.sh
index cae4d400f3..37f7547a4c 100755
--- a/t/t5537-fetch-shallow.sh
+++ b/t/t5537-fetch-shallow.sh
@@ -5,7 +5,6 @@ test_description='fetch/clone from a shallow clone'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
commit() {
diff --git a/t/t5538-push-shallow.sh b/t/t5538-push-shallow.sh
index 6adc3a20a4..e91fcc173e 100755
--- a/t/t5538-push-shallow.sh
+++ b/t/t5538-push-shallow.sh
@@ -5,7 +5,6 @@ test_description='push from/to a shallow clone'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
commit() {
diff --git a/t/t5539-fetch-http-shallow.sh b/t/t5539-fetch-http-shallow.sh
index 82fe09d0a9..3ea75d34ca 100755
--- a/t/t5539-fetch-http-shallow.sh
+++ b/t/t5539-fetch-http-shallow.sh
@@ -5,7 +5,6 @@ test_description='fetch/clone from a shallow clone over http'
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-httpd.sh
start_httpd
diff --git a/t/t5540-http-push-webdav.sh b/t/t5540-http-push-webdav.sh
index 27389b0908..37db3dec0c 100755
--- a/t/t5540-http-push-webdav.sh
+++ b/t/t5540-http-push-webdav.sh
@@ -10,7 +10,6 @@ This test runs various sanity checks on http-push.'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
if git http-push > /dev/null 2>&1 || [ $? -eq 128 ]
diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
index 3ad514bbd4..71428f3d5c 100755
--- a/t/t5541-http-push-smart.sh
+++ b/t/t5541-http-push-smart.sh
@@ -7,7 +7,6 @@ test_description='test smart pushing over http via http-backend'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
ROOT_PATH="$PWD"
diff --git a/t/t5542-push-http-shallow.sh b/t/t5542-push-http-shallow.sh
index 07624a1d7f..c2cc83182f 100755
--- a/t/t5542-push-http-shallow.sh
+++ b/t/t5542-push-http-shallow.sh
@@ -5,7 +5,6 @@ test_description='push from/to a shallow clone over http'
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-httpd.sh
start_httpd
diff --git a/t/t5543-atomic-push.sh b/t/t5543-atomic-push.sh
index 479d103469..04b47ad84a 100755
--- a/t/t5543-atomic-push.sh
+++ b/t/t5543-atomic-push.sh
@@ -5,7 +5,6 @@ test_description='pushing to a repository using the atomic push option'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
mk_repo_pair () {
diff --git a/t/t5544-pack-objects-hook.sh b/t/t5544-pack-objects-hook.sh
index 1a9e14bbcc..89147a052e 100755
--- a/t/t5544-pack-objects-hook.sh
+++ b/t/t5544-pack-objects-hook.sh
@@ -2,7 +2,6 @@
test_description='test custom script in place of pack-objects'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'create some history to fetch' '
diff --git a/t/t5545-push-options.sh b/t/t5545-push-options.sh
index 64ce56d3aa..fb13549da7 100755
--- a/t/t5545-push-options.sh
+++ b/t/t5545-push-options.sh
@@ -8,7 +8,6 @@ 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
mk_repo_pair () {
diff --git a/t/t5546-receive-limits.sh b/t/t5546-receive-limits.sh
index 9fc9ba552f..f1e61c9f09 100755
--- a/t/t5546-receive-limits.sh
+++ b/t/t5546-receive-limits.sh
@@ -2,7 +2,6 @@
test_description='check receive input limits'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Let's run tests with different unpack limits: 1 and 10000
diff --git a/t/t5547-push-quarantine.sh b/t/t5547-push-quarantine.sh
index 9f899b8c7d..0798ddab02 100755
--- a/t/t5547-push-quarantine.sh
+++ b/t/t5547-push-quarantine.sh
@@ -2,7 +2,6 @@
test_description='check quarantine of objects during push'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'create picky dest repo' '
diff --git a/t/t5548-push-porcelain.sh b/t/t5548-push-porcelain.sh
index ecb3877aa4..6282728eaf 100755
--- a/t/t5548-push-porcelain.sh
+++ b/t/t5548-push-porcelain.sh
@@ -4,7 +4,6 @@
#
test_description='Test git push porcelain output'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Create commits in <repo> and assign each commit's oid to shell variables
diff --git a/t/t5549-fetch-push-http.sh b/t/t5549-fetch-push-http.sh
index 6377fb6d99..2cdebcb735 100755
--- a/t/t5549-fetch-push-http.sh
+++ b/t/t5549-fetch-push-http.sh
@@ -5,7 +5,6 @@ test_description='fetch/push functionality using the HTTP protocol'
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-httpd.sh
start_httpd
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
index 5115b8dc23..21795a19bf 100755
--- a/t/t5550-http-fetch-dumb.sh
+++ b/t/t5550-http-fetch-dumb.sh
@@ -4,7 +4,6 @@ test_description='test dumb fetching over http via static file'
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
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index 2ce88535a6..ceb3336a5c 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -5,7 +5,6 @@ test_description="test smart fetching over http via http-backend ($HTTP_PROTO)"
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-httpd.sh
test "$HTTP_PROTO" = "HTTP/2" && enable_http2
diff --git a/t/t5552-skipping-fetch-negotiator.sh b/t/t5552-skipping-fetch-negotiator.sh
index 4f2e5ae8df..eeddb85b1d 100755
--- a/t/t5552-skipping-fetch-negotiator.sh
+++ b/t/t5552-skipping-fetch-negotiator.sh
@@ -2,7 +2,6 @@
test_description='test skipping fetch negotiator'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'fetch.negotiationalgorithm config' '
diff --git a/t/t5553-set-upstream.sh b/t/t5553-set-upstream.sh
index 33e919a17e..70e3376d31 100755
--- a/t/t5553-set-upstream.sh
+++ b/t/t5553-set-upstream.sh
@@ -4,7 +4,6 @@ test_description='"git fetch/pull --set-upstream" basic tests.'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
check_config () {
diff --git a/t/t5554-noop-fetch-negotiator.sh b/t/t5554-noop-fetch-negotiator.sh
index 06991e8e8a..17e73b606d 100755
--- a/t/t5554-noop-fetch-negotiator.sh
+++ b/t/t5554-noop-fetch-negotiator.sh
@@ -2,7 +2,6 @@
test_description='test noop fetch negotiator'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'noop negotiator does not emit any "have"' '
diff --git a/t/t5555-http-smart-common.sh b/t/t5555-http-smart-common.sh
index 3dcb3340a3..e47ea1ad10 100755
--- a/t/t5555-http-smart-common.sh
+++ b/t/t5555-http-smart-common.sh
@@ -2,7 +2,6 @@
test_description='test functionality common to smart fetch & push'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t5557-http-get.sh b/t/t5557-http-get.sh
index 76a4bbd16a..67fcc23f11 100755
--- a/t/t5557-http-get.sh
+++ b/t/t5557-http-get.sh
@@ -2,7 +2,6 @@
test_description='test downloading a file by URL'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t5560-http-backend-noserver.sh b/t/t5560-http-backend-noserver.sh
index f75068de64..d30cf4f5b8 100755
--- a/t/t5560-http-backend-noserver.sh
+++ b/t/t5560-http-backend-noserver.sh
@@ -4,7 +4,6 @@ test_description='test git-http-backend-noserver'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
HTTPD_DOCUMENT_ROOT_PATH="$TRASH_DIRECTORY"
diff --git a/t/t5561-http-backend.sh b/t/t5561-http-backend.sh
index e1d3b8caed..9c57d84315 100755
--- a/t/t5561-http-backend.sh
+++ b/t/t5561-http-backend.sh
@@ -4,7 +4,6 @@ test_description='test git-http-backend'
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-httpd.sh
diff --git a/t/t5562-http-backend-content-length.sh b/t/t5562-http-backend-content-length.sh
index 7ee9858a78..f3b158274c 100755
--- a/t/t5562-http-backend-content-length.sh
+++ b/t/t5562-http-backend-content-length.sh
@@ -2,7 +2,6 @@
test_description='test git-http-backend respects CONTENT_LENGTH'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_lazy_prereq GZIP 'gzip --version'
diff --git a/t/t5562/invoke-with-content-length.pl b/t/t5562/invoke-with-content-length.pl
index 9babb9a375..211e29fade 100644
--- a/t/t5562/invoke-with-content-length.pl
+++ b/t/t5562/invoke-with-content-length.pl
@@ -1,4 +1,4 @@
-use 5.008001;
+require v5.26;
use strict;
use warnings;
diff --git a/t/t5563-simple-http-auth.sh b/t/t5563-simple-http-auth.sh
index ba03f6a09f..317f33af5a 100755
--- a/t/t5563-simple-http-auth.sh
+++ b/t/t5563-simple-http-auth.sh
@@ -2,7 +2,6 @@
test_description='test http auth header and credential helper interop'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-httpd.sh
diff --git a/t/t5564-http-proxy.sh b/t/t5564-http-proxy.sh
index 4aef99bc28..b27e481f95 100755
--- a/t/t5564-http-proxy.sh
+++ b/t/t5564-http-proxy.sh
@@ -2,7 +2,6 @@
test_description="test fetching through http proxy"
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-httpd.sh
diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh
index e3df7d8641..8df4001b72 100755
--- a/t/t5570-git-daemon.sh
+++ b/t/t5570-git-daemon.sh
@@ -4,7 +4,6 @@ test_description='test fetching over git protocol'
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-git-daemon.sh
diff --git a/t/t5571-pre-push-hook.sh b/t/t5571-pre-push-hook.sh
index 448134c4bf..a11b20e378 100755
--- a/t/t5571-pre-push-hook.sh
+++ b/t/t5571-pre-push-hook.sh
@@ -4,7 +4,6 @@ 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' '
diff --git a/t/t5572-pull-submodule.sh b/t/t5572-pull-submodule.sh
index 9b6cf8d88b..f7650e8475 100755
--- a/t/t5572-pull-submodule.sh
+++ b/t/t5572-pull-submodule.sh
@@ -5,7 +5,6 @@ test_description='pull can handle submodules'
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-submodule-update.sh
diff --git a/t/t5573-pull-verify-signatures.sh b/t/t5573-pull-verify-signatures.sh
index ab05f38a99..a76b54d7de 100755
--- a/t/t5573-pull-verify-signatures.sh
+++ b/t/t5573-pull-verify-signatures.sh
@@ -2,7 +2,6 @@
test_description='pull signature verification tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-gpg.sh"
diff --git a/t/t5574-fetch-output.sh b/t/t5574-fetch-output.sh
index f7707326ea..5883839a04 100755
--- a/t/t5574-fetch-output.sh
+++ b/t/t5574-fetch-output.sh
@@ -5,7 +5,6 @@ test_description='git fetch output format'
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 'fetch with invalid output format configuration' '
diff --git a/t/t5580-unc-paths.sh b/t/t5580-unc-paths.sh
index d7537a162b..65ef1a3628 100755
--- a/t/t5580-unc-paths.sh
+++ b/t/t5580-unc-paths.sh
@@ -4,7 +4,6 @@ test_description='various Windows-only path tests'
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 CYGWIN
diff --git a/t/t5581-http-curl-verbose.sh b/t/t5581-http-curl-verbose.sh
index 724f610054..cded79c16b 100755
--- a/t/t5581-http-curl-verbose.sh
+++ b/t/t5581-http-curl-verbose.sh
@@ -4,7 +4,6 @@ test_description='test GIT_CURL_VERBOSE'
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-httpd.sh
start_httpd
diff --git a/t/t5582-fetch-negative-refspec.sh b/t/t5582-fetch-negative-refspec.sh
index b21bf2057d..ae32f8178a 100755
--- a/t/t5582-fetch-negative-refspec.sh
+++ b/t/t5582-fetch-negative-refspec.sh
@@ -8,7 +8,6 @@ test_description='"git fetch" with negative refspecs.
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 '
diff --git a/t/t5583-push-branches.sh b/t/t5583-push-branches.sh
index 320f49c753..e7e1b6dab6 100755
--- a/t/t5583-push-branches.sh
+++ b/t/t5583-push-branches.sh
@@ -5,7 +5,6 @@ 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() {
diff --git a/t/t5600-clone-fail-cleanup.sh b/t/t5600-clone-fail-cleanup.sh
index c814afa565..34b3df4027 100755
--- a/t/t5600-clone-fail-cleanup.sh
+++ b/t/t5600-clone-fail-cleanup.sh
@@ -13,7 +13,6 @@ Unless the directory already exists, in which case we clean up only what we
wrote.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
corrupt_repo () {
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 9fe665eadf..d0c18660e3 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -544,12 +544,16 @@ do
test_clone_url [::1]:$repo ::1 "$repo"
'
done
-#home directory
-test_expect_success "clone host:/~repo" '
+
+# Home directory. All tests that use "~repo" are broken in our CI job when the
+# leak sanitizer is enabled. It seems like either a bug in the sanitizer or in
+# glibc, but when executing getpwnam(3p) with an invalid username we eventually
+# start recursing in a call to free(3p), until bust the stack and segfault.
+test_expect_success !SANITIZE_LEAK "clone host:/~repo" '
test_clone_url host:/~repo host "~repo"
'
-test_expect_$expectation_for_ipv6_tests "clone [::1]:/~repo" '
+test_expect_$expectation_for_ipv6_tests !SANITIZE_LEAK "clone [::1]:/~repo" '
test_clone_url [::1]:/~repo ::1 "~repo"
'
@@ -569,9 +573,9 @@ do
test_clone_url "ssh://host.xz$tcol/home/user/repo" host.xz /home/user/repo
'
# from home directory
- test_expect_success "clone ssh://host.xz$tcol/~repo" '
- test_clone_url "ssh://host.xz$tcol/~repo" host.xz "~repo"
-'
+ test_expect_success !SANITIZE_LEAK "clone ssh://host.xz$tcol/~repo" '
+ test_clone_url "ssh://host.xz$tcol/~repo" host.xz "~repo"
+ '
done
# with port number
@@ -580,7 +584,7 @@ test_expect_success 'clone ssh://host.xz:22/home/user/repo' '
'
# from home directory with port number
-test_expect_success 'clone ssh://host.xz:22/~repo' '
+test_expect_success !SANITIZE_LEAK 'clone ssh://host.xz:22/~repo' '
test_clone_url "ssh://host.xz:22/~repo" "-p 22 host.xz" "~repo"
'
@@ -597,8 +601,8 @@ done
for tuah in ::1 [::1] user@::1 user@[::1] [user@::1]
do
euah=$(echo $tuah | tr -d "[]")
- test_expect_success "clone ssh://$tuah/~repo" "
- test_clone_url ssh://$tuah/~repo $euah '~repo'
+ test_expect_success !SANITIZE_LEAK "clone ssh://$tuah/~repo" "
+ test_clone_url ssh://$tuah/~repo $euah '~repo'
"
done
@@ -615,8 +619,8 @@ done
for tuah in [::1] user@[::1] [user@::1]
do
euah=$(echo $tuah | tr -d "[]")
- test_expect_success "clone ssh://$tuah:22/~repo" "
- test_clone_url ssh://$tuah:22/~repo '-p 22' $euah '~repo'
+ test_expect_success !SANITIZE_LEAK "clone ssh://$tuah:22/~repo" "
+ test_clone_url ssh://$tuah:22/~repo '-p 22' $euah '~repo'
"
done
diff --git a/t/t5602-clone-remote-exec.sh b/t/t5602-clone-remote-exec.sh
index 56329aa160..cbcceab9d5 100755
--- a/t/t5602-clone-remote-exec.sh
+++ b/t/t5602-clone-remote-exec.sh
@@ -2,7 +2,6 @@
test_description=clone
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t5603-clone-dirname.sh b/t/t5603-clone-dirname.sh
index 8ca1f09423..80eb4e04f8 100755
--- a/t/t5603-clone-dirname.sh
+++ b/t/t5603-clone-dirname.sh
@@ -2,7 +2,6 @@
test_description='check output directory names used by git-clone'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# we use a fake ssh wrapper that ignores the arguments
diff --git a/t/t5604-clone-reference.sh b/t/t5604-clone-reference.sh
index 9b32db8478..470bfb610c 100755
--- a/t/t5604-clone-reference.sh
+++ b/t/t5604-clone-reference.sh
@@ -7,7 +7,6 @@ test_description='test clone --reference'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
base_dir=$(pwd)
@@ -131,7 +130,7 @@ test_expect_success 'cloning with multiple references drops duplicates' '
test_expect_success 'clone with reference from a tagged repository' '
(
- cd A && git tag -a -m tagged HEAD
+ cd A && git tag -a -m tagged foo
) &&
git clone --reference=A A I
'
@@ -156,10 +155,10 @@ test_expect_success 'fetch with incomplete alternates' '
git remote add J "file://$base_dir/J" &&
GIT_TRACE_PACKET=$U.K git fetch J
) &&
- main_object=$(cd A && git for-each-ref --format="%(objectname)" refs/heads/main) &&
+ main_object=$(git -C A rev-parse --verify refs/heads/main) &&
test -s "$U.K" &&
! grep " want $main_object" "$U.K" &&
- tag_object=$(cd A && git for-each-ref --format="%(objectname)" refs/tags/HEAD) &&
+ tag_object=$(git -C A rev-parse --verify refs/tags/foo) &&
! grep " want $tag_object" "$U.K"
'
diff --git a/t/t5605-clone-local.sh b/t/t5605-clone-local.sh
index d9a320abd2..4605703496 100755
--- a/t/t5605-clone-local.sh
+++ b/t/t5605-clone-local.sh
@@ -4,7 +4,6 @@ test_description='test local clone'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
repo_is_hardlinked() {
@@ -154,6 +153,16 @@ test_expect_success 'cloning a local path with --no-local does not hardlink' '
! repo_is_hardlinked force-nonlocal
'
+test_expect_success 'cloning a local path with --no-local from a different user succeeds' '
+ git clone --upload-pack="GIT_TEST_ASSUME_DIFFERENT_OWNER=true git-upload-pack" \
+ --no-local a nonlocal-otheruser 2>err &&
+ ! repo_is_hardlinked nonlocal-otheruser &&
+ # Verify that this is a git repository.
+ git -C nonlocal-otheruser rev-parse --show-toplevel &&
+ ! test_grep "detected dubious ownership" err
+
+'
+
test_expect_success 'cloning locally respects "-u" for fetching refs' '
test_must_fail git clone --bare -u false a should_not_work.git
'
diff --git a/t/t5606-clone-options.sh b/t/t5606-clone-options.sh
index e93e0d0cc3..8a15237736 100755
--- a/t/t5606-clone-options.sh
+++ b/t/t5606-clone-options.sh
@@ -4,7 +4,6 @@ test_description='basic clone 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' '
diff --git a/t/t5607-clone-bundle.sh b/t/t5607-clone-bundle.sh
index 7ceaa8194d..82e3621ec5 100755
--- a/t/t5607-clone-bundle.sh
+++ b/t/t5607-clone-bundle.sh
@@ -4,7 +4,6 @@ test_description='some bundle related tests'
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' '
@@ -171,6 +170,13 @@ test_expect_success 'clone bundle with different fsckObjects configurations' '
test_must_fail git -c transfer.fsckObjects=true \
clone bundle-fsck/bad.bundle bundle-transfer-fsck 2>err &&
+ test_grep "missingEmail" err &&
+
+ git -c fetch.fsckObjects=true -c fetch.fsck.missingEmail=ignore \
+ clone bundle-fsck/bad.bundle bundle-fsck-ignore &&
+
+ test_must_fail git -c fetch.fsckObjects=true -c fetch.fsck.missingEmail=error \
+ clone bundle-fsck/bad.bundle bundle-fsck-error 2>err &&
test_grep "missingEmail" err
'
diff --git a/t/t5609-clone-branch.sh b/t/t5609-clone-branch.sh
index 252e1f7c20..f86a674a03 100755
--- a/t/t5609-clone-branch.sh
+++ b/t/t5609-clone-branch.sh
@@ -4,7 +4,6 @@ test_description='clone --branch option'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
check_HEAD() {
diff --git a/t/t5610-clone-detached.sh b/t/t5610-clone-detached.sh
index 022ed3d87c..a7ec21eda5 100755
--- a/t/t5610-clone-detached.sh
+++ b/t/t5610-clone-detached.sh
@@ -4,7 +4,6 @@ test_description='test cloning a repository with detached HEAD'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
head_is_detached() {
diff --git a/t/t5611-clone-config.sh b/t/t5611-clone-config.sh
index 298d4befab..4873089a8c 100755
--- a/t/t5611-clone-config.sh
+++ b/t/t5611-clone-config.sh
@@ -4,7 +4,6 @@ test_description='tests for git clone -c key=value'
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 'clone -c sets config in cloned repo' '
diff --git a/t/t5612-clone-refspec.sh b/t/t5612-clone-refspec.sh
index 72762de977..3126cfd7e9 100755
--- a/t/t5612-clone-refspec.sh
+++ b/t/t5612-clone-refspec.sh
@@ -4,7 +4,6 @@ test_description='test refspec written by clone-command'
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' '
diff --git a/t/t5613-info-alternate.sh b/t/t5613-info-alternate.sh
index 7708cbafa9..c752804a8e 100755
--- a/t/t5613-info-alternate.sh
+++ b/t/t5613-info-alternate.sh
@@ -5,7 +5,6 @@
test_description='test transitive info/alternate entries'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'preparing first repository' '
diff --git a/t/t5614-clone-submodules-shallow.sh b/t/t5614-clone-submodules-shallow.sh
index c2a2bb453e..0c85ef834a 100755
--- a/t/t5614-clone-submodules-shallow.sh
+++ b/t/t5614-clone-submodules-shallow.sh
@@ -2,7 +2,6 @@
test_description='Test shallow cloning of repos with submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
pwd=$(pwd)
diff --git a/t/t5615-alternate-env.sh b/t/t5615-alternate-env.sh
index 83513e46a3..9d6aa2187f 100755
--- a/t/t5615-alternate-env.sh
+++ b/t/t5615-alternate-env.sh
@@ -2,7 +2,6 @@
test_description='handling of alternates in environment variables'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
check_obj () {
diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
index 91d1808883..4650451964 100755
--- a/t/t5616-partial-clone.sh
+++ b/t/t5616-partial-clone.sh
@@ -5,7 +5,6 @@ test_description='git partial clone'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# create a normal "src" repo where we can later create new commits.
diff --git a/t/t5617-clone-submodules-remote.sh b/t/t5617-clone-submodules-remote.sh
index 5a4d7936a7..6884338249 100755
--- a/t/t5617-clone-submodules-remote.sh
+++ b/t/t5617-clone-submodules-remote.sh
@@ -5,7 +5,6 @@ test_description='Test cloning repos with submodules using remote-tracking branc
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
pwd=$(pwd)
diff --git a/t/t5618-alternate-refs.sh b/t/t5618-alternate-refs.sh
index f905db0a3f..2fb6d549d3 100755
--- a/t/t5618-alternate-refs.sh
+++ b/t/t5618-alternate-refs.sh
@@ -2,7 +2,6 @@
test_description='test handling of --alternate-refs traversal'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Avoid test_commit because we want a specific and known set of refs:
diff --git a/t/t5619-clone-local-ambiguous-transport.sh b/t/t5619-clone-local-ambiguous-transport.sh
index 1d4efe414d..cce62bf78d 100755
--- a/t/t5619-clone-local-ambiguous-transport.sh
+++ b/t/t5619-clone-local-ambiguous-transport.sh
@@ -2,7 +2,6 @@
test_description='test local clone with ambiguous transport'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-httpd.sh"
diff --git a/t/t5700-protocol-v1.sh b/t/t5700-protocol-v1.sh
index 985e04d06e..a73b4d4ff6 100755
--- a/t/t5700-protocol-v1.sh
+++ b/t/t5700-protocol-v1.sh
@@ -11,7 +11,6 @@ export GIT_TEST_PROTOCOL_VERSION
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Test protocol v1 with 'git://' transport
diff --git a/t/t5701-git-serve.sh b/t/t5701-git-serve.sh
index c48830de8f..de904c1655 100755
--- a/t/t5701-git-serve.sh
+++ b/t/t5701-git-serve.sh
@@ -5,7 +5,6 @@ test_description='test protocol v2 server commands'
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 'test capability advertisement' '
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index e4ce059236..d3df81e785 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -7,7 +7,6 @@ TEST_NO_CREATE_REPO=1
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Test protocol v2 with 'git://' transport
diff --git a/t/t5703-upload-pack-ref-in-want.sh b/t/t5703-upload-pack-ref-in-want.sh
index f75fae52c8..191097171b 100755
--- a/t/t5703-upload-pack-ref-in-want.sh
+++ b/t/t5703-upload-pack-ref-in-want.sh
@@ -2,7 +2,6 @@
test_description='upload-pack ref-in-want'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
get_actual_refs () {
diff --git a/t/t5704-protocol-violations.sh b/t/t5704-protocol-violations.sh
index 11be64fc03..2b33fced23 100755
--- a/t/t5704-protocol-violations.sh
+++ b/t/t5704-protocol-violations.sh
@@ -5,7 +5,6 @@ of these cases it will generally be acceptable for one side to break off
communications if the other side says something unexpected. We are mostly
making sure that we do not segfault or otherwise behave badly.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'extra delim packet in v2 ls-refs args' '
diff --git a/t/t5705-session-id-in-capabilities.sh b/t/t5705-session-id-in-capabilities.sh
index b8a722ec27..ed38c76c29 100755
--- a/t/t5705-session-id-in-capabilities.sh
+++ b/t/t5705-session-id-in-capabilities.sh
@@ -2,7 +2,6 @@
test_description='session ID in capabilities'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
REPO="$(pwd)/repo"
diff --git a/t/t5730-protocol-v2-bundle-uri-file.sh b/t/t5730-protocol-v2-bundle-uri-file.sh
index 38396df95b..37bdb725bc 100755
--- a/t/t5730-protocol-v2-bundle-uri-file.sh
+++ b/t/t5730-protocol-v2-bundle-uri-file.sh
@@ -7,7 +7,6 @@ TEST_NO_CREATE_REPO=1
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Test protocol v2 with 'file://' transport
diff --git a/t/t5731-protocol-v2-bundle-uri-git.sh b/t/t5731-protocol-v2-bundle-uri-git.sh
index c199e955fe..8add1b37ab 100755
--- a/t/t5731-protocol-v2-bundle-uri-git.sh
+++ b/t/t5731-protocol-v2-bundle-uri-git.sh
@@ -7,7 +7,6 @@ TEST_NO_CREATE_REPO=1
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Test protocol v2 with 'git://' transport
diff --git a/t/t5732-protocol-v2-bundle-uri-http.sh b/t/t5732-protocol-v2-bundle-uri-http.sh
index a9403e94c6..129daa0226 100755
--- a/t/t5732-protocol-v2-bundle-uri-http.sh
+++ b/t/t5732-protocol-v2-bundle-uri-http.sh
@@ -7,7 +7,6 @@ TEST_NO_CREATE_REPO=1
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Test protocol v2 with 'http://' transport
diff --git a/t/t5750-bundle-uri-parse.sh b/t/t5750-bundle-uri-parse.sh
index 81bdf58b94..80a3f83ffb 100755
--- a/t/t5750-bundle-uri-parse.sh
+++ b/t/t5750-bundle-uri-parse.sh
@@ -3,7 +3,6 @@
test_description="Test bundle-uri bundle_uri_parse_line()"
TEST_NO_CREATE_REPO=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'bundle_uri_parse_line() just URIs' '
diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
index d4882288a3..d21877150e 100755
--- a/t/t5801-remote-helpers.sh
+++ b/t/t5801-remote-helpers.sh
@@ -8,7 +8,6 @@ test_description='Test remote-helper import and export commands'
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-gpg.sh
diff --git a/t/t5802-connect-helper.sh b/t/t5802-connect-helper.sh
index dd3e6235cd..a7be375bce 100755
--- a/t/t5802-connect-helper.sh
+++ b/t/t5802-connect-helper.sh
@@ -2,7 +2,6 @@
test_description='ext::cmd remote "connect" helper'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t5810-proto-disable-local.sh b/t/t5810-proto-disable-local.sh
index 862610256f..96a2c46e7a 100755
--- a/t/t5810-proto-disable-local.sh
+++ b/t/t5810-proto-disable-local.sh
@@ -2,7 +2,6 @@
test_description='test disabling of local paths in clone/fetch'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-proto-disable.sh"
diff --git a/t/t5811-proto-disable-git.sh b/t/t5811-proto-disable-git.sh
index ed773e7432..b0061e6a37 100755
--- a/t/t5811-proto-disable-git.sh
+++ b/t/t5811-proto-disable-git.sh
@@ -2,7 +2,6 @@
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"
diff --git a/t/t5812-proto-disable-http.sh b/t/t5812-proto-disable-http.sh
index f69959c64c..96187efaa8 100755
--- a/t/t5812-proto-disable-http.sh
+++ b/t/t5812-proto-disable-http.sh
@@ -2,7 +2,6 @@
test_description='test disabling of git-over-http in clone/fetch'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-proto-disable.sh"
. "$TEST_DIRECTORY/lib-httpd.sh"
diff --git a/t/t5813-proto-disable-ssh.sh b/t/t5813-proto-disable-ssh.sh
index 2e975dc70e..045e2fe6ce 100755
--- a/t/t5813-proto-disable-ssh.sh
+++ b/t/t5813-proto-disable-ssh.sh
@@ -2,7 +2,6 @@
test_description='test disabling of git-over-ssh in clone/fetch'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-proto-disable.sh"
diff --git a/t/t5814-proto-disable-ext.sh b/t/t5814-proto-disable-ext.sh
index 6fe1a98b2a..9587a842bc 100755
--- a/t/t5814-proto-disable-ext.sh
+++ b/t/t5814-proto-disable-ext.sh
@@ -2,7 +2,6 @@
test_description='test disabling of remote-helper paths in clone/fetch'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-proto-disable.sh"
diff --git a/t/t5815-submodule-protos.sh b/t/t5815-submodule-protos.sh
index fe899ee82d..081a07cbae 100755
--- a/t/t5815-submodule-protos.sh
+++ b/t/t5815-submodule-protos.sh
@@ -2,7 +2,6 @@
test_description='test protocol filtering with submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-proto-disable.sh
diff --git a/t/t5900-repo-selection.sh b/t/t5900-repo-selection.sh
index a84faac242..923fc90f87 100755
--- a/t/t5900-repo-selection.sh
+++ b/t/t5900-repo-selection.sh
@@ -2,7 +2,6 @@
test_description='selecting remote repo in ambiguous cases'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
reset() {
diff --git a/t/t6000-rev-list-misc.sh b/t/t6000-rev-list-misc.sh
index f6d17ee902..6289a2e8b0 100755
--- a/t/t6000-rev-list-misc.sh
+++ b/t/t6000-rev-list-misc.sh
@@ -5,7 +5,6 @@ test_description='miscellaneous rev-list tests'
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 '
diff --git a/t/t6001-rev-list-graft.sh b/t/t6001-rev-list-graft.sh
index 3553bbbfe7..73a2465aa0 100755
--- a/t/t6001-rev-list-graft.sh
+++ b/t/t6001-rev-list-graft.sh
@@ -5,7 +5,6 @@ test_description='Revision traversal vs grafts and path limiter'
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 '
diff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh
index 162cf50778..daa009c9a1 100755
--- a/t/t6002-rev-list-bisect.sh
+++ b/t/t6002-rev-list-bisect.sh
@@ -4,7 +4,6 @@
#
test_description='Tests git rev-list --bisect functionality'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
@@ -309,4 +308,9 @@ test_expect_success '--bisect-all --first-parent' '
test_cmp expect actual
'
+test_expect_success '--bisect without any revisions' '
+ git rev-list --bisect HEAD..HEAD >out &&
+ test_must_be_empty out
+'
+
test_done
diff --git a/t/t6003-rev-list-topo-order.sh b/t/t6003-rev-list-topo-order.sh
index 5cf2cee74d..0d7055d46d 100755
--- a/t/t6003-rev-list-topo-order.sh
+++ b/t/t6003-rev-list-topo-order.sh
@@ -5,7 +5,6 @@
test_description='Tests git rev-list --topo-order functionality'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
diff --git a/t/t6004-rev-list-path-optim.sh b/t/t6004-rev-list-path-optim.sh
index 5416241ede..cd4f420e2a 100755
--- a/t/t6004-rev-list-path-optim.sh
+++ b/t/t6004-rev-list-path-optim.sh
@@ -16,7 +16,6 @@ test_description='git rev-list trivial path optimization test
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 '
diff --git a/t/t6005-rev-list-count.sh b/t/t6005-rev-list-count.sh
index ee0306aeec..6cde997e13 100755
--- a/t/t6005-rev-list-count.sh
+++ b/t/t6005-rev-list-count.sh
@@ -2,7 +2,6 @@
test_description='git rev-list --max-count and --skip test'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index b0ec2fe865..eb93d68d7d 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -8,7 +8,6 @@ test_description='git rev-list --pretty=format test'
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-terminal.sh
diff --git a/t/t6007-rev-list-cherry-pick-file.sh b/t/t6007-rev-list-cherry-pick-file.sh
index 2d337d7287..6f3e543977 100755
--- a/t/t6007-rev-list-cherry-pick-file.sh
+++ b/t/t6007-rev-list-cherry-pick-file.sh
@@ -5,7 +5,6 @@ test_description='test git rev-list --cherry-pick -- file'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# A---B---D---F
diff --git a/t/t6008-rev-list-submodule.sh b/t/t6008-rev-list-submodule.sh
index 2cdef6fdf9..a0a070b404 100755
--- a/t/t6008-rev-list-submodule.sh
+++ b/t/t6008-rev-list-submodule.sh
@@ -8,7 +8,6 @@ test_description='git rev-list involving submodules that this repo has'
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' '
diff --git a/t/t6009-rev-list-parent.sh b/t/t6009-rev-list-parent.sh
index 91db8fafe8..9c9a8459af 100755
--- a/t/t6009-rev-list-parent.sh
+++ b/t/t6009-rev-list-parent.sh
@@ -5,7 +5,6 @@ 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 () {
diff --git a/t/t6010-merge-base.sh b/t/t6010-merge-base.sh
index f96ea82e78..44c726ea39 100755
--- a/t/t6010-merge-base.sh
+++ b/t/t6010-merge-base.sh
@@ -6,7 +6,6 @@
test_description='Merge base and parent list computation.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
M=1130000000
diff --git a/t/t6011-rev-list-with-bad-commit.sh b/t/t6011-rev-list-with-bad-commit.sh
index b2e422cf0f..bad02cf5b8 100755
--- a/t/t6011-rev-list-with-bad-commit.sh
+++ b/t/t6011-rev-list-with-bad-commit.sh
@@ -2,7 +2,6 @@
test_description='git rev-list should notice bad commits'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Note:
diff --git a/t/t6012-rev-list-simplify.sh b/t/t6012-rev-list-simplify.sh
index 8ed1a215da..de1e87f162 100755
--- a/t/t6012-rev-list-simplify.sh
+++ b/t/t6012-rev-list-simplify.sh
@@ -5,7 +5,6 @@ test_description='merge simplification'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
note () {
diff --git a/t/t6013-rev-list-reverse-parents.sh b/t/t6013-rev-list-reverse-parents.sh
index 4128269c1d..39793cbbd6 100755
--- a/t/t6013-rev-list-reverse-parents.sh
+++ b/t/t6013-rev-list-reverse-parents.sh
@@ -5,7 +5,6 @@ test_description='--reverse combines with --parents'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t6014-rev-list-all.sh b/t/t6014-rev-list-all.sh
index 16b8bd1d09..c9bedd29cb 100755
--- a/t/t6014-rev-list-all.sh
+++ b/t/t6014-rev-list-all.sh
@@ -2,7 +2,6 @@
test_description='--all includes detached HEADs'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t6016-rev-list-graph-simplify-history.sh b/t/t6016-rev-list-graph-simplify-history.sh
index 2656d6a6bc..54b0a6f5f8 100755
--- a/t/t6016-rev-list-graph-simplify-history.sh
+++ b/t/t6016-rev-list-graph-simplify-history.sh
@@ -10,7 +10,6 @@ test_description='--graph and simplified history'
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
diff --git a/t/t6017-rev-list-stdin.sh b/t/t6017-rev-list-stdin.sh
index a0a40fe55c..4821b90e74 100755
--- a/t/t6017-rev-list-stdin.sh
+++ b/t/t6017-rev-list-stdin.sh
@@ -8,7 +8,6 @@ test_description='log family learns --stdin'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
check () {
diff --git a/t/t6018-rev-list-glob.sh b/t/t6018-rev-list-glob.sh
index 3b181f771c..bb55c7e3c3 100755
--- a/t/t6018-rev-list-glob.sh
+++ b/t/t6018-rev-list-glob.sh
@@ -5,7 +5,6 @@ test_description='rev-list/rev-parse --glob'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
commit () {
diff --git a/t/t6019-rev-list-ancestry-path.sh b/t/t6019-rev-list-ancestry-path.sh
index 1aabab6956..738da23628 100755
--- a/t/t6019-rev-list-ancestry-path.sh
+++ b/t/t6019-rev-list-ancestry-path.sh
@@ -29,7 +29,6 @@ test_description='--ancestry-path'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_merge () {
diff --git a/t/t6020-bundle-misc.sh b/t/t6020-bundle-misc.sh
index 34b5cd62c2..4ce62feaa2 100755
--- a/t/t6020-bundle-misc.sh
+++ b/t/t6020-bundle-misc.sh
@@ -8,7 +8,6 @@ test_description='Test git-bundle'
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-bundle.sh
. "$TEST_DIRECTORY"/lib-terminal.sh
@@ -505,6 +504,50 @@ test_expect_success 'unfiltered bundle with --objects' '
test_cmp expect actual
'
+test_expect_success 'full bundle upto annotated tag' '
+ git bundle create v2.bdl \
+ v2 &&
+
+ git bundle verify v2.bdl |
+ make_user_friendly_and_stable_output >actual &&
+
+ format_and_save_expect <<-EOF &&
+ The bundle contains this ref:
+ <TAG-2> refs/tags/v2
+ The bundle records a complete history.
+ $HASH_MESSAGE
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'clone from full bundle upto annotated tag' '
+ git clone --mirror v2.bdl tag-clone.git &&
+ git -C tag-clone.git show-ref |
+ make_user_friendly_and_stable_output >actual &&
+ cat >expect <<-\EOF &&
+ <TAG-2> refs/tags/v2
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'incremental bundle between two annotated tags' '
+ git bundle create v1-v2.bdl \
+ v1..v2 &&
+
+ git bundle verify v1-v2.bdl |
+ make_user_friendly_and_stable_output >actual &&
+
+ format_and_save_expect <<-EOF &&
+ The bundle contains this ref:
+ <TAG-2> refs/tags/v2
+ The bundle requires these 2 refs:
+ <COMMIT-E> Z
+ <COMMIT-B> Z
+ $HASH_MESSAGE
+ EOF
+ test_cmp expect actual
+'
+
for filter in "blob:none" "tree:0" "tree:1" "blob:limit=100"
do
test_expect_success "filtered bundle: $filter" '
diff --git a/t/t6021-rev-list-exclude-hidden.sh b/t/t6021-rev-list-exclude-hidden.sh
index 51df02105d..5fe942a293 100755
--- a/t/t6021-rev-list-exclude-hidden.sh
+++ b/t/t6021-rev-list-exclude-hidden.sh
@@ -2,7 +2,6 @@
test_description='git rev-list --exclude-hidden test'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t6022-rev-list-missing.sh b/t/t6022-rev-list-missing.sh
index 127180e1c9..7553a9cca2 100755
--- a/t/t6022-rev-list-missing.sh
+++ b/t/t6022-rev-list-missing.sh
@@ -2,7 +2,6 @@
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
diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh
index acc281c116..0b719bbae6 100755
--- a/t/t6040-tracking-info.sh
+++ b/t/t6040-tracking-info.sh
@@ -5,7 +5,6 @@ test_description='remote tracking stats'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
advance () {
diff --git a/t/t6041-bisect-submodule.sh b/t/t6041-bisect-submodule.sh
index 3946e18089..82013fc903 100755
--- a/t/t6041-bisect-submodule.sh
+++ b/t/t6041-bisect-submodule.sh
@@ -2,7 +2,6 @@
test_description='bisect can handle submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh
diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh
index deba3ca430..aa1b535187 100755
--- a/t/t6050-replace.sh
+++ b/t/t6050-replace.sh
@@ -7,7 +7,6 @@ test_description='Tests replace refs functionality'
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-gpg.sh"
diff --git a/t/t6060-merge-index.sh b/t/t6060-merge-index.sh
index 1a8b64cce1..e6b3e6ec77 100755
--- a/t/t6060-merge-index.sh
+++ b/t/t6060-merge-index.sh
@@ -2,7 +2,6 @@
test_description='basic git merge-index / git-merge-one-file tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup diverging branches' '
diff --git a/t/t6100-rev-list-in-order.sh b/t/t6100-rev-list-in-order.sh
index 88ed7bd75a..e934bc239c 100755
--- a/t/t6100-rev-list-in-order.sh
+++ b/t/t6100-rev-list-in-order.sh
@@ -2,7 +2,6 @@
test_description='rev-list testing in-commit-order'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup a commit history with trees, blobs' '
diff --git a/t/t6101-rev-parse-parents.sh b/t/t6101-rev-parse-parents.sh
index d20723d627..5f55ab98d3 100755
--- a/t/t6101-rev-parse-parents.sh
+++ b/t/t6101-rev-parse-parents.sh
@@ -8,7 +8,6 @@ test_description='Test git rev-parse with different parent options'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
TEST_CREATE_REPO_NO_TEMPLATE=1
. ./test-lib.sh
diff --git a/t/t6102-rev-list-unexpected-objects.sh b/t/t6102-rev-list-unexpected-objects.sh
index 5d28507efc..22dfd6d978 100755
--- a/t/t6102-rev-list-unexpected-objects.sh
+++ b/t/t6102-rev-list-unexpected-objects.sh
@@ -2,7 +2,6 @@
test_description='git rev-list should handle unexpected object types'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup well-formed objects' '
diff --git a/t/t6110-rev-list-sparse.sh b/t/t6110-rev-list-sparse.sh
index ddefc7f24e..13c1da5352 100755
--- a/t/t6110-rev-list-sparse.sh
+++ b/t/t6110-rev-list-sparse.sh
@@ -4,7 +4,6 @@ test_description='operations that cull histories in unusual ways'
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 '
diff --git a/t/t6111-rev-list-treesame.sh b/t/t6111-rev-list-treesame.sh
index f63bc8d3da..90ff141640 100755
--- a/t/t6111-rev-list-treesame.sh
+++ b/t/t6111-rev-list-treesame.sh
@@ -16,7 +16,6 @@ test_description='TREESAME and limiting'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
note () {
diff --git a/t/t6112-rev-list-filters-objects.sh b/t/t6112-rev-list-filters-objects.sh
index 71e38491fa..0387f35a32 100755
--- a/t/t6112-rev-list-filters-objects.sh
+++ b/t/t6112-rev-list-filters-objects.sh
@@ -5,7 +5,6 @@ test_description='git rev-list using object filtering'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Test the blob:none filter.
diff --git a/t/t6113-rev-list-bitmap-filters.sh b/t/t6113-rev-list-bitmap-filters.sh
index a9656a1ec8..902854cbfa 100755
--- a/t/t6113-rev-list-bitmap-filters.sh
+++ b/t/t6113-rev-list-bitmap-filters.sh
@@ -2,7 +2,6 @@
test_description='rev-list combining bitmaps and filters'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-bitmap.sh
diff --git a/t/t6114-keep-packs.sh b/t/t6114-keep-packs.sh
index 44246f8a63..a584522ef2 100755
--- a/t/t6114-keep-packs.sh
+++ b/t/t6114-keep-packs.sh
@@ -2,7 +2,6 @@
test_description='rev-list with .keep packs'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t6115-rev-list-du.sh b/t/t6115-rev-list-du.sh
index 21c4a211b1..3385fe9f13 100755
--- a/t/t6115-rev-list-du.sh
+++ b/t/t6115-rev-list-du.sh
@@ -2,7 +2,6 @@
test_description='basic tests of rev-list --disk-usage'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# we want a mix of reachable and unreachable, as well as
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index 05ed2510d9..3f6160d702 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -14,11 +14,11 @@ test_description='test describe'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
check_describe () {
indir= &&
+ outcome=success &&
while test $# != 0
do
case "$1" in
@@ -26,6 +26,9 @@ check_describe () {
indir="$2"
shift
;;
+ --expect-failure)
+ outcome=failure
+ ;;
*)
break
;;
@@ -36,7 +39,7 @@ check_describe () {
expect="$1"
shift
describe_opts="$@"
- test_expect_success "describe $describe_opts" '
+ test_expect_${outcome} "describe $describe_opts" '
git ${indir:+ -C "$indir"} describe $describe_opts >raw &&
sed -e "s/-g[0-9a-f]*\$/-gHASH/" <raw >actual &&
echo "$expect" >expect &&
@@ -617,7 +620,7 @@ test_expect_success 'name-rev --annotate-stdin works with commitGraph' '
# B
# o
-# \
+# H \
# o-----o---o----x
# A
#
@@ -627,6 +630,7 @@ test_expect_success 'setup: describe commits with disjoint bases' '
cd disjoint1 &&
echo o >> file && git add file && git commit -m o &&
+ git tag H -a -m H &&
echo A >> file && git add file && git commit -m A &&
git tag A -a -m A &&
echo o >> file && git add file && git commit -m o &&
@@ -639,8 +643,9 @@ test_expect_success 'setup: describe commits with disjoint bases' '
'
check_describe -C disjoint1 "A-3-gHASH" HEAD
+check_describe -C disjoint1 --expect-failure "A-3-gHASH" --candidates=2 HEAD
-# B
+# H B
# o---o---o------------.
# \
# o---o---x
@@ -658,6 +663,7 @@ test_expect_success 'setup: describe commits with disjoint bases 2' '
git checkout --orphan branch &&
echo o >> file2 && git add file2 && GIT_COMMITTER_DATE="2020-01-01 15:00" git commit -m o &&
echo o >> file2 && git add file2 && GIT_COMMITTER_DATE="2020-01-01 15:01" git commit -m o &&
+ git tag H -a -m H &&
echo B >> file2 && git add file2 && GIT_COMMITTER_DATE="2020-01-01 15:02" git commit -m B &&
git tag B -a -m B &&
git merge --no-ff --allow-unrelated-histories main -m x
@@ -665,6 +671,7 @@ test_expect_success 'setup: describe commits with disjoint bases 2' '
'
check_describe -C disjoint2 "B-3-gHASH" HEAD
+check_describe -C disjoint2 --expect-failure "B-3-gHASH" --candidates=2 HEAD
test_expect_success 'setup misleading taggerdates' '
GIT_COMMITTER_DATE="2006-12-12 12:31" git tag -a -m "another tag" newer-tag-older-commit unique-file~1
@@ -708,4 +715,14 @@ test_expect_success 'describe --broken --dirty with a file with changed stat' '
)
'
+test_expect_success '--always with no refs falls back to commit hash' '
+ git rev-parse HEAD >expect &&
+ git describe --no-abbrev --always --match=no-such-tag >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '--exact-match does not show --always fallback' '
+ test_must_fail git describe --exact-match --always
+'
+
test_done
diff --git a/t/t6130-pathspec-noglob.sh b/t/t6130-pathspec-noglob.sh
index 82de25d549..a7f2603cb4 100755
--- a/t/t6130-pathspec-noglob.sh
+++ b/t/t6130-pathspec-noglob.sh
@@ -2,7 +2,6 @@
test_description='test globbing (and noglob) of pathspec limiting'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'create commits with glob characters' '
diff --git a/t/t6131-pathspec-icase.sh b/t/t6131-pathspec-icase.sh
index 770cce026c..e64d938083 100755
--- a/t/t6131-pathspec-icase.sh
+++ b/t/t6131-pathspec-icase.sh
@@ -2,7 +2,6 @@
test_description='test case insensitive pathspec limiting'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
if test_have_prereq CASE_INSENSITIVE_FS
diff --git a/t/t6132-pathspec-exclude.sh b/t/t6132-pathspec-exclude.sh
index f31c09c056..9fdafeb1e9 100755
--- a/t/t6132-pathspec-exclude.sh
+++ b/t/t6132-pathspec-exclude.sh
@@ -2,7 +2,6 @@
test_description='test case exclude pathspec'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t6133-pathspec-rev-dwim.sh b/t/t6133-pathspec-rev-dwim.sh
index 6dd4bbbf9f..0f722fb340 100755
--- a/t/t6133-pathspec-rev-dwim.sh
+++ b/t/t6133-pathspec-rev-dwim.sh
@@ -2,7 +2,6 @@
test_description='test dwim of revs versus pathspecs in revision parser'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t6134-pathspec-in-submodule.sh b/t/t6134-pathspec-in-submodule.sh
index 16ce4cfcc6..9b62a0a65f 100755
--- a/t/t6134-pathspec-in-submodule.sh
+++ b/t/t6134-pathspec-in-submodule.sh
@@ -2,7 +2,6 @@
test_description='test case exclude pathspec'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup a submodule' '
diff --git a/t/t6135-pathspec-with-attrs.sh b/t/t6135-pathspec-with-attrs.sh
index 794bc7daf0..67d8c72147 100755
--- a/t/t6135-pathspec-with-attrs.sh
+++ b/t/t6135-pathspec-with-attrs.sh
@@ -2,7 +2,6 @@
test_description='test labels in pathspecs'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup a tree' '
diff --git a/t/t6136-pathspec-in-bare.sh b/t/t6136-pathspec-in-bare.sh
index 2db37a6596..1284fe0143 100755
--- a/t/t6136-pathspec-in-bare.sh
+++ b/t/t6136-pathspec-in-bare.sh
@@ -2,7 +2,6 @@
test_description='diagnosing out-of-scope pathspec'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup a bare and non-bare repository' '
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index 0a4388f343..011e5df1e6 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -8,7 +8,6 @@ test_description='fmt-merge-msg test'
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-gpg.sh"
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index c39d4e7e9c..a5c7794385 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -5,7 +5,6 @@
test_description='for-each-ref test'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
GNUPGHOME_NOT_USED=$GNUPGHOME
. "$TEST_DIRECTORY"/lib-gpg.sh
diff --git a/t/t6301-for-each-ref-errors.sh b/t/t6301-for-each-ref-errors.sh
index 83b8a19d94..e06feb06e9 100755
--- a/t/t6301-for-each-ref-errors.sh
+++ b/t/t6301-for-each-ref-errors.sh
@@ -2,7 +2,6 @@
test_description='for-each-ref errors for broken refs'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
ZEROS=$ZERO_OID
diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh
index a3e1258a4c..bb02b86c16 100755
--- a/t/t6302-for-each-ref-filter.sh
+++ b/t/t6302-for-each-ref-filter.sh
@@ -2,7 +2,6 @@
test_description='test for-each-refs usage of ref-filter APIs'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-gpg.sh
diff --git a/t/t6400-merge-df.sh b/t/t6400-merge-df.sh
index 27d6efdc9a..3de4ef6bd9 100755
--- a/t/t6400-merge-df.sh
+++ b/t/t6400-merge-df.sh
@@ -7,7 +7,6 @@ test_description='Test merge with directory/file conflicts'
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 'prepare repository' '
diff --git a/t/t6401-merge-criss-cross.sh b/t/t6401-merge-criss-cross.sh
index 1962310408..c8e5ff28e8 100755
--- a/t/t6401-merge-criss-cross.sh
+++ b/t/t6401-merge-criss-cross.sh
@@ -9,7 +9,6 @@
test_description='Test criss-cross merge'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'prepare repository' '
diff --git a/t/t6402-merge-rename.sh b/t/t6402-merge-rename.sh
index 729aac9842..2738b50c2a 100755
--- a/t/t6402-merge-rename.sh
+++ b/t/t6402-merge-rename.sh
@@ -4,7 +4,6 @@ test_description='Merge-recursive merging renames'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
modify () {
diff --git a/t/t6403-merge-file.sh b/t/t6403-merge-file.sh
index fb872c5a11..06ab4d7aed 100755
--- a/t/t6403-merge-file.sh
+++ b/t/t6403-merge-file.sh
@@ -2,7 +2,6 @@
test_description='RCS merge replacement: merge-file'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t6404-recursive-merge.sh b/t/t6404-recursive-merge.sh
index 57169ca24b..ae687f2ce5 100755
--- a/t/t6404-recursive-merge.sh
+++ b/t/t6404-recursive-merge.sh
@@ -4,7 +4,6 @@ test_description='Test merge without common ancestors'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# This scenario is based on a real-world repository of Shawn Pearce.
diff --git a/t/t6405-merge-symlinks.sh b/t/t6405-merge-symlinks.sh
index 29e2b25ce5..7435fce71e 100755
--- a/t/t6405-merge-symlinks.sh
+++ b/t/t6405-merge-symlinks.sh
@@ -11,7 +11,6 @@ if core.symlinks is false.'
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' '
diff --git a/t/t6406-merge-attr.sh b/t/t6406-merge-attr.sh
index 2dfc9a873d..66e01464b5 100755
--- a/t/t6406-merge-attr.sh
+++ b/t/t6406-merge-attr.sh
@@ -8,7 +8,6 @@ test_description='per path merge controlled by merge attribute'
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 '
diff --git a/t/t6407-merge-binary.sh b/t/t6407-merge-binary.sh
index 0753fc95f4..e8a28717ce 100755
--- a/t/t6407-merge-binary.sh
+++ b/t/t6407-merge-binary.sh
@@ -5,7 +5,6 @@ test_description='ask merge-recursive to merge binary files'
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 '
diff --git a/t/t6408-merge-up-to-date.sh b/t/t6408-merge-up-to-date.sh
index 8a1ba6d23a..7763c1ba98 100755
--- a/t/t6408-merge-up-to-date.sh
+++ b/t/t6408-merge-up-to-date.sh
@@ -2,7 +2,6 @@
test_description='merge fast-forward and up to date'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t6409-merge-subtree.sh b/t/t6409-merge-subtree.sh
index 528615b981..e9ba6f1690 100755
--- a/t/t6409-merge-subtree.sh
+++ b/t/t6409-merge-subtree.sh
@@ -5,7 +5,6 @@ test_description='subtree merge strategy'
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 '
diff --git a/t/t6411-merge-filemode.sh b/t/t6411-merge-filemode.sh
index b6182723aa..6ae2489286 100755
--- a/t/t6411-merge-filemode.sh
+++ b/t/t6411-merge-filemode.sh
@@ -4,7 +4,6 @@ test_description='merge: handle file mode'
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 'set up mode change in one branch' '
diff --git a/t/t6412-merge-large-rename.sh b/t/t6412-merge-large-rename.sh
index d0863a8fb5..ca018d11f5 100755
--- a/t/t6412-merge-large-rename.sh
+++ b/t/t6412-merge-large-rename.sh
@@ -4,7 +4,6 @@ test_description='merging with large rename matrix'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
count() {
diff --git a/t/t6413-merge-crlf.sh b/t/t6413-merge-crlf.sh
index 647ea1e838..cd6adf6caa 100755
--- a/t/t6413-merge-crlf.sh
+++ b/t/t6413-merge-crlf.sh
@@ -11,7 +11,6 @@ test_description='merge conflict in crlf repo
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 '
diff --git a/t/t6414-merge-rename-nocruft.sh b/t/t6414-merge-rename-nocruft.sh
index 69fc1c9e69..d7e3c1fa6e 100755
--- a/t/t6414-merge-rename-nocruft.sh
+++ b/t/t6414-merge-rename-nocruft.sh
@@ -4,7 +4,6 @@ test_description='Merge-recursive merging renames'
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' '
diff --git a/t/t6415-merge-dir-to-symlink.sh b/t/t6415-merge-dir-to-symlink.sh
index ae00492c76..2655e295f5 100755
--- a/t/t6415-merge-dir-to-symlink.sh
+++ b/t/t6415-merge-dir-to-symlink.sh
@@ -4,7 +4,6 @@ test_description='merging when a directory was replaced with a symlink'
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 'create a commit where dir a/b changed to symlink' '
diff --git a/t/t6416-recursive-corner-cases.sh b/t/t6416-recursive-corner-cases.sh
index 5f414abc89..17b54d625d 100755
--- a/t/t6416-recursive-corner-cases.sh
+++ b/t/t6416-recursive-corner-cases.sh
@@ -5,7 +5,6 @@ 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
diff --git a/t/t6417-merge-ours-theirs.sh b/t/t6417-merge-ours-theirs.sh
index 482b73a998..62d1406119 100755
--- a/t/t6417-merge-ours-theirs.sh
+++ b/t/t6417-merge-ours-theirs.sh
@@ -4,7 +4,6 @@ test_description='Merge-recursive ours and theirs variants'
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 '
diff --git a/t/t6418-merge-text-auto.sh b/t/t6418-merge-text-auto.sh
index 48a62cb855..41288a60ce 100755
--- a/t/t6418-merge-text-auto.sh
+++ b/t/t6418-merge-text-auto.sh
@@ -15,7 +15,6 @@ 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
diff --git a/t/t6421-merge-partial-clone.sh b/t/t6421-merge-partial-clone.sh
index 30349a466e..b99f29ef9b 100755
--- a/t/t6421-merge-partial-clone.sh
+++ b/t/t6421-merge-partial-clone.sh
@@ -26,7 +26,6 @@ test_description="limiting blob downloads when merging with partial clones"
# underscore notation is to differentiate different
# files that might be renamed into each other's paths.)
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-merge.sh
diff --git a/t/t6422-merge-rename-corner-cases.sh b/t/t6422-merge-rename-corner-cases.sh
index 80d7b5eaba..62b49c67e2 100755
--- a/t/t6422-merge-rename-corner-cases.sh
+++ b/t/t6422-merge-rename-corner-cases.sh
@@ -6,7 +6,6 @@ test_description="recursive merge corner cases w/ renames but not criss-crosses"
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
diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh
index 4aaaf38be6..88d1cf2cde 100755
--- a/t/t6423-merge-rename-directories.sh
+++ b/t/t6423-merge-rename-directories.sh
@@ -25,7 +25,6 @@ test_description="recursive merge with directory renames"
# underscore notation is to differentiate different
# files that might be renamed into each other's paths.)
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-merge.sh
diff --git a/t/t6424-merge-unrelated-index-changes.sh b/t/t6424-merge-unrelated-index-changes.sh
index a7ea8acb84..7677c5f08d 100755
--- a/t/t6424-merge-unrelated-index-changes.sh
+++ b/t/t6424-merge-unrelated-index-changes.sh
@@ -2,7 +2,6 @@
test_description="merges with unrelated index changes"
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Testcase for some simple merges
diff --git a/t/t6425-merge-rename-delete.sh b/t/t6425-merge-rename-delete.sh
index b95b064311..c15d031b16 100755
--- a/t/t6425-merge-rename-delete.sh
+++ b/t/t6425-merge-rename-delete.sh
@@ -4,7 +4,6 @@ test_description='Merge-recursive rename/delete conflict message'
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 'rename/delete' '
diff --git a/t/t6426-merge-skip-unneeded-updates.sh b/t/t6426-merge-skip-unneeded-updates.sh
index 62f0180325..b059475ed0 100755
--- a/t/t6426-merge-skip-unneeded-updates.sh
+++ b/t/t6426-merge-skip-unneeded-updates.sh
@@ -22,7 +22,6 @@ test_description="merge cases"
# underscore notation is to differentiate different
# files that might be renamed into each other's paths.)
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-merge.sh
diff --git a/t/t6427-diff3-conflict-markers.sh b/t/t6427-diff3-conflict-markers.sh
index a13271b349..dd5fe6a402 100755
--- a/t/t6427-diff3-conflict-markers.sh
+++ b/t/t6427-diff3-conflict-markers.sh
@@ -5,7 +5,6 @@ test_description='recursive merge diff3 style conflict markers'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Setup:
diff --git a/t/t6428-merge-conflicts-sparse.sh b/t/t6428-merge-conflicts-sparse.sh
index 8a79bc2e92..9919c3fa7c 100755
--- a/t/t6428-merge-conflicts-sparse.sh
+++ b/t/t6428-merge-conflicts-sparse.sh
@@ -22,7 +22,6 @@ test_description="merge cases"
# underscore notation is to differentiate different
# files that might be renamed into each other's paths.)
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-merge.sh
diff --git a/t/t6429-merge-sequence-rename-caching.sh b/t/t6429-merge-sequence-rename-caching.sh
index cb1c4ceef7..0f39ed0d08 100755
--- a/t/t6429-merge-sequence-rename-caching.sh
+++ b/t/t6429-merge-sequence-rename-caching.sh
@@ -2,7 +2,6 @@
test_description="remember regular & dir renames in sequence of merges"
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
#
diff --git a/t/t6430-merge-recursive.sh b/t/t6430-merge-recursive.sh
index 555f00f78a..ca15e6dd6d 100755
--- a/t/t6430-merge-recursive.sh
+++ b/t/t6430-merge-recursive.sh
@@ -5,7 +5,6 @@ test_description='merge-recursive backend test'
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
diff --git a/t/t6431-merge-criscross.sh b/t/t6431-merge-criscross.sh
index 3fe14cd73e..3824756a02 100755
--- a/t/t6431-merge-criscross.sh
+++ b/t/t6431-merge-criscross.sh
@@ -2,7 +2,6 @@
test_description='merge-recursive backend test'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# A <- create some files
diff --git a/t/t6432-merge-recursive-space-options.sh b/t/t6432-merge-recursive-space-options.sh
index c93538b0c3..db4b77e63d 100755
--- a/t/t6432-merge-recursive-space-options.sh
+++ b/t/t6432-merge-recursive-space-options.sh
@@ -14,7 +14,6 @@ test_description='merge-recursive space options
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
diff --git a/t/t6433-merge-toplevel.sh b/t/t6433-merge-toplevel.sh
index ed7866d3e9..0f611c4003 100755
--- a/t/t6433-merge-toplevel.sh
+++ b/t/t6433-merge-toplevel.sh
@@ -5,7 +5,6 @@ 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 () {
diff --git a/t/t6434-merge-recursive-rename-options.sh b/t/t6434-merge-recursive-rename-options.sh
index df1d0c156c..a11707835b 100755
--- a/t/t6434-merge-recursive-rename-options.sh
+++ b/t/t6434-merge-recursive-rename-options.sh
@@ -29,7 +29,6 @@ mentions this in a different context).
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
get_expected_stages () {
diff --git a/t/t6435-merge-sparse.sh b/t/t6435-merge-sparse.sh
index 78628fb248..fde4aa3cd1 100755
--- a/t/t6435-merge-sparse.sh
+++ b/t/t6435-merge-sparse.sh
@@ -3,7 +3,6 @@
test_description='merge with sparse files'
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# test_file $filename $content
diff --git a/t/t6436-merge-overwrite.sh b/t/t6436-merge-overwrite.sh
index ccc620477d..4f4376421e 100755
--- a/t/t6436-merge-overwrite.sh
+++ b/t/t6436-merge-overwrite.sh
@@ -7,7 +7,6 @@ Do not overwrite changes.'
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' '
diff --git a/t/t6437-submodule-merge.sh b/t/t6437-submodule-merge.sh
index 7a3f1cb27c..4815559157 100755
--- a/t/t6437-submodule-merge.sh
+++ b/t/t6437-submodule-merge.sh
@@ -8,7 +8,6 @@ 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
diff --git a/t/t6438-submodule-directory-file-conflicts.sh b/t/t6438-submodule-directory-file-conflicts.sh
index 3594190af8..8df67a0ef9 100755
--- a/t/t6438-submodule-directory-file-conflicts.sh
+++ b/t/t6438-submodule-directory-file-conflicts.sh
@@ -2,7 +2,6 @@
test_description='merge can handle submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh
diff --git a/t/t6439-merge-co-error-msgs.sh b/t/t6439-merge-co-error-msgs.sh
index a9804ae42f..55bd744a3f 100755
--- a/t/t6439-merge-co-error-msgs.sh
+++ b/t/t6439-merge-co-error-msgs.sh
@@ -5,7 +5,6 @@ test_description='unpack-trees error messages'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index ee074b99b7..5378455968 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -3,7 +3,6 @@
test_description='basic git gc tests
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-terminal.sh
diff --git a/t/t6501-freshen-objects.sh b/t/t6501-freshen-objects.sh
index 4521508b83..ddef1ca391 100755
--- a/t/t6501-freshen-objects.sh
+++ b/t/t6501-freshen-objects.sh
@@ -28,7 +28,6 @@ test_description='check pruning of dependent objects'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# We care about reachability, so we do not want to use
diff --git a/t/t6600-test-reach.sh b/t/t6600-test-reach.sh
index 307deefed2..2591f8b8b3 100755
--- a/t/t6600-test-reach.sh
+++ b/t/t6600-test-reach.sh
@@ -2,7 +2,6 @@
test_description='basic commit reachability tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Construct a grid-like commit graph with points (x,y)
diff --git a/t/t6700-tree-depth.sh b/t/t6700-tree-depth.sh
index 9e70a7c763..0f6a2ad9b5 100755
--- a/t/t6700-tree-depth.sh
+++ b/t/t6700-tree-depth.sh
@@ -2,7 +2,6 @@
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
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 69c9190772..25334b5062 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -2,7 +2,6 @@
test_description='git mv in subdirs'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff-data.sh
diff --git a/t/t7002-mv-sparse-checkout.sh b/t/t7002-mv-sparse-checkout.sh
index 57969ce805..4d3f221224 100755
--- a/t/t7002-mv-sparse-checkout.sh
+++ b/t/t7002-mv-sparse-checkout.sh
@@ -2,7 +2,6 @@
test_description='git mv in sparse working trees'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
setup_sparse_checkout () {
@@ -33,7 +32,7 @@ test_expect_success 'setup' "
hint: If you intend to update such entries, try one of the following:
hint: * Use the --sparse option.
hint: * Disable or modify the sparsity rules.
- hint: Disable this message with \"git config advice.updateSparsePath false\"
+ hint: Disable this message with \"git config set advice.updateSparsePath false\"
EOF
cat >dirty_error_header <<-EOF &&
@@ -46,7 +45,7 @@ test_expect_success 'setup' "
hint: To correct the sparsity of these paths, do the following:
hint: * Use \"git add --sparse <paths>\" to update the index
hint: * Use \"git sparse-checkout reapply\" to apply the sparsity rules
- hint: Disable this message with \"git config advice.updateSparsePath false\"
+ hint: Disable this message with \"git config set advice.updateSparsePath false\"
EOF
"
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index bf3e3f0b67..5ab4d41ee7 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -4,7 +4,6 @@ test_description='git filter-branch'
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-gpg.sh"
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 42b3327e69..10835631ca 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -10,7 +10,6 @@ Tests for operations with tags.'
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-gpg.sh
. "$TEST_DIRECTORY"/lib-terminal.sh
@@ -92,6 +91,18 @@ test_expect_success 'creating a tag using default HEAD should succeed' '
test_must_fail git reflog exists refs/tags/mytag
'
+test_expect_success 'HEAD is forbidden as a tagname' '
+ test_when_finished "git update-ref --no-deref -d refs/tags/HEAD || :" &&
+ test_must_fail git tag HEAD &&
+ test_must_fail git tag -a -m "useless" HEAD
+'
+
+test_expect_success '"git tag" can remove a tag named HEAD' '
+ test_when_finished "git update-ref --no-deref -d refs/tags/HEAD || :" &&
+ git update-ref refs/tags/HEAD HEAD &&
+ git tag -d HEAD
+'
+
test_expect_success 'creating a tag with --create-reflog should create reflog' '
git log -1 \
--format="format:tag: tagging %h (%s, %cd)%n" \
@@ -1851,7 +1862,7 @@ test_expect_success 'recursive tagging should give advice' '
hint: already a tag. If you meant to tag the object that it points to, use:
hint:
hint: git tag -f nested annotated-v4.0^{}
- hint: Disable this message with "git config advice.nestedTag false"
+ hint: Disable this message with "git config set advice.nestedTag false"
EOF
git tag -m nested nested annotated-v4.0 2>actual &&
test_cmp expect actual
diff --git a/t/t7005-editor.sh b/t/t7005-editor.sh
index b9822294fe..5fcf281dfb 100755
--- a/t/t7005-editor.sh
+++ b/t/t7005-editor.sh
@@ -2,7 +2,6 @@
test_description='GIT_EDITOR, core.editor, and stuff'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
unset EDITOR VISUAL GIT_EDITOR
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index a0296d6ca4..932c26cb45 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -2,7 +2,6 @@
test_description='Test automatic use of a pager.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-pager.sh
. "$TEST_DIRECTORY"/lib-terminal.sh
diff --git a/t/t7007-show.sh b/t/t7007-show.sh
index f908a4d1ab..d6cc69e0f2 100755
--- a/t/t7007-show.sh
+++ b/t/t7007-show.sh
@@ -2,7 +2,6 @@
test_description='git show'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t7008-filter-branch-null-sha1.sh b/t/t7008-filter-branch-null-sha1.sh
index 0ce8fd2c89..93fbc92b8d 100755
--- a/t/t7008-filter-branch-null-sha1.sh
+++ b/t/t7008-filter-branch-null-sha1.sh
@@ -2,7 +2,6 @@
test_description='filter-branch removal of trees with null sha1'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup: base commits' '
diff --git a/t/t7010-setup.sh b/t/t7010-setup.sh
index d9add2162e..520f96d09f 100755
--- a/t/t7010-setup.sh
+++ b/t/t7010-setup.sh
@@ -2,7 +2,6 @@
test_description='setup taking and sanitizing funny paths'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t7011-skip-worktree-reading.sh b/t/t7011-skip-worktree-reading.sh
index c86abd99bf..1ff2714cb4 100755
--- a/t/t7011-skip-worktree-reading.sh
+++ b/t/t7011-skip-worktree-reading.sh
@@ -5,7 +5,6 @@
test_description='skip-worktree bit test'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cat >expect.full <<EOF
diff --git a/t/t7012-skip-worktree-writing.sh b/t/t7012-skip-worktree-writing.sh
index d984200c17..cd5c20fe51 100755
--- a/t/t7012-skip-worktree-writing.sh
+++ b/t/t7012-skip-worktree-writing.sh
@@ -5,7 +5,6 @@
test_description='test worktree writing operations when skip-worktree is used'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7030-verify-tag.sh b/t/t7030-verify-tag.sh
index effa826744..6f526c37c2 100755
--- a/t/t7030-verify-tag.sh
+++ b/t/t7030-verify-tag.sh
@@ -4,7 +4,6 @@ test_description='signed tag tests'
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-gpg.sh"
diff --git a/t/t7031-verify-tag-signed-ssh.sh b/t/t7031-verify-tag-signed-ssh.sh
index 0efd17b363..80359d48f7 100755
--- a/t/t7031-verify-tag-signed-ssh.sh
+++ b/t/t7031-verify-tag-signed-ssh.sh
@@ -4,7 +4,6 @@ test_description='signed tag tests'
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-gpg.sh"
diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh
index aaeb4a5334..0f4344c55e 100755
--- a/t/t7060-wtstatus.sh
+++ b/t/t7060-wtstatus.sh
@@ -5,7 +5,6 @@ test_description='basic work tree status reporting'
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 '
diff --git a/t/t7061-wtstatus-ignore.sh b/t/t7061-wtstatus-ignore.sh
index 64145a05b1..2f9bea9793 100755
--- a/t/t7061-wtstatus-ignore.sh
+++ b/t/t7061-wtstatus-ignore.sh
@@ -2,7 +2,6 @@
test_description='git-status ignored files'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cat >expected <<\EOF
diff --git a/t/t7062-wtstatus-ignorecase.sh b/t/t7062-wtstatus-ignorecase.sh
index caf372a3d4..73709dbeee 100755
--- a/t/t7062-wtstatus-ignorecase.sh
+++ b/t/t7062-wtstatus-ignorecase.sh
@@ -2,7 +2,6 @@
test_description='git-status with core.ignorecase=true'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'status with hash collisions' '
diff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh
index 13fea7931c..8929ef481f 100755
--- a/t/t7063-status-untracked-cache.sh
+++ b/t/t7063-status-untracked-cache.sh
@@ -5,7 +5,6 @@ test_description='test untracked cache'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# On some filesystems (e.g. FreeBSD's ext2 and ufs) directory mtime
diff --git a/t/t7064-wtstatus-pv2.sh b/t/t7064-wtstatus-pv2.sh
index 2458e9d0eb..8bbc5ce6d9 100755
--- a/t/t7064-wtstatus-pv2.sh
+++ b/t/t7064-wtstatus-pv2.sh
@@ -4,7 +4,6 @@ test_description='git status --porcelain=v2
This test exercises porcelain V2 output for git status.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t7101-reset-empty-subdirs.sh b/t/t7101-reset-empty-subdirs.sh
index 89cf98b30c..33d5d5b76e 100755
--- a/t/t7101-reset-empty-subdirs.sh
+++ b/t/t7101-reset-empty-subdirs.sh
@@ -5,7 +5,6 @@
test_description='git reset should cull empty subdirs'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-diff-data.sh
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index e9a6cc7265..0503a64d3f 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -10,7 +10,6 @@ Documented tests for git reset'
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 ICONV
diff --git a/t/t7103-reset-bare.sh b/t/t7103-reset-bare.sh
index 18bbd9975e..871e438118 100755
--- a/t/t7103-reset-bare.sh
+++ b/t/t7103-reset-bare.sh
@@ -2,7 +2,6 @@
test_description='git reset in a bare repository'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup non-bare' '
diff --git a/t/t7104-reset-hard.sh b/t/t7104-reset-hard.sh
index cf9697eba9..7948ec392b 100755
--- a/t/t7104-reset-hard.sh
+++ b/t/t7104-reset-hard.sh
@@ -2,7 +2,6 @@
test_description='reset --hard unmerged'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t7105-reset-patch.sh b/t/t7105-reset-patch.sh
index f4f3b7a677..fced8adabd 100755
--- a/t/t7105-reset-patch.sh
+++ b/t/t7105-reset-patch.sh
@@ -2,7 +2,6 @@
test_description='git reset --patch'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-patch-mode.sh
test_expect_success 'setup' '
diff --git a/t/t7106-reset-unborn-branch.sh b/t/t7106-reset-unborn-branch.sh
index 88d1c8adf4..df20c0f0cc 100755
--- a/t/t7106-reset-unborn-branch.sh
+++ b/t/t7106-reset-unborn-branch.sh
@@ -2,7 +2,6 @@
test_description='git reset should work on unborn branch'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7107-reset-pathspec-file.sh b/t/t7107-reset-pathspec-file.sh
index 020db201d5..9162f591fb 100755
--- a/t/t7107-reset-pathspec-file.sh
+++ b/t/t7107-reset-pathspec-file.sh
@@ -2,7 +2,6 @@
test_description='reset --pathspec-from-file'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_tick
diff --git a/t/t7110-reset-merge.sh b/t/t7110-reset-merge.sh
index 7ee180f81d..61669a2d21 100755
--- a/t/t7110-reset-merge.sh
+++ b/t/t7110-reset-merge.sh
@@ -5,7 +5,6 @@
test_description='Tests for "git reset" with "--merge" and "--keep" options'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t7111-reset-table.sh b/t/t7111-reset-table.sh
index 01b7c3503c..07b919731a 100755
--- a/t/t7111-reset-table.sh
+++ b/t/t7111-reset-table.sh
@@ -5,7 +5,6 @@
test_description='Tests to check that "reset" options follow a known table'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t7112-reset-submodule.sh b/t/t7112-reset-submodule.sh
index b0d3d93b0b..a3e2413bc3 100755
--- a/t/t7112-reset-submodule.sh
+++ b/t/t7112-reset-submodule.sh
@@ -2,7 +2,6 @@
test_description='reset can handle submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh
diff --git a/t/t7113-post-index-change-hook.sh b/t/t7113-post-index-change-hook.sh
index 58e55a7c77..c10d94fe3d 100755
--- a/t/t7113-post-index-change-hook.sh
+++ b/t/t7113-post-index-change-hook.sh
@@ -5,7 +5,6 @@ test_description='post index change hook'
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' '
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 2d984eb4c6..9bcf7c0b40 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -23,7 +23,6 @@ Test switching across them.
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_tick
@@ -225,7 +224,7 @@ test_expect_success 'switch to another branch while carrying a deletion' '
'
test_expect_success 'checkout to detach HEAD (with advice declined)' '
- git config advice.detachedHead false &&
+ git config set advice.detachedHead false &&
rev=$(git rev-parse --short renamer^) &&
git checkout -f renamer &&
git clean -f &&
@@ -245,7 +244,7 @@ test_expect_success 'checkout to detach HEAD (with advice declined)' '
'
test_expect_success 'checkout to detach HEAD' '
- git config advice.detachedHead true &&
+ git config set advice.detachedHead true &&
rev=$(git rev-parse --short renamer^) &&
git checkout -f renamer &&
git clean -f &&
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index 54fed91e39..00d4070156 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -5,7 +5,6 @@
test_description='git clean basic tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
git config clean.requireForce no
diff --git a/t/t7301-clean-interactive.sh b/t/t7301-clean-interactive.sh
index 4afe53c66a..f743e5b8f4 100755
--- a/t/t7301-clean-interactive.sh
+++ b/t/t7301-clean-interactive.sh
@@ -2,7 +2,6 @@
test_description='git clean -i basic tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-terminal.sh
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 098d8833b6..d6a501d453 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -12,7 +12,6 @@ subcommands of git submodule.
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 - enable local submodules' '
@@ -213,7 +212,7 @@ test_expect_success 'submodule add to .gitignored path fails' '
The following paths are ignored by one of your .gitignore files:
submod
hint: Use -f if you really want to add them.
- hint: Disable this message with "git config advice.addIgnoredFile false"
+ hint: Disable this message with "git config set advice.addIgnoredFile false"
EOF
# Does not use test_commit due to the ignore
echo "*" > .gitignore &&
diff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-summary.sh
index 542b3331a7..9c3cc4cf40 100755
--- a/t/t7401-submodule-summary.sh
+++ b/t/t7401-submodule-summary.sh
@@ -17,7 +17,6 @@ This test script tries to verify the sanity of summary subcommand of git submodu
# various reasons, one of them being that there are lots of commands taking place
# outside of 'test_expect_success' block, which is no longer in good-style.
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
add_file () {
diff --git a/t/t7402-submodule-rebase.sh b/t/t7402-submodule-rebase.sh
index aa2fdc31d1..25b33a1e87 100755
--- a/t/t7402-submodule-rebase.sh
+++ b/t/t7402-submodule-rebase.sh
@@ -5,7 +5,6 @@
test_description='Test rebasing, stashing, etc. with submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh
index 19b6135d11..bf97d4f851 100755
--- a/t/t7403-submodule-sync.sh
+++ b/t/t7403-submodule-sync.sh
@@ -11,7 +11,6 @@ These tests exercise the "git submodule sync" subcommand.
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 '
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 0f0c86f9cb..297c6c3b5c 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -12,7 +12,6 @@ submodule and "git submodule update --rebase/--merge" does not detach the HEAD.
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t7407-submodule-foreach.sh b/t/t7407-submodule-foreach.sh
index 9f68893261..8d7b234beb 100755
--- a/t/t7407-submodule-foreach.sh
+++ b/t/t7407-submodule-foreach.sh
@@ -12,7 +12,6 @@ that are currently checked out.
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh
index 7e1afa9ce4..f860e7bbf4 100755
--- a/t/t7408-submodule-reference.sh
+++ b/t/t7408-submodule-reference.sh
@@ -5,7 +5,6 @@
test_description='test clone --reference'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
base_dir=$(pwd)
diff --git a/t/t7409-submodule-detached-work-tree.sh b/t/t7409-submodule-detached-work-tree.sh
index 574a6fc526..374ed481e9 100755
--- a/t/t7409-submodule-detached-work-tree.sh
+++ b/t/t7409-submodule-detached-work-tree.sh
@@ -13,7 +13,6 @@ TEST_NO_CREATE_REPO=1
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' '
diff --git a/t/t7411-submodule-config.sh b/t/t7411-submodule-config.sh
index af0de496e0..31271f8e0a 100755
--- a/t/t7411-submodule-config.sh
+++ b/t/t7411-submodule-config.sh
@@ -10,7 +10,6 @@ from the database and from the worktree works.
'
TEST_NO_CREATE_REPO=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7412-submodule-absorbgitdirs.sh b/t/t7412-submodule-absorbgitdirs.sh
index f778321857..0490499573 100755
--- a/t/t7412-submodule-absorbgitdirs.sh
+++ b/t/t7412-submodule-absorbgitdirs.sh
@@ -6,7 +6,6 @@ This test verifies that `git submodue absorbgitdirs` moves a submodules git
directory into the superproject.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup a real submodule' '
diff --git a/t/t7413-submodule-is-active.sh b/t/t7413-submodule-is-active.sh
index b9c89b1019..9509dc18fd 100755
--- a/t/t7413-submodule-is-active.sh
+++ b/t/t7413-submodule-is-active.sh
@@ -9,7 +9,6 @@ This is a unit test of the submodule.c is_submodule_active() function,
which is also indirectly tested elsewhere.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7414-submodule-mistakes.sh b/t/t7414-submodule-mistakes.sh
index 24f30e3bf9..e2d75c7f16 100755
--- a/t/t7414-submodule-mistakes.sh
+++ b/t/t7414-submodule-mistakes.sh
@@ -2,7 +2,6 @@
test_description='handling of common mistakes people may make with submodules'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'create embedded repository' '
diff --git a/t/t7416-submodule-dash-url.sh b/t/t7416-submodule-dash-url.sh
index 2ab566e717..0c605fd271 100755
--- a/t/t7416-submodule-dash-url.sh
+++ b/t/t7416-submodule-dash-url.sh
@@ -2,7 +2,6 @@
test_description='check handling of disallowed .gitmodule urls'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7417-submodule-path-url.sh b/t/t7417-submodule-path-url.sh
index dbbb3853dc..5e3051da8b 100755
--- a/t/t7417-submodule-path-url.sh
+++ b/t/t7417-submodule-path-url.sh
@@ -4,7 +4,6 @@ test_description='check handling of .gitmodule path with dash'
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' '
diff --git a/t/t7418-submodule-sparse-gitmodules.sh b/t/t7418-submodule-sparse-gitmodules.sh
index e1d9bf2ee3..dde11ecce8 100755
--- a/t/t7418-submodule-sparse-gitmodules.sh
+++ b/t/t7418-submodule-sparse-gitmodules.sh
@@ -15,7 +15,6 @@ also by committing .gitmodules and then just removing it from the filesystem.
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7419-submodule-set-branch.sh b/t/t7419-submodule-set-branch.sh
index a5d1bc5c54..08ed51d34f 100755
--- a/t/t7419-submodule-set-branch.sh
+++ b/t/t7419-submodule-set-branch.sh
@@ -9,7 +9,6 @@ This test verifies that the set-branch subcommand of git-submodule is working
as expected.
'
-TEST_PASSES_SANITIZE_LEAK=true
TEST_NO_CREATE_REPO=1
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
diff --git a/t/t7420-submodule-set-url.sh b/t/t7420-submodule-set-url.sh
index d7fe910bbe..bf7f15ee79 100755
--- a/t/t7420-submodule-set-url.sh
+++ b/t/t7420-submodule-set-url.sh
@@ -10,7 +10,6 @@ as expected.
'
TEST_NO_CREATE_REPO=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7421-submodule-summary-add.sh b/t/t7421-submodule-summary-add.sh
index 479c8fdde1..ce64d8b137 100755
--- a/t/t7421-submodule-summary-add.sh
+++ b/t/t7421-submodule-summary-add.sh
@@ -10,7 +10,6 @@ while making sure to add submodules using `git submodule add` instead of
`git add` as done in t7401.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7422-submodule-output.sh b/t/t7422-submodule-output.sh
index c1686d6bb5..f21e920367 100755
--- a/t/t7422-submodule-output.sh
+++ b/t/t7422-submodule-output.sh
@@ -2,7 +2,6 @@
test_description='submodule --cached, --quiet etc. output'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-t3100.sh
diff --git a/t/t7423-submodule-symlinks.sh b/t/t7423-submodule-symlinks.sh
index f45d806201..3d3c7af3ce 100755
--- a/t/t7423-submodule-symlinks.sh
+++ b/t/t7423-submodule-symlinks.sh
@@ -2,7 +2,6 @@
test_description='check that submodule operations do not follow symlinks'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'prepare' '
diff --git a/t/t7424-submodule-mixed-ref-formats.sh b/t/t7424-submodule-mixed-ref-formats.sh
index b43ef2ba67..559713b607 100755
--- a/t/t7424-submodule-mixed-ref-formats.sh
+++ b/t/t7424-submodule-mixed-ref-formats.sh
@@ -2,7 +2,6 @@
test_description='submodules handle mixed ref storage formats'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_ref_format () {
diff --git a/t/t7450-bad-git-dotfiles.sh b/t/t7450-bad-git-dotfiles.sh
index 4a9c22c9e2..9367794641 100755
--- a/t/t7450-bad-git-dotfiles.sh
+++ b/t/t7450-bad-git-dotfiles.sh
@@ -13,7 +13,6 @@ Such as:
- symlinked .gitmodules, etc
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-pack.sh
diff --git a/t/t7500-commit-template-squash-signoff.sh b/t/t7500-commit-template-squash-signoff.sh
index 379d3ed341..4dca8d97a7 100755
--- a/t/t7500-commit-template-squash-signoff.sh
+++ b/t/t7500-commit-template-squash-signoff.sh
@@ -7,7 +7,6 @@ test_description='git commit
Tests for template, signoff, squash and -F functions.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh
diff --git a/t/t7501-commit-basic-functionality.sh b/t/t7501-commit-basic-functionality.sh
index 52f5e28154..cc12f99f11 100755
--- a/t/t7501-commit-basic-functionality.sh
+++ b/t/t7501-commit-basic-functionality.sh
@@ -9,7 +9,6 @@ test_description='git commit'
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-diff.sh"
diff --git a/t/t7502-commit-porcelain.sh b/t/t7502-commit-porcelain.sh
index 84f1ff52b6..b37e2018a7 100755
--- a/t/t7502-commit-porcelain.sh
+++ b/t/t7502-commit-porcelain.sh
@@ -5,7 +5,6 @@ test_description='git commit porcelain-ish'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
commit_msg_is () {
diff --git a/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh b/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh
index aa004b70a8..ad1eb64ba0 100755
--- a/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh
+++ b/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh
@@ -5,7 +5,6 @@ test_description='pre-commit and pre-merge-commit 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 'root commit' '
diff --git a/t/t7504-commit-msg-hook.sh b/t/t7504-commit-msg-hook.sh
index d1255228d5..c0f024eb1e 100755
--- a/t/t7504-commit-msg-hook.sh
+++ b/t/t7504-commit-msg-hook.sh
@@ -5,7 +5,6 @@ test_description='commit-msg hook'
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 'with no hook' '
diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh
index b88383df9e..2128142a61 100755
--- a/t/t7505-prepare-commit-msg-hook.sh
+++ b/t/t7505-prepare-commit-msg-hook.sh
@@ -5,7 +5,6 @@ test_description='prepare-commit-msg hook'
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 'set up commits for rebasing' '
diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh
index 46566d529e..185fe7e78e 100755
--- a/t/t7506-status-submodule.sh
+++ b/t/t7506-status-submodule.sh
@@ -2,7 +2,6 @@
test_description='git status for submodule'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_create_repo_with_commit () {
diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh
index 4c7db19ce7..b53d71c086 100755
--- a/t/t7507-commit-verbose.sh
+++ b/t/t7507-commit-verbose.sh
@@ -2,7 +2,6 @@
test_description='verbose commit template'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
write_script "check-for-diff" <<\EOF &&
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index 773383fefb..b2070d4e39 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -5,7 +5,6 @@
test_description='git status'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-terminal.sh
@@ -1700,7 +1699,7 @@ test_expect_success 'setup slow status advice' '
EOF
git add .gitignore &&
git commit -m "Add .gitignore" &&
- git config advice.statusuoption true
+ git config set advice.statusuoption true
)
'
diff --git a/t/t7509-commit-authorship.sh b/t/t7509-commit-authorship.sh
index fd8c8f8f0b..8e373b566b 100755
--- a/t/t7509-commit-authorship.sh
+++ b/t/t7509-commit-authorship.sh
@@ -5,7 +5,6 @@
test_description='commit tests of various authorhip options. '
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
author_header () {
diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh
index eb229082e4..0d2dd29fe6 100755
--- a/t/t7510-signed-commit.sh
+++ b/t/t7510-signed-commit.sh
@@ -4,7 +4,6 @@ test_description='signed commit tests'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
GNUPGHOME_NOT_USED=$GNUPGHOME
. "$TEST_DIRECTORY/lib-gpg.sh"
diff --git a/t/t7511-status-index.sh b/t/t7511-status-index.sh
index 4ffa45a7bf..b5fdc048a5 100755
--- a/t/t7511-status-index.sh
+++ b/t/t7511-status-index.sh
@@ -2,7 +2,6 @@
test_description='git status with certain file name lengths'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
files="0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z"
diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh
index cdd5f2c697..802f8f704c 100755
--- a/t/t7512-status-help.sh
+++ b/t/t7512-status-help.sh
@@ -10,7 +10,6 @@ test_description='git status advice'
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-rebase.sh
diff --git a/t/t7513-interpret-trailers.sh b/t/t7513-interpret-trailers.sh
index 502752c0f3..818a8dafbd 100755
--- a/t/t7513-interpret-trailers.sh
+++ b/t/t7513-interpret-trailers.sh
@@ -5,7 +5,6 @@
test_description='git interpret-trailers'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# When we want one trailing space at the end of each line, let's use sed
diff --git a/t/t7514-commit-patch.sh b/t/t7514-commit-patch.sh
index 03ba0c0e73..075db69b42 100755
--- a/t/t7514-commit-patch.sh
+++ b/t/t7514-commit-patch.sh
@@ -2,7 +2,6 @@
test_description='hunk edit with "commit -p -m"'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup (initial)' '
diff --git a/t/t7515-status-symlinks.sh b/t/t7515-status-symlinks.sh
index e3d6bb67bf..9f989be01b 100755
--- a/t/t7515-status-symlinks.sh
+++ b/t/t7515-status-symlinks.sh
@@ -2,7 +2,6 @@
test_description='git status and symlinks'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7516-commit-races.sh b/t/t7516-commit-races.sh
index bb95f09810..de7c4ca790 100755
--- a/t/t7516-commit-races.sh
+++ b/t/t7516-commit-races.sh
@@ -2,7 +2,6 @@
test_description='git commit races'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'race to create orphan commit' '
diff --git a/t/t7517-per-repo-email.sh b/t/t7517-per-repo-email.sh
index efc6496e2b..163ae80468 100755
--- a/t/t7517-per-repo-email.sh
+++ b/t/t7517-per-repo-email.sh
@@ -9,7 +9,6 @@ test_description='per-repo forced setting of email address'
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 a likely user.useConfigOnly use case' '
diff --git a/t/t7518-ident-corner-cases.sh b/t/t7518-ident-corner-cases.sh
index b37de0af49..d3ea4d603f 100755
--- a/t/t7518-ident-corner-cases.sh
+++ b/t/t7518-ident-corner-cases.sh
@@ -2,7 +2,6 @@
test_description='corner cases in ident strings'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# confirm that we do not segfault _and_ that we do not say "(null)", as
diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh
index 0f88a58a81..7ee69ecdd4 100755
--- a/t/t7519-status-fsmonitor.sh
+++ b/t/t7519-status-fsmonitor.sh
@@ -2,7 +2,6 @@
test_description='git status with file system watcher'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Note, after "git reset --hard HEAD" no extensions exist other than 'TREE'
diff --git a/t/t7520-ignored-hook-warning.sh b/t/t7520-ignored-hook-warning.sh
index 3b63c34a30..bcfe15d51d 100755
--- a/t/t7520-ignored-hook-warning.sh
+++ b/t/t7520-ignored-hook-warning.sh
@@ -2,7 +2,6 @@
test_description='ignored hook warning'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t7521-ignored-mode.sh b/t/t7521-ignored-mode.sh
index edce10f998..a88b02b06e 100755
--- a/t/t7521-ignored-mode.sh
+++ b/t/t7521-ignored-mode.sh
@@ -2,7 +2,6 @@
test_description='git status ignored modes'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup initial commit and ignore file' '
diff --git a/t/t7524-commit-summary.sh b/t/t7524-commit-summary.sh
index a8fceb6a47..82b5e4aa41 100755
--- a/t/t7524-commit-summary.sh
+++ b/t/t7524-commit-summary.sh
@@ -2,7 +2,6 @@
test_description='git commit summary'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7525-status-rename.sh b/t/t7525-status-rename.sh
index a9210d3a3a..d409de1a33 100755
--- a/t/t7525-status-rename.sh
+++ b/t/t7525-status-rename.sh
@@ -2,7 +2,6 @@
test_description='git status rename detection options'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7526-commit-pathspec-file.sh b/t/t7526-commit-pathspec-file.sh
index c97c550021..3aabbf35a1 100755
--- a/t/t7526-commit-pathspec-file.sh
+++ b/t/t7526-commit-pathspec-file.sh
@@ -2,7 +2,6 @@
test_description='commit --pathspec-from-file'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_tick
diff --git a/t/t7528-signed-commit-ssh.sh b/t/t7528-signed-commit-ssh.sh
index 68e18856b6..065f780636 100755
--- a/t/t7528-signed-commit-ssh.sh
+++ b/t/t7528-signed-commit-ssh.sh
@@ -4,7 +4,6 @@ test_description='ssh signed commit tests'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
GNUPGHOME_NOT_USED=$GNUPGHOME
. "$TEST_DIRECTORY/lib-gpg.sh"
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 65fd3d8552..ef54cff4fa 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -29,7 +29,6 @@ Testing basic merge operations/option parsing.
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-gpg.sh
diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh
index c83298ba68..199a1d5db3 100755
--- a/t/t7601-merge-pull-config.sh
+++ b/t/t7601-merge-pull-config.sh
@@ -4,7 +4,6 @@ test_description='git merge
Testing pull.* configuration parsing and other things.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7602-merge-octopus-many.sh b/t/t7602-merge-octopus-many.sh
index 3669d33bd5..ff085b086c 100755
--- a/t/t7602-merge-octopus-many.sh
+++ b/t/t7602-merge-octopus-many.sh
@@ -4,7 +4,6 @@ test_description='git merge
Testing octopus merge with more than 25 refs.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7603-merge-reduce-heads.sh b/t/t7603-merge-reduce-heads.sh
index 0e85b21ec8..4887ca705b 100755
--- a/t/t7603-merge-reduce-heads.sh
+++ b/t/t7603-merge-reduce-heads.sh
@@ -4,7 +4,6 @@ test_description='git merge
Testing octopus merge when reducing parents to independent branches.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# 0 - 1
diff --git a/t/t7604-merge-custom-message.sh b/t/t7604-merge-custom-message.sh
index eca7555101..cd4f9607dc 100755
--- a/t/t7604-merge-custom-message.sh
+++ b/t/t7604-merge-custom-message.sh
@@ -4,7 +4,6 @@ test_description='git merge
Testing merge when using a custom message for the merge commit.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
create_merge_msgs() {
diff --git a/t/t7605-merge-resolve.sh b/t/t7605-merge-resolve.sh
index 62d935d31c..5d56c38546 100755
--- a/t/t7605-merge-resolve.sh
+++ b/t/t7605-merge-resolve.sh
@@ -4,7 +4,6 @@ test_description='git merge
Testing the resolve strategy.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7606-merge-custom.sh b/t/t7606-merge-custom.sh
index 135cb23085..81fb7c474c 100755
--- a/t/t7606-merge-custom.sh
+++ b/t/t7606-merge-custom.sh
@@ -14,7 +14,6 @@ Testing a custom strategy.
* (tag: c0) c0
"
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'set up custom strategy' '
diff --git a/t/t7607-merge-state.sh b/t/t7607-merge-state.sh
index 9001674f2e..89a62ac53b 100755
--- a/t/t7607-merge-state.sh
+++ b/t/t7607-merge-state.sh
@@ -4,7 +4,6 @@ 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' '
diff --git a/t/t7608-merge-messages.sh b/t/t7608-merge-messages.sh
index 2179938c43..0b908ab2e7 100755
--- a/t/t7608-merge-messages.sh
+++ b/t/t7608-merge-messages.sh
@@ -4,7 +4,6 @@ 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() {
diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh
index 8b1c3bd39f..e8e205707e 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -4,11 +4,10 @@ test_description='git mergetool
Testing basic merge tools options'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
- . "$GIT_BUILD_DIR"/mergetools/vimdiff &&
+ . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
run_unit_tests
'
diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index 5c5e79e990..c077aba7ce 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -10,7 +10,6 @@ Testing basic merge tool invocation'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# All the mergetool test work by checking out a temporary branch based
@@ -899,4 +898,12 @@ test_expect_success 'mergetool with guiDefault' '
git commit -m "branch1 resolved with mergetool"
'
+test_expect_success 'mergetool with non-existent tool' '
+ test_when_finished "git reset --hard" &&
+ git checkout -b test$test_count branch1 &&
+ test_must_fail git merge main &&
+ yes "" | test_must_fail git mergetool --tool=absent >out 2>&1 &&
+ test_grep "mergetool.absent.cmd not set for tool" out
+'
+
test_done
diff --git a/t/t7611-merge-abort.sh b/t/t7611-merge-abort.sh
index 992a8f9874..d6975ca48d 100755
--- a/t/t7611-merge-abort.sh
+++ b/t/t7611-merge-abort.sh
@@ -25,7 +25,6 @@ Next, test git merge --abort with the following variables:
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' '
diff --git a/t/t7612-merge-verify-signatures.sh b/t/t7612-merge-verify-signatures.sh
index 84ddb56851..337fac0d84 100755
--- a/t/t7612-merge-verify-signatures.sh
+++ b/t/t7612-merge-verify-signatures.sh
@@ -4,7 +4,6 @@ test_description='merge signature verification tests'
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-gpg.sh"
diff --git a/t/t7614-merge-signoff.sh b/t/t7614-merge-signoff.sh
index cf96a35e8e..fee258d4f0 100755
--- a/t/t7614-merge-signoff.sh
+++ b/t/t7614-merge-signoff.sh
@@ -8,7 +8,6 @@ This test runs git merge --signoff and makes sure that it works.
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Setup test files
diff --git a/t/t7615-diff-algo-with-mergy-operations.sh b/t/t7615-diff-algo-with-mergy-operations.sh
index 9a83be518c..3b1aad0167 100755
--- a/t/t7615-diff-algo-with-mergy-operations.sh
+++ b/t/t7615-diff-algo-with-mergy-operations.sh
@@ -4,7 +4,6 @@ test_description='git merge and other operations that rely on merge
Testing the influence of the diff algorithm on the merge output.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh
index c4c3d1a15d..be1188e736 100755
--- a/t/t7700-repack.sh
+++ b/t/t7700-repack.sh
@@ -2,7 +2,6 @@
test_description='git repack works correctly'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "${TEST_DIRECTORY}/lib-bitmap.sh"
. "${TEST_DIRECTORY}/lib-midx.sh"
diff --git a/t/t7701-repack-unpack-unreachable.sh b/t/t7701-repack-unpack-unreachable.sh
index fe6c3e77a3..5715f4d69a 100755
--- a/t/t7701-repack-unpack-unreachable.sh
+++ b/t/t7701-repack-unpack-unreachable.sh
@@ -5,7 +5,6 @@ test_description='git repack works correctly'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
fsha1=
diff --git a/t/t7702-repack-cyclic-alternate.sh b/t/t7702-repack-cyclic-alternate.sh
index d151d4f603..cd91766e78 100755
--- a/t/t7702-repack-cyclic-alternate.sh
+++ b/t/t7702-repack-cyclic-alternate.sh
@@ -5,7 +5,6 @@
test_description='repack involving cyclic alternate'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t7703-repack-geometric.sh b/t/t7703-repack-geometric.sh
index 8877aea98b..9fc1626fbf 100755
--- a/t/t7703-repack-geometric.sh
+++ b/t/t7703-repack-geometric.sh
@@ -2,7 +2,6 @@
test_description='git repack --geometric works correctly'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
GIT_TEST_MULTI_PACK_INDEX=0
diff --git a/t/t7704-repack-cruft.sh b/t/t7704-repack-cruft.sh
index 5db9f4e10f..959e6e2648 100755
--- a/t/t7704-repack-cruft.sh
+++ b/t/t7704-repack-cruft.sh
@@ -2,7 +2,6 @@
test_description='git repack works correctly'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
objdir=.git/objects
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index fcaa1748e4..9b74db5563 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -11,7 +11,6 @@ Testing basic diff tool invocation
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
difftool_test_setup ()
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index 1bdb8e5a99..64ac4f04ee 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -9,7 +9,6 @@ test_description='git grep various.
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_invalid_grep_expression() {
diff --git a/t/t7811-grep-open.sh b/t/t7811-grep-open.sh
index fe38d88a1a..3160be59fd 100755
--- a/t/t7811-grep-open.sh
+++ b/t/t7811-grep-open.sh
@@ -3,7 +3,6 @@
test_description='git grep --open-files-in-pager
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-pager.sh
unset PAGER GIT_PAGER
diff --git a/t/t7812-grep-icase-non-ascii.sh b/t/t7812-grep-icase-non-ascii.sh
index 31c66b63c2..ac7be54714 100755
--- a/t/t7812-grep-icase-non-ascii.sh
+++ b/t/t7812-grep-icase-non-ascii.sh
@@ -2,7 +2,6 @@
test_description='grep icase on non-English locales'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh
doalarm () {
diff --git a/t/t7813-grep-icase-iso.sh b/t/t7813-grep-icase-iso.sh
index 1227885737..701e08a8e5 100755
--- a/t/t7813-grep-icase-iso.sh
+++ b/t/t7813-grep-icase-iso.sh
@@ -2,7 +2,6 @@
test_description='grep icase on non-English locales'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh
test_expect_success GETTEXT_ISO_LOCALE 'setup' '
diff --git a/t/t7814-grep-recurse-submodules.sh b/t/t7814-grep-recurse-submodules.sh
index 55ed630e77..167fe66150 100755
--- a/t/t7814-grep-recurse-submodules.sh
+++ b/t/t7814-grep-recurse-submodules.sh
@@ -7,7 +7,6 @@ submodules.
'
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
diff --git a/t/t7815-grep-binary.sh b/t/t7815-grep-binary.sh
index ac871287c0..90ebb64f46 100755
--- a/t/t7815-grep-binary.sh
+++ b/t/t7815-grep-binary.sh
@@ -2,7 +2,6 @@
test_description='git grep in binary files'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' "
diff --git a/t/t7816-grep-binary-pattern.sh b/t/t7816-grep-binary-pattern.sh
index 4353be5adb..0088eaa0c9 100755
--- a/t/t7816-grep-binary-pattern.sh
+++ b/t/t7816-grep-binary-pattern.sh
@@ -2,7 +2,6 @@
test_description='git grep with a binary pattern files'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gettext.sh
nul_match_internal () {
diff --git a/t/t7817-grep-sparse-checkout.sh b/t/t7817-grep-sparse-checkout.sh
index 0ba7817fb7..eb59564565 100755
--- a/t/t7817-grep-sparse-checkout.sh
+++ b/t/t7817-grep-sparse-checkout.sh
@@ -33,7 +33,6 @@ should leave the following structure in the working tree:
But note that sub2 should have the SKIP_WORKTREE bit set.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
index c224c8450c..1909aed95e 100755
--- a/t/t7900-maintenance.sh
+++ b/t/t7900-maintenance.sh
@@ -2,7 +2,6 @@
test_description='git maintenance builtin'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
GIT_TEST_COMMIT_GRAPH=0
@@ -329,7 +328,8 @@ test_expect_success 'incremental-repack task' '
# Delete refs that have not been repacked in these packs.
git for-each-ref --format="delete %(refname)" \
- refs/prefetch refs/tags refs/remotes >refs &&
+ refs/prefetch refs/tags refs/remotes \
+ --exclude=refs/remotes/*/HEAD >refs &&
git update-ref --stdin <refs &&
# Replace the object directory with this pack layout.
@@ -1011,4 +1011,17 @@ test_expect_success 'repacking loose objects is quiet' '
)
'
+test_expect_success 'maintenance aborts with existing lock file' '
+ test_when_finished "rm -rf repo script" &&
+ mkdir script &&
+ write_script script/systemctl <<-\EOF &&
+ true
+ EOF
+
+ git init repo &&
+ : >repo/.git/objects/schedule.lock &&
+ test_must_fail env PATH="$PWD/script:$PATH" git -C repo maintenance start --scheduler=systemd 2>err &&
+ test_grep "Another scheduled git-maintenance(1) process seems to be running" err
+'
+
test_done
diff --git a/t/t8001-annotate.sh b/t/t8001-annotate.sh
index d434698919..d7167f5539 100755
--- a/t/t8001-annotate.sh
+++ b/t/t8001-annotate.sh
@@ -5,7 +5,6 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
PROG='git annotate'
diff --git a/t/t8002-blame.sh b/t/t8002-blame.sh
index 3596634039..0147de304b 100755
--- a/t/t8002-blame.sh
+++ b/t/t8002-blame.sh
@@ -5,7 +5,6 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
PROG='git blame -c'
diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh
index 6288352f57..731265541a 100755
--- a/t/t8003-blame-corner-cases.sh
+++ b/t/t8003-blame-corner-cases.sh
@@ -4,7 +4,6 @@ test_description='git blame corner cases'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
pick_fc='s/^[0-9a-f^]* *\([^ ]*\) *(\([^ ]*\) .*/\1-\2/'
diff --git a/t/t8004-blame-with-conflicts.sh b/t/t8004-blame-with-conflicts.sh
index 2c2a0b33f9..35414a5336 100755
--- a/t/t8004-blame-with-conflicts.sh
+++ b/t/t8004-blame-with-conflicts.sh
@@ -6,7 +6,6 @@ test_description='git blame on conflicted files'
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 first case' '
diff --git a/t/t8005-blame-i18n.sh b/t/t8005-blame-i18n.sh
index 7a1f581c24..81847ffb9a 100755
--- a/t/t8005-blame-i18n.sh
+++ b/t/t8005-blame-i18n.sh
@@ -1,6 +1,7 @@
#!/bin/sh
test_description='git blame encoding conversion'
+
. ./test-lib.sh
if ! test_have_prereq ICONV
diff --git a/t/t8006-blame-textconv.sh b/t/t8006-blame-textconv.sh
index 42f8be25a3..07a287ffd3 100755
--- a/t/t8006-blame-textconv.sh
+++ b/t/t8006-blame-textconv.sh
@@ -2,7 +2,6 @@
test_description='git blame textconv support'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
find_blame() {
diff --git a/t/t8007-cat-file-textconv.sh b/t/t8007-cat-file-textconv.sh
index c8266f17f1..c3735fb50d 100755
--- a/t/t8007-cat-file-textconv.sh
+++ b/t/t8007-cat-file-textconv.sh
@@ -2,7 +2,6 @@
test_description='git cat-file textconv support'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cat >helper <<'EOF'
diff --git a/t/t8008-blame-formats.sh b/t/t8008-blame-formats.sh
index fb5d225a67..c12a4196d6 100755
--- a/t/t8008-blame-formats.sh
+++ b/t/t8008-blame-formats.sh
@@ -2,7 +2,6 @@
test_description='blame output in various formats on a simple case'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t8009-blame-vs-topicbranches.sh b/t/t8009-blame-vs-topicbranches.sh
index cc51108464..c808b81962 100755
--- a/t/t8009-blame-vs-topicbranches.sh
+++ b/t/t8009-blame-vs-topicbranches.sh
@@ -2,7 +2,6 @@
test_description='blaming through history with topic branches'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Creates the history shown below. '*'s mark the first parent in the merges.
diff --git a/t/t8010-cat-file-filters.sh b/t/t8010-cat-file-filters.sh
index eb64b766bd..b3be2aa387 100755
--- a/t/t8010-cat-file-filters.sh
+++ b/t/t8010-cat-file-filters.sh
@@ -2,7 +2,6 @@
test_description='git cat-file filters support'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup ' '
diff --git a/t/t8011-blame-split-file.sh b/t/t8011-blame-split-file.sh
index da1801f4d2..c66494f5ba 100755
--- a/t/t8011-blame-split-file.sh
+++ b/t/t8011-blame-split-file.sh
@@ -11,7 +11,6 @@ not bother testing that the non-C case fails to find it. That is how blame
behaves now, but it is not a property we want to make sure is retained.
'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# help avoid typing and reading long strings of similar lines
diff --git a/t/t8012-blame-colors.sh b/t/t8012-blame-colors.sh
index 9a79c109f2..c3a5f6d01f 100755
--- a/t/t8012-blame-colors.sh
+++ b/t/t8012-blame-colors.sh
@@ -5,7 +5,6 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_CREATE_REPO_NO_TEMPLATE=1
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
PROG='git blame -c'
diff --git a/t/t8013-blame-ignore-revs.sh b/t/t8013-blame-ignore-revs.sh
index d33788d867..370b768149 100755
--- a/t/t8013-blame-ignore-revs.sh
+++ b/t/t8013-blame-ignore-revs.sh
@@ -2,7 +2,6 @@
test_description='ignore revisions when blaming'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Creates:
diff --git a/t/t8014-blame-ignore-fuzzy.sh b/t/t8014-blame-ignore-fuzzy.sh
index 933222cea1..f5dcbd9e82 100755
--- a/t/t8014-blame-ignore-fuzzy.sh
+++ b/t/t8014-blame-ignore-fuzzy.sh
@@ -2,7 +2,6 @@
test_description='git blame ignore fuzzy heuristic'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
pick_author='s/^[0-9a-f^]* *(\([^ ]*\) .*/\1/'
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index e2430f7bfa..0c1af43f6f 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -4,7 +4,6 @@ test_description='git send-email'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# May be altered later in the test
diff --git a/t/t9002-column.sh b/t/t9002-column.sh
index d5b98e615b..7353815c11 100755
--- a/t/t9002-column.sh
+++ b/t/t9002-column.sh
@@ -1,7 +1,6 @@
#!/bin/sh
test_description='git column'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t9003-help-autocorrect.sh b/t/t9003-help-autocorrect.sh
index 3be063afab..85a5074b5e 100755
--- a/t/t9003-help-autocorrect.sh
+++ b/t/t9003-help-autocorrect.sh
@@ -2,7 +2,6 @@
test_description='help.autocorrect finding a match'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index 3d4842164c..a44eabf0d8 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -4,7 +4,6 @@
#
test_description='Test export of commits to CVS'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
if ! test_have_prereq PERL; then
diff --git a/t/t9210-scalar.sh b/t/t9210-scalar.sh
index a30b2c9f70..a81662713e 100755
--- a/t/t9210-scalar.sh
+++ b/t/t9210-scalar.sh
@@ -2,7 +2,6 @@
test_description='test the `scalar` command'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
GIT_TEST_MAINT_SCHEDULER="crontab:test-tool crontab cron.txt,launchctl:true,schtasks:true"
@@ -151,7 +150,8 @@ test_expect_success 'scalar clone' '
"$(pwd)" &&
git for-each-ref --format="%(refname)" refs/remotes/origin/ >actual &&
- echo "refs/remotes/origin/parallel" >expect &&
+ echo "refs/remotes/origin/HEAD" >>expect &&
+ echo "refs/remotes/origin/parallel" >>expect &&
test_cmp expect actual &&
test_path_is_missing 1/2 &&
@@ -220,7 +220,7 @@ test_expect_success 'scalar reconfigure --all with includeIf.onbranch' '
done
'
- test_expect_success 'scalar reconfigure --all with detached HEADs' '
+test_expect_success 'scalar reconfigure --all with detached HEADs' '
repos="two three four" &&
for num in $repos
do
diff --git a/t/t9211-scalar-clone.sh b/t/t9211-scalar-clone.sh
index c16ea67c1d..01f71910f5 100755
--- a/t/t9211-scalar-clone.sh
+++ b/t/t9211-scalar-clone.sh
@@ -2,7 +2,6 @@
test_description='test the `scalar clone` subcommand'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "${TEST_DIRECTORY}/lib-terminal.sh"
@@ -32,7 +31,7 @@ test_expect_success 'set up repository to clone' '
)
'
-cleanup_clone () {
+cleanup_clone() {
rm -rf "$1"
}
@@ -128,7 +127,7 @@ test_expect_success '--single-branch clones HEAD only' '
(
cd $enlistment/src &&
git for-each-ref refs/remotes/origin >out &&
- test_line_count = 1 out &&
+ test_line_count = 2 out &&
grep "refs/remotes/origin/base" out
) &&
@@ -142,7 +141,7 @@ test_expect_success '--no-single-branch clones all branches' '
(
cd $enlistment/src &&
git for-each-ref refs/remotes/origin >out &&
- test_line_count = 2 out &&
+ test_line_count = 3 out &&
grep "refs/remotes/origin/base" out &&
grep "refs/remotes/origin/parallel" out
) &&
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 425a261c16..b258dbf1df 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -7,7 +7,6 @@ test_description='test git fast-import utility'
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-diff.sh ;# test-lib chdir's into trash
@@ -522,6 +521,113 @@ test_expect_success 'B: fail on invalid committer (5)' '
test_must_fail git fast-import <input
'
+test_expect_success 'B: fail on invalid file path of ..' '
+ cat >input <<-INPUT_END &&
+ blob
+ mark :1
+ data <<EOF
+ File contents
+ EOF
+
+ commit refs/heads/badpath
+ committer Name <email> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ Commit Message
+ COMMIT
+ M 100644 :1 ../invalid-path
+ INPUT_END
+
+ test_when_finished "git update-ref -d refs/heads/badpath" &&
+ test_must_fail git fast-import <input
+'
+
+test_expect_success 'B: fail on invalid file path of .' '
+ cat >input <<-INPUT_END &&
+ blob
+ mark :1
+ data <<EOF
+ File contents
+ EOF
+
+ commit refs/heads/badpath
+ committer Name <email> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ Good path
+ COMMIT
+ M 100644 :1 ok-path
+
+ commit refs/heads/badpath
+ committer Name <email> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ Bad path
+ COMMIT
+ R ok-path ./invalid-path
+ INPUT_END
+
+ test_when_finished "git update-ref -d refs/heads/badpath" &&
+ test_must_fail git fast-import <input
+'
+
+test_expect_success WINDOWS 'B: fail on invalid file path of C:' '
+ cat >input <<-INPUT_END &&
+ blob
+ mark :1
+ data <<EOF
+ File contents
+ EOF
+
+ commit refs/heads/badpath
+ committer Name <email> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ Commit Message
+ COMMIT
+ M 100644 :1 C:/invalid-path
+ INPUT_END
+
+ test_when_finished "git update-ref -d refs/heads/badpath" &&
+ test_must_fail git fast-import <input
+'
+
+test_expect_success 'B: fail on invalid file path of .git' '
+ cat >input <<-INPUT_END &&
+ blob
+ mark :1
+ data <<EOF
+ File contents
+ EOF
+
+ commit refs/heads/badpath
+ committer Name <email> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ Commit Message
+ COMMIT
+ M 100644 :1 .git/invalid-path
+ INPUT_END
+
+ test_when_finished "git update-ref -d refs/heads/badpath" &&
+ test_must_fail git fast-import <input
+'
+
+test_expect_success 'B: fail on invalid file path of .gitmodules' '
+ cat >input <<-INPUT_END &&
+ blob
+ mark :1
+ data <<EOF
+ File contents
+ EOF
+
+ commit refs/heads/badpath
+ committer Name <email> $GIT_COMMITTER_DATE
+ data <<COMMIT
+ Commit Message
+ COMMIT
+ M 120000 :1 .gitmodules
+ INPUT_END
+
+ test_when_finished "git update-ref -d refs/heads/badpath" &&
+ test_must_fail git fast-import <input
+'
+
###
### series C
###
@@ -946,7 +1052,7 @@ test_expect_success 'L: verify internal tree sorting' '
:100644 100644 M ba
EXPECT_END
- git fast-import <input &&
+ git -c core.protectNTFS=false fast-import <input &&
GIT_PRINT_SHA1_ELLIPSIS="yes" git diff-tree --abbrev --raw L^ L >output &&
cut -d" " -f1,2,5 output >actual &&
test_cmp expect actual
@@ -3097,7 +3203,7 @@ test_path_eol_success () {
test_expect_success "S: paths at EOL with $test must work" '
test_when_finished "git branch -D S-path-eol" &&
- git fast-import --export-marks=marks.out <<-EOF >out 2>err &&
+ git -c core.protectNTFS=false fast-import --export-marks=marks.out <<-EOF >out 2>err &&
blob
mark :401
data <<BLOB
@@ -3206,7 +3312,7 @@ test_path_space_success () {
test_expect_success "S: paths before space with $test must work" '
test_when_finished "git branch -D S-path-space" &&
- git fast-import --export-marks=marks.out <<-EOF 2>err &&
+ git -c core.protectNTFS=false fast-import --export-marks=marks.out <<-EOF 2>err &&
blob
mark :401
data <<BLOB
diff --git a/t/t9301-fast-import-notes.sh b/t/t9301-fast-import-notes.sh
index 58413221e6..1ae4d7c0d3 100755
--- a/t/t9301-fast-import-notes.sh
+++ b/t/t9301-fast-import-notes.sh
@@ -7,7 +7,6 @@ test_description='test git fast-import of notes objects'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t9302-fast-import-unpack-limit.sh b/t/t9302-fast-import-unpack-limit.sh
index d8b1f9442e..ec8c8652c6 100755
--- a/t/t9302-fast-import-unpack-limit.sh
+++ b/t/t9302-fast-import-unpack-limit.sh
@@ -1,7 +1,6 @@
#!/bin/sh
test_description='test git fast-import unpack limit'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'create loose objects on import' '
diff --git a/t/t9303-fast-import-compression.sh b/t/t9303-fast-import-compression.sh
index 4f5bf40587..f15c8c0213 100755
--- a/t/t9303-fast-import-compression.sh
+++ b/t/t9303-fast-import-compression.sh
@@ -2,7 +2,6 @@
test_description='compression setting of fast-import utility'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
import_large () {
diff --git a/t/t9304-fast-import-marks.sh b/t/t9304-fast-import-marks.sh
index 1f776a80f3..6c50adca00 100755
--- a/t/t9304-fast-import-marks.sh
+++ b/t/t9304-fast-import-marks.sh
@@ -2,7 +2,6 @@
test_description='test exotic situations with marks'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup dump of basic history' '
diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh
index 9595dfef2e..40427883ec 100755
--- a/t/t9350-fast-export.sh
+++ b/t/t9350-fast-export.sh
@@ -7,7 +7,6 @@ test_description='git fast-export'
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' '
@@ -632,7 +631,7 @@ test_expect_success 'fast-export quotes pathnames' '
git rev-list HEAD >expect &&
git init result &&
cd result &&
- git fast-import <../export.out &&
+ git -c core.protectNTFS=false fast-import <../export.out &&
git rev-list HEAD >actual &&
test_cmp ../expect actual
)
diff --git a/t/t9351-fast-export-anonymize.sh b/t/t9351-fast-export-anonymize.sh
index c0d9d7be75..156a647484 100755
--- a/t/t9351-fast-export-anonymize.sh
+++ b/t/t9351-fast-export-anonymize.sh
@@ -4,7 +4,6 @@ test_description='basic tests for fast-export --anonymize'
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 simple repo' '
diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 6da7440e73..e499c7f955 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -11,7 +11,6 @@ cvs CLI client via git-cvsserver server'
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 PERL; then
diff --git a/t/t9401-git-cvsserver-crlf.sh b/t/t9401-git-cvsserver-crlf.sh
index a67e6abd49..a34805acdc 100755
--- a/t/t9401-git-cvsserver-crlf.sh
+++ b/t/t9401-git-cvsserver-crlf.sh
@@ -12,7 +12,6 @@ repository using cvs CLI client via git-cvsserver server'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
marked_as () {
diff --git a/t/t9402-git-cvsserver-refs.sh b/t/t9402-git-cvsserver-refs.sh
index c847120d52..2ee41f9443 100755
--- a/t/t9402-git-cvsserver-refs.sh
+++ b/t/t9402-git-cvsserver-refs.sh
@@ -8,7 +8,6 @@ tags, branches and other git refspecs'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
#########
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index ccfa415384..7679780fb8 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -13,7 +13,6 @@ or warnings to log.'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gitweb.sh
# ----------------------------------------------------------------------
diff --git a/t/t9501-gitweb-standalone-http-status.sh b/t/t9501-gitweb-standalone-http-status.sh
index c900231079..32814e75df 100755
--- a/t/t9501-gitweb-standalone-http-status.sh
+++ b/t/t9501-gitweb-standalone-http-status.sh
@@ -13,7 +13,6 @@ code and message.'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gitweb.sh
#
diff --git a/t/t9502-gitweb-standalone-parse-output.sh b/t/t9502-gitweb-standalone-parse-output.sh
index b41ea19331..81d5625557 100755
--- a/t/t9502-gitweb-standalone-parse-output.sh
+++ b/t/t9502-gitweb-standalone-parse-output.sh
@@ -13,7 +13,6 @@ in the HTTP header or the actual script output.'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-gitweb.sh
# ----------------------------------------------------------------------
diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh
index 41fcf3606b..5680849218 100755
--- a/t/t9600-cvsimport.sh
+++ b/t/t9600-cvsimport.sh
@@ -4,7 +4,6 @@ test_description='git cvsimport basic tests'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-cvs.sh
if ! test_have_prereq NOT_ROOT; then
diff --git a/t/t9601-cvsimport-vendor-branch.sh b/t/t9601-cvsimport-vendor-branch.sh
index e007669495..116cddba3a 100755
--- a/t/t9601-cvsimport-vendor-branch.sh
+++ b/t/t9601-cvsimport-vendor-branch.sh
@@ -35,7 +35,6 @@ test_description='git cvsimport handling of vendor branches'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-cvs.sh
setup_cvs_test_repository t9601
diff --git a/t/t9602-cvsimport-branches-tags.sh b/t/t9602-cvsimport-branches-tags.sh
index 3768e3bd8c..e5266c9a87 100755
--- a/t/t9602-cvsimport-branches-tags.sh
+++ b/t/t9602-cvsimport-branches-tags.sh
@@ -7,7 +7,6 @@ test_description='git cvsimport handling of branches and tags'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-cvs.sh
setup_cvs_test_repository t9602
diff --git a/t/t9603-cvsimport-patchsets.sh b/t/t9603-cvsimport-patchsets.sh
index 2a387fdbaa..1ee966c256 100755
--- a/t/t9603-cvsimport-patchsets.sh
+++ b/t/t9603-cvsimport-patchsets.sh
@@ -13,7 +13,6 @@
test_description='git cvsimport testing for correct patchset estimation'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-cvs.sh
setup_cvs_test_repository t9603
diff --git a/t/t9604-cvsimport-timestamps.sh b/t/t9604-cvsimport-timestamps.sh
index 9cf0685d56..57a3bef2ec 100755
--- a/t/t9604-cvsimport-timestamps.sh
+++ b/t/t9604-cvsimport-timestamps.sh
@@ -2,7 +2,6 @@
test_description='git cvsimport timestamps'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-cvs.sh
test_lazy_prereq POSIX_TIMEZONE '
diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh
index 4431697122..9c9e3b5eb1 100755
--- a/t/t9700-perl-git.sh
+++ b/t/t9700-perl-git.sh
@@ -5,7 +5,6 @@
test_description='perl interface (Git.pm)'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-perl.sh
diff --git a/t/t9700/test.pl b/t/t9700/test.pl
index 2e1d50d4d1..58a9b328d5 100755
--- a/t/t9700/test.pl
+++ b/t/t9700/test.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use lib (split(/:/, $ENV{GITPERLLIB}));
-use 5.008001;
+require v5.26;
use warnings;
use strict;
diff --git a/t/t9800-git-p4-basic.sh b/t/t9800-git-p4-basic.sh
index 3e6dfce248..0816763e46 100755
--- a/t/t9800-git-p4-basic.sh
+++ b/t/t9800-git-p4-basic.sh
@@ -5,7 +5,6 @@ test_description='git p4 tests'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9801-git-p4-branch.sh b/t/t9801-git-p4-branch.sh
index cdbfacc727..c598011635 100755
--- a/t/t9801-git-p4-branch.sh
+++ b/t/t9801-git-p4-branch.sh
@@ -5,7 +5,6 @@ test_description='git p4 tests for p4 branches'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh
index 1bc48305b0..df01a5d338 100755
--- a/t/t9802-git-p4-filetype.sh
+++ b/t/t9802-git-p4-filetype.sh
@@ -2,7 +2,6 @@
test_description='git p4 filetype tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9803-git-p4-shell-metachars.sh b/t/t9803-git-p4-shell-metachars.sh
index ab7fe16266..2913277013 100755
--- a/t/t9803-git-p4-shell-metachars.sh
+++ b/t/t9803-git-p4-shell-metachars.sh
@@ -2,7 +2,6 @@
test_description='git p4 transparency to shell metachars in filenames'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9804-git-p4-label.sh b/t/t9804-git-p4-label.sh
index c8963fd398..3236457106 100755
--- a/t/t9804-git-p4-label.sh
+++ b/t/t9804-git-p4-label.sh
@@ -2,7 +2,6 @@
test_description='git p4 label tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9805-git-p4-skip-submit-edit.sh b/t/t9805-git-p4-skip-submit-edit.sh
index 72dce3d2b4..90ef647db7 100755
--- a/t/t9805-git-p4-skip-submit-edit.sh
+++ b/t/t9805-git-p4-skip-submit-edit.sh
@@ -2,7 +2,6 @@
test_description='git p4 skipSubmitEdit config variables'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9806-git-p4-options.sh b/t/t9806-git-p4-options.sh
index e4ce44ebf3..c26d297433 100755
--- a/t/t9806-git-p4-options.sh
+++ b/t/t9806-git-p4-options.sh
@@ -5,7 +5,6 @@ test_description='git p4 options'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9808-git-p4-chdir.sh b/t/t9808-git-p4-chdir.sh
index 342f7f3d4a..58a9b3b71e 100755
--- a/t/t9808-git-p4-chdir.sh
+++ b/t/t9808-git-p4-chdir.sh
@@ -2,7 +2,6 @@
test_description='git p4 relative chdir'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9809-git-p4-client-view.sh b/t/t9809-git-p4-client-view.sh
index f33fdea889..9c9710d8c7 100755
--- a/t/t9809-git-p4-client-view.sh
+++ b/t/t9809-git-p4-client-view.sh
@@ -2,7 +2,6 @@
test_description='git p4 client view'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9810-git-p4-rcs.sh b/t/t9810-git-p4-rcs.sh
index 15e32c9f35..5fe83315ec 100755
--- a/t/t9810-git-p4-rcs.sh
+++ b/t/t9810-git-p4-rcs.sh
@@ -2,7 +2,6 @@
test_description='git p4 rcs keywords'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
CP1252="\223\224"
diff --git a/t/t9811-git-p4-label-import.sh b/t/t9811-git-p4-label-import.sh
index 52a4b0af81..5ac5383fb7 100755
--- a/t/t9811-git-p4-label-import.sh
+++ b/t/t9811-git-p4-label-import.sh
@@ -5,7 +5,6 @@ test_description='git p4 label tests'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9812-git-p4-wildcards.sh b/t/t9812-git-p4-wildcards.sh
index 46aa5fd56c..254a7c2446 100755
--- a/t/t9812-git-p4-wildcards.sh
+++ b/t/t9812-git-p4-wildcards.sh
@@ -2,7 +2,6 @@
test_description='git p4 wildcards'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9813-git-p4-preserve-users.sh b/t/t9813-git-p4-preserve-users.sh
index 0efea28da2..fd018c87a8 100755
--- a/t/t9813-git-p4-preserve-users.sh
+++ b/t/t9813-git-p4-preserve-users.sh
@@ -2,7 +2,6 @@
test_description='git p4 preserve users'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9814-git-p4-rename.sh b/t/t9814-git-p4-rename.sh
index 00df6ebd3b..2a9838f37f 100755
--- a/t/t9814-git-p4-rename.sh
+++ b/t/t9814-git-p4-rename.sh
@@ -2,7 +2,6 @@
test_description='git p4 rename'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9815-git-p4-submit-fail.sh b/t/t9815-git-p4-submit-fail.sh
index 92ef9d8c24..c766fd159f 100755
--- a/t/t9815-git-p4-submit-fail.sh
+++ b/t/t9815-git-p4-submit-fail.sh
@@ -2,7 +2,6 @@
test_description='git p4 submit failure handling'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9816-git-p4-locked.sh b/t/t9816-git-p4-locked.sh
index e687fbc25f..5e904ac80d 100755
--- a/t/t9816-git-p4-locked.sh
+++ b/t/t9816-git-p4-locked.sh
@@ -2,7 +2,6 @@
test_description='git p4 locked file behavior'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9817-git-p4-exclude.sh b/t/t9817-git-p4-exclude.sh
index 3deb334fed..ec3d937c6a 100755
--- a/t/t9817-git-p4-exclude.sh
+++ b/t/t9817-git-p4-exclude.sh
@@ -2,7 +2,6 @@
test_description='git p4 tests for excluded paths during clone and sync'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9818-git-p4-block.sh b/t/t9818-git-p4-block.sh
index 091bb72bdb..de591d875c 100755
--- a/t/t9818-git-p4-block.sh
+++ b/t/t9818-git-p4-block.sh
@@ -2,7 +2,6 @@
test_description='git p4 fetching changes in multiple blocks'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9819-git-p4-case-folding.sh b/t/t9819-git-p4-case-folding.sh
index 985be20357..b4d93f0c17 100755
--- a/t/t9819-git-p4-case-folding.sh
+++ b/t/t9819-git-p4-case-folding.sh
@@ -2,7 +2,6 @@
test_description='interaction with P4 case-folding'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
if test_have_prereq CASE_INSENSITIVE_FS
diff --git a/t/t9820-git-p4-editor-handling.sh b/t/t9820-git-p4-editor-handling.sh
index 48e4dfb95c..fa1bba1dd9 100755
--- a/t/t9820-git-p4-editor-handling.sh
+++ b/t/t9820-git-p4-editor-handling.sh
@@ -2,7 +2,6 @@
test_description='git p4 handling of EDITOR'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9821-git-p4-path-variations.sh b/t/t9821-git-p4-path-variations.sh
index 49691c53da..ef80f1690b 100755
--- a/t/t9821-git-p4-path-variations.sh
+++ b/t/t9821-git-p4-path-variations.sh
@@ -2,7 +2,6 @@
test_description='Clone repositories with path case variations'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d with case folding enabled' '
diff --git a/t/t9822-git-p4-path-encoding.sh b/t/t9822-git-p4-path-encoding.sh
index e62ed49f51..572d395498 100755
--- a/t/t9822-git-p4-path-encoding.sh
+++ b/t/t9822-git-p4-path-encoding.sh
@@ -2,7 +2,6 @@
test_description='Clone repositories with non ASCII paths'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
UTF8_ESCAPED="a-\303\244_o-\303\266_u-\303\274.txt"
diff --git a/t/t9823-git-p4-mock-lfs.sh b/t/t9823-git-p4-mock-lfs.sh
index 98a40d8af3..88b76dc4d6 100755
--- a/t/t9823-git-p4-mock-lfs.sh
+++ b/t/t9823-git-p4-mock-lfs.sh
@@ -2,7 +2,6 @@
test_description='Clone repositories and store files in Mock LFS'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_file_is_not_in_mock_lfs () {
diff --git a/t/t9825-git-p4-handle-utf16-without-bom.sh b/t/t9825-git-p4-handle-utf16-without-bom.sh
index d0b86537dd..6a60b32349 100755
--- a/t/t9825-git-p4-handle-utf16-without-bom.sh
+++ b/t/t9825-git-p4-handle-utf16-without-bom.sh
@@ -2,7 +2,6 @@
test_description='git p4 handling of UTF-16 files without BOM'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
UTF16="\227\000\227\000"
diff --git a/t/t9826-git-p4-keep-empty-commits.sh b/t/t9826-git-p4-keep-empty-commits.sh
index 54083f842e..fd64afe064 100755
--- a/t/t9826-git-p4-keep-empty-commits.sh
+++ b/t/t9826-git-p4-keep-empty-commits.sh
@@ -2,7 +2,6 @@
test_description='Clone repositories and keep empty commits'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9827-git-p4-change-filetype.sh b/t/t9827-git-p4-change-filetype.sh
index 3476ea2fd3..d3670bd7a2 100755
--- a/t/t9827-git-p4-change-filetype.sh
+++ b/t/t9827-git-p4-change-filetype.sh
@@ -2,7 +2,6 @@
test_description='git p4 support for file type change'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9828-git-p4-map-user.sh b/t/t9828-git-p4-map-user.sh
index 7c8f9e3930..ca6c2942bd 100755
--- a/t/t9828-git-p4-map-user.sh
+++ b/t/t9828-git-p4-map-user.sh
@@ -2,7 +2,6 @@
test_description='Clone repositories and map users'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9829-git-p4-jobs.sh b/t/t9829-git-p4-jobs.sh
index 3fc0948d9c..88cfb1fcd3 100755
--- a/t/t9829-git-p4-jobs.sh
+++ b/t/t9829-git-p4-jobs.sh
@@ -2,7 +2,6 @@
test_description='git p4 retrieve job info'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9830-git-p4-symlink-dir.sh b/t/t9830-git-p4-symlink-dir.sh
index 02561a7f0e..3fb6960c18 100755
--- a/t/t9830-git-p4-symlink-dir.sh
+++ b/t/t9830-git-p4-symlink-dir.sh
@@ -2,7 +2,6 @@
test_description='git p4 symlinked directories'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9831-git-p4-triggers.sh b/t/t9831-git-p4-triggers.sh
index f287f41e37..ff6c0352e6 100755
--- a/t/t9831-git-p4-triggers.sh
+++ b/t/t9831-git-p4-triggers.sh
@@ -2,7 +2,6 @@
test_description='git p4 with server triggers'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9832-unshelve.sh b/t/t9832-unshelve.sh
index a266775408..6b3cb0414a 100755
--- a/t/t9832-unshelve.sh
+++ b/t/t9832-unshelve.sh
@@ -6,7 +6,6 @@ last_shelved_change () {
test_description='git p4 unshelve'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9833-errors.sh b/t/t9833-errors.sh
index da1d30c142..e22369ccdf 100755
--- a/t/t9833-errors.sh
+++ b/t/t9833-errors.sh
@@ -2,7 +2,6 @@
test_description='git p4 errors'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9834-git-p4-file-dir-bug.sh b/t/t9834-git-p4-file-dir-bug.sh
index 565870fc74..dac67e89d7 100755
--- a/t/t9834-git-p4-file-dir-bug.sh
+++ b/t/t9834-git-p4-file-dir-bug.sh
@@ -6,7 +6,6 @@ This test creates files and directories with the same name in perforce and
checks that git-p4 recovers from the error at the same time as the perforce
repository.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
diff --git a/t/t9835-git-p4-metadata-encoding-python2.sh b/t/t9835-git-p4-metadata-encoding-python2.sh
index ad20ffdede..036bf79c66 100755
--- a/t/t9835-git-p4-metadata-encoding-python2.sh
+++ b/t/t9835-git-p4-metadata-encoding-python2.sh
@@ -6,7 +6,6 @@ This test checks that the import process handles inconsistent text
encoding in p4 metadata (author names, commit messages, etc) without
failing, and produces maximally sane output in git.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
python_target_version='2'
diff --git a/t/t9836-git-p4-metadata-encoding-python3.sh b/t/t9836-git-p4-metadata-encoding-python3.sh
index 71ae763399..63350dc4b5 100755
--- a/t/t9836-git-p4-metadata-encoding-python3.sh
+++ b/t/t9836-git-p4-metadata-encoding-python3.sh
@@ -6,7 +6,6 @@ This test checks that the import process handles inconsistent text
encoding in p4 metadata (author names, commit messages, etc) without
failing, and produces maximally sane output in git.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-git-p4.sh
python_target_version='3'
diff --git a/t/t9850-shell.sh b/t/t9850-shell.sh
index f503f16d1b..36566ace21 100755
--- a/t/t9850-shell.sh
+++ b/t/t9850-shell.sh
@@ -2,7 +2,6 @@
test_description='git shell tests'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'shell allows upload-pack' '
diff --git a/t/t9901-git-web--browse.sh b/t/t9901-git-web--browse.sh
index 19f56e5680..de7152f827 100755
--- a/t/t9901-git-web--browse.sh
+++ b/t/t9901-git-web--browse.sh
@@ -5,7 +5,6 @@ test_description='git web--browse basic tests
This test checks that git web--browse can handle various valid URLs.'
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_web_browse () {
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index cc6aa9f0cd..51bd750837 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -16,7 +16,6 @@ test_untraceable=UnfortunatelyYes
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-bash.sh
complete ()
@@ -658,6 +657,7 @@ test_expect_success '__git_refs - simple' '
HEAD
main
matching-branch
+ other/HEAD
other/branch-in-other
other/main-in-other
matching-tag
@@ -673,6 +673,7 @@ test_expect_success '__git_refs - full refs' '
cat >expected <<-EOF &&
refs/heads/main
refs/heads/matching-branch
+ refs/remotes/other/HEAD
refs/remotes/other/branch-in-other
refs/remotes/other/main-in-other
refs/tags/matching-tag
@@ -729,6 +730,7 @@ test_expect_success '__git_refs - remote on local file system - full refs' '
test_expect_success '__git_refs - configured remote' '
cat >expected <<-EOF &&
HEAD
+ HEAD
branch-in-other
main-in-other
EOF
@@ -756,6 +758,7 @@ test_expect_success '__git_refs - configured remote - full refs' '
test_expect_success '__git_refs - configured remote - repo given on the command line' '
cat >expected <<-EOF &&
HEAD
+ HEAD
branch-in-other
main-in-other
EOF
@@ -787,6 +790,7 @@ test_expect_success '__git_refs - configured remote - full refs - repo given on
test_expect_success '__git_refs - configured remote - remote name matches a directory' '
cat >expected <<-EOF &&
HEAD
+ HEAD
branch-in-other
main-in-other
EOF
@@ -875,12 +879,14 @@ test_expect_success '__git_refs - unique remote branches for git checkout DWIMer
HEAD
main
matching-branch
+ other/HEAD
other/ambiguous
other/branch-in-other
other/main-in-other
remote/ambiguous
remote/branch-in-remote
matching-tag
+ HEAD
branch-in-other
branch-in-remote
main-in-other
@@ -904,6 +910,7 @@ test_expect_success '__git_refs - after --opt=' '
HEAD
main
matching-branch
+ other/HEAD
other/branch-in-other
other/main-in-other
matching-tag
@@ -919,6 +926,7 @@ test_expect_success '__git_refs - after --opt= - full refs' '
cat >expected <<-EOF &&
refs/heads/main
refs/heads/matching-branch
+ refs/remotes/other/HEAD
refs/remotes/other/branch-in-other
refs/remotes/other/main-in-other
refs/tags/matching-tag
@@ -935,6 +943,7 @@ test_expect_success '__git refs - excluding refs' '
^HEAD
^main
^matching-branch
+ ^other/HEAD
^other/branch-in-other
^other/main-in-other
^matching-tag
@@ -950,6 +959,7 @@ test_expect_success '__git refs - excluding full refs' '
cat >expected <<-EOF &&
^refs/heads/main
^refs/heads/matching-branch
+ ^refs/remotes/other/HEAD
^refs/remotes/other/branch-in-other
^refs/remotes/other/main-in-other
^refs/tags/matching-tag
@@ -975,6 +985,7 @@ test_expect_success '__git_refs - do not filter refs unless told so' '
main
matching-branch
matching/branch
+ other/HEAD
other/branch-in-other
other/main-in-other
other/matching/branch-in-other
@@ -1095,6 +1106,7 @@ test_expect_success '__git_complete_refs - simple' '
HEAD Z
main Z
matching-branch Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
matching-tag Z
@@ -1123,6 +1135,7 @@ test_expect_success '__git_complete_refs - matching' '
test_expect_success '__git_complete_refs - remote' '
sed -e "s/Z$//" >expected <<-EOF &&
HEAD Z
+ HEAD Z
branch-in-other Z
main-in-other Z
EOF
@@ -1139,9 +1152,11 @@ test_expect_success '__git_complete_refs - track' '
HEAD Z
main Z
matching-branch Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
matching-tag Z
+ HEAD Z
branch-in-other Z
main-in-other Z
EOF
@@ -1184,6 +1199,7 @@ test_expect_success '__git_complete_refs - suffix' '
HEAD.
main.
matching-branch.
+ other/HEAD.
other/branch-in-other.
other/main-in-other.
matching-tag.
@@ -1199,6 +1215,7 @@ test_expect_success '__git_complete_refs - suffix' '
test_expect_success '__git_complete_fetch_refspecs - simple' '
sed -e "s/Z$//" >expected <<-EOF &&
HEAD:HEAD Z
+ HEAD:HEAD Z
branch-in-other:branch-in-other Z
main-in-other:main-in-other Z
EOF
@@ -1225,6 +1242,7 @@ test_expect_success '__git_complete_fetch_refspecs - matching' '
test_expect_success '__git_complete_fetch_refspecs - prefix' '
sed -e "s/Z$//" >expected <<-EOF &&
+HEAD:HEAD Z
+ +HEAD:HEAD Z
+branch-in-other:branch-in-other Z
+main-in-other:main-in-other Z
EOF
@@ -1289,6 +1307,7 @@ test_expect_success '__git_complete_worktree_paths with -C' '
test_expect_success 'git switch - with no options, complete local branches and unique remote branch names for DWIM logic' '
test_completion "git switch " <<-\EOF
+ HEAD Z
branch-in-other Z
main Z
main-in-other Z
@@ -1435,11 +1454,13 @@ test_expect_success 'git-bisect - existing view subcommand is recognized and ena
test_expect_success 'git checkout - completes refs and unique remote branches for DWIM' '
test_completion "git checkout " <<-\EOF
HEAD Z
+ HEAD Z
branch-in-other Z
main Z
main-in-other Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1461,6 +1482,7 @@ test_expect_success 'git switch - with GIT_COMPLETION_CHECKOUT_NO_GUESS=1, compl
test_expect_success 'git switch - --guess overrides GIT_COMPLETION_CHECKOUT_NO_GUESS=1, complete local branches and unique remote names for DWIM logic' '
GIT_COMPLETION_CHECKOUT_NO_GUESS=1 test_completion "git switch --guess " <<-\EOF
+ HEAD Z
branch-in-other Z
main Z
main-in-other Z
@@ -1470,6 +1492,7 @@ test_expect_success 'git switch - --guess overrides GIT_COMPLETION_CHECKOUT_NO_G
test_expect_success 'git switch - a later --guess overrides previous --no-guess, complete local and remote unique branches for DWIM' '
test_completion "git switch --no-guess --guess " <<-\EOF
+ HEAD Z
branch-in-other Z
main Z
main-in-other Z
@@ -1490,6 +1513,7 @@ test_expect_success 'git checkout - with GIT_COMPLETION_NO_GUESS=1 only complete
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1498,11 +1522,13 @@ test_expect_success 'git checkout - with GIT_COMPLETION_NO_GUESS=1 only complete
test_expect_success 'git checkout - --guess overrides GIT_COMPLETION_NO_GUESS=1, complete refs and unique remote branches for DWIM' '
GIT_COMPLETION_CHECKOUT_NO_GUESS=1 test_completion "git checkout --guess " <<-\EOF
HEAD Z
+ HEAD Z
branch-in-other Z
main Z
main-in-other Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1514,6 +1540,7 @@ test_expect_success 'git checkout - with --no-guess, only completes refs' '
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1522,11 +1549,13 @@ test_expect_success 'git checkout - with --no-guess, only completes refs' '
test_expect_success 'git checkout - a later --guess overrides previous --no-guess, complete refs and unique remote branches for DWIM' '
test_completion "git checkout --no-guess --guess " <<-\EOF
HEAD Z
+ HEAD Z
branch-in-other Z
main Z
main-in-other Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1538,6 +1567,7 @@ test_expect_success 'git checkout - a later --no-guess overrides previous --gues
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1550,6 +1580,7 @@ test_expect_success 'git checkout - with checkout.guess = false, only completes
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1559,11 +1590,13 @@ test_expect_success 'git checkout - with checkout.guess = true, completes refs a
test_config checkout.guess true &&
test_completion "git checkout " <<-\EOF
HEAD Z
+ HEAD Z
branch-in-other Z
main Z
main-in-other Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1573,11 +1606,13 @@ test_expect_success 'git checkout - a later --guess overrides previous checkout.
test_config checkout.guess false &&
test_completion "git checkout --guess " <<-\EOF
HEAD Z
+ HEAD Z
branch-in-other Z
main Z
main-in-other Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1590,6 +1625,7 @@ test_expect_success 'git checkout - a later --no-guess overrides previous checko
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1601,6 +1637,7 @@ test_expect_success 'git switch - with --detach, complete all references' '
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1612,6 +1649,7 @@ test_expect_success 'git checkout - with --detach, complete only references' '
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1783,6 +1821,7 @@ test_expect_success 'git switch - with -d, complete all references' '
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1794,6 +1833,7 @@ test_expect_success 'git checkout - with -d, complete only references' '
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1801,10 +1841,12 @@ 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 &&
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
test_completion "git switch -t " <<-\EOF
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1812,10 +1854,12 @@ test_expect_success 'git switch - with --track, complete only remote branches' '
test_expect_success 'git checkout - with --track, complete only remote branches' '
test_completion "git checkout --track " <<-\EOF &&
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
test_completion "git checkout -t " <<-\EOF
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1834,6 +1878,7 @@ test_expect_success 'git checkout - with --no-track, complete only local referen
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1845,6 +1890,7 @@ test_expect_success 'git switch - with -c, complete all references' '
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1856,6 +1902,7 @@ test_expect_success 'git switch - with -C, complete all references' '
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1867,6 +1914,7 @@ test_expect_success 'git switch - with -c and --track, complete all references'
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1878,6 +1926,7 @@ test_expect_success 'git switch - with -C and --track, complete all references'
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1889,6 +1938,7 @@ test_expect_success 'git switch - with -c and --no-track, complete all reference
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1900,6 +1950,7 @@ test_expect_success 'git switch - with -C and --no-track, complete all reference
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1911,6 +1962,7 @@ test_expect_success 'git checkout - with -b, complete all references' '
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1922,6 +1974,7 @@ test_expect_success 'git checkout - with -B, complete all references' '
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1933,6 +1986,7 @@ test_expect_success 'git checkout - with -b and --track, complete all references
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1944,6 +1998,7 @@ test_expect_success 'git checkout - with -B and --track, complete all references
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1955,6 +2010,7 @@ test_expect_success 'git checkout - with -b and --no-track, complete all referen
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1966,6 +2022,7 @@ test_expect_success 'git checkout - with -B and --no-track, complete all referen
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
@@ -1973,6 +2030,7 @@ test_expect_success 'git checkout - with -B and --no-track, complete all referen
test_expect_success 'git switch - for -c, complete local branches and unique remote branches' '
test_completion "git switch -c " <<-\EOF
+ HEAD Z
branch-in-other Z
main Z
main-in-other Z
@@ -1982,6 +2040,7 @@ test_expect_success 'git switch - for -c, complete local branches and unique rem
test_expect_success 'git switch - for -C, complete local branches and unique remote branches' '
test_completion "git switch -C " <<-\EOF
+ HEAD Z
branch-in-other Z
main Z
main-in-other Z
@@ -2019,6 +2078,7 @@ test_expect_success 'git switch - for -C with --no-track, complete local branche
test_expect_success 'git checkout - for -b, complete local branches and unique remote branches' '
test_completion "git checkout -b " <<-\EOF
+ HEAD Z
branch-in-other Z
main Z
main-in-other Z
@@ -2028,6 +2088,7 @@ test_expect_success 'git checkout - for -b, complete local branches and unique r
test_expect_success 'git checkout - for -B, complete local branches and unique remote branches' '
test_completion "git checkout -B " <<-\EOF
+ HEAD Z
branch-in-other Z
main Z
main-in-other Z
@@ -2065,6 +2126,7 @@ test_expect_success 'git checkout - for -B with --no-track, complete local branc
test_expect_success 'git switch - with --orphan completes local branch names and unique remote branch names' '
test_completion "git switch --orphan " <<-\EOF
+ HEAD Z
branch-in-other Z
main Z
main-in-other Z
@@ -2080,6 +2142,7 @@ test_expect_success 'git switch - --orphan with branch already provided complete
test_expect_success 'git checkout - with --orphan completes local branch names and unique remote branch names' '
test_completion "git checkout --orphan " <<-\EOF
+ HEAD Z
branch-in-other Z
main Z
main-in-other Z
@@ -2093,6 +2156,7 @@ test_expect_success 'git checkout - --orphan with branch already provided comple
main Z
matching-branch Z
matching-tag Z
+ other/HEAD Z
other/branch-in-other Z
other/main-in-other Z
EOF
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 95e9955bca..d667dda654 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -8,7 +8,6 @@ test_description='test git-specific bash prompt functions'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./lib-bash.sh
. "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh"
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 6c60e8adae..62dfcc4aaf 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -35,13 +35,7 @@ else
# needing to exist.
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
-if test -z "$TEST_OUTPUT_DIRECTORY"
-then
- # Similarly, override this to store the test-results subdir
- # elsewhere
- TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
-fi
-GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
+GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}"
if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
then
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
@@ -92,6 +86,15 @@ export LSAN_OPTIONS
prepend_var UBSAN_OPTIONS : $GIT_SAN_OPTIONS
export UBSAN_OPTIONS
+# The TEST_OUTPUT_DIRECTORY will be overwritten via GIT-BUILD-OPTIONS. So in
+# case the caller has manually set up this variable via the environment we must
+# make sure to not overwrite that value, and thus we save it into
+# TEST_OUTPUT_DIRECTORY_OVERRIDE here.
+if test -n "$TEST_OUTPUT_DIRECTORY" && test -z "$TEST_OUTPUT_DIRECTORY_OVERRIDE"
+then
+ TEST_OUTPUT_DIRECTORY_OVERRIDE=$TEST_OUTPUT_DIRECTORY
+fi
+
if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
then
echo >&2 'error: GIT-BUILD-OPTIONS missing (has Git been built?).'
@@ -100,6 +103,13 @@ fi
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
export PERL_PATH SHELL_PATH
+if test -z "$TEST_OUTPUT_DIRECTORY"
+then
+ # Similarly, override this to store the test-results subdir
+ # elsewhere
+ TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
+fi
+
# In t0000, we need to override test directories of nested testcases. In case
# the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd
# reset this value to instead contain what the developer has specified. We thus
@@ -512,6 +522,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
PERF_
CURL_VERBOSE
TRACE_CURL
+ BUILD_DIR
));
my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
print join("\n", @vars);
@@ -1180,23 +1191,7 @@ check_test_results_san_file_ () {
fi &&
say_color error "$(cat "$TEST_RESULTS_SAN_FILE".*)" &&
- if test -n "$passes_sanitize_leak" && test "$test_failure" = 0
- then
- say "As TEST_PASSES_SANITIZE_LEAK=true and our logs show we're leaking, exit non-zero!" &&
- invert_exit_code=t
- elif test -n "$passes_sanitize_leak"
- then
- say "As TEST_PASSES_SANITIZE_LEAK=true and our logs show we're leaking, and we're failing for other reasons too..." &&
- invert_exit_code=
- elif test -n "$sanitize_leak_check" && test "$test_failure" = 0
- then
- say "As TEST_PASSES_SANITIZE_LEAK=true isn't set the above leak is 'ok' with GIT_TEST_PASSING_SANITIZE_LEAK=check" &&
- invert_exit_code=
- elif test -n "$sanitize_leak_check"
- then
- say "As TEST_PASSES_SANITIZE_LEAK=true isn't set the above leak is 'ok' with GIT_TEST_PASSING_SANITIZE_LEAK=check" &&
- invert_exit_code=t
- elif test "$test_failure" = 0
+ if test "$test_failure" = 0
then
say "Our logs revealed a memory leak, exit non-zero!" &&
invert_exit_code=t
@@ -1227,11 +1222,6 @@ 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)"
@@ -1430,7 +1420,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH"
fi
fi
-GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt
+GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR"
GIT_CONFIG_NOSYSTEM=1
GIT_ATTR_NOSYSTEM=1
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
@@ -1496,9 +1486,9 @@ then
fi
fi
-GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib
+GITPERLLIB="$GIT_TEST_GITPERLLIB"
export GITPERLLIB
-test -d "$GIT_BUILD_DIR"/templates/blt || {
+test -d "$GIT_TEMPLATE_DIR" || {
BAIL_OUT "You haven't built things yet, have you?"
}
@@ -1518,51 +1508,8 @@ then
test_done
fi
-BAIL_OUT_ENV_NEEDS_SANITIZE_LEAK () {
- BAIL_OUT "$1 has no effect except when compiled with SANITIZE=leak"
-}
-
if test -n "$SANITIZE_LEAK"
then
- # Normalize with test_bool_env
- passes_sanitize_leak=
-
- # We need to see TEST_PASSES_SANITIZE_LEAK in "test-tool
- # env-helper" (via test_bool_env)
- export TEST_PASSES_SANITIZE_LEAK
- if test_bool_env TEST_PASSES_SANITIZE_LEAK false
- then
- passes_sanitize_leak=t
- fi
-
- if test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check" ||
- test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check-failing"
- then
- if test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check-failing" &&
- test -n "$passes_sanitize_leak"
- then
- skip_all="skipping leak-free $this_test under GIT_TEST_PASSING_SANITIZE_LEAK=check-failing"
- test_done
- fi
-
- sanitize_leak_check=t
- if test -n "$invert_exit_code"
- then
- BAIL_OUT "cannot use --invert-exit-code under GIT_TEST_PASSING_SANITIZE_LEAK=check"
- fi
-
- if test -z "$passes_sanitize_leak"
- then
- say "in GIT_TEST_PASSING_SANITIZE_LEAK=check mode, setting --invert-exit-code for TEST_PASSES_SANITIZE_LEAK != true"
- invert_exit_code=t
- fi
- elif test -z "$passes_sanitize_leak" &&
- test_bool_env GIT_TEST_PASSING_SANITIZE_LEAK false
- then
- skip_all="skipping $this_test under GIT_TEST_PASSING_SANITIZE_LEAK=true"
- test_done
- fi
-
rm -rf "$TEST_RESULTS_SAN_DIR"
if ! mkdir -p "$TEST_RESULTS_SAN_DIR"
then
@@ -1577,12 +1524,6 @@ then
prepend_var LSAN_OPTIONS : log_exe_name=1
prepend_var LSAN_OPTIONS : log_path="'$TEST_RESULTS_SAN_FILE'"
export LSAN_OPTIONS
-
-elif test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check" ||
- test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check-failing" ||
- test_bool_env GIT_TEST_PASSING_SANITIZE_LEAK false
-then
- BAIL_OUT_ENV_NEEDS_SANITIZE_LEAK "GIT_TEST_PASSING_SANITIZE_LEAK=true"
fi
if test "${GIT_TEST_CHAIN_LINT:-1}" != 0 &&
diff --git a/t/test-terminal.perl b/t/test-terminal.perl
index b8fd6a4f13..862bb8f395 100755
--- a/t/test-terminal.perl
+++ b/t/test-terminal.perl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-use 5.008001;
+require v5.26;
use strict;
use warnings;
use IO::Pty;
diff --git a/t/unit-tests/lib-reftable.c b/t/unit-tests/lib-reftable.c
index 2ddf480588..d795dfb7c9 100644
--- a/t/unit-tests/lib-reftable.c
+++ b/t/unit-tests/lib-reftable.c
@@ -2,8 +2,9 @@
#include "test-lib.h"
#include "reftable/constants.h"
#include "reftable/writer.h"
+#include "strbuf.h"
-void t_reftable_set_hash(uint8_t *p, int i, uint32_t id)
+void t_reftable_set_hash(uint8_t *p, int i, enum reftable_hash id)
{
memset(p, (uint8_t)i, hash_size(id));
}
@@ -82,7 +83,7 @@ void t_reftable_write_to_buf(struct reftable_buf *buf,
size_t off = i * (opts.block_size ? opts.block_size
: DEFAULT_BLOCK_SIZE);
if (!off)
- off = header_size(opts.hash_id == GIT_SHA256_FORMAT_ID ? 2 : 1);
+ off = header_size(opts.hash_id == REFTABLE_HASH_SHA256 ? 2 : 1);
check_char(buf->buf[off], ==, 'r');
}
diff --git a/t/unit-tests/lib-reftable.h b/t/unit-tests/lib-reftable.h
index d4950fed3d..e4c360fa7e 100644
--- a/t/unit-tests/lib-reftable.h
+++ b/t/unit-tests/lib-reftable.h
@@ -6,7 +6,7 @@
struct reftable_buf;
-void t_reftable_set_hash(uint8_t *p, int i, uint32_t id);
+void t_reftable_set_hash(uint8_t *p, int i, enum reftable_hash id);
struct reftable_writer *t_reftable_strbuf_writer(struct reftable_buf *buf,
struct reftable_write_options *opts);
diff --git a/t/unit-tests/strvec.c b/t/unit-tests/strvec.c
index bf4c0cb172..e66b7bbfae 100644
--- a/t/unit-tests/strvec.c
+++ b/t/unit-tests/strvec.c
@@ -88,6 +88,81 @@ void test_strvec__pushv(void)
strvec_clear(&vec);
}
+void test_strvec__splice_just_initialized_strvec(void)
+{
+ struct strvec vec = STRVEC_INIT;
+ const char *replacement[] = { "foo" };
+
+ strvec_splice(&vec, 0, 0, replacement, ARRAY_SIZE(replacement));
+ check_strvec(&vec, "foo", NULL);
+ strvec_clear(&vec);
+}
+
+void test_strvec__splice_with_same_size_replacement(void)
+{
+ struct strvec vec = STRVEC_INIT;
+ const char *replacement[] = { "1" };
+
+ strvec_pushl(&vec, "foo", "bar", "baz", NULL);
+ strvec_splice(&vec, 1, 1, replacement, ARRAY_SIZE(replacement));
+ check_strvec(&vec, "foo", "1", "baz", NULL);
+ strvec_clear(&vec);
+}
+
+void test_strvec__splice_with_smaller_replacement(void)
+{
+ struct strvec vec = STRVEC_INIT;
+ const char *replacement[] = { "1" };
+
+ strvec_pushl(&vec, "foo", "bar", "baz", NULL);
+ strvec_splice(&vec, 1, 2, replacement, ARRAY_SIZE(replacement));
+ check_strvec(&vec, "foo", "1", NULL);
+ strvec_clear(&vec);
+}
+
+void test_strvec__splice_with_bigger_replacement(void)
+{
+ struct strvec vec = STRVEC_INIT;
+ const char *replacement[] = { "1", "2", "3" };
+
+ strvec_pushl(&vec, "foo", "bar", "baz", NULL);
+ strvec_splice(&vec, 0, 2, replacement, ARRAY_SIZE(replacement));
+ check_strvec(&vec, "1", "2", "3", "baz", NULL);
+ strvec_clear(&vec);
+}
+
+void test_strvec__splice_with_empty_replacement(void)
+{
+ struct strvec vec = STRVEC_INIT;
+
+ strvec_pushl(&vec, "foo", "bar", "baz", NULL);
+ strvec_splice(&vec, 0, 2, NULL, 0);
+ check_strvec(&vec, "baz", NULL);
+ strvec_clear(&vec);
+}
+
+void test_strvec__splice_with_empty_original(void)
+{
+ struct strvec vec = STRVEC_INIT;
+ const char *replacement[] = { "1", "2" };
+
+ strvec_pushl(&vec, "foo", "bar", "baz", NULL);
+ strvec_splice(&vec, 1, 0, replacement, ARRAY_SIZE(replacement));
+ check_strvec(&vec, "foo", "1", "2", "bar", "baz", NULL);
+ strvec_clear(&vec);
+}
+
+void test_strvec__splice_at_tail(void)
+{
+ struct strvec vec = STRVEC_INIT;
+ const char *replacement[] = { "1", "2" };
+
+ strvec_pushl(&vec, "foo", "bar", NULL);
+ strvec_splice(&vec, 2, 0, replacement, ARRAY_SIZE(replacement));
+ check_strvec(&vec, "foo", "bar", "1", "2", NULL);
+ strvec_clear(&vec);
+}
+
void test_strvec__replace_at_head(void)
{
struct strvec vec = STRVEC_INIT;
diff --git a/t/unit-tests/t-reftable-block.c b/t/unit-tests/t-reftable-block.c
index f9af907117..22040aeefa 100644
--- a/t/unit-tests/t-reftable-block.c
+++ b/t/unit-tests/t-reftable-block.c
@@ -11,6 +11,7 @@ https://developers.google.com/open-source/licenses/bsd
#include "reftable/blocksource.h"
#include "reftable/constants.h"
#include "reftable/reftable-error.h"
+#include "strbuf.h"
static void t_ref_block_read_write(void)
{
@@ -36,7 +37,7 @@ static void t_ref_block_read_write(void)
block.len = block_size;
block_source_from_buf(&block.source ,&buf);
ret = block_writer_init(&bw, BLOCK_TYPE_REF, block.data, block_size,
- header_off, hash_size(GIT_SHA1_FORMAT_ID));
+ header_off, hash_size(REFTABLE_HASH_SHA1));
check(!ret);
rec.u.ref.refname = (char *) "";
@@ -47,7 +48,7 @@ static void t_ref_block_read_write(void)
for (i = 0; i < N; i++) {
rec.u.ref.refname = xstrfmt("branch%02"PRIuMAX, (uintmax_t)i);
rec.u.ref.value_type = REFTABLE_REF_VAL1;
- memset(rec.u.ref.value.val1, i, GIT_SHA1_RAWSZ);
+ memset(rec.u.ref.value.val1, i, REFTABLE_HASH_SIZE_SHA1);
recs[i] = rec;
ret = block_writer_add(&bw, &rec);
@@ -61,7 +62,7 @@ static void t_ref_block_read_write(void)
block_writer_release(&bw);
- block_reader_init(&br, &block, header_off, block_size, GIT_SHA1_RAWSZ);
+ block_reader_init(&br, &block, header_off, block_size, REFTABLE_HASH_SIZE_SHA1);
block_iter_seek_start(&it, &br);
@@ -72,7 +73,7 @@ static void t_ref_block_read_write(void)
check_int(i, ==, N);
break;
}
- check(reftable_record_equal(&recs[i], &rec, GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&recs[i], &rec, REFTABLE_HASH_SIZE_SHA1));
}
for (i = 0; i < N; i++) {
@@ -85,7 +86,7 @@ static void t_ref_block_read_write(void)
ret = block_iter_next(&it, &rec);
check_int(ret, ==, 0);
- check(reftable_record_equal(&recs[i], &rec, GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&recs[i], &rec, REFTABLE_HASH_SIZE_SHA1));
want.len--;
ret = block_iter_seek_key(&it, &br, &want);
@@ -93,7 +94,7 @@ static void t_ref_block_read_write(void)
ret = block_iter_next(&it, &rec);
check_int(ret, ==, 0);
- check(reftable_record_equal(&recs[10 * (i / 10)], &rec, GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&recs[10 * (i / 10)], &rec, REFTABLE_HASH_SIZE_SHA1));
}
block_reader_release(&br);
@@ -130,7 +131,7 @@ static void t_log_block_read_write(void)
block.len = block_size;
block_source_from_buf(&block.source ,&buf);
ret = block_writer_init(&bw, BLOCK_TYPE_LOG, block.data, block_size,
- header_off, hash_size(GIT_SHA1_FORMAT_ID));
+ header_off, hash_size(REFTABLE_HASH_SHA1));
check(!ret);
for (i = 0; i < N; i++) {
@@ -150,7 +151,7 @@ static void t_log_block_read_write(void)
block_writer_release(&bw);
- block_reader_init(&br, &block, header_off, block_size, GIT_SHA1_RAWSZ);
+ block_reader_init(&br, &block, header_off, block_size, REFTABLE_HASH_SIZE_SHA1);
block_iter_seek_start(&it, &br);
@@ -161,7 +162,7 @@ static void t_log_block_read_write(void)
check_int(i, ==, N);
break;
}
- check(reftable_record_equal(&recs[i], &rec, GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&recs[i], &rec, REFTABLE_HASH_SIZE_SHA1));
}
for (i = 0; i < N; i++) {
@@ -175,7 +176,7 @@ static void t_log_block_read_write(void)
ret = block_iter_next(&it, &rec);
check_int(ret, ==, 0);
- check(reftable_record_equal(&recs[i], &rec, GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&recs[i], &rec, REFTABLE_HASH_SIZE_SHA1));
want.len--;
ret = block_iter_seek_key(&it, &br, &want);
@@ -183,7 +184,7 @@ static void t_log_block_read_write(void)
ret = block_iter_next(&it, &rec);
check_int(ret, ==, 0);
- check(reftable_record_equal(&recs[10 * (i / 10)], &rec, GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&recs[10 * (i / 10)], &rec, REFTABLE_HASH_SIZE_SHA1));
}
block_reader_release(&br);
@@ -220,7 +221,7 @@ static void t_obj_block_read_write(void)
block.len = block_size;
block_source_from_buf(&block.source, &buf);
ret = block_writer_init(&bw, BLOCK_TYPE_OBJ, block.data, block_size,
- header_off, hash_size(GIT_SHA1_FORMAT_ID));
+ header_off, hash_size(REFTABLE_HASH_SHA1));
check(!ret);
for (i = 0; i < N; i++) {
@@ -242,7 +243,7 @@ static void t_obj_block_read_write(void)
block_writer_release(&bw);
- block_reader_init(&br, &block, header_off, block_size, GIT_SHA1_RAWSZ);
+ block_reader_init(&br, &block, header_off, block_size, REFTABLE_HASH_SIZE_SHA1);
block_iter_seek_start(&it, &br);
@@ -253,7 +254,7 @@ static void t_obj_block_read_write(void)
check_int(i, ==, N);
break;
}
- check(reftable_record_equal(&recs[i], &rec, GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&recs[i], &rec, REFTABLE_HASH_SIZE_SHA1));
}
for (i = 0; i < N; i++) {
@@ -266,7 +267,7 @@ static void t_obj_block_read_write(void)
ret = block_iter_next(&it, &rec);
check_int(ret, ==, 0);
- check(reftable_record_equal(&recs[i], &rec, GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&recs[i], &rec, REFTABLE_HASH_SIZE_SHA1));
}
block_reader_release(&br);
@@ -304,7 +305,7 @@ static void t_index_block_read_write(void)
block.len = block_size;
block_source_from_buf(&block.source, &buf);
ret = block_writer_init(&bw, BLOCK_TYPE_INDEX, block.data, block_size,
- header_off, hash_size(GIT_SHA1_FORMAT_ID));
+ header_off, hash_size(REFTABLE_HASH_SHA1));
check(!ret);
for (i = 0; i < N; i++) {
@@ -326,7 +327,7 @@ static void t_index_block_read_write(void)
block_writer_release(&bw);
- block_reader_init(&br, &block, header_off, block_size, GIT_SHA1_RAWSZ);
+ block_reader_init(&br, &block, header_off, block_size, REFTABLE_HASH_SIZE_SHA1);
block_iter_seek_start(&it, &br);
@@ -337,7 +338,7 @@ static void t_index_block_read_write(void)
check_int(i, ==, N);
break;
}
- check(reftable_record_equal(&recs[i], &rec, GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&recs[i], &rec, REFTABLE_HASH_SIZE_SHA1));
}
for (i = 0; i < N; i++) {
@@ -350,7 +351,7 @@ static void t_index_block_read_write(void)
ret = block_iter_next(&it, &rec);
check_int(ret, ==, 0);
- check(reftable_record_equal(&recs[i], &rec, GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&recs[i], &rec, REFTABLE_HASH_SIZE_SHA1));
want.len--;
ret = block_iter_seek_key(&it, &br, &want);
@@ -358,7 +359,7 @@ static void t_index_block_read_write(void)
ret = block_iter_next(&it, &rec);
check_int(ret, ==, 0);
- check(reftable_record_equal(&recs[10 * (i / 10)], &rec, GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&recs[10 * (i / 10)], &rec, REFTABLE_HASH_SIZE_SHA1));
}
block_reader_release(&br);
diff --git a/t/unit-tests/t-reftable-merged.c b/t/unit-tests/t-reftable-merged.c
index 4c25ee5334..a12bd0e1a3 100644
--- a/t/unit-tests/t-reftable-merged.c
+++ b/t/unit-tests/t-reftable-merged.c
@@ -42,7 +42,7 @@ merged_table_from_records(struct reftable_ref_record **refs,
check(!err);
}
- err = reftable_merged_table_new(&mt, *readers, n, GIT_SHA1_FORMAT_ID);
+ err = reftable_merged_table_new(&mt, *readers, n, REFTABLE_HASH_SHA1);
check(!err);
return mt;
}
@@ -91,7 +91,7 @@ static void t_merged_single_record(void)
err = reftable_iterator_next_ref(&it, &ref);
check(!err);
- check(reftable_ref_record_equal(&r2[0], &ref, GIT_SHA1_RAWSZ));
+ check(reftable_ref_record_equal(&r2[0], &ref, REFTABLE_HASH_SIZE_SHA1));
reftable_ref_record_release(&ref);
reftable_iterator_destroy(&it);
readers_destroy(readers, 3);
@@ -168,7 +168,7 @@ static void t_merged_refs(void)
check(!err);
err = reftable_iterator_seek_ref(&it, "a");
check(!err);
- check_int(reftable_merged_table_hash_id(mt), ==, GIT_SHA1_FORMAT_ID);
+ check_int(reftable_merged_table_hash_id(mt), ==, REFTABLE_HASH_SHA1);
check_int(reftable_merged_table_min_update_index(mt), ==, 1);
check_int(reftable_merged_table_max_update_index(mt), ==, 3);
@@ -186,7 +186,7 @@ static void t_merged_refs(void)
check_int(ARRAY_SIZE(want), ==, len);
for (i = 0; i < len; i++)
check(reftable_ref_record_equal(want[i], &out[i],
- GIT_SHA1_RAWSZ));
+ REFTABLE_HASH_SIZE_SHA1));
for (i = 0; i < len; i++)
reftable_ref_record_release(&out[i]);
reftable_free(out);
@@ -252,12 +252,12 @@ static void t_merged_seek_multiple_times(void)
err = reftable_iterator_next_ref(&it, &rec);
check(!err);
- err = reftable_ref_record_equal(&rec, &r1[1], GIT_SHA1_RAWSZ);
+ err = reftable_ref_record_equal(&rec, &r1[1], REFTABLE_HASH_SIZE_SHA1);
check(err == 1);
err = reftable_iterator_next_ref(&it, &rec);
check(!err);
- err = reftable_ref_record_equal(&rec, &r2[1], GIT_SHA1_RAWSZ);
+ err = reftable_ref_record_equal(&rec, &r2[1], REFTABLE_HASH_SIZE_SHA1);
check(err == 1);
err = reftable_iterator_next_ref(&it, &rec);
@@ -273,6 +273,78 @@ static void t_merged_seek_multiple_times(void)
reftable_free(sources);
}
+static void t_merged_seek_multiple_times_without_draining(void)
+{
+ struct reftable_ref_record r1[] = {
+ {
+ .refname = (char *) "a",
+ .update_index = 1,
+ .value_type = REFTABLE_REF_VAL1,
+ .value.val1 = { 1 },
+ },
+ {
+ .refname = (char *) "c",
+ .update_index = 1,
+ .value_type = REFTABLE_REF_VAL1,
+ .value.val1 = { 2 },
+ }
+ };
+ struct reftable_ref_record r2[] = {
+ {
+ .refname = (char *) "b",
+ .update_index = 2,
+ .value_type = REFTABLE_REF_VAL1,
+ .value.val1 = { 3 },
+ },
+ {
+ .refname = (char *) "d",
+ .update_index = 2,
+ .value_type = REFTABLE_REF_VAL1,
+ .value.val1 = { 4 },
+ },
+ };
+ struct reftable_ref_record *refs[] = {
+ r1, r2,
+ };
+ size_t sizes[] = {
+ ARRAY_SIZE(r1), ARRAY_SIZE(r2),
+ };
+ struct reftable_buf bufs[] = {
+ REFTABLE_BUF_INIT, REFTABLE_BUF_INIT,
+ };
+ struct reftable_block_source *sources = NULL;
+ struct reftable_reader **readers = NULL;
+ struct reftable_ref_record rec = { 0 };
+ struct reftable_iterator it = { 0 };
+ struct reftable_merged_table *mt;
+ int err;
+
+ mt = merged_table_from_records(refs, &sources, &readers, sizes, bufs, 2);
+ merged_table_init_iter(mt, &it, BLOCK_TYPE_REF);
+
+ err = reftable_iterator_seek_ref(&it, "b");
+ check(!err);
+ err = reftable_iterator_next_ref(&it, &rec);
+ check(!err);
+ err = reftable_ref_record_equal(&rec, &r2[0], REFTABLE_HASH_SIZE_SHA1);
+ check(err == 1);
+
+ err = reftable_iterator_seek_ref(&it, "a");
+ check(!err);
+ err = reftable_iterator_next_ref(&it, &rec);
+ check(!err);
+ err = reftable_ref_record_equal(&rec, &r1[0], REFTABLE_HASH_SIZE_SHA1);
+ check(err == 1);
+
+ for (size_t i = 0; i < ARRAY_SIZE(bufs); i++)
+ reftable_buf_release(&bufs[i]);
+ readers_destroy(readers, ARRAY_SIZE(refs));
+ reftable_ref_record_release(&rec);
+ reftable_iterator_destroy(&it);
+ reftable_merged_table_free(mt);
+ reftable_free(sources);
+}
+
static struct reftable_merged_table *
merged_table_from_log_records(struct reftable_log_record **logs,
struct reftable_block_source **source,
@@ -300,7 +372,7 @@ merged_table_from_log_records(struct reftable_log_record **logs,
check(!err);
}
- err = reftable_merged_table_new(&mt, *readers, n, GIT_SHA1_FORMAT_ID);
+ err = reftable_merged_table_new(&mt, *readers, n, REFTABLE_HASH_SHA1);
check(!err);
return mt;
}
@@ -377,7 +449,7 @@ static void t_merged_logs(void)
check(!err);
err = reftable_iterator_seek_log(&it, "a");
check(!err);
- check_int(reftable_merged_table_hash_id(mt), ==, GIT_SHA1_FORMAT_ID);
+ check_int(reftable_merged_table_hash_id(mt), ==, REFTABLE_HASH_SHA1);
check_int(reftable_merged_table_min_update_index(mt), ==, 1);
check_int(reftable_merged_table_max_update_index(mt), ==, 3);
@@ -395,7 +467,7 @@ static void t_merged_logs(void)
check_int(ARRAY_SIZE(want), ==, len);
for (i = 0; i < len; i++)
check(reftable_log_record_equal(want[i], &out[i],
- GIT_SHA1_RAWSZ));
+ REFTABLE_HASH_SIZE_SHA1));
err = merged_table_init_iter(mt, &it, BLOCK_TYPE_LOG);
check(!err);
@@ -404,7 +476,7 @@ static void t_merged_logs(void)
reftable_log_record_release(&out[0]);
err = reftable_iterator_next_log(&it, &out[0]);
check(!err);
- check(reftable_log_record_equal(&out[0], &r3[0], GIT_SHA1_RAWSZ));
+ check(reftable_log_record_equal(&out[0], &r3[0], REFTABLE_HASH_SIZE_SHA1));
reftable_iterator_destroy(&it);
for (i = 0; i < len; i++)
@@ -448,11 +520,11 @@ static void t_default_write_opts(void)
check(!err);
hash_id = reftable_reader_hash_id(rd);
- check_int(hash_id, ==, GIT_SHA1_FORMAT_ID);
+ check_int(hash_id, ==, REFTABLE_HASH_SHA1);
- err = reftable_merged_table_new(&merged, &rd, 1, GIT_SHA256_FORMAT_ID);
+ err = reftable_merged_table_new(&merged, &rd, 1, REFTABLE_HASH_SHA256);
check_int(err, ==, REFTABLE_FORMAT_ERROR);
- err = reftable_merged_table_new(&merged, &rd, 1, GIT_SHA1_FORMAT_ID);
+ err = reftable_merged_table_new(&merged, &rd, 1, REFTABLE_HASH_SHA1);
check(!err);
reftable_reader_decref(rd);
@@ -467,6 +539,7 @@ int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
TEST(t_merged_logs(), "merged table with multiple log updates for same ref");
TEST(t_merged_refs(), "merged table with multiple updates to same ref");
TEST(t_merged_seek_multiple_times(), "merged table can seek multiple times");
+ TEST(t_merged_seek_multiple_times_without_draining(), "merged table can seek multiple times without draining");
TEST(t_merged_single_record(), "ref occurring in only one record can be fetched");
return test_done();
diff --git a/t/unit-tests/t-reftable-pq.c b/t/unit-tests/t-reftable-pq.c
index ada4c19f18..f3f8a0cdf3 100644
--- a/t/unit-tests/t-reftable-pq.c
+++ b/t/unit-tests/t-reftable-pq.c
@@ -9,6 +9,7 @@ https://developers.google.com/open-source/licenses/bsd
#include "test-lib.h"
#include "reftable/constants.h"
#include "reftable/pq.h"
+#include "strbuf.h"
static void merged_iter_pqueue_check(const struct merged_iter_pqueue *pq)
{
@@ -132,7 +133,7 @@ static void t_merged_iter_pqueue_top(void)
merged_iter_pqueue_check(&pq);
check(pq_entry_equal(&top, &e));
- check(reftable_record_equal(top.rec, &recs[i], GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(top.rec, &recs[i], REFTABLE_HASH_SIZE_SHA1));
for (size_t j = 0; i < pq.len; j++) {
check(pq_less(&top, &pq.heap[j]));
check_int(top.index, >, j);
diff --git a/t/unit-tests/t-reftable-reader.c b/t/unit-tests/t-reftable-reader.c
index 19cb53b641..546df6005e 100644
--- a/t/unit-tests/t-reftable-reader.c
+++ b/t/unit-tests/t-reftable-reader.c
@@ -31,7 +31,7 @@ static int t_reader_seek_once(void)
ret = reftable_iterator_next_ref(&it, &ref);
check(!ret);
- ret = reftable_ref_record_equal(&ref, &records[0], GIT_SHA1_RAWSZ);
+ ret = reftable_ref_record_equal(&ref, &records[0], REFTABLE_HASH_SIZE_SHA1);
check_int(ret, ==, 1);
ret = reftable_iterator_next_ref(&it, &ref);
@@ -74,7 +74,7 @@ static int t_reader_reseek(void)
ret = reftable_iterator_next_ref(&it, &ref);
check(!ret);
- ret = reftable_ref_record_equal(&ref, &records[0], GIT_SHA1_RAWSZ);
+ ret = reftable_ref_record_equal(&ref, &records[0], REFTABLE_HASH_SIZE_SHA1);
check_int(ret, ==, 1);
ret = reftable_iterator_next_ref(&it, &ref);
diff --git a/t/unit-tests/t-reftable-readwrite.c b/t/unit-tests/t-reftable-readwrite.c
index 7ffbd78c67..8c4161f365 100644
--- a/t/unit-tests/t-reftable-readwrite.c
+++ b/t/unit-tests/t-reftable-readwrite.c
@@ -13,6 +13,7 @@ https://developers.google.com/open-source/licenses/bsd
#include "reftable/reader.h"
#include "reftable/reftable-error.h"
#include "reftable/reftable-writer.h"
+#include "strbuf.h"
static const int update_index = 5;
@@ -41,7 +42,7 @@ static void t_buffer(void)
}
static void write_table(char ***names, struct reftable_buf *buf, int N,
- int block_size, uint32_t hash_id)
+ int block_size, enum reftable_hash hash_id)
{
struct reftable_write_options opts = {
.block_size = block_size,
@@ -62,7 +63,7 @@ static void write_table(char ***names, struct reftable_buf *buf, int N,
refs[i].refname = (*names)[i] = xstrfmt("refs/heads/branch%02d", i);
refs[i].update_index = update_index;
refs[i].value_type = REFTABLE_REF_VAL1;
- t_reftable_set_hash(refs[i].value.val1, i, GIT_SHA1_FORMAT_ID);
+ t_reftable_set_hash(refs[i].value.val1, i, REFTABLE_HASH_SHA1);
}
for (i = 0; i < N; i++) {
@@ -70,7 +71,7 @@ static void write_table(char ***names, struct reftable_buf *buf, int N,
logs[i].update_index = update_index;
logs[i].value_type = REFTABLE_LOG_UPDATE;
t_reftable_set_hash(logs[i].value.update.new_hash, i,
- GIT_SHA1_FORMAT_ID);
+ REFTABLE_HASH_SHA1);
logs[i].value.update.message = (char *) "message";
}
@@ -104,7 +105,7 @@ static void t_log_buffer_size(void)
/* This tests buffer extension for log compression. Must use a random
hash, to ensure that the compressed part is larger than the original.
*/
- for (i = 0; i < GIT_SHA1_RAWSZ; i++) {
+ for (i = 0; i < REFTABLE_HASH_SIZE_SHA1; i++) {
log.value.update.old_hash[i] = (uint8_t)(git_rand() % 256);
log.value.update.new_hash[i] = (uint8_t)(git_rand() % 256);
}
@@ -233,9 +234,9 @@ static void t_log_write_read(void)
log.update_index = i;
log.value_type = REFTABLE_LOG_UPDATE;
t_reftable_set_hash(log.value.update.old_hash, i,
- GIT_SHA1_FORMAT_ID);
+ REFTABLE_HASH_SHA1);
t_reftable_set_hash(log.value.update.new_hash, i + 1,
- GIT_SHA1_FORMAT_ID);
+ REFTABLE_HASH_SHA1);
err = reftable_writer_add_log(w, &log);
check(!err);
@@ -368,7 +369,7 @@ static void t_table_read_write_sequential(void)
int err = 0;
int j = 0;
- write_table(&names, &buf, N, 256, GIT_SHA1_FORMAT_ID);
+ write_table(&names, &buf, N, 256, REFTABLE_HASH_SHA1);
block_source_from_buf(&source, &buf);
@@ -403,7 +404,7 @@ static void t_table_write_small_table(void)
char **names;
struct reftable_buf buf = REFTABLE_BUF_INIT;
int N = 1;
- write_table(&names, &buf, N, 4096, GIT_SHA1_FORMAT_ID);
+ write_table(&names, &buf, N, 4096, REFTABLE_HASH_SHA1);
check_int(buf.len, <, 200);
reftable_buf_release(&buf);
free_names(names);
@@ -420,7 +421,7 @@ static void t_table_read_api(void)
struct reftable_log_record log = { 0 };
struct reftable_iterator it = { 0 };
- write_table(&names, &buf, N, 256, GIT_SHA1_FORMAT_ID);
+ write_table(&names, &buf, N, 256, REFTABLE_HASH_SHA1);
block_source_from_buf(&source, &buf);
@@ -442,7 +443,7 @@ static void t_table_read_api(void)
reftable_buf_release(&buf);
}
-static void t_table_read_write_seek(int index, int hash_id)
+static void t_table_read_write_seek(int index, enum reftable_hash hash_id)
{
char **names;
struct reftable_buf buf = REFTABLE_BUF_INIT;
@@ -509,24 +510,24 @@ static void t_table_read_write_seek(int index, int hash_id)
static void t_table_read_write_seek_linear(void)
{
- t_table_read_write_seek(0, GIT_SHA1_FORMAT_ID);
+ t_table_read_write_seek(0, REFTABLE_HASH_SHA1);
}
static void t_table_read_write_seek_linear_sha256(void)
{
- t_table_read_write_seek(0, GIT_SHA256_FORMAT_ID);
+ t_table_read_write_seek(0, REFTABLE_HASH_SHA256);
}
static void t_table_read_write_seek_index(void)
{
- t_table_read_write_seek(1, GIT_SHA1_FORMAT_ID);
+ t_table_read_write_seek(1, REFTABLE_HASH_SHA1);
}
static void t_table_refs_for(int indexed)
{
char **want_names;
int want_names_len = 0;
- uint8_t want_hash[GIT_SHA1_RAWSZ];
+ uint8_t want_hash[REFTABLE_HASH_SIZE_SHA1];
struct reftable_write_options opts = {
.block_size = 256,
@@ -542,10 +543,10 @@ static void t_table_refs_for(int indexed)
want_names = reftable_calloc(N + 1, sizeof(*want_names));
check(want_names != NULL);
- t_reftable_set_hash(want_hash, 4, GIT_SHA1_FORMAT_ID);
+ t_reftable_set_hash(want_hash, 4, REFTABLE_HASH_SHA1);
for (i = 0; i < N; i++) {
- uint8_t hash[GIT_SHA1_RAWSZ];
+ uint8_t hash[REFTABLE_HASH_SIZE_SHA1];
char fill[51] = { 0 };
char name[100];
struct reftable_ref_record ref = { 0 };
@@ -559,9 +560,9 @@ static void t_table_refs_for(int indexed)
ref.value_type = REFTABLE_REF_VAL2;
t_reftable_set_hash(ref.value.val2.value, i / 4,
- GIT_SHA1_FORMAT_ID);
+ REFTABLE_HASH_SHA1);
t_reftable_set_hash(ref.value.val2.target_value, 3 + i / 4,
- GIT_SHA1_FORMAT_ID);
+ REFTABLE_HASH_SHA1);
/* 80 bytes / entry, so 3 entries per block. Yields 17
*/
@@ -569,8 +570,8 @@ static void t_table_refs_for(int indexed)
n = reftable_writer_add_ref(w, &ref);
check_int(n, ==, 0);
- if (!memcmp(ref.value.val2.value, want_hash, GIT_SHA1_RAWSZ) ||
- !memcmp(ref.value.val2.target_value, want_hash, GIT_SHA1_RAWSZ))
+ if (!memcmp(ref.value.val2.value, want_hash, REFTABLE_HASH_SIZE_SHA1) ||
+ !memcmp(ref.value.val2.target_value, want_hash, REFTABLE_HASH_SIZE_SHA1))
want_names[want_names_len++] = xstrdup(name);
}
diff --git a/t/unit-tests/t-reftable-record.c b/t/unit-tests/t-reftable-record.c
index eb98bf2da9..42bc64cec8 100644
--- a/t/unit-tests/t-reftable-record.c
+++ b/t/unit-tests/t-reftable-record.c
@@ -7,6 +7,7 @@
*/
#include "test-lib.h"
+#include "reftable/basics.h"
#include "reftable/constants.h"
#include "reftable/record.h"
@@ -17,10 +18,10 @@ static void t_copy(struct reftable_record *rec)
typ = reftable_record_type(rec);
reftable_record_init(&copy, typ);
- reftable_record_copy_from(&copy, rec, GIT_SHA1_RAWSZ);
+ reftable_record_copy_from(&copy, rec, REFTABLE_HASH_SIZE_SHA1);
/* do it twice to catch memory leaks */
- reftable_record_copy_from(&copy, rec, GIT_SHA1_RAWSZ);
- check(reftable_record_equal(rec, &copy, GIT_SHA1_RAWSZ));
+ reftable_record_copy_from(&copy, rec, REFTABLE_HASH_SIZE_SHA1);
+ check(reftable_record_equal(rec, &copy, REFTABLE_HASH_SIZE_SHA1));
reftable_record_release(&copy);
}
@@ -59,7 +60,7 @@ static void t_varint_roundtrip(void)
static void set_hash(uint8_t *h, int j)
{
- for (int i = 0; i < hash_size(GIT_SHA1_FORMAT_ID); i++)
+ for (int i = 0; i < hash_size(REFTABLE_HASH_SHA1); i++)
h[i] = (j >> i) & 0xff;
}
@@ -84,14 +85,14 @@ static void t_reftable_ref_record_comparison(void)
},
};
- check(!reftable_record_equal(&in[0], &in[1], GIT_SHA1_RAWSZ));
+ check(!reftable_record_equal(&in[0], &in[1], REFTABLE_HASH_SIZE_SHA1));
check(!reftable_record_cmp(&in[0], &in[1]));
- check(!reftable_record_equal(&in[1], &in[2], GIT_SHA1_RAWSZ));
+ check(!reftable_record_equal(&in[1], &in[2], REFTABLE_HASH_SIZE_SHA1));
check_int(reftable_record_cmp(&in[1], &in[2]), >, 0);
in[1].u.ref.value_type = in[0].u.ref.value_type;
- check(reftable_record_equal(&in[0], &in[1], GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&in[0], &in[1], REFTABLE_HASH_SIZE_SHA1));
check(!reftable_record_cmp(&in[0], &in[1]));
}
@@ -155,15 +156,15 @@ static void t_reftable_ref_record_roundtrip(void)
check_int(reftable_record_is_deletion(&in), ==, i == REFTABLE_REF_DELETION);
reftable_record_key(&in, &key);
- n = reftable_record_encode(&in, dest, GIT_SHA1_RAWSZ);
+ n = reftable_record_encode(&in, dest, REFTABLE_HASH_SIZE_SHA1);
check_int(n, >, 0);
/* decode into a non-zero reftable_record to test for leaks. */
- m = reftable_record_decode(&out, key, i, dest, GIT_SHA1_RAWSZ, &scratch);
+ m = reftable_record_decode(&out, key, i, dest, REFTABLE_HASH_SIZE_SHA1, &scratch);
check_int(n, ==, m);
check(reftable_ref_record_equal(&in.u.ref, &out.u.ref,
- GIT_SHA1_RAWSZ));
+ REFTABLE_HASH_SIZE_SHA1));
reftable_record_release(&in);
reftable_buf_release(&key);
@@ -193,15 +194,15 @@ static void t_reftable_log_record_comparison(void)
},
};
- check(!reftable_record_equal(&in[0], &in[1], GIT_SHA1_RAWSZ));
- check(!reftable_record_equal(&in[1], &in[2], GIT_SHA1_RAWSZ));
+ check(!reftable_record_equal(&in[0], &in[1], REFTABLE_HASH_SIZE_SHA1));
+ check(!reftable_record_equal(&in[1], &in[2], REFTABLE_HASH_SIZE_SHA1));
check_int(reftable_record_cmp(&in[1], &in[2]), >, 0);
/* comparison should be reversed for equal keys, because
* comparison is now performed on the basis of update indices */
check_int(reftable_record_cmp(&in[0], &in[1]), <, 0);
in[1].u.log.update_index = in[0].u.log.update_index;
- check(reftable_record_equal(&in[0], &in[1], GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&in[0], &in[1], REFTABLE_HASH_SIZE_SHA1));
check(!reftable_record_cmp(&in[0], &in[1]));
}
@@ -303,15 +304,15 @@ static void t_reftable_log_record_roundtrip(void)
reftable_record_key(&rec, &key);
- n = reftable_record_encode(&rec, dest, GIT_SHA1_RAWSZ);
+ n = reftable_record_encode(&rec, dest, REFTABLE_HASH_SIZE_SHA1);
check_int(n, >=, 0);
valtype = reftable_record_val_type(&rec);
m = reftable_record_decode(&out, key, valtype, dest,
- GIT_SHA1_RAWSZ, &scratch);
+ REFTABLE_HASH_SIZE_SHA1, &scratch);
check_int(n, ==, m);
check(reftable_log_record_equal(&in[i], &out.u.log,
- GIT_SHA1_RAWSZ));
+ REFTABLE_HASH_SIZE_SHA1));
reftable_log_record_release(&in[i]);
reftable_buf_release(&key);
reftable_record_release(&out);
@@ -380,20 +381,20 @@ static void t_reftable_obj_record_comparison(void)
},
};
- check(!reftable_record_equal(&in[0], &in[1], GIT_SHA1_RAWSZ));
+ check(!reftable_record_equal(&in[0], &in[1], REFTABLE_HASH_SIZE_SHA1));
check(!reftable_record_cmp(&in[0], &in[1]));
- check(!reftable_record_equal(&in[1], &in[2], GIT_SHA1_RAWSZ));
+ check(!reftable_record_equal(&in[1], &in[2], REFTABLE_HASH_SIZE_SHA1));
check_int(reftable_record_cmp(&in[1], &in[2]), >, 0);
in[1].u.obj.offset_len = in[0].u.obj.offset_len;
- check(reftable_record_equal(&in[0], &in[1], GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&in[0], &in[1], REFTABLE_HASH_SIZE_SHA1));
check(!reftable_record_cmp(&in[0], &in[1]));
}
static void t_reftable_obj_record_roundtrip(void)
{
- uint8_t testHash1[GIT_SHA1_RAWSZ] = { 1, 2, 3, 4, 0 };
+ uint8_t testHash1[REFTABLE_HASH_SIZE_SHA1] = { 1, 2, 3, 4, 0 };
uint64_t till9[] = { 1, 2, 3, 4, 500, 600, 700, 800, 9000 };
struct reftable_obj_record recs[3] = {
{
@@ -435,14 +436,14 @@ static void t_reftable_obj_record_roundtrip(void)
check(!reftable_record_is_deletion(&in));
t_copy(&in);
reftable_record_key(&in, &key);
- n = reftable_record_encode(&in, dest, GIT_SHA1_RAWSZ);
+ n = reftable_record_encode(&in, dest, REFTABLE_HASH_SIZE_SHA1);
check_int(n, >, 0);
extra = reftable_record_val_type(&in);
m = reftable_record_decode(&out, key, extra, dest,
- GIT_SHA1_RAWSZ, &scratch);
+ REFTABLE_HASH_SIZE_SHA1, &scratch);
check_int(n, ==, m);
- check(reftable_record_equal(&in, &out, GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&in, &out, REFTABLE_HASH_SIZE_SHA1));
reftable_buf_release(&key);
reftable_record_release(&out);
}
@@ -473,14 +474,14 @@ static void t_reftable_index_record_comparison(void)
check(!reftable_buf_addstr(&in[1].u.idx.last_key, "refs/heads/master"));
check(!reftable_buf_addstr(&in[2].u.idx.last_key, "refs/heads/branch"));
- check(!reftable_record_equal(&in[0], &in[1], GIT_SHA1_RAWSZ));
+ check(!reftable_record_equal(&in[0], &in[1], REFTABLE_HASH_SIZE_SHA1));
check(!reftable_record_cmp(&in[0], &in[1]));
- check(!reftable_record_equal(&in[1], &in[2], GIT_SHA1_RAWSZ));
+ check(!reftable_record_equal(&in[1], &in[2], REFTABLE_HASH_SIZE_SHA1));
check_int(reftable_record_cmp(&in[1], &in[2]), >, 0);
in[1].u.idx.offset = in[0].u.idx.offset;
- check(reftable_record_equal(&in[0], &in[1], GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&in[0], &in[1], REFTABLE_HASH_SIZE_SHA1));
check(!reftable_record_cmp(&in[0], &in[1]));
for (size_t i = 0; i < ARRAY_SIZE(in); i++)
@@ -516,15 +517,15 @@ static void t_reftable_index_record_roundtrip(void)
check(!reftable_record_is_deletion(&in));
check(!reftable_buf_cmp(&key, &in.u.idx.last_key));
- n = reftable_record_encode(&in, dest, GIT_SHA1_RAWSZ);
+ n = reftable_record_encode(&in, dest, REFTABLE_HASH_SIZE_SHA1);
check_int(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, REFTABLE_HASH_SIZE_SHA1,
&scratch);
check_int(m, ==, n);
- check(reftable_record_equal(&in, &out, GIT_SHA1_RAWSZ));
+ check(reftable_record_equal(&in, &out, REFTABLE_HASH_SIZE_SHA1));
reftable_record_release(&out);
reftable_buf_release(&key);
diff --git a/t/unit-tests/t-reftable-stack.c b/t/unit-tests/t-reftable-stack.c
index 52b81475c3..e208e156f0 100644
--- a/t/unit-tests/t-reftable-stack.c
+++ b/t/unit-tests/t-reftable-stack.c
@@ -8,10 +8,13 @@ https://developers.google.com/open-source/licenses/bsd
#include "test-lib.h"
#include "lib-reftable.h"
+#include "dir.h"
#include "reftable/merged.h"
#include "reftable/reader.h"
#include "reftable/reftable-error.h"
#include "reftable/stack.h"
+#include "strbuf.h"
+#include "tempfile.h"
#include <dirent.h>
static void clear_dir(const char *dirname)
@@ -120,7 +123,7 @@ static void write_n_ref_tables(struct reftable_stack *st,
snprintf(buf, sizeof(buf), "refs/heads/branch-%04"PRIuMAX, (uintmax_t)i);
ref.refname = buf;
- t_reftable_set_hash(ref.value.val1, i, GIT_SHA1_FORMAT_ID);
+ t_reftable_set_hash(ref.value.val1, i, REFTABLE_HASH_SHA1);
err = reftable_stack_add(st, &write_test_ref, &ref);
check(!err);
@@ -168,7 +171,7 @@ static void t_reftable_stack_add_one(void)
err = reftable_stack_read_ref(st, ref.refname, &dest);
check(!err);
- check(reftable_ref_record_equal(&ref, &dest, GIT_SHA1_RAWSZ));
+ check(reftable_ref_record_equal(&ref, &dest, REFTABLE_HASH_SIZE_SHA1));
check_int(st->readers_len, >, 0);
#ifndef GIT_WINDOWS_NATIVE
@@ -279,7 +282,7 @@ static void t_reftable_stack_transaction_api(void)
err = reftable_stack_read_ref(st, ref.refname, &dest);
check(!err);
check_int(REFTABLE_REF_SYMREF, ==, dest.value_type);
- check(reftable_ref_record_equal(&ref, &dest, GIT_SHA1_RAWSZ));
+ check(reftable_ref_record_equal(&ref, &dest, REFTABLE_HASH_SIZE_SHA1));
reftable_ref_record_release(&dest);
reftable_stack_destroy(st);
@@ -339,7 +342,7 @@ static void t_reftable_stack_transaction_with_reload(void)
for (size_t i = 0; i < ARRAY_SIZE(refs); i++) {
err = reftable_stack_read_ref(st2, refs[i].refname, &ref);
check(!err);
- check(reftable_ref_record_equal(&refs[i], &ref, GIT_SHA1_RAWSZ));
+ check(reftable_ref_record_equal(&refs[i], &ref, REFTABLE_HASH_SIZE_SHA1));
}
reftable_ref_record_release(&ref);
@@ -529,13 +532,13 @@ static void t_reftable_stack_add(void)
refs[i].refname = xstrdup(buf);
refs[i].update_index = i + 1;
refs[i].value_type = REFTABLE_REF_VAL1;
- t_reftable_set_hash(refs[i].value.val1, i, GIT_SHA1_FORMAT_ID);
+ t_reftable_set_hash(refs[i].value.val1, i, REFTABLE_HASH_SHA1);
logs[i].refname = xstrdup(buf);
logs[i].update_index = N + i + 1;
logs[i].value_type = REFTABLE_LOG_UPDATE;
logs[i].value.update.email = xstrdup("identity@invalid");
- t_reftable_set_hash(logs[i].value.update.new_hash, i, GIT_SHA1_FORMAT_ID);
+ t_reftable_set_hash(logs[i].value.update.new_hash, i, REFTABLE_HASH_SHA1);
}
for (i = 0; i < N; i++) {
@@ -561,7 +564,7 @@ static void t_reftable_stack_add(void)
int err = reftable_stack_read_ref(st, refs[i].refname, &dest);
check(!err);
check(reftable_ref_record_equal(&dest, refs + i,
- GIT_SHA1_RAWSZ));
+ REFTABLE_HASH_SIZE_SHA1));
reftable_ref_record_release(&dest);
}
@@ -570,7 +573,7 @@ static void t_reftable_stack_add(void)
int err = reftable_stack_read_log(st, refs[i].refname, &dest);
check(!err);
check(reftable_log_record_equal(&dest, logs + i,
- GIT_SHA1_RAWSZ));
+ REFTABLE_HASH_SIZE_SHA1));
reftable_log_record_release(&dest);
}
@@ -621,14 +624,14 @@ static void t_reftable_stack_iterator(void)
refs[i].refname = xstrfmt("branch%02"PRIuMAX, (uintmax_t)i);
refs[i].update_index = i + 1;
refs[i].value_type = REFTABLE_REF_VAL1;
- t_reftable_set_hash(refs[i].value.val1, i, GIT_SHA1_FORMAT_ID);
+ t_reftable_set_hash(refs[i].value.val1, i, REFTABLE_HASH_SHA1);
logs[i].refname = xstrfmt("branch%02"PRIuMAX, (uintmax_t)i);
logs[i].update_index = i + 1;
logs[i].value_type = REFTABLE_LOG_UPDATE;
logs[i].value.update.email = xstrdup("johndoe@invalid");
logs[i].value.update.message = xstrdup("commit\n");
- t_reftable_set_hash(logs[i].value.update.new_hash, i, GIT_SHA1_FORMAT_ID);
+ t_reftable_set_hash(logs[i].value.update.new_hash, i, REFTABLE_HASH_SHA1);
}
for (i = 0; i < N; i++) {
@@ -655,7 +658,7 @@ static void t_reftable_stack_iterator(void)
if (err > 0)
break;
check(!err);
- check(reftable_ref_record_equal(&ref, &refs[i], GIT_SHA1_RAWSZ));
+ check(reftable_ref_record_equal(&ref, &refs[i], REFTABLE_HASH_SIZE_SHA1));
reftable_ref_record_release(&ref);
}
check_int(i, ==, N);
@@ -673,7 +676,7 @@ static void t_reftable_stack_iterator(void)
if (err > 0)
break;
check(!err);
- check(reftable_log_record_equal(&log, &logs[i], GIT_SHA1_RAWSZ));
+ check(reftable_log_record_equal(&log, &logs[i], REFTABLE_HASH_SIZE_SHA1));
reftable_log_record_release(&log);
}
check_int(i, ==, N);
@@ -766,7 +769,7 @@ static void t_reftable_stack_tombstone(void)
if (i % 2 == 0) {
refs[i].value_type = REFTABLE_REF_VAL1;
t_reftable_set_hash(refs[i].value.val1, i,
- GIT_SHA1_FORMAT_ID);
+ REFTABLE_HASH_SHA1);
}
logs[i].refname = xstrdup(buf);
@@ -779,7 +782,7 @@ static void t_reftable_stack_tombstone(void)
if (i % 2 == 0) {
logs[i].value_type = REFTABLE_LOG_UPDATE;
t_reftable_set_hash(logs[i].value.update.new_hash, i,
- GIT_SHA1_FORMAT_ID);
+ REFTABLE_HASH_SHA1);
logs[i].value.update.email =
xstrdup("identity@invalid");
}
@@ -839,7 +842,7 @@ static void t_reftable_stack_hash_id(void)
.value.symref = (char *) "target",
.update_index = 1,
};
- struct reftable_write_options opts32 = { .hash_id = GIT_SHA256_FORMAT_ID };
+ struct reftable_write_options opts32 = { .hash_id = REFTABLE_HASH_SHA256 };
struct reftable_stack *st32 = NULL;
struct reftable_write_options opts_default = { 0 };
struct reftable_stack *st_default = NULL;
@@ -862,7 +865,7 @@ static void t_reftable_stack_hash_id(void)
err = reftable_stack_read_ref(st_default, "master", &dest);
check(!err);
- check(reftable_ref_record_equal(&ref, &dest, GIT_SHA1_RAWSZ));
+ check(reftable_ref_record_equal(&ref, &dest, REFTABLE_HASH_SIZE_SHA1));
reftable_ref_record_release(&dest);
reftable_stack_destroy(st);
reftable_stack_destroy(st_default);
@@ -912,7 +915,7 @@ static void t_reflog_expire(void)
logs[i].value.update.time = i;
logs[i].value.update.email = xstrdup("identity@invalid");
t_reftable_set_hash(logs[i].value.update.new_hash, i,
- GIT_SHA1_FORMAT_ID);
+ REFTABLE_HASH_SHA1);
}
for (i = 1; i <= N; i++) {
diff --git a/tag.c b/tag.c
index d24170e340..beef9571b5 100644
--- a/tag.c
+++ b/tag.c
@@ -84,7 +84,7 @@ struct object *deref_tag(struct repository *r, struct object *o, const char *war
o = NULL;
}
if (!o && warn) {
- if (last_oid && is_promisor_object(last_oid))
+ if (last_oid && is_promisor_object(r, last_oid))
return NULL;
if (!warnlen)
warnlen = strlen(warn);
diff --git a/templates/Makefile b/templates/Makefile
index 367ad00c24..bd1e9e30c1 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -29,24 +29,35 @@ all: boilerplates.made custom
# in a file direc--tory--file in the source. They will be
# just copied to the destination.
-bpsrc = $(filter-out %~,$(wildcard *--*))
-boilerplates.made : $(bpsrc)
- $(QUIET)umask 022 && ls *--* 2>/dev/null | \
- while read boilerplate; \
+TEMPLATES =
+TEMPLATES += description
+TEMPLATES += hooks/applypatch-msg.sample
+TEMPLATES += hooks/commit-msg.sample
+TEMPLATES += hooks/fsmonitor-watchman.sample
+TEMPLATES += hooks/post-update.sample
+TEMPLATES += hooks/pre-applypatch.sample
+TEMPLATES += hooks/pre-commit.sample
+TEMPLATES += hooks/pre-merge-commit.sample
+TEMPLATES += hooks/prepare-commit-msg.sample
+TEMPLATES += hooks/pre-push.sample
+TEMPLATES += hooks/pre-rebase.sample
+TEMPLATES += hooks/pre-receive.sample
+TEMPLATES += hooks/push-to-checkout.sample
+TEMPLATES += hooks/sendemail-validate.sample
+TEMPLATES += hooks/update.sample
+TEMPLATES += info/exclude
+
+boilerplates.made: $(TEMPLATES)
+ $(QUIET)umask 022 && for template in $(TEMPLATES); \
do \
- case "$$boilerplate" in *~) continue ;; esac && \
- dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
- dir=`expr "$$dst" : '\(.*\)/'` && \
+ dir=$$(dirname "$$template") && \
mkdir -p blt/$$dir && \
- case "$$boilerplate" in \
- *--) continue;; \
- esac && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
- -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \
- blt/$$dst && \
- if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \
- chmod a+$$rx "blt/$$dst" || exit; \
+ -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \
+ blt/$$template && \
+ if test -x "$$template"; then rx=rx; else rx=r; fi && \
+ chmod a+$$rx "blt/$$template" || exit; \
done && \
date >$@
diff --git a/templates/branches-- b/templates/branches--
deleted file mode 100644
index fae88709a6..0000000000
--- a/templates/branches--
+++ /dev/null
@@ -1 +0,0 @@
-: this is just to ensure the directory exists.
diff --git a/templates/this--description b/templates/description
index 498b267a8c..498b267a8c 100644
--- a/templates/this--description
+++ b/templates/description
diff --git a/templates/hooks--applypatch-msg.sample b/templates/hooks/applypatch-msg.sample
index a5d7b84a67..a5d7b84a67 100755
--- a/templates/hooks--applypatch-msg.sample
+++ b/templates/hooks/applypatch-msg.sample
diff --git a/templates/hooks--commit-msg.sample b/templates/hooks/commit-msg.sample
index b58d1184a9..b58d1184a9 100755
--- a/templates/hooks--commit-msg.sample
+++ b/templates/hooks/commit-msg.sample
diff --git a/templates/hooks--fsmonitor-watchman.sample b/templates/hooks/fsmonitor-watchman.sample
index 23e856f5de..23e856f5de 100755
--- a/templates/hooks--fsmonitor-watchman.sample
+++ b/templates/hooks/fsmonitor-watchman.sample
diff --git a/templates/hooks/meson.build b/templates/hooks/meson.build
new file mode 100644
index 0000000000..ef85e10a16
--- /dev/null
+++ b/templates/hooks/meson.build
@@ -0,0 +1,26 @@
+hooks = [
+ 'applypatch-msg.sample',
+ 'commit-msg.sample',
+ 'fsmonitor-watchman.sample',
+ 'post-update.sample',
+ 'pre-applypatch.sample',
+ 'pre-commit.sample',
+ 'pre-merge-commit.sample',
+ 'prepare-commit-msg.sample',
+ 'pre-push.sample',
+ 'pre-rebase.sample',
+ 'pre-receive.sample',
+ 'push-to-checkout.sample',
+ 'sendemail-validate.sample',
+ 'update.sample',
+]
+
+foreach hook : hooks
+ configure_file(
+ input: hook,
+ output: hook,
+ configuration: template_config,
+ install: true,
+ install_dir: get_option('datadir') / 'git-core/templates/hooks',
+ )
+endforeach
diff --git a/templates/hooks--post-update.sample b/templates/hooks/post-update.sample
index ec17ec1939..ec17ec1939 100755
--- a/templates/hooks--post-update.sample
+++ b/templates/hooks/post-update.sample
diff --git a/templates/hooks--pre-applypatch.sample b/templates/hooks/pre-applypatch.sample
index 4142082bcb..4142082bcb 100755
--- a/templates/hooks--pre-applypatch.sample
+++ b/templates/hooks/pre-applypatch.sample
diff --git a/templates/hooks--pre-commit.sample b/templates/hooks/pre-commit.sample
index 29ed5ee486..29ed5ee486 100755
--- a/templates/hooks--pre-commit.sample
+++ b/templates/hooks/pre-commit.sample
diff --git a/templates/hooks--pre-merge-commit.sample b/templates/hooks/pre-merge-commit.sample
index 399eab1924..399eab1924 100755
--- a/templates/hooks--pre-merge-commit.sample
+++ b/templates/hooks/pre-merge-commit.sample
diff --git a/templates/hooks--pre-push.sample b/templates/hooks/pre-push.sample
index 4ce688d32b..4ce688d32b 100755
--- a/templates/hooks--pre-push.sample
+++ b/templates/hooks/pre-push.sample
diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks/pre-rebase.sample
index db5feab8a1..db5feab8a1 100755
--- a/templates/hooks--pre-rebase.sample
+++ b/templates/hooks/pre-rebase.sample
diff --git a/templates/hooks--pre-receive.sample b/templates/hooks/pre-receive.sample
index a1fd29ec14..a1fd29ec14 100755
--- a/templates/hooks--pre-receive.sample
+++ b/templates/hooks/pre-receive.sample
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks/prepare-commit-msg.sample
index 318afe3fd8..318afe3fd8 100755
--- a/templates/hooks--prepare-commit-msg.sample
+++ b/templates/hooks/prepare-commit-msg.sample
diff --git a/templates/hooks--push-to-checkout.sample b/templates/hooks/push-to-checkout.sample
index af5a0c0018..af5a0c0018 100755
--- a/templates/hooks--push-to-checkout.sample
+++ b/templates/hooks/push-to-checkout.sample
diff --git a/templates/hooks--sendemail-validate.sample b/templates/hooks/sendemail-validate.sample
index 640bcf874d..640bcf874d 100755
--- a/templates/hooks--sendemail-validate.sample
+++ b/templates/hooks/sendemail-validate.sample
diff --git a/templates/hooks--update.sample b/templates/hooks/update.sample
index c4d426bc6e..c4d426bc6e 100755
--- a/templates/hooks--update.sample
+++ b/templates/hooks/update.sample
diff --git a/templates/info--exclude b/templates/info/exclude
index a5196d1be8..a5196d1be8 100644
--- a/templates/info--exclude
+++ b/templates/info/exclude
diff --git a/templates/info/meson.build b/templates/info/meson.build
new file mode 100644
index 0000000000..026f231385
--- /dev/null
+++ b/templates/info/meson.build
@@ -0,0 +1,7 @@
+configure_file(
+ input: 'exclude',
+ output: 'exclude',
+ configuration: template_config,
+ install: true,
+ install_dir: get_option('datadir') / 'git-core/templates/info',
+)
diff --git a/templates/meson.build b/templates/meson.build
new file mode 100644
index 0000000000..1faf9a44ce
--- /dev/null
+++ b/templates/meson.build
@@ -0,0 +1,15 @@
+template_config = configuration_data()
+template_config.set('PERL_PATH', perl.found() ? fs.as_posix(perl.full_path()) : '')
+template_config.set('SHELL_PATH', fs.as_posix(shell.full_path()))
+template_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
+
+configure_file(
+ input: 'description',
+ output: 'description',
+ configuration: template_config,
+ install: true,
+ install_dir: get_option('datadir') / 'git-core/templates',
+)
+
+subdir('hooks')
+subdir('info')
diff --git a/transport.c b/transport.c
index 47fda6a773..6966df51a8 100644
--- a/transport.c
+++ b/transport.c
@@ -19,6 +19,7 @@
#include "branch.h"
#include "url.h"
#include "submodule.h"
+#include "strbuf.h"
#include "string-list.h"
#include "oid-array.h"
#include "sigchain.h"
@@ -172,12 +173,29 @@ static struct ref *get_refs_from_bundle(struct transport *transport,
return result;
}
+static int fetch_fsck_config_cb(const char *var, const char *value,
+ const struct config_context *ctx UNUSED, void *cb)
+{
+ struct strbuf *msg_types = cb;
+ int ret;
+
+ ret = fetch_pack_fsck_config(var, value, msg_types);
+ if (ret > 0)
+ return 0;
+
+ return ret;
+}
+
static int fetch_refs_from_bundle(struct transport *transport,
int nr_heads UNUSED,
struct ref **to_fetch UNUSED)
{
+ struct unbundle_opts opts = {
+ .flags = fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0,
+ };
struct bundle_transport_data *data = transport->data;
struct strvec extra_index_pack_args = STRVEC_INIT;
+ struct strbuf msg_types = STRBUF_INIT;
int ret;
if (transport->progress)
@@ -185,12 +203,16 @@ static int fetch_refs_from_bundle(struct transport *transport,
if (!data->get_refs_from_bundle_called)
get_refs_from_bundle_inner(transport);
+
+ git_config(fetch_fsck_config_cb, &msg_types);
+ opts.fsck_msg_types = msg_types.buf;
+
ret = unbundle(the_repository, &data->header, data->fd,
- &extra_index_pack_args,
- fetch_pack_fsck_objects() ? VERIFY_BUNDLE_FSCK : 0);
+ &extra_index_pack_args, &opts);
transport->hash_algo = data->header.hash_algo;
strvec_clear(&extra_index_pack_args);
+ strbuf_release(&msg_types);
return ret;
}
diff --git a/unimplemented.sh b/unimplemented.sh
index fee21d24e8..41776b279d 100644
--- a/unimplemented.sh
+++ b/unimplemented.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)."
+echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)."
exit 128
diff --git a/usage.c b/usage.c
index 7a2f7805f5..29a9725784 100644
--- a/usage.c
+++ b/usage.c
@@ -350,18 +350,3 @@ void bug_fl(const char *file, int line, const char *fmt, ...)
trace2_cmd_error_va(fmt, ap);
va_end(ap);
}
-
-#ifdef SUPPRESS_ANNOTATED_LEAKS
-void unleak_memory(const void *ptr, size_t len)
-{
- static struct suppressed_leak_root {
- struct suppressed_leak_root *next;
- char data[FLEX_ARRAY];
- } *suppressed_leaks;
- struct suppressed_leak_root *root;
-
- FLEX_ALLOC_MEM(root, data, ptr, len);
- root->next = suppressed_leaks;
- suppressed_leaks = root;
-}
-#endif
diff --git a/version-def.h.in b/version-def.h.in
new file mode 100644
index 0000000000..347995df06
--- /dev/null
+++ b/version-def.h.in
@@ -0,0 +1,8 @@
+#ifndef VERSION_DEF_H
+#define VERSION_DEF_H
+
+#define GIT_VERSION "@GIT_VERSION@"
+#define GIT_BUILT_FROM_COMMIT "@GIT_BUILT_FROM_COMMIT@"
+#define GIT_USER_AGENT "@GIT_USER_AGENT@"
+
+#endif /* VERSION_DEF_H */
diff --git a/version.c b/version.c
index 41b718c29e..7adc4d51ff 100644
--- a/version.c
+++ b/version.c
@@ -1,5 +1,6 @@
#include "git-compat-util.h"
#include "version.h"
+#include "version-def.h"
#include "strbuf.h"
const char git_version_string[] = GIT_VERSION;
diff --git a/walker.c b/walker.c
index 5ea7e5b392..7cc9dbea46 100644
--- a/walker.c
+++ b/walker.c
@@ -290,7 +290,7 @@ int walker_fetch(struct walker *walker, int targets, char **target,
if (write_ref) {
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction) {
error("%s", err.buf);
goto done;
diff --git a/worktree.c b/worktree.c
index 77ff484d3e..af68b24f9d 100644
--- a/worktree.c
+++ b/worktree.c
@@ -111,9 +111,9 @@ struct worktree *get_linked_worktree(const char *id,
strbuf_strip_suffix(&worktree_path, "/.git");
if (!is_absolute_path(worktree_path.buf)) {
- strbuf_strip_suffix(&path, "gitdir");
- strbuf_addbuf(&path, &worktree_path);
- strbuf_realpath_forgiving(&worktree_path, path.buf, 0);
+ strbuf_strip_suffix(&path, "gitdir");
+ strbuf_addbuf(&path, &worktree_path);
+ strbuf_realpath_forgiving(&worktree_path, path.buf, 0);
}
CALLOC_ARRAY(worktree, 1);
@@ -376,32 +376,28 @@ done:
return ret;
}
-void update_worktree_location(struct worktree *wt, const char *path_)
+void update_worktree_location(struct worktree *wt, const char *path_,
+ int use_relative_paths)
{
struct strbuf path = STRBUF_INIT;
- struct strbuf repo = STRBUF_INIT;
- struct strbuf file = STRBUF_INIT;
- struct strbuf tmp = STRBUF_INIT;
+ struct strbuf dotgit = STRBUF_INIT;
+ struct strbuf gitdir = STRBUF_INIT;
if (is_main_worktree(wt))
BUG("can't relocate main worktree");
- strbuf_realpath(&repo, git_common_path("worktrees/%s", wt->id), 1);
+ strbuf_realpath(&gitdir, git_common_path("worktrees/%s/gitdir", wt->id), 1);
strbuf_realpath(&path, path_, 1);
+ strbuf_addf(&dotgit, "%s/.git", path.buf);
if (fspathcmp(wt->path, path.buf)) {
- strbuf_addf(&file, "%s/gitdir", repo.buf);
- write_file(file.buf, "%s/.git", relative_path(path.buf, repo.buf, &tmp));
- strbuf_reset(&file);
- strbuf_addf(&file, "%s/.git", path.buf);
- write_file(file.buf, "gitdir: %s", relative_path(repo.buf, path.buf, &tmp));
+ write_worktree_linking_files(dotgit, gitdir, use_relative_paths);
free(wt->path);
wt->path = strbuf_detach(&path, NULL);
}
strbuf_release(&path);
- strbuf_release(&repo);
- strbuf_release(&file);
- strbuf_release(&tmp);
+ strbuf_release(&dotgit);
+ strbuf_release(&gitdir);
}
int is_worktree_being_rebased(const struct worktree *wt,
@@ -577,12 +573,13 @@ int other_head_refs(each_ref_fn fn, void *cb_data)
* pointing at <repo>/worktrees/<id>.
*/
static void repair_gitfile(struct worktree *wt,
- worktree_repair_fn fn, void *cb_data)
+ worktree_repair_fn fn, void *cb_data,
+ int use_relative_paths)
{
struct strbuf dotgit = STRBUF_INIT;
+ struct strbuf gitdir = STRBUF_INIT;
struct strbuf repo = STRBUF_INIT;
struct strbuf backlink = STRBUF_INIT;
- struct strbuf tmp = STRBUF_INIT;
char *dotgit_contents = NULL;
const char *repair = NULL;
int err;
@@ -598,6 +595,7 @@ static void repair_gitfile(struct worktree *wt,
strbuf_realpath(&repo, git_common_path("worktrees/%s", wt->id), 1);
strbuf_addf(&dotgit, "%s/.git", wt->path);
+ strbuf_addf(&gitdir, "%s/gitdir", repo.buf);
dotgit_contents = xstrdup_or_null(read_gitfile_gently(dotgit.buf, &err));
if (dotgit_contents) {
@@ -615,18 +613,20 @@ static void repair_gitfile(struct worktree *wt,
repair = _(".git file broken");
else if (fspathcmp(backlink.buf, repo.buf))
repair = _(".git file incorrect");
+ else if (use_relative_paths == is_absolute_path(dotgit_contents))
+ repair = _(".git file absolute/relative path mismatch");
if (repair) {
fn(0, wt->path, repair, cb_data);
- write_file(dotgit.buf, "gitdir: %s", relative_path(repo.buf, wt->path, &tmp));
+ write_worktree_linking_files(dotgit, gitdir, use_relative_paths);
}
done:
free(dotgit_contents);
strbuf_release(&repo);
strbuf_release(&dotgit);
+ strbuf_release(&gitdir);
strbuf_release(&backlink);
- strbuf_release(&tmp);
}
static void repair_noop(int iserr UNUSED,
@@ -637,7 +637,7 @@ static void repair_noop(int iserr UNUSED,
/* nothing */
}
-void repair_worktrees(worktree_repair_fn fn, void *cb_data)
+void repair_worktrees(worktree_repair_fn fn, void *cb_data, int use_relative_paths)
{
struct worktree **worktrees = get_worktrees_internal(1);
struct worktree **wt = worktrees + 1; /* +1 skips main worktree */
@@ -645,51 +645,38 @@ void repair_worktrees(worktree_repair_fn fn, void *cb_data)
if (!fn)
fn = repair_noop;
for (; *wt; wt++)
- repair_gitfile(*wt, fn, cb_data);
+ repair_gitfile(*wt, fn, cb_data, use_relative_paths);
free_worktrees(worktrees);
}
void repair_worktree_after_gitdir_move(struct worktree *wt, const char *old_path)
{
- struct strbuf path = STRBUF_INIT;
- struct strbuf repo = STRBUF_INIT;
struct strbuf gitdir = STRBUF_INIT;
struct strbuf dotgit = STRBUF_INIT;
- struct strbuf olddotgit = STRBUF_INIT;
- struct strbuf tmp = STRBUF_INIT;
+ int is_relative_path;
if (is_main_worktree(wt))
goto done;
- strbuf_realpath(&repo, git_common_path("worktrees/%s", wt->id), 1);
- strbuf_addf(&gitdir, "%s/gitdir", repo.buf);
+ strbuf_realpath(&gitdir, git_common_path("worktrees/%s/gitdir", wt->id), 1);
- if (strbuf_read_file(&olddotgit, gitdir.buf, 0) < 0)
+ if (strbuf_read_file(&dotgit, gitdir.buf, 0) < 0)
goto done;
- strbuf_rtrim(&olddotgit);
- if (is_absolute_path(olddotgit.buf)) {
- strbuf_addbuf(&dotgit, &olddotgit);
- } else {
- strbuf_addf(&dotgit, "%s/worktrees/%s/%s", old_path, wt->id, olddotgit.buf);
+ strbuf_rtrim(&dotgit);
+ is_relative_path = ! is_absolute_path(dotgit.buf);
+ if (is_relative_path) {
+ strbuf_insertf(&dotgit, 0, "%s/worktrees/%s/", old_path, wt->id);
strbuf_realpath_forgiving(&dotgit, dotgit.buf, 0);
}
if (!file_exists(dotgit.buf))
goto done;
- strbuf_addbuf(&path, &dotgit);
- strbuf_strip_suffix(&path, "/.git");
-
- write_file(dotgit.buf, "gitdir: %s", relative_path(repo.buf, path.buf, &tmp));
- write_file(gitdir.buf, "%s", relative_path(dotgit.buf, repo.buf, &tmp));
+ write_worktree_linking_files(dotgit, gitdir, is_relative_path);
done:
- strbuf_release(&path);
- strbuf_release(&repo);
strbuf_release(&gitdir);
strbuf_release(&dotgit);
- strbuf_release(&olddotgit);
- strbuf_release(&tmp);
}
void repair_worktrees_after_gitdir_move(const char *old_path)
@@ -725,8 +712,10 @@ static int is_main_worktree_path(const char *path)
* won't know which <repo>/worktrees/<id>/gitdir to repair. However, we may
* be able to infer the gitdir by manually reading /path/to/worktree/.git,
* extracting the <id>, and checking if <repo>/worktrees/<id> exists.
+ *
+ * Returns -1 on failure and strbuf.len on success.
*/
-static int infer_backlink(const char *gitfile, struct strbuf *inferred)
+static ssize_t infer_backlink(const char *gitfile, struct strbuf *inferred)
{
struct strbuf actual = STRBUF_INIT;
const char *id;
@@ -747,12 +736,11 @@ static int infer_backlink(const char *gitfile, struct strbuf *inferred)
goto error;
strbuf_release(&actual);
- return 1;
-
+ return inferred->len;
error:
strbuf_release(&actual);
strbuf_reset(inferred); /* clear invalid path */
- return 0;
+ return -1;
}
/*
@@ -760,16 +748,14 @@ error:
* the worktree's path.
*/
void repair_worktree_at_path(const char *path,
- worktree_repair_fn fn, void *cb_data)
+ worktree_repair_fn fn, void *cb_data,
+ int use_relative_paths)
{
struct strbuf dotgit = STRBUF_INIT;
- struct strbuf realdotgit = STRBUF_INIT;
struct strbuf backlink = STRBUF_INIT;
struct strbuf inferred_backlink = STRBUF_INIT;
struct strbuf gitdir = STRBUF_INIT;
struct strbuf olddotgit = STRBUF_INIT;
- struct strbuf realolddotgit = STRBUF_INIT;
- struct strbuf tmp = STRBUF_INIT;
char *dotgit_contents = NULL;
const char *repair = NULL;
int err;
@@ -781,25 +767,25 @@ void repair_worktree_at_path(const char *path,
goto done;
strbuf_addf(&dotgit, "%s/.git", path);
- if (!strbuf_realpath(&realdotgit, dotgit.buf, 0)) {
+ if (!strbuf_realpath(&dotgit, dotgit.buf, 0)) {
fn(1, path, _("not a valid path"), cb_data);
goto done;
}
- infer_backlink(realdotgit.buf, &inferred_backlink);
+ infer_backlink(dotgit.buf, &inferred_backlink);
strbuf_realpath_forgiving(&inferred_backlink, inferred_backlink.buf, 0);
- dotgit_contents = xstrdup_or_null(read_gitfile_gently(realdotgit.buf, &err));
+ dotgit_contents = xstrdup_or_null(read_gitfile_gently(dotgit.buf, &err));
if (dotgit_contents) {
if (is_absolute_path(dotgit_contents)) {
strbuf_addstr(&backlink, dotgit_contents);
} else {
- strbuf_addbuf(&backlink, &realdotgit);
+ strbuf_addbuf(&backlink, &dotgit);
strbuf_strip_suffix(&backlink, ".git");
strbuf_addstr(&backlink, dotgit_contents);
strbuf_realpath_forgiving(&backlink, backlink.buf, 0);
}
} else if (err == READ_GITFILE_ERR_NOT_A_FILE) {
- fn(1, realdotgit.buf, _("unable to locate repository; .git is not a file"), cb_data);
+ fn(1, dotgit.buf, _("unable to locate repository; .git is not a file"), cb_data);
goto done;
} else if (err == READ_GITFILE_ERR_NOT_A_REPO) {
if (inferred_backlink.len) {
@@ -812,11 +798,11 @@ void repair_worktree_at_path(const char *path,
*/
strbuf_swap(&backlink, &inferred_backlink);
} else {
- fn(1, realdotgit.buf, _("unable to locate repository; .git file does not reference a repository"), cb_data);
+ fn(1, dotgit.buf, _("unable to locate repository; .git file does not reference a repository"), cb_data);
goto done;
}
} else {
- fn(1, realdotgit.buf, _("unable to locate repository; .git file broken"), cb_data);
+ fn(1, dotgit.buf, _("unable to locate repository; .git file broken"), cb_data);
goto done;
}
@@ -838,39 +824,35 @@ void repair_worktree_at_path(const char *path,
* in the "copy" repository. In this case, point the "copy" worktree's
* .git file at the "copy" repository.
*/
- if (inferred_backlink.len && fspathcmp(backlink.buf, inferred_backlink.buf)) {
+ if (inferred_backlink.len && fspathcmp(backlink.buf, inferred_backlink.buf))
strbuf_swap(&backlink, &inferred_backlink);
- }
strbuf_addf(&gitdir, "%s/gitdir", backlink.buf);
if (strbuf_read_file(&olddotgit, gitdir.buf, 0) < 0)
repair = _("gitdir unreadable");
+ else if (use_relative_paths == is_absolute_path(olddotgit.buf))
+ repair = _("gitdir absolute/relative path mismatch");
else {
strbuf_rtrim(&olddotgit);
- if (is_absolute_path(olddotgit.buf)) {
- strbuf_addbuf(&realolddotgit, &olddotgit);
- } else {
- strbuf_addf(&realolddotgit, "%s/%s", backlink.buf, olddotgit.buf);
- strbuf_realpath_forgiving(&realolddotgit, realolddotgit.buf, 0);
+ if (!is_absolute_path(olddotgit.buf)) {
+ strbuf_insertf(&olddotgit, 0, "%s/", backlink.buf);
+ strbuf_realpath_forgiving(&olddotgit, olddotgit.buf, 0);
}
- if (fspathcmp(realolddotgit.buf, realdotgit.buf))
+ if (fspathcmp(olddotgit.buf, dotgit.buf))
repair = _("gitdir incorrect");
}
if (repair) {
fn(0, gitdir.buf, repair, cb_data);
- write_file(gitdir.buf, "%s", relative_path(realdotgit.buf, backlink.buf, &tmp));
+ write_worktree_linking_files(dotgit, gitdir, use_relative_paths);
}
done:
free(dotgit_contents);
strbuf_release(&olddotgit);
- strbuf_release(&realolddotgit);
strbuf_release(&backlink);
strbuf_release(&inferred_backlink);
strbuf_release(&gitdir);
- strbuf_release(&realdotgit);
strbuf_release(&dotgit);
- strbuf_release(&tmp);
}
int should_prune_worktree(const char *id, struct strbuf *reason, char **wtpath, timestamp_t expire)
@@ -1031,3 +1013,38 @@ cleanup:
free(main_worktree_file);
return res;
}
+
+void write_worktree_linking_files(struct strbuf dotgit, struct strbuf gitdir,
+ int use_relative_paths)
+{
+ struct strbuf path = STRBUF_INIT;
+ struct strbuf repo = STRBUF_INIT;
+ struct strbuf tmp = STRBUF_INIT;
+
+ strbuf_addbuf(&path, &dotgit);
+ strbuf_strip_suffix(&path, "/.git");
+ strbuf_realpath(&path, path.buf, 1);
+ strbuf_addbuf(&repo, &gitdir);
+ strbuf_strip_suffix(&repo, "/gitdir");
+ strbuf_realpath(&repo, repo.buf, 1);
+
+ if (use_relative_paths && !the_repository->repository_format_relative_worktrees) {
+ if (upgrade_repository_format(1) < 0)
+ die(_("unable to upgrade repository format to support relative worktrees"));
+ if (git_config_set_gently("extensions.relativeWorktrees", "true"))
+ die(_("unable to set extensions.relativeWorktrees setting"));
+ the_repository->repository_format_relative_worktrees = 1;
+ }
+
+ if (use_relative_paths) {
+ write_file(gitdir.buf, "%s/.git", relative_path(path.buf, repo.buf, &tmp));
+ write_file(dotgit.buf, "gitdir: %s", relative_path(repo.buf, path.buf, &tmp));
+ } else {
+ write_file(gitdir.buf, "%s/.git", path.buf);
+ write_file(dotgit.buf, "gitdir: %s", repo.buf);
+ }
+
+ strbuf_release(&path);
+ strbuf_release(&repo);
+ strbuf_release(&tmp);
+}
diff --git a/worktree.h b/worktree.h
index e961186216..38145df80f 100644
--- a/worktree.h
+++ b/worktree.h
@@ -117,8 +117,8 @@ int validate_worktree(const struct worktree *wt,
/*
* Update worktrees/xxx/gitdir with the new path.
*/
-void update_worktree_location(struct worktree *wt,
- const char *path_);
+void update_worktree_location(struct worktree *wt, const char *path_,
+ int use_relative_paths);
typedef void (* worktree_repair_fn)(int iserr, const char *path,
const char *msg, void *cb_data);
@@ -129,7 +129,7 @@ typedef void (* worktree_repair_fn)(int iserr, const char *path,
* function, if non-NULL, is called with the path of the worktree and a
* description of the repair or error, along with the callback user-data.
*/
-void repair_worktrees(worktree_repair_fn, void *cb_data);
+void repair_worktrees(worktree_repair_fn, void *cb_data, int use_relative_paths);
/*
* Repair the linked worktrees after the gitdir has been moved.
@@ -151,7 +151,8 @@ void repair_worktree_after_gitdir_move(struct worktree *wt, const char *old_path
* worktree and a description of the repair or error, along with the callback
* user-data.
*/
-void repair_worktree_at_path(const char *, worktree_repair_fn, void *cb_data);
+void repair_worktree_at_path(const char *, worktree_repair_fn,
+ void *cb_data, int use_relative_paths);
/*
* Free up the memory for a worktree.
@@ -215,4 +216,17 @@ void strbuf_worktree_ref(const struct worktree *wt,
*/
int init_worktree_config(struct repository *r);
+/**
+ * Write the .git file and gitdir file that links the worktree to the repository.
+ *
+ * The `dotgit` parameter is the path to the worktree's .git file, and `gitdir`
+ * is the path to the repository's `gitdir` file.
+ *
+ * Example
+ * dotgit: "/path/to/foo/.git"
+ * gitdir: "/path/to/repo/worktrees/foo/gitdir"
+ */
+void write_worktree_linking_files(struct strbuf dotgit, struct strbuf gitdir,
+ int use_relative_paths);
+
#endif
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
deleted file mode 100644
index 95851b85b6..0000000000
--- a/wrap-for-bin.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-# wrap-for-bin.sh: Template for git executable wrapper scripts
-# to run test suite against sandbox, but with only bindir-installed
-# executables in PATH. The Makefile copies this into various
-# files in bin-wrappers, substituting
-# @@BUILD_DIR@@ and @@PROG@@.
-
-GIT_EXEC_PATH='@@BUILD_DIR@@'
-if test -n "$NO_SET_GIT_TEMPLATE_DIR"
-then
- unset GIT_TEMPLATE_DIR
-else
- GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
- export GIT_TEMPLATE_DIR
-fi
-GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}"
-GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale'
-PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
-
-export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
-
-case "$GIT_DEBUGGER" in
-'')
- exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
- ;;
-1)
- unset GIT_DEBUGGER
- exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
- ;;
-*)
- GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
- unset GIT_DEBUGGER
- exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
- ;;
-esac