summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes22
-rw-r--r--.github/workflows/check-whitespace.yml63
-rw-r--r--.github/workflows/l10n.yml6
-rw-r--r--.github/workflows/main.yml54
-rw-r--r--.gitignore8
-rw-r--r--.mailmap2
-rw-r--r--Documentation/.gitignore1
-rw-r--r--Documentation/CodingGuidelines24
-rw-r--r--Documentation/Makefile40
-rw-r--r--Documentation/MyFirstContribution.txt18
-rw-r--r--Documentation/RelNotes/2.30.8.txt1
-rw-r--r--Documentation/RelNotes/2.39.0.txt346
-rw-r--r--Documentation/RelNotes/2.39.1.txt5
-rw-r--r--Documentation/RelNotes/2.39.2.txt7
-rw-r--r--Documentation/RelNotes/2.39.3.txt64
-rw-r--r--Documentation/RelNotes/2.40.0.txt320
-rw-r--r--Documentation/RelNotes/2.40.1.txt8
-rw-r--r--Documentation/RelNotes/2.41.0.txt348
-rw-r--r--Documentation/SubmittingPatches2
-rw-r--r--Documentation/asciidoc.conf19
-rw-r--r--Documentation/blame-options.txt8
-rwxr-xr-xDocumentation/build-docdep.perl5
-rw-r--r--Documentation/config.txt4
-rw-r--r--Documentation/config/add.txt7
-rw-r--r--Documentation/config/advice.txt2
-rw-r--r--Documentation/config/bundle.txt31
-rw-r--r--Documentation/config/core.txt2
-rw-r--r--Documentation/config/difftool.txt7
-rw-r--r--Documentation/config/feature.txt5
-rw-r--r--Documentation/config/fetch.txt24
-rw-r--r--Documentation/config/format.txt14
-rw-r--r--Documentation/config/fsck.txt4
-rw-r--r--Documentation/config/fsmonitor--daemon.txt11
-rw-r--r--Documentation/config/gc.txt12
-rw-r--r--Documentation/config/gpg.txt3
-rw-r--r--Documentation/config/index.txt11
-rw-r--r--Documentation/config/mergetool.txt7
-rw-r--r--Documentation/config/pack.txt8
-rw-r--r--Documentation/config/push.txt14
-rw-r--r--Documentation/config/rebase.txt10
-rw-r--r--Documentation/config/sendemail.txt1
-rw-r--r--Documentation/config/transfer.txt6
-rw-r--r--Documentation/diff-generate-patch.txt1
-rw-r--r--Documentation/diff-options.txt13
-rwxr-xr-xDocumentation/doc-diff2
-rw-r--r--Documentation/fsck-msgids.txt173
-rw-r--r--Documentation/git-add.txt6
-rw-r--r--Documentation/git-am.txt15
-rw-r--r--Documentation/git-annotate.txt2
-rw-r--r--Documentation/git-apply.txt2
-rw-r--r--Documentation/git-archive.txt5
-rw-r--r--Documentation/git-bisect-lk2009.txt4
-rw-r--r--Documentation/git-blame.txt2
-rw-r--r--Documentation/git-branch.txt10
-rw-r--r--Documentation/git-bundle.txt26
-rw-r--r--Documentation/git-cat-file.txt58
-rw-r--r--Documentation/git-check-attr.txt9
-rw-r--r--Documentation/git-checkout.txt74
-rw-r--r--Documentation/git-cherry-pick.txt2
-rw-r--r--Documentation/git-clean.txt10
-rw-r--r--Documentation/git-clone.txt5
-rw-r--r--Documentation/git-commit-graph.txt5
-rw-r--r--Documentation/git-credential-cache--daemon.txt4
-rw-r--r--Documentation/git-credential-cache.txt15
-rw-r--r--Documentation/git-credential.txt33
-rw-r--r--Documentation/git-diff-files.txt2
-rw-r--r--Documentation/git-diff.txt8
-rw-r--r--Documentation/git-difftool.txt10
-rw-r--r--Documentation/git-fast-export.txt2
-rw-r--r--Documentation/git-fetch.txt8
-rw-r--r--Documentation/git-for-each-ref.txt16
-rw-r--r--Documentation/git-format-patch.txt7
-rw-r--r--Documentation/git-fsck.txt12
-rw-r--r--Documentation/git-fsmonitor--daemon.txt37
-rw-r--r--Documentation/git-gc.txt12
-rw-r--r--Documentation/git-hash-object.txt3
-rw-r--r--Documentation/git-hook.txt7
-rw-r--r--Documentation/git-interpret-trailers.txt102
-rw-r--r--Documentation/git-ls-files.txt83
-rw-r--r--Documentation/git-ls-remote.txt19
-rw-r--r--Documentation/git-maintenance.txt20
-rw-r--r--Documentation/git-merge-base.txt4
-rw-r--r--Documentation/git-merge-tree.txt92
-rw-r--r--Documentation/git-merge.txt3
-rw-r--r--Documentation/git-mergetool.txt9
-rw-r--r--Documentation/git-mv.txt4
-rw-r--r--Documentation/git-pack-redundant.txt18
-rw-r--r--Documentation/git-patch-id.txt24
-rw-r--r--Documentation/git-prune-packed.txt2
-rw-r--r--Documentation/git-push.txt6
-rw-r--r--Documentation/git-read-tree.txt4
-rw-r--r--Documentation/git-rebase.txt131
-rw-r--r--Documentation/git-receive-pack.txt4
-rw-r--r--Documentation/git-reflog.txt17
-rw-r--r--Documentation/git-repack.txt6
-rw-r--r--Documentation/git-rerere.txt2
-rw-r--r--Documentation/git-reset.txt3
-rw-r--r--Documentation/git-rev-list.txt2
-rw-r--r--Documentation/git-rev-parse.txt8
-rw-r--r--Documentation/git-revert.txt2
-rw-r--r--Documentation/git-send-email.txt36
-rw-r--r--Documentation/git-send-pack.txt5
-rw-r--r--Documentation/git-shortlog.txt8
-rw-r--r--Documentation/git-show-branch.txt4
-rw-r--r--Documentation/git-show-ref.txt4
-rw-r--r--Documentation/git-sparse-checkout.txt25
-rw-r--r--Documentation/git-stash.txt17
-rw-r--r--Documentation/git-status.txt62
-rw-r--r--Documentation/git-symbolic-ref.txt11
-rw-r--r--Documentation/git-tag.txt22
-rw-r--r--Documentation/git-update-server-info.txt8
-rw-r--r--Documentation/git-upload-archive.txt4
-rw-r--r--Documentation/git-var.txt13
-rw-r--r--Documentation/git-verify-commit.txt2
-rw-r--r--Documentation/git-verify-pack.txt2
-rw-r--r--Documentation/git-verify-tag.txt2
-rw-r--r--Documentation/git-worktree.txt3
-rw-r--r--Documentation/git.txt16
-rw-r--r--Documentation/gitattributes.txt92
-rw-r--r--Documentation/gitcredentials.txt18
-rw-r--r--Documentation/gitformat-commit-graph.txt6
-rw-r--r--Documentation/gitformat-index.txt4
-rw-r--r--Documentation/gitformat-pack.txt4
-rw-r--r--Documentation/gitformat-signature.txt24
-rw-r--r--Documentation/githooks.txt61
-rw-r--r--Documentation/gitignore.txt4
-rw-r--r--Documentation/gitprotocol-v2.txt201
-rw-r--r--Documentation/gittutorial.txt129
-rw-r--r--Documentation/glossary-content.txt27
-rw-r--r--Documentation/howto/coordinate-embargoed-releases.txt165
-rw-r--r--Documentation/howto/maintain-git.txt11
-rw-r--r--Documentation/howto/new-command.txt4
-rwxr-xr-xDocumentation/lint-fsck-msgids.perl70
-rw-r--r--Documentation/manpage-base-url.xsl.in10
-rw-r--r--Documentation/manpage-normal.xsl16
-rw-r--r--Documentation/manpage-quote-apos.xsl16
-rw-r--r--Documentation/pretty-formats.txt32
-rw-r--r--Documentation/rev-list-options.txt27
-rw-r--r--Documentation/revisions.txt5
-rw-r--r--Documentation/technical/api-trace2.txt190
-rw-r--r--Documentation/technical/bundle-uri.txt8
-rw-r--r--Documentation/technical/commit-graph.txt8
-rw-r--r--Documentation/technical/hash-function-transition.txt2
-rw-r--r--Documentation/technical/parallel-checkout.txt2
-rw-r--r--Documentation/technical/repository-version.txt4
-rw-r--r--Documentation/technical/rerere.txt2
-rw-r--r--Documentation/technical/sparse-checkout.txt1103
-rw-r--r--Documentation/urls-remotes.txt4
-rwxr-xr-xGIT-VERSION-GEN2
-rw-r--r--INSTALL6
-rw-r--r--Makefile465
l---------RelNotes2
-rw-r--r--abspath.c11
-rw-r--r--abspath.h33
-rw-r--r--add-interactive.c24
-rw-r--r--add-patch.c14
-rw-r--r--advice.c13
-rw-r--r--advice.h3
-rw-r--r--alias.c22
-rw-r--r--alias.h3
-rw-r--r--alloc.c3
-rw-r--r--alloc.h75
-rw-r--r--apply.c61
-rw-r--r--apply.h2
-rw-r--r--archive-tar.c8
-rw-r--r--archive-zip.c6
-rw-r--r--archive.c110
-rw-r--r--archive.h4
-rw-r--r--attr.c105
-rw-r--r--attr.h8
-rw-r--r--banned.h4
-rw-r--r--base85.c3
-rw-r--r--base85.h7
-rw-r--r--bisect.c32
-rw-r--r--blame.c68
-rw-r--r--blame.h1
-rw-r--r--blob.c5
-rw-r--r--blob.h3
-rw-r--r--bloom.c1
-rw-r--r--branch.c53
-rw-r--r--branch.h8
-rw-r--r--builtin.h16
-rw-r--r--builtin/add.c90
-rw-r--r--builtin/am.c130
-rw-r--r--builtin/apply.c2
-rw-r--r--builtin/archive.c5
-rw-r--r--builtin/bisect.c (renamed from builtin/bisect--helper.c)442
-rw-r--r--builtin/blame.c47
-rw-r--r--builtin/branch.c207
-rw-r--r--builtin/bugreport.c19
-rw-r--r--builtin/bundle.c98
-rw-r--r--builtin/cat-file.c75
-rw-r--r--builtin/check-attr.c45
-rw-r--r--builtin/check-ignore.c7
-rw-r--r--builtin/check-mailmap.c3
-rw-r--r--builtin/check-ref-format.c3
-rw-r--r--builtin/checkout--worker.c2
-rw-r--r--builtin/checkout-index.c22
-rw-r--r--builtin/checkout.c162
-rw-r--r--builtin/clean.c15
-rw-r--r--builtin/clone.c114
-rw-r--r--builtin/column.c1
-rw-r--r--builtin/commit-graph.c25
-rw-r--r--builtin/commit-tree.c22
-rw-r--r--builtin/commit.c134
-rw-r--r--builtin/config.c52
-rw-r--r--builtin/count-objects.c8
-rw-r--r--builtin/credential-cache--daemon.c14
-rw-r--r--builtin/credential-cache.c4
-rw-r--r--builtin/credential-store.c3
-rw-r--r--builtin/credential.c2
-rw-r--r--builtin/describe.c28
-rw-r--r--builtin/diagnose.c6
-rw-r--r--builtin/diff-files.c6
-rw-r--r--builtin/diff-index.c13
-rw-r--r--builtin/diff-tree.c13
-rw-r--r--builtin/diff.c65
-rw-r--r--builtin/difftool.c57
-rw-r--r--builtin/fast-export.c96
-rw-r--r--builtin/fast-import.c36
-rw-r--r--builtin/fetch-pack.c10
-rw-r--r--builtin/fetch.c359
-rw-r--r--builtin/fmt-merge-msg.c2
-rw-r--r--builtin/for-each-ref.c34
-rw-r--r--builtin/for-each-repo.c24
-rw-r--r--builtin/fsck.c170
-rw-r--r--builtin/fsmonitor--daemon.c24
-rw-r--r--builtin/gc.c219
-rw-r--r--builtin/get-tar-commit-id.c7
-rw-r--r--builtin/grep.c61
-rw-r--r--builtin/hash-object.c12
-rw-r--r--builtin/help.c6
-rw-r--r--builtin/hook.c5
-rw-r--r--builtin/index-pack.c26
-rw-r--r--builtin/init-db.c13
-rw-r--r--builtin/interpret-trailers.c5
-rw-r--r--builtin/log.c91
-rw-r--r--builtin/ls-files.c14
-rw-r--r--builtin/ls-remote.c8
-rw-r--r--builtin/ls-tree.c274
-rw-r--r--builtin/mailinfo.c3
-rw-r--r--builtin/mailsplit.c3
-rw-r--r--builtin/merge-base.c14
-rw-r--r--builtin/merge-file.c3
-rw-r--r--builtin/merge-index.c24
-rw-r--r--builtin/merge-ours.c5
-rw-r--r--builtin/merge-recursive.c13
-rw-r--r--builtin/merge-tree.c121
-rw-r--r--builtin/merge.c143
-rw-r--r--builtin/mktag.c8
-rw-r--r--builtin/mktree.c3
-rw-r--r--builtin/multi-pack-index.c3
-rw-r--r--builtin/mv.c57
-rw-r--r--builtin/name-rev.c55
-rw-r--r--builtin/notes.c46
-rw-r--r--builtin/pack-objects.c124
-rw-r--r--builtin/pack-redundant.c7
-rw-r--r--builtin/pack-refs.c3
-rw-r--r--builtin/patch-id.c115
-rw-r--r--builtin/prune-packed.c1
-rw-r--r--builtin/prune.c18
-rw-r--r--builtin/pull.c169
-rw-r--r--builtin/push.c57
-rw-r--r--builtin/range-diff.c16
-rw-r--r--builtin/read-tree.c38
-rw-r--r--builtin/rebase.c582
-rw-r--r--builtin/receive-pack.c71
-rw-r--r--builtin/reflog.c5
-rw-r--r--builtin/remote-ext.c8
-rw-r--r--builtin/remote-fd.c4
-rw-r--r--builtin/remote.c45
-rw-r--r--builtin/repack.c282
-rw-r--r--builtin/replace.c27
-rw-r--r--builtin/rerere.c7
-rw-r--r--builtin/reset.c74
-rw-r--r--builtin/rev-list.c24
-rw-r--r--builtin/rev-parse.c48
-rw-r--r--builtin/revert.c48
-rw-r--r--builtin/rm.c43
-rw-r--r--builtin/send-pack.c8
-rw-r--r--builtin/shortlog.c101
-rw-r--r--builtin/show-branch.c29
-rw-r--r--builtin/show-index.c4
-rw-r--r--builtin/show-ref.c13
-rw-r--r--builtin/sparse-checkout.c147
-rw-r--r--builtin/stash.c189
-rw-r--r--builtin/stripspace.c3
-rw-r--r--builtin/submodule--helper.c297
-rw-r--r--builtin/symbolic-ref.c22
-rw-r--r--builtin/tag.c43
-rw-r--r--builtin/unpack-file.c12
-rw-r--r--builtin/unpack-objects.c12
-rw-r--r--builtin/update-index.c110
-rw-r--r--builtin/update-ref.c12
-rw-r--r--builtin/update-server-info.c4
-rw-r--r--builtin/upload-archive.c5
-rw-r--r--builtin/upload-pack.c5
-rw-r--r--builtin/var.c38
-rw-r--r--builtin/verify-commit.c16
-rw-r--r--builtin/verify-pack.c3
-rw-r--r--builtin/verify-tag.c16
-rw-r--r--builtin/worktree.c145
-rw-r--r--builtin/write-tree.c12
-rw-r--r--bulk-checkin.c10
-rw-r--r--bulk-checkin.h2
-rw-r--r--bundle-uri.c798
-rw-r--r--bundle-uri.h156
-rw-r--r--bundle.c108
-rw-r--r--bundle.h16
-rw-r--r--cache-tree.c27
-rw-r--r--cache-tree.h16
-rw-r--r--cache.h1413
-rw-r--r--cbtree.c1
-rw-r--r--cbtree.h2
-rw-r--r--chdir-notify.c5
-rw-r--r--checkout.c7
-rw-r--r--checkout.h2
-rw-r--r--chunk-format.c6
-rw-r--r--chunk-format.h3
-rwxr-xr-xci/lib.sh7
-rwxr-xr-xci/run-build-and-tests.sh3
-rw-r--r--color.c7
-rw-r--r--column.c3
-rw-r--r--combine-diff.c18
-rw-r--r--commit-graph.c220
-rw-r--r--commit-graph.h9
-rw-r--r--commit-reach.c252
-rw-r--r--commit-reach.h49
-rw-r--r--commit-slab-impl.h2
-rw-r--r--commit.c145
-rw-r--r--commit.h49
-rw-r--r--common-main.c8
-rw-r--r--compat/disk.h2
-rw-r--r--compat/fsmonitor/fsm-darwin-gcc.h4
-rw-r--r--compat/fsmonitor/fsm-health-darwin.c2
-rw-r--r--compat/fsmonitor/fsm-health-win32.c1
-rw-r--r--compat/fsmonitor/fsm-ipc-darwin.c55
-rw-r--r--compat/fsmonitor/fsm-ipc-win32.c11
-rw-r--r--compat/fsmonitor/fsm-listen-darwin.c55
-rw-r--r--compat/fsmonitor/fsm-listen-win32.c2
-rw-r--r--compat/fsmonitor/fsm-path-utils-darwin.c136
-rw-r--r--compat/fsmonitor/fsm-path-utils-win32.c146
-rw-r--r--compat/fsmonitor/fsm-settings-darwin.c78
-rw-r--r--compat/fsmonitor/fsm-settings-win32.c174
-rw-r--r--compat/linux/procinfo.c2
-rw-r--r--compat/mingw.c30
-rw-r--r--compat/nonblock.c2
-rw-r--r--compat/pread.c1
-rw-r--r--compat/precompose_utf8.c3
-rw-r--r--compat/regcomp_enhanced.c9
-rw-r--r--compat/simple-ipc/ipc-shared.c2
-rw-r--r--compat/simple-ipc/ipc-unix-socket.c4
-rw-r--r--compat/simple-ipc/ipc-win32.c4
-rw-r--r--compat/terminal.c4
-rw-r--r--compat/win32/pthread.c25
-rw-r--r--compat/win32/pthread.h2
-rw-r--r--compat/win32/trace2_win32_process_info.c2
-rw-r--r--compat/winansi.c2
-rw-r--r--config.c754
-rw-r--r--config.h81
-rw-r--r--config.mak.uname87
-rw-r--r--connect.c111
-rw-r--r--connect.h9
-rw-r--r--connected.c17
-rw-r--r--connected.h7
-rw-r--r--contrib/buildsystems/CMakeLists.txt22
-rw-r--r--contrib/coccinelle/.gitignore2
-rw-r--r--contrib/coccinelle/README49
-rw-r--r--contrib/coccinelle/array.cocci7
-rw-r--r--contrib/coccinelle/hashmap.cocci2
-rw-r--r--contrib/coccinelle/index-compatibility.cocci157
-rw-r--r--contrib/coccinelle/preincr.cocci2
-rwxr-xr-xcontrib/coccinelle/spatchcache304
-rw-r--r--contrib/coccinelle/strbuf.cocci2
-rw-r--r--contrib/coccinelle/swap.cocci2
-rw-r--r--contrib/coccinelle/the_repository.cocci123
-rw-r--r--contrib/coccinelle/the_repository.pending.cocci129
-rw-r--r--contrib/completion/git-completion.bash26
-rw-r--r--contrib/completion/git-prompt.sh21
-rw-r--r--contrib/credential/gnome-keyring/.gitignore1
-rw-r--r--contrib/credential/gnome-keyring/Makefile25
-rw-r--r--contrib/credential/gnome-keyring/git-credential-gnome-keyring.c470
-rw-r--r--contrib/credential/libsecret/.gitignore1
-rw-r--r--contrib/credential/libsecret/git-credential-libsecret.c15
-rwxr-xr-xcontrib/credential/netrc/git-credential-netrc.perl5
-rw-r--r--contrib/credential/osxkeychain/git-credential-osxkeychain.c15
-rw-r--r--contrib/credential/wincred/git-credential-wincred.c114
-rw-r--r--contrib/git-jump/README10
-rwxr-xr-xcontrib/git-jump/git-jump45
-rwxr-xr-xcontrib/subtree/git-subtree.sh177
-rw-r--r--contrib/subtree/git-subtree.txt16
-rw-r--r--contrib/subtree/t/Makefile4
-rwxr-xr-xcontrib/subtree/t/t7900-subtree.sh60
-rw-r--r--convert.c13
-rw-r--r--convert.h2
-rw-r--r--copy.c5
-rw-r--r--copy.h10
-rw-r--r--credential.c36
-rw-r--r--credential.h19
-rw-r--r--csum-file.c18
-rw-r--r--csum-file.h11
-rw-r--r--daemon.c11
-rw-r--r--date.c62
-rw-r--r--date.h1
-rw-r--r--decorate.c3
-rw-r--r--delta-islands.c97
-rw-r--r--delta-islands.h1
-rwxr-xr-xdetect-compiler10
-rw-r--r--diagnose.c9
-rw-r--r--diagnose.h3
-rw-r--r--diff-lib.c9
-rw-r--r--diff-merges.c2
-rw-r--r--diff-no-index.c8
-rw-r--r--diff.c370
-rw-r--r--diff.h16
-rw-r--r--diffcore-break.c2
-rw-r--r--diffcore-delta.c2
-rw-r--r--diffcore-order.c3
-rw-r--r--diffcore-pickaxe.c8
-rw-r--r--diffcore-rename.c11
-rw-r--r--diffcore-rotate.c3
-rw-r--r--diffcore.h5
-rw-r--r--dir-iterator.c15
-rw-r--r--dir-iterator.h20
-rw-r--r--dir.c146
-rw-r--r--dir.h142
-rw-r--r--editor.c38
-rw-r--r--editor.h34
-rw-r--r--entry.c20
-rw-r--r--entry.h10
-rw-r--r--environment.c26
-rw-r--r--environment.h220
-rw-r--r--ewah/bitmap.c3
-rw-r--r--ewah/ewah_bitmap.c2
-rw-r--r--exec-cmd.c8
-rw-r--r--fetch-pack.c35
-rw-r--r--fmt-merge-msg.c25
-rw-r--r--fsck.c105
-rw-r--r--fsck.h17
-rw-r--r--fsmonitor--daemon.h4
-rw-r--r--fsmonitor-ipc.c30
-rw-r--r--fsmonitor-ipc.h4
-rw-r--r--fsmonitor-path-utils.h60
-rw-r--r--fsmonitor-settings.c85
-rw-r--r--fsmonitor-settings.h4
-rw-r--r--fsmonitor.c13
-rw-r--r--fsmonitor.h3
-rw-r--r--gettext.c6
-rwxr-xr-xgit-add--interactive.perl1920
-rwxr-xr-xgit-bisect.sh84
-rw-r--r--git-compat-util.h89
-rwxr-xr-xgit-difftool--helper.sh5
-rw-r--r--git-gui/Makefile2
-rw-r--r--git-mergetool--lib.sh40
-rwxr-xr-xgit-mergetool.sh9
-rwxr-xr-xgit-request-pull.sh2
-rwxr-xr-xgit-send-email.perl215
-rwxr-xr-xgit-submodule.sh6
-rw-r--r--git-zlib.c (renamed from zlib.c)3
-rw-r--r--git-zlib.h28
-rw-r--r--git.c84
-rwxr-xr-xgitk-git/gitk36
-rw-r--r--gpg-interface.c49
-rw-r--r--gpg-interface.h1
-rw-r--r--graph.c3
-rw-r--r--grep.c95
-rw-r--r--grep.h4
-rw-r--r--hash-ll.h276
-rw-r--r--hash-lookup.c1
-rw-r--r--hash.h240
-rw-r--r--hashmap.c2
-rw-r--r--hashmap.h4
-rw-r--r--help.c11
-rw-r--r--hex.c4
-rw-r--r--hex.h84
-rw-r--r--hook.c46
-rw-r--r--hook.h5
-rw-r--r--http-backend.c25
-rw-r--r--http-fetch.c8
-rw-r--r--http-push.c25
-rw-r--r--http-walker.c18
-rw-r--r--http.c173
-rw-r--r--http.h4
-rw-r--r--ident.c5
-rw-r--r--ident.h67
-rw-r--r--imap-send.c5
-rw-r--r--json-writer.c2
-rw-r--r--khash.h2
-rw-r--r--kwset.c2
-rw-r--r--levenshtein.c2
-rw-r--r--line-log.c15
-rw-r--r--line-log.h1
-rw-r--r--line-range.c7
-rw-r--r--linear-assignment.c2
-rw-r--r--list-objects-filter-options.c16
-rw-r--r--list-objects-filter-options.h25
-rw-r--r--list-objects-filter.c38
-rw-r--r--list-objects.c57
-rw-r--r--ll-merge.c34
-rw-r--r--lockfile.c4
-rw-r--r--log-tree.c41
-rw-r--r--ls-refs.c60
-rw-r--r--mailinfo.c8
-rw-r--r--mailmap.c51
-rw-r--r--mailmap.h3
-rw-r--r--match-trees.c8
-rw-r--r--match-trees.h10
-rw-r--r--mem-pool.c2
-rw-r--r--merge-blobs.c8
-rw-r--r--merge-ort-wrappers.c3
-rw-r--r--merge-ort.c60
-rw-r--r--merge-ort.h2
-rw-r--r--merge-recursive.c22
-rw-r--r--merge.c21
-rw-r--r--midx.c49
-rw-r--r--name-hash.c3
-rw-r--r--negotiator/default.c48
-rw-r--r--negotiator/noop.c2
-rw-r--r--negotiator/skipping.c45
-rw-r--r--notes-cache.c8
-rw-r--r--notes-merge.c20
-rw-r--r--notes-utils.c7
-rw-r--r--notes.c40
-rw-r--r--object-file.c284
-rw-r--r--object-file.h131
-rw-r--r--object-name.c46
-rw-r--r--object-name.h121
-rw-r--r--object-store.h165
-rw-r--r--object.c13
-rw-r--r--object.h67
-rw-r--r--oid-array.c3
-rw-r--r--oidmap.c3
-rw-r--r--oidmap.h1
-rw-r--r--oidset.c4
-rw-r--r--oidtree.c1
-rw-r--r--oidtree.h2
-rw-r--r--oss-fuzz/.gitignore3
-rw-r--r--oss-fuzz/fuzz-commit-graph.c (renamed from fuzz-commit-graph.c)1
-rw-r--r--oss-fuzz/fuzz-pack-headers.c (renamed from fuzz-pack-headers.c)1
-rw-r--r--oss-fuzz/fuzz-pack-idx.c (renamed from fuzz-pack-idx.c)1
-rw-r--r--pack-bitmap-write.c20
-rw-r--r--pack-bitmap.c130
-rw-r--r--pack-bitmap.h2
-rw-r--r--pack-check.c5
-rw-r--r--pack-mtimes.c2
-rw-r--r--pack-mtimes.h2
-rw-r--r--pack-objects.c3
-rw-r--r--pack-revindex.c60
-rw-r--r--pack-revindex.h22
-rw-r--r--pack-write.c23
-rw-r--r--pack.h2
-rw-r--r--packfile.c54
-rw-r--r--packfile.h17
-rw-r--r--pager.c6
-rw-r--r--pager.h17
-rw-r--r--parallel-checkout.c6
-rw-r--r--parse-options-cb.c40
-rw-r--r--parse-options.c19
-rw-r--r--parse-options.h334
-rw-r--r--patch-ids.c13
-rw-r--r--patch-ids.h2
-rw-r--r--path.c19
-rw-r--r--path.h62
-rw-r--r--pathspec.c16
-rw-r--r--pathspec.h5
-rw-r--r--perl/Git.pm36
-rw-r--r--pkt-line.c8
-rw-r--r--pkt-line.h3
-rw-r--r--po/bg.po1646
-rw-r--r--po/ca.po2016
-rw-r--r--po/de.po1961
-rw-r--r--po/fr.po1629
-rw-r--r--po/id.po1970
-rw-r--r--po/sv.po1519
-rw-r--r--po/tr.po1599
-rw-r--r--po/zh_CN.po1961
-rw-r--r--po/zh_TW.po2161
-rw-r--r--preload-index.c4
-rw-r--r--pretty.c20
-rw-r--r--pretty.h8
-rw-r--r--prio-queue.c3
-rw-r--r--progress.c8
-rw-r--r--promisor-remote.c28
-rw-r--r--promisor-remote.h26
-rw-r--r--prompt.c3
-rw-r--r--protocol-caps.c6
-rw-r--r--protocol.c4
-rw-r--r--protocol.h21
-rw-r--r--prune-packed.c3
-rw-r--r--quote.c5
-rw-r--r--quote.h2
-rw-r--r--range-diff.c35
-rw-r--r--reachable.c19
-rw-r--r--read-cache.c213
-rw-r--r--rebase-interactive.c10
-rw-r--r--rebase.c1
-rw-r--r--ref-filter.c240
-rw-r--r--ref-filter.h30
-rw-r--r--reflog-walk.c5
-rw-r--r--reflog-walk.h2
-rw-r--r--reflog.c29
-rw-r--r--refs.c206
-rw-r--r--refs.h51
-rw-r--r--refs/debug.c4
-rw-r--r--refs/files-backend.c92
-rw-r--r--refs/iterator.c2
-rw-r--r--refs/packed-backend.c13
-rw-r--r--refs/ref-cache.c5
-rw-r--r--refs/ref-cache.h3
-rw-r--r--refs/refs-internal.h1
-rw-r--r--refspec.c7
-rw-r--r--reftable/dump.c2
-rw-r--r--reftable/error.c1
-rw-r--r--reftable/publicbasics.c2
-rw-r--r--reftable/system.h2
-rw-r--r--reftable/tree.c2
-rw-r--r--reftable/tree_test.c1
-rw-r--r--remote-curl.c16
-rw-r--r--remote.c25
-rw-r--r--remote.h8
-rw-r--r--replace-object.c4
-rw-r--r--replace-object.h8
-rw-r--r--repo-settings.c8
-rw-r--r--repository.c18
-rw-r--r--repository.h3
-rw-r--r--rerere.c12
-rw-r--r--rerere.h4
-rw-r--r--reset.c8
-rw-r--r--reset.h2
-rw-r--r--resolve-undo.c1
-rw-r--r--resolve-undo.h7
-rw-r--r--revision.c224
-rw-r--r--revision.h69
-rw-r--r--run-command.c297
-rw-r--r--run-command.h105
-rw-r--r--scalar.c92
-rw-r--r--send-pack.c18
-rw-r--r--sequencer.c505
-rw-r--r--sequencer.h21
-rw-r--r--serve.c21
-rw-r--r--server-info.c8
-rw-r--r--server-info.h7
-rw-r--r--setup.c10
-rw-r--r--setup.h168
-rw-r--r--sha1dc_git.c4
-rw-r--r--sha1dc_git.h1
-rw-r--r--shallow.c25
-rw-r--r--shallow.h2
-rw-r--r--shared.mak12
-rw-r--r--shell.c19
-rw-r--r--shortlog.h5
-rw-r--r--sideband.c5
-rw-r--r--sigchain.c3
-rw-r--r--sparse-index.c48
-rw-r--r--split-index.c8
-rw-r--r--split-index.h2
-rw-r--r--statinfo.h24
-rw-r--r--strbuf.c38
-rw-r--r--strbuf.h33
-rw-r--r--streaming.c17
-rw-r--r--streaming.h4
-rw-r--r--string-list.c18
-rw-r--r--string-list.h19
-rw-r--r--strvec.c4
-rw-r--r--sub-process.c1
-rw-r--r--sub-process.h1
-rw-r--r--submodule-config.c15
-rw-r--r--submodule-config.h1
-rw-r--r--submodule.c132
-rw-r--r--submodule.h8
-rw-r--r--symlinks.c5
-rw-r--r--symlinks.h28
-rw-r--r--t/Makefile10
-rw-r--r--t/README6
-rwxr-xr-xt/aggregate-results.sh2
-rw-r--r--t/annotate-tests.sh21
-rwxr-xr-xt/chainlint.pl188
-rw-r--r--t/chainlint/block-comment.expect2
-rw-r--r--t/chainlint/case-comment.expect3
-rw-r--r--t/chainlint/close-subshell.expect3
-rw-r--r--t/chainlint/comment.expect4
-rw-r--r--t/chainlint/double-here-doc.expect14
-rw-r--r--t/chainlint/empty-here-doc.expect3
-rw-r--r--t/chainlint/for-loop.expect4
-rw-r--r--t/chainlint/here-doc-close-subshell.expect4
-rw-r--r--t/chainlint/here-doc-indent-operator.expect10
-rw-r--r--t/chainlint/here-doc-multi-line-command-subst.expect5
-rw-r--r--t/chainlint/here-doc-multi-line-string.expect4
-rw-r--r--t/chainlint/here-doc.expect24
-rw-r--r--t/chainlint/if-then-else.expect4
-rw-r--r--t/chainlint/incomplete-line.expect10
-rw-r--r--t/chainlint/inline-comment.expect4
-rw-r--r--t/chainlint/loop-detect-status.expect2
-rw-r--r--t/chainlint/nested-here-doc.expect27
-rw-r--r--t/chainlint/nested-subshell-comment.expect2
-rw-r--r--t/chainlint/subshell-here-doc.expect28
-rw-r--r--t/chainlint/t7900-subtree.expect4
-rw-r--r--t/chainlint/unclosed-here-doc-indent.expect4
-rw-r--r--t/chainlint/unclosed-here-doc-indent.test4
-rw-r--r--t/chainlint/unclosed-here-doc.expect7
-rw-r--r--t/chainlint/unclosed-here-doc.test7
-rw-r--r--t/chainlint/while-loop.expect4
-rwxr-xr-xt/check-non-portable-shell.pl1
-rw-r--r--t/helper/test-advise.c2
-rw-r--r--t/helper/test-bitmap.c3
-rw-r--r--t/helper/test-bloom.c6
-rw-r--r--t/helper/test-bundle-uri.c137
-rw-r--r--t/helper/test-cache-tree.c69
-rw-r--r--t/helper/test-chmtime.c2
-rw-r--r--t/helper/test-config.c47
-rw-r--r--t/helper/test-crontab.c1
-rw-r--r--t/helper/test-ctype.c35
-rw-r--r--t/helper/test-date.c8
-rw-r--r--t/helper/test-delta.c2
-rw-r--r--t/helper/test-dir-iterator.c6
-rw-r--r--t/helper/test-drop-caches.c2
-rw-r--r--t/helper/test-dump-cache-tree.c12
-rw-r--r--t/helper/test-dump-fsmonitor.c4
-rw-r--r--t/helper/test-dump-split-index.c5
-rw-r--r--t/helper/test-dump-untracked-cache.c9
-rw-r--r--t/helper/test-env-helper.c (renamed from builtin/env--helper.c)24
-rw-r--r--t/helper/test-example-decorate.c5
-rw-r--r--t/helper/test-fake-ssh.c8
-rw-r--r--t/helper/test-fast-rebase.c30
-rw-r--r--t/helper/test-fsmonitor-client.c5
-rw-r--r--t/helper/test-genzeros.c11
-rw-r--r--t/helper/test-hash.c2
-rw-r--r--t/helper/test-hashmap.c22
-rw-r--r--t/helper/test-hexdump.c2
-rw-r--r--t/helper/test-index-version.c2
-rw-r--r--t/helper/test-json-writer.c77
-rw-r--r--t/helper/test-lazy-init-name-hash.c25
-rw-r--r--t/helper/test-match-trees.c12
-rw-r--r--t/helper/test-mergesort.c3
-rw-r--r--t/helper/test-oid-array.c6
-rw-r--r--t/helper/test-oidmap.c33
-rw-r--r--t/helper/test-oidtree.c8
-rw-r--r--t/helper/test-online-cpus.c2
-rw-r--r--t/helper/test-pack-mtimes.c3
-rw-r--r--t/helper/test-parse-options.c6
-rw-r--r--t/helper/test-parse-pathspec-file.c4
-rw-r--r--t/helper/test-partial-clone.c3
-rw-r--r--t/helper/test-path-utils.c8
-rw-r--r--t/helper/test-pcre2-config.c1
-rw-r--r--t/helper/test-pkt-line.c3
-rw-r--r--t/helper/test-prio-queue.c5
-rw-r--r--t/helper/test-proc-receive.c7
-rw-r--r--t/helper/test-progress.c1
-rw-r--r--t/helper/test-reach.c18
-rw-r--r--t/helper/test-read-cache.c8
-rw-r--r--t/helper/test-read-graph.c4
-rw-r--r--t/helper/test-read-midx.c4
-rw-r--r--t/helper/test-ref-store.c8
-rw-r--r--t/helper/test-reftable.c1
-rw-r--r--t/helper/test-repository.c4
-rw-r--r--t/helper/test-revision-walking.c5
-rw-r--r--t/helper/test-run-command.c94
-rw-r--r--t/helper/test-scrap-cache-tree.c13
-rw-r--r--t/helper/test-serve-v2.c3
-rw-r--r--t/helper/test-sha1.c8
-rw-r--r--t/helper/test-sigchain.c3
-rw-r--r--t/helper/test-simple-ipc.c3
-rw-r--r--t/helper/test-strcmp-offset.c2
-rw-r--r--t/helper/test-string-list.c6
-rw-r--r--t/helper/test-submodule-config.c9
-rw-r--r--t/helper/test-submodule-nested-repo-config.c2
-rw-r--r--t/helper/test-submodule.c87
-rw-r--r--t/helper/test-subprocess.c2
-rw-r--r--t/helper/test-tool.c4
-rw-r--r--t/helper/test-tool.h5
-rw-r--r--t/helper/test-trace2.c200
-rw-r--r--t/helper/test-userdiff.c2
-rw-r--r--t/helper/test-wildmatch.c1
-rw-r--r--t/helper/test-write-cache.c8
-rw-r--r--t/helper/test-xml-encode.c2
-rw-r--r--t/interop/interop-lib.sh2
-rw-r--r--t/lib-bundle-uri-protocol.sh216
-rw-r--r--t/lib-credential.sh59
-rw-r--r--t/lib-diff-alternative.sh38
-rw-r--r--t/lib-httpd.sh41
-rw-r--r--t/lib-httpd/apache.conf72
-rw-r--r--t/lib-httpd/apply-one-time-perl.sh2
-rw-r--r--t/lib-httpd/nph-custom-auth.sh39
-rw-r--r--t/lib-httpd/proxy-passwd1
-rw-r--r--t/lib-httpd/ssl.cnf2
-rw-r--r--t/lib-patch-mode.sh11
-rw-r--r--t/lib-rebase.sh10
-rw-r--r--t/lib-submodule-update.sh26
-rwxr-xr-xt/perf/p0006-read-tree-checkout.sh8
-rwxr-xr-xt/perf/p0090-cache-tree.sh36
-rwxr-xr-xt/perf/p1500-graph-walks.sh50
-rwxr-xr-xt/perf/p2000-sparse-operations.sh5
-rwxr-xr-xt/perf/p5312-pack-bitmaps-revs.sh3
-rwxr-xr-xt/perf/p7102-reset.sh21
-rwxr-xr-xt/perf/p7822-grep-perl-character.sh42
-rwxr-xr-xt/perf/run4
-rwxr-xr-xt/t0000-basic.sh7
-rwxr-xr-xt/t0001-init.sh9
-rwxr-xr-xt/t0002-gitfile.sh4
-rwxr-xr-xt/t0003-attributes.sh52
-rwxr-xr-xt/t0006-date.sh8
-rwxr-xr-xt/t0007-git-var.sh100
-rwxr-xr-xt/t0013-sha1dc.sh6
-rwxr-xr-xt/t0017-env-helper.sh62
-rwxr-xr-xt/t0021-conversion.sh4
-rwxr-xr-xt/t0023-crlf-am.sh1
-rwxr-xr-xt/t0027-auto-crlf.sh66
-rwxr-xr-xt/t0033-safe-directory.sh9
-rwxr-xr-xt/t0035-safe-bare-repository.sh41
-rwxr-xr-xt/t0040-parse-options.sh12
-rwxr-xr-xt/t0055-beyond-symlinks.sh14
-rwxr-xr-xt/t0060-path-utils.sh108
-rwxr-xr-xt/t0061-run-command.sh15
-rwxr-xr-xt/t0063-string-list.sh51
-rwxr-xr-xt/t0066-dir-iterator.sh44
-rwxr-xr-xt/t0068-for-each-repo.sh26
-rwxr-xr-xt/t0070-fundamental.sh1
-rwxr-xr-xt/t0100-previous.sh8
-rwxr-xr-xt/t0211-trace2-perf.sh95
-rw-r--r--t/t0211/scrub_perf.perl6
-rwxr-xr-xt/t0300-credentials.sh114
-rwxr-xr-xt/t0301-credential-cache.sh1
-rwxr-xr-xt/t0410-partial-clone.sh14
-rwxr-xr-xt/t0450-txt-doc-vs-help.sh172
-rw-r--r--t/t0450/txt-help-mismatches58
-rwxr-xr-xt/t1001-read-tree-m-2way.sh2
-rwxr-xr-xt/t1002-read-tree-m-u-2way.sh16
-rwxr-xr-xt/t1005-read-tree-reset.sh15
-rwxr-xr-xt/t1006-cat-file.sh9
-rwxr-xr-xt/t1007-hash-object.sh29
-rwxr-xr-xt/t1010-mktree.sh4
-rwxr-xr-xt/t1011-read-tree-sparse-checkout.sh1
-rwxr-xr-xt/t1022-read-tree-partial-clone.sh4
-rwxr-xr-xt/t1050-large.sh6
-rwxr-xr-xt/t1091-sparse-checkout-builtin.sh178
-rwxr-xr-xt/t1092-sparse-checkout-compatibility.sh125
-rwxr-xr-xt/t1300-config.sh49
-rwxr-xr-xt/t1301-shared-repo.sh15
-rwxr-xr-xt/t1302-repo-version.sh5
-rwxr-xr-xt/t1304-default-acl.sh5
-rwxr-xr-xt/t1308-config-set.sh117
-rwxr-xr-xt/t1400-update-ref.sh3
-rwxr-xr-xt/t1401-symbolic-ref.sh51
-rwxr-xr-xt/t1404-update-ref-errors.sh3
-rwxr-xr-xt/t1408-packed-refs.sh1
-rwxr-xr-xt/t1409-avoid-packing-refs.sh1
-rwxr-xr-xt/t1410-reflog.sh1
-rwxr-xr-xt/t1413-reflog-detach.sh1
-rwxr-xr-xt/t1416-ref-transaction-hooks.sh1
-rwxr-xr-xt/t1450-fsck.sh63
-rwxr-xr-xt/t1451-fsck-buffer.sh142
-rwxr-xr-xt/t1500-rev-parse.sh2
-rwxr-xr-xt/t1501-work-tree.sh2
-rwxr-xr-xt/t1502-rev-parse-parseopt.sh6
-rwxr-xr-xt/t1504-ceiling-dirs.sh8
-rwxr-xr-xt/t1507-rev-parse-upstream.sh11
-rwxr-xr-xt/t1509-root-work-tree.sh10
-rwxr-xr-xt/t1600-index.sh31
-rwxr-xr-xt/t1800-hook.sh20
-rwxr-xr-xt/t2005-checkout-index-symlinks.sh8
-rwxr-xr-xt/t2012-checkout-last.sh1
-rwxr-xr-xt/t2015-checkout-unborn.sh11
-rwxr-xr-xt/t2016-checkout-patch.sh6
-rwxr-xr-xt/t2018-checkout-branch.sh1
-rwxr-xr-xt/t2019-checkout-ambiguous-ref.sh4
-rwxr-xr-xt/t2021-checkout-overwrite.sh16
-rwxr-xr-xt/t2024-checkout-dwim.sh7
-rwxr-xr-xt/t2025-checkout-no-overlay.sh1
-rwxr-xr-xt/t2060-switch.sh29
-rwxr-xr-xt/t2070-restore.sh16
-rwxr-xr-xt/t2107-update-index-basic.sh2
-rwxr-xr-xt/t2401-worktree-prune.sh1
-rwxr-xr-xt/t2402-worktree-list.sh1
-rwxr-xr-xt/t2406-worktree-repair.sh1
-rwxr-xr-xt/t3009-ls-files-others-nonsubmodule.sh1
-rwxr-xr-xt/t3010-ls-files-killed-modified.sh2
-rwxr-xr-xt/t3013-ls-files-format.sh16
-rwxr-xr-xt/t3050-subprojects-fetch.sh1
-rwxr-xr-xt/t3060-ls-files-with-tree.sh6
-rwxr-xr-xt/t3070-wildmatch.sh11
-rwxr-xr-xt/t3104-ls-tree-format.sh7
-rwxr-xr-xt/t3200-branch.sh90
-rwxr-xr-xt/t3202-show-branch.sh18
-rwxr-xr-xt/t3203-branch-output.sh38
-rwxr-xr-xt/t3204-branch-name-interpretation.sh34
-rwxr-xr-xt/t3206-range-diff.sh32
-rwxr-xr-xt/t3210-pack-refs.sh1
-rwxr-xr-xt/t3305-notes-fanout.sh2
-rwxr-xr-xt/t3309-notes-merge-auto-resolve.sh7
-rwxr-xr-xt/t3400-rebase.sh14
-rwxr-xr-xt/t3402-rebase-merge.sh21
-rwxr-xr-xt/t3404-rebase-interactive.sh41
-rwxr-xr-xt/t3405-rebase-malformed.sh1
-rwxr-xr-xt/t3406-rebase-message.sh185
-rwxr-xr-xt/t3409-rebase-environ.sh1
-rwxr-xr-xt/t3412-rebase-root.sh1
-rwxr-xr-xt/t3413-rebase-hook.sh1
-rwxr-xr-xt/t3416-rebase-onto-threedots.sh63
-rwxr-xr-xt/t3418-rebase-continue.sh62
-rwxr-xr-xt/t3419-rebase-patch-id.sh64
-rwxr-xr-xt/t3422-rebase-incompatible-options.sh88
-rwxr-xr-xt/t3423-rebase-reword.sh1
-rwxr-xr-xt/t3425-rebase-topology-merges.sh2
-rwxr-xr-xt/t3428-rebase-signoff.sh1
-rwxr-xr-xt/t3429-rebase-edit-todo.sh1
-rwxr-xr-xt/t3430-rebase-merges.sh61
-rwxr-xr-xt/t3431-rebase-fork-point.sh3
-rwxr-xr-xt/t3432-rebase-fast-forward.sh1
-rwxr-xr-xt/t3433-rebase-across-mode-change.sh1
-rwxr-xr-xt/t3437-rebase-fixup-options.sh27
-rwxr-xr-xt/t3438-rebase-broken-files.sh2
-rwxr-xr-xt/t3501-revert-cherry-pick.sh19
-rwxr-xr-xt/t3502-cherry-pick-merge.sh1
-rwxr-xr-xt/t3503-cherry-pick-root.sh1
-rwxr-xr-xt/t3506-cherry-pick-ff.sh1
-rwxr-xr-xt/t3511-cherry-pick-x.sh1
-rwxr-xr-xt/t3700-add.sh20
-rwxr-xr-xt/t3701-add-interactive.sh62
-rwxr-xr-xt/t3702-add-edit.sh2
-rwxr-xr-xt/t3800-mktag.sh1
-rwxr-xr-xt/t3920-crlf-messages.sh2
-rwxr-xr-xt/t4012-diff-binary.sh14
-rwxr-xr-xt/t4013-diff-various.sh42
-rwxr-xr-xt/t4014-format-patch.sh119
-rwxr-xr-xt/t4015-diff-whitespace.sh4
-rw-r--r--t/t4018/java-class-brace-on-separate-line6
-rw-r--r--t/t4018/java-class-space-before-type-parameters6
-rw-r--r--t/t4018/java-class-type-parameters6
-rw-r--r--t/t4018/java-class-type-parameters-implements6
-rw-r--r--t/t4018/java-interface-type-parameters6
-rw-r--r--t/t4018/java-interface-type-parameters-extends6
-rw-r--r--t/t4018/java-non-sealed8
-rw-r--r--t/t4018/java-record6
-rw-r--r--t/t4018/java-record-space-before-components6
-rw-r--r--t/t4018/java-record-type-parameters6
-rw-r--r--t/t4018/java-sealed7
-rw-r--r--t/t4018/java-sealed-permits6
-rw-r--r--t/t4018/java-sealed-type-parameters6
-rw-r--r--t/t4018/java-sealed-type-parameters-implements-permits6
-rw-r--r--t/t4018/java-sealed-type-parameters-permits6
-rwxr-xr-xt/t4023-diff-rename-typechange.sh12
-rwxr-xr-xt/t4034-diff-words.sh4
-rwxr-xr-xt/t4038-diff-combined.sh10
-rwxr-xr-xt/t4044-diff-index-unique-abbrev.sh4
-rwxr-xr-xt/t4045-diff-relative.sh31
-rwxr-xr-xt/t4046-diff-unmerged.sh10
-rwxr-xr-xt/t4052-stat-output.sh1
-rwxr-xr-xt/t4053-diff-no-index.sh1
-rwxr-xr-xt/t4054-diff-bogus-tree.sh2
-rwxr-xr-xt/t4058-diff-duplicates.sh2
-rwxr-xr-xt/t4067-diff-partial-clone.sh1
-rwxr-xr-xt/t4111-apply-subdir.sh1
-rwxr-xr-xt/t4135-apply-weird-filenames.sh1
-rwxr-xr-xt/t4141-apply-too-large.sh23
-rwxr-xr-xt/t4150-am.sh42
-rwxr-xr-xt/t4152-am-subjects.sh2
-rwxr-xr-xt/t4201-shortlog.sh39
-rwxr-xr-xt/t4202-log.sh24
-rwxr-xr-xt/t4203-mailmap.sh65
-rwxr-xr-xt/t4204-patch-id.sh95
-rwxr-xr-xt/t4205-log-pretty-formats.sh29
-rwxr-xr-xt/t4211-line-log.sh22
-rwxr-xr-xt/t4212-log-corrupt.sh55
-rwxr-xr-xt/t4213-log-tabexpand.sh1
-rwxr-xr-xt/t4254-am-corrupt.sh2
-rwxr-xr-xt/t4256-am-format-flowed.sh1
-rwxr-xr-xt/t4257-am-interactive.sh2
-rw-r--r--t/t4258/mbox2
-rwxr-xr-xt/t4301-merge-tree-write-tree.sh107
-rwxr-xr-xt/t5000-tar-tree.sh58
-rwxr-xr-xt/t5001-archive-attr.sh17
-rwxr-xr-xt/t5004-archive-corner-cases.sh2
-rw-r--r--t/t5100/msg00022
-rw-r--r--t/t5100/msg00032
-rw-r--r--t/t5100/msg0012--message-id2
-rw-r--r--t/t5100/quoted-cr.mbox4
-rw-r--r--t/t5100/sample.mbox6
-rwxr-xr-xt/t5300-pack-object.sh135
-rwxr-xr-xt/t5302-pack-index.sh4
-rwxr-xr-xt/t5304-prune.sh48
-rwxr-xr-xt/t5306-pack-nobase.sh2
-rwxr-xr-xt/t5310-pack-bitmaps.sh25
-rwxr-xr-xt/t5312-prune-corruption.sh1
-rwxr-xr-xt/t5313-pack-bounds-checks.sh2
-rwxr-xr-xt/t5314-pack-cycle-detection.sh17
-rwxr-xr-xt/t5317-pack-objects-filter-objects.sh91
-rwxr-xr-xt/t5318-commit-graph.sh2
-rwxr-xr-xt/t5319-multi-pack-index.sh28
-rwxr-xr-xt/t5320-delta-islands.sh2
-rwxr-xr-xt/t5325-reverse-index.sh90
-rwxr-xr-xt/t5326-multi-pack-bitmaps.sh68
-rwxr-xr-xt/t5328-commit-graph-64bit-time.sh9
-rwxr-xr-xt/t5330-no-lazy-fetch-with-commit-graph.sh1
-rwxr-xr-xt/t5331-pack-objects-stdin.sh240
-rwxr-xr-xt/t5403-post-checkout-hook.sh1
-rwxr-xr-xt/t5405-send-pack-rewind.sh1
-rwxr-xr-xt/t5406-remote-rejects.sh1
-rwxr-xr-xt/t5502-quickfetch.sh1
-rwxr-xr-xt/t5504-fetch-receive-strict.sh3
-rwxr-xr-xt/t5506-remote-groups.sh9
-rwxr-xr-xt/t5507-remote-environment.sh2
-rwxr-xr-xt/t5510-fetch.sh17
-rwxr-xr-xt/t5512-ls-remote.sh156
-rwxr-xr-xt/t5514-fetch-multiple.sh12
-rwxr-xr-xt/t5516-fetch-push.sh49
-rwxr-xr-xt/t5522-pull-symlink.sh5
-rwxr-xr-xt/t5523-push-upstream.sh1
-rwxr-xr-xt/t5526-fetch-submodules.sh29
-rwxr-xr-xt/t5527-fetch-odd-refs.sh1
-rwxr-xr-xt/t5529-push-errors.sh2
-rwxr-xr-xt/t5531-deep-submodule-push.sh50
-rwxr-xr-xt/t5541-http-push-smart.sh57
-rwxr-xr-xt/t5544-pack-objects-hook.sh2
-rwxr-xr-xt/t5546-receive-limits.sh2
-rwxr-xr-xt/t5547-push-quarantine.sh2
-rwxr-xr-xt/t5550-http-fetch-dumb.sh2
-rwxr-xr-xt/t5551-http-fetch-smart.sh258
-rwxr-xr-xt/t5552-skipping-fetch-negotiator.sh16
-rwxr-xr-xt/t5554-noop-fetch-negotiator.sh2
-rwxr-xr-xt/t5558-clone-bundle-uri.sh977
-rwxr-xr-xt/t5559-http-fetch-smart-http2.sh5
-rwxr-xr-xt/t5560-http-backend-noserver.sh1
-rwxr-xr-xt/t5561-http-backend.sh1
-rwxr-xr-xt/t5562-http-backend-content-length.sh2
-rwxr-xr-xt/t5563-simple-http-auth.sh323
-rwxr-xr-xt/t5564-http-proxy.sh41
-rwxr-xr-xt/t5573-pull-verify-signatures.sh2
-rwxr-xr-xt/t5601-clone.sh128
-rwxr-xr-xt/t5604-clone-reference.sh3
-rwxr-xr-xt/t5605-clone-local.sh12
-rwxr-xr-xt/t5606-clone-options.sh1
-rwxr-xr-xt/t5610-clone-detached.sh1
-rwxr-xr-xt/t5611-clone-config.sh1
-rwxr-xr-xt/t5613-info-alternate.sh2
-rwxr-xr-xt/t5614-clone-submodules-shallow.sh1
-rwxr-xr-xt/t5616-partial-clone.sh43
-rwxr-xr-xt/t5617-clone-submodules-remote.sh1
-rwxr-xr-xt/t5618-alternate-refs.sh2
-rwxr-xr-xt/t5701-git-serve.sh40
-rwxr-xr-xt/t5702-protocol-v2.sh42
-rwxr-xr-xt/t5705-session-id-in-capabilities.sh1
-rwxr-xr-xt/t5730-protocol-v2-bundle-uri-file.sh17
-rwxr-xr-xt/t5731-protocol-v2-bundle-uri-git.sh17
-rwxr-xr-xt/t5732-protocol-v2-bundle-uri-http.sh17
-rwxr-xr-xt/t5750-bundle-uri-parse.sh290
-rwxr-xr-xt/t5810-proto-disable-local.sh2
-rwxr-xr-xt/t5813-proto-disable-ssh.sh2
-rwxr-xr-xt/t6003-rev-list-topo-order.sh23
-rwxr-xr-xt/t6011-rev-list-with-bad-commit.sh1
-rwxr-xr-xt/t6014-rev-list-all.sh1
-rwxr-xr-xt/t6018-rev-list-glob.sh40
-rwxr-xr-xt/t6020-bundle-misc.sh86
-rwxr-xr-xt/t6021-rev-list-exclude-hidden.sh164
-rwxr-xr-xt/t6030-bisect-porcelain.sh202
-rwxr-xr-xt/t6060-merge-index.sh2
-rwxr-xr-xt/t6102-rev-list-unexpected-objects.sh4
-rwxr-xr-xt/t6120-describe.sh6
-rwxr-xr-xt/t6132-pathspec-exclude.sh6
-rwxr-xr-xt/t6300-for-each-ref.sh118
-rwxr-xr-xt/t6301-for-each-ref-errors.sh15
-rwxr-xr-xt/t6401-merge-criss-cross.sh2
-rwxr-xr-xt/t6406-merge-attr.sh1
-rwxr-xr-xt/t6407-merge-binary.sh1
-rwxr-xr-xt/t6415-merge-dir-to-symlink.sh1
-rwxr-xr-xt/t6421-merge-partial-clone.sh4
-rwxr-xr-xt/t6422-merge-rename-corner-cases.sh2
-rwxr-xr-xt/t6423-merge-rename-directories.sh56
-rwxr-xr-xt/t6426-merge-skip-unneeded-updates.sh58
-rwxr-xr-xt/t6435-merge-sparse.sh1
-rwxr-xr-xt/t6439-merge-co-error-msgs.sh1
-rwxr-xr-xt/t6500-gc.sh101
-rwxr-xr-xt/t6501-freshen-objects.sh11
-rwxr-xr-xt/t6600-test-reach.sh169
-rwxr-xr-xt/t7001-mv.sh62
-rwxr-xr-xt/t7003-filter-branch.sh4
-rwxr-xr-xt/t7004-tag.sh61
-rwxr-xr-xt/t7030-verify-tag.sh2
-rwxr-xr-xt/t7031-verify-tag-signed-ssh.sh12
-rwxr-xr-xt/t7103-reset-bare.sh2
-rwxr-xr-xt/t7105-reset-patch.sh2
-rwxr-xr-xt/t7106-reset-unborn-branch.sh2
-rwxr-xr-xt/t7107-reset-pathspec-file.sh1
-rwxr-xr-xt/t7301-clean-interactive.sh1
-rwxr-xr-xt/t7400-submodule-basic.sh10
-rwxr-xr-xt/t7402-submodule-rebase.sh24
-rwxr-xr-xt/t7403-submodule-sync.sh1
-rwxr-xr-xt/t7407-submodule-foreach.sh5
-rwxr-xr-xt/t7409-submodule-detached-work-tree.sh1
-rwxr-xr-xt/t7411-submodule-config.sh36
-rwxr-xr-xt/t7412-submodule-absorbgitdirs.sh64
-rwxr-xr-xt/t7413-submodule-is-active.sh16
-rwxr-xr-xt/t7416-submodule-dash-url.sh2
-rwxr-xr-xt/t7418-submodule-sparse-gitmodules.sh4
-rwxr-xr-xt/t7422-submodule-output.sh170
-rwxr-xr-xt/t7450-bad-git-dotfiles.sh2
-rwxr-xr-xt/t7504-commit-msg-hook.sh5
-rwxr-xr-xt/t7508-status.sh70
-rwxr-xr-xt/t7509-commit-authorship.sh2
-rwxr-xr-xt/t7510-signed-commit.sh67
-rwxr-xr-xt/t7516-commit-races.sh3
-rwxr-xr-xt/t7517-per-repo-email.sh1
-rwxr-xr-xt/t7520-ignored-hook-warning.sh1
-rwxr-xr-xt/t7527-builtin-fsmonitor.sh99
-rwxr-xr-xt/t7528-signed-commit-ssh.sh2
-rwxr-xr-xt/t7600-merge.sh2
-rwxr-xr-xt/t7605-merge-resolve.sh1
-rwxr-xr-xt/t7610-mergetool.sh42
-rwxr-xr-xt/t7612-merge-verify-signatures.sh1
-rwxr-xr-xt/t7614-merge-signoff.sh1
-rwxr-xr-xt/t7700-repack.sh215
-rwxr-xr-xt/t7701-repack-unpack-unreachable.sh5
-rwxr-xr-xt/t7703-repack-geometric.sh170
-rwxr-xr-xt/t7800-difftool.sh52
-rwxr-xr-xt/t7810-grep.sh19
-rwxr-xr-xt/t7900-maintenance.sh68
-rwxr-xr-xt/t8003-blame-corner-cases.sh2
-rwxr-xr-xt/t9001-send-email.sh181
-rwxr-xr-xt/t9003-help-autocorrect.sh8
-rwxr-xr-xt/t9106-git-svn-commit-diff-clobber.sh1
-rwxr-xr-xt/t9115-git-svn-dcommit-funky-renames.sh1
-rwxr-xr-xt/t9119-git-svn-info.sh2
-rwxr-xr-xt/t9133-git-svn-nested-git-repo.sh6
-rwxr-xr-xt/t9134-git-svn-ignore-paths.sh8
-rwxr-xr-xt/t9140-git-svn-reset.sh4
-rwxr-xr-xt/t9146-git-svn-empty-dirs.sh1
-rwxr-xr-xt/t9147-git-svn-include-paths.sh8
-rwxr-xr-xt/t9148-git-svn-propset.sh1
-rwxr-xr-xt/t9160-git-svn-preserve-empty-dirs.sh1
-rwxr-xr-xt/t9164-git-svn-dcommit-concurrent.sh1
-rwxr-xr-xt/t9210-scalar.sh26
-rwxr-xr-xt/t9211-scalar-clone.sh32
-rwxr-xr-xt/t9300-fast-import.sh13
-rwxr-xr-xt/t9304-fast-import-marks.sh29
-rwxr-xr-xt/t9350-fast-export.sh2
-rwxr-xr-xt/t9351-fast-export-anonymize.sh2
-rwxr-xr-xt/t9700-perl-git.sh65
-rwxr-xr-xt/t9700/test.pl12
-rwxr-xr-xt/t9814-git-p4-rename.sh2
-rwxr-xr-xt/t9815-git-p4-submit-fail.sh4
-rwxr-xr-xt/t9902-completion.sh30
-rwxr-xr-xt/t9903-bash-prompt.sh8
-rw-r--r--t/test-lib-functions.sh136
-rw-r--r--t/test-lib.sh55
-rw-r--r--tag.c15
-rw-r--r--tempfile.c4
-rwxr-xr-xtemplates/hooks--sendemail-validate.sample77
-rw-r--r--thread-utils.c2
-rw-r--r--tmp-objdir.c5
-rw-r--r--tmp-objdir.h6
-rw-r--r--trace.c14
-rw-r--r--trace.h3
-rw-r--r--trace2.c126
-rw-r--r--trace2.h101
-rw-r--r--trace2/tr2_cfg.c4
-rw-r--r--trace2/tr2_cmd_name.c3
-rw-r--r--trace2/tr2_ctr.c101
-rw-r--r--trace2/tr2_ctr.h104
-rw-r--r--trace2/tr2_dst.c4
-rw-r--r--trace2/tr2_sid.c4
-rw-r--r--trace2/tr2_sysenv.c2
-rw-r--r--trace2/tr2_tbuf.c2
-rw-r--r--trace2/tr2_tgt.h16
-rw-r--r--trace2/tr2_tgt_event.c50
-rw-r--r--trace2/tr2_tgt_normal.c42
-rw-r--r--trace2/tr2_tgt_perf.c46
-rw-r--r--trace2/tr2_tls.c38
-rw-r--r--trace2/tr2_tls.h55
-rw-r--r--trace2/tr2_tmr.c183
-rw-r--r--trace2/tr2_tmr.h140
-rw-r--r--trailer.c5
-rw-r--r--transport-helper.c22
-rw-r--r--transport-internal.h7
-rw-r--r--transport.c117
-rw-r--r--transport.h20
-rw-r--r--tree-diff.c16
-rw-r--r--tree-walk.c7
-rw-r--r--tree-walk.h5
-rw-r--r--tree.c79
-rw-r--r--tree.h11
-rw-r--r--unicode-width.h33
-rw-r--r--unix-socket.c3
-rw-r--r--unix-stream-server.c2
-rw-r--r--unpack-trees.c287
-rw-r--r--unpack-trees.h47
-rw-r--r--upload-pack.c59
-rw-r--r--url.c4
-rw-r--r--urlmatch.c11
-rw-r--r--usage.c4
-rw-r--r--userdiff.c48
-rw-r--r--userdiff.h2
-rw-r--r--versioncmp.c25
-rw-r--r--versioncmp.h6
-rw-r--r--walker.c10
-rw-r--r--wildmatch.c25
-rw-r--r--wildmatch.h2
-rw-r--r--worktree.c130
-rw-r--r--worktree.h17
-rw-r--r--wrapper.c9
-rw-r--r--wrapper.h36
-rw-r--r--write-or-die.c4
-rw-r--r--write-or-die.h78
-rw-r--r--ws.c17
-rw-r--r--ws.h33
-rw-r--r--wt-status.c62
-rw-r--r--xdiff-interface.c5
-rw-r--r--xdiff-interface.h2
-rw-r--r--xdiff/xdiffi.c2
-rw-r--r--xdiff/xemit.c4
1208 files changed, 41363 insertions, 21994 deletions
diff --git a/.gitattributes b/.gitattributes
index b0044cf272..158c3d45c4 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,17 +1,17 @@
* whitespace=!indent,trail,space
*.[ch] whitespace=indent,trail,space diff=cpp
-*.sh whitespace=indent,trail,space eol=lf
-*.perl eol=lf diff=perl
-*.pl eof=lf diff=perl
-*.pm eol=lf diff=perl
-*.py eol=lf diff=python
-*.bat eol=crlf
+*.sh whitespace=indent,trail,space text eol=lf
+*.perl text eol=lf diff=perl
+*.pl text eof=lf diff=perl
+*.pm text eol=lf diff=perl
+*.py text eol=lf diff=python
+*.bat text eol=crlf
CODE_OF_CONDUCT.md -whitespace
-/Documentation/**/*.txt eol=lf
-/command-list.txt eol=lf
-/GIT-VERSION-GEN eol=lf
-/mergetools/* eol=lf
-/t/oid-info/* eol=lf
+/Documentation/**/*.txt text eol=lf
+/command-list.txt text eol=lf
+/GIT-VERSION-GEN text eol=lf
+/mergetools/* text eol=lf
+/t/oid-info/* text eol=lf
/Documentation/git-merge.txt conflict-marker-size=32
/Documentation/gitk.txt conflict-marker-size=32
/Documentation/user-manual.txt conflict-marker-size=32
diff --git a/.github/workflows/check-whitespace.yml b/.github/workflows/check-whitespace.yml
index ad3466ad16..a58e2dc8ad 100644
--- a/.github/workflows/check-whitespace.yml
+++ b/.github/workflows/check-whitespace.yml
@@ -9,42 +9,83 @@ on:
pull_request:
types: [opened, synchronize]
+# Avoid unnecessary builds. Unlike the main CI jobs, these are not
+# ci-configurable (but could be).
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
jobs:
check-whitespace:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
with:
fetch-depth: 0
- name: git log --check
id: check_out
run: |
- log=
+ baseSha=${{github.event.pull_request.base.sha}}
+ problems=()
commit=
- while read dash etc
+ commitText=
+ commitTextmd=
+ goodparent=
+ while read dash sha etc
do
case "${dash}" in
"---")
- commit="${etc}"
+ if test -z "${commit}"
+ then
+ goodparent=${sha}
+ fi
+ commit="${sha}"
+ commitText="${sha} ${etc}"
+ commitTextmd="[${sha}](https://github.com/${{ github.repository }}/commit/${sha}) ${etc}"
;;
"")
;;
*)
if test -n "${commit}"
then
- log="${log}\n${commit}"
+ problems+=("1) --- ${commitTextmd}")
echo ""
- echo "--- ${commit}"
+ echo "--- ${commitText}"
+ commit=
fi
- commit=
- log="${log}\n${dash} ${etc}"
- echo "${dash} ${etc}"
+ case "${dash}" in
+ *:[1-9]*:) # contains file and line number information
+ dashend=${dash#*:}
+ problems+=("[${dash}](https://github.com/${{ github.repository }}/blob/${{github.event.pull_request.head.ref}}/${dash%%:*}#L${dashend%:}) ${sha} ${etc}")
+ ;;
+ *)
+ problems+=("\`${dash} ${sha} ${etc}\`")
+ ;;
+ esac
+ echo "${dash} ${sha} ${etc}"
;;
esac
- done <<< $(git log --check --pretty=format:"---% h% s" ${{github.event.pull_request.base.sha}}..)
+ done <<< $(git log --check --pretty=format:"---% h% s" ${baseSha}..)
- if test -n "${log}"
+ if test ${#problems[*]} -gt 0
then
+ if test -z "${commit}"
+ then
+ goodparent=${baseSha: 0:7}
+ fi
+ echo "🛑 Please review the Summary output for further information."
+ echo "### :x: A whitespace issue was found in one or more of the commits." >$GITHUB_STEP_SUMMARY
+ echo "" >>$GITHUB_STEP_SUMMARY
+ echo "Run these commands to correct the problem:" >>$GITHUB_STEP_SUMMARY
+ echo "1. \`git rebase --whitespace=fix ${goodparent}\`" >>$GITHUB_STEP_SUMMARY
+ echo "1. \`git push --force\`" >>$GITHUB_STEP_SUMMARY
+ echo " " >>$GITHUB_STEP_SUMMARY
+ echo "Errors:" >>$GITHUB_STEP_SUMMARY
+ for i in "${problems[@]}"
+ do
+ echo "${i}" >>$GITHUB_STEP_SUMMARY
+ done
+
exit 2
fi
diff --git a/.github/workflows/l10n.yml b/.github/workflows/l10n.yml
index f7ea0f00a4..6c3849658a 100644
--- a/.github/workflows/l10n.yml
+++ b/.github/workflows/l10n.yml
@@ -2,6 +2,12 @@ name: git-l10n
on: [push, pull_request_target]
+# Avoid unnecessary builds. Unlike the main CI jobs, these are not
+# ci-configurable (but could be).
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
jobs:
git-po-helper:
if: >-
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index eed522f321..30492eacdd 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -11,6 +11,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
enabled: ${{ steps.check-ref.outputs.enabled }}${{ steps.skip-if-redundant.outputs.enabled }}
+ skip_concurrent: ${{ steps.check-ref.outputs.skip_concurrent }}
steps:
- name: try to clone ci-config branch
run: |
@@ -34,7 +35,15 @@ jobs:
then
enabled=no
fi
+
+ skip_concurrent=yes
+ if test -x config-repo/ci/config/skip-concurrent &&
+ ! config-repo/ci/config/skip-concurrent '${{ github.ref }}'
+ then
+ skip_concurrent=no
+ fi
echo "enabled=$enabled" >>$GITHUB_OUTPUT
+ echo "skip_concurrent=$skip_concurrent" >>$GITHUB_OUTPUT
- name: skip if the commit or tree was already tested
id: skip-if-redundant
uses: actions/github-script@v6
@@ -82,6 +91,9 @@ jobs:
needs: ci-config
if: needs.ci-config.outputs.enabled == 'yes'
runs-on: windows-latest
+ concurrency:
+ group: windows-build-${{ github.ref }}
+ cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
steps:
- uses: actions/checkout@v3
- uses: git-for-windows/setup-git-for-windows-sdk@v1
@@ -101,11 +113,14 @@ jobs:
windows-test:
name: win test
runs-on: windows-latest
- needs: [windows-build]
+ needs: [ci-config, windows-build]
strategy:
fail-fast: false
matrix:
nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+ concurrency:
+ group: windows-test-${{ matrix.nr }}-${{ github.ref }}
+ cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
steps:
- name: download tracked files and build artifacts
uses: actions/download-artifact@v3
@@ -132,11 +147,14 @@ jobs:
vs-build:
name: win+VS build
needs: ci-config
- if: needs.ci-config.outputs.enabled == 'yes'
+ if: github.event.repository.owner.login == 'git-for-windows' && needs.ci-config.outputs.enabled == 'yes'
env:
NO_PERL: 1
GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
runs-on: windows-latest
+ concurrency:
+ group: vs-build-${{ github.ref }}
+ cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
steps:
- uses: actions/checkout@v3
- uses: git-for-windows/setup-git-for-windows-sdk@v1
@@ -184,11 +202,14 @@ jobs:
vs-test:
name: win+VS test
runs-on: windows-latest
- needs: vs-build
+ needs: [ci-config, vs-build]
strategy:
fail-fast: false
matrix:
nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+ concurrency:
+ group: vs-test-${{ matrix.nr }}-${{ github.ref }}
+ cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
steps:
- uses: git-for-windows/setup-git-for-windows-sdk@v1
- name: download tracked files and build artifacts
@@ -218,6 +239,9 @@ jobs:
name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}})
needs: ci-config
if: needs.ci-config.outputs.enabled == 'yes'
+ concurrency:
+ group: ${{ matrix.vector.jobname }}-${{ matrix.vector.pool }}-${{ github.ref }}
+ cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
strategy:
fail-fast: false
matrix:
@@ -249,6 +273,12 @@ jobs:
- jobname: linux-leaks
cc: gcc
pool: ubuntu-latest
+ - jobname: linux-asan
+ cc: gcc
+ pool: ubuntu-latest
+ - jobname: linux-ubsan
+ cc: gcc
+ pool: ubuntu-latest
env:
CC: ${{matrix.vector.cc}}
CC_PACKAGE: ${{matrix.vector.cc_package}}
@@ -259,8 +289,9 @@ jobs:
- uses: actions/checkout@v3
- run: ci/install-dependencies.sh
- run: ci/run-build-and-tests.sh
- - run: ci/print-test-failures.sh
+ - name: print test failures
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+ run: ci/print-test-failures.sh
- name: Upload failed tests' directories
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
uses: actions/upload-artifact@v3
@@ -271,6 +302,9 @@ jobs:
name: ${{matrix.vector.jobname}} (${{matrix.vector.image}})
needs: ci-config
if: needs.ci-config.outputs.enabled == 'yes'
+ concurrency:
+ group: dockerized-${{ matrix.vector.jobname }}-${{ matrix.vector.image }}-${{ github.ref }}
+ cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
strategy:
fail-fast: false
matrix:
@@ -292,8 +326,9 @@ jobs:
if: matrix.vector.jobname == 'linux32'
- run: ci/install-docker-dependencies.sh
- run: ci/run-build-and-tests.sh
- - run: ci/print-test-failures.sh
+ - name: print test failures
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+ run: ci/print-test-failures.sh
- name: Upload failed tests' directories
if: failure() && env.FAILED_TEST_ARTIFACTS != '' && matrix.vector.jobname != 'linux32'
uses: actions/upload-artifact@v3
@@ -312,6 +347,9 @@ jobs:
env:
jobname: StaticAnalysis
runs-on: ubuntu-22.04
+ concurrency:
+ group: static-analysis-${{ github.ref }}
+ cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
steps:
- uses: actions/checkout@v3
- run: ci/install-dependencies.sh
@@ -323,6 +361,9 @@ jobs:
env:
jobname: sparse
runs-on: ubuntu-20.04
+ concurrency:
+ group: sparse-${{ github.ref }}
+ cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
steps:
- name: Download a current `sparse` package
# Ubuntu's `sparse` version is too old for us
@@ -341,6 +382,9 @@ jobs:
name: documentation
needs: ci-config
if: needs.ci-config.outputs.enabled == 'yes'
+ concurrency:
+ group: documentation-${{ github.ref }}
+ cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
env:
jobname: Documentation
runs-on: ubuntu-latest
diff --git a/.gitignore b/.gitignore
index b3dcafcb33..e875c59054 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,5 @@
-/fuzz-commit-graph
/fuzz_corpora
-/fuzz-pack-headers
-/fuzz-pack-idx
+/GIT-BUILD-DIR
/GIT-BUILD-OPTIONS
/GIT-CFLAGS
/GIT-LDFLAGS
@@ -10,19 +8,18 @@
/GIT-PERL-HEADER
/GIT-PYTHON-VARS
/GIT-SCRIPT-DEFINES
+/GIT-SPATCH-DEFINES
/GIT-USER-AGENT
/GIT-VERSION-FILE
/bin-wrappers/
/git
/git-add
-/git-add--interactive
/git-am
/git-annotate
/git-apply
/git-archimport
/git-archive
/git-bisect
-/git-bisect--helper
/git-blame
/git-branch
/git-bugreport
@@ -61,7 +58,6 @@
/git-difftool
/git-difftool--helper
/git-describe
-/git-env--helper
/git-fast-export
/git-fast-import
/git-fetch
diff --git a/.mailmap b/.mailmap
index 07db36a9bb..733e047aa8 100644
--- a/.mailmap
+++ b/.mailmap
@@ -65,6 +65,7 @@ Derrick Stolee <derrickstolee@github.com> <dstolee@microsoft.com>
Deskin Miller <deskinm@umich.edu>
Äoàn Trần Công Danh <congdanhqx@gmail.com> Doan Tran Cong Danh
Dirk Süsserott <newsletter@dirk.my1.cc>
+Emily Shaffer <nasamuffin@google.com> <emilyshaffer@google.com>
Eric Blake <eblake@redhat.com> <ebb9@byu.net>
Eric Hanchrow <eric.hanchrow@gmail.com> <offby1@blarg.net>
Eric S. Raymond <esr@thyrsus.com>
@@ -165,6 +166,7 @@ Mark Rada <marada@uwaterloo.ca>
Martin Langhoff <martin@laptop.org> <martin@catalyst.net.nz>
Martin von Zweigbergk <martinvonz@gmail.com> <martin.von.zweigbergk@gmail.com>
Masaya Suzuki <masayasuzuki@google.com> <draftcode@gmail.com>
+Matheus Tavares <matheus.tavb@gmail.com> <matheus.bernardino@usp.br>
Matt Draisey <matt@draisey.ca> <mattdraisey@sympatico.ca>
Matt Kraai <kraai@ftbfs.org> <matt.kraai@amo.abbott.com>
Matt McCutchen <matt@mattmccutchen.net> <hashproduct@gmail.com>
diff --git a/Documentation/.gitignore b/Documentation/.gitignore
index 1c3771e7d7..a48448de32 100644
--- a/Documentation/.gitignore
+++ b/Documentation/.gitignore
@@ -10,7 +10,6 @@ howto-index.txt
doc.dep
cmds-*.txt
mergetools-*.txt
-manpage-base-url.xsl
SubmittingPatches.txt
tmp-doc-diff/
GIT-ASCIIDOCFLAGS
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 1d95a142b2..003393ed16 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -162,8 +162,6 @@ For shell scripts specifically (not exhaustive):
- We do not use \{m,n\};
- - We do not use -E;
-
- We do not use ? or + (which are \{0,1\} and \{1,\}
respectively in BRE) but that goes without saying as these
are ERE elements not BRE (note that \? and \+ are not even part
@@ -444,8 +442,12 @@ For C programs:
detail.
- The first #include in C files, except in platform specific compat/
- implementations, must be either "git-compat-util.h", "cache.h" or
- "builtin.h". You do not have to include more than one of these.
+ implementations and sha1dc/, must be either "git-compat-util.h" or
+ one of the approved headers that includes it first for you. (The
+ approved headers currently include "cache.h", "builtin.h",
+ "t/helper/test-tool.h", "xdiff/xinclude.h", or
+ "reftable/system.h"). You do not have to include more than one of
+ these.
- A C file must directly include the header files that declare the
functions and the types it uses, except for the functions and types
@@ -665,8 +667,8 @@ Writing Documentation:
(One or more of <file>.)
Optional parts are enclosed in square brackets:
- [<extra>]
- (Zero or one <extra>.)
+ [<file>...]
+ (Zero or more of <file>.)
--exec-path[=<path>]
(Option with an optional argument. Note that the "=" is inside the
@@ -680,6 +682,16 @@ Writing Documentation:
[-q | --quiet]
[--utf8 | --no-utf8]
+ Use spacing around "|" token(s), but not immediately after opening or
+ before closing a [] or () pair:
+ Do: [-q | --quiet]
+ Don't: [-q|--quiet]
+
+ Don't use spacing around "|" tokens when they're used to seperate the
+ alternate arguments of an option:
+ Do: --track[=(direct|inherit)]
+ Don't: --track[=(direct | inherit)]
+
Parentheses are used for grouping:
[(<rev> | <range>)...]
(Any number of either <rev> or <range>. Parens are needed to make
diff --git a/Documentation/Makefile b/Documentation/Makefile
index d47acb2e25..b629176d7d 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -144,14 +144,16 @@ 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) \
- -amanversion=$(GIT_VERSION) \
- -amanmanual='Git Manual' -amansource='Git'
+ -amanmanual='Git Manual' -amansource='Git $(GIT_VERSION)' \
+ -arevdate='$(GIT_DATE)'
ASCIIDOC_DEPS = asciidoc.conf GIT-ASCIIDOCFLAGS
TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
@@ -189,15 +191,7 @@ endif
ifndef MAN_BASE_URL
MAN_BASE_URL = file://$(htmldir)/
endif
-XMLTO_EXTRA += -m manpage-base-url.xsl
-
-# If your target system uses GNU groff, it may try to render
-# apostrophes as a "pretty" apostrophe using unicode. This breaks
-# cut&paste, so you should set GNU_ROFF to force them to be ASCII
-# apostrophes. Unfortunately does not work with non-GNU roff.
-ifdef GNU_ROFF
-XMLTO_EXTRA += -m manpage-quote-apos.xsl
-endif
+XMLTO_EXTRA += --stringparam man.base.url.for.relative.links='$(MAN_BASE_URL)'
ifdef USE_ASCIIDOCTOR
ASCIIDOC = asciidoctor
@@ -339,7 +333,6 @@ clean:
$(RM) technical/*.html technical/api-index.txt
$(RM) SubmittingPatches.txt
$(RM) $(cmds_txt) $(mergetools_txt) *.made
- $(RM) manpage-base-url.xsl
$(RM) GIT-ASCIIDOCFLAGS
$(MAN_HTML): %.html : %.txt $(ASCIIDOC_DEPS)
@@ -348,11 +341,15 @@ $(MAN_HTML): %.html : %.txt $(ASCIIDOC_DEPS)
$(OBSOLETE_HTML): %.html : %.txto $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) -o $@ $<
-manpage-base-url.xsl: manpage-base-url.xsl.in
- $(QUIET_GEN)sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
+manpage-prereqs := $(wildcard manpage*.xsl)
+manpage-cmd = $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
-%.1 %.5 %.7 : %.xml manpage-base-url.xsl $(wildcard manpage*.xsl)
- $(QUIET_XMLTO)$(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
+%.1 : %.xml $(manpage-prereqs)
+ $(manpage-cmd)
+%.5 : %.xml $(manpage-prereqs)
+ $(manpage-cmd)
+%.7 : %.xml $(manpage-prereqs)
+ $(manpage-cmd)
%.xml : %.txt $(ASCIIDOC_DEPS)
$(QUIET_ASCIIDOC)$(TXT_TO_XML) -d manpage -o $@ $<
@@ -476,8 +473,19 @@ $(LINT_DOCS_MAN_SECTION_ORDER): .build/lint-docs/man-section-order/%.ok: %.txt
.PHONY: lint-docs-man-section-order
lint-docs-man-section-order: $(LINT_DOCS_MAN_SECTION_ORDER)
+.PHONY: lint-docs-fsck-msgids
+LINT_DOCS_FSCK_MSGIDS = .build/lint-docs/fsck-msgids.ok
+$(LINT_DOCS_FSCK_MSGIDS): lint-fsck-msgids.perl
+$(LINT_DOCS_FSCK_MSGIDS): ../fsck.h fsck-msgids.txt
+ $(call mkdir_p_parent_template)
+ $(QUIET_GEN)$(PERL_PATH) lint-fsck-msgids.perl \
+ ../fsck.h fsck-msgids.txt $@
+
+lint-docs-fsck-msgids: $(LINT_DOCS_FSCK_MSGIDS)
+
## Lint: list of targets above
.PHONY: lint-docs
+lint-docs: lint-docs-fsck-msgids
lint-docs: lint-docs-gitlink
lint-docs: lint-docs-man-end-blurb
lint-docs: lint-docs-man-section-order
diff --git a/Documentation/MyFirstContribution.txt b/Documentation/MyFirstContribution.txt
index 1a4be8ee0a..56130e4bec 100644
--- a/Documentation/MyFirstContribution.txt
+++ b/Documentation/MyFirstContribution.txt
@@ -736,7 +736,7 @@ the {lore}[Git mailing list archive]:
2022-02-21 1:43 ` John Cai
2022-02-21 1:50 ` Taylor Blau
2022-02-23 19:50 ` John Cai
-2022-02-18 20:00 ` // other replies ellided
+2022-02-18 20:00 ` // other replies elided
2022-02-18 18:40 ` [PATCH 2/3] reflog: call reflog_delete from reflog.c John Cai via GitGitGadget
2022-02-18 19:15 ` Ævar Arnfjörð Bjarmason
2022-02-18 20:26 ` Junio C Hamano
@@ -1164,28 +1164,28 @@ After you run this command, `format-patch` will output the patches to the `psuh/
directory, alongside the v1 patches. Using a single directory makes it easy to
refer to the old v1 patches while proofreading the v2 patches, but you will need
to be careful to send out only the v2 patches. We will use a pattern like
-"psuh/v2-*.patch" (not "psuh/*.patch", which would match v1 and v2 patches).
+`psuh/v2-*.patch` (not `psuh/*.patch`, which would match v1 and v2 patches).
Edit your cover letter again. Now is a good time to mention what's different
between your last version and now, if it's something significant. You do not
need the exact same body in your second cover letter; focus on explaining to
reviewers the changes you've made that may not be as visible.
-You will also need to go and find the Message-Id of your previous cover letter.
+You will also need to go and find the Message-ID of your previous cover letter.
You can either note it when you send the first series, from the output of `git
send-email`, or you can look it up on the
https://lore.kernel.org/git[mailing list]. Find your cover letter in the
-archives, click on it, then click "permalink" or "raw" to reveal the Message-Id
+archives, click on it, then click "permalink" or "raw" to reveal the Message-ID
header. It should match:
----
-Message-Id: <foo.12345.author@example.com>
+Message-ID: <foo.12345.author@example.com>
----
-Your Message-Id is `<foo.12345.author@example.com>`. This example will be used
-below as well; make sure to replace it with the correct Message-Id for your
-**previous cover letter** - that is, if you're sending v2, use the Message-Id
-from v1; if you're sending v3, use the Message-Id from v2.
+Your Message-ID is `<foo.12345.author@example.com>`. This example will be used
+below as well; make sure to replace it with the correct Message-ID for your
+**previous cover letter** - that is, if you're sending v2, use the Message-ID
+from v1; if you're sending v3, use the Message-ID from v2.
While you're looking at the email, you should also note who is CC'd, as it's
common practice in the mailing list to keep all CCs on a thread. You can add
diff --git a/Documentation/RelNotes/2.30.8.txt b/Documentation/RelNotes/2.30.8.txt
index 38c23e0345..5ed3efbd6a 100644
--- a/Documentation/RelNotes/2.30.8.txt
+++ b/Documentation/RelNotes/2.30.8.txt
@@ -49,4 +49,3 @@ Taylor Blau (3):
t5619: demonstrate clone_local() with ambiguous transport
clone: delay picking a transport until after get_repo_path()
dir-iterator: prevent top-level symlinks without FOLLOW_SYMLINKS
-
diff --git a/Documentation/RelNotes/2.39.0.txt b/Documentation/RelNotes/2.39.0.txt
new file mode 100644
index 0000000000..9bf00ece53
--- /dev/null
+++ b/Documentation/RelNotes/2.39.0.txt
@@ -0,0 +1,346 @@
+Git v2.39 Release Notes
+=======================
+
+UI, Workflows & Features
+------------------------
+
+ * "git grep" learned to expand the sparse-index more lazily and on
+ demand in a sparse checkout.
+
+ * By default, use of fsmonitor on a repository on networked
+ filesystem is disabled. Add knobs to make it workable on macOS.
+
+ * After checking out a "branch" that is a symbolic-ref that points at
+ another branch, "git symbolic-ref HEAD" reports the underlying
+ branch, not the symbolic-ref the user gave checkout as argument.
+ The command learned the "--no-recurse" option to stop after
+ dereferencing a symbolic-ref only once.
+
+ * "git branch --edit-description @{-1}" is now a way to edit branch
+ description of the branch you were on before switching to the
+ current branch.
+
+ * "git merge-tree --stdin" is a new way to request a series of merges
+ and report the merge results.
+
+ * "git shortlog" learned to group by the "format" string.
+
+ * A new "--include-whitespace" option is added to "git patch-id", and
+ existing bugs in the internal patch-id logic that did not match
+ what "git patch-id" produces have been corrected.
+
+ * Enable gc.cruftpacks by default for those who opt into
+ feature.experimental setting.
+
+ * "git repack" learns to send cruft objects out of the way into
+ packfiles outside the repository.
+
+ * 'scalar reconfigure -a' is taught to automatically remove
+ scalar.repo entires which no longer exist.
+
+ * Redact headers from cURL's h2h3 module in GIT_CURL_VERBOSE and
+ others.
+
+ * 'git maintenance register' is taught to write configuration to an
+ arbitrary path, and 'git for-each-repo' is taught to expand tilde
+ characters in paths.
+
+ * When creating new notes, the template used to get a stray empty
+ newline, which has been removed.
+
+ * "git receive-pack" used to use all the local refs as the boundary for
+ checking connectivity of the data "git push" sent, but now it uses
+ only the refs that it advertised to the pusher. In a repository with
+ the .hideRefs configuration, this reduces the resources needed to
+ perform the check.
+
+ * With '--recurse-submodules=on-demand', all submodules are
+ recursively pushed.
+
+
+Performance, Internal Implementation, Development Support etc.
+--------------------------------------------------------------
+
+ * With a bit of header twiddling, use the native regexp library on
+ macOS instead of the compat/ one.
+
+ * Prepare for GNU [ef]grep that throw warning of their uses.
+
+ * Sources related to fuzz testing have been moved down to their own
+ directory.
+
+ * Most credential helpers ignored unknown entries in a credential
+ description, but a few died upon seeing them. The latter were
+ taught to ignore them, too
+
+ * "scalar unregister" in a repository that is already been
+ unregistered reported an error.
+
+ * Remove error detection from a function that fetches from promisor
+ remotes, and make it die when such a fetch fails to bring all the
+ requested objects, to give an early failure to various operations.
+
+ * Update CodingGuidelines to clarify what features to use and avoid
+ in C99.
+
+ * Avoid false-positive from LSan whose assumption may be broken with
+ higher optimization levels.
+
+ * Enable address and undefined sanitizer tasks at GitHub Actions CI.
+
+ * More UNUSED annotation to help using -Wunused option with the
+ compiler.
+ (merge 4b992f0a24 jk/unused-anno-more later to maint).
+
+ * Rewrite a deep recursion in the skipping negotiator to use a loop
+ with on-heap prio queue to avoid stack wastage.
+
+ * Add documentation for message IDs in fsck error messages.
+
+ * Define the logical elements of a "bundle list", data structure to
+ store them in-core, format to transfer them, and code to parse
+ them.
+
+ * The role the security mailing list plays in an embargoed release
+ has been documented.
+
+ * Two new facilities, "timer" and "counter", are introduced to the
+ trace2 API.
+
+ * Code simplification by using strvec_pushf() instead of building an
+ argument in a separate strbuf.
+
+ * Make sure generated dependency file is stably sorted to help
+ developers debugging their build issues.
+
+ * The glossary entries for "commit-graph file" and "reachability
+ bitmap" have been added.
+
+ * Various tests exercising the transfer.credentialsInUrl
+ configuration are taught to avoid making requests which require
+ resolving localhost to reduce CI-flakiness.
+
+ * A redundant diagnostic message is dropped from test_path_is_missing().
+
+ * Simplify the run-command API.
+
+ * Update the actions/github-script dependency in CI to avoid a
+ deprecation warning.
+
+ * Progress on being able to initialize a rev_info struct with a
+ macro.
+
+ * Add trace2 counters to the region to clear skip worktree bits in a
+ sparse checkout.
+
+ * Modernize test script to avoid "test -f" and friends.
+
+ * Avoid calling 'cache_tree_update()' when doing so would be
+ redundant.
+
+ * Update the credential-cache documentation to provide a more
+ realistic example.
+
+ * Makefile comments updates and reordering to clarify knobs used to
+ choose SHA implementations.
+
+ * A design document for sparse-checkout's future directions has been
+ added.
+
+ * Teach chainlint.pl to annotate the original test definition instead
+ of the token stream.
+
+ * "make coccicheck" is time consuming. It has been made to run more
+ incrementally.
+
+ * `parse_object()` has been hardened to check for the existence of a
+ suspected blob object.
+
+ * The build procedure has been adjusted to GNUmake version 4.4, which
+ made some changes to how pattern rule with multiple targets are
+ handled.
+
+
+Fixes since v2.38
+-----------------
+
+ * The codepath that reads from the index v4 had unaligned memory
+ accesses, which has been corrected.
+
+ * Fix messages incorrectly marked for translation.
+
+ * "git fsck" failed to release contents of tree objects already used
+ from the memory, which has been fixed.
+
+ * "git clone" did not like to see the "--bare" and the "--origin"
+ options used together without a good reason.
+
+ * "git remote rename" failed to rename a remote without fetch
+ refspec, which has been corrected.
+
+ * Documentation on various Boolean GIT_* environment variables have
+ been clarified.
+
+ * "git rebase -i" can mistakenly attempt to apply a fixup to a commit
+ itself, which has been corrected.
+
+ * "git multi-pack-index repack/expire" used to repack unreachable
+ cruft into a new pack, which have been corrected.
+
+ * In read-only repositories, "git merge-tree" tried to come up with a
+ merge result tree object, which it failed (which is not wrong) and
+ led to a segfault (which is bad), which has been corrected.
+
+ * Force C locale while running tests around httpd to make sure we can
+ find expected error messages in the log.
+
+ * Fix a logic in "mailinfo -b" that miscomputed the length of a
+ substring, which lead to an out-of-bounds access.
+
+ * The codepath to sign learned to report errors when it fails to read
+ from "ssh-keygen".
+
+ * Code clean-up that results in plugging a leak.
+
+ * "GIT_EDITOR=: git branch --edit-description" resulted in failure,
+ which has been corrected.
+
+ * The code to clean temporary object directories (used for
+ quarantine) tried to remove them inside its signal handler, which
+ was a no-no.
+
+ * Update comment in the Makefile about the RUNTIME_PREFIX config knob.
+
+ * Clarify that "the sentence after <area>: prefix does not begin with
+ a capital letter" rule applies only to the commit title.
+
+ * "git branch --edit-description" on an unborn branch misleadingly
+ said that no such branch exists, which has been corrected.
+
+ * Work around older clang that warns against C99 zero initialization
+ syntax for struct.
+
+ * Giving "--invert-grep" and "--all-match" without "--grep" to the
+ "git log" command resulted in an attempt to access grep pattern
+ expression structure that has not been allocated, which has been
+ corrected.
+ (merge db84376f98 ab/grep-simplify-extended-expression later to maint).
+
+ * "git diff rev^!" did not show combined diff to go to the rev from
+ its parents.
+ (merge a79c6b6081 rs/diff-caret-bang-with-parents later to maint).
+
+ * Allow configuration files in "protected" scopes to include other
+ configuration files.
+ (merge ecec57b3c9 gc/bare-repo-discovery later to maint).
+
+ * Give a bit more diversity to macOS CI by using sha1dc in one of the
+ jobs (the other one tests Apple Common Crypto).
+ (merge 1ad5c3df35 jc/ci-osx-with-sha1dc later to maint).
+
+ * A bugfix with tracing support in midx codepath
+ (merge e9c3839944 tb/midx-bitmap-selection-fix later to maint).
+
+ * When geometric repacking feature is in use together with the
+ --pack-kept-objects option, we lost packs marked with .keep files.
+ (merge 197443e80a tb/save-keep-pack-during-geometric-repack later to maint).
+
+ * Move a global variable added as a hack during regression fixes to
+ its proper place in the API.
+ (merge 0b0ab95f17 ab/run-hook-api-cleanup later to maint).
+
+ * Update to build procedure with VS using CMake/CTest.
+ (merge c858750b41 js/cmake-updates later to maint).
+
+ * The short-help text shown by "git cmd -h" and the synopsis text
+ shown at the beginning of "git help cmd" have been made more
+ consistent.
+
+ * When creating a multi-pack bitmap, remove per-pack bitmap files
+ unconditionally as they will never be consulted.
+ (merge 55d902cd61 tb/remove-unused-pack-bitmap later to maint).
+
+ * Fix a longstanding syntax error in Git.pm error codepath.
+
+ * "git diff --stat" etc. were invented back when everything was ASCII
+ and strlen() was a way to measure the display width of a string;
+ adjust them to compute the display width assuming UTF-8 pathnames.
+ (merge ce8529b2bb tb/diffstat-with-utf8-strwidth later to maint).
+
+ * "git branch --edit-description" can exit with status -1 which is
+ not a good practice; it learned to use 1 as everybody else instead.
+
+ * "git apply" limits its input to a bit less than 1 GiB.
+
+ * Merging a branch with directory renames into a branch that changes
+ the directory to a symlink was mishandled by the ort merge
+ strategy, which has been corrected.
+
+ * A bugfix to "git subtree" in its split and merge features.
+
+ * Fix some bugs in the reflog messages when rebasing and changes the
+ reflog messages of "rebase --apply" to match "rebase --merge" with
+ the aim of making the reflog easier to parse.
+
+ * "git rebase --keep-base" used to discard the commits that are
+ already cherry-picked to the upstream, even when "keep-base" meant
+ that the base, on top of which the history is being rebuilt, does
+ not yet include these cherry-picked commits. The --keep-base
+ option now implies --reapply-cherry-picks and --no-fork-point
+ options.
+
+ * The way "git repack" created temporary files when it received a
+ signal was prone to deadlocking, which has been corrected.
+
+ * Various tests exercising the transfer.credentialsInUrl
+ configuration are taught to avoid making requests which require
+ resolving localhost to reduce CI-flakiness.
+
+ * The adjust_shared_perm() helper function learned to refrain from
+ setting the "g+s" bit on directories when it is not necessary.
+
+ * "git archive" mistakenly complained twice about a missing
+ executable, which has been corrected.
+
+ * Fix a bug where `git branch -d` did not work on an orphaned HEAD.
+
+ * `git rebase --update-refs` would delete references when all
+ `update-ref` commands in the sequencer were removed, which has been
+ corrected.
+
+ * Fix a regression in the bisect-helper which mistakenly treats
+ arguments to the command given to 'git bisect run' as arguments to
+ the helper.
+
+ * Correct an error where `git rebase` would mistakenly use a branch or
+ tag named "refs/rewritten/xyz" when missing a rebase label.
+
+ * Assorted fixes of parsing end-user input as integers.
+ (merge 14770cf0de pw/config-int-parse-fixes later to maint).
+
+ * "git prune" may try to iterate over .git/objects/pack for trash
+ files to remove in it, and loudly fail when the directory is
+ missing, which is not necessary. The command has been taught to
+ ignore such a failure.
+ (merge 6974765352 ew/prune-with-missing-objects-pack later to maint).
+
+ * Add one more candidate directory that may house httpd modules while
+ running tests.
+ (merge 1c7dc23d41 es/locate-httpd-module-location-in-test later to maint).
+
+ * A handful of leaks in the line-log machinery have been plugged.
+
+ * The format of a line in /proc/cpuinfo that describes a CPU on s390x
+ looked different from everybody else, and the code in chainlint.pl
+ failed to parse it.
+ (merge 1f51b77f4f ah/chainlint-cpuinfo-parse-fix later to maint).
+
+ * Adjust the GitHub CI to newer ubuntu release.
+ (merge 0d3507f3e7 jx/ci-ubuntu-fix later to maint).
+
+ * Other code cleanup, docfix, build fix, etc.
+ (merge 413bc6d20a ds/cmd-main-reorder later to maint).
+ (merge 8d2863e4ed nw/t1002-cleanup later to maint).
+ (merge 7c2dc122f9 rs/list-objects-filter-leakfix later to maint).
+ (merge 288fcb1c94 zk/push-use-bitmaps later to maint).
+ (merge 42db324c0f km/merge-recursive-typofix later to maint).
diff --git a/Documentation/RelNotes/2.39.1.txt b/Documentation/RelNotes/2.39.1.txt
new file mode 100644
index 0000000000..60c86f4122
--- /dev/null
+++ b/Documentation/RelNotes/2.39.1.txt
@@ -0,0 +1,5 @@
+Git v2.39.1 Release Notes
+=========================
+
+This release merges the security fix that appears in v2.30.7; see
+the release notes for that version for details.
diff --git a/Documentation/RelNotes/2.39.2.txt b/Documentation/RelNotes/2.39.2.txt
new file mode 100644
index 0000000000..ebb9900bc5
--- /dev/null
+++ b/Documentation/RelNotes/2.39.2.txt
@@ -0,0 +1,7 @@
+Git v2.39.2 Release Notes
+=========================
+
+This release merges up the fixes that appear in v2.30.8, v2.31.7,
+v2.32.6, v2.33.7, v2.34.7, v2.35.7, v2.36.5, v2.37.6 and v2.38.4
+to address the security issues CVE-2023-22490 and CVE-2023-23946;
+see the release notes for these versions for details.
diff --git a/Documentation/RelNotes/2.39.3.txt b/Documentation/RelNotes/2.39.3.txt
new file mode 100644
index 0000000000..66351b65c2
--- /dev/null
+++ b/Documentation/RelNotes/2.39.3.txt
@@ -0,0 +1,64 @@
+Git v2.39.3 Release Notes
+=========================
+
+This release merges up the fix that appears in v2.30.9, v2.31.8,
+v2.32.7, v2.33.8, v2.34.8, v2.35.8, v2.36.6, v2.37.7 and v2.38.5 to
+address the security issues CVE-2023-25652, CVE-2023-25815, and
+CVE-2023-29007; see the release notes for these versions for
+details.
+
+This release also merges fixes that have accumulated on the 'master'
+front to prepare for the 2.40 release that are still relevant to
+2.39.x maintenance track.
+
+Fixes since v2.39.2
+-------------------
+
+ * Stop running win+VS build by default.
+
+ * CI updates. We probably want a clean-up to move the long shell
+ script embedded in yaml file into a separate file, but that can
+ come later.
+
+ * Avoid unnecessary builds in CI, with settings configured in
+ ci-config.
+
+ * Redefining system functions for a few functions did not follow our
+ usual "implement git_foo() and #define foo(args) git_foo(args)"
+ pattern, which has broken build for some folks.
+
+ * Deal with a few deprecation warning from cURL library.
+
+ * Newer regex library macOS stopped enabling GNU-like enhanced BRE,
+ where '\(A\|B\)' works as alternation, unless explicitly asked with
+ the REG_ENHANCED flag. "git grep" now can be compiled to do so, to
+ retain the old behaviour.
+
+ * When given a pattern that matches an empty string at the end of a
+ line, the code to parse the "git diff" line-ranges fell into an
+ infinite loop, which has been corrected.
+
+ * Fix the sequence to fsync $GIT_DIR/packed-refs file that forgot to
+ flush its output to the disk..
+
+ * "git diff --relative" did not mix well with "git diff --ext-diff",
+ which has been corrected.
+
+ * The logic to see if we are using the "cone" mode by checking the
+ sparsity patterns has been tightened to avoid mistaking a pattern
+ that names a single file as specifying a cone.
+
+ * Doc update for environment variables set when hooks are invoked.
+
+ * Document ORIG_HEAD a bit more.
+
+ * "git ls-tree --format='%(path) %(path)' $tree $path" showed the
+ path three times, which has been corrected.
+
+ * Document that "branch -f <branch>" disables only the safety to
+ avoid recreating an existing branch.
+
+ * Clarify how "checkout -b/-B" and "git branch [-f]" are similar but
+ different in the documentation.
+
+Also contains minor documentation updates and code clean-ups.
diff --git a/Documentation/RelNotes/2.40.0.txt b/Documentation/RelNotes/2.40.0.txt
new file mode 100644
index 0000000000..3ea445bf20
--- /dev/null
+++ b/Documentation/RelNotes/2.40.0.txt
@@ -0,0 +1,320 @@
+Git v2.40 Release Notes
+=======================
+
+UI, Workflows & Features
+
+ * "merge-tree" learns a new `--merge-base` option.
+
+ * "git jump" (in contrib/) learned to present the "quickfix list" to
+ its standard output (instead of letting it consumed by the editor
+ it invokes), and learned to also drive emacs/emacsclient.
+
+ * "git var UNKNOWN_VARIABLE" and "git var VARIABLE" with the variable
+ given an empty value used to behave identically. Now the latter
+ just gives an empty output, while the former still gives an error
+ message.
+
+ * Introduce a case insensitive mode to the Bash completion helpers.
+
+ * The advice message given by "git status" when it takes long time to
+ enumerate untracked paths has been updated.
+
+ * Just like "git var GIT_EDITOR" abstracts the complex logic to
+ choose which editor gets used behind it, "git var" now give support
+ to GIT_SEQUENCE_EDITOR.
+
+ * "git format-patch" learned to honor format.mboxrd even when sending
+ patches to the standard output stream,
+
+ * 'cat-file' gains mailmap support for its '--batch-check' and '-s'
+ options.
+
+ * Conditionally skip the pre-applypatch and applypatch-msg hooks when
+ applying patches with 'git am'.
+
+ * Introduce an optional configuration to allow the trailing hash that
+ protects the index file from bit flipping.
+
+ * "git check-attr" learned to take an optional tree-ish to read the
+ .gitattributes file from.
+
+ * "scalar" learned to give progress bar.
+
+ * "grep -P" learned to use Unicode Character Property to grok
+ character classes when processing \b and \w etc.
+
+ * "git rebase" often ignored incompatible options instead of
+ complaining, which has been corrected.
+
+ * "scalar" warns but continues when its periodic maintenance
+ feature cannot be enabled.
+
+ * The bundle-URI subsystem adds support for creation-token heuristics
+ to help incremental fetches.
+
+ * Userdiff regexp update for Java language.
+
+ * "git fetch --jobs=0" used to hit a BUG(), which has been corrected
+ to use the available CPUs.
+
+ * An invalid label or ref in the "rebase -i" todo file used to
+ trigger an runtime error. SUch an error is now diagnosed while the
+ todo file is parsed.
+
+ * The "diff" drivers specified by the "diff" attribute attached to
+ paths can now specify which algorithm (e.g. histogram) to use.
+
+ * "git range-diff" learned --abbrev=<num> option.
+
+ * "git archive HEAD^{tree}" records the paths with the current
+ timestamp in the archive, making it harder to obtain a stable
+ output. The command learned the --mtime option to specify an
+ arbitrary timestamp (e.g. --mtime="@0 +0000" for the epoch).
+
+ * The credential subsystem learned that a password may have an
+ explicit expiration.
+
+ * The format.attach configuration variable lacked a way to override a
+ value defined in a lower-priority configuration file (e.g. the
+ system one) by redefining it in a higher-priority configuration
+ file. Now, setting format.attach to an empty string means show the
+ patch inline in the e-mail message, without using MIME attachment.
+
+ This is a backward incompatible change.
+
+
+Performance, Internal Implementation, Development Support etc.
+
+ * `git bisect` becomes a builtin.
+
+ * The pack-bitmap machinery is taught to log the paths of redundant
+ bitmap(s) to trace2 instead of stderr.
+
+ * Use the SHA1DC implementation on macOS, just like other platforms,
+ by default.
+
+ * Even in a repository with promisor remote, it is useless to
+ attempt to lazily attempt fetching an object that is expected to be
+ commit, because no "filter" mode omits commit objects. Take
+ advantage of this assumption to fail fast on errors.
+
+ * Stop using "git --super-prefix" and narrow the scope of its use to
+ the submodule--helper.
+
+ * Stop running win+VS build by default.
+
+ * CI updates. We probably want a clean-up to move the long shell
+ script embedded in yaml file into a separate file, but that can
+ come later.
+
+ * Use `git diff --no-index` as a test_cmp on Windows.
+
+ We'd probably need to revisit "do we really want to, and have to,
+ lose CRLF vs LF?" later, at which time we may be able to further
+ clean this up by replacing "git diff --no-index" with "diff -u".
+
+ * Avoid unnecessary builds in CI, with settings configured in
+ ci-config.
+
+ * Plug leaks in sequencer subsystem and its users.
+
+ * In-tree .gitattributes update to match the way we recommend our
+ users to mark a file as text.
+ (merge 1f34e0cd3d po/attributes-text later to maint).
+
+ * Finally retire the scripted "git add -p/-i" implementation and have
+ everybody use the one reimplemented in C.
+
+
+Fixes since v2.39
+-----------------
+
+ * Various leak fixes.
+
+ * Fix a bug where `pack-objects` would not respect multiple `--filter`
+ arguments when invoked directly.
+ (merge d4f7036887 rs/multi-filter-args later to maint).
+
+ * Make fsmonitor more robust to avoid the flakiness seen in t7527.
+ (merge 6692d45477 jh/t7527-unflake-by-forcing-cookie later to maint).
+
+ * Stop using deprecated macOS API in fsmonitor.
+ (merge b0226007f0 jh/fsmonitor-darwin-modernize later to maint).
+
+ * Redefining system functions for a few functions did not follow our
+ usual "implement git_foo() and #define foo(args) git_foo(args)"
+ pattern, which has broken build for some folks.
+
+ * The way the diff machinery prepares the options array for the
+ parse_options API has been refactored to avoid resource leaks.
+ (merge 189e97bc4b rs/diff-parseopts later to maint).
+
+ * Correct pthread API usage.
+ (merge 786e67611d sx/pthread-error-check-fix later to maint).
+
+ * The code to auto-correct a misspelt subcommand unnecessarily called
+ into git_default_config() from the early config codepath, which was
+ a no-no. This has bee corrected.
+ (merge 0918d08887 sg/help-autocorrect-config-fix later to maint).
+
+ * "git http-fetch" (which is rarely used) forgot to identify itself
+ in the trace2 output.
+ (merge 7abb43cbc8 jt/http-fetch-trace2-report-name later to maint).
+
+ * The output from "git diff --stat" on an unmerged path lost the
+ terminating LF in Git 2.39, which has been corrected.
+ (merge 209d9cb011 pg/diff-stat-unmerged-regression-fix later to maint).
+
+ * "git pull -v --recurse-submodules" attempted to pass "-v" down to
+ underlying "git submodule update", which did not understand the
+ request and barfed, which has been corrected.
+ (merge 6f65f84766 ss/pull-v-recurse-fix later to maint).
+
+ * When given a pattern that matches an empty string at the end of a
+ line, the code to parse the "git diff" line-ranges fell into an
+ infinite loop, which has been corrected.
+
+ * Fix the sequence to fsync $GIT_DIR/packed-refs file that forgot to
+ flush its output to the disk..
+
+ * Fix to a small regression in 2.38 days.
+
+ * "git diff --relative" did not mix well with "git diff --ext-diff",
+ which has been corrected.
+
+ * The logic to see if we are using the "cone" mode by checking the
+ sparsity patterns has been tightened to avoid mistaking a pattern
+ that names a single file as specifying a cone.
+
+ * Deal with a few deprecation warning from cURL library.
+
+ * Doc update for environment variables set when hooks are invoked.
+
+ * Document ORIG_HEAD a bit more.
+
+ * "git ls-tree --format='%(path) %(path)' $tree $path" showed the
+ path three times, which has been corrected.
+
+ * Remove "git env--helper" and demote it to a test-tool subcommand.
+ (merge 4a1baacd46 ab/test-env-helper later to maint).
+
+ * Newer regex library macOS stopped enabling GNU-like enhanced BRE,
+ where '\(A\|B\)' works as alternation, unless explicitly asked with
+ the REG_ENHANCED flag. "git grep" now can be compiled to do so, to
+ retain the old behaviour.
+
+ * Pthread emulation on Win32 leaked thread handle when a thread is
+ joined.
+ (merge 238a9dfe86 sk/win32-close-handle-upon-pthread-join later to maint).
+
+ * "git send-email -v 3" used to be expanded to "git send-email
+ --validate 3" when the user meant to pass them down to
+ "format-patch", which has been corrected.
+ (merge 8774aa56ad km/send-email-with-v-reroll-count later to maint).
+
+ * Document that "branch -f <branch>" disables only the safety to
+ avoid recreating an existing branch.
+
+ * "git fetch <group>", when "<group>" of remotes lists the same
+ remote twice, unnecessarily failed when parallel fetching was
+ enabled, which has been corrected.
+ (merge 06a668cb90 cw/fetch-remote-group-with-duplication later to maint).
+
+ * Clarify how "checkout -b/-B" and "git branch [-f]" are similar but
+ different in the documentation.
+
+ * "git hash-object" now checks that the resulting object is well
+ formed with the same code as "git fsck".
+ (merge 8e4309038f jk/hash-object-fsck later to maint).
+
+ * Improve the error message given when private key is not loaded in
+ the ssh agent in the codepath to sign with an ssh key.
+ (merge dce7b31126 as/ssh-signing-improve-key-missing-error later to maint).
+
+ * Adjust "git request-pull" to strip embedded signature from signed
+ tags to notice non-PGP signatures.
+ (merge a9cad02538 gm/request-pull-with-non-pgp-signed-tags later to maint).
+
+ * Remove support for MSys, which now lags way behind MSys2.
+ (merge 2987407f3c hj/remove-msys-support later to maint).
+
+ * Fix use of CreateThread() API call made early in the windows
+ start-up code.
+ (merge 592bcab61b sk/winansi-createthread-fix later to maint).
+
+ * "git pack-objects" learned to release delta-island bitmap data when
+ it is done using it, saving peak heap memory usage.
+ (merge 647982bb71 ew/free-island-marks later to maint).
+
+ * In an environment where dynamically generated code is prohibited to
+ run (e.g. SELinux), failure to JIT pcre patterns is expected. Fall
+ back to interpreted execution in such a case.
+ (merge 50b6ad55b0 cb/grep-fallback-failing-jit later to maint).
+
+ * "git name-rev" heuristics update.
+ (merge b2182a8730 en/name-rev-make-taggerdate-much-less-important later to maint).
+
+ * Remove more remaining uses of macros that relies on the_index
+ singleton instance without explicitly spelling it out.
+
+ * Remove unnecessary explicit sizing of strbuf.
+ (merge 93ea118bed rs/cache-tree-strbuf-growth-fix later to maint).
+
+ * Doc update.
+ (merge d9ec3b0dc0 jk/doc-ls-remote-matching later to maint).
+
+ * Error messages given upon a signature verification failure used to
+ discard the errors from underlying gpg program, which has been
+ corrected.
+ (merge ad6b320756 js/gpg-errors later to maint).
+
+ * Update --date=default documentation.
+ (merge 9deef088ae rd/doc-default-date-format later to maint).
+
+ * A test helper had a single write(2) of 256kB, which was too big for
+ some platforms (e.g. NonStop), which has been corrected by using
+ xwrite() wrapper appropriately.
+ (merge 58eab6ff13 jc/genzeros-avoid-raw-write later to maint).
+
+ * sscanf(3) used in "git symbolic-ref --short" implementation found
+ to be not working reliably on macOS in UTF-8 locales. Rewrite the
+ code to avoid sscanf() altogether to work it around.
+ (merge 613bef56b8 jk/shorten-unambiguous-ref-wo-sscanf later to maint).
+
+ * Various fix-ups on HTTP tests.
+ (merge 8f2146dbf1 jk/http-test-fixes later to maint).
+
+ * Fixes to code that parses the todo file used in "rebase -i".
+ (merge 666b6e1135 pw/rebase-i-parse-fix later to maint).
+
+ * Test library clean-up.
+ (merge c600a91c94 ar/test-lib-remove-stale-comment later to maint).
+
+ * Other code cleanup, docfix, build fix, etc.
+ (merge 4eb1ccecd4 dh/mingw-ownership-check-typofix later to maint).
+ (merge f95526419b ar/typofix-gitattributes-doc later to maint).
+ (merge 27875aeec9 km/doc-branch-start-point later to maint).
+ (merge 35c194dc57 es/t1509-root-fixes later to maint).
+ (merge 7b341645e3 pw/ci-print-failure-name-fix later to maint).
+ (merge bcb71d45bf jx/t1301-updates later to maint).
+ (merge ebdc46c242 jc/doc-diff-patch.txt later to maint).
+ (merge a87a20cbb4 ar/test-cleanup later to maint).
+ (merge f5156f1885 ar/bisect-doc-update later to maint).
+ (merge fca2d86c97 jk/interop-error later to maint).
+ (merge cf4936ed74 tl/ls-tree-code-clean-up later to maint).
+ (merge dcb47e52b0 en/t6426-todo-cleanup later to maint).
+ (merge 5b8db44bdd jc/format-patch-v-unleak later to maint).
+ (merge 590b636737 jk/hash-object-literally-fd-leak later to maint).
+ (merge 5458ba0a4d tb/t0003-invoke-dd-more-portably later to maint).
+ (merge 70661d288b ar/markup-em-dash later to maint).
+ (merge e750951e74 en/ls-files-doc-update later to maint).
+ (merge 4f542975d1 mh/doc-credential-cache-only-in-core later to maint).
+ (merge 3a2ebaebc7 gc/index-format-doc later to maint).
+ (merge b08edf709d jk/httpd-test-updates later to maint).
+ (merge d85e9448dd wl/new-command-doc later to maint).
+ (merge d912a603ed kf/t5000-modernise later to maint).
+ (merge e65b868d07 rs/size-t-fixes later to maint).
+ (merge 3eb1e1ca9a ab/config-h-remove-unused later to maint).
+ (merge d390e08076 cw/doc-pushurl-vs-url later to maint).
+ (merge 567342fc77 rs/ctype-test later to maint).
+ (merge d35d8f2e7a ap/t2015-style-update later to maint).
diff --git a/Documentation/RelNotes/2.40.1.txt b/Documentation/RelNotes/2.40.1.txt
new file mode 100644
index 0000000000..e72f6b1b25
--- /dev/null
+++ b/Documentation/RelNotes/2.40.1.txt
@@ -0,0 +1,8 @@
+Git v2.40.1 Release Notes
+=========================
+
+This release merges up the fix that appears in v2.30.9, v2.31.8,
+v2.32.7, v2.33.8, v2.34.8, v2.35.8, v2.36.6, v2.37.7, v2.38.5
+and v2.39.3 to address the security issues CVE-2023-25652,
+CVE-2023-25815, and CVE-2023-29007; see the release notes for these
+versions for details.
diff --git a/Documentation/RelNotes/2.41.0.txt b/Documentation/RelNotes/2.41.0.txt
new file mode 100644
index 0000000000..fa2834bd72
--- /dev/null
+++ b/Documentation/RelNotes/2.41.0.txt
@@ -0,0 +1,348 @@
+Git v2.41 Release Notes
+=======================
+
+UI, Workflows & Features
+
+ * Allow information carried on the WWW-AUthenticate header to be
+ passed to the credential helpers.
+
+ * A new "fetch.hideRefs" option can be used to exclude specified refs
+ from "rev-list --objects --stdin --not --all" traversal for
+ checking object connectivity, most useful when there are many
+ unrelated histories in a single repository.
+
+ * "git push" has been taught to allow deletion of refs with one-level
+ names to help repairing a repository who acquired such a ref by
+ mistake. In general, we don't encourage use of such a ref, and
+ creation or update to such a ref is rejected as before.
+
+ * Allow "git bisect reset" to check out the original branch when the
+ branch is already checked out in a different worktree linked to the
+ same repository.
+
+ * A few subcommands have been taught to stop users from working on a
+ branch that is being used in another worktree linked to the same
+ repository.
+
+ * "git format-patch" learned to write a log-message only output file
+ for empty commits.
+
+ * "git format-patch" honors the src/dst prefixes set to nonstandard
+ values with configuration variables like "diff.noprefix", causing
+ receiving end of the patch that expects the standard -p1 format to
+ break. "format-patch" has been taught to ignore end-user configuration
+ and always use the standard prefixes.
+
+ This is a backward compatibility breaking change.
+
+ * Lift the limitation that colored prompts can only be used with
+ PROMPT_COMMAND mode.
+
+ * "git blame --contents=<file> <rev> -- <path>" used to be forbidden,
+ but now it finds the origins of lines starting at <file> contents
+ through the history that leads to <rev>.
+
+ * "git pack-redundant" gave a warning when run, as the command has
+ outlived its usefulness long ago and is nominated for future
+ removal. Now we escalate to give an error.
+
+ * "git clone" from an empty repository learned to propagate the
+ choice of the hash algorithm from the source repository to the
+ newly created repository.
+
+ * "git mergetool" and "git difftool" learns a new configuration
+ guiDefault to optionally favor configured guitool over non-gui-tool
+ automatically when $DISPLAY is set.
+
+ * "git branch -d origin/master" would say "no such branch", but it is
+ likely a missed "-r" if refs/remotes/origin/master exists. The
+ command has been taught to give such a hint in its error message.
+
+ * Clean-up of the code path that deals with merge strategy option
+ handling in "git rebase".
+
+ * "git clone --local" stops copying from an original repository that
+ has symbolic links inside its $GIT_DIR; an error message when that
+ happens has been updated.
+
+ * "git branch --format=..." and "git format-patch --format=..."
+ learns "--omit-empty" to hide refs that whose formatting result
+ becomes an empty string from the output.
+
+ * The sendemail-validate validate hook learned to pass the total
+ number of input files and where in the sequence each invocation is
+ via environment variables.
+
+ * When "gc" needs to retain unreachable objects, packing them into
+ cruft packs (instead of exploding them into loose object files) has
+ been offered as a more efficient option for some time. Now the use
+ of cruft packs has been made the default and no longer considered
+ an experimental feature.
+
+ * The output given by "git blame" that attributes a line to contents
+ taken from the file specified by the "--contents" option shows it
+ differently from a line attributed to the working tree file.
+
+ * "git send-email" learned to give the e-mail headers to the validate
+ hook by passing an extra argument from the command line.
+
+ * The credential subsystem learns to help OAuth framework.
+
+ * The titles of manual pages used to be chomped at an unreasonably
+ short limit, which has been removed.
+
+
+Performance, Internal Implementation, Development Support etc.
+
+ * Code clean-up to clarify directory traversal API.
+
+ * Code clean-up to clarify the rule that "git-compat-util.h" must be
+ the first to be included.
+
+ * More work towards -Wunused.
+
+ * Instead of forcing each command to choose to honor GPG related
+ configuration variables, make the subsystem lazily initialize
+ itself.
+
+ * Remove workaround for ancient versions of DocBook to make it work
+ correctly with groff, which has not been necessary since docbook
+ 1.76 from 2010.
+
+ * Code clean-up to include and/or uninclude parse-options.h file as
+ needed.
+
+ * The code path that reports what "git fetch" did to each ref has
+ been cleaned up.
+
+ * Assorted config API updates.
+
+ * A few configuration variables to tell the cURL library that
+ different types of ssl-cert and ssl-key are in use have been added.
+
+ * Split key function and data structure definitions out of cache.h to
+ new header files and adjust the users.
+
+ * "git fetch --all" does not have to download and handle the same
+ bundleURI over and over, which has been corrected.
+
+ * "git sparse-checkout" command learns a debugging aid for the sparse
+ rule definitions.
+
+ * "git write-tree" learns to work better with sparse-index.
+
+ * The on-disk reverse index that allows mapping from the pack offset
+ to the object name for the object stored at the offset has been
+ enabled by default.
+
+ * "git fsck" learned to validate the on-disk pack reverse index files.
+
+ * strtok() and strtok_r() are banned in this codebase.
+
+ * The detect-compilers script to help auto-tweaking the build system
+ had trouble working with compilers whose version number has extra
+ suffixes. The script has been taught that certain suffixes (like
+ "-win32" in "gcc 10-win32") can be safely stripped as they share
+ the same features and bugs with the version without the suffix.
+
+ * ctype tests have been taught to test EOF, too.
+
+ * The implementation of credential helpers used fgets() over fixed
+ size buffers to read protocol messages, causing the remainder of
+ the folded long line to trigger unexpected behaviour, which has
+ been corrected.
+
+ * The implementation of the default "negotiator", used to find common
+ ancestor over the network for object tranfer, used to be recursive;
+ it was updated to be iterative to conserve stackspace usage.
+
+ * Our custom callout formatter is no longer used in the documentation
+ formatting toolchain, as the upstream default ones give better
+ output these days.
+
+
+Fixes since v2.40
+-----------------
+
+ * "git fsck" learned to check the index files in other worktrees,
+ just like "git gc" honors them as anchoring points.
+ (merge 8d3e7eac52 jk/fsck-indices-in-worktrees later to maint).
+
+ * Fix a segfaulting loop. The function and its caller may need
+ further clean-up.
+ (merge c5773dc078 ew/commit-reach-clean-up-flags-fix later to maint).
+
+ * "git restore" supports options like "--ours" that are only
+ meaningful during a conflicted merge, but these options are only
+ meaningful when updating the working tree files. These options are
+ marked to be incompatible when both "--staged" and "--worktree" are
+ in effect.
+ (merge ee8a88826a ak/restore-both-incompatible-with-conflicts later to maint).
+
+ * Simplify UI to control progress meter given by "git bundle" command.
+ (merge 8b95521edb jk/bundle-progress later to maint).
+
+ * "git bundle" learned that "-" is a common way to say that the input
+ comes from the standard input and/or the output goes to the
+ standard output. It used to work only for output and only from the
+ root level of the working tree.
+ (merge 0bbe10313e jk/bundle-use-dash-for-stdfiles later to maint).
+
+ * Once we start running, we assumed that the list of alternate object
+ databases would never change. Hook into the machinery used to
+ update the list of packfiles during runtime to update this list as
+ well.
+ (merge e2d003dbed ds/reprepare-alternates-when-repreparing-packfiles later to maint).
+
+ * The code to parse "git rebase -X<opt>" was not prepared to see an
+ unparsable option string, which has been corrected.
+ (merge 15a4cc912e ab/fix-strategy-opts-parsing later to maint).
+
+ * "git add -p" while the index is unmerged sometimes failed to parse
+ the diff output it internally produces and died, which has been
+ corrected.
+ (merge 28d1122f9c jk/add-p-unmerged-fix later to maint).
+
+ * Fix for a "ls-files --format="%(path)" that produced nonsense
+ output, which was a bug in 2.38.
+ (merge cfb62dd006 aj/ls-files-format-fix later to maint).
+
+ * "git receive-pack" that responds to "git push" requests failed to
+ clean a stale lockfile when killed in the middle, which has been
+ corrected.
+ (merge c55c30669c ps/receive-pack-unlock-before-die later to maint).
+
+ * "git rev-parse --quiet foo@{u}", or anything that asks @{u} to be
+ parsed with GET_OID_QUIETLY option, did not quietly fail, which has
+ been corrected.
+ (merge dfbfdc521d fc/oid-quietly-parse-upstream later to maint).
+
+ * Transports that do not support protocol v2 did not correctly fall
+ back to protocol v0 under certain conditions, which has been
+ corrected.
+ (merge eaa0fd6584 jk/fix-proto-downgrade-to-v0 later to maint).
+
+ * time(2) on glib 2.31+, especially on Linux, goes out of sync with
+ higher resolution timers used for gettimeofday(2) and by the
+ filesystem. Replace all calls to it with a git_time() wrapper and
+ (merge 370ddcbc89 pe/time-use-gettimeofday later to maint).
+
+ * Code clean-up to use designated initializers in parse-options API.
+ (merge 353e6d4554 sg/parse-options-h-initializers later to maint).
+
+ * A recent-ish change to allow unicode character classes to be used
+ with "grep -P" triggered a JIT bug in older pcre2 libraries.
+ The problematic change in Git built with these older libraries has
+ been disabled to work around the bug.
+ (merge 14b9a04479 mk/workaround-pcre-jit-ucp-bug later to maint).
+
+ * The wildmatch library code unlearns exponential behaviour it
+ acquired some time ago since it was borrowed from rsync.
+ (merge 3dc0b7f0dc pw/wildmatch-fixes later to maint).
+
+ * The index files can become corrupt under certain conditions when
+ the split-index feature is in use, especially together with
+ fsmonitor, which have been corrected.
+ (merge 061dd722dc js/split-index-fixes later to maint).
+
+ * Document what the pathname-looking strings in "rev-list --object"
+ output are for and what they mean.
+ (merge 15364d2a3c jk/document-rev-list-object-name later to maint).
+
+ * Fix unnecessary truncation of generation numbers used in-core.
+ (merge d3af1c193d ps/ahead-behind-truncation-fix later to maint).
+
+ * Code clean-up around the use of the_repository.
+ (merge 4a93b899c1 ab/remove-implicit-use-of-the-repository later to maint).
+
+ * Consistently spell "Message-ID" as such, not "Message-Id".
+ (merge ba4324c4e1 jc/spell-id-in-both-caps-in-message-id later to maint).
+
+ * Correct use of an uninitialized structure member.
+ (merge dc12ee77ab jx/cap-object-info-uninitialized-fix later to maint).
+
+ * Tests had a few places where we ignored PERL_PATH and blindly used
+ /usr/bin/perl, which have been corrected.
+ (merge c1917156a0 jk/use-perl-path-consistently later to maint).
+
+ * Documentation mark-up fix.
+ (merge 78b6369e67 la/mfc-markup-fix later to maint).
+
+ * Doc toolchain update to remove old workaround for AsciiDoc.
+ (merge 8806120de6 fc/remove-header-workarounds-for-asciidoc later to maint).
+
+ * The userdiff regexp patterns for various filetypes that are built
+ into the system have been updated to avoid triggering regexp errors
+ from UTF-8 aware regex engines.
+ (merge be39144954 rs/userdiff-multibyte-regex later to maint).
+
+ * The approxidate() API has been simplified by losing an extra
+ function that did the same thing as another one.
+ (merge 8a7f0b666f rs/remove-approxidate-relative later to maint).
+
+ * Code clean-up to replace a hardcoded constant with a CPP macro.
+ (merge c870de6502 rs/get-tar-commit-id-use-defined-const later to maint).
+
+ * Doc build simplification.
+ (merge 9a09ed3229 fc/doc-stop-using-manversion later to maint).
+
+ * "git archive" run from a subdirectory mishandled attributes and
+ paths outside the current directory.
+ (merge 92b1dd1b9e rs/archive-from-subdirectory-fixes later to maint).
+
+ * The code to parse capability list for v0 on-wire protocol fell into
+ an infinite loop when a capability appears multiple times, which
+ has been corrected.
+
+ * Geometric repacking ("git repack --geometric=<n>") in a repository
+ that borrows from an alternate object database had various corner
+ case bugs, which have been corrected.
+ (merge d85cd18777 ps/fix-geom-repack-with-alternates later to maint).
+
+ * The "%GT" placeholder for the "--format" option of "git log" and
+ friends caused BUG() to trigger on a commit signed with an unknown
+ key, which has been corrected.
+ (merge 7891e46585 jk/gpg-trust-level-fix later to maint).
+
+ * The completion script used to use bare "read" without the "-r"
+ option to read the contents of various state files, which risked
+ getting confused with backslashes in them. This has been
+ corrected.
+ (merge 197152098a ek/completion-use-read-r-to-read-literally later to maint).
+
+ * A small API fix to the ort merge strategy backend.
+ (merge 000c4ceca7 en/ort-finalize-after-0-merges-fix later to maint).
+
+ * The commit object parser has been taught to be a bit more lenient
+ to parse timestamps on the author/committer line with a malformed
+ author/committer ident.
+ (merge 90ef0f14eb jk/parse-commit-with-malformed-ident later to maint).
+
+ * Retitle a test script with an overly narrow name.
+ (merge 8bb19c14fb ob/t3501-retitle later to maint).
+
+ * Doc update to clarify how text and eol attributes interact to
+ specify the end-of-line conversion.
+ (merge 6696077ace ah/doc-attributes-text later to maint).
+
+ * Other code cleanup, docfix, build fix, etc.
+ (merge f7111175df as/doc-markup-fix later to maint).
+ (merge 90ff7c9898 fc/test-aggregation-clean-up later to maint).
+ (merge 9b0c7f308a jc/am-doc-refer-to-format-patch later to maint).
+ (merge b10cbdac4c bb/unicode-width-table-15 later to maint).
+ (merge 3457b50e8c ab/retire-scripted-add-p later to maint).
+ (merge d52fcf493b ds/p2000-fix-grep-sparse later to maint).
+ (merge ec063d2591 ss/hashmap-typofix later to maint).
+ (merge 1aaed69d11 rs/archive-mtime later to maint).
+ (merge 2da2cc9b28 ob/rollback-after-commit-lock-failure later to maint).
+ (merge 54dbd0933b ob/sequencer-save-head-simplify later to maint).
+ (merge a93cbe8d78 ar/test-cleanup-unused-file-creation later to maint).
+ (merge cc48ddd937 jk/chainlint-fixes later to maint).
+ (merge 4833b08426 ow/ref-format-remove-unused-member later to maint).
+ (merge d0ea2ca1cf dw/doc-submittingpatches-grammofix later to maint).
+ (merge fd72637423 ar/t2024-checkout-output-fix later to maint).
+ (merge d45cbe3fe0 ob/sequencer-i18n-fix later to maint).
+ (merge b734fe49fd ob/messages-capitalize-exception later to maint).
+ (merge ad353d7e77 ma/gittutorial-fixes later to maint).
+ (merge a5855fd8d4 ar/test-cleanup-unused-file-creation-part2 later to maint).
+ (merge 0c5308af30 sd/doc-gitignore-and-rm-cached later to maint).
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 927f7329a5..b218e27357 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -543,7 +543,7 @@ trigger a new CI build to ensure all tests pass.
[[mua]]
== MUA specific hints
-Some of patches I receive or pick up from the list share common
+Some of the patches I receive or pick up from the list share common
patterns of breakage. Please make sure your MUA is set up
properly not to corrupt whitespaces.
diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf
index 3e4c13971b..60f76f43ed 100644
--- a/Documentation/asciidoc.conf
+++ b/Documentation/asciidoc.conf
@@ -51,25 +51,6 @@ ifdef::doctype-manpage[]
endif::doctype-manpage[]
endif::backend-docbook[]
-ifdef::doctype-manpage[]
-ifdef::backend-docbook[]
-[header]
-template::[header-declarations]
-<refentry>
-<refmeta>
-<refentrytitle>{mantitle}</refentrytitle>
-<manvolnum>{manvolnum}</manvolnum>
-<refmiscinfo class="source">{mansource}</refmiscinfo>
-<refmiscinfo class="version">{manversion}</refmiscinfo>
-<refmiscinfo class="manual">{manmanual}</refmiscinfo>
-</refmeta>
-<refnamediv>
- <refname>{manname}</refname>
- <refpurpose>{manpurpose}</refpurpose>
-</refnamediv>
-endif::backend-docbook[]
-endif::doctype-manpage[]
-
ifdef::backend-xhtml11[]
[attributes]
git-relative-html-prefix=
diff --git a/Documentation/blame-options.txt b/Documentation/blame-options.txt
index 9a663535f4..552dcc60f2 100644
--- a/Documentation/blame-options.txt
+++ b/Documentation/blame-options.txt
@@ -64,11 +64,9 @@ include::line-range-format.txt[]
manual page.
--contents <file>::
- When <rev> is not specified, the command annotates the
- changes starting backwards from the working tree copy.
- This flag makes the command pretend as if the working
- tree copy has the contents of the named file (specify
- `-` to make the command read from the standard input).
+ Annotate using the contents from the named file, starting from <rev>
+ if it is specified, and HEAD otherwise. You may specify '-' to make
+ the command read from the standard input for the file contents.
--date <format>::
Specifies the format used to output dates. If --date is not
diff --git a/Documentation/build-docdep.perl b/Documentation/build-docdep.perl
index ba4205e030..1b3ac8fdd9 100755
--- a/Documentation/build-docdep.perl
+++ b/Documentation/build-docdep.perl
@@ -38,9 +38,10 @@ while ($changed) {
}
}
-while (my ($text, $included) = each %include) {
+foreach my $text (sort keys %include) {
+ my $included = $include{$text};
if (! exists $included{$text} &&
(my $base = $text) =~ s/\.txt$//) {
- print "$base.html $base.xml : ", join(" ", keys %$included), "\n";
+ print "$base.html $base.xml : ", join(" ", sort keys %$included), "\n";
}
}
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 5b5b976569..0e93aef862 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -387,6 +387,8 @@ include::config/branch.txt[]
include::config/browser.txt[]
+include::config/bundle.txt[]
+
include::config/checkout.txt[]
include::config/clean.txt[]
@@ -423,6 +425,8 @@ include::config/filter.txt[]
include::config/fsck.txt[]
+include::config/fsmonitor--daemon.txt[]
+
include::config/gc.txt[]
include::config/gitcvs.txt[]
diff --git a/Documentation/config/add.txt b/Documentation/config/add.txt
index 3e859f3419..e0354ceaed 100644
--- a/Documentation/config/add.txt
+++ b/Documentation/config/add.txt
@@ -7,6 +7,7 @@ add.ignore-errors (deprecated)::
variables.
add.interactive.useBuiltin::
- Set to `false` to fall back to the original Perl implementation of
- the interactive version of linkgit:git-add[1] instead of the built-in
- version. Is `true` by default.
+ Unused configuration variable. Used in Git versions v2.25.0 to
+ v2.36.0 to enable the built-in version of linkgit:git-add[1]'s
+ interactive mode, which then became the default in Git
+ versions v2.37.0 to v2.39.0.
diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt
index a00d0100a8..c96b5b2e5d 100644
--- a/Documentation/config/advice.txt
+++ b/Documentation/config/advice.txt
@@ -136,4 +136,6 @@ advice.*::
Advice shown when either linkgit:git-add[1] or linkgit:git-rm[1]
is asked to update index entries outside the current sparse
checkout.
+ diverging::
+ Advice shown when a fast-forward is not possible.
--
diff --git a/Documentation/config/bundle.txt b/Documentation/config/bundle.txt
new file mode 100644
index 0000000000..3faae38685
--- /dev/null
+++ b/Documentation/config/bundle.txt
@@ -0,0 +1,31 @@
+bundle.*::
+ The `bundle.*` keys may appear in a bundle list file found via the
+ `git clone --bundle-uri` option. These keys currently have no effect
+ if placed in a repository config file, though this will change in the
+ future. See link:technical/bundle-uri.html[the bundle URI design
+ document] for more details.
+
+bundle.version::
+ This integer value advertises the version of the bundle list format
+ used by the bundle list. Currently, the only accepted value is `1`.
+
+bundle.mode::
+ This string value should be either `all` or `any`. This value describes
+ whether all of the advertised bundles are required to unbundle a
+ complete understanding of the bundled information (`all`) or if any one
+ of the listed bundle URIs is sufficient (`any`).
+
+bundle.heuristic::
+ If this string-valued key exists, then the bundle list is designed to
+ work well with incremental `git fetch` commands. The heuristic signals
+ that there are additional keys available for each bundle that help
+ determine which subset of bundles the client should download. The
+ only value currently understood is `creationToken`.
+
+bundle.<id>.*::
+ The `bundle.<id>.*` keys are used to describe a single item in the
+ bundle list, grouped under `<id>` for identification purposes.
+
+bundle.<id>.uri::
+ This string value defines the URI by which Git can reach the contents
+ of this `<id>`. This URI may be a bundle file or another bundle list.
diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt
index 37afbaf5a4..dfbdaf00b8 100644
--- a/Documentation/config/core.txt
+++ b/Documentation/config/core.txt
@@ -618,7 +618,7 @@ but risks losing recent work in the event of an unclean system shutdown.
* `loose-object` hardens objects added to the repo in loose-object form.
* `pack` hardens objects added to the repo in packfile form.
* `pack-metadata` hardens packfile bitmaps and indexes.
-* `commit-graph` hardens the commit graph file.
+* `commit-graph` hardens the commit-graph file.
* `index` hardens the index when it is modified.
* `objects` is an aggregate option that is equivalent to
`loose-object,pack`.
diff --git a/Documentation/config/difftool.txt b/Documentation/config/difftool.txt
index a3f8211210..447c40d85a 100644
--- a/Documentation/config/difftool.txt
+++ b/Documentation/config/difftool.txt
@@ -34,3 +34,10 @@ See the `--trust-exit-code` option in linkgit:git-difftool[1] for more details.
difftool.prompt::
Prompt before each invocation of the diff tool.
+
+difftool.guiDefault::
+ Set `true` to use the `diff.guitool` by default (equivalent to specifying
+ the `--gui` argument), or `auto` to select `diff.guitool` or `diff.tool`
+ depending on the presence of a `DISPLAY` environment variable value. The
+ default is `false`, where the `--gui` argument must be provided
+ explicitly for the `diff.guitool` to be used.
diff --git a/Documentation/config/feature.txt b/Documentation/config/feature.txt
index cdecd04e5b..17b4d39f89 100644
--- a/Documentation/config/feature.txt
+++ b/Documentation/config/feature.txt
@@ -20,6 +20,11 @@ feature.manyFiles::
working directory. With many files, commands such as `git status` and
`git checkout` may be slow and these new defaults improve performance:
+
+* `index.skipHash=true` speeds up index writes by not computing a trailing
+ checksum. Note that this will cause Git versions earlier than 2.13.0 to
+ refuse to parse the index and Git versions earlier than 2.40.0 will report
+ a corrupted index during `git fsck`.
++
* `index.version=4` enables path-prefix compression in the index.
+
* `core.untrackedCache=true` enables the untracked cache. This setting assumes
diff --git a/Documentation/config/fetch.txt b/Documentation/config/fetch.txt
index cd65d236b4..568f0f75b3 100644
--- a/Documentation/config/fetch.txt
+++ b/Documentation/config/fetch.txt
@@ -96,3 +96,27 @@ fetch.writeCommitGraph::
merge and the write may take longer. Having an updated commit-graph
file helps performance of many Git commands, including `git merge-base`,
`git push -f`, and `git log --graph`. Defaults to false.
+
+fetch.bundleURI::
+ This value stores a URI for downloading Git object data from a bundle
+ URI before performing an incremental fetch from the origin Git server.
+ This is similar to how the `--bundle-uri` option behaves in
+ linkgit:git-clone[1]. `git clone --bundle-uri` will set the
+ `fetch.bundleURI` value if the supplied bundle URI contains a bundle
+ list that is organized for incremental fetches.
++
+If you modify this value and your repository has a `fetch.bundleCreationToken`
+value, then remove that `fetch.bundleCreationToken` value before fetching from
+the new bundle URI.
+
+fetch.bundleCreationToken::
+ When using `fetch.bundleURI` to fetch incrementally from a bundle
+ list that uses the "creationToken" heuristic, this config value
+ stores the maximum `creationToken` value of the downloaded bundles.
+ This value is used to prevent downloading bundles in the future
+ if the advertised `creationToken` is not strictly larger than this
+ value.
++
+The creation token values are chosen by the provider serving the specific
+bundle URI. If you modify the URI at `fetch.bundleURI`, then be sure to
+remove the value for the `fetch.bundleCreationToken` value before fetching.
diff --git a/Documentation/config/format.txt b/Documentation/config/format.txt
index c7303d8d9f..8cf6f00d93 100644
--- a/Documentation/config/format.txt
+++ b/Documentation/config/format.txt
@@ -3,7 +3,8 @@ format.attach::
'format-patch'. The value can also be a double quoted string
which will enable attachments as the default and set the
value as the boundary. See the --attach option in
- linkgit:git-format-patch[1].
+ linkgit:git-format-patch[1]. To countermand an earlier
+ value, set it to an empty string.
format.from::
Provides the default value for the `--from` option to format-patch.
@@ -139,3 +140,14 @@ For example,
------------
+
will only show notes from `refs/notes/bar`.
+
+format.mboxrd::
+ A boolean value which enables the robust "mboxrd" format when
+ `--stdout` is in use to escape "^>+From " lines.
+
+format.noprefix::
+ If set, do not show any source or destination prefix in patches.
+ This is equivalent to the `diff.noprefix` option used by `git
+ diff` (but which is not respected by `format-patch`). Note that
+ by setting this, the receiver of any patches you generate will
+ have to apply them using the `-p0` option.
diff --git a/Documentation/config/fsck.txt b/Documentation/config/fsck.txt
index 450e8c38e3..a3c865df56 100644
--- a/Documentation/config/fsck.txt
+++ b/Documentation/config/fsck.txt
@@ -35,6 +35,10 @@ allow new instances of the same breakages go unnoticed.
Setting an unknown `fsck.<msg-id>` value will cause fsck to die, but
doing the same for `receive.fsck.<msg-id>` and `fetch.fsck.<msg-id>`
will only cause git to warn.
++
+See `Fsck Messages` section of linkgit:git-fsck[1] for supported
+values of `<msg-id>`.
+
fsck.skipList::
The path to a list of object names (i.e. one unabbreviated SHA-1 per
diff --git a/Documentation/config/fsmonitor--daemon.txt b/Documentation/config/fsmonitor--daemon.txt
new file mode 100644
index 0000000000..c225c6c9e7
--- /dev/null
+++ b/Documentation/config/fsmonitor--daemon.txt
@@ -0,0 +1,11 @@
+fsmonitor.allowRemote::
+ By default, the fsmonitor daemon refuses to work against network-mounted
+ repositories. Setting `fsmonitor.allowRemote` to `true` overrides this
+ behavior. Only respected when `core.fsmonitor` is set to `true`.
+
+fsmonitor.socketDir::
+ This Mac OS-specific option, if set, specifies the directory in
+ which to create the Unix domain socket used for communication
+ between the fsmonitor daemon and various Git commands. The directory must
+ reside on a native Mac OS filesystem. Only respected when `core.fsmonitor`
+ is set to `true`.
diff --git a/Documentation/config/gc.txt b/Documentation/config/gc.txt
index 38fea076a2..7f95c866e1 100644
--- a/Documentation/config/gc.txt
+++ b/Documentation/config/gc.txt
@@ -43,11 +43,11 @@ gc.autoDetach::
if the system supports it. Default is true.
gc.bigPackThreshold::
- If non-zero, all packs larger than this limit are kept when
- `git gc` is run. This is very similar to `--keep-largest-pack`
- except that all packs that meet the threshold are kept, not
- just the largest pack. Defaults to zero. Common unit suffixes of
- 'k', 'm', or 'g' are supported.
+ If non-zero, all non-cruft packs larger than this limit are kept
+ when `git gc` is run. This is very similar to
+ `--keep-largest-pack` except that all non-cruft packs that meet
+ the threshold are kept, not just the largest pack. Defaults to
+ zero. Common unit suffixes of 'k', 'm', or 'g' are supported.
+
Note that if the number of kept packs is more than gc.autoPackLimit,
this configuration variable is ignored, all packs except the base pack
@@ -84,7 +84,7 @@ gc.packRefs::
gc.cruftPacks::
Store unreachable objects in a cruft pack (see
linkgit:git-repack[1]) instead of as loose objects. The default
- is `false`.
+ is `true`.
gc.pruneExpire::
When 'git gc' is run, it will call 'prune --expire 2.weeks.ago'
diff --git a/Documentation/config/gpg.txt b/Documentation/config/gpg.txt
index 86f6308c4c..37e2831cd5 100644
--- a/Documentation/config/gpg.txt
+++ b/Documentation/config/gpg.txt
@@ -12,6 +12,9 @@ gpg.program::
gpg.format::
Specifies which key format to use when signing with `--gpg-sign`.
Default is "openpgp". Other possible values are "x509", "ssh".
++
+See linkgit:gitformat-signature[5] for the signature format, which differs
+based on the selected `gpg.format`.
gpg.<format>.program::
Use this to customize the program used for the signing format you
diff --git a/Documentation/config/index.txt b/Documentation/config/index.txt
index 75f3a2d105..23c7985eb4 100644
--- a/Documentation/config/index.txt
+++ b/Documentation/config/index.txt
@@ -30,3 +30,14 @@ index.version::
Specify the version with which new index files should be
initialized. This does not affect existing repositories.
If `feature.manyFiles` is enabled, then the default is 4.
+
+index.skipHash::
+ When enabled, do not compute the trailing hash for the index file.
+ This accelerates Git commands that manipulate the index, such as
+ `git add`, `git commit`, or `git status`. Instead of storing the
+ checksum, write a trailing set of bytes with value zero, indicating
+ that the computation was skipped.
++
+If you enable `index.skipHash`, then Git clients older than 2.13.0 will
+refuse to parse the index and Git clients older than 2.40.0 will report an
+error during `git fsck`.
diff --git a/Documentation/config/mergetool.txt b/Documentation/config/mergetool.txt
index e779a122d8..56a7eeeffb 100644
--- a/Documentation/config/mergetool.txt
+++ b/Documentation/config/mergetool.txt
@@ -85,3 +85,10 @@ mergetool.writeToTemp::
mergetool.prompt::
Prompt before each invocation of the merge resolution program.
+
+mergetool.guiDefault::
+ Set `true` to use the `merge.guitool` by default (equivalent to
+ specifying the `--gui` argument), or `auto` to select `merge.guitool`
+ or `merge.tool` depending on the presence of a `DISPLAY` environment
+ variable value. The default is `false`, where the `--gui` argument
+ must be provided explicitly for the `merge.guitool` to be used.
diff --git a/Documentation/config/pack.txt b/Documentation/config/pack.txt
index 53093d9996..d4c7c9d4e4 100644
--- a/Documentation/config/pack.txt
+++ b/Documentation/config/pack.txt
@@ -171,9 +171,15 @@ pack.writeBitmapLookupTable::
beneficial in repositories that have relatively large bitmap
indexes. Defaults to false.
+pack.readReverseIndex::
+ When true, git will read any .rev file(s) that may be available
+ (see: linkgit:gitformat-pack[5]). When false, the reverse index
+ will be generated from scratch and stored in memory. Defaults to
+ true.
+
pack.writeReverseIndex::
When true, git will write a corresponding .rev file (see:
linkgit:gitformat-pack[5])
for each new packfile that it writes in all places except for
linkgit:git-fast-import[1] and in the bulk checkin mechanism.
- Defaults to false.
+ Defaults to true.
diff --git a/Documentation/config/push.txt b/Documentation/config/push.txt
index 7386fea225..43338b65e8 100644
--- a/Documentation/config/push.txt
+++ b/Documentation/config/push.txt
@@ -110,18 +110,8 @@ This will result in only b (a and c are cleared).
----
push.recurseSubmodules::
- Make sure all submodule commits used by the revisions to be pushed
- are available on a remote-tracking branch. If the value is 'check'
- then Git will verify that all submodule commits that changed in the
- revisions to be pushed are available on at least one remote of the
- submodule. If any commits are missing, the push will be aborted and
- exit with non-zero status. If the value is 'on-demand' then all
- submodules that changed in the revisions to be pushed will be
- pushed. If on-demand was not able to push all necessary revisions
- it will also be aborted and exit with non-zero status. If the value
- is 'no' then default behavior of ignoring submodules when pushing
- is retained. You may override this configuration at time of push by
- specifying '--recurse-submodules=check|on-demand|no'.
+ May be "check", "on-demand", "only", or "no", with the same behavior
+ as that of "push --recurse-submodules".
If not set, 'no' is used by default, unless 'submodule.recurse' is
set (in which case a 'true' value means 'on-demand').
diff --git a/Documentation/config/rebase.txt b/Documentation/config/rebase.txt
index f19bd0e040..afaf6dad99 100644
--- a/Documentation/config/rebase.txt
+++ b/Documentation/config/rebase.txt
@@ -67,3 +67,13 @@ rebase.rescheduleFailedExec::
rebase.forkPoint::
If set to false set `--no-fork-point` option by default.
+
+rebase.rebaseMerges::
+ Whether and how to set the `--rebase-merges` option by default. Can
+ be `rebase-cousins`, `no-rebase-cousins`, or a boolean. Setting to
+ true or to `no-rebase-cousins` is equivalent to
+ `--rebase-merges=no-rebase-cousins`, setting to `rebase-cousins` is
+ equivalent to `--rebase-merges=rebase-cousins`, and setting to false is
+ equivalent to `--no-rebase-merges`. Passing `--rebase-merges` on the
+ command line, with or without an argument, overrides any
+ `rebase.rebaseMerges` configuration.
diff --git a/Documentation/config/sendemail.txt b/Documentation/config/sendemail.txt
index 51da7088a8..92a9ebe98c 100644
--- a/Documentation/config/sendemail.txt
+++ b/Documentation/config/sendemail.txt
@@ -61,6 +61,7 @@ sendemail.ccCmd::
sendemail.chainReplyTo::
sendemail.envelopeSender::
sendemail.from::
+sendemail.headerCmd::
sendemail.signedoffbycc::
sendemail.smtpPass::
sendemail.suppresscc::
diff --git a/Documentation/config/transfer.txt b/Documentation/config/transfer.txt
index 264812cca4..c3ac767d1e 100644
--- a/Documentation/config/transfer.txt
+++ b/Documentation/config/transfer.txt
@@ -115,3 +115,9 @@ transfer.unpackLimit::
transfer.advertiseSID::
Boolean. When true, client and server processes will advertise their
unique session IDs to their remote counterpart. Defaults to false.
+
+transfer.bundleURI::
+ When `true`, local `git clone` commands will request bundle
+ information from the remote server (if advertised) and download
+ bundles before continuing the clone through the Git protocol.
+ Defaults to `false`.
diff --git a/Documentation/diff-generate-patch.txt b/Documentation/diff-generate-patch.txt
index c78063d4f7..546adf79e5 100644
--- a/Documentation/diff-generate-patch.txt
+++ b/Documentation/diff-generate-patch.txt
@@ -1,3 +1,4 @@
+[[generate_patch_text_with_p]]
Generating patch text with -p
-----------------------------
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 3674ac48e9..08ab86189a 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -22,7 +22,13 @@ ifndef::git-format-patch[]
-p::
-u::
--patch::
- Generate patch (see section on generating patches).
+ Generate patch (see section titled
+ifdef::git-log[]
+<<generate_patch_text_with_p, "Generating patch text with -p">>).
+endif::git-log[]
+ifndef::git-log[]
+"Generating patch text with -p").
+endif::git-log[]
ifdef::git-diff[]
This is the default.
endif::git-diff[]
@@ -846,6 +852,11 @@ endif::git-format-patch[]
--no-prefix::
Do not show any source or destination prefix.
+--default-prefix::
+ Use the default source and destination prefixes ("a/" and "b/").
+ This is usually the default already, but may be used to override
+ config such as `diff.noprefix`.
+
--line-prefix=<prefix>::
Prepend an additional prefix to every line of output.
diff --git a/Documentation/doc-diff b/Documentation/doc-diff
index 1694300e50..fb09e0ac0e 100755
--- a/Documentation/doc-diff
+++ b/Documentation/doc-diff
@@ -153,7 +153,7 @@ render_tree () {
make -j$parallel -C "$tmp/worktree" \
$makemanflags \
GIT_VERSION=omitted \
- SOURCE_DATE_EPOCH=0 \
+ GIT_DATE=1970-01-01 \
DESTDIR="$tmp/installed/$dname+" \
install-man &&
mv "$tmp/installed/$dname+" "$tmp/installed/$dname"
diff --git a/Documentation/fsck-msgids.txt b/Documentation/fsck-msgids.txt
new file mode 100644
index 0000000000..12eae8a222
--- /dev/null
+++ b/Documentation/fsck-msgids.txt
@@ -0,0 +1,173 @@
+`badDate`::
+ (ERROR) Invalid date format in an author/committer line.
+
+`badDateOverflow`::
+ (ERROR) Invalid date value in an author/committer line.
+
+`badEmail`::
+ (ERROR) Invalid email format in an author/committer line.
+
+`badFilemode`::
+ (INFO) A tree contains a bad filemode entry.
+
+`badName`::
+ (ERROR) An author/committer name is empty.
+
+`badObjectSha1`::
+ (ERROR) An object has a bad sha1.
+
+`badParentSha1`::
+ (ERROR) A commit object has a bad parent sha1.
+
+`badTagName`::
+ (INFO) A tag has an invalid format.
+
+`badTimezone`::
+ (ERROR) Found an invalid time zone in an author/committer line.
+
+`badTree`::
+ (ERROR) A tree cannot be parsed.
+
+`badTreeSha1`::
+ (ERROR) A tree has an invalid format.
+
+`badType`::
+ (ERROR) Found an invalid object type.
+
+`duplicateEntries`::
+ (ERROR) A tree contains duplicate file entries.
+
+`emptyName`::
+ (WARN) A path contains an empty name.
+
+`extraHeaderEntry`::
+ (IGNORE) Extra headers found after `tagger`.
+
+`fullPathname`::
+ (WARN) A path contains the full path starting with "/".
+
+`gitattributesBlob`::
+ (ERROR) A non-blob found at `.gitattributes`.
+
+`gitattributesLarge`::
+ (ERROR) The `.gitattributes` blob is too large.
+
+`gitattributesLineLength`::
+ (ERROR) The `.gitattributes` blob contains too long lines.
+
+`gitattributesMissing`::
+ (ERROR) Unable to read `.gitattributes` blob.
+
+`gitattributesSymlink`::
+ (INFO) `.gitattributes` is a symlink.
+
+`gitignoreSymlink`::
+ (INFO) `.gitignore` is a symlink.
+
+`gitmodulesBlob`::
+ (ERROR) A non-blob found at `.gitmodules`.
+
+`gitmodulesLarge`::
+ (ERROR) The `.gitmodules` file is too large to parse.
+
+`gitmodulesMissing`::
+ (ERROR) Unable to read `.gitmodules` blob.
+
+`gitmodulesName`::
+ (ERROR) A submodule name is invalid.
+
+`gitmodulesParse`::
+ (INFO) Could not parse `.gitmodules` blob.
+
+`gitmodulesLarge`;
+ (ERROR) `.gitmodules` blob is too large to parse.
+
+`gitmodulesPath`::
+ (ERROR) `.gitmodules` path is invalid.
+
+`gitmodulesSymlink`::
+ (ERROR) `.gitmodules` is a symlink.
+
+`gitmodulesUpdate`::
+ (ERROR) Found an invalid submodule update setting.
+
+`gitmodulesUrl`::
+ (ERROR) Found an invalid submodule url.
+
+`hasDot`::
+ (WARN) A tree contains an entry named `.`.
+
+`hasDotdot`::
+ (WARN) A tree contains an entry named `..`.
+
+`hasDotgit`::
+ (WARN) A tree contains an entry named `.git`.
+
+`mailmapSymlink`::
+ (INFO) `.mailmap` is a symlink.
+
+`missingAuthor`::
+ (ERROR) Author is missing.
+
+`missingCommitter`::
+ (ERROR) Committer is missing.
+
+`missingEmail`::
+ (ERROR) Email is missing in an author/committer line.
+
+`missingNameBeforeEmail`::
+ (ERROR) Missing name before an email in an author/committer line.
+
+`missingObject`::
+ (ERROR) Missing `object` line in tag object.
+
+`missingSpaceBeforeDate`::
+ (ERROR) Missing space before date in an author/committer line.
+
+`missingSpaceBeforeEmail`::
+ (ERROR) Missing space before the email in author/committer line.
+
+`missingTag`::
+ (ERROR) Unexpected end after `type` line in a tag object.
+
+`missingTagEntry`::
+ (ERROR) Missing `tag` line in a tag object.
+
+`missingTaggerEntry`::
+ (INFO) Missing `tagger` line in a tag object.
+
+`missingTree`::
+ (ERROR) Missing `tree` line in a commit object.
+
+`missingType`::
+ (ERROR) Invalid type value on the `type` line in a tag object.
+
+`missingTypeEntry`::
+ (ERROR) Missing `type` line in a tag object.
+
+`multipleAuthors`::
+ (ERROR) Multiple author lines found in a commit.
+
+`nulInCommit`::
+ (WARN) Found a NUL byte in the commit object body.
+
+`nulInHeader`::
+ (FATAL) NUL byte exists in the object header.
+
+`nullSha1`::
+ (WARN) Tree contains entries pointing to a null sha1.
+
+`treeNotSorted`::
+ (ERROR) A tree is not properly sorted.
+
+`unknownType`::
+ (ERROR) Found an unknown object type.
+
+`unterminatedHeader`::
+ (FATAL) Missing end-of-line in the object header.
+
+`zeroPaddedDate`::
+ (ERROR) Found a zero padded date in an author/commiter line.
+
+`zeroPaddedFilemode`::
+ (WARN) Found a zero padded filemode in a tree.
diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index a030d33c6e..ed44c1cb31 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -274,7 +274,7 @@ status::
------------
staged unstaged path
1: binary nothing foo.png
- 2: +403/-35 +1/-1 git-add--interactive.perl
+ 2: +403/-35 +1/-1 add-interactive.c
------------
+
It shows that foo.png has differences from HEAD (but that is
@@ -282,7 +282,7 @@ binary so line count cannot be shown) and there is no
difference between indexed copy and the working tree
version (if the working tree version were also different,
'binary' would have been shown in place of 'nothing'). The
-other file, git-add{litdd}interactive.perl, has 403 lines added
+other file, add-interactive.c, has 403 lines added
and 35 lines deleted if you commit what is in the index, but
working tree file has further modifications (one addition and
one deletion).
@@ -303,7 +303,7 @@ like this:
------------
staged unstaged path
1: binary nothing foo.png
-* 2: +403/-35 +1/-1 git-add--interactive.perl
+* 2: +403/-35 +1/-1 add-interactive.c
------------
+
To remove selection, prefix the input with `-`
diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index 326276e51c..900be198b1 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -9,7 +9,7 @@ git-am - Apply a series of patches from a mailbox
SYNOPSIS
--------
[verse]
-'git am' [--signoff] [--keep] [--[no-]keep-cr] [--[no-]utf8]
+'git am' [--signoff] [--keep] [--[no-]keep-cr] [--[no-]utf8] [--no-verify]
[--[no-]3way] [--interactive] [--committer-date-is-author-date]
[--ignore-date] [--ignore-space-change | --ignore-whitespace]
[--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
@@ -24,7 +24,9 @@ DESCRIPTION
-----------
Splits mail messages in a mailbox into commit log message,
authorship information and patches, and applies them to the
-current branch.
+current branch. You could think of it as a reverse operation
+of linkgit:git-format-patch[1] run on a branch with a straight
+history without merges.
OPTIONS
-------
@@ -138,6 +140,12 @@ include::rerere-options.txt[]
--interactive::
Run interactively.
+-n::
+--no-verify::
+ By default, the pre-applypatch and applypatch-msg hooks are run.
+ When any of `--no-verify` or `-n` is given, these are bypassed.
+ See also linkgit:githooks[5].
+
--committer-date-is-author-date::
By default the command records the date from the e-mail
message as the commit author date, and uses the time of
@@ -267,7 +275,8 @@ include::config/am.txt[]
SEE ALSO
--------
-linkgit:git-apply[1].
+linkgit:git-apply[1],
+linkgit:git-format-patch[1].
GIT
---
diff --git a/Documentation/git-annotate.txt b/Documentation/git-annotate.txt
index e44a831339..5ae8aabe0f 100644
--- a/Documentation/git-annotate.txt
+++ b/Documentation/git-annotate.txt
@@ -8,7 +8,7 @@ git-annotate - Annotate file lines with commit information
SYNOPSIS
--------
[verse]
-'git annotate' [<options>] <file> [<revision>]
+'git annotate' [<options>] [<rev-opts>] [<rev>] [--] <file>
DESCRIPTION
-----------
diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt
index 1d478cbe9b..5e16e6db7e 100644
--- a/Documentation/git-apply.txt
+++ b/Documentation/git-apply.txt
@@ -208,7 +208,7 @@ behavior:
* `warn` outputs warnings for a few such errors, but applies the
patch as-is (default).
* `fix` outputs warnings for a few such errors, and applies the
- patch after fixing them (`strip` is a synonym --- the tool
+ patch after fixing them (`strip` is a synonym -- the tool
used to consider only trailing whitespace characters as errors, and the
fix involved 'stripping' them, but modern Gits do more).
* `error` outputs warnings for a few such errors, and refuses
diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt
index 60c040988b..6bab201d37 100644
--- a/Documentation/git-archive.txt
+++ b/Documentation/git-archive.txt
@@ -86,6 +86,11 @@ cases, write an untracked file and use `--add-file` instead.
Look for attributes in .gitattributes files in the working tree
as well (see <<ATTRIBUTES>>).
+--mtime=<time>::
+ Set modification time of archive entries. Without this option
+ the committer time is used if `<tree-ish>` is a commit or tag,
+ and the current time if it is a tree.
+
<extra>::
This can be any options that the archiver backend understands.
See next section.
diff --git a/Documentation/git-bisect-lk2009.txt b/Documentation/git-bisect-lk2009.txt
index f3d9566c89..0bc165788e 100644
--- a/Documentation/git-bisect-lk2009.txt
+++ b/Documentation/git-bisect-lk2009.txt
@@ -1347,8 +1347,8 @@ author to given a talk and for publishing this paper.
References
----------
-- [[[1]]] https://www.nist.gov/sites/default/files/documents/director/planning/report02-3.pdf['The Economic Impacts of Inadequate Infratructure for Software Testing'. Nist Planning Report 02-3], see Executive Summary and Chapter 8.
-- [[[2]]] http://www.oracle.com/technetwork/java/codeconvtoc-136057.html['Code Conventions for the Java Programming Language'. Sun Microsystems.]
+- [[[1]]] https://web.archive.org/web/20091206032101/http://www.nist.gov/public_affairs/releases/n02-10.htm['Software Errors Cost U.S. Economy $59.5 Billion Annually'. Nist News Release.] See also https://www.nist.gov/system/files/documents/director/planning/report02-3.pdf['The Economic Impacts of Inadequate Infratructure for Software Testing'. Nist Planning Report 02-3], Executive Summary and Chapter 8.
+- [[[2]]] https://www.oracle.com/java/technologies/javase/codeconventions-introduction.html['Code Conventions for the Java Programming Language: 1. Introduction'. Sun Microsystems.]
- [[[3]]] https://en.wikipedia.org/wiki/Software_maintenance['Software maintenance'. Wikipedia.]
- [[[4]]] https://lore.kernel.org/git/7vps5xsbwp.fsf_-_@assigned-by-dhcp.cox.net/[Junio C Hamano. 'Automated bisect success story'.]
- [[[5]]] https://lwn.net/Articles/317154/[Christian Couder. 'Fully automated bisecting with "git bisect run"'. LWN.net.]
diff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt
index 4400a17330..f69a871a96 100644
--- a/Documentation/git-blame.txt
+++ b/Documentation/git-blame.txt
@@ -12,7 +12,7 @@ SYNOPSIS
[-L <range>] [-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>]
[--ignore-rev <rev>] [--ignore-revs-file <file>]
[--color-lines] [--color-by-age] [--progress] [--abbrev=<n>]
- [<rev> | --contents <file> | --reverse <rev>..<rev>] [--] <file>
+ [ --contents <file> ] [<rev> | --reverse <rev>..<rev>] [--] <file>
DESCRIPTION
-----------
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index 12c5f84e3b..d207da9101 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -116,13 +116,17 @@ OPTIONS
-f::
--force::
- Reset <branchname> to <startpoint>, even if <branchname> exists
+ Reset <branchname> to <start-point>, even if <branchname> exists
already. Without `-f`, 'git branch' refuses to change an existing branch.
In combination with `-d` (or `--delete`), allow deleting the
branch irrespective of its merged status, or whether it even
points to a valid commit. In combination with
`-m` (or `--move`), allow renaming the branch even if the new
branch name already exists, the same applies for `-c` (or `--copy`).
++
+Note that 'git branch -f <branchname> [<start-point>]', even with '-f',
+refuses to change an existing branch `<branchname>` that is checked out
+in another worktree linked to the same repository.
-m::
--move::
@@ -152,6 +156,10 @@ OPTIONS
--ignore-case::
Sorting and filtering branches are case insensitive.
+--omit-empty::
+ Do not print a newline after formatted refs where the format expands
+ to the empty string.
+
--column[=<options>]::
--no-column::
Display branch listing in columns. See configuration variable
diff --git a/Documentation/git-bundle.txt b/Documentation/git-bundle.txt
index 18a022b4b4..3ab42a19ca 100644
--- a/Documentation/git-bundle.txt
+++ b/Documentation/git-bundle.txt
@@ -9,7 +9,7 @@ git-bundle - Move objects and refs by archive
SYNOPSIS
--------
[verse]
-'git bundle' create [-q | --quiet | --progress | --all-progress] [--all-progress-implied]
+'git bundle' create [-q | --quiet | --progress]
[--version=<version>] <file> <git-rev-list-args>
'git bundle' verify [-q | --quiet] <file>
'git bundle' list-heads <file> [<refname>...]
@@ -66,7 +66,7 @@ create [options] <file> <git-rev-list-args>::
Used to create a bundle named 'file'. This requires the
'<git-rev-list-args>' arguments to define the bundle contents.
'options' contains the options specific to the 'git bundle create'
- subcommand.
+ subcommand. If 'file' is `-`, the bundle is written to stdout.
verify <file>::
Used to check that a bundle file is valid and will apply
@@ -77,12 +77,13 @@ verify <file>::
Finally, information about additional capabilities, such as "object
filter", is printed. See "Capabilities" in linkgit:gitformat-bundle[5]
for more information. The exit code is zero for success, but will
- be nonzero if the bundle file is invalid.
+ be nonzero if the bundle file is invalid. If 'file' is `-`, the
+ bundle is read from stdin.
list-heads <file>::
Lists the references defined in the bundle. If followed by a
list of references, only references matching those given are
- printed out.
+ printed out. If 'file' is `-`, the bundle is read from stdin.
unbundle <file>::
Passes the objects in the bundle to 'git index-pack'
@@ -90,6 +91,7 @@ unbundle <file>::
defined references. If a list of references is given, only
references matching those in the list are printed. This command is
really plumbing, intended to be called only by 'git fetch'.
+ If 'file' is `-`, the bundle is read from stdin.
<git-rev-list-args>::
A list of arguments, acceptable to 'git rev-parse' and
@@ -115,22 +117,6 @@ unbundle <file>::
is specified. This flag forces progress status even if
the standard error stream is not directed to a terminal.
---all-progress::
- When --stdout is specified then progress report is
- displayed during the object count and compression phases
- but inhibited during the write-out phase. The reason is
- that in some cases the output stream is directly linked
- to another command which may wish to display progress
- status of its own as it processes incoming pack data.
- This flag is like --progress except that it forces progress
- report for the write-out phase as well even if --stdout is
- used.
-
---all-progress-implied::
- This is used to imply --all-progress whenever progress display
- is activated. Unlike --all-progress this flag doesn't actually
- force any progress display by itself.
-
--version=<version>::
Specify the bundle version. Version 2 is the older format and can only be
used with SHA-1 repositories; the newer version 3 contains capabilities that
diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt
index ec30b5c574..411de2e27d 100644
--- a/Documentation/git-cat-file.txt
+++ b/Documentation/git-cat-file.txt
@@ -45,7 +45,9 @@ OPTIONS
-s::
Instead of the content, show the object size identified by
- `<object>`.
+ `<object>`. If used with `--use-mailmap` option, will show
+ the size of updated object after replacing idents using the
+ mailmap mechanism.
-e::
Exit with zero status if `<object>` exists and is a valid
@@ -89,26 +91,54 @@ OPTIONS
--batch::
--batch=<format>::
Print object information and contents for each object provided
- on stdin. May not be combined with any other options or arguments
- except `--textconv` or `--filters`, in which case the input lines
- also need to specify the path, separated by whitespace. See the
- section `BATCH OUTPUT` below for details.
+ on stdin. May not be combined with any other options or arguments
+ except `--textconv`, `--filters`, or `--use-mailmap`.
++
+--
+ * When used with `--textconv` or `--filters`, the input lines
+ must specify the path, separated by whitespace. See the section
+ `BATCH OUTPUT` below for details.
+
+ * When used with `--use-mailmap`, for commit and tag objects, the
+ contents part of the output shows the identities replaced using the
+ mailmap mechanism, while the information part of the output shows
+ the size of the object as if it actually recorded the replacement
+ identities.
+--
--batch-check::
--batch-check=<format>::
- Print object information for each object provided on stdin. May
- not be combined with any other options or arguments except
- `--textconv` or `--filters`, in which case the input lines also
- need to specify the path, separated by whitespace. See the
- section `BATCH OUTPUT` below for details.
+ Print object information for each object provided on stdin. May not be
+ combined with any other options or arguments except `--textconv`, `--filters`
+ or `--use-mailmap`.
++
+--
+ * When used with `--textconv` or `--filters`, the input lines must
+ specify the path, separated by whitespace. See the section
+ `BATCH OUTPUT` below for details.
+
+ * When used with `--use-mailmap`, for commit and tag objects, the
+ printed object information shows the size of the object as if the
+ identities recorded in it were replaced by the mailmap mechanism.
+--
--batch-command::
--batch-command=<format>::
Enter a command mode that reads commands and arguments from stdin. May
- only be combined with `--buffer`, `--textconv` or `--filters`. In the
- case of `--textconv` or `--filters`, the input lines also need to specify
- the path, separated by whitespace. See the section `BATCH OUTPUT` below
- for details.
+ only be combined with `--buffer`, `--textconv`, `--use-mailmap` or
+ `--filters`.
++
+--
+ * When used with `--textconv` or `--filters`, the input lines must
+ specify the path, separated by whitespace. See the section
+ `BATCH OUTPUT` below for details.
+
+ * When used with `--use-mailmap`, for commit and tag objects, the
+ `contents` command shows the identities replaced using the
+ mailmap mechanism, while the `info` command shows the size
+ of the object as if it actually recorded the replacement
+ identities.
+--
+
`--batch-command` recognizes the following commands:
+
diff --git a/Documentation/git-check-attr.txt b/Documentation/git-check-attr.txt
index 84f41a8e82..6e4f3aaf34 100644
--- a/Documentation/git-check-attr.txt
+++ b/Documentation/git-check-attr.txt
@@ -9,8 +9,8 @@ git-check-attr - Display gitattributes information
SYNOPSIS
--------
[verse]
-'git check-attr' [-a | --all | <attr>...] [--] <pathname>...
-'git check-attr' --stdin [-z] [-a | --all | <attr>...]
+'git check-attr' [--source <tree-ish>] [-a | --all | <attr>...] [--] <pathname>...
+'git check-attr' --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]
DESCRIPTION
-----------
@@ -36,6 +36,11 @@ OPTIONS
If `--stdin` is also given, input paths are separated
with a NUL character instead of a linefeed character.
+--source=<tree-ish>::
+ Check attributes against the specified tree-ish. It is common to
+ specify the source tree by naming a commit, branch or tag associated
+ with it.
+
\--::
Interpret all preceding arguments as attributes and all following
arguments as path names.
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 4cb9d555b4..4af0904f47 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -146,14 +146,16 @@ on your side branch as `theirs` (i.e. "one contributor's work on top
of it").
-b <new-branch>::
- Create a new branch named `<new-branch>` and start it at
- `<start-point>`; see linkgit:git-branch[1] for details.
+ Create a new branch named `<new-branch>`, start it at
+ `<start-point>`, and check the resulting branch out;
+ see linkgit:git-branch[1] for details.
-B <new-branch>::
- Creates the branch `<new-branch>` and start it at `<start-point>`;
- if it already exists, then reset it to `<start-point>`. This is
- equivalent to running "git branch" with "-f"; see
- linkgit:git-branch[1] for details.
+ Creates the branch `<new-branch>`, start it at `<start-point>`;
+ if it already exists, then reset it to `<start-point>`. And then
+ check the resulting branch out. This is equivalent to running
+ "git branch" with "-f" followed by "git checkout" of that branch;
+ see linkgit:git-branch[1] for details.
-t::
--track[=(direct|inherit)]::
@@ -477,18 +479,15 @@ before that happens. If we have not yet moved away from commit `f`,
any of these will create a reference to it:
------------
-$ git checkout -b foo <1>
-$ git branch foo <2>
-$ git tag foo <3>
+$ git checkout -b foo # or "git switch -c foo" <1>
+$ git branch foo <2>
+$ git tag foo <3>
------------
-
<1> creates a new branch `foo`, which refers to commit `f`, and then
updates `HEAD` to refer to branch `foo`. In other words, we'll no longer
be in detached `HEAD` state after this command.
-
<2> similarly creates a new branch `foo`, which refers to commit `f`,
but leaves `HEAD` detached.
-
<3> creates a new tag `foo`, which refers to commit `f`,
leaving `HEAD` detached.
@@ -517,84 +516,89 @@ to checkout these paths out of the index.
EXAMPLES
--------
-. The following sequence checks out the `master` branch, reverts
- the `Makefile` to two revisions back, deletes `hello.c` by
- mistake, and gets it back from the index.
-+
+=== 1. Paths
+
+The following sequence checks out the `master` branch, reverts
+the `Makefile` to two revisions back, deletes `hello.c` by
+mistake, and gets it back from the index.
+
------------
$ git checkout master <1>
$ git checkout master~2 Makefile <2>
$ rm -f hello.c
$ git checkout hello.c <3>
------------
-+
<1> switch branch
<2> take a file out of another commit
<3> restore `hello.c` from the index
-+
+
If you want to check out _all_ C source files out of the index,
you can say
-+
+
------------
$ git checkout -- '*.c'
------------
-+
+
Note the quotes around `*.c`. The file `hello.c` will also be
checked out, even though it is no longer in the working tree,
because the file globbing is used to match entries in the index
(not in the working tree by the shell).
-+
+
If you have an unfortunate branch that is named `hello.c`, this
step would be confused as an instruction to switch to that branch.
You should instead write:
-+
+
------------
$ git checkout -- hello.c
------------
-. After working in the wrong branch, switching to the correct
- branch would be done using:
-+
+=== 2. Merge
+
+After working in the wrong branch, switching to the correct
+branch would be done using:
+
------------
$ git checkout mytopic
------------
-+
+
However, your "wrong" branch and correct `mytopic` branch may
differ in files that you have modified locally, in which case
the above checkout would fail like this:
-+
+
------------
$ git checkout mytopic
error: You have local changes to 'frotz'; not switching branches.
------------
-+
+
You can give the `-m` flag to the command, which would try a
three-way merge:
-+
+
------------
$ git checkout -m mytopic
Auto-merging frotz
------------
-+
+
After this three-way merge, the local modifications are _not_
registered in your index file, so `git diff` would show you what
changes you made since the tip of the new branch.
-. When a merge conflict happens during switching branches with
- the `-m` option, you would see something like this:
-+
+=== 3. Merge conflict
+
+When a merge conflict happens during switching branches with
+the `-m` option, you would see something like this:
+
------------
$ git checkout -m mytopic
Auto-merging frotz
ERROR: Merge conflict in frotz
fatal: merge program failed
------------
-+
+
At this point, `git diff` shows the changes cleanly merged as in
the previous example, as well as the changes in the conflicted
files. Edit and resolve the conflict and mark it resolved with
`git add` as usual:
-+
+
------------
$ edit frotz
$ git add frotz
diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index 1e8ac9df60..fdcad3d200 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -219,7 +219,7 @@ again, this time exercising more care about matching up context lines.
------------
$ git cherry-pick topic^ <1>
$ git diff <2>
-$ git reset --merge ORIG_HEAD <3>
+$ git cherry-pick --abort <3>
$ git cherry-pick -Xpatience topic^ <4>
------------
<1> apply the change that would be shown by `git show topic^`.
diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt
index 91742633fa..160d08b86b 100644
--- a/Documentation/git-clean.txt
+++ b/Documentation/git-clean.txt
@@ -8,7 +8,7 @@ git-clean - Remove untracked files from the working tree
SYNOPSIS
--------
[verse]
-'git clean' [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <path>...
+'git clean' [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] [<pathspec>...]
DESCRIPTION
-----------
@@ -20,16 +20,16 @@ Normally, only files unknown to Git are removed, but if the `-x`
option is specified, ignored files are also removed. This can, for
example, be useful to remove all build products.
-If any optional `<path>...` arguments are given, only those paths
-are affected.
+If any optional `<pathspec>...` arguments are given, only those paths
+that match the pathspec are affected.
OPTIONS
-------
-d::
- Normally, when no <path> is specified, git clean will not
+ Normally, when no <pathspec> is specified, git clean will not
recurse into untracked directories to avoid removing too much.
Specify -d to have it recurse into such directories as well.
- If any paths are specified, -d is irrelevant; all untracked
+ If a <pathspec> is specified, -d is irrelevant; all untracked
files matching the specified paths (with exceptions for nested
git directories mentioned under `--force`) will be removed.
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index d6434d262d..c37c4a37f7 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -58,6 +58,11 @@ never use the local optimizations). Specifying `--no-local` will
override the default when `/path/to/repo` is given, using the regular
Git transport instead.
+
+If the repository's `$GIT_DIR/objects` has symbolic links or is a
+symbolic link, the clone will fail. This is a security measure to
+prevent the unintentional copying of files by dereferencing the symbolic
+links.
++
*NOTE*: this operation can race with concurrent modification to the
source repository, similar to running `cp -r src dst` while modifying
`src`.
diff --git a/Documentation/git-commit-graph.txt b/Documentation/git-commit-graph.txt
index 36fe56c2c7..c8dbceba01 100644
--- a/Documentation/git-commit-graph.txt
+++ b/Documentation/git-commit-graph.txt
@@ -10,7 +10,10 @@ SYNOPSIS
--------
[verse]
'git commit-graph verify' [--object-dir <dir>] [--shallow] [--[no-]progress]
-'git commit-graph write' <options> [--object-dir <dir>] [--[no-]progress]
+'git commit-graph write' [--object-dir <dir>] [--append]
+ [--split[=<strategy>]] [--reachable | --stdin-packs | --stdin-commits]
+ [--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress]
+ <split options>
DESCRIPTION
diff --git a/Documentation/git-credential-cache--daemon.txt b/Documentation/git-credential-cache--daemon.txt
index 01e1c214dd..650a15a7ed 100644
--- a/Documentation/git-credential-cache--daemon.txt
+++ b/Documentation/git-credential-cache--daemon.txt
@@ -8,7 +8,7 @@ git-credential-cache--daemon - Temporarily store user credentials in memory
SYNOPSIS
--------
[verse]
-'git credential-cache{litdd}daemon' [--debug] <socket>
+'git credential-cache{litdd}daemon' [--debug] <socket-path>
DESCRIPTION
-----------
@@ -16,7 +16,7 @@ DESCRIPTION
NOTE: You probably don't want to invoke this command yourself; it is
started automatically when you use linkgit:git-credential-cache[1].
-This command listens on the Unix domain socket specified by `<socket>`
+This command listens on the Unix domain socket specified by `<socket-path>`
for `git-credential-cache` clients. Clients may store and retrieve
credentials. Each credential is held for a timeout specified by the
client; once no credentials are held, the daemon exits.
diff --git a/Documentation/git-credential-cache.txt b/Documentation/git-credential-cache.txt
index 0216c18ef8..f473994a86 100644
--- a/Documentation/git-credential-cache.txt
+++ b/Documentation/git-credential-cache.txt
@@ -14,10 +14,13 @@ git config credential.helper 'cache [<options>]'
DESCRIPTION
-----------
-This command caches credentials in memory for use by future Git
-programs. The stored credentials never touch the disk, and are forgotten
-after a configurable timeout. The cache is accessible over a Unix
-domain socket, restricted to the current user by filesystem permissions.
+This command caches credentials for use by future Git programs.
+The stored credentials are kept in memory of the cache-daemon
+process (instead of written to a file) and are forgotten after a
+configurable timeout. Credentials are forgotten sooner if the
+cache-daemon dies, for example if the system restarts. The cache
+is accessible over a Unix domain socket, restricted to the current
+user by filesystem permissions.
You probably don't want to invoke this command directly; it is meant to
be used as a credential helper by other parts of Git. See
@@ -69,10 +72,10 @@ $ git push http://example.com/repo.git
------------------------------------
You can provide options via the credential.helper configuration
-variable (this example drops the cache time to 5 minutes):
+variable (this example increases the cache time to 1 hour):
-------------------------------------------------------
-$ git config credential.helper 'cache --timeout=300'
+$ git config credential.helper 'cache --timeout=3600'
-------------------------------------------------------
GIT
diff --git a/Documentation/git-credential.txt b/Documentation/git-credential.txt
index f18673017f..0e6d9e85ec 100644
--- a/Documentation/git-credential.txt
+++ b/Documentation/git-credential.txt
@@ -113,7 +113,13 @@ separated by an `=` (equals) sign, followed by a newline.
The key may contain any bytes except `=`, newline, or NUL. The value may
contain any bytes except newline or NUL.
-In both cases, all bytes are treated as-is (i.e., there is no quoting,
+Attributes with keys that end with C-style array brackets `[]` can have
+multiple values. Each instance of a multi-valued attribute forms an
+ordered list of values - the order of the repeated attributes defines
+the order of the values. An empty multi-valued attribute (`key[]=\n`)
+acts to clear any previous entries and reset the list.
+
+In all cases, all bytes are treated as-is (i.e., there is no quoting,
and one cannot transmit a value with newline or NUL in it). The list of
attributes is terminated by a blank line or end-of-file.
@@ -144,6 +150,18 @@ Git understands the following attributes:
The credential's password, if we are asking it to be stored.
+`password_expiry_utc`::
+
+ Generated passwords such as an OAuth access token may have an expiry date.
+ When reading credentials from helpers, `git credential fill` ignores expired
+ passwords. Represented as Unix time UTC, seconds since 1970.
+
+`oauth_refresh_token`::
+
+ An OAuth refresh token may accompany a password that is an OAuth access
+ token. Helpers must treat this attribute as confidential like the password
+ attribute. Git itself has no special behaviour for this attribute.
+
`url`::
When this special attribute is read by `git credential`, the
@@ -160,6 +178,19 @@ empty string.
Components which are missing from the URL (e.g., there is no
username in the example above) will be left unset.
+`wwwauth[]`::
+
+ When an HTTP response is received by Git that includes one or more
+ 'WWW-Authenticate' authentication headers, these will be passed by Git
+ to credential helpers.
++
+Each 'WWW-Authenticate' header value is passed as a multi-valued
+attribute 'wwwauth[]', where the order of the attributes is the same as
+they appear in the HTTP response. This attribute is 'one-way' from Git
+to pass additional information to credential helpers.
+
+Unrecognised attributes are silently discarded.
+
GIT
---
Part of the linkgit:git[1] suite
diff --git a/Documentation/git-diff-files.txt b/Documentation/git-diff-files.txt
index bf1febb9ae..591e3801b7 100644
--- a/Documentation/git-diff-files.txt
+++ b/Documentation/git-diff-files.txt
@@ -9,7 +9,7 @@ git-diff-files - Compares files in the working tree and the index
SYNOPSIS
--------
[verse]
-'git diff-files' [-q] [-0|-1|-2|-3|-c|--cc] [<common-diff-options>] [<path>...]
+'git diff-files' [-q] [-0 | -1 | -2 | -3 | -c | --cc] [<common-diff-options>] [<path>...]
DESCRIPTION
-----------
diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt
index 85ae6d6d08..52b679256c 100644
--- a/Documentation/git-diff.txt
+++ b/Documentation/git-diff.txt
@@ -79,10 +79,10 @@ If --merge-base is given, use the merge base of the two commits for the
This form is to view the results of a merge commit. The first
listed <commit> must be the merge itself; the remaining two or
- more commits should be its parents. A convenient way to produce
- the desired set of revisions is to use the `^@` suffix.
- For instance, if `master` names a merge commit, `git diff master
- master^@` gives the same combined diff as `git show master`.
+ 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^@`,
+ `git diff A^!` and `git show A` all give the same combined diff.
'git diff' [<options>] <commit>..<commit> [--] [<path>...]::
diff --git a/Documentation/git-difftool.txt b/Documentation/git-difftool.txt
index 9d14c3c9f0..ac0ac6fa02 100644
--- a/Documentation/git-difftool.txt
+++ b/Documentation/git-difftool.txt
@@ -97,10 +97,12 @@ instead. `--no-symlinks` is the default on Windows.
--[no-]gui::
When 'git-difftool' is invoked with the `-g` or `--gui` option
the default diff tool will be read from the configured
- `diff.guitool` variable instead of `diff.tool`. The `--no-gui`
- option can be used to override this setting. If `diff.guitool`
- is not set, we will fallback in the order of `merge.guitool`,
- `diff.tool`, `merge.tool` until a tool is found.
+ `diff.guitool` variable instead of `diff.tool`. This may be
+ selected automatically using the configuration variable
+ `difftool.guiDefault`. The `--no-gui` option can be used to
+ override these settings. If `diff.guitool` is not set, we will
+ fallback in the order of `merge.guitool`, `diff.tool`,
+ `merge.tool` until a tool is found.
--[no-]trust-exit-code::
'git-difftool' invokes a diff tool individually on each file.
diff --git a/Documentation/git-fast-export.txt b/Documentation/git-fast-export.txt
index 1978dbdc6a..4643ddbe68 100644
--- a/Documentation/git-fast-export.txt
+++ b/Documentation/git-fast-export.txt
@@ -9,7 +9,7 @@ git-fast-export - Git data exporter
SYNOPSIS
--------
[verse]
-'git fast-export [<options>]' | 'git fast-import'
+'git fast-export' [<options>] | 'git fast-import'
DESCRIPTION
-----------
diff --git a/Documentation/git-fetch.txt b/Documentation/git-fetch.txt
index 63d9569e16..fba66f1460 100644
--- a/Documentation/git-fetch.txt
+++ b/Documentation/git-fetch.txt
@@ -251,10 +251,10 @@ EXAMPLES
$ git fetch origin
------------------------------------------------
+
-The above command copies all branches from the remote refs/heads/
-namespace and stores them to the local refs/remotes/origin/ namespace,
-unless the branch.<name>.fetch option is used to specify a non-default
-refspec.
+The above command copies all branches from the remote `refs/heads/`
+namespace and stores them to the local `refs/remotes/origin/` namespace,
+unless the `remote.<repository>.fetch` option is used to specify a
+non-default refspec.
* Using refspecs explicitly:
+
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
index 6da899c629..1e215d4e73 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -9,7 +9,8 @@ SYNOPSIS
--------
[verse]
'git for-each-ref' [--count=<count>] [--shell|--perl|--python|--tcl]
- [(--sort=<key>)...] [--format=<format>] [<pattern>...]
+ [(--sort=<key>)...] [--format=<format>]
+ [ --stdin | <pattern>... ]
[--points-at=<object>]
[--merged[=<object>]] [--no-merged[=<object>]]
[--contains[=<object>]] [--no-contains[=<object>]]
@@ -32,6 +33,10 @@ OPTIONS
literally, in the latter case matching completely or from the
beginning up to a slash.
+--stdin::
+ If `--stdin` is supplied, then the list of patterns is read from
+ standard input instead of from the argument list.
+
--count=<count>::
By default the command shows all refs that match
`<pattern>`. This option makes it stop after showing
@@ -93,6 +98,10 @@ OPTIONS
--ignore-case::
Sorting and filtering refs are case insensitive.
+--omit-empty::
+ Do not print a newline after formatted refs where the format expands
+ to the empty string.
+
FIELD NAMES
-----------
@@ -217,6 +226,11 @@ worktreepath::
out, if it is checked out in any linked worktree. Empty string
otherwise.
+ahead-behind:<committish>::
+ Two integers, separated by a space, demonstrating the number of
+ commits ahead and behind, respectively, when comparing the output
+ ref to the `<committish>` specified in the format.
+
In addition to the above, for commit and tag objects, the header
field names (`tree`, `parent`, `object`, `type`, and `tag`) can
be used to specify the value in the header field.
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index dfcc7da4c2..b1c13fb39a 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -99,7 +99,7 @@ To omit patch numbers from the subject, use `-N`.
If given `--thread`, `git-format-patch` will generate `In-Reply-To` and
`References` headers to make the second and subsequent patch mails appear
-as replies to the first mail; this also generates a `Message-Id` header to
+as replies to the first mail; this also generates a `Message-ID` header to
reference.
OPTIONS
@@ -163,7 +163,7 @@ include::diff-options.txt[]
--no-thread::
Controls addition of `In-Reply-To` and `References` headers to
make the second and subsequent mails appear as replies to the
- first. Also controls generation of the `Message-Id` header to
+ first. Also controls generation of the `Message-ID` header to
reference.
+
The optional <style> argument can be either `shallow` or `deep`.
@@ -173,8 +173,7 @@ series, where the head is chosen from the cover letter, the
threading makes every mail a reply to the previous one.
+
The default is `--no-thread`, unless the `format.thread` configuration
-is set. If `--thread` is specified without a style, it defaults to the
-style specified by `format.thread` if any, or else `shallow`.
+is set. `--thread` without an argument is equivalent to `--thread=shallow`.
+
Beware that the default for 'git send-email' is to thread emails
itself. If you want `git format-patch` to take care of threading, you
diff --git a/Documentation/git-fsck.txt b/Documentation/git-fsck.txt
index 29318ea957..b6a0f8a085 100644
--- a/Documentation/git-fsck.txt
+++ b/Documentation/git-fsck.txt
@@ -152,6 +152,18 @@ hash mismatch <object>::
object database value.
This indicates a serious data integrity problem.
+
+FSCK MESSAGES
+-------------
+
+The following lists the types of errors `git fsck` detects and what
+each error means, with their default severity. The severity of the
+error, other than those that are marked as "(FATAL)", can be tweaked
+by setting the corresponding `fsck.<msg-id>` configuration variable.
+
+include::fsck-msgids.txt[]
+
+
Environment Variables
---------------------
diff --git a/Documentation/git-fsmonitor--daemon.txt b/Documentation/git-fsmonitor--daemon.txt
index cc142fb861..8238eadb0e 100644
--- a/Documentation/git-fsmonitor--daemon.txt
+++ b/Documentation/git-fsmonitor--daemon.txt
@@ -3,7 +3,7 @@ git-fsmonitor{litdd}daemon(1)
NAME
----
-git-fsmonitor--daemon - A Built-in File System Monitor
+git-fsmonitor--daemon - A Built-in Filesystem Monitor
SYNOPSIS
--------
@@ -17,7 +17,7 @@ DESCRIPTION
-----------
A daemon to watch the working directory for file and directory
-changes using platform-specific file system notification facilities.
+changes using platform-specific filesystem notification facilities.
This daemon communicates directly with commands like `git status`
using the link:technical/api-simple-ipc.html[simple IPC] interface
@@ -63,13 +63,44 @@ CAVEATS
-------
The fsmonitor daemon does not currently know about submodules and does
-not know to filter out file system events that happen within a
+not know to filter out filesystem events that happen within a
submodule. If fsmonitor daemon is watching a super repo and a file is
modified within the working directory of a submodule, it will report
the change (as happening against the super repo). However, the client
will properly ignore these extra events, so performance may be affected
but it will not cause an incorrect result.
+By default, the fsmonitor daemon refuses to work against network-mounted
+repositories; this may be overridden by setting `fsmonitor.allowRemote` to
+`true`. Note, however, that the fsmonitor daemon is not guaranteed to work
+correctly with all network-mounted repositories and such use is considered
+experimental.
+
+On Mac OS, the inter-process communication (IPC) between various Git
+commands and the fsmonitor daemon is done via a Unix domain socket (UDS) -- a
+special type of file -- which is supported by native Mac OS filesystems,
+but not on network-mounted filesystems, NTFS, or FAT32. Other filesystems
+may or may not have the needed support; the fsmonitor daemon is not guaranteed
+to work with these filesystems and such use is considered experimental.
+
+By default, the socket is created in the `.git` directory, however, if the
+`.git` directory is on a network-mounted filesystem, it will be instead be
+created at `$HOME/.git-fsmonitor-*` unless `$HOME` itself is on a
+network-mounted filesystem in which case you must set the configuration
+variable `fsmonitor.socketDir` to the path of a directory on a Mac OS native
+filesystem in which to create the socket file.
+
+If none of the above directories (`.git`, `$HOME`, or `fsmonitor.socketDir`)
+is on a native Mac OS file filesystem the fsmonitor daemon will report an
+error that will cause the daemon and the currently running command to exit.
+
+CONFIGURATION
+-------------
+
+include::includes/cmd-config-section-all.txt[]
+
+include::config/fsmonitor--daemon.txt[]
+
GIT
---
Part of the linkgit:git[1] suite
diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index a65c9aa62d..90806fd26a 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -54,9 +54,10 @@ other housekeeping tasks (e.g. rerere, working trees, reflog...) will
be performed as well.
---cruft::
+--[no-]cruft::
When expiring unreachable objects, pack them separately into a
- cruft pack instead of storing them as loose objects.
+ cruft pack instead of storing them as loose objects. `--cruft`
+ is on by default.
--prune=<date>::
Prune loose objects older than date (default is 2 weeks ago,
@@ -77,9 +78,10 @@ be performed as well.
instance running on this repository.
--keep-largest-pack::
- All packs except the largest pack and those marked with a
- `.keep` files are consolidated into a single pack. When this
- option is used, `gc.bigPackThreshold` is ignored.
+ All packs except the largest non-cruft pack, any packs marked
+ with a `.keep` file, and any cruft pack(s) are consolidated into
+ a single pack. When this option is used, `gc.bigPackThreshold`
+ is ignored.
AGGRESSIVE
----------
diff --git a/Documentation/git-hash-object.txt b/Documentation/git-hash-object.txt
index df9e2c58bd..472b5bb995 100644
--- a/Documentation/git-hash-object.txt
+++ b/Documentation/git-hash-object.txt
@@ -9,7 +9,8 @@ git-hash-object - Compute object ID and optionally creates a blob from a file
SYNOPSIS
--------
[verse]
-'git hash-object' [-t <type>] [-w] [--path=<file>|--no-filters] [--stdin [--literally]] [--] <file>...
+'git hash-object' [-t <type>] [-w] [--path=<file> | --no-filters]
+ [--stdin [--literally]] [--] <file>...
'git hash-object' [-t <type>] [-w] --stdin-paths [--no-filters]
DESCRIPTION
diff --git a/Documentation/git-hook.txt b/Documentation/git-hook.txt
index 77c3a8ad90..3407f3c2c0 100644
--- a/Documentation/git-hook.txt
+++ b/Documentation/git-hook.txt
@@ -8,7 +8,7 @@ git-hook - Run git hooks
SYNOPSIS
--------
[verse]
-'git hook' run [--ignore-missing] <hook-name> [-- <hook-args>]
+'git hook' run [--ignore-missing] [--to-stdin=<path>] <hook-name> [-- <hook-args>]
DESCRIPTION
-----------
@@ -31,6 +31,11 @@ linkgit:githooks[5] for arguments hooks might expect (if any).
OPTIONS
-------
+--to-stdin::
+ For "run"; Specify a file which will be streamed into the
+ hook's stdin. The hook will receive the entire file from
+ beginning to EOF.
+
--ignore-missing::
Ignore any missing hook by quietly returning zero. Used for
tools that want to do a blind one-shot run of a hook that may
diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt
index 6d6197cd0a..4b97f812be 100644
--- a/Documentation/git-interpret-trailers.txt
+++ b/Documentation/git-interpret-trailers.txt
@@ -8,8 +8,9 @@ git-interpret-trailers - Add or parse structured information in commit messages
SYNOPSIS
--------
[verse]
-'git interpret-trailers' [<options>] [(--trailer <token>[(=|:)<value>])...] [<file>...]
-'git interpret-trailers' [<options>] [--parse] [<file>...]
+'git interpret-trailers' [--in-place] [--trim-empty]
+ [(--trailer <token>[(=|:)<value>])...]
+ [--parse] [<file>...]
DESCRIPTION
-----------
@@ -279,7 +280,7 @@ $ cat msg.txt
subject
message
-$ cat msg.txt | git interpret-trailers --trailer 'sign: Alice <alice@example.com>' --trailer 'sign: Bob <bob@example.com>'
+$ git interpret-trailers --trailer 'sign: Alice <alice@example.com>' --trailer 'sign: Bob <bob@example.com>' <msg.txt
subject
message
@@ -321,17 +322,30 @@ $ git interpret-trailers --trailer 'Cc: Alice <alice@example.com>' --trailer 'Re
'Signed-off-by: ' already, and show how it works:
+
------------
+$ cat msg1.txt
+subject
+
+message
$ git config trailer.sign.key "Signed-off-by: "
$ git config trailer.sign.ifmissing add
$ git config trailer.sign.ifexists doNothing
-$ git config trailer.sign.command 'echo "$(git config user.name) <$(git config user.email)>"'
-$ git interpret-trailers <<EOF
-> EOF
+$ git config trailer.sign.cmd 'echo "$(git config user.name) <$(git config user.email)>"'
+$ git interpret-trailers --trailer sign <msg1.txt
+subject
+
+message
Signed-off-by: Bob <bob@example.com>
-$ git interpret-trailers <<EOF
-> Signed-off-by: Alice <alice@example.com>
-> EOF
+$ cat msg2.txt
+subject
+
+message
+
+Signed-off-by: Alice <alice@example.com>
+$ git interpret-trailers --trailer sign <msg2.txt
+subject
+
+message
Signed-off-by: Alice <alice@example.com>
------------
@@ -356,15 +370,14 @@ Fix #42
$ cat ~/bin/glog-find-author
#!/bin/sh
test -n "$1" && git log --author="$1" --pretty="%an <%ae>" -1 || true
+$ cat msg.txt
+subject
+
+message
$ git config trailer.help.key "Helped-by: "
$ git config trailer.help.ifExists "addIfDifferentNeighbor"
$ git config trailer.help.cmd "~/bin/glog-find-author"
-$ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" <<EOF
-> subject
->
-> message
->
-> EOF
+$ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" <msg.txt
subject
message
@@ -381,15 +394,14 @@ Helped-by: Christian Couder <christian.couder@gmail.com>
$ cat ~/bin/glog-grep
#!/bin/sh
test -n "$1" && git log --grep "$1" --pretty=reference -1 || true
+$ cat msg.txt
+subject
+
+message
$ git config trailer.ref.key "Reference-to: "
$ git config trailer.ref.ifExists "replace"
$ git config trailer.ref.cmd "~/bin/glog-grep"
-$ git interpret-trailers --trailer="ref:Add copyright notices." <<EOF
-> subject
->
-> message
->
-> EOF
+$ git interpret-trailers --trailer="ref:Add copyright notices." <msg.txt
subject
message
@@ -401,17 +413,20 @@ Reference-to: 8bc9a0c769 (Add copyright notices., 2005-04-07)
commit that is related, and show how it works:
+
------------
+$ cat msg.txt
+subject
+
+message
+
+see: HEAD~2
+$ cat ~/bin/glog-ref
+#!/bin/sh
+git log -1 --oneline --format="%h (%s)" --abbrev-commit --abbrev=14
$ git config trailer.see.key "See-also: "
$ git config trailer.see.ifExists "replace"
$ git config trailer.see.ifMissing "doNothing"
-$ git config trailer.see.command "git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14 \$ARG"
-$ git interpret-trailers <<EOF
-> subject
->
-> message
->
-> see: HEAD~2
-> EOF
+$ git config trailer.see.cmd "glog-ref"
+$ git interpret-trailers --trailer=see <msg.txt
subject
message
@@ -426,22 +441,21 @@ See-also: fe3187489d69c4 (subject of related commit)
to add a 'git-version' trailer:
+
------------
-$ sed -e 's/ Z$/ /' >commit_template.txt <<EOF
-> ***subject***
->
-> ***message***
->
-> Fixes: Z
-> Cc: Z
-> Reviewed-by: Z
-> Signed-off-by: Z
-> EOF
+$ cat temp.txt
+***subject***
+
+***message***
+
+Fixes: Z
+Cc: Z
+Reviewed-by: Z
+Signed-off-by: Z
+$ sed -e 's/ Z$/ /' temp.txt > commit_template.txt
$ git config commit.template commit_template.txt
-$ cat >.git/hooks/commit-msg <<EOF
-> #!/bin/sh
-> git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new"
-> mv "\$1.new" "\$1"
-> EOF
+$ cat .git/hooks/commit-msg
+#!/bin/sh
+git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new"
+mv "\$1.new" "\$1"
$ chmod +x .git/hooks/commit-msg
------------
diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt
index d7986419c2..1abdd3c21c 100644
--- a/Documentation/git-ls-files.txt
+++ b/Documentation/git-ls-files.txt
@@ -10,8 +10,9 @@ SYNOPSIS
--------
[verse]
'git ls-files' [-z] [-t] [-v] [-f]
- [-c|--cached] [-d|--deleted] [-o|--others] [-i|--|ignored]
- [-s|--stage] [-u|--unmerged] [-k|--|killed] [-m|--modified]
+ [-c|--cached] [-d|--deleted] [-o|--others] [-i|--ignored]
+ [-s|--stage] [-u|--unmerged] [-k|--killed] [-m|--modified]
+ [--resolve-undo]
[--directory [--no-empty-directory]] [--eol]
[--deduplicate]
[-x <pattern>|--exclude=<pattern>]
@@ -28,21 +29,26 @@ This merges the file listing in the index with the actual working
directory list, and shows different combinations of the two.
One or more of the options below may be used to determine the files
-shown:
+shown, and each file may be printed multiple times if there are
+multiple entries in the index or multiple statuses are applicable for
+the relevant file selection options.
OPTIONS
-------
-c::
--cached::
- Show cached files in the output (default)
+ Show all files cached in Git's index, i.e. all tracked files.
+ (This is the default if no -c/-s/-d/-o/-u/-k/-m/--resolve-undo
+ options are specified.)
-d::
--deleted::
- Show deleted files in the output
+ Show files with an unstaged deletion
-m::
--modified::
- Show modified files in the output
+ Show files with an unstaged modification (note that an unstaged
+ deletion also counts as an unstaged modification)
-o::
--others::
@@ -50,11 +56,14 @@ OPTIONS
-i::
--ignored::
- Show only ignored files in the output. When showing files in the
- index, print only those matched by an exclude pattern. When
- showing "other" files, show only those matched by an exclude
- pattern. Standard ignore rules are not automatically activated,
- therefore at least one of the `--exclude*` options is required.
+ Show only ignored files in the output. Must be used with
+ either an explicit '-c' or '-o'. When showing files in the
+ index (i.e. when used with '-c'), print only those files
+ matching an exclude pattern. When showing "other" files
+ (i.e. when used with '-o'), show only those matched by an
+ exclude pattern. Standard ignore rules are not automatically
+ activated, therefore at least one of the `--exclude*` options
+ is required.
-s::
--stage::
@@ -63,19 +72,29 @@ OPTIONS
--directory::
If a whole directory is classified as "other", show just its
name (with a trailing slash) and not its whole contents.
+ Has no effect without -o/--others.
--no-empty-directory::
Do not list empty directories. Has no effect without --directory.
-u::
--unmerged::
- Show unmerged files in the output (forces --stage)
+ Show information about unmerged files in the output, but do
+ not show any other tracked files (forces --stage, overrides
+ --cached).
-k::
--killed::
- Show files on the filesystem that need to be removed due
- to file/directory conflicts for checkout-index to
- succeed.
+ Show untracked files on the filesystem that need to be removed
+ due to file/directory conflicts for tracked files to be able to
+ be written to the filesystem.
+
+--resolve-undo::
+ Show files having resolve-undo information in the index
+ together with their resolve-undo information. (resolve-undo
+ information is what is used to implement "git checkout -m
+ $PATH", i.e. to recreate merge conflicts that were
+ accidentally resolved)
-z::
\0 line termination on output and do not quote filenames.
@@ -100,7 +119,8 @@ OPTIONS
--exclude-per-directory=<file>::
Read additional exclude patterns that apply only to the
- directory and its subdirectories in <file>.
+ directory and its subdirectories in <file>. Deprecated; use
+ --exclude-standard instead.
--exclude-standard::
Add the standard Git exclusions: .git/info/exclude, .gitignore
@@ -118,24 +138,27 @@ OPTIONS
with `-s` or `-u` options does not make any sense.
-t::
- This feature is semi-deprecated. For scripting purpose,
- linkgit:git-status[1] `--porcelain` and
+ Show status tags together with filenames. Note that for
+ scripting purposes, linkgit:git-status[1] `--porcelain` and
linkgit:git-diff-files[1] `--name-status` are almost always
superior alternatives, and users should look at
linkgit:git-status[1] `--short` or linkgit:git-diff[1]
`--name-status` for more user-friendly alternatives.
+
--
-This option identifies the file status with the following tags (followed by
-a space) at the start of each line:
-
- H:: cached
- S:: skip-worktree
- M:: unmerged
- R:: removed/deleted
- C:: modified/changed
- K:: to be killed
- ?:: other
+This option provides a reason for showing each filename, in the form
+of a status tag (which is followed by a space and then the filename).
+The status tags are all single characters from the following list:
+
+ H:: tracked file that is not either unmerged or skip-worktree
+ S:: tracked file that is skip-worktree
+ M:: tracked file that is unmerged
+ R:: tracked file with unstaged removal/deletion
+ C:: tracked file with unstaged modification/change
+ K:: untracked paths which are part of file/directory conflicts
+ which prevent checking out tracked files
+ ?:: untracked file
+ U:: file with resolve-undo information
--
-v::
@@ -269,7 +292,9 @@ traversing the directory tree and finding files to show when the
flags --others or --ignored are specified. linkgit:gitignore[5]
specifies the format of exclude patterns.
-These exclude patterns come from these places, in order:
+Generally, you should just use --exclude-standard, but for historical
+reasons the exclude patterns can be specified from the following
+places, in order:
1. The command-line flag --exclude=<pattern> specifies a
single pattern. Patterns are ordered in the same order
diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt
index 492e573856..ff3da547dd 100644
--- a/Documentation/git-ls-remote.txt
+++ b/Documentation/git-ls-remote.txt
@@ -11,7 +11,7 @@ SYNOPSIS
[verse]
'git ls-remote' [--heads] [--tags] [--refs] [--upload-pack=<exec>]
[-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]
- [--symref] [<repository> [<refs>...]]
+ [--symref] [<repository> [<patterns>...]]
DESCRIPTION
-----------
@@ -85,25 +85,32 @@ OPTIONS
either a URL or the name of a remote (see the GIT URLS and
REMOTES sections of linkgit:git-fetch[1]).
-<refs>...::
+<patterns>...::
When unspecified, all references, after filtering done
- with --heads and --tags, are shown. When <refs>... are
- specified, only references matching the given patterns
- are displayed.
+ with --heads and --tags, are shown. When <patterns>... are
+ specified, only references matching one or more of the given
+ patterns are displayed. Each pattern is interpreted as a glob
+ (see `glob` in linkgit:gitglossary[7]) which is matched against
+ the "tail" of a ref, starting either from the start of the ref
+ (so a full name like `refs/heads/foo` matches) or from a slash
+ separator (so `bar` matches `refs/heads/bar` but not
+ `refs/heads/foobar`).
EXAMPLES
--------
----
-$ git ls-remote --tags ./.
+$ git ls-remote --tags .
d6602ec5194c87b0fc87103ca4d67251c76f233a refs/tags/v0.99
f25a265a342aed6041ab0cc484224d9ca54b6f41 refs/tags/v0.99.1
7ceca275d047c90c0c7d5afb13ab97efdf51bd6e refs/tags/v0.99.3
c5db5456ae3b0873fc659c19fafdde22313cc441 refs/tags/v0.99.2
0918385dbd9656cab0d1d81ba7453d49bbc16250 refs/tags/junio-gpg-pub
+
$ git ls-remote http://www.kernel.org/pub/scm/git/git.git master seen rc
5fe978a5381f1fbad26a80e682ddd2a401966740 refs/heads/master
c781a84b5204fb294c9ccc79f8b3baceeb32c061 refs/heads/seen
+
$ git remote add korg http://www.kernel.org/pub/scm/git/git.git
$ git ls-remote --tags korg v\*
d6602ec5194c87b0fc87103ca4d67251c76f233a refs/tags/v0.99
diff --git a/Documentation/git-maintenance.txt b/Documentation/git-maintenance.txt
index 9c630efe19..805e5a2e3a 100644
--- a/Documentation/git-maintenance.txt
+++ b/Documentation/git-maintenance.txt
@@ -11,7 +11,7 @@ SYNOPSIS
[verse]
'git maintenance' run [<options>]
'git maintenance' start [--scheduler=<scheduler>]
-'git maintenance' (stop|register|unregister)
+'git maintenance' (stop|register|unregister) [<options>]
DESCRIPTION
@@ -50,13 +50,13 @@ stop::
the background maintenance is restarted later.
register::
- Initialize Git config values so any scheduled maintenance will
- start running on this repository. This adds the repository to the
- `maintenance.repo` config variable in the current user's global
- config and enables some recommended configuration values for
- `maintenance.<task>.schedule`. The tasks that are enabled are safe
- for running in the background without disrupting foreground
- processes.
+ Initialize Git config values so any scheduled maintenance will start
+ running on this repository. This adds the repository to the
+ `maintenance.repo` config variable in the current user's global config,
+ or the config specified by --config-file option, and enables some
+ recommended configuration values for `maintenance.<task>.schedule`. The
+ tasks that are enabled are safe for running in the background without
+ disrupting foreground processes.
+
The `register` subcommand will also set the `maintenance.strategy` config
value to `incremental`, if this value is not previously set. The
@@ -79,6 +79,10 @@ unregister::
Remove the current repository from background maintenance. This
only removes the repository from the configured list. It does not
stop the background maintenance processes from running.
++
+The `unregister` subcommand will report an error if the current repository
+is not already registered. Use the `--force` option to return success even
+when the current repository is not registered.
TASKS
-----
diff --git a/Documentation/git-merge-base.txt b/Documentation/git-merge-base.txt
index 2d944e0851..b01ba3d356 100644
--- a/Documentation/git-merge-base.txt
+++ b/Documentation/git-merge-base.txt
@@ -9,8 +9,8 @@ git-merge-base - Find as good common ancestors as possible for a merge
SYNOPSIS
--------
[verse]
-'git merge-base' [-a|--all] <commit> <commit>...
-'git merge-base' [-a|--all] --octopus <commit>...
+'git merge-base' [-a | --all] <commit> <commit>...
+'git merge-base' [-a | --all] --octopus <commit>...
'git merge-base' --is-ancestor <commit> <commit>
'git merge-base' --independent <commit>...
'git merge-base' --fork-point <ref> [<commit>]
diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt
index d6c356740e..ffc4fbf7e8 100644
--- a/Documentation/git-merge-tree.txt
+++ b/Documentation/git-merge-tree.txt
@@ -64,6 +64,11 @@ OPTIONS
share no common history. This flag can be given to override that
check and make the merge proceed anyway.
+--merge-base=<commit>::
+ Instead of finding the merge-bases for <branch1> and <branch2>,
+ specify a merge-base for the merge, and specifying multiple bases is
+ currently not supported. This option is incompatible with `--stdin`.
+
[[OUTPUT]]
OUTPUT
------
@@ -81,6 +86,31 @@ Whereas for a conflicted merge, the output is by default of the form:
These are discussed individually below.
+However, there is an exception. If `--stdin` is passed, then there is
+an extra section at the beginning, a NUL character at the end, and then
+all the sections repeat for each line of input. Thus, if the first merge
+is conflicted and the second is clean, the output would be of the form:
+
+ <Merge status>
+ <OID of toplevel tree>
+ <Conflicted file info>
+ <Informational messages>
+ NUL
+ <Merge status>
+ <OID of toplevel tree>
+ NUL
+
+[[MS]]
+Merge status
+~~~~~~~~~~~~
+
+This is an integer status followed by a NUL character. The integer status is:
+
+ 0: merge had conflicts
+ 1: merge was clean
+ <0: something prevented the merge from running (e.g. access to repository
+ objects denied by filesystem)
+
[[OIDTLT]]
OID of toplevel tree
~~~~~~~~~~~~~~~~~~~~
@@ -108,18 +138,50 @@ character instead of a newline character.
Informational messages
~~~~~~~~~~~~~~~~~~~~~~
-This always starts with a blank line (or NUL if `-z` is passed) to
-separate it from the previous sections, and then has free-form
-messages about the merge, such as:
+This section provides informational messages, typically about
+conflicts. The format of the section varies significantly depending
+on whether `-z` is passed.
+
+If `-z` is passed:
+
+The output format is zero or more conflict informational records, each
+of the form:
+
+ <list-of-paths><conflict-type>NUL<conflict-message>NUL
+
+where <list-of-paths> is of the form
+
+ <number-of-paths>NUL<path1>NUL<path2>NUL...<pathN>NUL
+
+and includes paths (or branch names) affected by the conflict or
+informational message in <conflict-message>. Also, <conflict-type> is a
+stable string explaining the type of conflict, such as
+
+ * "Auto-merging"
+ * "CONFLICT (rename/delete)"
+ * "CONFLICT (submodule lacks merge base)"
+ * "CONFLICT (binary)"
+
+and <conflict-message> is a more detailed message about the conflict which often
+(but not always) embeds the <stable-short-type-description> within it. These
+strings may change in future Git versions. Some examples:
* "Auto-merging <file>"
* "CONFLICT (rename/delete): <oldfile> renamed...but deleted in..."
- * "Failed to merge submodule <submodule> (<reason>)"
+ * "Failed to merge submodule <submodule> (no merge base)"
* "Warning: cannot merge binary files: <filename>"
-Note that these free-form messages will never have a NUL character
-in or between them, even if -z is passed. It is simply a large block
-of text taking up the remainder of the output.
+If `-z` is NOT passed:
+
+This section starts with a blank line to separate it from the previous
+sections, and then only contains the <conflict-message> information
+from the previous section (separated by newlines). These are
+non-stable strings that should not be parsed by scripts, and are just
+meant for human consumption. Also, note that while <conflict-message>
+strings usually do not contain embedded newlines, they sometimes do.
+(However, the free-form messages will never have an embedded NUL
+character). So, the entire block of information is meant for human
+readers as an agglomeration of all conflict messages.
EXIT STATUS
-----------
@@ -127,7 +189,10 @@ EXIT STATUS
For a successful, non-conflicted merge, the exit status is 0. When the
merge has conflicts, the exit status is 1. If the merge is not able to
complete (or start) due to some kind of error, the exit status is
-something other than 0 or 1 (and the output is unspecified).
+something other than 0 or 1 (and the output is unspecified). When
+--stdin is passed, the return status is 0 for both successful and
+conflicted merges, and something other than 0 or 1 if it cannot complete
+all the requested merges.
USAGE NOTES
-----------
@@ -156,6 +221,17 @@ with linkgit:git-merge[1]:
* any messages that would have been printed to stdout (the
<<IM,Informational messages>>)
+INPUT FORMAT
+------------
+'git merge-tree --stdin' input format is fully text based. Each line
+has this format:
+
+ [<base-commit> -- ]<branch1> <branch2>
+
+If one line is separated by `--`, the string before the separator is
+used for specifying a merge-base for the merge and the string after
+the separator describes the branches to be merged.
+
MISTAKES TO AVOID
-----------------
diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index 2d6a1391c8..0aeff572a5 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -37,7 +37,8 @@ Then "`git merge topic`" will replay the changes made on the
`topic` branch since it diverged from `master` (i.e., `E`) until
its current commit (`C`) on top of `master`, and record the result
in a new commit along with the names of the two parent commits and
-a log message from the user describing the changes.
+a log message from the user describing the changes. Before the operation,
+`ORIG_HEAD` is set to the tip of the current branch (`C`).
------------
A---B---C topic
diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
index c44e205629..07535f6576 100644
--- a/Documentation/git-mergetool.txt
+++ b/Documentation/git-mergetool.txt
@@ -85,12 +85,13 @@ success of the resolution after the custom tool has exited.
the default merge tool will be read from the configured
`merge.guitool` variable instead of `merge.tool`. If
`merge.guitool` is not set, we will fallback to the tool
- configured under `merge.tool`.
+ configured under `merge.tool`. This may be autoselected using
+ the configuration variable `mergetool.guiDefault`.
--no-gui::
- This overrides a previous `-g` or `--gui` setting and reads the
- default merge tool will be read from the configured `merge.tool`
- variable.
+ This overrides a previous `-g` or `--gui` setting or
+ `mergetool.guiDefault` configuration and reads the default merge
+ tool from the configured `merge.tool` variable.
-O<orderfile>::
Process files in the order specified in the
diff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt
index 79449bf98f..fb0220fd18 100644
--- a/Documentation/git-mv.txt
+++ b/Documentation/git-mv.txt
@@ -9,7 +9,7 @@ git-mv - Move or rename a file, a directory, or a symlink
SYNOPSIS
--------
[verse]
-'git mv' <options>... <args>...
+'git mv' [<options>] <source>... <destination>
DESCRIPTION
-----------
@@ -30,7 +30,7 @@ OPTIONS
-------
-f::
--force::
- Force renaming or moving of a file even if the target exists
+ Force renaming or moving of a file even if the <destination> exists.
-k::
Skip move or rename actions which would lead to an error
condition. An error happens when a source is neither existing nor
diff --git a/Documentation/git-pack-redundant.txt b/Documentation/git-pack-redundant.txt
index ee7034b5e5..13c3eb5ec9 100644
--- a/Documentation/git-pack-redundant.txt
+++ b/Documentation/git-pack-redundant.txt
@@ -9,7 +9,21 @@ git-pack-redundant - Find redundant pack files
SYNOPSIS
--------
[verse]
-'git pack-redundant' [ --verbose ] [ --alt-odb ] ( --all | <pack-filename>... )
+'git pack-redundant' [--verbose] [--alt-odb] (--all | <pack-filename>...)
+
+WARNING
+-------
+`git pack-redundant` has been deprecated and is scheduled for removal in
+a future version of Git. Because it can only remove entire duplicate
+packs and not individual duplicate objects, it is generally not a useful
+tool for reducing repository size. You are better off using `git gc` to
+do so, which will put objects into a new pack, removing duplicates.
+
+Running `pack-redundant` without the `--i-still-use-this` flag will fail
+in this release. If you believe you have a use case for which
+`pack-redundant` is better suited and oppose this removal, please
+contact the Git mailing list at git@vger.kernel.org. More information
+about the list is available at https://git-scm.com/community.
DESCRIPTION
-----------
@@ -34,7 +48,7 @@ OPTIONS
--alt-odb::
Don't require objects present in packs from alternate object
- directories to be present in local packs.
+ database (odb) directories to be present in local packs.
--verbose::
Outputs some statistics to stderr. Has a small performance penalty.
diff --git a/Documentation/git-patch-id.txt b/Documentation/git-patch-id.txt
index 442caff8a9..1d15fa45d5 100644
--- a/Documentation/git-patch-id.txt
+++ b/Documentation/git-patch-id.txt
@@ -8,18 +8,18 @@ git-patch-id - Compute unique ID for a patch
SYNOPSIS
--------
[verse]
-'git patch-id' [--stable | --unstable]
+'git patch-id' [--stable | --unstable | --verbatim]
DESCRIPTION
-----------
Read a patch from the standard input and compute the patch ID for it.
A "patch ID" is nothing but a sum of SHA-1 of the file diffs associated with a
-patch, with whitespace and line numbers ignored. As such, it's "reasonably
-stable", but at the same time also reasonably unique, i.e., two patches that
-have the same "patch ID" are almost guaranteed to be the same thing.
+patch, with line numbers ignored. As such, it's "reasonably stable", but at
+the same time also reasonably unique, i.e., two patches that have the same
+"patch ID" are almost guaranteed to be the same thing.
-IOW, you can use this thing to look for likely duplicate commits.
+The main usecase for this command is to look for likely duplicate commits.
When dealing with 'git diff-tree' output, it takes advantage of
the fact that the patch is prefixed with the object name of the
@@ -30,6 +30,12 @@ This can be used to make a mapping from patch ID to commit ID.
OPTIONS
-------
+--verbatim::
+ Calculate the patch-id of the input as it is given, do not strip
+ any whitespace.
+
+ This is the default if patchid.verbatim is true.
+
--stable::
Use a "stable" sum of hashes as the patch ID. With this option:
- Reordering file diffs that make up a patch does not affect the ID.
@@ -45,14 +51,16 @@ OPTIONS
of "-O<orderfile>", thereby making existing databases storing such
"unstable" or historical patch-ids unusable.
+ - All whitespace within the patch is ignored and does not affect the id.
+
This is the default if patchid.stable is set to true.
--unstable::
Use an "unstable" hash as the patch ID. With this option,
the result produced is compatible with the patch-id value produced
- by git 1.9 and older. Users with pre-existing databases storing
- patch-ids produced by git 1.9 and older (who do not deal with reordered
- patches) may want to use this option.
+ by git 1.9 and older and whitespace is ignored. Users with pre-existing
+ databases storing patch-ids produced by git 1.9 and older (who do not deal
+ with reordered patches) may want to use this option.
This is the default.
diff --git a/Documentation/git-prune-packed.txt b/Documentation/git-prune-packed.txt
index 9fed59a317..844d6f808a 100644
--- a/Documentation/git-prune-packed.txt
+++ b/Documentation/git-prune-packed.txt
@@ -9,7 +9,7 @@ git-prune-packed - Remove extra objects that are already in pack files
SYNOPSIS
--------
[verse]
-'git prune-packed' [-n|--dry-run] [-q|--quiet]
+'git prune-packed' [-n | --dry-run] [-q | --quiet]
DESCRIPTION
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index def7657ef9..5bb1d5aae2 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -409,10 +409,14 @@ Specifying `--no-force-if-includes` disables this behavior.
all submodules that changed in the revisions to be pushed will be
pushed. If on-demand was not able to push all necessary revisions it will
also be aborted and exit with non-zero status. If 'only' is used all
- submodules will be recursively pushed while the superproject is left
+ submodules will be pushed while the superproject is left
unpushed. A value of 'no' or using `--no-recurse-submodules` can be used
to override the push.recurseSubmodules configuration variable when no
submodule recursion is required.
++
+When using 'on-demand' or 'only', if a submodule has a
+"push.recurseSubmodules={on-demand,only}" or "submodule.recurse" configuration,
+further recursion will occur. In this case, "only" is treated as "on-demand".
--[no-]verify::
Toggle the pre-push hook (see linkgit:githooks[5]). The
diff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt
index b9bfdc0a31..b09707474d 100644
--- a/Documentation/git-read-tree.txt
+++ b/Documentation/git-read-tree.txt
@@ -9,7 +9,7 @@ git-read-tree - Reads tree information into the index
SYNOPSIS
--------
[verse]
-'git read-tree' [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>]
+'git read-tree' [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>)
[-u | -i]] [--index-output=<file>] [--no-sparse-checkout]
(--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])
@@ -219,7 +219,7 @@ see which of the "local changes" that you made were carried forward by running
`git diff-index --cached $M`. Note that this does not
necessarily match what `git diff-index --cached $H` would have
produced before such a two tree merge. This is because of cases
-18 and 19 --- if you already had the changes in $M (e.g. maybe
+18 and 19 -- if you already had the changes in $M (e.g. maybe
you picked it up via e-mail in a patch form), `git diff-index
--cached $H` would have told you about the change before this
merge, but it would not show in `git diff-index --cached $M`
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 9cb8931c7a..e7b39ad244 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -38,6 +38,13 @@ The current branch is reset to `<upstream>` or `<newbase>` if the
`git reset --hard <upstream>` (or `<newbase>`). `ORIG_HEAD` is set
to point at the tip of the branch before the reset.
+[NOTE]
+`ORIG_HEAD` is not guaranteed to still point to the previous branch tip
+at the end of the rebase if other commands that write that pseudo-ref
+(e.g. `git reset`) are used during the rebase. The previous branch tip,
+however, is accessible using the reflog of the current branch
+(i.e. `@{1}`, see linkgit:gitrevisions[7]).
+
The commits that were previously saved into the temporary area are
then reapplied to the current branch, one by one, in order. Note that
any commits in `HEAD` which introduce the same textual changes as a commit
@@ -201,6 +208,39 @@ Alternatively, you can undo the 'git rebase' with
git rebase --abort
+MODE OPTIONS
+------------
+
+The options in this section cannot be used with any other option,
+including not with each other:
+
+--continue::
+ Restart the rebasing process after having resolved a merge conflict.
+
+--skip::
+ Restart the rebasing process by skipping the current patch.
+
+--abort::
+ Abort the rebase operation and reset HEAD to the original
+ branch. If `<branch>` was provided when the rebase operation was
+ started, then `HEAD` will be reset to `<branch>`. Otherwise `HEAD`
+ will be reset to where it was when the rebase operation was
+ started.
+
+--quit::
+ Abort the rebase operation but `HEAD` is not reset back to the
+ original branch. The index and working tree are also left
+ unchanged as a result. If a temporary stash entry was created
+ using `--autostash`, it will be saved to the stash list.
+
+--edit-todo::
+ Edit the todo list during an interactive rebase.
+
+--show-current-patch::
+ Show the current patch in an interactive rebase or when rebase
+ is stopped because of conflicts. This is the equivalent of
+ `git show REBASE_HEAD`.
+
OPTIONS
-------
--onto <newbase>::
@@ -218,12 +258,14 @@ leave out at most one of A and B, in which case it defaults to HEAD.
merge base of `<upstream>` and `<branch>`. Running
`git rebase --keep-base <upstream> <branch>` is equivalent to
running
- `git rebase --onto <upstream>...<branch> <upstream> <branch>`.
+ `git rebase --reapply-cherry-picks --no-fork-point --onto <upstream>...<branch> <upstream> <branch>`.
+
This option is useful in the case where one is developing a feature on
top of an upstream branch. While the feature is being worked on, the
upstream branch may advance and it may not be the best idea to keep
-rebasing on top of the upstream but to keep the base commit as-is.
+rebasing on top of the upstream but to keep the base commit as-is. As
+the base commit is unchanged this option implies `--reapply-cherry-picks`
+to avoid losing commits.
+
Although both this option and `--fork-point` find the merge base between
`<upstream>` and `<branch>`, this option uses the merge base as the _starting
@@ -240,22 +282,6 @@ See also INCOMPATIBLE OPTIONS below.
<branch>::
Working branch; defaults to `HEAD`.
---continue::
- Restart the rebasing process after having resolved a merge conflict.
-
---abort::
- Abort the rebase operation and reset HEAD to the original
- branch. If `<branch>` was provided when the rebase operation was
- started, then `HEAD` will be reset to `<branch>`. Otherwise `HEAD`
- will be reset to where it was when the rebase operation was
- started.
-
---quit::
- Abort the rebase operation but `HEAD` is not reset back to the
- original branch. The index and working tree are also left
- unchanged as a result. If a temporary stash entry was created
- using `--autostash`, it will be saved to the stash list.
-
--apply::
Use applying strategies to rebase (calling `git-am`
internally). This option may become a no-op in the future
@@ -278,7 +304,8 @@ See also INCOMPATIBLE OPTIONS below.
Note that commits which start empty are kept (unless `--no-keep-empty`
is specified), and commits which are clean cherry-picks (as determined
by `git log --cherry-mark ...`) are detected and dropped as a
-preliminary step (unless `--reapply-cherry-picks` is passed).
+preliminary step (unless `--reapply-cherry-picks` or `--keep-base` is
+passed).
+
See also INCOMPATIBLE OPTIONS below.
@@ -311,13 +338,14 @@ See also INCOMPATIBLE OPTIONS below.
upstream changes, the behavior towards them is controlled by
the `--empty` flag.)
+
-By default (or if `--no-reapply-cherry-picks` is given), these commits
-will be automatically dropped. Because this necessitates reading all
-upstream commits, this can be expensive in repos with a large number
-of upstream commits that need to be read. When using the 'merge'
-backend, warnings will be issued for each dropped commit (unless
-`--quiet` is given). Advice will also be issued unless
-`advice.skippedCherryPicks` is set to false (see linkgit:git-config[1]).
+In the absence of `--keep-base` (or if `--no-reapply-cherry-picks` is
+given), these commits will be automatically dropped. Because this
+necessitates reading all upstream commits, this can be expensive in
+repositories with a large number of upstream commits that need to be
+read. When using the 'merge' backend, warnings will be issued for each
+dropped commit (unless `--quiet` is given). Advice will also be issued
+unless `advice.skippedCherryPicks` is set to false (see
+linkgit:git-config[1]).
+
`--reapply-cherry-picks` allows rebase to forgo reading all upstream
commits, potentially improving performance.
@@ -332,17 +360,6 @@ See also INCOMPATIBLE OPTIONS below.
+
See also INCOMPATIBLE OPTIONS below.
---skip::
- Restart the rebasing process by skipping the current patch.
-
---edit-todo::
- Edit the todo list during an interactive rebase.
-
---show-current-patch::
- Show the current patch in an interactive rebase or when rebase
- is stopped because of conflicts. This is the equivalent of
- `git show REBASE_HEAD`.
-
-m::
--merge::
Using merging strategies to rebase (default).
@@ -443,9 +460,9 @@ When `--fork-point` is active, 'fork_point' will be used instead of
<branch>` command (see linkgit:git-merge-base[1]). If 'fork_point'
ends up being empty, the `<upstream>` will be used as a fallback.
+
-If `<upstream>` is given on the command line, then the default is
-`--no-fork-point`, otherwise the default is `--fork-point`. See also
-`rebase.forkpoint` in linkgit:git-config[1].
+If `<upstream>` or `--keep-base` is given on the command line, then
+the default is `--no-fork-point`, otherwise the default is
+`--fork-point`. See also `rebase.forkpoint` in linkgit:git-config[1].
+
If your branch was based on `<upstream>` but `<upstream>` was rewound and
your branch contains commits which were dropped, this option can be used
@@ -512,20 +529,25 @@ See also INCOMPATIBLE OPTIONS below.
-r::
--rebase-merges[=(rebase-cousins|no-rebase-cousins)]::
+--no-rebase-merges::
By default, a rebase will simply drop merge commits from the todo
list, and put the rebased commits into a single, linear branch.
With `--rebase-merges`, the rebase will instead try to preserve
the branching structure within the commits that are to be rebased,
by recreating the merge commits. Any resolved merge conflicts or
manual amendments in these merge commits will have to be
- resolved/re-applied manually.
+ resolved/re-applied manually. `--no-rebase-merges` can be used to
+ countermand both the `rebase.rebaseMerges` config option and a previous
+ `--rebase-merges`.
+
-By default, or when `no-rebase-cousins` was specified, commits which do not
-have `<upstream>` as direct ancestor will keep their original branch point,
-i.e. commits that would be excluded by linkgit:git-log[1]'s
-`--ancestry-path` option will keep their original ancestry by default. If
-the `rebase-cousins` mode is turned on, such commits are instead rebased
-onto `<upstream>` (or `<onto>`, if specified).
+When rebasing merges, there are two modes: `rebase-cousins` and
+`no-rebase-cousins`. If the mode is not specified, it defaults to
+`no-rebase-cousins`. In `no-rebase-cousins` mode, commits which do not have
+`<upstream>` as direct ancestor will keep their original branch point, i.e.
+commits that would be excluded by linkgit:git-log[1]'s `--ancestry-path`
+option will keep their original ancestry by default. In `rebase-cousins` mode,
+such commits are instead rebased onto `<upstream>` (or `<onto>`, if
+specified).
+
It is currently only possible to recreate the merge commits using the
`ort` merge strategy; different merge strategies can be used only via
@@ -561,10 +583,7 @@ See also INCOMPATIBLE OPTIONS below.
--root::
Rebase all commits reachable from `<branch>`, instead of
limiting them with an `<upstream>`. This allows you to rebase
- the root commit(s) on a branch. When used with `--onto`, it
- will skip changes already contained in `<newbase>` (instead of
- `<upstream>`) whereas without `--onto` it will operate on every
- change.
+ the root commit(s) on a branch.
+
See also INCOMPATIBLE OPTIONS below.
@@ -617,6 +636,8 @@ start would be overridden by the presence of
+
If the configuration variable `rebase.updateRefs` is set, then this option
can be used to override and disable this setting.
++
+See also INCOMPATIBLE OPTIONS below.
INCOMPATIBLE OPTIONS
--------------------
@@ -632,17 +653,15 @@ are incompatible with the following options:
* --merge
* --strategy
* --strategy-option
- * --allow-empty-message
- * --[no-]autosquash
+ * --autosquash
* --rebase-merges
* --interactive
* --exec
* --no-keep-empty
* --empty=
- * --reapply-cherry-picks
- * --edit-todo
+ * --[no-]reapply-cherry-picks when used without --keep-base
* --update-refs
- * --root when used in combination with --onto
+ * --root when used without --onto
In addition, the following pairs of options are incompatible:
diff --git a/Documentation/git-receive-pack.txt b/Documentation/git-receive-pack.txt
index 014a78409b..65ff518ccf 100644
--- a/Documentation/git-receive-pack.txt
+++ b/Documentation/git-receive-pack.txt
@@ -9,7 +9,7 @@ git-receive-pack - Receive what is pushed into the repository
SYNOPSIS
--------
[verse]
-'git-receive-pack' <directory>
+'git receive-pack' <git-dir>
DESCRIPTION
-----------
@@ -38,7 +38,7 @@ its behavior, see linkgit:git-config[1].
OPTIONS
-------
-<directory>::
+<git-dir>::
The repository to sync into.
--http-backend-info-refs::
diff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt
index db9d46edfa..ec64cbff4c 100644
--- a/Documentation/git-reflog.txt
+++ b/Documentation/git-reflog.txt
@@ -9,15 +9,7 @@ git-reflog - Manage reflog information
SYNOPSIS
--------
[verse]
-'git reflog' <subcommand> <options>
-
-DESCRIPTION
------------
-The command takes various subcommands, and different options
-depending on the subcommand:
-
-[verse]
-'git reflog' ['show'] [<log-options>] [<ref>]
+'git reflog' [show] [<log-options>] [<ref>]
'git reflog expire' [--expire=<time>] [--expire-unreachable=<time>]
[--rewrite] [--updateref] [--stale-fix]
[--dry-run | -n] [--verbose] [--all [--single-worktree] | <refs>...]
@@ -25,6 +17,10 @@ depending on the subcommand:
[--dry-run | -n] [--verbose] <ref>@{<specifier>}...
'git reflog exists' <ref>
+DESCRIPTION
+-----------
+This command manages the information recorded in the reflogs.
+
Reference logs, or "reflogs", record when the tips of branches and
other references were updated in the local repository. Reflogs are
useful in various Git commands, to specify the old value of a
@@ -33,7 +29,8 @@ moves ago", `master@{one.week.ago}` means "where master used to point
to one week ago in this local repository", and so on. See
linkgit:gitrevisions[7] for more details.
-This command manages the information recorded in the reflogs.
+The command takes various subcommands, and different options
+depending on the subcommand:
The "show" subcommand (which is also the default, in the absence of
any subcommands) shows the log of the reference provided in the
diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt
index 0bf13893d8..4017157949 100644
--- a/Documentation/git-repack.txt
+++ b/Documentation/git-repack.txt
@@ -74,6 +74,12 @@ to the new separate pack will be written.
immediately instead of waiting for the next `git gc` invocation.
Only useful with `--cruft -d`.
+--expire-to=<dir>::
+ Write a cruft pack containing pruned objects (if any) to the
+ directory `<dir>`. This option is useful for keeping a copy of
+ any pruned objects in a separate directory as a backup. Only
+ useful with `--cruft -d`.
+
-l::
Pass the `--local` option to 'git pack-objects'. See
linkgit:git-pack-objects[1].
diff --git a/Documentation/git-rerere.txt b/Documentation/git-rerere.txt
index 4cfc883378..992b469270 100644
--- a/Documentation/git-rerere.txt
+++ b/Documentation/git-rerere.txt
@@ -8,7 +8,7 @@ git-rerere - Reuse recorded resolution of conflicted merges
SYNOPSIS
--------
[verse]
-'git rerere' ['clear'|'forget' <pathspec>|'diff'|'remaining'|'status'|'gc']
+'git rerere' [clear | forget <pathspec>... | diff | status | remaining | gc]
DESCRIPTION
-----------
diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt
index 01cb4c9b9c..79ad5643ee 100644
--- a/Documentation/git-reset.txt
+++ b/Documentation/git-reset.txt
@@ -49,7 +49,8 @@ section of linkgit:git-add[1] to learn how to operate the `--patch` mode.
'git reset' [<mode>] [<commit>]::
This form resets the current branch head to `<commit>` and
possibly updates the index (resetting it to the tree of `<commit>`) and
- the working tree depending on `<mode>`. If `<mode>` is omitted,
+ the working tree depending on `<mode>`. Before the operation, `ORIG_HEAD`
+ is set to the tip of the current branch. If `<mode>` is omitted,
defaults to `--mixed`. The `<mode>` must be one of the following:
+
--
diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index 20bb8e8217..51029a2271 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -9,7 +9,7 @@ git-rev-list - Lists commit objects in reverse chronological order
SYNOPSIS
--------
[verse]
-'git rev-list' [<options>] <commit>... [[--] <path>...]
+'git rev-list' [<options>] <commit>... [--] [<path>...]
DESCRIPTION
-----------
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 6b8ca085aa..f26a7591e3 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -197,6 +197,14 @@ respectively, and they must begin with `refs/` when applied to `--glob`
or `--all`. If a trailing '/{asterisk}' is intended, it must be given
explicitly.
+--exclude-hidden=[fetch|receive|uploadpack]::
+ Do not include refs that would be hidden by `git-fetch`,
+ `git-receive-pack` or `git-upload-pack` by consulting the appropriate
+ `fetch.hideRefs`, `receive.hideRefs` or `uploadpack.hideRefs`
+ configuration along with `transfer.hideRefs` (see
+ linkgit:git-config[1]). This option affects the next pseudo-ref option
+ `--all` or `--glob` and is cleared after processing them.
+
--disambiguate=<prefix>::
Show every object whose name begins with the given prefix.
The <prefix> must be at least 4 hexadecimal digits long to
diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
index 5016755efb..d2e10d3dce 100644
--- a/Documentation/git-revert.txt
+++ b/Documentation/git-revert.txt
@@ -8,7 +8,7 @@ git-revert - Revert some existing commits
SYNOPSIS
--------
[verse]
-'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>...
+'git revert' [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] <commit>...
'git revert' (--continue | --skip | --abort | --quit)
DESCRIPTION
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 3290043053..492a82323d 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -93,7 +93,7 @@ See the CONFIGURATION section for `sendemail.multiEdit`.
--in-reply-to=<identifier>::
Make the first mail (or all the mails with `--no-thread`) appear as a
- reply to the given Message-Id, which avoids breaking threads to
+ reply to the given Message-ID, which avoids breaking threads to
provide a new patch series.
The second and subsequent emails will be sent as replies according to
the `--[no-]chain-reply-to` setting.
@@ -178,9 +178,18 @@ Sending
for `sendmail` in `/usr/sbin`, `/usr/lib` and $PATH.
--smtp-encryption=<encryption>::
- Specify the encryption to use, either 'ssl' or 'tls'. Any other
- value reverts to plain SMTP. Default is the value of
- `sendemail.smtpEncryption`.
+ Specify in what way encrypting begins for the SMTP connection.
+ Valid values are 'ssl' and 'tls'. Any other value reverts to plain
+ (unencrypted) SMTP, which defaults to port 25.
+ Despite the names, both values will use the same newer version of TLS,
+ but for historic reasons have these names. 'ssl' refers to "implicit"
+ encryption (sometimes called SMTPS), that uses port 465 by default.
+ 'tls' refers to "explicit" encryption (often known as STARTTLS),
+ that uses port 25 by default. Other ports might be used by the SMTP
+ server, which are not the default. Commonly found alternative port for
+ 'tls' and unencrypted is 587. You need to check your provider's
+ documentation or your server configuration to make sure
+ for your own case. Default is the value of `sendemail.smtpEncryption`.
--smtp-domain=<FQDN>::
Specifies the Fully Qualified Domain Name (FQDN) used in the
@@ -311,6 +320,17 @@ Automating
Output of this command must be single email address per line.
Default is the value of `sendemail.ccCmd` configuration value.
+--header-cmd=<command>::
+ Specify a command that is executed once per outgoing message
+ and output RFC 2822 style header lines to be inserted into
+ them. When the `sendemail.headerCmd` configuration variable is
+ set, its value is always used. When --header-cmd is provided
+ at the command line, its value takes precedence over the
+ `sendemail.headerCmd` configuration variable.
+
+--no-header-cmd::
+ Disable any header command in use.
+
--[no-]chain-reply-to::
If this is set, each email will be sent as a reply to the previous
email sent. If disabled with "--no-chain-reply-to", all emails after
@@ -475,14 +495,10 @@ edit ~/.gitconfig to specify your account settings:
smtpServerPort = 587
----
-If you have multi-factor authentication set up on your Gmail account, you will
-need to generate an app-specific password for use with 'git send-email'. Visit
+If you have multi-factor authentication set up on your Gmail account, you can
+generate an app-specific password for use with 'git send-email'. Visit
https://security.google.com/settings/security/apppasswords to create it.
-If you do not have multi-factor authentication set up on your Gmail account,
-you will need to allow less secure app access. Visit
-https://myaccount.google.com/lesssecureapps to enable it.
-
Once your commits are ready to be sent to the mailing list, run the
following commands:
diff --git a/Documentation/git-send-pack.txt b/Documentation/git-send-pack.txt
index be41f11974..595b002152 100644
--- a/Documentation/git-send-pack.txt
+++ b/Documentation/git-send-pack.txt
@@ -9,9 +9,10 @@ git-send-pack - Push objects over Git protocol to another repository
SYNOPSIS
--------
[verse]
-'git send-pack' [--dry-run] [--force] [--receive-pack=<git-receive-pack>]
+'git send-pack' [--mirror] [--dry-run] [--force]
+ [--receive-pack=<git-receive-pack>]
[--verbose] [--thin] [--atomic]
- [--[no-]signed|--signed=(true|false|if-asked)]
+ [--[no-]signed | --signed=(true|false|if-asked)]
[<host>:]<directory> (--all | <ref>...)
DESCRIPTION
diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt
index f64e77047b..7d0277d033 100644
--- a/Documentation/git-shortlog.txt
+++ b/Documentation/git-shortlog.txt
@@ -47,6 +47,11 @@ OPTIONS
Each pretty-printed commit will be rewrapped before it is shown.
+--date=<format>::
+ Show dates formatted according to the given date string. (See
+ the `--date` option in the "Commit Formatting" section of
+ linkgit:git-log[1]). Useful with `--group=format:<format>`.
+
--group=<type>::
Group commits based on `<type>`. If no `--group` option is
specified, the default is `author`. `<type>` is one of:
@@ -59,6 +64,9 @@ OPTIONS
example, if your project uses `Reviewed-by` trailers, you might want
to see who has been reviewing with
`git shortlog -ns --group=trailer:reviewed-by`.
+ - `format:<format>`, any string accepted by the `--format` option of
+ 'git log'. (See the "PRETTY FORMATS" section of
+ linkgit:git-log[1].)
+
Note that commits that do not include the trailer will not be counted.
Likewise, commits with multiple trailers (e.g., multiple signoffs) may
diff --git a/Documentation/git-show-branch.txt b/Documentation/git-show-branch.txt
index e5ec6b467f..71f608b1ff 100644
--- a/Documentation/git-show-branch.txt
+++ b/Documentation/git-show-branch.txt
@@ -8,12 +8,12 @@ git-show-branch - Show branches and their commits
SYNOPSIS
--------
[verse]
-'git show-branch' [-a|--all] [-r|--remotes] [--topo-order | --date-order]
+'git show-branch' [-a | --all] [-r | --remotes] [--topo-order | --date-order]
[--current] [--color[=<when>] | --no-color] [--sparse]
[--more=<n> | --list | --independent | --merge-base]
[--no-name | --sha1-name] [--topics]
[(<rev> | <glob>)...]
-'git show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] [<ref>]
+'git show-branch' (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]
DESCRIPTION
-----------
diff --git a/Documentation/git-show-ref.txt b/Documentation/git-show-ref.txt
index ab4d271925..d1d56f68b4 100644
--- a/Documentation/git-show-ref.txt
+++ b/Documentation/git-show-ref.txt
@@ -8,8 +8,8 @@ git-show-ref - List references in a local repository
SYNOPSIS
--------
[verse]
-'git show-ref' [-q|--quiet] [--verify] [--head] [-d|--dereference]
- [-s|--hash[=<n>]] [--abbrev[=<n>]] [--tags]
+'git show-ref' [-q | --quiet] [--verify] [--head] [-d | --dereference]
+ [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]
[--heads] [--] [<pattern>...]
'git show-ref' --exclude-existing[=<pattern>]
diff --git a/Documentation/git-sparse-checkout.txt b/Documentation/git-sparse-checkout.txt
index 3776705bf5..53dc17aa77 100644
--- a/Documentation/git-sparse-checkout.txt
+++ b/Documentation/git-sparse-checkout.txt
@@ -9,7 +9,7 @@ git-sparse-checkout - Reduce your working tree to a subset of tracked files
SYNOPSIS
--------
[verse]
-'git sparse-checkout <subcommand> [<options>]'
+'git sparse-checkout' (init | list | set | add | reapply | disable | check-rules) [<options>]
DESCRIPTION
@@ -135,6 +135,29 @@ paths to pass to a subsequent 'set' or 'add' command. However,
the disable command, so the easy restore of calling a plain `init`
decreased in utility.
+'check-rules'::
+ Check whether sparsity rules match one or more paths.
++
+By default `check-rules` reads a list of paths from stdin and outputs only
+the ones that match the current sparsity rules. The input is expected to consist
+of one path per line, matching the output of `git ls-tree --name-only` including
+that pathnames that begin with a double quote (") are interpreted as C-style
+quoted strings.
++
+When called with the `--rules-file <file>` flag the input files are matched
+against the sparse checkout rules found in `<file>` instead of the current ones.
+The rules in the files are expected to be in the same form as accepted by `git
+sparse-checkout set --stdin` (in particular, they must be newline-delimited).
++
+By default, the rules passed to the `--rules-file` option are interpreted as
+cone mode directories. To pass non-cone mode patterns with `--rules-file`,
+combine the option with the `--no-cone` option.
++
+When called with the `-z` flag, the format of the paths input on stdin as well
+as the output paths are \0 terminated and not quoted. Note that this does not
+apply to the format of the rules passed with the `--rules-file` option.
+
+
EXAMPLES
--------
`git sparse-checkout set MY/DIR1 SUB/DIR2`::
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index c5d7091828..f4bb6114d9 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -9,17 +9,20 @@ SYNOPSIS
--------
[verse]
'git stash' list [<log-options>]
-'git stash' show [-u|--include-untracked|--only-untracked] [<diff-options>] [<stash>]
-'git stash' drop [-q|--quiet] [<stash>]
-'git stash' ( pop | apply ) [--index] [-q|--quiet] [<stash>]
+'git stash' show [-u | --include-untracked | --only-untracked] [<diff-options>] [<stash>]
+'git stash' drop [-q | --quiet] [<stash>]
+'git stash' pop [--index] [-q | --quiet] [<stash>]
+'git stash' apply [--index] [-q | --quiet] [<stash>]
'git stash' branch <branchname> [<stash>]
-'git stash' [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--quiet]
- [-u|--include-untracked] [-a|--all] [-m|--message <message>]
+'git stash' [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
+ [-u | --include-untracked] [-a | --all] [(-m | --message) <message>]
[--pathspec-from-file=<file> [--pathspec-file-nul]]
[--] [<pathspec>...]]
+'git stash' save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]
+ [-u | --include-untracked] [-a | --all] [<message>]
'git stash' clear
'git stash' create [<message>]
-'git stash' store [-m|--message <message>] [-q|--quiet] <commit>
+'git stash' store [(-m | --message) <message>] [-q | --quiet] <commit>
DESCRIPTION
-----------
@@ -47,7 +50,7 @@ stash index (e.g. the integer `n` is equivalent to `stash@{n}`).
COMMANDS
--------
-push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [-m|--message <message>] [--pathspec-from-file=<file> [--pathspec-file-nul]] [--] [<pathspec>...]::
+push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [(-m|--message) <message>] [--pathspec-from-file=<file> [--pathspec-file-nul]] [--] [<pathspec>...]::
Save your local modifications to a new 'stash entry' and roll them
back to HEAD (in the working tree and in the index).
diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index 54a4b29b47..a051b1e8f3 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -9,7 +9,7 @@ git-status - Show the working tree status
SYNOPSIS
--------
[verse]
-'git status' [<options>...] [--] [<pathspec>...]
+'git status' [<options>] [--] [<pathspec>...]
DESCRIPTION
-----------
@@ -457,6 +457,66 @@ during the write may conflict with other simultaneous processes, causing
them to fail. Scripts running `status` in the background should consider
using `git --no-optional-locks status` (see linkgit:git[1] for details).
+UNTRACKED FILES AND PERFORMANCE
+-------------------------------
+
+`git status` can be very slow in large worktrees if/when it
+needs to search for untracked files and directories. There are
+many configuration options available to speed this up by either
+avoiding the work or making use of cached results from previous
+Git commands. There is no single optimum set of settings right
+for everyone. We'll list a summary of the relevant options to help
+you, but before going into the list, you may want to run `git status`
+again, because your configuration may already be caching `git status`
+results, so it could be faster on subsequent runs.
+
+* The `--untracked-files=no` flag or the
+ `status.showUntrackedfiles=false` config (see above for both):
+ indicate that `git status` should not report untracked
+ files. This is the fastest option. `git status` will not list
+ the untracked files, so you need to be careful to remember if
+ you create any new files and manually `git add` them.
+
+* `advice.statusUoption=false` (see linkgit:git-config[1]):
+ setting this variable to `false` disables the warning message
+ given when enumerating untracked files takes more than 2
+ seconds. In a large project, it may take longer and the user
+ may have already accepted the trade off (e.g. using "-uno" may
+ not be an acceptable option for the user), in which case, there
+ is no point issuing the warning message, and in such a case,
+ disabling the warning may be the best.
+
+* `core.untrackedCache=true` (see linkgit:git-update-index[1]):
+ enable the untracked cache feature and only search directories
+ that have been modified since the previous `git status` command.
+ Git remembers the set of untracked files within each directory
+ and assumes that if a directory has not been modified, then
+ the set of untracked files within has not changed. This is much
+ faster than enumerating the contents of every directory, but still
+ not without cost, because Git still has to search for the set of
+ modified directories. The untracked cache is stored in the
+ `.git/index` file. The reduced cost of searching for untracked
+ files is offset slightly by the increased size of the index and
+ the cost of keeping it up-to-date. That reduced search time is
+ usually worth the additional size.
+
+* `core.untrackedCache=true` and `core.fsmonitor=true` or
+ `core.fsmonitor=<hook_command_pathname>` (see
+ linkgit:git-update-index[1]): enable both the untracked cache
+ and FSMonitor features and only search directories that have
+ been modified since the previous `git status` command. This
+ is faster than using just the untracked cache alone because
+ Git can also avoid searching for modified directories. Git
+ only has to enumerate the exact set of directories that have
+ changed recently. While the FSMonitor feature can be enabled
+ without the untracked cache, the benefits are greatly reduced
+ in that case.
+
+Note that after you turn on the untracked cache and/or FSMonitor
+features it may take a few `git status` commands for the various
+caches to warm up before you see improved command times. This is
+normal.
+
SEE ALSO
--------
linkgit:gitignore[5]
diff --git a/Documentation/git-symbolic-ref.txt b/Documentation/git-symbolic-ref.txt
index ef68ad2b71..102c83eb19 100644
--- a/Documentation/git-symbolic-ref.txt
+++ b/Documentation/git-symbolic-ref.txt
@@ -9,7 +9,7 @@ SYNOPSIS
--------
[verse]
'git symbolic-ref' [-m <reason>] <name> <ref>
-'git symbolic-ref' [-q] [--short] <name>
+'git symbolic-ref' [-q] [--short] [--no-recurse] <name>
'git symbolic-ref' --delete [-q] <name>
DESCRIPTION
@@ -46,6 +46,15 @@ OPTIONS
When showing the value of <name> as a symbolic ref, try to shorten the
value, e.g. from `refs/heads/master` to `master`.
+--recurse::
+--no-recurse::
+ When showing the value of <name> as a symbolic ref, if
+ <name> refers to another symbolic ref, follow such a chain
+ of symbolic refs until the result no longer points at a
+ symbolic ref (`--recurse`, which is the default).
+ `--no-recurse` stops after dereferencing only a single level
+ of symbolic ref.
+
-m::
Update the reflog for <name> with <reason>. This is valid only
when creating or updating a symbolic ref.
diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt
index 31a97a1b6c..7f61c1edb3 100644
--- a/Documentation/git-tag.txt
+++ b/Documentation/git-tag.txt
@@ -9,7 +9,7 @@ git-tag - Create, list, delete or verify a tag object signed with GPG
SYNOPSIS
--------
[verse]
-'git tag' [-a | -s | -u <keyid>] [-f] [-m <msg> | -F <file>] [-e]
+'git tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]
<tagname> [<commit> | <object>]
'git tag' -d <tagname>...
'git tag' [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]
@@ -26,19 +26,19 @@ to delete, list or verify tags.
Unless `-f` is given, the named tag must not yet exist.
-If one of `-a`, `-s`, or `-u <keyid>` is passed, the command
+If one of `-a`, `-s`, or `-u <key-id>` is passed, the command
creates a 'tag' object, and requires a tag message. Unless
`-m <msg>` or `-F <file>` is given, an editor is started for the user to type
in the tag message.
-If `-m <msg>` or `-F <file>` is given and `-a`, `-s`, and `-u <keyid>`
+If `-m <msg>` or `-F <file>` is given and `-a`, `-s`, and `-u <key-id>`
are absent, `-a` is implied.
Otherwise, a tag reference that points directly at the given object
(i.e., a lightweight tag) is created.
A GnuPG signed tag object will be created when `-s` or `-u
-<keyid>` is used. When `-u <keyid>` is not used, the
+<key-id>` is used. When `-u <key-id>` is not used, the
committer identity for the current user is used to find the
GnuPG key for signing. The configuration variable `gpg.program`
is used to specify custom GnuPG binary.
@@ -72,8 +72,8 @@ OPTIONS
Override `tag.gpgSign` configuration variable that is
set to force each and every tag to be signed.
--u <keyid>::
---local-user=<keyid>::
+-u <key-id>::
+--local-user=<key-id>::
Make a GPG-signed tag, using the given key.
-f::
@@ -131,6 +131,10 @@ options for details.
--ignore-case::
Sorting and filtering tags are case insensitive.
+--omit-empty::
+ Do not print a newline after formatted refs where the format expands
+ to the empty string.
+
--column[=<options>]::
--no-column::
Display tag listing in columns. See configuration variable
@@ -164,14 +168,14 @@ This option is only applicable when listing tags without annotation lines.
Use the given tag message (instead of prompting).
If multiple `-m` options are given, their values are
concatenated as separate paragraphs.
- Implies `-a` if none of `-a`, `-s`, or `-u <keyid>`
+ Implies `-a` if none of `-a`, `-s`, or `-u <key-id>`
is given.
-F <file>::
--file=<file>::
Take the tag message from the given file. Use '-' to
read the message from the standard input.
- Implies `-a` if none of `-a`, `-s`, or `-u <keyid>`
+ Implies `-a` if none of `-a`, `-s`, or `-u <key-id>`
is given.
-e::
@@ -220,7 +224,7 @@ it in the repository configuration as follows:
-------------------------------------
[user]
- signingKey = <gpg-keyid>
+ signingKey = <gpg-key_id>
-------------------------------------
`pager.tag` is only respected when listing tags, i.e., when `-l` is
diff --git a/Documentation/git-update-server-info.txt b/Documentation/git-update-server-info.txt
index 969bb2e15f..17e429dbd0 100644
--- a/Documentation/git-update-server-info.txt
+++ b/Documentation/git-update-server-info.txt
@@ -9,7 +9,7 @@ git-update-server-info - Update auxiliary info file to help dumb servers
SYNOPSIS
--------
[verse]
-'git update-server-info'
+'git update-server-info' [-f | --force]
DESCRIPTION
-----------
@@ -19,6 +19,12 @@ $GIT_OBJECT_DIRECTORY/info directories to help clients discover
what references and packs the server has. This command
generates such auxiliary files.
+OPTIONS
+-------
+-f::
+--force::
+ update the info files from scratch.
+
OUTPUT
------
diff --git a/Documentation/git-upload-archive.txt b/Documentation/git-upload-archive.txt
index fba0f1c1b2..e8eb10baad 100644
--- a/Documentation/git-upload-archive.txt
+++ b/Documentation/git-upload-archive.txt
@@ -9,7 +9,7 @@ git-upload-archive - Send archive back to git-archive
SYNOPSIS
--------
[verse]
-'git upload-archive' <directory>
+'git upload-archive' <repository>
DESCRIPTION
-----------
@@ -54,7 +54,7 @@ access via non-smart-http.
OPTIONS
-------
-<directory>::
+<repository>::
The repository to get a tar archive from.
GIT
diff --git a/Documentation/git-var.txt b/Documentation/git-var.txt
index 387cc1b914..f40202b8e3 100644
--- a/Documentation/git-var.txt
+++ b/Documentation/git-var.txt
@@ -9,11 +9,12 @@ git-var - Show a Git logical variable
SYNOPSIS
--------
[verse]
-'git var' ( -l | <variable> )
+'git var' (-l | <variable>)
DESCRIPTION
-----------
-Prints a Git logical variable.
+Prints a Git logical variable. Exits with code 1 if the variable has
+no value.
OPTIONS
-------
@@ -49,6 +50,14 @@ ifdef::git-default-editor[]
The build you are using chose '{git-default-editor}' as the default.
endif::git-default-editor[]
+GIT_SEQUENCE_EDITOR::
+ Text editor used to edit the 'todo' file while running `git rebase
+ -i`. Like `GIT_EDITOR`, the value is meant to be interpreted by
+ the shell when it is used. The order of preference is the
+ `$GIT_SEQUENCE_EDITOR` environment variable, then
+ `sequence.editor` configuration, and then the value of `git var
+ GIT_EDITOR`.
+
GIT_PAGER::
Text viewer for use by Git commands (e.g., 'less'). The value
is meant to be interpreted by the shell. The order of preference
diff --git a/Documentation/git-verify-commit.txt b/Documentation/git-verify-commit.txt
index 92097f6673..aee4c40eac 100644
--- a/Documentation/git-verify-commit.txt
+++ b/Documentation/git-verify-commit.txt
@@ -8,7 +8,7 @@ git-verify-commit - Check the GPG signature of commits
SYNOPSIS
--------
[verse]
-'git verify-commit' <commit>...
+'git verify-commit' [-v | --verbose] [--raw] <commit>...
DESCRIPTION
-----------
diff --git a/Documentation/git-verify-pack.txt b/Documentation/git-verify-pack.txt
index 61ca6d04c2..b8720dce8a 100644
--- a/Documentation/git-verify-pack.txt
+++ b/Documentation/git-verify-pack.txt
@@ -9,7 +9,7 @@ git-verify-pack - Validate packed Git archive files
SYNOPSIS
--------
[verse]
-'git verify-pack' [-v|--verbose] [-s|--stat-only] [--] <pack>.idx ...
+'git verify-pack' [-v | --verbose] [-s | --stat-only] [--] <pack>.idx...
DESCRIPTION
diff --git a/Documentation/git-verify-tag.txt b/Documentation/git-verify-tag.txt
index 0b8075dad9..81d50ecc4c 100644
--- a/Documentation/git-verify-tag.txt
+++ b/Documentation/git-verify-tag.txt
@@ -8,7 +8,7 @@ git-verify-tag - Check the GPG signature of tags
SYNOPSIS
--------
[verse]
-'git verify-tag' [--format=<format>] <tag>...
+'git verify-tag' [-v | --verbose] [--format=<format>] [--raw] <tag>...
DESCRIPTION
-----------
diff --git a/Documentation/git-worktree.txt b/Documentation/git-worktree.txt
index ada30c86a7..063d6eeb99 100644
--- a/Documentation/git-worktree.txt
+++ b/Documentation/git-worktree.txt
@@ -9,7 +9,8 @@ git-worktree - Manage multiple working trees
SYNOPSIS
--------
[verse]
-'git worktree add' [-f] [--detach] [--checkout] [--lock [--reason <string>]] [-b <new-branch>] <path> [<commit-ish>]
+'git worktree add' [-f] [--detach] [--checkout] [--lock [--reason <string>]]
+ [-b <new-branch>] <path> [<commit-ish>]
'git worktree list' [-v | --porcelain [-z]]
'git worktree lock' [--reason <string>] <worktree>
'git worktree move' <worktree> <new-path>
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 1d33e083ab..54b043899f 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -13,8 +13,7 @@ SYNOPSIS
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
- [--super-prefix=<path>] [--config-env=<name>=<envvar>]
- <command> [<args>]
+ [--config-env=<name>=<envvar>] <command> [<args>]
DESCRIPTION
-----------
@@ -169,11 +168,6 @@ If you just want to run git as if it was started in `<path>` then use
details. Equivalent to setting the `GIT_NAMESPACE` environment
variable.
---super-prefix=<path>::
- Currently for internal use only. Set a prefix which gives a path from
- above a repository down to its root. One use is to give submodules
- context about the superproject that invoked it.
-
--bare::
Treat the repository as a bare repository. If GIT_DIR
environment is not set, it is set to the current working
@@ -552,9 +546,9 @@ double-quotes and respecting backslash escapes. E.g., the value
`GIT_DEFAULT_HASH`::
If this variable is set, the default hash algorithm for new
- repositories will be set to this value. This value is currently
- ignored when cloning; the setting of the remote repository
- is used instead. The default is "sha1". THIS VARIABLE IS
+ repositories will be set to this value. This value is
+ ignored when cloning and the setting of the remote repository
+ is always used. The default is "sha1". THIS VARIABLE IS
EXPERIMENTAL! See `--object-format` in linkgit:git-init[1].
Git Commits
@@ -619,7 +613,7 @@ The file parameters can point at the user's working file
(e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file`
when a new file is added), or a temporary file (e.g. `old-file` in the
index). `GIT_EXTERNAL_DIFF` should not worry about unlinking the
-temporary file --- it is removed when `GIT_EXTERNAL_DIFF` exits.
+temporary file -- it is removed when `GIT_EXTERNAL_DIFF` exits.
+
For a path that is unmerged, `GIT_EXTERNAL_DIFF` is called with 1
parameter, <path>.
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index 4b36d51beb..02a3ec83e4 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -120,20 +120,19 @@ repository upon 'git add' and 'git commit'.
`text`
^^^^^^
-This attribute enables and controls end-of-line normalization. When a
-text file is normalized, its line endings are converted to LF in the
-repository. To control what line ending style is used in the working
-directory, use the `eol` attribute for a single file and the
-`core.eol` configuration variable for all text files.
-Note that setting `core.autocrlf` to `true` or `input` overrides
-`core.eol` (see the definitions of those options in
-linkgit:git-config[1]).
+This attribute marks the path as a text file, which enables end-of-line
+conversion: When a matching file is added to the index, the file's line
+endings are normalized to LF in the index. Conversely, when the file is
+copied from the index to the working directory, its line endings may be
+converted from LF to CRLF depending on the `eol` attribute, the Git
+config, and the platform (see explanation of `eol` below).
Set::
Setting the `text` attribute on a path enables end-of-line
- normalization and marks the path as a text file. End-of-line
- conversion takes place without guessing the content type.
+ conversion on checkin and checkout as described above. Line endings
+ are normalized to LF in the index every time the file is checked in,
+ even if the file was previously added to Git with CRLF line endings.
Unset::
@@ -142,10 +141,11 @@ Unset::
Set to string value "auto"::
- When `text` is set to "auto", the path is marked for automatic
- end-of-line conversion. If Git decides that the content is
- text, its line endings are converted to LF on checkin.
- When the file has been committed with CRLF, no conversion is done.
+ When `text` is set to "auto", Git decides by itself whether the file
+ is text or binary. If it is text and the file was not already in
+ Git with CRLF endings, line endings are converted on checkin and
+ checkout as described above. Otherwise, no conversion is done on
+ checkin or checkout.
Unspecified::
@@ -159,26 +159,29 @@ unspecified.
`eol`
^^^^^
-This attribute sets a specific line-ending style to be used in the
-working directory. This attribute has effect only if the `text`
-attribute is set or unspecified, or if it is set to `auto`, the file is
-detected as text, and it is stored with LF endings in the index. Note
-that setting this attribute on paths which are in the index with CRLF
-line endings may make the paths to be considered dirty unless
-`text=auto` is set. Adding the path to the index again will normalize
-the line endings in the index.
+This attribute marks a path to use a specific line-ending style in the
+working tree when it is checked out. It has effect only if `text` or
+`text=auto` is set (see above), but specifying `eol` automatically sets
+`text` if `text` was left unspecified.
Set to string value "crlf"::
- This setting forces Git to normalize line endings for this
- file on checkin and convert them to CRLF when the file is
- checked out.
+ This setting converts the file's line endings in the working
+ directory to CRLF when the file is checked out.
Set to string value "lf"::
- This setting forces Git to normalize line endings to LF on
- checkin and prevents conversion to CRLF when the file is
- checked out.
+ This setting uses the same line endings in the working directory as
+ in the index when the file is checked out.
+
+Unspecified::
+
+ If the `eol` attribute is unspecified for a file, its line endings
+ in the working directory are determined by the `core.autocrlf` or
+ `core.eol` configuration variable (see the definitions of those
+ options in linkgit:git-config[1]). If `text` is set but neither of
+ those variables is, the default is `eol=crlf` on Windows and
+ `eol=lf` on all other platforms.
Backwards compatibility with `crlf` attribute
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -758,6 +761,37 @@ with the above configuration, i.e. `j-c-diff`, with 7
parameters, just like `GIT_EXTERNAL_DIFF` program is called.
See linkgit:git[1] for details.
+Setting the internal diff algorithm
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The diff algorithm can be set through the `diff.algorithm` config key, but
+sometimes it may be helpful to set the diff algorithm per path. For example,
+one may want to use the `minimal` diff algorithm for .json files, and the
+`histogram` for .c files, and so on without having to pass in the algorithm
+through the command line each time.
+
+First, in `.gitattributes`, assign the `diff` attribute for paths.
+
+------------------------
+*.json diff=<name>
+------------------------
+
+Then, define a "diff.<name>.algorithm" configuration to specify the diff
+algorithm, choosing from `myers`, `patience`, `minimal`, or `histogram`.
+
+----------------------------------------------------------------
+[diff "<name>"]
+ algorithm = histogram
+----------------------------------------------------------------
+
+This diff algorithm applies to user facing diff output like git-diff(1),
+git-show(1) and is used for the `--stat` output as well. The merge machinery
+will not use the diff algorithm set through this method.
+
+NOTE: If `diff.<name>.command` is defined for path with the
+`diff=<name>` attribute, it is executed as an external diff driver
+(see above), and adding `diff.<name>.algorithm` has no effect, as the
+algorithm is not passed to the external diff driver.
Defining a custom hunk-header
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1155,7 +1189,7 @@ Unspecified::
String::
- Specify a comma separate list of common whitespace problems to
+ Specify a comma separated list of common whitespace problems to
notice in the same format as the `core.whitespace` configuration
variable.
diff --git a/Documentation/gitcredentials.txt b/Documentation/gitcredentials.txt
index 80517b4eb2..100f045bb1 100644
--- a/Documentation/gitcredentials.txt
+++ b/Documentation/gitcredentials.txt
@@ -17,9 +17,10 @@ DESCRIPTION
Git will sometimes need credentials from the user in order to perform
operations; for example, it may need to ask for a username and password
-in order to access a remote repository over HTTP. This manual describes
-the mechanisms Git uses to request these credentials, as well as some
-features to avoid inputting these credentials repeatedly.
+in order to access a remote repository over HTTP. Some remotes accept
+a personal access token or OAuth access token as a password. This
+manual describes the mechanisms Git uses to request these credentials,
+as well as some features to avoid inputting these credentials repeatedly.
REQUESTING CREDENTIALS
----------------------
@@ -61,7 +62,9 @@ for a password. It is generally configured by adding this to your config:
Credential helpers, on the other hand, are external programs from which Git can
request both usernames and passwords; they typically interface with secure
-storage provided by the OS or other programs.
+storage provided by the OS or other programs. Alternatively, a
+credential-generating helper might generate credentials for certain servers via
+some API.
To use a helper, you must first select one to use. Git currently
includes the following helpers:
@@ -164,7 +167,7 @@ helper::
If there are multiple instances of the `credential.helper` configuration
variable, each helper will be tried in turn, and may provide a username,
password, or nothing. Once Git has acquired both a username and a
-password, no more helpers will be tried.
+non-expired password, no more helpers will be tried.
+
If `credential.helper` is configured to the empty string, this resets
the helper list to empty (so you may override a helper set by a
@@ -269,6 +272,7 @@ stdout in the same format (see linkgit:git-credential[1] for common
attributes). A helper is free to produce a subset, or even no values at
all if it has nothing useful to provide. Any provided attributes will
overwrite those already known about by Git's credential subsystem.
+Unrecognised attributes are silently discarded.
While it is possible to override all attributes, well behaving helpers
should refrain from doing so for any attribute other than username and
@@ -286,8 +290,8 @@ For a `store` or `erase` operation, the helper's output is ignored.
If a helper fails to perform the requested operation or needs to notify
the user of a potential issue, it may write to stderr.
-If it does not support the requested operation (e.g., a read-only store),
-it should silently ignore the request.
+If it does not support the requested operation (e.g., a read-only store
+or generator), it should silently ignore the request.
If a helper receives any other operation, it should silently ignore the
request. This leaves room for future operations to be added (older
diff --git a/Documentation/gitformat-commit-graph.txt b/Documentation/gitformat-commit-graph.txt
index 7324665716..31cad585e2 100644
--- a/Documentation/gitformat-commit-graph.txt
+++ b/Documentation/gitformat-commit-graph.txt
@@ -3,7 +3,7 @@ gitformat-commit-graph(5)
NAME
----
-gitformat-commit-graph - Git commit graph format
+gitformat-commit-graph - Git commit-graph format
SYNOPSIS
--------
@@ -14,7 +14,7 @@ $GIT_DIR/objects/info/commit-graphs/*
DESCRIPTION
-----------
-The Git commit graph stores a list of commit OIDs and some associated
+The Git commit-graph stores a list of commit OIDs and some associated
metadata, including:
- The generation number of the commit.
@@ -34,7 +34,7 @@ corresponding to the array position within the list of commit OIDs. Due
to some special constants we use to track parents, we can store at most
(1 << 30) + (1 << 29) + (1 << 28) - 1 (around 1.8 billion) commits.
-== Commit graph files have the following format:
+== Commit-graph files have the following format:
In order to allow extensions that add extra data to the graph, we organize
the body into "chunks" and provide a binary lookup table at the beginning
diff --git a/Documentation/gitformat-index.txt b/Documentation/gitformat-index.txt
index 015cb21bdc..0773e5c380 100644
--- a/Documentation/gitformat-index.txt
+++ b/Documentation/gitformat-index.txt
@@ -83,11 +83,13 @@ Git index format
32-bit mode, split into (high to low bits)
+ 16-bit unused, must be zero
+
4-bit object type
valid values in binary are 1000 (regular file), 1010 (symbolic link)
and 1110 (gitlink)
- 3-bit unused
+ 3-bit unused, must be zero
9-bit unix permission. Only 0755 and 0644 are valid for regular files.
Symbolic links and gitlinks have value 0 in this field.
diff --git a/Documentation/gitformat-pack.txt b/Documentation/gitformat-pack.txt
index e06af02f21..0c1be2dbe8 100644
--- a/Documentation/gitformat-pack.txt
+++ b/Documentation/gitformat-pack.txt
@@ -611,8 +611,8 @@ result of repeatedly resetting the objects' mtimes to the present time.
If you are GC-ing repositories in a mixed version environment, consider omitting
the `--cruft` option when using linkgit:git-repack[1] and linkgit:git-gc[1], and
-leaving the `gc.cruftPacks` configuration unset until all writers understand
-cruft packs.
+setting the `gc.cruftPacks` configuration to "false" until all writers
+understand cruft packs.
=== Alternatives
diff --git a/Documentation/gitformat-signature.txt b/Documentation/gitformat-signature.txt
index a249869faf..d4d3a31f03 100644
--- a/Documentation/gitformat-signature.txt
+++ b/Documentation/gitformat-signature.txt
@@ -17,12 +17,24 @@ DESCRIPTION
Git uses cryptographic signatures in various places, currently objects (tags,
commits, mergetags) and transactions (pushes). In every case, the command which
is about to create an object or transaction determines a payload from that,
-calls gpg to obtain a detached signature for the payload (`gpg -bsa`) and
-embeds the signature into the object or transaction.
+calls an external program to obtain a detached signature for the payload
+(`gpg -bsa` in the case of PGP signatures), and embeds the signature into the
+object or transaction.
-Signatures always begin with `-----BEGIN PGP SIGNATURE-----`
-and end with `-----END PGP SIGNATURE-----`, unless gpg is told to
-produce RFC1991 signatures which use `MESSAGE` instead of `SIGNATURE`.
+Signatures begin with an "ASCII Armor" header line and end with a tail line,
+which differ depending on signature type (as selected by `gpg.format`, see
+linkgit:git-config[1]). These are, for `gpg.format` values:
+
+`gpg` (PGP)::
+ `-----BEGIN PGP SIGNATURE-----` and `-----END PGP SIGNATURE-----`.
+ Or, if gpg is told to produce RFC1991 signatures,
+ `-----BEGIN PGP MESSAGE-----` and `-----END PGP MESSAGE-----`
+
+`ssh` (SSH)::
+ `-----BEGIN SSH SIGNATURE-----` and `-----END SSH SIGNATURE-----`
+
+`x509` (X.509)::
+ `-----BEGIN SIGNED MESSAGE-----` and `-----END SIGNED MESSAGE-----`
Signatures sometimes appear as a part of the normal payload
(e.g. a signed tag has the signature block appended after the payload
@@ -37,7 +49,7 @@ line.
This is even true for an originally empty line. In the following
examples, the end of line that ends with a whitespace letter is
highlighted with a `$` sign; if you are trying to recreate these
-example by hand, do not cut and paste them---they are there
+example by hand, do not cut and paste them--they are there
primarily to highlight extra whitespace at the end of some lines.
The signed payload and the way the signature is embedded depends
diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index a16e62bc8c..86f804720a 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -27,6 +27,18 @@ repository. An exception are hooks triggered during a push ('pre-receive',
'update', 'post-receive', 'post-update', 'push-to-checkout') which are always
executed in $GIT_DIR.
+Environment variables, such as `GIT_DIR`, `GIT_WORK_TREE`, etc., are exported
+so that Git commands run by the hook can correctly locate the repository. If
+your hook needs to invoke Git commands in a foreign repository or in a
+different working tree of the same repository, then it should clear these
+environment variables so they do not interfere with Git operations at the
+foreign location. For example:
+
+------------
+local_desc=$(git describe)
+foreign_desc=$(unset $(git rev-parse --local-env-vars); git -C ../foreign-repo describe)
+------------
+
Hooks can get their arguments via the environment, command-line
arguments, and stdin. See the documentation for each hook below for
details.
@@ -583,10 +595,51 @@ processed by rebase.
sendemail-validate
~~~~~~~~~~~~~~~~~~
-This hook is invoked by linkgit:git-send-email[1]. It takes a single parameter,
-the name of the file that holds the e-mail to be sent. Exiting with a
-non-zero status causes `git send-email` to abort before sending any
-e-mails.
+This hook is invoked by linkgit:git-send-email[1].
+
+It takes these command line arguments. They are,
+1. the name of the file which holds the contents of the email to be sent.
+2. The name of the file which holds the SMTP headers of the email.
+
+The SMTP headers are passed in the exact same way as they are passed to the
+user's Mail Transport Agent (MTA). In effect, the email given to the user's
+MTA, is the contents of $2 followed by the contents of $1.
+
+An example of a few common headers is shown below. Take notice of the
+capitalization and multi-line tab structure.
+
+ From: Example <from@example.com>
+ To: to@example.com
+ Cc: cc@example.com,
+ A <author@example.com>,
+ One <one@example.com>,
+ two@example.com
+ Subject: PATCH-STRING
+
+Exiting with a non-zero status causes `git send-email` to abort
+before sending any e-mails.
+
+The following environment variables are set when executing the hook.
+
+`GIT_SENDEMAIL_FILE_COUNTER`::
+ A 1-based counter incremented by one for every file holding an e-mail
+ to be sent (excluding any FIFOs). This counter does not follow the
+ patch series counter scheme. It will always start at 1 and will end at
+ GIT_SENDEMAIL_FILE_TOTAL.
+
+`GIT_SENDEMAIL_FILE_TOTAL`::
+ The total number of files that will be sent (excluding any FIFOs). This
+ counter does not follow the patch series counter scheme. It will always
+ be equal to the number of files being sent, whether there is a cover
+ letter or not.
+
+These variables may for instance be used to validate patch series.
+
+The sample `sendemail-validate` hook that comes with Git checks that all sent
+patches (excluding the cover letter) can be applied on top of the upstream
+repository default branch without conflicts. Some placeholders are left for
+additional validation steps to be performed after all patches of a given series
+have been applied.
fsmonitor-watchman
~~~~~~~~~~~~~~~~~~
diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
index f2738b10db..4c17f2356c 100644
--- a/Documentation/gitignore.txt
+++ b/Documentation/gitignore.txt
@@ -146,7 +146,9 @@ The purpose of gitignore files is to ensure that certain files
not tracked by Git remain untracked.
To stop tracking a file that is currently tracked, use
-'git rm --cached'.
+'git rm --cached' to remove the file from the index. The filename
+can then be added to the `.gitignore` file to stop the file from
+being reintroduced in later commits.
Git does not follow symbolic links when accessing a `.gitignore` file in
the working tree. This keeps behavior consistent when the file is
diff --git a/Documentation/gitprotocol-v2.txt b/Documentation/gitprotocol-v2.txt
index 59bf41cefb..acb97ad0c2 100644
--- a/Documentation/gitprotocol-v2.txt
+++ b/Documentation/gitprotocol-v2.txt
@@ -578,6 +578,207 @@ and associated requested information, each separated by a single space.
obj-info = obj-id SP obj-size
+bundle-uri
+~~~~~~~~~~
+
+If the 'bundle-uri' capability is advertised, the server supports the
+`bundle-uri' command.
+
+The capability is currently advertised with no value (i.e. not
+"bundle-uri=somevalue"), a value may be added in the future for
+supporting command-wide extensions. Clients MUST ignore any unknown
+capability values and proceed with the 'bundle-uri` dialog they
+support.
+
+The 'bundle-uri' command is intended to be issued before `fetch` to
+get URIs to bundle files (see linkgit:git-bundle[1]) to "seed" and
+inform the subsequent `fetch` command.
+
+The client CAN issue `bundle-uri` before or after any other valid
+command. To be useful to clients it's expected that it'll be issued
+after an `ls-refs` and before `fetch`, but CAN be issued at any time
+in the dialog.
+
+DISCUSSION of bundle-uri
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+The intent of the feature is optimize for server resource consumption
+in the common case by changing the common case of fetching a very
+large PACK during linkgit:git-clone[1] into a smaller incremental
+fetch.
+
+It also allows servers to achieve better caching in combination with
+an `uploadpack.packObjectsHook` (see linkgit:git-config[1]).
+
+By having new clones or fetches be a more predictable and common
+negotiation against the tips of recently produces *.bundle file(s).
+Servers might even pre-generate the results of such negotiations for
+the `uploadpack.packObjectsHook` as new pushes come in.
+
+One way that servers could take advantage of these bundles is that the
+server would anticipate that fresh clones will download a known bundle,
+followed by catching up to the current state of the repository using ref
+tips found in that bundle (or bundles).
+
+PROTOCOL for bundle-uri
+^^^^^^^^^^^^^^^^^^^^^^^
+
+A `bundle-uri` request takes no arguments, and as noted above does not
+currently advertise a capability value. Both may be added in the
+future.
+
+When the client issues a `command=bundle-uri` request, the response is a
+list of key-value pairs provided as packet lines with value
+`<key>=<value>`. Each `<key>` should be interpreted as a config key from
+the `bundle.*` namespace to construct a list of bundles. These keys are
+grouped by a `bundle.<id>.` subsection, where each key corresponding to a
+given `<id>` contributes attributes to the bundle defined by that `<id>`.
+See linkgit:git-config[1] for the specific details of these keys and how
+the Git client will interpret their values.
+
+Clients MUST parse the line according to the above format, lines that do
+not conform to the format SHOULD be discarded. The user MAY be warned in
+such a case.
+
+bundle-uri CLIENT AND SERVER EXPECTATIONS
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+URI CONTENTS::
+The content at the advertised URIs MUST be one of two types.
++
+The advertised URI may contain a bundle file that `git bundle verify`
+would accept. I.e. they MUST contain one or more reference tips for
+use by the client, MUST indicate prerequisites (in any) with standard
+"-" prefixes, and MUST indicate their "object-format", if
+applicable.
++
+The advertised URI may alternatively contain a plaintext file that `git
+config --list` would accept (with the `--file` option). The key-value
+pairs in this list are in the `bundle.*` namespace (see
+linkgit:git-config[1]).
+
+bundle-uri CLIENT ERROR RECOVERY::
+A client MUST above all gracefully degrade on errors, whether that
+error is because of bad missing/data in the bundle URI(s), because
+that client is too dumb to e.g. understand and fully parse out bundle
+headers and their prerequisite relationships, or something else.
++
+Server operators should feel confident in turning on "bundle-uri" and
+not worry if e.g. their CDN goes down that clones or fetches will run
+into hard failures. Even if the server bundle(s) are
+incomplete, or bad in some way the client should still end up with a
+functioning repository, just as if it had chosen not to use this
+protocol extension.
++
+All subsequent discussion on client and server interaction MUST keep
+this in mind.
+
+bundle-uri SERVER TO CLIENT::
+The ordering of the returned bundle uris is not significant. Clients
+MUST parse their headers to discover their contained OIDS and
+prerequisites. A client MUST consider the content of the bundle(s)
+themselves and their header as the ultimate source of truth.
++
+A server MAY even return bundle(s) that don't have any direct
+relationship to the repository being cloned (either through accident,
+or intentional "clever" configuration), and expect a client to sort
+out what data they'd like from the bundle(s), if any.
+
+bundle-uri CLIENT TO SERVER::
+The client SHOULD provide reference tips found in the bundle header(s)
+as 'have' lines in any subsequent `fetch` request. A client MAY also
+ignore the bundle(s) entirely if doing so is deemed worse for some
+reason, e.g. if the bundles can't be downloaded, it doesn't like the
+tips it finds etc.
+
+WHEN ADVERTISED BUNDLE(S) REQUIRE NO FURTHER NEGOTIATION::
+If after issuing `bundle-uri` and `ls-refs`, and getting the header(s)
+of the bundle(s) the client finds that the ref tips it wants can be
+retrieved entirely from advertised bundle(s), the client MAY disconnect
+from the Git server. The results of such a 'clone' or 'fetch' should be
+indistinguishable from the state attained without using bundle-uri.
+
+EARLY CLIENT DISCONNECTIONS AND ERROR RECOVERY::
+A client MAY perform an early disconnect while still downloading the
+bundle(s) (having streamed and parsed their headers). In such a case
+the client MUST gracefully recover from any errors related to
+finishing the download and validation of the bundle(s).
++
+I.e. a client might need to re-connect and issue a 'fetch' command,
+and possibly fall back to not making use of 'bundle-uri' at all.
++
+This "MAY" behavior is specified as such (and not a "SHOULD") on the
+assumption that a server advertising bundle uris is more likely than
+not to be serving up a relatively large repository, and to be pointing
+to URIs that have a good chance of being in working order. A client
+MAY e.g. look at the payload size of the bundles as a heuristic to see
+if an early disconnect is worth it, should falling back on a full
+"fetch" dialog be necessary.
+
+WHEN ADVERTISED BUNDLE(S) REQUIRE FURTHER NEGOTIATION::
+A client SHOULD commence a negotiation of a PACK from the server via
+the "fetch" command using the OID tips found in advertised bundles,
+even if's still in the process of downloading those bundle(s).
++
+This allows for aggressive early disconnects from any interactive
+server dialog. The client blindly trusts that the advertised OID tips
+are relevant, and issues them as 'have' lines, it then requests any
+tips it would like (usually from the "ls-refs" advertisement) via
+'want' lines. The server will then compute a (hopefully small) PACK
+with the expected difference between the tips from the bundle(s) and
+the data requested.
++
+The only connection the client then needs to keep active is to the
+concurrently downloading static bundle(s), when those and the
+incremental PACK are retrieved they should be inflated and
+validated. Any errors at this point should be gracefully recovered
+from, see above.
+
+bundle-uri PROTOCOL FEATURES
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The client constructs a bundle list from the `<key>=<value>` pairs
+provided by the server. These pairs are part of the `bundle.*` namespace
+as documented in linkgit:git-config[1]. In this section, we discuss some
+of these keys and describe the actions the client will do in response to
+this information.
+
+In particular, the `bundle.version` key specifies an integer value. The
+only accepted value at the moment is `1`, but if the client sees an
+unexpected value here then the client MUST ignore the bundle list.
+
+As long as `bundle.version` is understood, all other unknown keys MAY be
+ignored by the client. The server will guarantee compatibility with older
+clients, though newer clients may be better able to use the extra keys to
+minimize downloads.
+
+Any backwards-incompatible addition of pre-URI key-value will be
+guarded by a new `bundle.version` value or values in 'bundle-uri'
+capability advertisement itself, and/or by new future `bundle-uri`
+request arguments.
+
+Some example key-value pairs that are not currently implemented but could
+be implemented in the future include:
+
+ * Add a "hash=<val>" or "size=<bytes>" advertise the expected hash or
+ size of the bundle file.
+
+ * Advertise that one or more bundle files are the same (to e.g. have
+ clients round-robin or otherwise choose one of N possible files).
+
+ * A "oid=<OID>" shortcut and "prerequisite=<OID>" shortcut. For
+ expressing the common case of a bundle with one tip and no
+ prerequisites, or one tip and one prerequisite.
++
+This would allow for optimizing the common case of servers who'd like
+to provide one "big bundle" containing only their "main" branch,
+and/or incremental updates thereof.
++
+A client receiving such a a response MAY assume that they can skip
+retrieving the header from a bundle at the indicated URI, and thus
+save themselves and the server(s) the request(s) needed to inspect the
+headers of that bundle or bundles.
+
GIT
---
Part of the linkgit:git[1] suite
diff --git a/Documentation/gittutorial.txt b/Documentation/gittutorial.txt
index 0e0b863105..c7cadd8aaf 100644
--- a/Documentation/gittutorial.txt
+++ b/Documentation/gittutorial.txt
@@ -49,7 +49,7 @@ $ git config --global user.email you@yourdomain.example.com
Importing a new project
-----------------------
-Assume you have a tarball project.tar.gz with your initial work. You
+Assume you have a tarball `project.tar.gz` with your initial work. You
can place it under Git revision control as follows.
------------------------------------------------
@@ -65,10 +65,10 @@ Initialized empty Git repository in .git/
------------------------------------------------
You've now initialized the working directory--you may notice a new
-directory created, named ".git".
+directory created, named `.git`.
Next, tell Git to take a snapshot of the contents of all files under the
-current directory (note the '.'), with 'git add':
+current directory (note the `.`), with `git add`:
------------------------------------------------
$ git add .
@@ -76,7 +76,7 @@ $ git add .
This snapshot is now stored in a temporary staging area which Git calls
the "index". You can permanently store the contents of the index in the
-repository with 'git commit':
+repository with `git commit`:
------------------------------------------------
$ git commit
@@ -95,21 +95,20 @@ $ git add file1 file2 file3
------------------------------------------------
You are now ready to commit. You can see what is about to be committed
-using 'git diff' with the --cached option:
+using `git diff` with the `--cached` option:
------------------------------------------------
$ git diff --cached
------------------------------------------------
-(Without --cached, 'git diff' will show you any changes that
+(Without `--cached`, `git diff` will show you any changes that
you've made but not yet added to the index.) You can also get a brief
-summary of the situation with 'git status':
+summary of the situation with `git status`:
------------------------------------------------
$ git status
On branch master
Changes to be committed:
-Your branch is up to date with 'origin/master'.
(use "git restore --staged <file>..." to unstage)
modified: file1
@@ -128,7 +127,7 @@ $ git commit
This will again prompt you for a message describing the change, and then
record a new version of the project.
-Alternatively, instead of running 'git add' beforehand, you can use
+Alternatively, instead of running `git add` beforehand, you can use
------------------------------------------------
$ git commit -a
@@ -151,7 +150,7 @@ Git tracks content not files
Many revision control systems provide an `add` command that tells the
system to start tracking changes to a new file. Git's `add` command
-does something simpler and more powerful: 'git add' is used both for new
+does something simpler and more powerful: `git add` is used both for new
and newly modified files, and in both cases it takes a snapshot of the
given files and stages that content in the index, ready for inclusion in
the next commit.
@@ -182,7 +181,7 @@ Managing branches
-----------------
A single Git repository can maintain multiple branches of
-development. To create a new branch named "experimental", use
+development. To create a new branch named `experimental`, use
------------------------------------------------
$ git branch experimental
@@ -201,8 +200,8 @@ you'll get a list of all existing branches:
* master
------------------------------------------------
-The "experimental" branch is the one you just created, and the
-"master" branch is a default branch that was created for you
+The `experimental` branch is the one you just created, and the
+`master` branch is a default branch that was created for you
automatically. The asterisk marks the branch you are currently on;
type
@@ -210,8 +209,8 @@ type
$ git switch experimental
------------------------------------------------
-to switch to the experimental branch. Now edit a file, commit the
-change, and switch back to the master branch:
+to switch to the `experimental` branch. Now edit a file, commit the
+change, and switch back to the `master` branch:
------------------------------------------------
(edit file)
@@ -220,9 +219,9 @@ $ git switch master
------------------------------------------------
Check that the change you made is no longer visible, since it was
-made on the experimental branch and you're back on the master branch.
+made on the `experimental` branch and you're back on the `master` branch.
-You can make a different change on the master branch:
+You can make a different change on the `master` branch:
------------------------------------------------
(edit file)
@@ -230,7 +229,7 @@ $ git commit -a
------------------------------------------------
at this point the two branches have diverged, with different changes
-made in each. To merge the changes made in experimental into master, run
+made in each. To merge the changes made in `experimental` into `master`, run
------------------------------------------------
$ git merge experimental
@@ -258,16 +257,16 @@ $ gitk
will show a nice graphical representation of the resulting history.
-At this point you could delete the experimental branch with
+At this point you could delete the `experimental` branch with
------------------------------------------------
$ git branch -d experimental
------------------------------------------------
-This command ensures that the changes in the experimental branch are
+This command ensures that the changes in the `experimental` branch are
already in the current branch.
-If you develop on a branch crazy-idea, then regret it, you can always
+If you develop on a branch `crazy-idea`, then regret it, you can always
delete the branch with
-------------------------------------
@@ -281,7 +280,7 @@ Using Git for collaboration
---------------------------
Suppose that Alice has started a new project with a Git repository in
-/home/alice/project, and that Bob, who has a home directory on the
+`/home/alice/project`, and that Bob, who has a home directory on the
same machine, wants to contribute.
Bob begins with:
@@ -290,7 +289,7 @@ Bob begins with:
bob$ git clone /home/alice/project myrepo
------------------------------------------------
-This creates a new directory "myrepo" containing a clone of Alice's
+This creates a new directory `myrepo` containing a clone of Alice's
repository. The clone is on an equal footing with the original
project, possessing its own copy of the original project's history.
@@ -303,31 +302,31 @@ bob$ git commit -a
------------------------------------------------
When he's ready, he tells Alice to pull changes from the repository
-at /home/bob/myrepo. She does this with:
+at `/home/bob/myrepo`. She does this with:
------------------------------------------------
alice$ cd /home/alice/project
alice$ git pull /home/bob/myrepo master
------------------------------------------------
-This merges the changes from Bob's "master" branch into Alice's
+This merges the changes from Bob's `master` branch into Alice's
current branch. If Alice has made her own changes in the meantime,
then she may need to manually fix any conflicts.
-The "pull" command thus performs two operations: it fetches changes
+The `pull` command thus performs two operations: it fetches changes
from a remote branch, then merges them into the current branch.
Note that in general, Alice would want her local changes committed before
-initiating this "pull". If Bob's work conflicts with what Alice did since
+initiating this `pull`. If Bob's work conflicts with what Alice did since
their histories forked, Alice will use her working tree and the index to
resolve conflicts, and existing local changes will interfere with the
conflict resolution process (Git will still perform the fetch but will
refuse to merge -- Alice will have to get rid of her local changes in
some way and pull again when this happens).
-Alice can peek at what Bob did without merging first, using the "fetch"
+Alice can peek at what Bob did without merging first, using the `fetch`
command; this allows Alice to inspect what Bob did, using a special
-symbol "FETCH_HEAD", in order to determine if he has anything worth
+symbol `FETCH_HEAD`, in order to determine if he has anything worth
pulling, like this:
------------------------------------------------
@@ -336,10 +335,10 @@ alice$ git log -p HEAD..FETCH_HEAD
------------------------------------------------
This operation is safe even if Alice has uncommitted local changes.
-The range notation "HEAD..FETCH_HEAD" means "show everything that is reachable
-from the FETCH_HEAD but exclude anything that is reachable from HEAD".
-Alice already knows everything that leads to her current state (HEAD),
-and reviews what Bob has in his state (FETCH_HEAD) that she has not
+The range notation `HEAD..FETCH_HEAD` means "show everything that is reachable
+from the `FETCH_HEAD` but exclude anything that is reachable from `HEAD`".
+Alice already knows everything that leads to her current state (`HEAD`),
+and reviews what Bob has in his state (`FETCH_HEAD`) that she has not
seen with this command.
If Alice wants to visualize what Bob did since their histories forked
@@ -349,7 +348,7 @@ she can issue the following command:
$ gitk HEAD..FETCH_HEAD
------------------------------------------------
-This uses the same two-dot range notation we saw earlier with 'git log'.
+This uses the same two-dot range notation we saw earlier with `git log`.
Alice may want to view what both of them did since they forked.
She can use three-dot form instead of the two-dot form:
@@ -361,13 +360,13 @@ $ gitk HEAD...FETCH_HEAD
This means "show everything that is reachable from either one, but
exclude anything that is reachable from both of them".
-Please note that these range notation can be used with both gitk
-and "git log".
+Please note that these range notation can be used with both `gitk`
+and `git log`.
After inspecting what Bob did, if there is nothing urgent, Alice may
decide to continue working without pulling from Bob. If Bob's history
does have something Alice would immediately need, Alice may choose to
-stash her work-in-progress first, do a "pull", and then finally unstash
+stash her work-in-progress first, do a `pull`, and then finally unstash
her work-in-progress on top of the resulting history.
When you are working in a small closely knit group, it is not
@@ -379,8 +378,8 @@ it easier:
alice$ git remote add bob /home/bob/myrepo
------------------------------------------------
-With this, Alice can perform the first part of the "pull" operation
-alone using the 'git fetch' command without merging them with her own
+With this, Alice can perform the first part of the `pull` operation
+alone using the `git fetch` command without merging them with her own
branch, using:
-------------------------------------
@@ -388,7 +387,7 @@ alice$ git fetch bob
-------------------------------------
Unlike the longhand form, when Alice fetches from Bob using a
-remote repository shorthand set up with 'git remote', what was
+remote repository shorthand set up with `git remote`, what was
fetched is stored in a remote-tracking branch, in this case
`bob/master`. So after this:
@@ -397,10 +396,10 @@ alice$ git log -p master..bob/master
-------------------------------------
shows a list of all the changes that Bob made since he branched from
-Alice's master branch.
+Alice's `master` branch.
After examining those changes, Alice
-could merge the changes into her master branch:
+could merge the changes into her `master` branch:
-------------------------------------
alice$ git merge bob/master
@@ -432,12 +431,12 @@ bob$ git config --get remote.origin.url
/home/alice/project
-------------------------------------
-(The complete configuration created by 'git clone' is visible using
+(The complete configuration created by `git clone` is visible using
`git config -l`, and the linkgit:git-config[1] man page
explains the meaning of each option.)
-Git also keeps a pristine copy of Alice's master branch under the
-name "origin/master":
+Git also keeps a pristine copy of Alice's `master` branch under the
+name `origin/master`:
-------------------------------------
bob$ git branch -r
@@ -462,8 +461,8 @@ Exploring history
-----------------
Git history is represented as a series of interrelated commits. We
-have already seen that the 'git log' command can list those commits.
-Note that first line of each git log entry also gives a name for the
+have already seen that the `git log` command can list those commits.
+Note that first line of each `git log` entry also gives a name for the
commit:
-------------------------------------
@@ -475,7 +474,7 @@ Date: Tue May 16 17:18:22 2006 -0700
merge-base: Clarify the comments on post processing.
-------------------------------------
-We can give this name to 'git show' to see the details about this
+We can give this name to `git show` to see the details about this
commit.
-------------------------------------
@@ -514,7 +513,7 @@ You can also give commits names of your own; after running
$ git tag v2.5 1b2e1d63ff
-------------------------------------
-you can refer to 1b2e1d63ff by the name "v2.5". If you intend to
+you can refer to `1b2e1d63ff` by the name `v2.5`. If you intend to
share this name with other people (for example, to identify a release
version), you should create a "tag" object, and perhaps sign it; see
linkgit:git-tag[1] for details.
@@ -533,22 +532,22 @@ $ git reset --hard HEAD^ # reset your current branch and working
Be careful with that last command: in addition to losing any changes
in the working directory, it will also remove all later commits from
this branch. If this branch is the only branch containing those
-commits, they will be lost. Also, don't use 'git reset' on a
+commits, they will be lost. Also, don't use `git reset` on a
publicly-visible branch that other developers pull from, as it will
force needless merges on other developers to clean up the history.
-If you need to undo changes that you have pushed, use 'git revert'
+If you need to undo changes that you have pushed, use `git revert`
instead.
-The 'git grep' command can search for strings in any version of your
+The `git grep` command can search for strings in any version of your
project, so
-------------------------------------
$ git grep "hello" v2.5
-------------------------------------
-searches for all occurrences of "hello" in v2.5.
+searches for all occurrences of "hello" in `v2.5`.
-If you leave out the commit name, 'git grep' will search any of the
+If you leave out the commit name, `git grep` will search any of the
files it manages in your current directory. So
-------------------------------------
@@ -558,7 +557,7 @@ $ git grep "hello"
is a quick way to search just the files that are tracked by Git.
Many Git commands also take sets of commits, which can be specified
-in a number of ways. Here are some examples with 'git log':
+in a number of ways. Here are some examples with `git log`:
-------------------------------------
$ git log v2.5..v2.6 # commits between v2.5 and v2.6
@@ -568,16 +567,16 @@ $ git log v2.5.. Makefile # commits since v2.5 which modify
# Makefile
-------------------------------------
-You can also give 'git log' a "range" of commits where the first is not
+You can also give `git log` a "range" of commits where the first is not
necessarily an ancestor of the second; for example, if the tips of
-the branches "stable" and "master" diverged from a common
+the branches `stable` and `master` diverged from a common
commit some time ago, then
-------------------------------------
$ git log stable..master
-------------------------------------
-will list commits made in the master branch but not in the
+will list commits made in the `master` branch but not in the
stable branch, while
-------------------------------------
@@ -585,15 +584,15 @@ $ git log master..stable
-------------------------------------
will show the list of commits made on the stable branch but not
-the master branch.
+the `master` branch.
-The 'git log' command has a weakness: it must present commits in a
+The `git log` command has a weakness: it must present commits in a
list. When the history has lines of development that diverged and
-then merged back together, the order in which 'git log' presents
+then merged back together, the order in which `git log` presents
those commits is meaningless.
Most projects with multiple contributors (such as the Linux kernel,
-or Git itself) have frequent merges, and 'gitk' does a better job of
+or Git itself) have frequent merges, and `gitk` does a better job of
visualizing their history. For example,
-------------------------------------
@@ -601,7 +600,7 @@ $ gitk --since="2 weeks ago" drivers/
-------------------------------------
allows you to browse any commits from the last 2 weeks of commits
-that modified files under the "drivers" directory. (Note: you can
+that modified files under the `drivers` directory. (Note: you can
adjust gitk's fonts by holding down the control key while pressing
"-" or "+".)
@@ -613,7 +612,7 @@ of the file:
$ git diff v2.5:Makefile HEAD:Makefile.in
-------------------------------------
-You can also use 'git show' to see any such file:
+You can also use `git show` to see any such file:
-------------------------------------
$ git show v2.5:Makefile
@@ -649,7 +648,7 @@ digressions that may be interesting at this point are:
* linkgit:git-bisect[1]: When there is a regression in your
project, one way to track down the bug is by searching through
- the history to find the exact commit that's to blame. Git bisect
+ the history to find the exact commit that's to blame. `git bisect`
can help you perform a binary search for that commit. It is
smart enough to perform a close-to-optimal search even in the
case of complex non-linear history with lots of merged branches.
diff --git a/Documentation/glossary-content.txt b/Documentation/glossary-content.txt
index aa2f41f5e7..5a537268e2 100644
--- a/Documentation/glossary-content.txt
+++ b/Documentation/glossary-content.txt
@@ -20,7 +20,7 @@
[[def_branch]]branch::
A "branch" is a line of development. The most recent
<<def_commit,commit>> on a branch is referred to as the tip of
- that branch. The tip of the branch is referenced by a branch
+ that branch. The tip of the branch is <<def_ref,referenced>> by a branch
<<def_head,head>>, which moves forward as additional development
is done on the branch. A single Git
<<def_repository,repository>> can track an arbitrary number of
@@ -75,6 +75,21 @@ state in the Git history, by creating a new commit representing the current
state of the <<def_index,index>> and advancing <<def_HEAD,HEAD>>
to point at the new commit.
+[[def_commit_graph_general]]commit graph concept, representations and usage::
+ A synonym for the <<def_DAG,DAG>> structure formed by the commits
+ in the object database, <<def_ref,referenced>> by branch tips,
+ using their <<def_chain,chain>> of linked commits.
+ This structure is the definitive commit graph. The
+ graph can be represented in other ways, e.g. the
+ <<def_commit_graph_file,"commit-graph" file>>.
+
+[[def_commit_graph_file]]commit-graph file::
+ The "commit-graph" (normally hyphenated) file is a supplemental
+ representation of the <<def_commit_graph_general,commit graph>>
+ which accelerates commit graph walks. The "commit-graph" file is
+ stored either in the .git/objects/info directory or in the info
+ directory of an alternate object database.
+
[[def_commit_object]]commit object::
An <<def_object,object>> which contains the information about a
particular <<def_revision,revision>>, such as <<def_parent,parents>>, committer,
@@ -262,7 +277,7 @@ This commit is referred to as a "merge commit", or sometimes just a
identified by its <<def_object_name,object name>>. The objects usually
live in `$GIT_DIR/objects/`.
-[[def_object_identifier]]object identifier::
+[[def_object_identifier]]object identifier (oid)::
Synonym for <<def_object_name,object name>>.
[[def_object_name]]object name::
@@ -493,6 +508,14 @@ exclude;;
<<def_tree_object,trees>> to the trees or <<def_blob_object,blobs>>
that they contain.
+[[def_reachability_bitmap]]reachability bitmaps::
+ Reachability bitmaps store information about the
+ <<def_reachable,reachability>> of a selected set of commits in
+ a packfile, or a multi-pack index (MIDX), to speed up object search.
+ The bitmaps are stored in a ".bitmap" file. A repository may have at
+ most one bitmap file in use. The bitmap file may belong to either one
+ pack, or the repository's multi-pack index (if it exists).
+
[[def_rebase]]rebase::
To reapply a series of changes from a <<def_branch,branch>> to a
different base, and reset the <<def_head,head>> of that branch
diff --git a/Documentation/howto/coordinate-embargoed-releases.txt b/Documentation/howto/coordinate-embargoed-releases.txt
index 601aae88e9..e653775bab 100644
--- a/Documentation/howto/coordinate-embargoed-releases.txt
+++ b/Documentation/howto/coordinate-embargoed-releases.txt
@@ -1,9 +1,10 @@
Content-type: text/asciidoc
-Abstract: When a critical vulnerability is discovered and fixed, we follow this
- script to coordinate a public release.
+Abstract: When a vulnerability is reported, we follow these guidelines to
+ assess the vulnerability, create and review a fix, and coordinate embargoed
+ security releases.
How we coordinate embargoed releases
-====================================
+------------------------------------
To protect Git users from critical vulnerabilities, we do not just release
fixed versions like regular maintenance releases. Instead, we coordinate
@@ -11,33 +12,147 @@ releases with packagers, keeping the fixes under an embargo until the release
date. That way, users will have a chance to upgrade on that date, no matter
what Operating System or distribution they run.
-Open a Security Advisory draft
-------------------------------
+The `git-security` mailing list
+-------------------------------
+
+Responsible disclosures of vulnerabilities, analysis, proposed fixes as
+well as the orchestration of coordinated embargoed releases all happen on the
+`git-security` mailing list at <git-security@googlegroups.com>.
+
+In this context, the term "embargo" refers to the time period that information
+about a vulnerability is kept under wraps and only shared on a need-to-know
+basis. This is necessary to protect Git's users from bad actors who would
+otherwise be made aware of attack vectors that could be exploited. "Lifting the
+embargo" refers to publishing the version that fixes the vulnerabilities.
+
+Audience of the `git-security` mailing list
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Anybody may contact the `git-security` mailing list by sending an email
+to <git-security@googlegroups.com>, though the archive is closed to the
+public and only accessible to subscribed members.
+
+There are a few dozen subscribed members: core Git developers who are trusted
+with addressing vulnerabilities, and stakeholders (i.e. owners of products
+affected by security vulnerabilities in Git).
+
+Most of the discussions revolve around assessing the severity of the reported
+issue (including the decision whether the report is security-relevant or can be
+redirected to the public mailing list), how to remediate the issue, determining
+the timeline of the disclosure as well as aligning priorities and
+requirements.
-The first step is to https://github.com/git/git/security/advisories/new[open an
-advisory]. Technically, it is not necessary, but it is convenient and saves a
-bit of hassle. This advisory can also be used to obtain the CVE number and it
-will give us a private fork associated with it that can be used to collaborate
-on a fix.
+Communications
+~~~~~~~~~~~~~~
-Release date of the embargoed version
--------------------------------------
+If you are a stakeholder, it is a good idea to pay close attention to the
+discussions, as pertinent information may be buried in the middle of a lively
+conversation that might not look relevant to your interests. For example, the
+tentative timeline might be agreed upon in the middle of discussing code
+comment formatting in one of the patches and whether or not to combine fixes
+for multiple, separate vulnerabilities into the same embargoed release. Most
+mail threads are not usually structured specifically to communicate
+agreements, assessments or timelines.
-If the vulnerability affects Windows users, we want to have our friends over at
-Visual Studio on board. This means we need to target a "Patch Tuesday" (i.e. a
-second Tuesday of the month), at the minimum three weeks from heads-up to
-coordinated release.
+Typical timeline
+----------------
-If the vulnerability affects the server side, or can benefit from scans on the
-server side (i.e. if `git fsck` can detect an attack), it is important to give
-all involved Git repository hosting sites enough time to scan all of those
-repositories.
+- A potential vulnerability is reported to the `git-security` mailing list.
+
+- The members of the git-security list start a discussion to give an initial
+ assessment of the severity of the reported potential vulnerability.
+ We aspire to do so within a few days.
+
+- After discussion, if consensus is reached that it is not critical enough
+ to warrant any embargo, the reporter is redirected to the public Git mailing
+ list. This ends the reporter's interaction with the `git-security` list.
+
+- If it is deemed critical enough for an embargo, ideas are presented on how to
+ address the vulnerability.
+
+- Usually around that time, the Git maintainer or their delegate(s) open a draft
+ security advisory in the `git/git` repository on GitHub (see below for more
+ details).
+
+- Code review can take place in a variety of different locations,
+ depending on context. These are: patches sent inline on the git-security list,
+ a private fork on GitHub associated with the draft security advisory, or the
+ git/cabal repository.
+
+- Contributors working on a fix should consider beginning by sending
+ patches to the git-security list (inline with the original thread), since they
+ are accessible to all subscribers, along with the original reporter.
+
+- Once the review has settled and everyone involved in the review agrees that
+ the patches are nearing the finish line, the Git maintainer, and others
+ determine a release date as well as the release trains that are serviced. The
+ decision regarding which versions need a backported fix is based on input from
+ the reporter, the contributor who worked on the patches, and from
+ stakeholders. Operators of hosting sites who may want to analyze whether the
+ given issue is exploited via any of the repositories they host, and binary
+ packagers who want to make sure their product gets patched adequately against
+ the vulnerability, for example, may want to give their input at this stage.
+
+- While the Git community does its best to accommodate the specific timeline
+ requests of the various binary packagers, the nature of the issue may preclude
+ a prolonged release schedule. For fixes deemed urgent, it may be in the best
+ interest of the Git users community to shorten the disclosure and release
+ timeline, and packagers may need to adapt accordingly.
+
+- Subsequently, branches with the fixes are pushed to the git/cabal repository.
+
+- The tags are created by the Git maintainer and pushed to the same repository.
+
+- The Git for Windows, Git for macOS, BSD, Debian, etc. maintainers prepare the
+ corresponding release artifacts, based on the tags created that have been
+ prepared by the Git maintainer.
+
+- The release artifacts prepared by various binary packagers can be
+ made available to stakeholders under embargo via a mail to the
+ `git-security` list.
+
+- Less than a week before the release, a mail with the relevant information is
+ sent to <distros@vs.openwall.org> (see below), a list used to pre-announce
+ embargoed releases of open source projects to the stakeholders of all major
+ distributions of Linux as well as other OSes.
+
+- Public communication is then prepared in advance of the release date. This
+ includes blog posts and mails to the Git and Git for Windows mailing lists.
+
+- On the day of the release, at around 10am Pacific Time, the Git maintainer
+ pushes the tag and the `master` branch to the public repository, then sends
+ out an announcement mail.
+
+- Once the tag is pushed, the Git for Windows maintainer publishes the
+ corresponding tag and creates a GitHub Release with the associated release
+ artifacts (Git for Windows installer, Portable Git, MinGit, etc).
+
+- Git for Windows release is then announced via a mail to the public Git and
+ Git for Windows mailing lists as well as via a tweet.
+
+- Ditto for distribution packagers for Linux and other platforms:
+ their releases are announced via their preferred channels.
+
+- A mail to <oss-security@lists.openwall.org> (see below for details) is sent
+ as a follow-up to the <distros@vs.openwall.org> one, describing the
+ vulnerability in detail, often including a proof of concept of an exploit.
+
+Note: The Git project makes no guarantees about timelines, but aims to keep
+embargoes reasonably short in the interest of keeping Git's users safe.
+
+Opening a Security Advisory draft
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The first step is to https://github.com/git/git/security/advisories/new[open
+an advisory]. Technically, this is not necessary. However, it is the most
+convenient way to obtain the CVE number and it give us a private repository
+associated with it that can be used to collaborate on a fix.
Notifying the Linux distributions
----------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At most two weeks before release date, we need to send a notification to
-distros@vs.openwall.org, preferably less than 7 days before the release date.
+<distros@vs.openwall.org>, preferably less than 7 days before the release date.
This will reach most (all?) Linux distributions. See an example below, and the
guidelines for this mailing list at
https://oss-security.openwall.org/wiki/mailing-lists/distros#how-to-use-the-lists[here].
@@ -65,7 +180,7 @@ created using a command like this:
tar cJvf cve-xxx.bundle.tar.xz cve-xxx.bundle
Example mail to distros@vs.openwall.org
----------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
....
To: distros@vs.openwall.org
@@ -101,7 +216,7 @@ Thanks,
....
Example mail to oss-security@lists.openwall.com
------------------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
....
To: oss-security@lists.openwall.com
@@ -128,4 +243,4 @@ it goes to <developer>.
Thanks,
<name>
-....
+.... \ No newline at end of file
diff --git a/Documentation/howto/maintain-git.txt b/Documentation/howto/maintain-git.txt
index a67130debb..d07c6d44e5 100644
--- a/Documentation/howto/maintain-git.txt
+++ b/Documentation/howto/maintain-git.txt
@@ -231,7 +231,7 @@ by doing the following:
- Prepare 'jch' branch, which is used to represent somewhere
between 'master' and 'seen' and often is slightly ahead of 'next'.
- $ Meta/Reintegrate master..seen >Meta/redo-jch.sh
+ $ Meta/Reintegrate master..jch >Meta/redo-jch.sh
The result is a script that lists topics to be merged in order to
rebuild 'seen' as the input to Meta/Reintegrate script. Remove
@@ -256,7 +256,7 @@ by doing the following:
merged to 'next', add it at the end of the list. Then:
$ git checkout -B jch master
- $ Meta/redo-jch.sh -c1
+ $ sh Meta/redo-jch.sh -c1
to rebuild the 'jch' branch from scratch. "-c1" tells the script
to stop merging at the first line that begins with '###'
@@ -283,6 +283,11 @@ by doing the following:
$ git diff jch next
+ Then build the rest of 'jch':
+
+ $ git checkout jch
+ $ sh Meta/redo-jch.sh
+
When all is well, clean up the redo-jch.sh script with
$ sh Meta/redo-jch.sh -u
@@ -293,7 +298,7 @@ by doing the following:
- Rebuild 'seen'.
- $ Meta/Reintegrate master..seen >Meta/redo-seen.sh
+ $ Meta/Reintegrate jch..seen >Meta/redo-seen.sh
Edit the result by adding new topics that are not still in 'seen'
in the script. Then
diff --git a/Documentation/howto/new-command.txt b/Documentation/howto/new-command.txt
index 15a4c8031f..880c51112b 100644
--- a/Documentation/howto/new-command.txt
+++ b/Documentation/howto/new-command.txt
@@ -1,13 +1,13 @@
From: Eric S. Raymond <esr@thyrsus.com>
Abstract: This is how-to documentation for people who want to add extension
- commands to Git. It should be read alongside api-builtin.txt.
+ commands to Git. It should be read alongside builtin.h.
Content-type: text/asciidoc
How to integrate new subcommands
================================
This is how-to documentation for people who want to add extension
-commands to Git. It should be read alongside api-builtin.txt.
+commands to Git. It should be read alongside builtin.h.
Runtime environment
-------------------
diff --git a/Documentation/lint-fsck-msgids.perl b/Documentation/lint-fsck-msgids.perl
new file mode 100755
index 0000000000..1233ffe815
--- /dev/null
+++ b/Documentation/lint-fsck-msgids.perl
@@ -0,0 +1,70 @@
+#!/usr/bin/perl
+
+my ($fsck_h, $fsck_msgids_txt, $okfile) = @ARGV;
+
+my (%in_fsck_h, $fh, $bad);
+
+open($fh, "<", "$fsck_h") or die;
+while (<$fh>) {
+ if (/^\s+FUNC\(([0-9A-Z_]+), ([A-Z]+)\)/) {
+ my ($name, $severity) = ($1, $2);
+ my ($first) = 1;
+ $name = join('',
+ map {
+ y/A-Z/a-z/;
+ if (!$first) {
+ s/^(.)/uc($1)/e;
+ } else {
+ $first = 0;
+ }
+ $_;
+ }
+ split(/_/, $name));
+ $in_fsck_h{$name} = $severity;
+ }
+}
+close($fh);
+
+open($fh, "<", "$fsck_msgids_txt") or die;
+my ($previous, $current);
+while (<$fh>) {
+ if (!defined $current) {
+ if (/^\`([a-zA-Z0-9]*)\`::/) {
+ $current = $1;
+ if ((defined $previous) &&
+ ($current le $previous)) {
+ print STDERR "$previous >= $current in doc\n";
+ $bad = 1;
+ }
+ }
+ } elsif (/^\s+\(([A-Z]+)\) /) {
+ my ($level) = $1;
+ if (!exists $in_fsck_h{$current}) {
+ print STDERR "$current does not exist in fsck.h\n";
+ $bad = 1;
+ } elsif ($in_fsck_h{$current} eq "") {
+ print STDERR "$current defined twice\n";
+ $bad = 1;
+ } elsif ($in_fsck_h{$current} ne $level) {
+ print STDERR "$current severity $level != $in_fsck_h{$current}\n";
+ $bad = 1;
+ }
+ $previous = $current;
+ $in_fsck_h{$current} = ""; # mark as seen.
+ undef $current;
+ }
+}
+close($fh);
+
+for my $key (keys %in_fsck_h) {
+ if ($in_fsck_h{$key} ne "") {
+ print STDERR "$key not explained in doc.\n";
+ $bad = 1;
+ }
+}
+
+die if ($bad);
+
+open($fh, ">", "$okfile");
+print $fh "good\n";
+close($fh);
diff --git a/Documentation/manpage-base-url.xsl.in b/Documentation/manpage-base-url.xsl.in
deleted file mode 100644
index e800904df3..0000000000
--- a/Documentation/manpage-base-url.xsl.in
+++ /dev/null
@@ -1,10 +0,0 @@
-<!-- manpage-base-url.xsl:
- special settings for manpages rendered from newer docbook -->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0">
-
-<!-- set a base URL for relative links -->
-<xsl:param name="man.base.url.for.relative.links"
- >@@MAN_BASE_URL@@</xsl:param>
-
-</xsl:stylesheet>
diff --git a/Documentation/manpage-normal.xsl b/Documentation/manpage-normal.xsl
index a9c7ec69f4..beb5ff8ec2 100644
--- a/Documentation/manpage-normal.xsl
+++ b/Documentation/manpage-normal.xsl
@@ -8,19 +8,7 @@
<xsl:param name="man.output.quietly" select="1"/>
<xsl:param name="refentry.meta.get.quietly" select="1"/>
-<!-- convert asciidoc callouts to man page format -->
-<xsl:template match="co">
- <xsl:value-of select="concat('\fB(',substring-after(@id,'-'),')\fR')"/>
-</xsl:template>
-<xsl:template match="calloutlist">
- <xsl:text>.sp&#10;</xsl:text>
- <xsl:apply-templates/>
- <xsl:text>&#10;</xsl:text>
-</xsl:template>
-<xsl:template match="callout">
- <xsl:value-of select="concat('\fB',substring-after(@arearefs,'-'),'. \fR')"/>
- <xsl:apply-templates/>
- <xsl:text>.br&#10;</xsl:text>
-</xsl:template>
+<!-- unset maximum length of title -->
+<xsl:param name="man.th.title.max.length"/>
</xsl:stylesheet>
diff --git a/Documentation/manpage-quote-apos.xsl b/Documentation/manpage-quote-apos.xsl
deleted file mode 100644
index aeb8839f33..0000000000
--- a/Documentation/manpage-quote-apos.xsl
+++ /dev/null
@@ -1,16 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0">
-
-<!-- work around newer groff/man setups using a prettier apostrophe
- that unfortunately does not quote anything when cut&pasting
- examples to the shell -->
-<xsl:template name="escape.apostrophe">
- <xsl:param name="content"/>
- <xsl:call-template name="string.subst">
- <xsl:with-param name="string" select="$content"/>
- <xsl:with-param name="target">'</xsl:with-param>
- <xsl:with-param name="replacement">\(aq</xsl:with-param>
- </xsl:call-template>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt
index 0b4c1c8d98..3b71334459 100644
--- a/Documentation/pretty-formats.txt
+++ b/Documentation/pretty-formats.txt
@@ -146,24 +146,34 @@ The placeholders are:
'%m':: left (`<`), right (`>`) or boundary (`-`) mark
'%w([<w>[,<i1>[,<i2>]]])':: switch line wrapping, like the -w option of
linkgit:git-shortlog[1].
-'%<(<N>[,trunc|ltrunc|mtrunc])':: make the next placeholder take at
- least N columns, padding spaces on
+'%<( <N> [,trunc|ltrunc|mtrunc])':: make the next placeholder take at
+ least N column widths, padding spaces on
the right if necessary. Optionally
- truncate at the beginning (ltrunc),
- the middle (mtrunc) or the end
- (trunc) if the output is longer than
- N columns. Note that truncating
+ truncate (with ellipsis '..') at the left (ltrunc) `..ft`,
+ the middle (mtrunc) `mi..le`, or the end
+ (trunc) `rig..`, if the output is longer than
+ N columns.
+ Note 1: that truncating
only works correctly with N >= 2.
-'%<|(<N>)':: make the next placeholder take at least until Nth
- columns, padding spaces on the right if necessary
-'%>(<N>)', '%>|(<N>)':: similar to '%<(<N>)', '%<|(<N>)' respectively,
+ Note 2: spaces around the N and M (see below)
+ values are optional.
+ Note 3: Emojis and other wide characters
+ will take two display columns, which may
+ over-run column boundaries.
+ Note 4: decomposed character combining marks
+ may be misplaced at padding boundaries.
+'%<|( <M> )':: make the next placeholder take at least until Mth
+ display column, padding spaces on the right if necessary.
+ Use negative M values for column positions measured
+ from the right hand edge of the terminal window.
+'%>( <N> )', '%>|( <M> )':: similar to '%<( <N> )', '%<|( <M> )' respectively,
but padding spaces on the left
-'%>>(<N>)', '%>>|(<N>)':: similar to '%>(<N>)', '%>|(<N>)'
+'%>>( <N> )', '%>>|( <M> )':: similar to '%>( <N> )', '%>|( <M> )'
respectively, except that if the next
placeholder takes more spaces than given and
there are spaces on its left, use those
spaces
-'%><(<N>)', '%><|(<N>)':: similar to '%<(<N>)', '%<|(<N>)'
+'%><( <N> )', '%><|( <M> )':: similar to '%<( <N> )', '%<|( <M> )'
respectively, but padding both sides
(i.e. the text is centered)
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 1837509566..3000888a90 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -195,6 +195,14 @@ respectively, and they must begin with `refs/` when applied to `--glob`
or `--all`. If a trailing '/{asterisk}' is intended, it must be given
explicitly.
+--exclude-hidden=[fetch|receive|uploadpack]::
+ Do not include refs that would be hidden by `git-fetch`,
+ `git-receive-pack` or `git-upload-pack` by consulting the appropriate
+ `fetch.hideRefs`, `receive.hideRefs` or `uploadpack.hideRefs`
+ configuration along with `transfer.hideRefs` (see
+ linkgit:git-config[1]). This option affects the next pseudo-ref option
+ `--all` or `--glob` and is cleared after processing them.
+
--reflog::
Pretend as if all objects mentioned by reflogs are listed on the
command line as `<commit>`.
@@ -882,7 +890,7 @@ ifdef::git-rev-list[]
Print the object IDs of any object referenced by the listed
commits. `--objects foo ^bar` thus means ``send me
all object IDs which I need to download if I have the commit
- object _bar_ but not _foo_''.
+ object _bar_ but not _foo_''. See also `--object-names` below.
--in-commit-order::
Print tree and blob ids in order of the commits. The tree
@@ -912,7 +920,12 @@ ifdef::git-rev-list[]
--object-names::
Only useful with `--objects`; print the names of the object IDs
- that are found. This is the default behavior.
+ that are found. This is the default behavior. Note that the
+ "name" of each object is ambiguous, and mostly intended as a
+ hint for packing objects. In particular: no distinction is made between
+ the names of tags, trees, and blobs; path names may be modified
+ to remove newlines; and if an object would appear multiple times
+ with different names, only one name is shown.
--no-object-names::
Only useful with `--objects`; does not print the names of the object
@@ -1093,12 +1106,12 @@ preferred format. See the `strftime` manual for a complete list of
format placeholders. When using `-local`, the correct syntax is
`--date=format-local:...`.
-`--date=default` is the default format, and is similar to
-`--date=rfc2822`, with a few exceptions:
+`--date=default` is the default format, and is based on ctime(3)
+output. It shows a single line with three-letter day of the week,
+three-letter month, day-of-month, hour-minute-seconds in "HH:MM:SS"
+format, followed by 4-digit year, plus timezone information, unless
+the local time zone is used, e.g. `Thu Jan 1 00:00:00 1970 +0000`.
--
- - there is no comma after the day-of-week
-
- - the time zone is omitted when the local time zone is used
ifdef::git-rev-list[]
--header::
diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt
index e3e350126d..9aa58052bc 100644
--- a/Documentation/revisions.txt
+++ b/Documentation/revisions.txt
@@ -49,7 +49,8 @@ characters and to avoid word splitting.
`FETCH_HEAD` records the branch which you fetched from a remote repository
with your last `git fetch` invocation.
`ORIG_HEAD` is created by commands that move your `HEAD` in a drastic
-way, to record the position of the `HEAD` before their operation, so that
+way (`git am`, `git merge`, `git rebase`, `git reset`),
+to record the position of the `HEAD` before their operation, so that
you can easily change the tip of the branch back to the state before you ran
them.
`MERGE_HEAD` records the commit(s) which you are merging into your branch
@@ -363,7 +364,7 @@ Revision Range Summary
'<rev>{caret}!', e.g. 'HEAD{caret}!'::
A suffix '{caret}' followed by an exclamation mark is the same
- as giving commit '<rev>' and then all its parents prefixed with
+ as giving commit '<rev>' and all its parents prefixed with
'{caret}' to exclude them (and their ancestors).
'<rev>{caret}-<n>', e.g. 'HEAD{caret}-, HEAD{caret}-2'::
diff --git a/Documentation/technical/api-trace2.txt b/Documentation/technical/api-trace2.txt
index 2afa28bb5a..de5fc25059 100644
--- a/Documentation/technical/api-trace2.txt
+++ b/Documentation/technical/api-trace2.txt
@@ -148,20 +148,18 @@ filename collisions).
== Trace2 API
-All public Trace2 functions and macros are defined in `trace2.h` and
-`trace2.c`. All public symbols are prefixed with `trace2_`.
+The Trace2 public API is defined and documented in `trace2.h`; refer to it for
+more information. All public functions and macros are prefixed
+with `trace2_` and are implemented in `trace2.c`.
There are no public Trace2 data structures.
The Trace2 code also defines a set of private functions and data types
in the `trace2/` directory. These symbols are prefixed with `tr2_`
-and should only be used by functions in `trace2.c`.
+and should only be used by functions in `trace2.c` (or other private
+source files in `trace2/`).
-== Conventions for Public Functions and Macros
-
-The functions defined by the Trace2 API are declared and documented
-in `trace2.h`. It defines the API functions and wrapper macros for
-Trace2.
+=== Conventions for Public Functions and Macros
Some functions have a `_fl()` suffix to indicate that they take `file`
and `line-number` arguments.
@@ -172,52 +170,7 @@ take a `va_list` argument.
Some functions have a `_printf_fl()` suffix to indicate that they also
take a `printf()` style format with a variable number of arguments.
-There are CPP wrapper macros and `#ifdef`s to hide most of these details.
-See `trace2.h` for more details. The following discussion will only
-describe the simplified forms.
-
-== Public API
-
-All Trace2 API functions send a message to all of the active
-Trace2 Targets. This section describes the set of available
-messages.
-
-It helps to divide these functions into groups for discussion
-purposes.
-
-=== Basic Command Messages
-
-These are concerned with the lifetime of the overall git process.
-e.g: `void trace2_initialize_clock()`, `void trace2_initialize()`,
-`int trace2_is_enabled()`, `void trace2_cmd_start(int argc, const char **argv)`.
-
-=== Command Detail Messages
-
-These are concerned with describing the specific Git command
-after the command line, config, and environment are inspected.
-e.g: `void trace2_cmd_name(const char *name)`,
-`void trace2_cmd_mode(const char *mode)`.
-
-=== Child Process Messages
-
-These are concerned with the various spawned child processes,
-including shell scripts, git commands, editors, pagers, and hooks.
-
-e.g: `void trace2_child_start(struct child_process *cmd)`.
-
-=== Git Thread Messages
-
-These messages are concerned with Git thread usage.
-
-e.g: `void trace2_thread_start(const char *thread_name)`.
-
-=== Region and Data Messages
-
-These are concerned with recording performance data
-over regions or spans of code. e.g:
-`void trace2_region_enter(const char *category, const char *label, const struct repository *repo)`.
-
-Refer to trace2.h for details about all trace2 functions.
+CPP wrapper macros are defined to hide most of these details.
== Trace2 Target Formats
@@ -685,8 +638,8 @@ The "exec_id" field is a command-unique id and is only useful if the
`"thread_start"`::
This event is generated when a thread is started. It is
- generated from *within* the new thread's thread-proc (for TLS
- reasons).
+ generated from *within* the new thread's thread-proc (because
+ it needs to access data in the thread's thread-local storage).
+
------------
{
@@ -698,7 +651,7 @@ The "exec_id" field is a command-unique id and is only useful if the
`"thread_exit"`::
This event is generated when a thread exits. It is generated
- from *within* the thread's thread-proc (for TLS reasons).
+ from *within* the thread's thread-proc.
+
------------
{
@@ -816,6 +769,73 @@ The "value" field may be an integer or a string.
}
------------
+`"th_timer"`::
+ This event logs the amount of time that a stopwatch timer was
+ running in the thread. This event is generated when a thread
+ exits for timers that requested per-thread events.
++
+------------
+{
+ "event":"th_timer",
+ ...
+ "category":"my_category",
+ "name":"my_timer",
+ "intervals":5, # number of time it was started/stopped
+ "t_total":0.052741, # total time in seconds it was running
+ "t_min":0.010061, # shortest interval
+ "t_max":0.011648 # longest interval
+}
+------------
+
+`"timer"`::
+ This event logs the amount of time that a stopwatch timer was
+ running aggregated across all threads. This event is generated
+ when the process exits.
++
+------------
+{
+ "event":"timer",
+ ...
+ "category":"my_category",
+ "name":"my_timer",
+ "intervals":5, # number of time it was started/stopped
+ "t_total":0.052741, # total time in seconds it was running
+ "t_min":0.010061, # shortest interval
+ "t_max":0.011648 # longest interval
+}
+------------
+
+`"th_counter"`::
+ This event logs the value of a counter variable in a thread.
+ This event is generated when a thread exits for counters that
+ requested per-thread events.
++
+------------
+{
+ "event":"th_counter",
+ ...
+ "category":"my_category",
+ "name":"my_counter",
+ "count":23
+}
+------------
+
+`"counter"`::
+ This event logs the value of a counter variable across all threads.
+ This event is generated when the process exits. The total value
+ reported here is the sum across all threads.
++
+------------
+{
+ "event":"counter",
+ ...
+ "category":"my_category",
+ "name":"my_counter",
+ "count":23
+}
+------------
+
+
== Example Trace2 API Usage
Here is a hypothetical usage of the Trace2 API showing the intended
@@ -1206,7 +1226,7 @@ worked on 508 items at offset 2032. Thread "th04" worked on 508 items
at offset 508.
+
This example also shows that thread names are assigned in a racy manner
-as each thread starts and allocates TLS storage.
+as each thread starts.
Config (def param) Events::
@@ -1247,6 +1267,60 @@ d0 | main | data | r0 | 0.002126 | 0.002126 | fsy
d0 | main | exit | | 0.000470 | | | code:0
d0 | main | atexit | | 0.000477 | | | code:0
----------------
+
+Stopwatch Timer Events::
+
+ Measure the time spent in a function call or span of code
+ that might be called from many places within the code
+ throughout the life of the process.
++
+----------------
+static void expensive_function(void)
+{
+ trace2_timer_start(TRACE2_TIMER_ID_TEST1);
+ ...
+ sleep_millisec(1000); // Do something expensive
+ ...
+ trace2_timer_stop(TRACE2_TIMER_ID_TEST1);
+}
+
+static int ut_100timer(int argc, const char **argv)
+{
+ ...
+
+ expensive_function();
+
+ // Do something else 1...
+
+ expensive_function();
+
+ // Do something else 2...
+
+ expensive_function();
+
+ return 0;
+}
+----------------
++
+In this example, we measure the total time spent in
+`expensive_function()` regardless of when it is called
+in the overall flow of the program.
++
+----------------
+$ export GIT_TRACE2_PERF_BRIEF=1
+$ export GIT_TRACE2_PERF=~/log.perf
+$ t/helper/test-tool trace2 100timer 3 1000
+...
+$ cat ~/log.perf
+d0 | main | version | | | | | ...
+d0 | main | start | | 0.001453 | | | t/helper/test-tool trace2 100timer 3 1000
+d0 | main | cmd_name | | | | | trace2 (trace2)
+d0 | main | exit | | 3.003667 | | | code:0
+d0 | main | timer | | | | test | name:test1 intervals:3 total:3.001686 min:1.000254 max:1.000929
+d0 | main | atexit | | 3.003796 | | | code:0
+----------------
+
+
== Future Work
=== Relationship to the Existing Trace Api (api-trace.txt)
diff --git a/Documentation/technical/bundle-uri.txt b/Documentation/technical/bundle-uri.txt
index b78d01d9ad..91d3a13e32 100644
--- a/Documentation/technical/bundle-uri.txt
+++ b/Documentation/technical/bundle-uri.txt
@@ -479,14 +479,14 @@ outline for submitting these features:
(This choice is an opt-in via a config option and a command-line
option.)
-4. Allow the client to understand the `bundle.flag=forFetch` configuration
+4. Allow the client to understand the `bundle.heuristic` configuration key
and the `bundle.<id>.creationToken` heuristic. When `git clone`
- discovers a bundle URI with `bundle.flag=forFetch`, it configures the
- client repository to check that bundle URI during later `git fetch <remote>`
+ discovers a bundle URI with `bundle.heuristic`, it configures the client
+ repository to check that bundle URI during later `git fetch <remote>`
commands.
5. Allow clients to discover bundle URIs during `git fetch` and configure
- a bundle URI for later fetches if `bundle.flag=forFetch`.
+ a bundle URI for later fetches if `bundle.heuristic` is set.
6. Implement the "inspect headers" heuristic to reduce data downloads when
the `bundle.<id>.creationToken` heuristic is not available.
diff --git a/Documentation/technical/commit-graph.txt b/Documentation/technical/commit-graph.txt
index 90c9760c23..86fed0de0f 100644
--- a/Documentation/technical/commit-graph.txt
+++ b/Documentation/technical/commit-graph.txt
@@ -1,4 +1,4 @@
-Git Commit Graph Design Notes
+Git Commit-Graph Design Notes
=============================
Git walks the commit graph for many reasons, including:
@@ -17,7 +17,7 @@ There are two main costs here:
The commit-graph file is a supplemental data structure that accelerates
commit graph walks. If a user downgrades or disables the 'core.commitGraph'
-config setting, then the existing ODB is sufficient. The file is stored
+config setting, then the existing object database is sufficient. The file is stored
as "commit-graph" either in the .git/objects/info directory or in the info
directory of an alternate.
@@ -95,7 +95,7 @@ with default order), but is not used when the topological order is
required (such as merge base calculations, "git log --graph").
In practice, we expect some commits to be created recently and not stored
-in the commit graph. We can treat these commits as having "infinite"
+in the commit-graph. We can treat these commits as having "infinite"
generation number and walk until reaching commits with known generation
number.
@@ -149,7 +149,7 @@ Design Details
helpful for these clones, anyway. The commit-graph will not be read or
written when shallow commits are present.
-Commit Graphs Chains
+Commit-Graphs Chains
--------------------
Typically, repos grow with near-constant velocity (commits per day). Over time,
diff --git a/Documentation/technical/hash-function-transition.txt b/Documentation/technical/hash-function-transition.txt
index e2ac36dd21..ed57481089 100644
--- a/Documentation/technical/hash-function-transition.txt
+++ b/Documentation/technical/hash-function-transition.txt
@@ -562,7 +562,7 @@ hash re-encode during clone and to encourage peers to modernize.
The design described here allows fetches by SHA-1 clients of a
personal SHA-256 repository because it's not much more difficult than
allowing pushes from that repository. This support needs to be guarded
-by a configuration option --- servers like git.kernel.org that serve a
+by a configuration option -- servers like git.kernel.org that serve a
large number of clients would not be expected to bear that cost.
Meaning of signatures
diff --git a/Documentation/technical/parallel-checkout.txt b/Documentation/technical/parallel-checkout.txt
index e790258a1a..47c9b6183c 100644
--- a/Documentation/technical/parallel-checkout.txt
+++ b/Documentation/technical/parallel-checkout.txt
@@ -56,7 +56,7 @@ Rejected Multi-Threaded Solution
The most "straightforward" implementation would be to spread the set of
to-be-updated cache entries across multiple threads. But due to the
-thread-unsafe functions in the ODB code, we would have to use locks to
+thread-unsafe functions in the object database code, we would have to use locks to
coordinate the parallel operation. An early prototype of this solution
showed that the multi-threaded checkout would bring performance
improvements over the sequential code, but there was still too much lock
diff --git a/Documentation/technical/repository-version.txt b/Documentation/technical/repository-version.txt
index 7844ef30ff..8ef664b0b9 100644
--- a/Documentation/technical/repository-version.txt
+++ b/Documentation/technical/repository-version.txt
@@ -82,9 +82,9 @@ When the config key `extensions.preciousObjects` is set to `true`,
objects in the repository MUST NOT be deleted (e.g., by `git-prune` or
`git repack -d`).
-==== `partialclone`
+==== `partialClone`
-When the config key `extensions.partialclone` is set, it indicates
+When the config key `extensions.partialClone` is set, it indicates
that the repo was created with a partial clone (or later performed
a partial fetch) and that the remote may have omitted sending
certain unwanted objects. Such a remote is called a "promisor remote"
diff --git a/Documentation/technical/rerere.txt b/Documentation/technical/rerere.txt
index 35d4541433..be58f1bee3 100644
--- a/Documentation/technical/rerere.txt
+++ b/Documentation/technical/rerere.txt
@@ -99,7 +99,7 @@ conflict to leave line D means that the user declares:
compatible with what AB and AC wanted to do.
So the conflict we would see when merging AB into ACAB should be
-resolved the same way---it is the resolution that is in line with that
+resolved the same way--it is the resolution that is in line with that
declaration.
Imagine that similarly previously a branch XYXZ was forked from XY,
diff --git a/Documentation/technical/sparse-checkout.txt b/Documentation/technical/sparse-checkout.txt
new file mode 100644
index 0000000000..fa0d01cbda
--- /dev/null
+++ b/Documentation/technical/sparse-checkout.txt
@@ -0,0 +1,1103 @@
+Table of contents:
+
+ * Terminology
+ * Purpose of sparse-checkouts
+ * Usecases of primary concern
+ * Oversimplified mental models ("Cliff Notes" for this document!)
+ * Desired behavior
+ * Behavior classes
+ * Subcommand-dependent defaults
+ * Sparse specification vs. sparsity patterns
+ * Implementation Questions
+ * Implementation Goals/Plans
+ * Known bugs
+ * Reference Emails
+
+
+=== Terminology ===
+
+cone mode: one of two modes for specifying the desired subset of files
+ in a sparse-checkout. In cone-mode, the user specifies
+ directories (getting both everything under that directory as
+ well as everything in leading directories), while in non-cone
+ mode, the user specifies gitignore-style patterns. Controlled
+ by the --[no-]cone option to sparse-checkout init|set.
+
+SKIP_WORKTREE: When tracked files do not match the sparse specification and
+ are removed from the working tree, the file in the index is marked
+ with a SKIP_WORKTREE bit. Note that if a tracked file has the
+ SKIP_WORKTREE bit set but the file is later written by the user to
+ the working tree anyway, the SKIP_WORKTREE bit will be cleared at
+ the beginning of any subsequent Git operation.
+
+ Most sparse checkout users are unaware of this implementation
+ detail, and the term should generally be avoided in user-facing
+ descriptions and command flags. Unfortunately, prior to the
+ `sparse-checkout` subcommand this low-level detail was exposed,
+ and as of time of writing, is still exposed in various places.
+
+sparse-checkout: a subcommand in git used to reduce the files present in
+ the working tree to a subset of all tracked files. Also, the
+ name of the file in the $GIT_DIR/info directory used to track
+ the sparsity patterns corresponding to the user's desired
+ subset.
+
+sparse cone: see cone mode
+
+sparse directory: An entry in the index corresponding to a directory, which
+ appears in the index instead of all the files under that directory
+ that would normally appear. See also sparse-index. Something that
+ can cause confusion is that the "sparse directory" does NOT match
+ the sparse specification, i.e. the directory is NOT present in the
+ working tree. May be renamed in the future (e.g. to "skipped
+ directory").
+
+sparse index: A special mode for sparse-checkout that also makes the
+ index sparse by recording a directory entry in lieu of all the
+ files underneath that directory (thus making that a "skipped
+ directory" which unfortunately has also been called a "sparse
+ directory"), and does this for potentially multiple
+ directories. Controlled by the --[no-]sparse-index option to
+ init|set|reapply.
+
+sparsity patterns: patterns from $GIT_DIR/info/sparse-checkout used to
+ define the set of files of interest. A warning: It is easy to
+ over-use this term (or the shortened "patterns" term), for two
+ reasons: (1) users in cone mode specify directories rather than
+ patterns (their directories are transformed into patterns, but
+ users may think you are talking about non-cone mode if you use the
+ word "patterns"), and (b) the sparse specification might
+ transiently differ in the working tree or index from the sparsity
+ patterns (see "Sparse specification vs. sparsity patterns").
+
+sparse specification: The set of paths in the user's area of focus. This
+ is typically just the tracked files that match the sparsity
+ patterns, but the sparse specification can temporarily differ and
+ include additional files. (See also "Sparse specification
+ vs. sparsity patterns")
+
+ * When working with history, the sparse specification is exactly
+ the set of files matching the sparsity patterns.
+ * When interacting with the working tree, the sparse specification
+ is the set of tracked files with a clear SKIP_WORKTREE bit or
+ tracked files present in the working copy.
+ * When modifying or showing results from the index, the sparse
+ specification is the set of files with a clear SKIP_WORKTREE bit
+ or that differ in the index from HEAD.
+ * If working with the index and the working copy, the sparse
+ specification is the union of the paths from above.
+
+vivifying: When a command restores a tracked file to the working tree (and
+ hopefully also clears the SKIP_WORKTREE bit in the index for that
+ file), this is referred to as "vivifying" the file.
+
+
+=== Purpose of sparse-checkouts ===
+
+sparse-checkouts exist to allow users to work with a subset of their
+files.
+
+You can think of sparse-checkouts as subdividing "tracked" files into two
+categories -- a sparse subset, and all the rest. Implementationally, we
+mark "all the rest" in the index with a SKIP_WORKTREE bit and leave them
+out of the working tree. The SKIP_WORKTREE files are still tracked, just
+not present in the working tree.
+
+In the past, sparse-checkouts were defined by "SKIP_WORKTREE means the file
+is missing from the working tree but pretend the file contents match HEAD".
+That was not only bogus (it actually meant the file missing from the
+working tree matched the index rather than HEAD), but it was also a
+low-level detail which only provided decent behavior for a few commands.
+There were a surprising number of ways in which that guiding principle gave
+command results that violated user expectations, and as such was a bad
+mental model. However, it persisted for many years and may still be found
+in some corners of the code base.
+
+Anyway, the idea of "working with a subset of files" is simple enough, but
+there are multiple different high-level usecases which affect how some Git
+subcommands should behave. Further, even if we only considered one of
+those usecases, sparse-checkouts can modify different subcommands in over a
+half dozen different ways. Let's start by considering the high level
+usecases:
+
+ A) Users are _only_ interested in the sparse portion of the repo
+
+ A*) Users are _only_ interested in the sparse portion of the repo
+ that they have downloaded so far
+
+ B) Users want a sparse working tree, but are working in a larger whole
+
+ C) sparse-checkout is a behind-the-scenes implementation detail allowing
+ Git to work with a specially crafted in-house virtual file system;
+ users are actually working with a "full" working tree that is
+ lazily populated, and sparse-checkout helps with the lazy population
+ piece.
+
+It may be worth explaining each of these in a bit more detail:
+
+
+ (Behavior A) Users are _only_ interested in the sparse portion of the repo
+
+These folks might know there are other things in the repository, but
+don't care. They are uninterested in other parts of the repository, and
+only want to know about changes within their area of interest. Showing
+them other files from history (e.g. from diff/log/grep/etc.) is a
+usability annoyance, potentially a huge one since other changes in
+history may dwarf the changes they are interested in.
+
+Some of these users also arrive at this usecase from wanting to use partial
+clones together with sparse checkouts (in a way where they have downloaded
+blobs within the sparse specification) and do disconnected development.
+Not only do these users generally not care about other parts of the
+repository, but consider it a blocker for Git commands to try to operate on
+those. If commands attempt to access paths in history outside the sparsity
+specification, then the partial clone will attempt to download additional
+blobs on demand, fail, and then fail the user's command. (This may be
+unavoidable in some cases, e.g. when `git merge` has non-trivial changes to
+reconcile outside the sparse specification, but we should limit how often
+users are forced to connect to the network.)
+
+Also, even for users using partial clones that do not mind being
+always connected to the network, the need to download blobs as
+side-effects of various other commands (such as the printed diffstat
+after a merge or pull) can lead to worries about local repository size
+growing unnecessarily[10].
+
+ (Behavior A*) Users are _only_ interested in the sparse portion of the repo
+ that they have downloaded so far (a variant on the first usecase)
+
+This variant is driven by folks who using partial clones together with
+sparse checkouts and do disconnected development (so far sounding like a
+subset of behavior A users) and doing so on very large repositories. The
+reason for yet another variant is that downloading even just the blobs
+through history within their sparse specification may be too much, so they
+only download some. They would still like operations to succeed without
+network connectivity, though, so things like `git log -S${SEARCH_TERM} -p`
+or `git grep ${SEARCH_TERM} OLDREV ` would need to be prepared to provide
+partial results that depend on what happens to have been downloaded.
+
+This variant could be viewed as Behavior A with the sparse specification
+for history querying operations modified from "sparsity patterns" to
+"sparsity patterns limited to the blobs we have already downloaded".
+
+ (Behavior B) Users want a sparse working tree, but are working in a
+ larger whole
+
+Stolee described this usecase this way[11]:
+
+"I'm also focused on users that know that they are a part of a larger
+whole. They know they are operating on a large repository but focus on
+what they need to contribute their part. I expect multiple "roles" to
+use very different, almost disjoint parts of the codebase. Some other
+"architect" users operate across the entire tree or hop between different
+sections of the codebase as necessary. In this situation, I'm wary of
+scoping too many features to the sparse-checkout definition, especially
+"git log," as it can be too confusing to have their view of the codebase
+depend on your "point of view."
+
+People might also end up wanting behavior B due to complex inter-project
+dependencies. The initial attempts to use sparse-checkouts usually involve
+the directories you are directly interested in plus what those directories
+depend upon within your repository. But there's a monkey wrench here: if
+you have integration tests, they invert the hierarchy: to run integration
+tests, you need not only what you are interested in and its in-tree
+dependencies, you also need everything that depends upon what you are
+interested in or that depends upon one of your dependencies...AND you need
+all the in-tree dependencies of that expanded group. That can easily
+change your sparse-checkout into a nearly dense one.
+
+Naturally, that tends to kill the benefits of sparse-checkouts. There are
+a couple solutions to this conundrum: either avoid grabbing in-repo
+dependencies (maybe have built versions of your in-repo dependencies pulled
+from a CI cache somewhere), or say that users shouldn't run integration
+tests directly and instead do it on the CI server when they submit a code
+review. Or do both. Regardless of whether you stub out your in-repo
+dependencies or stub out the things that depend upon you, there is
+certainly a reason to want to query and be aware of those other stubbed-out
+parts of the repository, particularly when the dependencies are complex or
+change relatively frequently. Thus, for such uses, sparse-checkouts can be
+used to limit what you directly build and modify, but these users do not
+necessarily want their sparse checkout paths to limit their queries of
+versions in history.
+
+Some people may also be interested in behavior B over behavior A simply as
+a performance workaround: if they are using non-cone mode, then they have
+to deal with its inherent quadratic performance problems. In that mode,
+every operation that checks whether paths match the sparsity specification
+can be expensive. As such, these users may only be willing to pay for
+those expensive checks when interacting with the working copy, and may
+prefer getting "unrelated" results from their history queries over having
+slow commands.
+
+ (Behavior C) sparse-checkout is an implementational detail supporting a
+ special VFS.
+
+This usecase goes slightly against the traditional definition of
+sparse-checkout in that it actually tries to present a full or dense
+checkout to the user. However, this usecase utilizes the same underlying
+technical underpinnings in a new way which does provide some performance
+advantages to users. The basic idea is that a company can have an in-house
+Git-aware Virtual File System which pretends all files are present in the
+working tree, by intercepting all file system accesses and using those to
+fetch and write accessed files on demand via partial clones. The VFS uses
+sparse-checkout to prevent Git from writing or paying attention to many
+files, and manually updates the sparse checkout patterns itself based on
+user access and modification of files in the working tree. See commit
+ecc7c8841d ("repo_read_index: add config to expect files outside sparse
+patterns", 2022-02-25) and the link at [17] for a more detailed description
+of such a VFS.
+
+The biggest difference here is that users are completely unaware that the
+sparse-checkout machinery is even in use. The sparse patterns are not
+specified by the user but rather are under the complete control of the VFS
+(and the patterns are updated frequently and dynamically by it). The user
+will perceive the checkout as dense, and commands should thus behave as if
+all files are present.
+
+
+=== Usecases of primary concern ===
+
+Most of the rest of this document will focus on Behavior A and Behavior
+B. Some notes about the other two cases and why we are not focusing on
+them:
+
+ (Behavior A*)
+
+Supporting this usecase is estimated to be difficult and a lot of work.
+There are no plans to implement it currently, but it may be a potential
+future alternative. Knowing about the existence of additional alternatives
+may affect our choice of command line flags (e.g. if we need tri-state or
+quad-state flags rather than just binary flags), so it was still important
+to at least note.
+
+Further, I believe the descriptions below for Behavior A are probably still
+valid for this usecase, with the only exception being that it redefines the
+sparse specification to restrict it to already-downloaded blobs. The hard
+part is in making commands capable of respecting that modified definition.
+
+ (Behavior C)
+
+This usecase violates some of the early sparse-checkout documented
+assumptions (since files marked as SKIP_WORKTREE will be displayed to users
+as present in the working tree). That violation may mean various
+sparse-checkout related behaviors are not well suited to this usecase and
+we may need tweaks -- to both documentation and code -- to handle it.
+However, this usecase is also perhaps the simplest model to support in that
+everything behaves like a dense checkout with a few exceptions (e.g. branch
+checkouts and switches write fewer things, knowing the VFS will lazily
+write the rest on an as-needed basis).
+
+Since there is no publically available VFS-related code for folks to try,
+the number of folks who can test such a usecase is limited.
+
+The primary reason to note the Behavior C usecase is that as we fix things
+to better support Behaviors A and B, there may be additional places where
+we need to make tweaks allowing folks in this usecase to get the original
+non-sparse treatment. For an example, see ecc7c8841d ("repo_read_index:
+add config to expect files outside sparse patterns", 2022-02-25). The
+secondary reason to note Behavior C, is so that folks taking advantage of
+Behavior C do not assume they are part of the Behavior B camp and propose
+patches that break things for the real Behavior B folks.
+
+
+=== Oversimplified mental models ===
+
+An oversimplification of the differences in the above behaviors is:
+
+ Behavior A: Restrict worktree and history operations to sparse specification
+ Behavior B: Restrict worktree operations to sparse specification; have any
+ history operations work across all files
+ Behavior C: Do not restrict either worktree or history operations to the
+ sparse specification...with the exception of branch checkouts or
+ switches which avoid writing files that will match the index so
+ they can later lazily be populated instead.
+
+
+=== Desired behavior ===
+
+As noted previously, despite the simple idea of just working with a subset
+of files, there are a range of different behavioral changes that need to be
+made to different subcommands to work well with such a feature. See
+[1,2,3,4,5,6,7,8,9,10] for various examples. In particular, at [2], we saw
+that mere composition of other commands that individually worked correctly
+in a sparse-checkout context did not imply that the higher level command
+would work correctly; it sometimes requires further tweaks. So,
+understanding these differences can be beneficial.
+
+* Commands behaving the same regardless of high-level use-case
+
+ * commands that only look at files within the sparsity specification
+
+ * diff (without --cached or REVISION arguments)
+ * grep (without --cached or REVISION arguments)
+ * diff-files
+
+ * commands that restore files to the working tree that match sparsity
+ patterns, and remove unmodified files that don't match those
+ patterns:
+
+ * switch
+ * checkout (the switch-like half)
+ * read-tree
+ * reset --hard
+
+ * commands that write conflicted files to the working tree, but otherwise
+ will omit writing files to the working tree that do not match the
+ sparsity patterns:
+
+ * merge
+ * rebase
+ * cherry-pick
+ * revert
+
+ * `am` and `apply --cached` should probably be in this section but
+ are buggy (see the "Known bugs" section below)
+
+ The behavior for these commands somewhat depends upon the merge
+ strategy being used:
+ * `ort` behaves as described above
+ * `recursive` tries to not vivify files unnecessarily, but does sometimes
+ vivify files without conflicts.
+ * `octopus` and `resolve` will always vivify any file changed in the merge
+ relative to the first parent, which is rather suboptimal.
+
+ It is also important to note that these commands WILL update the index
+ outside the sparse specification relative to when the operation began,
+ BUT these commands often make a commit just before or after such that
+ by the end of the operation there is no change to the index outside the
+ sparse specification. Of course, if the operation hits conflicts or
+ does not make a commit, then these operations clearly can modify the
+ index outside the sparse specification.
+
+ Finally, it is important to note that at least the first four of these
+ commands also try to remove differences between the sparse
+ specification and the sparsity patterns (much like the commands in the
+ previous section).
+
+ * commands that always ignore sparsity since commits must be full-tree
+
+ * archive
+ * bundle
+ * commit
+ * format-patch
+ * fast-export
+ * fast-import
+ * commit-tree
+
+ * commands that write any modified file to the working tree (conflicted
+ or not, and whether those paths match sparsity patterns or not):
+
+ * stash
+ * apply (without `--index` or `--cached`)
+
+* Commands that may slightly differ for behavior A vs. behavior B:
+
+ Commands in this category behave mostly the same between the two
+ behaviors, but may differ in verbosity and types of warning and error
+ messages.
+
+ * commands that make modifications to which files are tracked:
+ * add
+ * rm
+ * mv
+ * update-index
+
+ The fact that files can move between the 'tracked' and 'untracked'
+ categories means some commands will have to treat untracked files
+ differently. But if we have to treat untracked files differently,
+ then additional commands may also need changes:
+
+ * status
+ * clean
+
+ In particular, `status` may need to report any untracked files outside
+ the sparsity specification as an erroneous condition (especially to
+ avoid the user trying to `git add` them, forcing `git add` to display
+ an error).
+
+ It's not clear to me exactly how (or even if) `clean` would change,
+ but it's the other command that also affects untracked files.
+
+ `update-index` may be slightly special. Its --[no-]skip-worktree flag
+ may need to ignore the sparse specification by its nature. Also, its
+ current --[no-]ignore-skip-worktree-entries default is totally bogus.
+
+ * commands for manually tweaking paths in both the index and the working tree
+ * `restore`
+ * the restore-like half of `checkout`
+
+ These commands should be similar to add/rm/mv in that they should
+ only operate on the sparse specification by default, and require a
+ special flag to operate on all files.
+
+ Also, note that these commands currently have a number of issues (see
+ the "Known bugs" section below)
+
+* Commands that significantly differ for behavior A vs. behavior B:
+
+ * commands that query history
+ * diff (with --cached or REVISION arguments)
+ * grep (with --cached or REVISION arguments)
+ * show (when given commit arguments)
+ * blame (only matters when one or more -C flags are passed)
+ * and annotate
+ * log
+ * whatchanged
+ * ls-files
+ * diff-index
+ * diff-tree
+ * ls-tree
+
+ Note: for log and whatchanged, revision walking logic is unaffected
+ but displaying of patches is affected by scoping the command to the
+ sparse-checkout. (The fact that revision walking is unaffected is
+ why rev-list, shortlog, show-branch, and bisect are not in this
+ list.)
+
+ ls-files may be slightly special in that e.g. `git ls-files -t` is
+ often used to see what is sparse and what is not. Perhaps -t should
+ always work on the full tree?
+
+* Commands I don't know how to classify
+
+ * range-diff
+
+ Is this like `log` or `format-patch`?
+
+ * cherry
+
+ See range-diff
+
+* Commands unaffected by sparse-checkouts
+
+ * shortlog
+ * show-branch
+ * rev-list
+ * bisect
+
+ * branch
+ * describe
+ * fetch
+ * gc
+ * init
+ * maintenance
+ * notes
+ * pull (merge & rebase have the necessary changes)
+ * push
+ * submodule
+ * tag
+
+ * config
+ * filter-branch (works in separate checkout without sparse-checkout setup)
+ * pack-refs
+ * prune
+ * remote
+ * repack
+ * replace
+
+ * bugreport
+ * count-objects
+ * fsck
+ * gitweb
+ * help
+ * instaweb
+ * merge-tree (doesn't touch worktree or index, and merges always compute full-tree)
+ * rerere
+ * verify-commit
+ * verify-tag
+
+ * commit-graph
+ * hash-object
+ * index-pack
+ * mktag
+ * mktree
+ * multi-pack-index
+ * pack-objects
+ * prune-packed
+ * symbolic-ref
+ * unpack-objects
+ * update-ref
+ * write-tree (operates on index, possibly optimized to use sparse dir entries)
+
+ * for-each-ref
+ * get-tar-commit-id
+ * ls-remote
+ * merge-base (merges are computed full tree, so merge base should be too)
+ * name-rev
+ * pack-redundant
+ * rev-parse
+ * show-index
+ * show-ref
+ * unpack-file
+ * var
+ * verify-pack
+
+ * <Everything under 'Interacting with Others' in 'git help --all'>
+ * <Everything under 'Low-level...Syncing' in 'git help --all'>
+ * <Everything under 'Low-level...Internal Helpers' in 'git help --all'>
+ * <Everything under 'External commands' in 'git help --all'>
+
+* Commands that might be affected, but who cares?
+
+ * merge-file
+ * merge-index
+ * gitk?
+
+
+=== Behavior classes ===
+
+From the above there are a few classes of behavior:
+
+ * "restrict"
+
+ Commands in this class only read or write files in the working tree
+ within the sparse specification.
+
+ When moving to a new commit (e.g. switch, reset --hard), these commands
+ may update index files outside the sparse specification as of the start
+ of the operation, but by the end of the operation those index files
+ will match HEAD again and thus those files will again be outside the
+ sparse specification.
+
+ When paths are explicitly specified, these paths are intersected with
+ the sparse specification and will only operate on such paths.
+ (e.g. `git restore [--staged] -- '*.png'`, `git reset -p -- '*.md'`)
+
+ Some of these commands may also attempt, at the end of their operation,
+ to cull transient differences between the sparse specification and the
+ sparsity patterns (see "Sparse specification vs. sparsity patterns" for
+ details, but this basically means either removing unmodified files not
+ matching the sparsity patterns and marking those files as
+ SKIP_WORKTREE, or vivifying files that match the sparsity patterns and
+ marking those files as !SKIP_WORKTREE).
+
+ * "restrict modulo conflicts"
+
+ Commands in this class generally behave like the "restrict" class,
+ except that:
+ (1) they will ignore the sparse specification and write files with
+ conflicts to the working tree (thus temporarily expanding the
+ sparse specification to include such files.)
+ (2) they are grouped with commands which move to a new commit, since
+ they often create a commit and then move to it, even though we
+ know there are many exceptions to moving to the new commit. (For
+ example, the user may rebase a commit that becomes empty, or have
+ a cherry-pick which conflicts, or a user could run `merge
+ --no-commit`, and we also view `apply --index` kind of like `am
+ --no-commit`.) As such, these commands can make changes to index
+ files outside the sparse specification, though they'll mark such
+ files with SKIP_WORKTREE.
+
+ * "restrict also specially applied to untracked files"
+
+ Commands in this class generally behave like the "restrict" class,
+ except that they have to handle untracked files differently too, often
+ because these commands are dealing with files changing state between
+ 'tracked' and 'untracked'. Often, this may mean printing an error
+ message if the command had nothing to do, but the arguments may have
+ referred to files whose tracked-ness state could have changed were it
+ not for the sparsity patterns excluding them.
+
+ * "no restrict"
+
+ Commands in this class ignore the sparse specification entirely.
+
+ * "restrict or no restrict dependent upon behavior A vs. behavior B"
+
+ Commands in this class behave like "no restrict" for folks in the
+ behavior B camp, and like "restrict" for folks in the behavior A camp.
+ However, when behaving like "restrict" a warning of some sort might be
+ provided that history queries have been limited by the sparse-checkout
+ specification.
+
+
+=== Subcommand-dependent defaults ===
+
+Note that we have different defaults depending on the command for the
+desired behavior :
+
+ * Commands defaulting to "restrict":
+ * diff-files
+ * diff (without --cached or REVISION arguments)
+ * grep (without --cached or REVISION arguments)
+ * switch
+ * checkout (the switch-like half)
+ * reset (<commit>)
+
+ * restore
+ * checkout (the restore-like half)
+ * checkout-index
+ * reset (with pathspec)
+
+ This behavior makes sense; these interact with the working tree.
+
+ * Commands defaulting to "restrict modulo conflicts":
+ * merge
+ * rebase
+ * cherry-pick
+ * revert
+
+ * am
+ * apply --index (which is kind of like an `am --no-commit`)
+
+ * read-tree (especially with -m or -u; is kind of like a --no-commit merge)
+ * reset (<tree-ish>, due to similarity to read-tree)
+
+ These also interact with the working tree, but require slightly
+ different behavior either so that (a) conflicts can be resolved or (b)
+ because they are kind of like a merge-without-commit operation.
+
+ (See also the "Known bugs" section below regarding `am` and `apply`)
+
+ * Commands defaulting to "no restrict":
+ * archive
+ * bundle
+ * commit
+ * format-patch
+ * fast-export
+ * fast-import
+ * commit-tree
+
+ * stash
+ * apply (without `--index`)
+
+ These have completely different defaults and perhaps deserve the most
+ detailed explanation:
+
+ In the case of commands in the first group (format-patch,
+ fast-export, bundle, archive, etc.), these are commands for
+ communicating history, which will be broken if they restrict to a
+ subset of the repository. As such, they operate on full paths and
+ have no `--restrict` option for overriding. Some of these commands may
+ take paths for manually restricting what is exported, but it needs to
+ be very explicit.
+
+ In the case of stash, it needs to vivify files to avoid losing the
+ user's changes.
+
+ In the case of apply without `--index`, that command needs to update
+ the working tree without the index (or the index without the working
+ tree if `--cached` is passed), and if we restrict those updates to the
+ sparse specification then we'll lose changes from the user.
+
+ * Commands defaulting to "restrict also specially applied to untracked files":
+ * add
+ * rm
+ * mv
+ * update-index
+ * status
+ * clean (?)
+
+ Our original implementation for the first three of these commands was
+ "no restrict", but it had some severe usability issues:
+ * `git add <somefile>` if honored and outside the sparse
+ specification, can result in the file randomly disappearing later
+ when some subsequent command is run (since various commands
+ automatically clean up unmodified files outside the sparse
+ specification).
+ * `git rm '*.jpg'` could very negatively surprise users if it deletes
+ files outside the range of the user's interest.
+ * `git mv` has similar surprises when moving into or out of the cone,
+ so best to restrict by default
+
+ So, we switched `add` and `rm` to default to "restrict", which made
+ usability problems much less severe and less frequent, but we still got
+ complaints because commands like:
+ git add <file-outside-sparse-specification>
+ git rm <file-outside-sparse-specification>
+ would silently do nothing. We should instead print an error in those
+ cases to get usability right.
+
+ update-index needs to be updated to match, and status and maybe clean
+ also need to be updated to specially handle untracked paths.
+
+ There may be a difference in here between behavior A and behavior B in
+ terms of verboseness of errors or additional warnings.
+
+ * Commands falling under "restrict or no restrict dependent upon behavior
+ A vs. behavior B"
+
+ * diff (with --cached or REVISION arguments)
+ * grep (with --cached or REVISION arguments)
+ * show (when given commit arguments)
+ * blame (only matters when one or more -C flags passed)
+ * and annotate
+ * log
+ * and variants: shortlog, gitk, show-branch, whatchanged, rev-list
+ * ls-files
+ * diff-index
+ * diff-tree
+ * ls-tree
+
+ For now, we default to behavior B for these, which want a default of
+ "no restrict".
+
+ Note that two of these commands -- diff and grep -- also appeared in a
+ different list with a default of "restrict", but only when limited to
+ searching the working tree. The working tree vs. history distinction
+ is fundamental in how behavior B operates, so this is expected. Note,
+ though, that for diff and grep with --cached, when doing "restrict"
+ behavior, the difference between sparse specification and sparsity
+ patterns is important to handle.
+
+ "restrict" may make more sense as the long term default for these[12].
+ Also, supporting "restrict" for these commands might be a fair amount
+ of work to implement, meaning it might be implemented over multiple
+ releases. If that behavior were the default in the commands that
+ supported it, that would force behavior B users to need to learn to
+ slowly add additional flags to their commands, depending on git
+ version, to get the behavior they want. That gradual switchover would
+ be painful, so we should avoid it at least until it's fully
+ implemented.
+
+
+=== Sparse specification vs. sparsity patterns ===
+
+In a well-behaved situation, the sparse specification is given directly
+by the $GIT_DIR/info/sparse-checkout file. However, it can transiently
+diverge for a few reasons:
+
+ * needing to resolve conflicts (merging will vivify conflicted files)
+ * running Git commands that implicitly vivify files (e.g. "git stash apply")
+ * running Git commands that explicitly vivify files (e.g. "git checkout
+ --ignore-skip-worktree-bits FILENAME")
+ * other commands that write to these files (perhaps a user copies it
+ from elsewhere)
+
+For the last item, note that we do automatically clear the SKIP_WORKTREE
+bit for files that are present in the working tree. This has been true
+since 82386b4496 ("Merge branch 'en/present-despite-skipped'",
+2022-03-09)
+
+However, such a situation is transient because:
+
+ * Such transient differences can and will be automatically removed as
+ a side-effect of commands which call unpack_trees() (checkout,
+ merge, reset, etc.).
+ * Users can also request such transient differences be corrected via
+ running `git sparse-checkout reapply`. Various places recommend
+ running that command.
+ * Additional commands are also welcome to implicitly fix these
+ differences; we may add more in the future.
+
+While we avoid dropping unstaged changes or files which have conflicts,
+we otherwise aggressively try to fix these transient differences. If
+users want these differences to persist, they should run the `set` or
+`add` subcommands of `git sparse-checkout` to reflect their intended
+sparse specification.
+
+However, when we need to do a query on history restricted to the
+"relevant subset of files" such a transiently expanded sparse
+specification is ignored. There are a couple reasons for this:
+
+ * The behavior wanted when doing something like
+ git grep expression REVISION
+ is roughly what the users would expect from
+ git checkout REVISION && git grep expression
+ (modulo a "REVISION:" prefix), which has a couple ramifications:
+
+ * REVISION may have paths not in the current index, so there is no
+ path we can consult for a SKIP_WORKTREE setting for those paths.
+
+ * Since `checkout` is one of those commands that tries to remove
+ transient differences in the sparse specification, it makes sense
+ to use the corrected sparse specification
+ (i.e. $GIT_DIR/info/sparse-checkout) rather than attempting to
+ consult SKIP_WORKTREE anyway.
+
+So, a transiently expanded (or restricted) sparse specification applies to
+the working tree, but not to history queries where we always use the
+sparsity patterns. (See [16] for an early discussion of this.)
+
+Similar to a transiently expanded sparse specification of the working tree
+based on additional files being present in the working tree, we also need
+to consider additional files being modified in the index. In particular,
+if the user has staged changes to files (relative to HEAD) that do not
+match the sparsity patterns, and the file is not present in the working
+tree, we still want to consider the file part of the sparse specification
+if we are specifically performing a query related to the index (e.g. git
+diff --cached [REVISION], git diff-index [REVISION], git restore --staged
+--source=REVISION -- PATHS, etc.) Note that a transiently expanded sparse
+specification for the index usually only matters under behavior A, since
+under behavior B index operations are lumped with history and tend to
+operate full-tree.
+
+
+=== Implementation Questions ===
+
+ * Do the options --scope={sparse,all} sound good to others? Are there better
+ options?
+ * Names in use, or appearing in patches, or previously suggested:
+ * --sparse/--dense
+ * --ignore-skip-worktree-bits
+ * --ignore-skip-worktree-entries
+ * --ignore-sparsity
+ * --[no-]restrict-to-sparse-paths
+ * --full-tree/--sparse-tree
+ * --[no-]restrict
+ * --scope={sparse,all}
+ * --focus/--unfocus
+ * --limit/--unlimited
+ * Rationale making me lean slightly towards --scope={sparse,all}:
+ * We want a name that works for many commands, so we need a name that
+ does not conflict
+ * We know that we have more than two possible usecases, so it is best
+ to avoid a flag that appears to be binary.
+ * --scope={sparse,all} isn't overly long and seems relatively
+ explanatory
+ * `--sparse`, as used in add/rm/mv, is totally backwards for
+ grep/log/etc. Changing the meaning of `--sparse` for these
+ commands would fix the backwardness, but possibly break existing
+ scripts. Using a new name pairing would allow us to treat
+ `--sparse` in these commands as a deprecated alias.
+ * There is a different `--sparse`/`--dense` pair for commands using
+ revision machinery, so using that naming might cause confusion
+ * There is also a `--sparse` in both pack-objects and show-branch, which
+ don't conflict but do suggest that `--sparse` is overloaded
+ * The name --ignore-skip-worktree-bits is a double negative, is
+ quite a mouthful, refers to an implementation detail that many
+ users may not be familiar with, and we'd need a negation for it
+ which would probably be even more ridiculously long. (But we
+ can make --ignore-skip-worktree-bits a deprecated alias for
+ --no-restrict.)
+
+ * If a config option is added (sparse.scope?) what should the values and
+ description be? "sparse" (behavior A), "worktree-sparse-history-dense"
+ (behavior B), "dense" (behavior C)? There's a risk of confusion,
+ because even for Behaviors A and B we want some commands to be
+ full-tree and others to operate sparsely, so the wording may need to be
+ more tied to the usecases and somehow explain that. Also, right now,
+ the primary difference we are focusing is just the history-querying
+ commands (log/diff/grep). Previous config suggestion here: [13]
+
+ * Is `--no-expand` a good alias for ls-files's `--sparse` option?
+ (`--sparse` does not map to either `--scope=sparse` or `--scope=all`,
+ because in non-cone mode it does nothing and in cone-mode it shows the
+ sparse directory entries which are technically outside the sparse
+ specification)
+
+ * Under Behavior A:
+ * Does ls-files' `--no-expand` override the default `--scope=all`, or
+ does it need an extra flag?
+ * Does ls-files' `-t` option imply `--scope=all`?
+ * Does update-index's `--[no-]skip-worktree` option imply `--scope=all`?
+
+ * sparse-checkout: once behavior A is fully implemented, should we take
+ an interim measure to ease people into switching the default? Namely,
+ if folks are not already in a sparse checkout, then require
+ `sparse-checkout init/set` to take a
+ `--set-scope=(sparse|worktree-sparse-history-dense|dense)` flag (which
+ would set sparse.scope according to the setting given), and throw an
+ error if the flag is not provided? That error would be a great place
+ to warn folks that the default may change in the future, and get them
+ used to specifying what they want so that the eventual default switch
+ is seamless for them.
+
+
+=== Implementation Goals/Plans ===
+
+ * Get buy-in on this document in general.
+
+ * Figure out answers to the 'Implementation Questions' sections (above)
+
+ * Fix bugs in the 'Known bugs' section (below)
+
+ * Provide some kind of method for backfilling the blobs within the sparse
+ specification in a partial clone
+
+ [Below here is kind of spitballing since the first two haven't been resolved]
+
+ * update-index: flip the default to --no-ignore-skip-worktree-entries,
+ nuke this stupid "Oh, there's a bug? Let me add a flag to let users
+ request that they not trigger this bug." flag
+
+ * Flags & Config
+ * Make `--sparse` in add/rm/mv a deprecated alias for `--scope=all`
+ * Make `--ignore-skip-worktree-bits` in checkout-index/checkout/restore
+ a deprecated aliases for `--scope=all`
+ * Create config option (sparse.scope?), tie it to the "Cliff notes"
+ overview
+
+ * Add --scope=sparse (and --scope=all) flag to each of the history querying
+ commands. IMPORTANT: make sure diff machinery changes don't mess with
+ format-patch, fast-export, etc.
+
+=== Known bugs ===
+
+This list used to be a lot longer (see e.g. [1,2,3,4,5,6,7,8,9]), but we've
+been working on it.
+
+0. Behavior A is not well supported in Git. (Behavior B didn't used to
+ be either, but was the easier of the two to implement.)
+
+1. am and apply:
+
+ apply, without `--index` or `--cached`, relies on files being present
+ in the working copy, and also writes to them unconditionally. As
+ such, it should first check for the files' presence, and if found to
+ be SKIP_WORKTREE, then clear the bit and vivify the paths, then do
+ its work. Currently, it just throws an error.
+
+ apply, with either `--cached` or `--index`, will not preserve the
+ SKIP_WORKTREE bit. This is fine if the file has conflicts, but
+ otherwise SKIP_WORKTREE bits should be preserved for --cached and
+ probably also for --index.
+
+ am, if there are no conflicts, will vivify files and fail to preserve
+ the SKIP_WORKTREE bit. If there are conflicts and `-3` is not
+ specified, it will vivify files and then complain the patch doesn't
+ apply. If there are conflicts and `-3` is specified, it will vivify
+ files and then complain that those vivified files would be
+ overwritten by merge.
+
+2. reset --hard:
+
+ reset --hard provides confusing error message (works correctly, but
+ misleads the user into believing it didn't):
+
+ $ touch addme
+ $ git add addme
+ $ git ls-files -t
+ H addme
+ H tracked
+ S tracked-but-maybe-skipped
+ $ git reset --hard # usually works great
+ error: Path 'addme' not uptodate; will not remove from working tree.
+ HEAD is now at bdbbb6f third
+ $ git ls-files -t
+ H tracked
+ S tracked-but-maybe-skipped
+ $ ls -1
+ tracked
+
+ `git reset --hard` DID remove addme from the index and the working tree, contrary
+ to the error message, but in line with how reset --hard should behave.
+
+3. read-tree
+
+ `read-tree` doesn't apply the 'SKIP_WORKTREE' bit to *any* of the
+ entries it reads into the index, resulting in all your files suddenly
+ appearing to be "deleted".
+
+4. Checkout, restore:
+
+ These command do not handle path & revision arguments appropriately:
+
+ $ ls
+ tracked
+ $ git ls-files -t
+ H tracked
+ S tracked-but-maybe-skipped
+ $ git status --porcelain
+ $ git checkout -- '*skipped'
+ error: pathspec '*skipped' did not match any file(s) known to git
+ $ git ls-files -- '*skipped'
+ tracked-but-maybe-skipped
+ $ git checkout HEAD -- '*skipped'
+ error: pathspec '*skipped' did not match any file(s) known to git
+ $ git ls-tree HEAD | grep skipped
+ 100644 blob 276f5a64354b791b13840f02047738c77ad0584f tracked-but-maybe-skipped
+ $ git status --porcelain
+ $ git checkout HEAD~1 -- '*skipped'
+ $ git ls-files -t
+ H tracked
+ H tracked-but-maybe-skipped
+ $ git status --porcelain
+ M tracked-but-maybe-skipped
+ $ git checkout HEAD -- '*skipped'
+ $ git status --porcelain
+ $
+
+ Note that checkout without a revision (or restore --staged) fails to
+ find a file to restore from the index, even though ls-files shows
+ such a file certainly exists.
+
+ Similar issues occur with HEAD (--source=HEAD in restore's case),
+ but suddenly works when HEAD~1 is specified. And then after that it
+ will work with HEAD specified, even though it didn't before.
+
+ Directories are also an issue:
+
+ $ git sparse-checkout set nomatches
+ $ git status
+ On branch main
+ You are in a sparse checkout with 0% of tracked files present.
+
+ nothing to commit, working tree clean
+ $ git checkout .
+ error: pathspec '.' did not match any file(s) known to git
+ $ git checkout HEAD~1 .
+ Updated 1 path from 58916d9
+ $ git ls-files -t
+ S tracked
+ H tracked-but-maybe-skipped
+
+5. checkout and restore --staged, continued:
+
+ These commands do not correctly scope operations to the sparse
+ specification, and make it worse by not setting important SKIP_WORKTREE
+ bits:
+
+ $ git restore --source OLDREV --staged outside-sparse-cone/
+ $ git status --porcelain
+ MD outside-sparse-cone/file1
+ MD outside-sparse-cone/file2
+ MD outside-sparse-cone/file3
+
+ We can add a --scope=all mode to `git restore` to let it operate outside
+ the sparse specification, but then it will be important to set the
+ SKIP_WORKTREE bits appropriately.
+
+6. Performance issues; see:
+ https://lore.kernel.org/git/CABPp-BEkJQoKZsQGCYioyga_uoDQ6iBeW+FKr8JhyuuTMK1RDw@mail.gmail.com/
+
+
+=== Reference Emails ===
+
+Emails that detail various bugs we've had in sparse-checkout:
+
+[1] (Original descriptions of behavior A & behavior B)
+ https://lore.kernel.org/git/CABPp-BGJ_Nvi5TmgriD9Bh6eNXE2EDq2f8e8QKXAeYG3BxZafA@mail.gmail.com/
+[2] (Fix stash applications in sparse checkouts; bugs from behavioral differences)
+ https://lore.kernel.org/git/ccfedc7140dbf63ba26a15f93bd3885180b26517.1606861519.git.gitgitgadget@gmail.com/
+[3] (Present-despite-skipped entries)
+ https://lore.kernel.org/git/11d46a399d26c913787b704d2b7169cafc28d639.1642175983.git.gitgitgadget@gmail.com/
+[4] (Clone --no-checkout interaction)
+ https://lore.kernel.org/git/pull.801.v2.git.git.1591324899170.gitgitgadget@gmail.com/ (clone --no-checkout)
+[5] (The need for update_sparsity() and avoiding `read-tree -mu HEAD`)
+ https://lore.kernel.org/git/3a1f084641eb47515b5a41ed4409a36128913309.1585270142.git.gitgitgadget@gmail.com/
+[6] (SKIP_WORKTREE is advisory, not mandatory)
+ https://lore.kernel.org/git/844306c3e86ef67591cc086decb2b760e7d710a3.1585270142.git.gitgitgadget@gmail.com/
+[7] (`worktree add` should copy sparsity settings from current worktree)
+ https://lore.kernel.org/git/c51cb3714e7b1d2f8c9370fe87eca9984ff4859f.1644269584.git.gitgitgadget@gmail.com/
+[8] (Avoid negative surprises in add, rm, and mv)
+ https://lore.kernel.org/git/cover.1617914011.git.matheus.bernardino@usp.br/
+ https://lore.kernel.org/git/pull.1018.v4.git.1632497954.gitgitgadget@gmail.com/
+[9] (Move from out-of-cone to in-cone)
+ https://lore.kernel.org/git/20220630023737.473690-6-shaoxuan.yuan02@gmail.com/
+ https://lore.kernel.org/git/20220630023737.473690-4-shaoxuan.yuan02@gmail.com/
+[10] (Unnecessarily downloading objects outside sparse specification)
+ https://lore.kernel.org/git/CAOLTT8QfwOi9yx_qZZgyGa8iL8kHWutEED7ok_jxwTcYT_hf9Q@mail.gmail.com/
+
+[11] (Stolee's comments on high-level usecases)
+ https://lore.kernel.org/git/1a1e33f6-3514-9afc-0a28-5a6b85bd8014@gmail.com/
+
+[12] Others commenting on eventually switching default to behavior A:
+ * https://lore.kernel.org/git/xmqqh719pcoo.fsf@gitster.g/
+ * https://lore.kernel.org/git/xmqqzgeqw0sy.fsf@gitster.g/
+ * https://lore.kernel.org/git/a86af661-cf58-a4e5-0214-a67d3a794d7e@github.com/
+
+[13] Previous config name suggestion and description
+ * https://lore.kernel.org/git/CABPp-BE6zW0nJSStcVU=_DoDBnPgLqOR8pkTXK3dW11=T01OhA@mail.gmail.com/
+
+[14] Tangential issue: switch to cone mode as default sparse specification mechanism:
+ https://lore.kernel.org/git/a1b68fd6126eb341ef3637bb93fedad4309b36d0.1650594746.git.gitgitgadget@gmail.com/
+
+[15] Lengthy email on grep behavior, covering what should be searched:
+ * https://lore.kernel.org/git/CABPp-BGVO3QdbfE84uF_3QDF0-y2iHHh6G5FAFzNRfeRitkuHw@mail.gmail.com/
+
+[16] Email explaining sparsity patterns vs. SKIP_WORKTREE and history operations,
+ search for the parenthetical comment starting "We do not check".
+ https://lore.kernel.org/git/CABPp-BFsCPPNOZ92JQRJeGyNd0e-TCW-LcLyr0i_+VSQJP+GCg@mail.gmail.com/
+
+[17] https://lore.kernel.org/git/20220207190320.2960362-1-jonathantanmy@google.com/
diff --git a/Documentation/urls-remotes.txt b/Documentation/urls-remotes.txt
index 86d0008f94..e410912fe5 100644
--- a/Documentation/urls-remotes.txt
+++ b/Documentation/urls-remotes.txt
@@ -33,7 +33,9 @@ config file would appear like this:
------------
The `<pushurl>` is used for pushes only. It is optional and defaults
-to `<URL>`.
+to `<URL>`. Pushing to a remote affects all defined pushurls or to all
+defined urls if no pushurls are defined. Fetch, however, will only
+fetch from the first defined url if muliple urls are defined.
Named file in `$GIT_DIR/remotes`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index d78ceb857a..9a1111af9b 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,7 +1,7 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
-DEF_VER=v2.38.5
+DEF_VER=v2.40.GIT
LF='
'
diff --git a/INSTALL b/INSTALL
index 43b39d99c4..4b42288882 100644
--- a/INSTALL
+++ b/INSTALL
@@ -120,7 +120,7 @@ Issues of note:
for everyday use (e.g. "bisect", "request-pull").
- "Perl" version 5.8 or later is needed to use some of the
- features (e.g. preparing a partial commit using "git add -i/-p",
+ features (e.g. sending patches using "git send-email",
interacting with svn repositories with "git svn"). If you can
live without these, use NO_PERL. Note that recent releases of
Redhat/Fedora are reported to ship Perl binary package with some
@@ -133,10 +133,6 @@ Issues of note:
you are using libcurl older than 7.34.0. Otherwise you can use
NO_OPENSSL without losing git-imap-send.
- By default, git uses OpenSSL for SHA1 but it will use its own
- library (inspired by Mozilla's) with either NO_OPENSSL or
- BLK_SHA1.
-
- "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
diff --git a/Makefile b/Makefile
index 865b2c7ae6..e440728c24 100644
--- a/Makefile
+++ b/Makefile
@@ -4,8 +4,20 @@ all::
# Import tree-wide shared Makefile behavior and libraries
include shared.mak
+# == Makefile defines ==
+#
+# These defines change the behavior of the Makefile itself, but have
+# no impact on what it builds:
+#
# Define V=1 to have a more verbose compile.
#
+# == Portability and optional library defines ==
+#
+# These defines indicate what Git can expect from the OS, what
+# libraries are available etc. Much of this is auto-detected in
+# config.mak.uname, or in configure.ac when using the optional "make
+# configure && ./configure" (see INSTALL).
+#
# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
#
# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
@@ -30,68 +42,8 @@ include shared.mak
#
# Define NO_OPENSSL environment variable if you do not have OpenSSL.
#
-# Define USE_LIBPCRE if you have and want to use libpcre. Various
-# commands such as log and grep offer runtime options to use
-# Perl-compatible regular expressions instead of standard or extended
-# POSIX regular expressions.
-#
-# Only libpcre version 2 is supported. USE_LIBPCRE2 is a synonym for
-# USE_LIBPCRE, support for the old USE_LIBPCRE1 has been removed.
-#
-# Define LIBPCREDIR=/foo/bar if your PCRE header and library files are
-# in /foo/bar/include and /foo/bar/lib directories.
-#
# Define HAVE_ALLOCA_H if you have working alloca(3) defined in that header.
#
-# Define NO_CURL if you do not have libcurl installed. git-http-fetch and
-# git-http-push are not built, and you cannot use http:// and https://
-# transports (neither smart nor dumb).
-#
-# Define CURLDIR=/foo/bar if your curl header and library files are in
-# /foo/bar/include and /foo/bar/lib directories.
-#
-# Define CURL_CONFIG to curl's configuration program that prints information
-# about the library (e.g., its version number). The default is 'curl-config'.
-#
-# Define CURL_LDFLAGS to specify flags that you need to link when using libcurl,
-# if you do not want to rely on the libraries provided by CURL_CONFIG. The
-# default value is a result of `curl-config --libs`. An example value for
-# CURL_LDFLAGS is as follows:
-#
-# CURL_LDFLAGS=-lcurl
-#
-# Define NO_EXPAT if you do not have expat installed. git-http-push is
-# not built, and you cannot push using http:// and https:// transports (dumb).
-#
-# Define EXPATDIR=/foo/bar if your expat header and library files are in
-# /foo/bar/include and /foo/bar/lib directories.
-#
-# Define EXPAT_NEEDS_XMLPARSE_H if you have an old version of expat (e.g.,
-# 1.1 or 1.2) that provides xmlparse.h instead of expat.h.
-#
-# Define NO_GETTEXT if you don't want Git output to be translated.
-# A translated Git requires GNU libintl or another gettext implementation,
-# plus libintl-perl at runtime.
-#
-# Define USE_GETTEXT_SCHEME and set it to 'fallthrough', if you don't trust
-# the installed gettext translation of the shell scripts output.
-#
-# Define HAVE_LIBCHARSET_H if you haven't set NO_GETTEXT and you can't
-# trust the langinfo.h's nl_langinfo(CODESET) function to return the
-# current character set. GNU and Solaris have a nl_langinfo(CODESET),
-# FreeBSD can use either, but MinGW and some others need to use
-# libcharset.h's locale_charset() instead.
-#
-# Define CHARSET_LIB to the library you need to link with in order to
-# use locale_charset() function. On some platforms this needs to set to
-# -lcharset, on others to -liconv .
-#
-# Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't
-# need -lintl when linking.
-#
-# Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt
-# doesn't support GNU extensions like --check and --statistics
-#
# Define HAVE_PATHS_H if you have paths.h and want to use the default PATH
# it specifies.
#
@@ -152,39 +104,6 @@ include shared.mak
# and do not want to use Apple's CommonCrypto library. This allows you
# to provide your own OpenSSL library, for example from MacPorts.
#
-# Define BLK_SHA1 environment variable to make use of the bundled
-# optimized C SHA1 routine.
-#
-# Define DC_SHA1 to unconditionally enable the collision-detecting sha1
-# algorithm. This is slower, but may detect attempted collision attacks.
-# Takes priority over other *_SHA1 knobs.
-#
-# Define DC_SHA1_EXTERNAL in addition to DC_SHA1 if you want to build / link
-# git with the external SHA1 collision-detect library.
-# Without this option, i.e. the default behavior is to build git with its
-# own built-in code (or submodule).
-#
-# Define DC_SHA1_SUBMODULE in addition to DC_SHA1 to use the
-# sha1collisiondetection shipped as a submodule instead of the
-# non-submodule copy in sha1dc/. This is an experimental option used
-# by the git project to migrate to using sha1collisiondetection as a
-# submodule.
-#
-# Define OPENSSL_SHA1 environment variable when running make to link
-# with the SHA1 routine from openssl library.
-#
-# Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed
-# in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO
-# wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined.
-#
-# Define BLK_SHA256 to use the built-in SHA-256 routines.
-#
-# Define NETTLE_SHA256 to use the SHA-256 routines in libnettle.
-#
-# Define GCRYPT_SHA256 to use the SHA-256 routines in libgcrypt.
-#
-# Define OPENSSL_SHA256 to use the SHA-256 routines in OpenSSL.
-#
# Define NEEDS_CRYPTO_WITH_SSL if you need -lcrypto when using -lssl (Darwin).
#
# Define NEEDS_SSL_WITH_CRYPTO if you need -lssl when using -lcrypto (Darwin).
@@ -288,10 +207,6 @@ include shared.mak
# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
# field that counts the on-disk footprint in 512-byte blocks.
#
-# Define GNU_ROFF if your target system uses GNU groff. This forces
-# apostrophes to be ASCII so that cut&pasting examples to the shell
-# will work.
-#
# Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the
# documentation.
#
@@ -370,6 +285,10 @@ include shared.mak
# Define NO_REGEX if your C library lacks regex support with REG_STARTEND
# feature.
#
+# Define USE_ENHANCED_BASIC_REGULAR_EXPRESSIONS if your C library provides
+# the flag REG_ENHANCED and you'd like to use it to enable enhanced basic
+# regular expressions.
+#
# Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
# user.
#
@@ -490,6 +409,149 @@ include shared.mak
# to the "<name>" of the corresponding `compat/fsmonitor/fsm-settings-<name>.c`
# that implements the `fsm_os_settings__*()` routines.
#
+# === Optional library: libintl ===
+#
+# Define NO_GETTEXT if you don't want Git output to be translated.
+# A translated Git requires GNU libintl or another gettext implementation,
+# plus libintl-perl at runtime.
+#
+# Define USE_GETTEXT_SCHEME and set it to 'fallthrough', if you don't trust
+# the installed gettext translation of the shell scripts output.
+#
+# Define HAVE_LIBCHARSET_H if you haven't set NO_GETTEXT and you can't
+# trust the langinfo.h's nl_langinfo(CODESET) function to return the
+# current character set. GNU and Solaris have a nl_langinfo(CODESET),
+# FreeBSD can use either, but MinGW and some others need to use
+# libcharset.h's locale_charset() instead.
+#
+# Define CHARSET_LIB to the library you need to link with in order to
+# use locale_charset() function. On some platforms this needs to set to
+# -lcharset, on others to -liconv .
+#
+# Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't
+# need -lintl when linking.
+#
+# Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt
+# doesn't support GNU extensions like --check and --statistics
+#
+# === Optional library: libexpat ===
+#
+# Define NO_EXPAT if you do not have expat installed. git-http-push is
+# not built, and you cannot push using http:// and https:// transports (dumb).
+#
+# Define EXPATDIR=/foo/bar if your expat header and library files are in
+# /foo/bar/include and /foo/bar/lib directories.
+#
+# Define EXPAT_NEEDS_XMLPARSE_H if you have an old version of expat (e.g.,
+# 1.1 or 1.2) that provides xmlparse.h instead of expat.h.
+
+# === Optional library: libcurl ===
+#
+# Define NO_CURL if you do not have libcurl installed. git-http-fetch and
+# git-http-push are not built, and you cannot use http:// and https://
+# transports (neither smart nor dumb).
+#
+# Define CURLDIR=/foo/bar if your curl header and library files are in
+# /foo/bar/include and /foo/bar/lib directories.
+#
+# Define CURL_CONFIG to curl's configuration program that prints information
+# about the library (e.g., its version number). The default is 'curl-config'.
+#
+# Define CURL_LDFLAGS to specify flags that you need to link when using libcurl,
+# if you do not want to rely on the libraries provided by CURL_CONFIG. The
+# default value is a result of `curl-config --libs`. An example value for
+# CURL_LDFLAGS is as follows:
+#
+# CURL_LDFLAGS=-lcurl
+#
+# === Optional library: libpcre2 ===
+#
+# Define USE_LIBPCRE if you have and want to use libpcre. Various
+# commands such as log and grep offer runtime options to use
+# Perl-compatible regular expressions instead of standard or extended
+# POSIX regular expressions.
+#
+# Only libpcre version 2 is supported. USE_LIBPCRE2 is a synonym for
+# USE_LIBPCRE, support for the old USE_LIBPCRE1 has been removed.
+#
+# Define LIBPCREDIR=/foo/bar if your PCRE header and library files are
+# in /foo/bar/include and /foo/bar/lib directories.
+#
+# == SHA-1 and SHA-256 defines ==
+#
+# === SHA-1 backend ===
+#
+# ==== Security ====
+#
+# Due to the SHAttered (https://shattered.io) attack vector on SHA-1
+# it's strongly recommended to use the sha1collisiondetection
+# counter-cryptanalysis library for SHA-1 hashing.
+#
+# If you know that you can trust the repository contents, or where
+# potential SHA-1 attacks are otherwise mitigated the other backends
+# listed in "SHA-1 implementations" are faster than
+# sha1collisiondetection.
+#
+# ==== Default SHA-1 backend ====
+#
+# If no *_SHA1 backend is picked, the first supported one listed in
+# "SHA-1 implementations" will be picked.
+#
+# ==== Options common to all SHA-1 implementations ====
+#
+# Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed
+# in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO
+# wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined.
+#
+# ==== SHA-1 implementations ====
+#
+# Define OPENSSL_SHA1 to link to the SHA-1 routines from the OpenSSL
+# library.
+#
+# Define BLK_SHA1 to make use of optimized C SHA-1 routines bundled
+# with git (in the block-sha1/ directory).
+#
+# Define APPLE_COMMON_CRYPTO_SHA1 to use Apple's CommonCrypto for
+# SHA-1.
+#
+# If don't enable any of the *_SHA1 settings in this section, Git will
+# default to its built-in sha1collisiondetection library, which is a
+# collision-detecting sha1 This is slower, but may detect attempted
+# collision attacks.
+#
+# ==== Options for the sha1collisiondetection library ====
+#
+# Define DC_SHA1_EXTERNAL if you want to build / link
+# git with the external SHA1 collision-detect library.
+# Without this option, i.e. the default behavior is to build git with its
+# own built-in code (or submodule).
+#
+# Define DC_SHA1_SUBMODULE to use the
+# sha1collisiondetection shipped as a submodule instead of the
+# non-submodule copy in sha1dc/. This is an experimental option used
+# by the git project to migrate to using sha1collisiondetection as a
+# submodule.
+#
+# === SHA-256 backend ===
+#
+# ==== Security ====
+#
+# Unlike SHA-1 the SHA-256 algorithm does not suffer from any known
+# vulnerabilities, so any implementation will do.
+#
+# ==== SHA-256 implementations ====
+#
+# Define OPENSSL_SHA256 to use the SHA-256 routines in OpenSSL.
+#
+# Define NETTLE_SHA256 to use the SHA-256 routines in libnettle.
+#
+# Define GCRYPT_SHA256 to use the SHA-256 routines in libgcrypt.
+#
+# If don't enable any of the *_SHA256 settings in this section, Git
+# will default to its built-in sha256 implementation.
+#
+# == DEVELOPER defines ==
+#
# Define DEVELOPER to enable more compiler warnings. Compiler version
# and family are auto detected, but could be overridden by defining
# COMPILER_FEATURES (see config.mak.dev). You can still set
@@ -627,7 +689,6 @@ THIRD_PARTY_SOURCES =
# interactive shell sessions without exporting it.
unexport CDPATH
-SCRIPT_SH += git-bisect.sh
SCRIPT_SH += git-difftool--helper.sh
SCRIPT_SH += git-filter-branch.sh
SCRIPT_SH += git-merge-octopus.sh
@@ -643,7 +704,6 @@ SCRIPT_LIB += git-mergetool--lib
SCRIPT_LIB += git-sh-i18n
SCRIPT_LIB += git-sh-setup
-SCRIPT_PERL += git-add--interactive.perl
SCRIPT_PERL += git-archimport.perl
SCRIPT_PERL += git-cvsexportcommit.perl
SCRIPT_PERL += git-cvsimport.perl
@@ -689,9 +749,9 @@ SCRIPTS = $(SCRIPT_SH_GEN) \
ETAGS_TARGET = TAGS
-FUZZ_OBJS += fuzz-commit-graph.o
-FUZZ_OBJS += fuzz-pack-headers.o
-FUZZ_OBJS += fuzz-pack-idx.o
+FUZZ_OBJS += oss-fuzz/fuzz-commit-graph.o
+FUZZ_OBJS += oss-fuzz/fuzz-pack-headers.o
+FUZZ_OBJS += oss-fuzz/fuzz-pack-idx.o
.PHONY: fuzz-objs
fuzz-objs: $(FUZZ_OBJS)
@@ -722,6 +782,8 @@ PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
TEST_BUILTINS_OBJS += test-advise.o
TEST_BUILTINS_OBJS += test-bitmap.o
TEST_BUILTINS_OBJS += test-bloom.o
+TEST_BUILTINS_OBJS += test-bundle-uri.o
+TEST_BUILTINS_OBJS += test-cache-tree.o
TEST_BUILTINS_OBJS += test-chmtime.o
TEST_BUILTINS_OBJS += test-config.o
TEST_BUILTINS_OBJS += test-crontab.o
@@ -735,6 +797,7 @@ TEST_BUILTINS_OBJS += test-dump-cache-tree.o
TEST_BUILTINS_OBJS += test-dump-fsmonitor.o
TEST_BUILTINS_OBJS += test-dump-split-index.o
TEST_BUILTINS_OBJS += test-dump-untracked-cache.o
+TEST_BUILTINS_OBJS += test-env-helper.o
TEST_BUILTINS_OBJS += test-example-decorate.o
TEST_BUILTINS_OBJS += test-fast-rebase.o
TEST_BUILTINS_OBJS += test-fsmonitor-client.o
@@ -969,6 +1032,7 @@ LIB_OBJS += fsmonitor.o
LIB_OBJS += fsmonitor-ipc.o
LIB_OBJS += fsmonitor-settings.o
LIB_OBJS += gettext.o
+LIB_OBJS += git-zlib.o
LIB_OBJS += gpg-interface.o
LIB_OBJS += graph.o
LIB_OBJS += grep.o
@@ -1095,6 +1159,7 @@ LIB_OBJS += trace.o
LIB_OBJS += trace2.o
LIB_OBJS += trace2/tr2_cfg.o
LIB_OBJS += trace2/tr2_cmd_name.o
+LIB_OBJS += trace2/tr2_ctr.o
LIB_OBJS += trace2/tr2_dst.o
LIB_OBJS += trace2/tr2_sid.o
LIB_OBJS += trace2/tr2_sysenv.o
@@ -1103,6 +1168,7 @@ LIB_OBJS += trace2/tr2_tgt_event.o
LIB_OBJS += trace2/tr2_tgt_normal.o
LIB_OBJS += trace2/tr2_tgt_perf.o
LIB_OBJS += trace2/tr2_tls.o
+LIB_OBJS += trace2/tr2_tmr.o
LIB_OBJS += trailer.o
LIB_OBJS += transport-helper.o
LIB_OBJS += transport.o
@@ -1127,14 +1193,13 @@ LIB_OBJS += write-or-die.o
LIB_OBJS += ws.o
LIB_OBJS += wt-status.o
LIB_OBJS += xdiff-interface.o
-LIB_OBJS += zlib.o
BUILTIN_OBJS += builtin/add.o
BUILTIN_OBJS += builtin/am.o
BUILTIN_OBJS += builtin/annotate.o
BUILTIN_OBJS += builtin/apply.o
BUILTIN_OBJS += builtin/archive.o
-BUILTIN_OBJS += builtin/bisect--helper.o
+BUILTIN_OBJS += builtin/bisect.o
BUILTIN_OBJS += builtin/blame.o
BUILTIN_OBJS += builtin/branch.o
BUILTIN_OBJS += builtin/bugreport.o
@@ -1166,7 +1231,6 @@ BUILTIN_OBJS += builtin/diff-index.o
BUILTIN_OBJS += builtin/diff-tree.o
BUILTIN_OBJS += builtin/diff.o
BUILTIN_OBJS += builtin/difftool.o
-BUILTIN_OBJS += builtin/env--helper.o
BUILTIN_OBJS += builtin/fast-export.o
BUILTIN_OBJS += builtin/fast-import.o
BUILTIN_OBJS += builtin/fetch-pack.o
@@ -1299,11 +1363,53 @@ SP_EXTRA_FLAGS = -Wno-universal-initializer
SANITIZE_LEAK =
SANITIZE_ADDRESS =
-# For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
-# usually result in less CPU usage at the cost of higher peak memory.
-# Setting it to 0 will feed all files in a single spatch invocation.
-SPATCH_FLAGS = --all-includes
-SPATCH_BATCH_SIZE = 1
+# For the 'coccicheck' target
+SPATCH_INCLUDE_FLAGS = --all-includes
+SPATCH_FLAGS =
+SPATCH_TEST_FLAGS =
+
+# If *.o files are present, have "coccicheck" depend on them, with
+# COMPUTE_HEADER_DEPENDENCIES this will speed up the common-case of
+# only needing to re-generate coccicheck results for the users of a
+# given API if it's changed, and not all files in the project. If
+# COMPUTE_HEADER_DEPENDENCIES=no this will be unset too.
+SPATCH_USE_O_DEPENDENCIES = YesPlease
+
+# Set SPATCH_CONCAT_COCCI to concatenate the contrib/cocci/*.cocci
+# files into a single contrib/cocci/ALL.cocci before running
+# "coccicheck".
+#
+# Pros:
+#
+# - Speeds up a one-shot run of "make coccicheck", as we won't have to
+# parse *.[ch] files N times for the N *.cocci rules
+#
+# Cons:
+#
+# - Will make incremental development of *.cocci slower, as
+# e.g. changing strbuf.cocci will re-run all *.cocci.
+#
+# - Makes error and performance analysis harder, as rules will be
+# applied from a monolithic ALL.cocci, rather than
+# e.g. strbuf.cocci. To work around this either undefine this, or
+# generate a specific patch, e.g. this will always use strbuf.cocci,
+# not ALL.cocci:
+#
+# make contrib/coccinelle/strbuf.cocci.patch
+SPATCH_CONCAT_COCCI = YesPlease
+
+# Rebuild 'coccicheck' if $(SPATCH), its flags etc. change
+TRACK_SPATCH_DEFINES =
+TRACK_SPATCH_DEFINES += $(SPATCH)
+TRACK_SPATCH_DEFINES += $(SPATCH_INCLUDE_FLAGS)
+TRACK_SPATCH_DEFINES += $(SPATCH_FLAGS)
+TRACK_SPATCH_DEFINES += $(SPATCH_TEST_FLAGS)
+GIT-SPATCH-DEFINES: FORCE
+ @FLAGS='$(TRACK_SPATCH_DEFINES)'; \
+ if test x"$$FLAGS" != x"`cat GIT-SPATCH-DEFINES 2>/dev/null`" ; then \
+ echo >&2 " * new spatch flags"; \
+ echo "$$FLAGS" >GIT-SPATCH-DEFINES; \
+ fi
include config.mak.uname
-include config.mak.autogen
@@ -1444,7 +1550,6 @@ ifeq ($(uname_S),Darwin)
APPLE_COMMON_CRYPTO = YesPlease
COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
endif
- NO_REGEX = YesPlease
PTHREAD_LIBS =
endif
@@ -1803,7 +1908,7 @@ ifdef NO_POSIX_GOODIES
BASIC_CFLAGS += -DNO_POSIX_GOODIES
endif
-ifdef APPLE_COMMON_CRYPTO
+ifdef APPLE_COMMON_CRYPTO_SHA1
# Apple CommonCrypto requires chunking
SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
endif
@@ -1820,11 +1925,10 @@ ifdef BLK_SHA1
LIB_OBJS += block-sha1/sha1.o
BASIC_CFLAGS += -DSHA1_BLK
else
-ifdef APPLE_COMMON_CRYPTO
+ifdef APPLE_COMMON_CRYPTO_SHA1
COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
BASIC_CFLAGS += -DSHA1_APPLE
else
- DC_SHA1 := YesPlease
BASIC_CFLAGS += -DSHA1_DC
LIB_OBJS += sha1dc_git.o
ifdef DC_SHA1_EXTERNAL
@@ -1932,6 +2036,11 @@ endif
ifdef NO_REGEX
COMPAT_CFLAGS += -Icompat/regex
COMPAT_OBJS += compat/regex/regex.o
+else
+ifdef USE_ENHANCED_BASIC_REGULAR_EXPRESSIONS
+ COMPAT_CFLAGS += -DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS
+ COMPAT_OBJS += compat/regcomp_enhanced.o
+endif
endif
ifdef NATIVE_CRLF
BASIC_CFLAGS += -DNATIVE_CRLF
@@ -2041,11 +2150,13 @@ ifdef FSMONITOR_DAEMON_BACKEND
COMPAT_CFLAGS += -DHAVE_FSMONITOR_DAEMON_BACKEND
COMPAT_OBJS += compat/fsmonitor/fsm-listen-$(FSMONITOR_DAEMON_BACKEND).o
COMPAT_OBJS += compat/fsmonitor/fsm-health-$(FSMONITOR_DAEMON_BACKEND).o
+ COMPAT_OBJS += compat/fsmonitor/fsm-ipc-$(FSMONITOR_DAEMON_BACKEND).o
endif
ifdef FSMONITOR_OS_SETTINGS
COMPAT_CFLAGS += -DHAVE_FSMONITOR_OS_SETTINGS
COMPAT_OBJS += compat/fsmonitor/fsm-settings-$(FSMONITOR_OS_SETTINGS).o
+ COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o
endif
ifeq ($(TCLTK_PATH),)
@@ -2982,9 +3093,9 @@ GIT-BUILD-OPTIONS: FORCE
@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 DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
@echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+
@echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+
@echo X=\'$(X)\' >>$@+
@@ -3040,6 +3151,7 @@ else
@echo RUNTIME_PREFIX=\'false\' >>$@+
endif
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
+ @if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi
### Detect Python interpreter path changes
ifndef NO_PYTHON
@@ -3138,35 +3250,113 @@ check: $(GENERATED_H)
exit 1; \
fi
+COCCI_GEN_ALL = .build/contrib/coccinelle/ALL.cocci
+COCCI_GLOB = $(wildcard contrib/coccinelle/*.cocci)
+COCCI_RULES_TRACKED = $(COCCI_GLOB:%=.build/%)
+COCCI_RULES_TRACKED_NO_PENDING = $(filter-out %.pending.cocci,$(COCCI_RULES_TRACKED))
+COCCI_RULES =
+COCCI_RULES += $(COCCI_GEN_ALL)
+COCCI_RULES += $(COCCI_RULES_TRACKED)
+COCCI_NAMES =
+COCCI_NAMES += $(COCCI_RULES:.build/contrib/coccinelle/%.cocci=%)
+
+COCCICHECK_PENDING = $(filter %.pending.cocci,$(COCCI_RULES))
+COCCICHECK = $(filter-out $(COCCICHECK_PENDING),$(COCCI_RULES))
+
+COCCICHECK_PATCHES = $(COCCICHECK:%=%.patch)
+COCCICHECK_PATCHES_PENDING = $(COCCICHECK_PENDING:%=%.patch)
+
+COCCICHECK_PATCHES_INTREE = $(COCCICHECK_PATCHES:.build/%=%)
+COCCICHECK_PATCHES_PENDING_INTREE = $(COCCICHECK_PATCHES_PENDING:.build/%=%)
+
+# It's expensive to compute the many=many rules below, only eval them
+# on $(MAKECMDGOALS) that match these $(COCCI_RULES)
+COCCI_RULES_GLOB =
+COCCI_RULES_GLOB += cocci%
+COCCI_RULES_GLOB += .build/contrib/coccinelle/%
+COCCI_RULES_GLOB += $(COCCICHECK_PATCHES)
+COCCI_RULES_GLOB += $(COCCICHEC_PATCHES_PENDING)
+COCCI_RULES_GLOB += $(COCCICHECK_PATCHES_INTREE)
+COCCI_RULES_GLOB += $(COCCICHECK_PATCHES_PENDING_INTREE)
+COCCI_GOALS = $(filter $(COCCI_RULES_GLOB),$(MAKECMDGOALS))
+
COCCI_TEST_RES = $(wildcard contrib/coccinelle/tests/*.res)
-%.cocci.patch: %.cocci $(COCCI_SOURCES)
- $(QUIET_SPATCH) \
- if test $(SPATCH_BATCH_SIZE) = 0; then \
- limit=; \
- else \
- limit='-n $(SPATCH_BATCH_SIZE)'; \
- fi; \
- if ! echo $(COCCI_SOURCES) | xargs $$limit \
- $(SPATCH) $(SPATCH_FLAGS) \
- --sp-file $< --patch . \
- >$@+ 2>$@.log; \
+$(COCCI_RULES_TRACKED): .build/% : %
+ $(call mkdir_p_parent_template)
+ $(QUIET_CP)cp $< $@
+
+.build/contrib/coccinelle/FOUND_H_SOURCES: $(FOUND_H_SOURCES)
+ $(call mkdir_p_parent_template)
+ $(QUIET_GEN) >$@
+
+$(COCCI_GEN_ALL): $(COCCI_RULES_TRACKED_NO_PENDING)
+ $(call mkdir_p_parent_template)
+ $(QUIET_SPATCH_CAT)cat $^ >$@
+
+ifeq ($(COMPUTE_HEADER_DEPENDENCIES),no)
+SPATCH_USE_O_DEPENDENCIES =
+endif
+define cocci-rule
+
+## Rule for .build/$(1).patch/$(2); Params:
+# $(1) = e.g. ".build/contrib/coccinelle/free.cocci"
+# $(2) = e.g. "grep.c"
+# $(3) = e.g. "grep.o"
+COCCI_$(1:.build/contrib/coccinelle/%.cocci=%) += $(1).d/$(2).patch
+$(1).d/$(2).patch: GIT-SPATCH-DEFINES
+$(1).d/$(2).patch: $(if $(and $(SPATCH_USE_O_DEPENDENCIES),$(wildcard $(3))),$(3),.build/contrib/coccinelle/FOUND_H_SOURCES)
+$(1).d/$(2).patch: $(1)
+$(1).d/$(2).patch: $(1).d/%.patch : %
+ $$(call mkdir_p_parent_template)
+ $$(QUIET_SPATCH)if ! $$(SPATCH) $$(SPATCH_FLAGS) \
+ $$(SPATCH_INCLUDE_FLAGS) \
+ --sp-file $(1) --patch . $$< \
+ >$$@ 2>$$@.log; \
then \
- cat $@.log; \
+ echo "ERROR when applying '$(1)' to '$$<'; '$$@.log' follows:"; \
+ cat $$@.log; \
exit 1; \
- fi; \
- mv $@+ $@; \
- if test -s $@; \
+ fi
+endef
+
+define cocci-matrix
+
+$(foreach s,$(COCCI_SOURCES),$(call cocci-rule,$(c),$(s),$(s:%.c=%.o)))
+endef
+
+ifdef COCCI_GOALS
+$(eval $(foreach c,$(COCCI_RULES),$(call cocci-matrix,$(c))))
+endif
+
+define spatch-rule
+
+.build/contrib/coccinelle/$(1).cocci.patch: $$(COCCI_$(1))
+ $$(QUIET_SPATCH_CAT)cat $$^ >$$@ && \
+ if test -s $$@; \
then \
- echo ' ' SPATCH result: $@; \
+ echo ' ' SPATCH result: $$@; \
fi
+contrib/coccinelle/$(1).cocci.patch: .build/contrib/coccinelle/$(1).cocci.patch
+ $$(QUIET_CP)cp $$< $$@
+
+endef
+
+ifdef COCCI_GOALS
+$(eval $(foreach n,$(COCCI_NAMES),$(call spatch-rule,$(n))))
+endif
COCCI_TEST_RES_GEN = $(addprefix .build/,$(COCCI_TEST_RES))
+$(COCCI_TEST_RES_GEN): GIT-SPATCH-DEFINES
$(COCCI_TEST_RES_GEN): .build/%.res : %.c
$(COCCI_TEST_RES_GEN): .build/%.res : %.res
+ifdef SPATCH_CONCAT_COCCI
+$(COCCI_TEST_RES_GEN): .build/contrib/coccinelle/tests/%.res : $(COCCI_GEN_ALL)
+else
$(COCCI_TEST_RES_GEN): .build/contrib/coccinelle/tests/%.res : contrib/coccinelle/%.cocci
+endif
$(call mkdir_p_parent_template)
- $(QUIET_SPATCH_T)$(SPATCH) $(SPATCH_FLAGS) \
+ $(QUIET_SPATCH_TEST)$(SPATCH) $(SPATCH_TEST_FLAGS) \
--very-quiet --no-show-diff \
--sp-file $< -o $@ \
$(@:.build/%.res=%.c) && \
@@ -3177,11 +3367,15 @@ $(COCCI_TEST_RES_GEN): .build/contrib/coccinelle/tests/%.res : contrib/coccinell
coccicheck-test: $(COCCI_TEST_RES_GEN)
coccicheck: coccicheck-test
-coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/coccinelle/*.cocci)))
+ifdef SPATCH_CONCAT_COCCI
+coccicheck: contrib/coccinelle/ALL.cocci.patch
+else
+coccicheck: $(COCCICHECK_PATCHES_INTREE)
+endif
# See contrib/coccinelle/README
coccicheck-pending: coccicheck-test
-coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))
+coccicheck-pending: $(COCCICHECK_PATCHES_PENDING_INTREE)
.PHONY: coccicheck coccicheck-pending
@@ -3448,8 +3642,9 @@ profile-clean:
$(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))
cocciclean:
+ $(RM) GIT-SPATCH-DEFINES
$(RM) -r .build/contrib/coccinelle
- $(RM) contrib/coccinelle/*.cocci.patch*
+ $(RM) contrib/coccinelle/*.cocci.patch
clean: profile-clean coverage-clean cocciclean
$(RM) -r .build
diff --git a/RelNotes b/RelNotes
index a960781cc9..4da73c9a6d 120000
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes/2.38.5.txt \ No newline at end of file
+Documentation/RelNotes/2.41.0.txt \ No newline at end of file
diff --git a/abspath.c b/abspath.c
index 39e06b5848..d032f5dce5 100644
--- a/abspath.c
+++ b/abspath.c
@@ -1,4 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "strbuf.h"
/*
* Do not use this for inspecting *tracked* content. When path is a
@@ -280,3 +282,10 @@ char *prefix_filename(const char *pfx, const char *arg)
#endif
return strbuf_detach(&path, NULL);
}
+
+char *prefix_filename_except_for_dash(const char *pfx, const char *arg)
+{
+ if (!strcmp(arg, "-"))
+ return xstrdup(arg);
+ return prefix_filename(pfx, arg);
+}
diff --git a/abspath.h b/abspath.h
new file mode 100644
index 0000000000..7cd3de5e9d
--- /dev/null
+++ b/abspath.h
@@ -0,0 +1,33 @@
+#ifndef ABSPATH_H
+#define ABSPATH_H
+
+int is_directory(const char *);
+char *strbuf_realpath(struct strbuf *resolved, const char *path,
+ int die_on_error);
+char *strbuf_realpath_forgiving(struct strbuf *resolved, const char *path,
+ int die_on_error);
+char *real_pathdup(const char *path, int die_on_error);
+const char *absolute_path(const char *path);
+char *absolute_pathdup(const char *path);
+
+/*
+ * Concatenate "prefix" (if len is non-zero) and "path", with no
+ * connecting characters (so "prefix" should end with a "/").
+ * Unlike prefix_path, this should be used if the named file does
+ * not have to interact with index entry; i.e. name of a random file
+ * on the filesystem.
+ *
+ * The return value is always a newly allocated string (even if the
+ * prefix was empty).
+ */
+char *prefix_filename(const char *prefix, const char *path);
+
+/* Likewise, but path=="-" always yields "-" */
+char *prefix_filename_except_for_dash(const char *prefix, const char *path);
+
+static inline int is_absolute_path(const char *path)
+{
+ return is_dir_sep(path[0]) || has_dos_drive_prefix(path);
+}
+
+#endif /* ABSPATH_H */
diff --git a/add-interactive.c b/add-interactive.c
index f071b2a1b4..de877ca052 100644
--- a/add-interactive.c
+++ b/add-interactive.c
@@ -3,6 +3,8 @@
#include "color.h"
#include "config.h"
#include "diffcore.h"
+#include "gettext.h"
+#include "hex.h"
#include "revision.h"
#include "refs.h"
#include "string-list.h"
@@ -10,6 +12,7 @@
#include "dir.h"
#include "run-command.h"
#include "prompt.h"
+#include "tree.h"
static void init_color(struct repository *r, struct add_i_state *s,
const char *section_and_slot, char *dst,
@@ -530,8 +533,8 @@ static int get_modified_files(struct repository *r,
struct collection_status s = { 0 };
int i;
- if (discard_index(r->index) < 0 ||
- repo_read_index_preload(r, ps, 0) < 0)
+ discard_index(r->index);
+ if (repo_read_index_preload(r, ps, 0) < 0)
return error(_("could not read index"));
prefix_item_list_clear(files);
@@ -551,7 +554,7 @@ static int get_modified_files(struct repository *r,
opt.def = is_initial ?
empty_tree_oid_hex() : oid_to_hex(&head_oid);
- init_revisions(&rev, NULL);
+ repo_init_revisions(r, &rev, NULL);
setup_revisions(0, NULL, &rev, &opt);
rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
@@ -724,7 +727,7 @@ static int run_update(struct add_i_state *s, const struct pathspec *ps,
}
static void revert_from_diff(struct diff_queue_struct *q,
- struct diff_options *opt, void *data)
+ struct diff_options *opt, void *data UNUSED)
{
int i, add_flags = ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE;
@@ -997,18 +1000,17 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,
count = list_and_choose(s, files, opts);
opts->flags = 0;
if (count > 0) {
- struct strvec args = STRVEC_INIT;
+ struct child_process cmd = CHILD_PROCESS_INIT;
- strvec_pushl(&args, "git", "diff", "-p", "--cached",
+ strvec_pushl(&cmd.args, "git", "diff", "-p", "--cached",
oid_to_hex(!is_initial ? &oid :
s->r->hash_algo->empty_tree),
"--", NULL);
for (i = 0; i < files->items.nr; i++)
if (files->selected[i])
- strvec_push(&args,
+ strvec_push(&cmd.args,
files->items.items[i].string);
- res = run_command_v_opt(args.v, 0);
- strvec_clear(&args);
+ res = run_command(&cmd);
}
putchar('\n');
@@ -1157,8 +1159,8 @@ int run_add_i(struct repository *r, const struct pathspec *ps)
_("staged"), _("unstaged"), _("path"));
opts.list_opts.header = header.buf;
- if (discard_index(r->index) < 0 ||
- repo_read_index(r) < 0 ||
+ discard_index(r->index);
+ if (repo_read_index(r) < 0 ||
repo_refresh_and_write_index(r, REFRESH_QUIET, 0, 1,
NULL, NULL, NULL) < 0)
warning(_("could not refresh index"));
diff --git a/add-patch.c b/add-patch.c
index 33ecd8398a..8d770d203f 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -1,5 +1,11 @@
#include "cache.h"
#include "add-interactive.h"
+#include "advice.h"
+#include "alloc.h"
+#include "editor.h"
+#include "environment.h"
+#include "gettext.h"
+#include "object-name.h"
#include "strbuf.h"
#include "run-command.h"
#include "strvec.h"
@@ -414,7 +420,7 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
strvec_push(&args,
/* could be on an unborn branch */
!strcmp("HEAD", s->revision) &&
- get_oid("HEAD", &oid) ?
+ repo_get_oid(the_repository, "HEAD", &oid) ?
empty_tree_oid_hex() : s->revision);
}
color_arg_index = args.nr;
@@ -483,7 +489,8 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
if (!eol)
eol = pend;
- if (starts_with(p, "diff ")) {
+ if (starts_with(p, "diff ") ||
+ starts_with(p, "* Unmerged path ")) {
complete_file(marker, hunk);
ALLOC_GROW_BY(s->file_diff, s->file_diff_nr, 1,
file_diff_alloc);
@@ -1750,7 +1757,8 @@ int run_add_p(struct repository *r, enum add_p_mode mode,
s.mode = &patch_mode_add;
s.revision = revision;
- if (discard_index(r->index) < 0 || repo_read_index(r) < 0 ||
+ discard_index(r->index);
+ if (repo_read_index(r) < 0 ||
(!s.mode->index_only &&
repo_refresh_and_write_index(r, REFRESH_QUIET, 0, 1,
NULL, NULL, NULL) < 0) ||
diff --git a/advice.c b/advice.c
index fd18968943..d6232439c3 100644
--- a/advice.c
+++ b/advice.c
@@ -1,6 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "advice.h"
#include "config.h"
#include "color.h"
+#include "gettext.h"
#include "help.h"
#include "string-list.h"
@@ -44,6 +46,7 @@ static struct {
[ADVICE_COMMIT_BEFORE_MERGE] = { "commitBeforeMerge", 1 },
[ADVICE_DETACHED_HEAD] = { "detachedHead", 1 },
[ADVICE_SUGGEST_DETACHING_HEAD] = { "suggestDetachingHead", 1 },
+ [ADVICE_DIVERGING] = { "diverging", 1 },
[ADVICE_FETCH_SHOW_FORCED_UPDATES] = { "fetchShowForcedUpdates", 1 },
[ADVICE_GRAFT_FILE_DEPRECATED] = { "graftFileDeprecated", 1 },
[ADVICE_IGNORED_HOOK] = { "ignoredHook", 1 },
@@ -217,6 +220,14 @@ void NORETURN die_conclude_merge(void)
void NORETURN die_ff_impossible(void)
{
+ advise_if_enabled(ADVICE_DIVERGING,
+ _("Diverging branches can't be fast-forwarded, you need to either:\n"
+ "\n"
+ "\tgit merge --no-ff\n"
+ "\n"
+ "or:\n"
+ "\n"
+ "\tgit rebase\n"));
die(_("Not possible to fast-forward, aborting."));
}
diff --git a/advice.h b/advice.h
index 07e0f76833..0f584163f5 100644
--- a/advice.h
+++ b/advice.h
@@ -1,8 +1,6 @@
#ifndef ADVICE_H
#define ADVICE_H
-#include "git-compat-util.h"
-
struct string_list;
/*
@@ -21,6 +19,7 @@ struct string_list;
ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME,
ADVICE_COMMIT_BEFORE_MERGE,
ADVICE_DETACHED_HEAD,
+ ADVICE_DIVERGING,
ADVICE_SUGGEST_DETACHING_HEAD,
ADVICE_FETCH_SHOW_FORCED_UPDATES,
ADVICE_GRAFT_FILE_DEPRECATED,
diff --git a/alias.c b/alias.c
index 00abde0817..54a1a23d2c 100644
--- a/alias.c
+++ b/alias.c
@@ -1,6 +1,9 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "alias.h"
+#include "alloc.h"
#include "config.h"
+#include "gettext.h"
+#include "strbuf.h"
#include "string-list.h"
struct config_alias_data {
@@ -44,6 +47,23 @@ void list_aliases(struct string_list *list)
read_early_config(config_alias_cb, &data);
}
+void quote_cmdline(struct strbuf *buf, const char **argv)
+{
+ for (const char **argp = argv; *argp; argp++) {
+ if (argp != argv)
+ strbuf_addch(buf, ' ');
+ strbuf_addch(buf, '"');
+ for (const char *p = *argp; *p; p++) {
+ const char c = *p;
+
+ if (c == '"' || c =='\\')
+ strbuf_addch(buf, '\\');
+ strbuf_addch(buf, c);
+ }
+ strbuf_addch(buf, '"');
+ }
+}
+
#define SPLIT_CMDLINE_BAD_ENDING 1
#define SPLIT_CMDLINE_UNCLOSED_QUOTE 2
#define SPLIT_CMDLINE_ARGC_OVERFLOW 3
diff --git a/alias.h b/alias.h
index aef4843bb7..43db736484 100644
--- a/alias.h
+++ b/alias.h
@@ -1,9 +1,12 @@
#ifndef ALIAS_H
#define ALIAS_H
+struct strbuf;
struct string_list;
char *alias_lookup(const char *alias);
+/* Quote argv so buf can be parsed by split_cmdline() */
+void quote_cmdline(struct strbuf *buf, const char **argv);
int split_cmdline(char *cmdline, const char ***argv);
/* Takes a negative value returned by split_cmdline */
const char *split_cmdline_strerror(int cmdline_errno);
diff --git a/alloc.c b/alloc.c
index 27f697e4c8..377e80f5dd 100644
--- a/alloc.c
+++ b/alloc.c
@@ -8,11 +8,12 @@
* up with maximal alignment because it doesn't know what the object alignment
* for the new allocation is.
*/
-#include "cache.h"
+#include "git-compat-util.h"
#include "object.h"
#include "blob.h"
#include "tree.h"
#include "commit.h"
+#include "repository.h"
#include "tag.h"
#include "alloc.h"
diff --git a/alloc.h b/alloc.h
index 3f4a0ad310..4312db4bd0 100644
--- a/alloc.h
+++ b/alloc.h
@@ -17,4 +17,79 @@ void *alloc_object_node(struct repository *r);
struct alloc_state *allocate_alloc_state(void);
void clear_alloc_state(struct alloc_state *s);
+#define alloc_nr(x) (((x)+16)*3/2)
+
+/**
+ * Dynamically growing an array using realloc() is error prone and boring.
+ *
+ * Define your array with:
+ *
+ * - a pointer (`item`) that points at the array, initialized to `NULL`
+ * (although please name the variable based on its contents, not on its
+ * type);
+ *
+ * - an integer variable (`alloc`) that keeps track of how big the current
+ * allocation is, initialized to `0`;
+ *
+ * - another integer variable (`nr`) to keep track of how many elements the
+ * array currently has, initialized to `0`.
+ *
+ * Then before adding `n`th element to the item, call `ALLOC_GROW(item, n,
+ * alloc)`. This ensures that the array can hold at least `n` elements by
+ * calling `realloc(3)` and adjusting `alloc` variable.
+ *
+ * ------------
+ * sometype *item;
+ * size_t nr;
+ * size_t alloc
+ *
+ * for (i = 0; i < nr; i++)
+ * if (we like item[i] already)
+ * return;
+ *
+ * // we did not like any existing one, so add one
+ * ALLOC_GROW(item, nr + 1, alloc);
+ * item[nr++] = value you like;
+ * ------------
+ *
+ * You are responsible for updating the `nr` variable.
+ *
+ * If you need to specify the number of elements to allocate explicitly
+ * then use the macro `REALLOC_ARRAY(item, alloc)` instead of `ALLOC_GROW`.
+ *
+ * Consider using ALLOC_GROW_BY instead of ALLOC_GROW as it has some
+ * added niceties.
+ *
+ * DO NOT USE any expression with side-effect for 'x', 'nr', or 'alloc'.
+ */
+#define ALLOC_GROW(x, nr, alloc) \
+ do { \
+ if ((nr) > alloc) { \
+ if (alloc_nr(alloc) < (nr)) \
+ alloc = (nr); \
+ else \
+ alloc = alloc_nr(alloc); \
+ REALLOC_ARRAY(x, alloc); \
+ } \
+ } while (0)
+
+/*
+ * Similar to ALLOC_GROW but handles updating of the nr value and
+ * zeroing the bytes of the newly-grown array elements.
+ *
+ * DO NOT USE any expression with side-effect for any of the
+ * arguments.
+ */
+#define ALLOC_GROW_BY(x, nr, increase, alloc) \
+ do { \
+ if (increase) { \
+ size_t new_nr = nr + (increase); \
+ if (new_nr < nr) \
+ BUG("negative growth in ALLOC_GROW_BY"); \
+ ALLOC_GROW(x, new_nr, alloc); \
+ memset((x) + nr, 0, sizeof(*(x)) * (increase)); \
+ nr = new_nr; \
+ } \
+ } while (0)
+
#endif
diff --git a/apply.c b/apply.c
index 1ac3a028a0..6212ab3a1b 100644
--- a/apply.c
+++ b/apply.c
@@ -8,20 +8,32 @@
*/
#include "cache.h"
+#include "abspath.h"
+#include "alloc.h"
+#include "base85.h"
#include "config.h"
#include "object-store.h"
#include "blob.h"
#include "delta.h"
#include "diff.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "xdiff-interface.h"
#include "ll-merge.h"
#include "lockfile.h"
+#include "object-name.h"
+#include "object-file.h"
#include "parse-options.h"
#include "quote.h"
#include "rerere.h"
#include "apply.h"
#include "entry.h"
+#include "setup.h"
+#include "symlinks.h"
+#include "ws.h"
+#include "wrapper.h"
struct gitdiff_data {
struct strbuf *root;
@@ -125,7 +137,7 @@ void clear_apply_state(struct apply_state *state)
/* &state->fn_table is cleared at the end of apply_patch() */
}
-static void mute_routine(const char *msg, va_list params)
+static void mute_routine(const char *msg UNUSED, va_list params UNUSED)
{
/* do nothing */
}
@@ -386,9 +398,19 @@ static void say_patch_name(FILE *output, const char *fmt, struct patch *patch)
#define SLOP (16)
+/*
+ * apply.c isn't equipped to handle arbitrarily large patches, because
+ * it intermingles `unsigned long` with `int` for the type used to store
+ * buffer lengths.
+ *
+ * Only process patches that are just shy of 1 GiB large in order to
+ * avoid any truncation or overflow issues.
+ */
+#define MAX_APPLY_SIZE (1024UL * 1024 * 1023)
+
static int read_patch_file(struct strbuf *sb, int fd)
{
- if (strbuf_read(sb, fd, 0) < 0)
+ if (strbuf_read(sb, fd, 0) < 0 || sb->len >= MAX_APPLY_SIZE)
return error_errno("git apply: failed to read");
/*
@@ -892,9 +914,9 @@ static int parse_traditional_patch(struct apply_state *state,
return 0;
}
-static int gitdiff_hdrend(struct gitdiff_data *state,
- const char *line,
- struct patch *patch)
+static int gitdiff_hdrend(struct gitdiff_data *state UNUSED,
+ const char *line UNUSED,
+ struct patch *patch UNUSED)
{
return 1;
}
@@ -1044,7 +1066,7 @@ static int gitdiff_renamedst(struct gitdiff_data *state,
return 0;
}
-static int gitdiff_similarity(struct gitdiff_data *state,
+static int gitdiff_similarity(struct gitdiff_data *state UNUSED,
const char *line,
struct patch *patch)
{
@@ -1054,7 +1076,7 @@ static int gitdiff_similarity(struct gitdiff_data *state,
return 0;
}
-static int gitdiff_dissimilarity(struct gitdiff_data *state,
+static int gitdiff_dissimilarity(struct gitdiff_data *state UNUSED,
const char *line,
struct patch *patch)
{
@@ -1104,9 +1126,9 @@ static int gitdiff_index(struct gitdiff_data *state,
* This is normal for a diff that doesn't change anything: we'll fall through
* into the next diff. Tell the parser to break out.
*/
-static int gitdiff_unrecognized(struct gitdiff_data *state,
- const char *line,
- struct patch *patch)
+static int gitdiff_unrecognized(struct gitdiff_data *state UNUSED,
+ const char *line UNUSED,
+ struct patch *patch UNUSED)
{
return 1;
}
@@ -2903,7 +2925,7 @@ static int apply_one_fragment(struct apply_state *state,
break;
case ' ':
if (plen && (ws_rule & WS_BLANK_AT_EOF) &&
- ws_blank_line(patch + 1, plen, ws_rule))
+ ws_blank_line(patch + 1, plen))
is_blank_context = 1;
/* fallthrough */
case '-':
@@ -2932,7 +2954,7 @@ static int apply_one_fragment(struct apply_state *state,
(first == '+' ? 0 : LINE_COMMON));
if (first == '+' &&
(ws_rule & WS_BLANK_AT_EOF) &&
- ws_blank_line(patch + 1, plen, ws_rule))
+ ws_blank_line(patch + 1, plen))
added_blank_line = 1;
break;
case '@': case '\\':
@@ -3191,7 +3213,8 @@ static int apply_binary(struct apply_state *state,
unsigned long size;
char *result;
- result = read_object_file(&oid, &type, &size);
+ result = repo_read_object_file(the_repository, &oid, &type,
+ &size);
if (!result)
return error(_("the necessary postimage %s for "
"'%s' cannot be read"),
@@ -3254,7 +3277,8 @@ static int read_blob_object(struct strbuf *buf, const struct object_id *oid, uns
unsigned long sz;
char *result;
- result = read_object_file(oid, &type, &sz);
+ result = repo_read_object_file(the_repository, oid, &type,
+ &sz);
if (!result)
return -1;
/* XXX read_sha1_file NUL-terminates */
@@ -3482,7 +3506,8 @@ static int resolve_to(struct image *image, const struct object_id *result_id)
clear_image(image);
- image->buf = read_object_file(result_id, &type, &size);
+ image->buf = repo_read_object_file(the_repository, result_id, &type,
+ &size);
if (!image->buf || type != OBJ_BLOB)
die("unable to read blob object %s", oid_to_hex(result_id));
image->len = size;
@@ -3600,7 +3625,7 @@ static int try_threeway(struct apply_state *state,
/* Preimage the patch was prepared for */
if (patch->is_new)
write_object_file("", 0, OBJ_BLOB, &pre_oid);
- else if (get_oid(patch->old_oid_prefix, &pre_oid) ||
+ else if (repo_get_oid(the_repository, patch->old_oid_prefix, &pre_oid) ||
read_blob_object(&buf, &pre_oid, patch->old_mode))
return error(_("repository lacks the necessary blob to perform 3-way merge."));
@@ -4095,7 +4120,7 @@ static int preimage_oid_in_gitlink_patch(struct patch *p, struct object_id *oid)
static int build_fake_ancestor(struct apply_state *state, struct patch *list)
{
struct patch *patch;
- struct index_state result = { NULL };
+ struct index_state result = INDEX_STATE_INIT(state->repo);
struct lock_file lock = LOCK_INIT;
int res;
@@ -4117,7 +4142,7 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)
else
return error(_("sha1 information is lacking or "
"useless for submodule %s"), name);
- } else if (!get_oid_blob(patch->old_oid_prefix, &oid)) {
+ } else if (!repo_get_oid_blob(the_repository, patch->old_oid_prefix, &oid)) {
; /* ok */
} else if (!patch->lines_added && !patch->lines_deleted) {
/* mode-only change: update the current */
diff --git a/apply.h b/apply.h
index b9f18ce87d..7cd38b1443 100644
--- a/apply.h
+++ b/apply.h
@@ -1,7 +1,7 @@
#ifndef APPLY_H
#define APPLY_H
-#include "hash.h"
+#include "hash-ll.h"
#include "lockfile.h"
#include "string-list.h"
#include "strmap.h"
diff --git a/archive-tar.c b/archive-tar.c
index 3e4822b684..4cd81d8161 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -1,13 +1,18 @@
/*
* Copyright (c) 2005, 2006 Rene Scharfe
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "config.h"
+#include "gettext.h"
+#include "git-zlib.h"
+#include "hex.h"
#include "tar.h"
#include "archive.h"
#include "object-store.h"
#include "streaming.h"
#include "run-command.h"
+#include "write-or-die.h"
#define RECORDSIZE (512)
#define BLOCKSIZE (RECORDSIZE * 20)
@@ -498,6 +503,7 @@ static int write_tar_filter_archive(const struct archiver *ar,
strvec_push(&filter.args, cmd.buf);
filter.use_shell = 1;
filter.in = -1;
+ filter.silent_exec_failure = 1;
if (start_command(&filter) < 0)
die_errno(_("unable to start '%s' filter"), cmd.buf);
diff --git a/archive-zip.c b/archive-zip.c
index 0456f1ebf1..d0d065a312 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -1,13 +1,17 @@
/*
* Copyright (c) 2006 Rene Scharfe
*/
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "archive.h"
+#include "gettext.h"
+#include "git-zlib.h"
+#include "hex.h"
#include "streaming.h"
#include "utf8.h"
#include "object-store.h"
#include "userdiff.h"
+#include "write-or-die.h"
#include "xdiff-interface.h"
#include "date.h"
diff --git a/archive.c b/archive.c
index cc1087262f..641baad627 100644
--- a/archive.c
+++ b/archive.c
@@ -1,8 +1,17 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
+#include "convert.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
+#include "pretty.h"
+#include "setup.h"
#include "refs.h"
#include "object-store.h"
#include "commit.h"
+#include "tree.h"
#include "tree-walk.h"
#include "attr.h"
#include "archive.h"
@@ -59,7 +68,8 @@ static void format_subst(const struct commit *commit,
strbuf_add(&fmt, b + 8, c - b - 8);
strbuf_add(buf, src, b - src);
- format_commit_message(commit, fmt.buf, buf, ctx);
+ repo_format_commit_message(the_repository, commit, fmt.buf,
+ buf, ctx);
len -= c + 1 - src;
src = c + 1;
}
@@ -84,7 +94,7 @@ static void *object_file_to_archive(const struct archiver_args *args,
(args->tree ? &args->tree->object.oid : NULL), oid);
path += args->baselen;
- buffer = read_object_file(oid, type, sizep);
+ buffer = repo_read_object_file(the_repository, oid, type, sizep);
if (buffer && S_ISREG(mode)) {
struct strbuf buf = STRBUF_INIT;
size_t size = 0;
@@ -120,7 +130,7 @@ static const struct attr_check *get_archive_attrs(struct index_state *istate,
static struct attr_check *check;
if (!check)
check = attr_check_initl("export-ignore", "export-subst", NULL);
- git_check_attr(istate, path, check);
+ git_check_attr(istate, NULL, path, check);
return check;
}
@@ -166,6 +176,29 @@ static int write_archive_entry(const struct object_id *oid, const char *base,
args->convert = check_attr_export_subst(check);
}
+ if (args->prefix) {
+ static struct strbuf new_path = STRBUF_INIT;
+ static struct strbuf buf = STRBUF_INIT;
+ const char *rel;
+
+ rel = relative_path(path_without_prefix, args->prefix, &buf);
+
+ /*
+ * We don't add an entry for the current working
+ * directory when we are at the root; skip it also when
+ * we're in a subdirectory or submodule. Skip entries
+ * higher up as well.
+ */
+ if (!strcmp(rel, "./") || starts_with(rel, "../"))
+ return S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0;
+
+ /* rel can refer to path, so don't edit it in place */
+ strbuf_reset(&new_path);
+ strbuf_add(&new_path, args->base, args->baselen);
+ strbuf_addstr(&new_path, rel);
+ strbuf_swap(&path, &new_path);
+ }
+
if (args->verbose)
fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
@@ -401,6 +434,27 @@ static int reject_entry(const struct object_id *oid UNUSED,
return ret;
}
+static int reject_outside(const struct object_id *oid UNUSED,
+ struct strbuf *base, const char *filename,
+ unsigned mode, void *context)
+{
+ struct archiver_args *args = context;
+ struct strbuf buf = STRBUF_INIT;
+ struct strbuf path = STRBUF_INIT;
+ int ret = 0;
+
+ if (S_ISDIR(mode))
+ return READ_TREE_RECURSIVE;
+
+ strbuf_addbuf(&path, base);
+ strbuf_addstr(&path, filename);
+ if (starts_with(relative_path(path.buf, args->prefix, &buf), "../"))
+ ret = -1;
+ strbuf_release(&buf);
+ strbuf_release(&path);
+ return ret;
+}
+
static int path_exists(struct archiver_args *args, const char *path)
{
const char *paths[] = { path, NULL };
@@ -408,8 +462,13 @@ static int path_exists(struct archiver_args *args, const char *path)
int ret;
ctx.args = args;
- parse_pathspec(&ctx.pathspec, 0, 0, "", paths);
+ parse_pathspec(&ctx.pathspec, 0, PATHSPEC_PREFER_CWD,
+ args->prefix, paths);
ctx.pathspec.recursive = 1;
+ if (args->prefix && read_tree(args->repo, args->tree, &ctx.pathspec,
+ reject_outside, args))
+ die(_("pathspec '%s' matches files outside the "
+ "current directory"), path);
ret = read_tree(args->repo, args->tree,
&ctx.pathspec,
reject_entry, &ctx);
@@ -425,9 +484,8 @@ static void parse_pathspec_arg(const char **pathspec,
* Also if pathspec patterns are dependent, we're in big
* trouble as we test each one separately
*/
- parse_pathspec(&ar_args->pathspec, 0,
- PATHSPEC_PREFER_FULL,
- "", pathspec);
+ parse_pathspec(&ar_args->pathspec, 0, PATHSPEC_PREFER_CWD,
+ ar_args->prefix, pathspec);
ar_args->pathspec.recursive = 1;
if (pathspec) {
while (*pathspec) {
@@ -439,8 +497,7 @@ static void parse_pathspec_arg(const char **pathspec,
}
static void parse_treeish_arg(const char **argv,
- struct archiver_args *ar_args, const char *prefix,
- int remote)
+ struct archiver_args *ar_args, int remote)
{
const char *name = argv[0];
const struct object_id *commit_oid;
@@ -455,13 +512,14 @@ static void parse_treeish_arg(const char **argv,
const char *colon = strchrnul(name, ':');
int refnamelen = colon - name;
- if (!dwim_ref(name, refnamelen, &oid, &ref, 0))
+ if (!repo_dwim_ref(the_repository, name, refnamelen, &oid, &ref, 0))
die(_("no such ref: %.*s"), refnamelen, name);
} else {
- dwim_ref(name, strlen(name), &oid, &ref, 0);
+ repo_dwim_ref(the_repository, name, strlen(name), &oid, &ref,
+ 0);
}
- if (get_oid(name, &oid))
+ if (repo_get_oid(the_repository, name, &oid))
die(_("not a valid object name: %s"), name);
commit = lookup_commit_reference_gently(ar_args->repo, &oid, 1);
@@ -472,25 +530,13 @@ static void parse_treeish_arg(const char **argv,
commit_oid = NULL;
archive_time = time(NULL);
}
+ if (ar_args->mtime_option)
+ archive_time = approxidate(ar_args->mtime_option);
tree = parse_tree_indirect(&oid);
if (!tree)
die(_("not a tree object: %s"), oid_to_hex(&oid));
- if (prefix) {
- struct object_id tree_oid;
- unsigned short mode;
- int err;
-
- err = get_tree_entry(ar_args->repo,
- &tree->object.oid,
- prefix, &tree_oid,
- &mode);
- if (err || !S_ISDIR(mode))
- die(_("current working directory is untracked"));
-
- tree = parse_tree_indirect(&tree_oid);
- }
ar_args->refname = ref;
ar_args->tree = tree;
ar_args->commit_oid = commit_oid;
@@ -498,7 +544,7 @@ static void parse_treeish_arg(const char **argv,
ar_args->time = archive_time;
}
-static void extra_file_info_clear(void *util, const char *str)
+static void extra_file_info_clear(void *util, const char *str UNUSED)
{
struct extra_file_info *info = util;
free(info->base);
@@ -586,6 +632,7 @@ static int parse_archive_args(int argc, const char **argv,
const char *remote = NULL;
const char *exec = NULL;
const char *output = NULL;
+ const char *mtime_option = NULL;
int compression_level = -1;
int verbose = 0;
int i;
@@ -607,6 +654,9 @@ static int parse_archive_args(int argc, const char **argv,
OPT_BOOL(0, "worktree-attributes", &worktree_attributes,
N_("read .gitattributes in working directory")),
OPT__VERBOSE(&verbose, N_("report archived files on stderr")),
+ { OPTION_STRING, 0, "mtime", &mtime_option, N_("time"),
+ N_("set modification time of archive entries"),
+ PARSE_OPT_NONEG },
OPT_NUMBER_CALLBACK(&compression_level,
N_("set compression level"), number_callback),
OPT_GROUP(""),
@@ -668,6 +718,7 @@ static int parse_archive_args(int argc, const char **argv,
args->base = base;
args->baselen = strlen(base);
args->worktree_attributes = worktree_attributes;
+ args->mtime_option = mtime_option;
return argc;
}
@@ -703,13 +754,14 @@ int write_archive(int argc, const char **argv, const char *prefix,
setup_git_directory();
}
- parse_treeish_arg(argv, &args, prefix, remote);
+ parse_treeish_arg(argv, &args, remote);
parse_pathspec_arg(argv + 1, &args);
rc = ar->write_archive(ar, &args);
string_list_clear_func(&args.extra_files, extra_file_info_clear);
free(args.refname);
+ clear_pathspec(&args.pathspec);
return rc;
}
diff --git a/archive.h b/archive.h
index 08bed3ed3a..3a4bdfbd07 100644
--- a/archive.h
+++ b/archive.h
@@ -1,8 +1,9 @@
#ifndef ARCHIVE_H
#define ARCHIVE_H
-#include "cache.h"
+#include "object-name.h"
#include "pathspec.h"
+#include "string-list.h"
struct repository;
struct pretty_print_context;
@@ -16,6 +17,7 @@ struct archiver_args {
struct tree *tree;
const struct object_id *commit_oid;
const struct commit *commit;
+ const char *mtime_option;
timestamp_t time;
struct pathspec pathspec;
unsigned int verbose : 1;
diff --git a/attr.c b/attr.c
index 9922529b58..ddf2b0cbc2 100644
--- a/attr.c
+++ b/attr.c
@@ -7,13 +7,20 @@
*/
#include "cache.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
#include "exec-cmd.h"
#include "attr.h"
#include "dir.h"
+#include "gettext.h"
#include "utf8.h"
#include "quote.h"
+#include "revision.h"
+#include "object-store.h"
+#include "setup.h"
#include "thread-utils.h"
+#include "tree-walk.h"
const char git_attr__true[] = "(builtin)true";
const char git_attr__false[] = "\0(builtin)false";
@@ -603,8 +610,7 @@ struct attr_check *attr_check_dup(const struct attr_check *check)
ret->nr = check->nr;
ret->alloc = check->alloc;
- ALLOC_ARRAY(ret->items, ret->nr);
- COPY_ARRAY(ret->items, check->items, ret->nr);
+ DUP_ARRAY(ret->items, check->items, ret->nr);
return ret;
}
@@ -745,13 +751,61 @@ static struct attr_stack *read_attr_from_file(const char *path, unsigned flags)
return res;
}
-static struct attr_stack *read_attr_from_index(struct index_state *istate,
- const char *path,
- unsigned flags)
+static struct attr_stack *read_attr_from_buf(char *buf, const char *path,
+ unsigned flags)
{
struct attr_stack *res;
- char *buf, *sp;
+ char *sp;
int lineno = 0;
+
+ if (!buf)
+ return NULL;
+
+ CALLOC_ARRAY(res, 1);
+ for (sp = buf; *sp;) {
+ char *ep;
+ int more;
+
+ ep = strchrnul(sp, '\n');
+ more = (*ep == '\n');
+ *ep = '\0';
+ handle_attr_line(res, sp, path, ++lineno, flags);
+ sp = ep + more;
+ }
+ free(buf);
+
+ return res;
+}
+
+static struct attr_stack *read_attr_from_blob(struct index_state *istate,
+ const struct object_id *tree_oid,
+ const char *path, unsigned flags)
+{
+ struct object_id oid;
+ unsigned long sz;
+ enum object_type type;
+ void *buf;
+ unsigned short mode;
+
+ if (!tree_oid)
+ return NULL;
+
+ if (get_tree_entry(istate->repo, tree_oid, path, &oid, &mode))
+ return NULL;
+
+ buf = repo_read_object_file(istate->repo, &oid, &type, &sz);
+ if (!buf || type != OBJ_BLOB) {
+ free(buf);
+ return NULL;
+ }
+
+ return read_attr_from_buf(buf, path, flags);
+}
+
+static struct attr_stack *read_attr_from_index(struct index_state *istate,
+ const char *path, unsigned flags)
+{
+ char *buf;
unsigned long size;
if (!istate)
@@ -779,28 +833,19 @@ static struct attr_stack *read_attr_from_index(struct index_state *istate,
return NULL;
}
- CALLOC_ARRAY(res, 1);
- for (sp = buf; *sp; ) {
- char *ep;
- int more;
-
- ep = strchrnul(sp, '\n');
- more = (*ep == '\n');
- *ep = '\0';
- handle_attr_line(res, sp, path, ++lineno, flags);
- sp = ep + more;
- }
- free(buf);
- return res;
+ return read_attr_from_buf(buf, path, flags);
}
static struct attr_stack *read_attr(struct index_state *istate,
+ const struct object_id *tree_oid,
const char *path, unsigned flags)
{
struct attr_stack *res = NULL;
if (direction == GIT_ATTR_INDEX) {
res = read_attr_from_index(istate, path, flags);
+ } else if (tree_oid) {
+ res = read_attr_from_blob(istate, tree_oid, path, flags);
} else if (!is_bare_repository()) {
if (direction == GIT_ATTR_CHECKOUT) {
res = read_attr_from_index(istate, path, flags);
@@ -860,6 +905,7 @@ static void push_stack(struct attr_stack **attr_stack_p,
}
static void bootstrap_attr_stack(struct index_state *istate,
+ const struct object_id *tree_oid,
struct attr_stack **stack)
{
struct attr_stack *e;
@@ -885,7 +931,7 @@ static void bootstrap_attr_stack(struct index_state *istate,
}
/* root directory */
- e = read_attr(istate, GITATTRIBUTES_FILE, flags | READ_ATTR_NOFOLLOW);
+ e = read_attr(istate, tree_oid, GITATTRIBUTES_FILE, flags | READ_ATTR_NOFOLLOW);
push_stack(stack, e, xstrdup(""), 0);
/* info frame */
@@ -899,6 +945,7 @@ static void bootstrap_attr_stack(struct index_state *istate,
}
static void prepare_attr_stack(struct index_state *istate,
+ const struct object_id *tree_oid,
const char *path, int dirlen,
struct attr_stack **stack)
{
@@ -920,7 +967,7 @@ static void prepare_attr_stack(struct index_state *istate,
* .gitattributes in deeper directories to shallower ones,
* and finally use the built-in set as the default.
*/
- bootstrap_attr_stack(istate, stack);
+ bootstrap_attr_stack(istate, tree_oid, stack);
/*
* Pop the "info" one that is always at the top of the stack.
@@ -975,7 +1022,7 @@ static void prepare_attr_stack(struct index_state *istate,
strbuf_add(&pathbuf, path + pathbuf.len, (len - pathbuf.len));
strbuf_addf(&pathbuf, "/%s", GITATTRIBUTES_FILE);
- next = read_attr(istate, pathbuf.buf, READ_ATTR_NOFOLLOW);
+ next = read_attr(istate, tree_oid, pathbuf.buf, READ_ATTR_NOFOLLOW);
/* reset the pathbuf to not include "/.gitattributes" */
strbuf_setlen(&pathbuf, len);
@@ -1095,8 +1142,8 @@ static void determine_macros(struct all_attrs_item *all_attrs,
* Otherwise all attributes are collected.
*/
static void collect_some_attrs(struct index_state *istate,
- const char *path,
- struct attr_check *check)
+ const struct object_id *tree_oid,
+ const char *path, struct attr_check *check)
{
int pathlen, rem, dirlen;
const char *cp, *last_slash = NULL;
@@ -1115,7 +1162,7 @@ static void collect_some_attrs(struct index_state *istate,
dirlen = 0;
}
- prepare_attr_stack(istate, path, dirlen, &check->stack);
+ prepare_attr_stack(istate, tree_oid, path, dirlen, &check->stack);
all_attrs_init(&g_attr_hashmap, check);
determine_macros(check->all_attrs, check->stack);
@@ -1124,12 +1171,12 @@ static void collect_some_attrs(struct index_state *istate,
}
void git_check_attr(struct index_state *istate,
- const char *path,
+ const struct object_id *tree_oid, const char *path,
struct attr_check *check)
{
int i;
- collect_some_attrs(istate, path, check);
+ collect_some_attrs(istate, tree_oid, path, check);
for (i = 0; i < check->nr; i++) {
unsigned int n = check->items[i].attr->attr_nr;
@@ -1140,13 +1187,13 @@ void git_check_attr(struct index_state *istate,
}
}
-void git_all_attrs(struct index_state *istate,
+void git_all_attrs(struct index_state *istate, const struct object_id *tree_oid,
const char *path, struct attr_check *check)
{
int i;
attr_check_reset(check);
- collect_some_attrs(istate, path, check);
+ collect_some_attrs(istate, tree_oid, path, check);
for (i = 0; i < check->all_attrs_nr; i++) {
const char *name = check->all_attrs[i].attr->name;
diff --git a/attr.h b/attr.h
index 2f22dffadb..9884ea2bc6 100644
--- a/attr.h
+++ b/attr.h
@@ -45,7 +45,7 @@
* const char *path;
*
* setup_check();
- * git_check_attr(path, check);
+ * git_check_attr(&the_index, tree_oid, path, check);
* ------------
*
* - Act on `.value` member of the result, left in `check->items[]`:
@@ -120,6 +120,7 @@
#define ATTR_MAX_FILE_SIZE (100 * 1024 * 1024)
struct index_state;
+struct object_id;
/**
* An attribute is an opaque object that is identified by its name. Pass the
@@ -202,13 +203,14 @@ void attr_check_free(struct attr_check *check);
const char *git_attr_name(const struct git_attr *);
void git_check_attr(struct index_state *istate,
- const char *path, struct attr_check *check);
+ const struct object_id *tree_oid, const char *path,
+ struct attr_check *check);
/*
* Retrieve all attributes that apply to the specified path.
* check holds the attributes and their values.
*/
-void git_all_attrs(struct index_state *istate,
+void git_all_attrs(struct index_state *istate, const struct object_id *tree_oid,
const char *path, struct attr_check *check);
enum git_attr_direction {
diff --git a/banned.h b/banned.h
index 6ccf46bc19..44e76bd90a 100644
--- a/banned.h
+++ b/banned.h
@@ -18,6 +18,10 @@
#define strncpy(x,y,n) BANNED(strncpy)
#undef strncat
#define strncat(x,y,n) BANNED(strncat)
+#undef strtok
+#define strtok(x,y) BANNED(strtok)
+#undef strtok_r
+#define strtok_r(x,y,z) BANNED(strtok_r)
#undef sprintf
#undef vsprintf
diff --git a/base85.c b/base85.c
index 5ca601ee14..bbacdca31b 100644
--- a/base85.c
+++ b/base85.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "base85.h"
#undef DEBUG_85
diff --git a/base85.h b/base85.h
new file mode 100644
index 0000000000..c835086e09
--- /dev/null
+++ b/base85.h
@@ -0,0 +1,7 @@
+#ifndef BASE85_H
+#define BASE85_H
+
+int decode_85(char *dst, const char *line, int linelen);
+void encode_85(char *buf, const unsigned char *data, int bytes);
+
+#endif /* BASE85_H */
diff --git a/bisect.c b/bisect.c
index fd581b85a7..8d5f8e5885 100644
--- a/bisect.c
+++ b/bisect.c
@@ -1,7 +1,10 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "commit.h"
#include "diff.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "revision.h"
#include "refs.h"
#include "list-objects.h"
@@ -14,6 +17,7 @@
#include "strvec.h"
#include "commit-slab.h"
#include "commit-reach.h"
+#include "object-name.h"
#include "object-store.h"
#include "dir.h"
@@ -22,8 +26,6 @@ static struct oid_array skipped_revs;
static struct object_id *current_bad_oid;
-static const char *argv_checkout[] = {"checkout", "-q", NULL, "--", NULL};
-
static const char *term_bad;
static const char *term_good;
@@ -150,8 +152,9 @@ static void show_list(const char *debug, int counted, int nr,
unsigned commit_flags = commit->object.flags;
enum object_type type;
unsigned long size;
- char *buf = read_object_file(&commit->object.oid, &type,
- &size);
+ char *buf = repo_read_object_file(the_repository,
+ &commit->object.oid, &type,
+ &size);
const char *subject_start;
int subject_len;
@@ -474,7 +477,6 @@ static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START")
static GIT_PATH_FUNC(git_path_bisect_log, "BISECT_LOG")
static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS")
static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT")
-static GIT_PATH_FUNC(git_path_head_name, "head-name")
static void read_bisect_paths(struct strvec *array)
{
@@ -729,20 +731,22 @@ static int is_expected_rev(const struct object_id *oid)
enum bisect_error bisect_checkout(const struct object_id *bisect_rev,
int no_checkout)
{
- char bisect_rev_hex[GIT_MAX_HEXSZ + 1];
struct commit *commit;
struct pretty_print_context pp = {0};
struct strbuf commit_msg = STRBUF_INIT;
- oid_to_hex_r(bisect_rev_hex, bisect_rev);
update_ref(NULL, "BISECT_EXPECTED_REV", bisect_rev, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
- argv_checkout[2] = bisect_rev_hex;
if (no_checkout) {
update_ref(NULL, "BISECT_HEAD", bisect_rev, NULL, 0,
UPDATE_REFS_DIE_ON_ERR);
} else {
- if (run_command_v_opt(argv_checkout, RUN_GIT_CMD))
+ struct child_process cmd = CHILD_PROCESS_INIT;
+
+ cmd.git_cmd = 1;
+ strvec_pushl(&cmd.args, "checkout", "-q",
+ oid_to_hex(bisect_rev), "--", NULL);
+ if (run_command(&cmd))
/*
* Errors in `run_command()` itself, signaled by res < 0,
* and errors in the child process, signaled by res > 0
@@ -752,7 +756,8 @@ enum bisect_error bisect_checkout(const struct object_id *bisect_rev,
}
commit = lookup_commit_reference(the_repository, bisect_rev);
- format_commit_message(commit, "[%H] %s%n", &commit_msg, &pp);
+ repo_format_commit_message(the_repository, commit, "[%H] %s%n",
+ &commit_msg, &pp);
fputs(commit_msg.buf, stdout);
strbuf_release(&commit_msg);
@@ -847,7 +852,8 @@ static enum bisect_error check_merge_bases(int rev_nr, struct commit **rev, int
enum bisect_error res = BISECT_OK;
struct commit_list *result;
- result = get_merge_bases_many(rev[0], rev_nr - 1, rev + 1);
+ result = repo_get_merge_bases_many(the_repository, rev[0], rev_nr - 1,
+ rev + 1);
for (; result; result = result->next) {
const struct object_id *mb = &result->item->object.oid;
@@ -1188,8 +1194,6 @@ int bisect_clean_state(void)
unlink_or_warn(git_path_bisect_run());
unlink_or_warn(git_path_bisect_terms());
unlink_or_warn(git_path_bisect_first_parent());
- /* Cleanup head-name if it got left by an old version of git-bisect */
- unlink_or_warn(git_path_head_name());
/*
* Cleanup BISECT_START last to support the --no-checkout option
* introduced in the commit 4796e823a.
diff --git a/blame.c b/blame.c
index 8bfeaa1c63..b830654062 100644
--- a/blame.c
+++ b/blame.c
@@ -3,9 +3,14 @@
#include "object-store.h"
#include "cache-tree.h"
#include "mergesort.h"
+#include "convert.h"
#include "diff.h"
#include "diffcore.h"
+#include "gettext.h"
+#include "hex.h"
+#include "setup.h"
#include "tag.h"
+#include "trace2.h"
#include "blame.h"
#include "alloc.h"
#include "commit-slab.h"
@@ -176,12 +181,12 @@ static void set_commit_buffer_from_strbuf(struct repository *r,
static struct commit *fake_working_tree_commit(struct repository *r,
struct diff_options *opt,
const char *path,
- const char *contents_from)
+ const char *contents_from,
+ struct object_id *oid)
{
struct commit *commit;
struct blame_origin *origin;
struct commit_list **parent_tail, *parent;
- struct object_id head_oid;
struct strbuf buf = STRBUF_INIT;
const char *ident;
time_t now;
@@ -197,17 +202,18 @@ static struct commit *fake_working_tree_commit(struct repository *r,
commit->date = now;
parent_tail = &commit->parents;
- if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, &head_oid, NULL))
- die("no such ref: HEAD");
-
- parent_tail = append_parent(r, parent_tail, &head_oid);
+ parent_tail = append_parent(r, parent_tail, oid);
append_merge_parents(r, parent_tail);
verify_working_tree_path(r, commit, path);
origin = make_origin(commit, path);
- ident = fmt_ident("Not Committed Yet", "not.committed.yet",
- WANT_BLANK_IDENT, NULL, 0);
+ if (contents_from)
+ ident = fmt_ident("External file (--contents)", "external.file",
+ WANT_BLANK_IDENT, NULL, 0);
+ else
+ ident = fmt_ident("Not Committed Yet", "not.committed.yet",
+ WANT_BLANK_IDENT, NULL, 0);
strbuf_addstr(&msg, "tree 0000000000000000000000000000000000000000\n");
for (parent = commit->parents; parent; parent = parent->next)
strbuf_addf(&msg, "parent %s\n",
@@ -1028,8 +1034,9 @@ static void fill_origin_blob(struct diff_options *opt,
&o->blob_oid, 1, &file->ptr, &file_size))
;
else
- file->ptr = read_object_file(&o->blob_oid, &type,
- &file_size);
+ file->ptr = repo_read_object_file(the_repository,
+ &o->blob_oid, &type,
+ &file_size);
file->size = file_size;
if (!file->ptr)
@@ -2429,7 +2436,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
if (sg_origin[i])
continue;
- if (parse_commit(p))
+ if (repo_parse_commit(the_repository, p))
continue;
porigin = find(sb->repo, p, origin, sb->bloom_data);
if (!porigin)
@@ -2592,7 +2599,7 @@ void assign_blame(struct blame_scoreboard *sb, int opt)
* so hold onto it in the meantime.
*/
blame_origin_incref(suspect);
- parse_commit(commit);
+ repo_parse_commit(the_repository, commit);
if (sb->reverse ||
(!(commit->object.flags & UNINTERESTING) &&
!(revs->max_age != -1 && commit->date < revs->max_age)))
@@ -2771,22 +2778,37 @@ void setup_scoreboard(struct blame_scoreboard *sb,
sb->commits.compare = compare_commits_by_reverse_commit_date;
}
- if (sb->final && sb->contents_from)
- die(_("cannot use --contents with final commit object name"));
-
if (sb->reverse && sb->revs->first_parent_only)
sb->revs->children.name = NULL;
- if (!sb->final) {
+ if (sb->contents_from || !sb->final) {
+ struct object_id head_oid, *parent_oid;
+
/*
- * "--not A B -- path" without anything positive;
- * do not default to HEAD, but use the working tree
- * or "--contents".
+ * Build a fake commit at the top of the history, when
+ * (1) "git blame [^A] --path", i.e. with no positive end
+ * of the history range, in which case we build such
+ * a fake commit on top of the HEAD to blame in-tree
+ * modifications.
+ * (2) "git blame --contents=file [A] -- path", with or
+ * without positive end of the history range but with
+ * --contents, in which case we pretend that there is
+ * a fake commit on top of the positive end (defaulting to
+ * HEAD) that has the given contents in the path.
*/
+ if (sb->final) {
+ parent_oid = &sb->final->object.oid;
+ } else {
+ if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, &head_oid, NULL))
+ die("no such ref: HEAD");
+ parent_oid = &head_oid;
+ }
+
setup_work_tree();
sb->final = fake_working_tree_commit(sb->repo,
&sb->revs->diffopt,
- sb->path, sb->contents_from);
+ sb->path, sb->contents_from,
+ parent_oid);
add_pending_object(sb->revs, &(sb->final->object), ":");
}
@@ -2838,8 +2860,10 @@ void setup_scoreboard(struct blame_scoreboard *sb,
&sb->final_buf_size))
;
else
- sb->final_buf = read_object_file(&o->blob_oid, &type,
- &sb->final_buf_size);
+ sb->final_buf = repo_read_object_file(the_repository,
+ &o->blob_oid,
+ &type,
+ &sb->final_buf_size);
if (!sb->final_buf)
die(_("cannot read blob %s for path %s"),
diff --git a/blame.h b/blame.h
index 38bde535b3..b60d1d81e3 100644
--- a/blame.h
+++ b/blame.h
@@ -1,7 +1,6 @@
#ifndef BLAME_H
#define BLAME_H
-#include "cache.h"
#include "commit.h"
#include "xdiff-interface.h"
#include "revision.h"
diff --git a/blob.c b/blob.c
index 182718aba9..888e28a559 100644
--- a/blob.c
+++ b/blob.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "blob.h"
#include "repository.h"
#include "alloc.h"
@@ -13,8 +13,7 @@ struct blob *lookup_blob(struct repository *r, const struct object_id *oid)
return object_as_type(obj, OBJ_BLOB, 0);
}
-int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
+void parse_blob_buffer(struct blob *item)
{
item->object.parsed = 1;
- return 0;
}
diff --git a/blob.h b/blob.h
index 1664872055..74555c90c4 100644
--- a/blob.h
+++ b/blob.h
@@ -11,8 +11,6 @@ struct blob {
struct blob *lookup_blob(struct repository *r, const struct object_id *oid);
-int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size);
-
/**
* Blobs do not contain references to other objects and do not have
* structured data that needs parsing. However, code may use the
@@ -21,5 +19,6 @@ int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size);
* parse_blob_buffer() is used (by object.c) to flag that the object
* has been read successfully from the database.
**/
+void parse_blob_buffer(struct blob *item);
#endif /* BLOB_H */
diff --git a/bloom.c b/bloom.c
index d0730525da..aef6b5fea2 100644
--- a/bloom.c
+++ b/bloom.c
@@ -6,6 +6,7 @@
#include "hashmap.h"
#include "commit-graph.h"
#include "commit.h"
+#include "commit-slab.h"
define_commit_slab(bloom_filter_slab, struct bloom_filter);
diff --git a/branch.c b/branch.c
index d182756827..ba3914adf5 100644
--- a/branch.c
+++ b/branch.c
@@ -1,10 +1,15 @@
#include "git-compat-util.h"
-#include "cache.h"
+#include "advice.h"
#include "config.h"
#include "branch.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-name.h"
#include "refs.h"
#include "refspec.h"
#include "remote.h"
+#include "repository.h"
#include "sequencer.h"
#include "commit.h"
#include "worktree.h"
@@ -531,7 +536,7 @@ static void dwim_branch_start(struct repository *r, const char *start_name,
explicit_tracking = 1;
real_ref = NULL;
- if (get_oid_mb(start_name, &oid)) {
+ if (repo_get_oid_mb(r, start_name, &oid)) {
if (explicit_tracking) {
int code = die_message(_(upstream_missing), start_name);
advise_if_enabled(ADVICE_SET_UPSTREAM_FAILURE,
@@ -541,7 +546,8 @@ static void dwim_branch_start(struct repository *r, const char *start_name,
die(_("not a valid object name: '%s'"), start_name);
}
- switch (dwim_ref(start_name, strlen(start_name), &oid, &real_ref, 0)) {
+ switch (repo_dwim_ref(r, start_name, strlen(start_name), &oid,
+ &real_ref, 0)) {
case 0:
/* Not branching from any existing branch */
if (explicit_tracking)
@@ -756,7 +762,7 @@ void create_branches_recursively(struct repository *r, const char *name,
_("submodule '%s': unable to find submodule"),
submodule_entry_list.entries[i].submodule->name);
if (advice_enabled(ADVICE_SUBMODULES_NOT_UPDATED))
- advise(_("You may try updating the submodules using 'git checkout %s && git submodule update --init'"),
+ advise(_("You may try updating the submodules using 'git checkout --no-recurse-submodules %s && git submodule update --init'"),
start_commitish);
exit(code);
}
@@ -772,7 +778,7 @@ void create_branches_recursively(struct repository *r, const char *name,
name);
}
- create_branch(the_repository, name, start_commitish, force, 0, reflog, quiet,
+ create_branch(r, name, start_commitish, force, 0, reflog, quiet,
BRANCH_TRACK_NEVER, dry_run);
if (dry_run)
return;
@@ -820,40 +826,17 @@ void remove_branch_state(struct repository *r, int verbose)
void die_if_checked_out(const char *branch, int ignore_current_worktree)
{
struct worktree **worktrees = get_worktrees();
- const struct worktree *wt;
- wt = find_shared_symref(worktrees, "HEAD", branch);
- if (wt && (!ignore_current_worktree || !wt->is_current)) {
- skip_prefix(branch, "refs/heads/", &branch);
- die(_("'%s' is already checked out at '%s'"), branch, wt->path);
- }
-
- free_worktrees(worktrees);
-}
-
-int replace_each_worktree_head_symref(const char *oldref, const char *newref,
- const char *logmsg)
-{
- int ret = 0;
- struct worktree **worktrees = get_worktrees();
- int i;
-
- for (i = 0; worktrees[i]; i++) {
- struct ref_store *refs;
-
- if (worktrees[i]->is_detached)
- continue;
- if (!worktrees[i]->head_ref)
- continue;
- if (strcmp(oldref, worktrees[i]->head_ref))
+ for (int i = 0; worktrees[i]; i++) {
+ if (worktrees[i]->is_current && ignore_current_worktree)
continue;
- refs = get_worktree_ref_store(worktrees[i]);
- if (refs_create_symref(refs, "HEAD", newref, logmsg))
- ret = error(_("HEAD of working tree %s is not updated"),
- worktrees[i]->path);
+ if (is_shared_symref(worktrees[i], "HEAD", branch)) {
+ skip_prefix(branch, "refs/heads/", &branch);
+ die(_("'%s' is already checked out at '%s'"),
+ branch, worktrees[i]->path);
+ }
}
free_worktrees(worktrees);
- return ret;
}
diff --git a/branch.h b/branch.h
index ef56103c05..30c01aed73 100644
--- a/branch.h
+++ b/branch.h
@@ -155,12 +155,4 @@ int read_branch_desc(struct strbuf *, const char *branch_name);
*/
void die_if_checked_out(const char *branch, int ignore_current_worktree);
-/*
- * Update all per-worktree HEADs pointing at the old ref to point the new ref.
- * This will be used when renaming a branch. Returns 0 if successful, non-zero
- * otherwise.
- */
-int replace_each_worktree_head_symref(const char *oldref, const char *newref,
- const char *logmsg);
-
#endif
diff --git a/builtin.h b/builtin.h
index 8901a34d6b..cb0db67681 100644
--- a/builtin.h
+++ b/builtin.h
@@ -51,10 +51,6 @@
* on bare repositories.
* This only makes sense when `RUN_SETUP` is also set.
*
- * `SUPPORT_SUPER_PREFIX`:
- *
- * The built-in supports `--super-prefix`.
- *
* `DELAY_PAGER_CONFIG`:
*
* If RUN_SETUP or RUN_SETUP_GENTLY is set, git.c normally handles
@@ -111,12 +107,22 @@ void setup_auto_pager(const char *cmd, int def);
int is_builtin(const char *s);
+/*
+ * Builtins which do not use RUN_SETUP should never see
+ * a prefix that is not empty; use this to protect downstream
+ * code which is not prepared to call prefix_filename(), etc.
+ */
+#define BUG_ON_NON_EMPTY_PREFIX(prefix) do { \
+ if ((prefix)) \
+ BUG("unexpected prefix in builtin: %s", (prefix)); \
+} while (0)
+
int cmd_add(int argc, const char **argv, const char *prefix);
int cmd_am(int argc, const char **argv, const char *prefix);
int cmd_annotate(int argc, const char **argv, const char *prefix);
int cmd_apply(int argc, const char **argv, const char *prefix);
int cmd_archive(int argc, const char **argv, const char *prefix);
-int cmd_bisect__helper(int argc, const char **argv, const char *prefix);
+int cmd_bisect(int argc, const char **argv, const char *prefix);
int cmd_blame(int argc, const char **argv, const char *prefix);
int cmd_branch(int argc, const char **argv, const char *prefix);
int cmd_bugreport(int argc, const char **argv, const char *prefix);
diff --git a/builtin/add.c b/builtin/add.c
index f84372964c..76cc026a68 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -3,12 +3,15 @@
*
* Copyright (C) 2006 Linus Torvalds
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "cache.h"
+#include "advice.h"
#include "config.h"
#include "builtin.h"
#include "lockfile.h"
+#include "editor.h"
#include "dir.h"
+#include "gettext.h"
#include "pathspec.h"
#include "exec-cmd.h"
#include "cache-tree.h"
@@ -42,8 +45,8 @@ static int chmod_pathspec(struct pathspec *pathspec, char flip, int show_only)
{
int i, ret = 0;
- for (i = 0; i < active_nr; i++) {
- struct cache_entry *ce = active_cache[i];
+ for (i = 0; i < the_index.cache_nr; i++) {
+ struct cache_entry *ce = the_index.cache[i];
int err;
if (!include_sparse &&
@@ -55,7 +58,7 @@ static int chmod_pathspec(struct pathspec *pathspec, char flip, int show_only)
continue;
if (!show_only)
- err = chmod_cache_entry(ce, flip);
+ err = chmod_index_entry(&the_index, ce, flip);
else
err = S_ISREG(ce->ce_mode) ? 0 : -1;
@@ -88,7 +91,7 @@ static int fix_unmerged_status(struct diff_filepair *p,
}
static void update_callback(struct diff_queue_struct *q,
- struct diff_options *opt, void *cbdata)
+ struct diff_options *opt UNUSED, void *cbdata)
{
int i;
struct update_callback_data *data = cbdata;
@@ -159,8 +162,8 @@ static int renormalize_tracked_files(const struct pathspec *pathspec, int flags)
{
int i, retval = 0;
- for (i = 0; i < active_nr; i++) {
- struct cache_entry *ce = active_cache[i];
+ for (i = 0; i < the_index.cache_nr; i++) {
+ struct cache_entry *ce = the_index.cache[i];
if (!include_sparse &&
(ce_skip_worktree(ce) ||
@@ -172,7 +175,8 @@ static int renormalize_tracked_files(const struct pathspec *pathspec, int flags)
continue; /* do not touch non blobs */
if (pathspec && !ce_path_match(&the_index, ce, pathspec, NULL))
continue;
- retval |= add_file_to_cache(ce->name, flags | ADD_CACHE_RENORMALIZE);
+ retval |= add_file_to_index(&the_index, ce->name,
+ flags | ADD_CACHE_RENORMALIZE);
}
return retval;
@@ -237,59 +241,14 @@ static int refresh(int verbose, const struct pathspec *pathspec)
return ret;
}
-int run_add_interactive(const char *revision, const char *patch_mode,
- const struct pathspec *pathspec)
-{
- int status, i;
- struct strvec argv = STRVEC_INIT;
- int use_builtin_add_i =
- git_env_bool("GIT_TEST_ADD_I_USE_BUILTIN", -1);
-
- if (use_builtin_add_i < 0 &&
- git_config_get_bool("add.interactive.usebuiltin",
- &use_builtin_add_i))
- use_builtin_add_i = 1;
-
- if (use_builtin_add_i != 0) {
- enum add_p_mode mode;
-
- if (!patch_mode)
- return !!run_add_i(the_repository, pathspec);
-
- if (!strcmp(patch_mode, "--patch"))
- mode = ADD_P_ADD;
- else if (!strcmp(patch_mode, "--patch=stash"))
- mode = ADD_P_STASH;
- else if (!strcmp(patch_mode, "--patch=reset"))
- mode = ADD_P_RESET;
- else if (!strcmp(patch_mode, "--patch=checkout"))
- mode = ADD_P_CHECKOUT;
- else if (!strcmp(patch_mode, "--patch=worktree"))
- mode = ADD_P_WORKTREE;
- else
- die("'%s' not supported", patch_mode);
-
- return !!run_add_p(the_repository, mode, revision, pathspec);
- }
-
- strvec_push(&argv, "add--interactive");
- if (patch_mode)
- strvec_push(&argv, patch_mode);
- if (revision)
- strvec_push(&argv, revision);
- strvec_push(&argv, "--");
- for (i = 0; i < pathspec->nr; i++)
- /* pass original pathspec, to be re-parsed */
- strvec_push(&argv, pathspec->items[i].original);
-
- status = run_command_v_opt(argv.v, RUN_GIT_CMD);
- strvec_clear(&argv);
- return status;
-}
-
int interactive_add(const char **argv, const char *prefix, int patch)
{
struct pathspec pathspec;
+ int unused;
+
+ if (!git_config_get_bool("add.interactive.usebuiltin", &unused))
+ warning(_("the add.interactive.useBuiltin setting has been removed!\n"
+ "See its entry in 'git help config' for details."));
parse_pathspec(&pathspec, 0,
PATHSPEC_PREFER_FULL |
@@ -297,9 +256,10 @@ int interactive_add(const char **argv, const char *prefix, int patch)
PATHSPEC_PREFIX_ORIGIN,
prefix, argv);
- return run_add_interactive(NULL,
- patch ? "--patch" : NULL,
- &pathspec);
+ if (patch)
+ return !!run_add_p(the_repository, ADD_P_ADD, NULL, &pathspec);
+ else
+ return !!run_add_i(the_repository, &pathspec);
}
static int edit_patch(int argc, const char **argv, const char *prefix)
@@ -312,7 +272,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
- if (read_cache() < 0)
+ if (repo_read_index(the_repository) < 0)
die(_("Could not read the index"));
repo_init_revisions(the_repository, &rev, prefix);
@@ -544,7 +504,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
- hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &lock_file, LOCK_DIE_ON_ERROR);
/*
* Check the "pathspec '%s' did not match any files" block
@@ -587,7 +547,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
(!(addremove || take_worktree_changes)
? ADD_CACHE_IGNORE_REMOVAL : 0));
- if (read_cache_preload(&pathspec) < 0)
+ if (repo_read_index_preload(the_repository, &pathspec, 0) < 0)
die(_("index file corrupt"));
die_in_unpopulated_submodule(&the_index, prefix);
@@ -695,6 +655,6 @@ finish:
die(_("Unable to write new index file"));
dir_clear(&dir);
- UNLEAK(pathspec);
+ clear_pathspec(&pathspec);
return exit_status;
}
diff --git a/builtin/am.c b/builtin/am.c
index 39fea24833..5c83f2e003 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -3,11 +3,17 @@
*
* Based on git-am.sh by Junio C Hamano.
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "cache.h"
+#include "abspath.h"
+#include "advice.h"
#include "config.h"
#include "builtin.h"
+#include "editor.h"
+#include "environment.h"
#include "exec-cmd.h"
+#include "gettext.h"
+#include "hex.h"
#include "parse-options.h"
#include "dir.h"
#include "run-command.h"
@@ -22,6 +28,7 @@
#include "diffcore.h"
#include "unpack-trees.h"
#include "branch.h"
+#include "object-name.h"
#include "sequencer.h"
#include "revision.h"
#include "merge-recursive.h"
@@ -33,8 +40,10 @@
#include "apply.h"
#include "string-list.h"
#include "packfile.h"
+#include "pager.h"
#include "repository.h"
#include "pretty.h"
+#include "wrapper.h"
/**
* Returns the length of the first line of msg.
@@ -117,6 +126,7 @@ struct am_state {
/* various operating modes and command line options */
int interactive;
+ int no_verify;
int threeway;
int quiet;
int signoff; /* enum signoff_type */
@@ -472,10 +482,12 @@ static void am_destroy(const struct am_state *state)
*/
static int run_applypatch_msg_hook(struct am_state *state)
{
- int ret;
+ int ret = 0;
assert(state->msg);
- ret = run_hooks_l("applypatch-msg", am_path(state, "final-commit"), NULL);
+
+ if (!state->no_verify)
+ ret = run_hooks_l("applypatch-msg", am_path(state, "final-commit"), NULL);
if (!ret) {
FREE_AND_NULL(state->msg);
@@ -492,24 +504,12 @@ static int run_applypatch_msg_hook(struct am_state *state)
*/
static int run_post_rewrite_hook(const struct am_state *state)
{
- struct child_process cp = CHILD_PROCESS_INIT;
- const char *hook = find_hook("post-rewrite");
- int ret;
+ struct run_hooks_opt opt = RUN_HOOKS_OPT_INIT;
- if (!hook)
- return 0;
-
- strvec_push(&cp.args, hook);
- strvec_push(&cp.args, "rebase");
-
- cp.in = xopen(am_path(state, "rewritten"), O_RDONLY);
- cp.stdout_to_stderr = 1;
- cp.trace2_hook_name = "post-rewrite";
+ strvec_push(&opt.args, "rebase");
+ opt.path_to_stdin = am_path(state, "rewritten");
- ret = run_command(&cp);
-
- close(cp.in);
- return ret;
+ return run_hooks_opt("post-rewrite", &opt);
}
/**
@@ -1075,7 +1075,7 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,
else
write_state_text(state, "applying", "");
- if (!get_oid("HEAD", &curr_head)) {
+ if (!repo_get_oid(the_repository, "HEAD", &curr_head)) {
write_state_text(state, "abort-safety", oid_to_hex(&curr_head));
if (!state->rebasing)
update_ref("am", "ORIG_HEAD", &curr_head, NULL, 0,
@@ -1118,7 +1118,7 @@ static void am_next(struct am_state *state)
unlink(am_path(state, "original-commit"));
delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
- if (!get_oid("HEAD", &head))
+ if (!repo_get_oid(the_repository, "HEAD", &head))
write_state_text(state, "abort-safety", oid_to_hex(&head));
else
write_state_text(state, "abort-safety", "");
@@ -1338,7 +1338,8 @@ static void get_commit_info(struct am_state *state, struct commit *commit)
size_t ident_len;
struct ident_split id;
- buffer = logmsg_reencode(commit, NULL, get_commit_output_encoding());
+ buffer = repo_logmsg_reencode(the_repository, commit, NULL,
+ get_commit_output_encoding());
ident_line = find_commit_header(buffer, "author", &ident_len);
if (!ident_line)
@@ -1370,7 +1371,7 @@ static void get_commit_info(struct am_state *state, struct commit *commit)
die(_("unable to parse commit %s"), oid_to_hex(&commit->object.oid));
state->msg = xstrdup(msg + 2);
state->msg_len = strlen(state->msg);
- unuse_commit_buffer(commit, buffer);
+ repo_unuse_commit_buffer(the_repository, commit, buffer);
}
/**
@@ -1411,9 +1412,9 @@ static void write_index_patch(const struct am_state *state)
struct rev_info rev_info;
FILE *fp;
- if (!get_oid("HEAD", &head)) {
+ if (!repo_get_oid(the_repository, "HEAD", &head)) {
struct commit *commit = lookup_commit_or_die(&head, "HEAD");
- tree = get_commit_tree(commit);
+ tree = repo_get_commit_tree(the_repository, commit);
} else
tree = lookup_tree(the_repository,
the_repository->hash_algo->empty_tree);
@@ -1476,6 +1477,7 @@ static int run_apply(const struct am_state *state, const char *index_file)
int res, opts_left;
int force_apply = 0;
int options = 0;
+ const char **apply_argv;
if (init_apply_state(&apply_state, the_repository, NULL))
BUG("init_apply_state() failed");
@@ -1483,7 +1485,14 @@ static int run_apply(const struct am_state *state, const char *index_file)
strvec_push(&apply_opts, "apply");
strvec_pushv(&apply_opts, state->git_apply_opts.v);
- opts_left = apply_parse_options(apply_opts.nr, apply_opts.v,
+ /*
+ * Build a copy that apply_parse_options() can rearrange.
+ * apply_opts.v keeps referencing the allocated strings for
+ * strvec_clear() to release.
+ */
+ DUP_ARRAY(apply_argv, apply_opts.v, apply_opts.nr);
+
+ opts_left = apply_parse_options(apply_opts.nr, apply_argv,
&apply_state, &force_apply, &options,
NULL);
@@ -1513,14 +1522,15 @@ static int run_apply(const struct am_state *state, const char *index_file)
strvec_clear(&apply_paths);
strvec_clear(&apply_opts);
clear_apply_state(&apply_state);
+ free(apply_argv);
if (res)
return res;
if (index_file) {
/* Reload index as apply_all_patches() will have modified it. */
- discard_cache();
- read_cache_from(index_file);
+ discard_index(&the_index);
+ read_index_from(&the_index, index_file, get_git_dir());
}
return 0;
@@ -1556,14 +1566,14 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
struct commit *result;
char *their_tree_name;
- if (get_oid("HEAD", &our_tree) < 0)
+ if (repo_get_oid(the_repository, "HEAD", &our_tree) < 0)
oidcpy(&our_tree, the_hash_algo->empty_tree);
if (build_fake_ancestor(state, index_path))
return error("could not build fake ancestor");
- discard_cache();
- read_cache_from(index_path);
+ discard_index(&the_index);
+ read_index_from(&the_index, index_path, get_git_dir());
if (write_index_as_tree(&orig_tree, &the_index, index_path, 0, NULL))
return error(_("Repository lacks necessary blobs to fall back on 3-way merge."));
@@ -1596,8 +1606,8 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
say(state, stdout, _("Falling back to patching base and 3-way merge..."));
- discard_cache();
- read_cache();
+ discard_index(&the_index);
+ repo_read_index(the_repository);
/*
* This is not so wrong. Depending on which base we picked, orig_tree
@@ -1640,13 +1650,13 @@ static void do_commit(const struct am_state *state)
const char *reflog_msg, *author, *committer = NULL;
struct strbuf sb = STRBUF_INIT;
- if (run_hooks("pre-applypatch"))
+ if (!state->no_verify && run_hooks("pre-applypatch"))
exit(1);
- if (write_cache_as_tree(&tree, 0, NULL))
+ if (write_index_as_tree(&tree, &the_index, get_index_file(), 0, NULL))
die(_("git write-tree failed to write a tree"));
- if (!get_oid_commit("HEAD", &parent)) {
+ if (!repo_get_oid_commit(the_repository, "HEAD", &parent)) {
old_oid = &parent;
commit_list_insert(lookup_commit(the_repository, &parent),
&parents);
@@ -1781,7 +1791,8 @@ static void am_run(struct am_state *state, int resume)
unlink(am_path(state, "dirtyindex"));
- if (refresh_and_write_cache(REFRESH_QUIET, 0, 0) < 0)
+ if (repo_refresh_and_write_index(the_repository, REFRESH_QUIET, 0, 0,
+ NULL, NULL, NULL) < 0)
die(_("unable to write index file"));
if (repo_index_has_changes(the_repository, NULL, &sb)) {
@@ -1930,7 +1941,7 @@ static void am_resolve(struct am_state *state, int allow_empty)
}
}
- if (unmerged_cache()) {
+ if (unmerged_index(&the_index)) {
printf_ln(_("You still have unmerged paths in your index.\n"
"You should 'git add' each file with resolved conflicts to mark them as such.\n"
"You might run `git rm` on a file to accept \"deleted by them\" for it."));
@@ -1967,9 +1978,9 @@ static int fast_forward_to(struct tree *head, struct tree *remote, int reset)
if (parse_tree(head) || parse_tree(remote))
return -1;
- hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &lock_file, LOCK_DIE_ON_ERROR);
- refresh_cache(REFRESH_QUIET);
+ refresh_index(&the_index, REFRESH_QUIET, NULL, NULL, NULL);
memset(&opts, 0, sizeof(opts));
opts.head_idx = 1;
@@ -2007,7 +2018,7 @@ static int merge_tree(struct tree *tree)
if (parse_tree(tree))
return -1;
- hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &lock_file, LOCK_DIE_ON_ERROR);
memset(&opts, 0, sizeof(opts));
opts.head_idx = 1;
@@ -2045,12 +2056,12 @@ static int clean_index(const struct object_id *head, const struct object_id *rem
if (!remote_tree)
return error(_("Could not parse object '%s'."), oid_to_hex(remote));
- read_cache_unmerged();
+ repo_read_index_unmerged(the_repository);
if (fast_forward_to(head_tree, head_tree, 1))
return -1;
- if (write_cache_as_tree(&index, 0, NULL))
+ if (write_index_as_tree(&index, &the_index, get_index_file(), 0, NULL))
return -1;
index_tree = parse_tree_indirect(&index);
@@ -2087,7 +2098,7 @@ static void am_skip(struct am_state *state)
am_rerere_clear();
- if (get_oid("HEAD", &head))
+ if (repo_get_oid(the_repository, "HEAD", &head))
oidcpy(&head, the_hash_algo->empty_tree);
if (clean_index(&head, &head))
@@ -2129,7 +2140,7 @@ static int safe_to_abort(const struct am_state *state)
oidclr(&abort_safety);
strbuf_release(&sb);
- if (get_oid("HEAD", &head))
+ if (repo_get_oid(the_repository, "HEAD", &head))
oidclr(&head);
if (oideq(&head, &abort_safety))
@@ -2162,7 +2173,7 @@ static void am_abort(struct am_state *state)
if (!has_curr_head)
oidcpy(&curr_head, the_hash_algo->empty_tree);
- has_orig_head = !get_oid("ORIG_HEAD", &orig_head);
+ has_orig_head = !repo_get_oid(the_repository, "ORIG_HEAD", &orig_head);
if (!has_orig_head)
oidcpy(&orig_head, the_hash_algo->empty_tree);
@@ -2187,14 +2198,12 @@ static int show_patch(struct am_state *state, enum show_patch_type sub_mode)
int len;
if (!is_null_oid(&state->orig_commit)) {
- const char *av[4] = { "show", NULL, "--", NULL };
- char *new_oid_str;
- int ret;
+ struct child_process cmd = CHILD_PROCESS_INIT;
- av[1] = new_oid_str = xstrdup(oid_to_hex(&state->orig_commit));
- ret = run_command_v_opt(av, RUN_GIT_CMD);
- free(new_oid_str);
- return ret;
+ strvec_pushl(&cmd.args, "show", oid_to_hex(&state->orig_commit),
+ "--", NULL);
+ cmd.git_cmd = 1;
+ return run_command(&cmd);
}
switch (sub_mode) {
@@ -2301,17 +2310,6 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar
return 0;
}
-static int git_am_config(const char *k, const char *v, void *cb UNUSED)
-{
- int status;
-
- status = git_gpg_config(k, v, NULL);
- if (status)
- return status;
-
- return git_default_config(k, v, NULL);
-}
-
int cmd_am(int argc, const char **argv, const char *prefix)
{
struct am_state state;
@@ -2331,6 +2329,8 @@ int cmd_am(int argc, const char **argv, const char *prefix)
struct option options[] = {
OPT_BOOL('i', "interactive", &state.interactive,
N_("run interactively")),
+ OPT_BOOL('n', "no-verify", &state.no_verify,
+ N_("bypass pre-applypatch and applypatch-msg hooks")),
OPT_HIDDEN_BOOL('b', "binary", &binary,
N_("historical option -- no-op")),
OPT_BOOL('3', "3way", &state.threeway,
@@ -2433,7 +2433,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(usage, options);
- git_config(git_am_config, NULL);
+ git_config(git_default_config, NULL);
am_state_init(&state);
diff --git a/builtin/apply.c b/builtin/apply.c
index 555219de40..e3ff02a09e 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1,6 +1,8 @@
#include "cache.h"
#include "builtin.h"
+#include "gettext.h"
#include "parse-options.h"
+#include "repository.h"
#include "apply.h"
static const char * const apply_usage[] = {
diff --git a/builtin/archive.c b/builtin/archive.c
index f094390ee0..b0eaa3c14a 100644
--- a/builtin/archive.c
+++ b/builtin/archive.c
@@ -5,9 +5,11 @@
#include "cache.h"
#include "builtin.h"
#include "archive.h"
+#include "gettext.h"
#include "transport.h"
#include "parse-options.h"
#include "pkt-line.h"
+#include "repository.h"
#include "sideband.h"
static void create_output_file(const char *output_file)
@@ -81,7 +83,7 @@ static int run_remote_archiver(int argc, const char **argv,
int cmd_archive(int argc, const char **argv, const char *prefix)
{
const char *exec = "git-upload-archive";
- const char *output = NULL;
+ char *output = NULL;
const char *remote = NULL;
struct option local_opts[] = {
OPT_FILENAME('o', "output", &output,
@@ -106,5 +108,6 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
+ UNLEAK(output);
return write_archive(argc, argv, prefix, the_repository, output, 0);
}
diff --git a/builtin/bisect--helper.c b/builtin/bisect.c
index 28ef7ec2a4..4812450c39 100644
--- a/builtin/bisect--helper.c
+++ b/builtin/bisect.c
@@ -1,37 +1,65 @@
#include "builtin.h"
#include "cache.h"
+#include "copy.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-name.h"
#include "parse-options.h"
#include "bisect.h"
#include "refs.h"
#include "dir.h"
#include "strvec.h"
#include "run-command.h"
+#include "oid-array.h"
#include "prompt.h"
#include "quote.h"
#include "revision.h"
+#include "wrapper.h"
static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS")
static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")
static GIT_PATH_FUNC(git_path_bisect_ancestors_ok, "BISECT_ANCESTORS_OK")
static GIT_PATH_FUNC(git_path_bisect_start, "BISECT_START")
static GIT_PATH_FUNC(git_path_bisect_log, "BISECT_LOG")
-static GIT_PATH_FUNC(git_path_head_name, "head-name")
static GIT_PATH_FUNC(git_path_bisect_names, "BISECT_NAMES")
static GIT_PATH_FUNC(git_path_bisect_first_parent, "BISECT_FIRST_PARENT")
static GIT_PATH_FUNC(git_path_bisect_run, "BISECT_RUN")
-static const char * const git_bisect_helper_usage[] = {
- N_("git bisect--helper --bisect-reset [<commit>]"),
- "git bisect--helper --bisect-terms [--term-good | --term-old | --term-bad | --term-new]",
- N_("git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}=<term>]"
- " [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] [<paths>...]"),
- "git bisect--helper --bisect-next",
- N_("git bisect--helper --bisect-state (bad|new) [<rev>]"),
- N_("git bisect--helper --bisect-state (good|old) [<rev>...]"),
- N_("git bisect--helper --bisect-replay <filename>"),
- N_("git bisect--helper --bisect-skip [(<rev>|<range>)...]"),
- "git bisect--helper --bisect-visualize",
- N_("git bisect--helper --bisect-run <cmd>..."),
+#define BUILTIN_GIT_BISECT_START_USAGE \
+ N_("git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]" \
+ " [--no-checkout] [--first-parent] [<bad> [<good>...]] [--]" \
+ " [<pathspec>...]")
+#define BUILTIN_GIT_BISECT_STATE_USAGE \
+ N_("git bisect (good|bad) [<rev>...]")
+#define BUILTIN_GIT_BISECT_TERMS_USAGE \
+ "git bisect terms [--term-good | --term-bad]"
+#define BUILTIN_GIT_BISECT_SKIP_USAGE \
+ N_("git bisect skip [(<rev>|<range>)...]")
+#define BUILTIN_GIT_BISECT_NEXT_USAGE \
+ "git bisect next"
+#define BUILTIN_GIT_BISECT_RESET_USAGE \
+ N_("git bisect reset [<commit>]")
+#define BUILTIN_GIT_BISECT_VISUALIZE_USAGE \
+ "git bisect visualize"
+#define BUILTIN_GIT_BISECT_REPLAY_USAGE \
+ N_("git bisect replay <logfile>")
+#define BUILTIN_GIT_BISECT_LOG_USAGE \
+ "git bisect log"
+#define BUILTIN_GIT_BISECT_RUN_USAGE \
+ N_("git bisect run <cmd>...")
+
+static const char * const git_bisect_usage[] = {
+ BUILTIN_GIT_BISECT_START_USAGE,
+ BUILTIN_GIT_BISECT_STATE_USAGE,
+ BUILTIN_GIT_BISECT_TERMS_USAGE,
+ BUILTIN_GIT_BISECT_SKIP_USAGE,
+ BUILTIN_GIT_BISECT_NEXT_USAGE,
+ BUILTIN_GIT_BISECT_RESET_USAGE,
+ BUILTIN_GIT_BISECT_VISUALIZE_USAGE,
+ BUILTIN_GIT_BISECT_REPLAY_USAGE,
+ BUILTIN_GIT_BISECT_LOG_USAGE,
+ BUILTIN_GIT_BISECT_RUN_USAGE,
NULL
};
@@ -214,24 +242,24 @@ static int bisect_reset(const char *commit)
} else {
struct object_id oid;
- if (get_oid_commit(commit, &oid))
+ if (repo_get_oid_commit(the_repository, commit, &oid))
return error(_("'%s' is not a valid commit"), commit);
strbuf_addstr(&branch, commit);
}
if (!ref_exists("BISECT_HEAD")) {
- struct strvec argv = STRVEC_INIT;
+ struct child_process cmd = CHILD_PROCESS_INIT;
- strvec_pushl(&argv, "checkout", branch.buf, "--", NULL);
- if (run_command_v_opt(argv.v, RUN_GIT_CMD)) {
+ cmd.git_cmd = 1;
+ strvec_pushl(&cmd.args, "checkout", "--ignore-other-worktrees",
+ branch.buf, "--", NULL);
+ if (run_command(&cmd)) {
error(_("could not check out original"
" HEAD '%s'. Try 'git bisect"
" reset <commit>'."), branch.buf);
strbuf_release(&branch);
- strvec_clear(&argv);
return -1;
}
- strvec_clear(&argv);
}
strbuf_release(&branch);
@@ -245,7 +273,8 @@ static void log_commit(FILE *fp, char *fmt, const char *state,
struct strbuf commit_msg = STRBUF_INIT;
char *label = xstrfmt(fmt, state);
- format_commit_message(commit, "%s", &commit_msg, &pp);
+ repo_format_commit_message(the_repository, commit, "%s", &commit_msg,
+ &pp);
fprintf(fp, "# %s: [%s] %s\n", label, oid_to_hex(&commit->object.oid),
commit_msg.buf);
@@ -272,7 +301,7 @@ static int bisect_write(const char *state, const char *rev,
goto finish;
}
- if (get_oid(rev, &oid)) {
+ if (repo_get_oid(the_repository, rev, &oid)) {
res = error(_("couldn't get the oid of the rev '%s'"), rev);
goto finish;
}
@@ -547,7 +576,7 @@ static int prepare_revs(struct bisect_terms *terms, struct rev_info *revs)
* sets up a revision walk.
*/
reset_revision_walk();
- init_revisions(revs, NULL);
+ repo_init_revisions(the_repository, revs, NULL);
setup_revisions(0, NULL, revs, NULL);
for_each_glob_ref_in(add_bisect_ref, bad, "refs/bisect/", &cb);
cb.object_flags = UNINTERESTING;
@@ -583,8 +612,8 @@ static int bisect_skipped_commits(struct bisect_terms *terms)
while ((commit = get_revision(&revs)) != NULL) {
strbuf_reset(&commit_name);
- format_commit_message(commit, "%s",
- &commit_name, &pp);
+ repo_format_commit_message(the_repository, commit, "%s",
+ &commit_name, &pp);
fprintf(fp, "# possible first %s commit: [%s] %s\n",
terms->term_bad, oid_to_hex(&commit->object.oid),
commit_name.buf);
@@ -613,7 +642,8 @@ static int bisect_successful(struct bisect_terms *terms)
read_ref(bad_ref, &oid);
commit = lookup_commit_reference_by_name(bad_ref);
- format_commit_message(commit, "%s", &commit_name, &pp);
+ repo_format_commit_message(the_repository, commit, "%s", &commit_name,
+ &pp);
res = append_to_file(git_path_bisect_log(), "# first %s commit: [%s] %s\n",
terms->term_bad, oid_to_hex(&commit->object.oid),
@@ -657,7 +687,8 @@ static enum bisect_error bisect_auto_next(struct bisect_terms *terms, const char
return bisect_next(terms, prefix);
}
-static enum bisect_error bisect_start(struct bisect_terms *terms, const char **argv, int argc)
+static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
+ const char **argv)
{
int no_checkout = 0;
int first_parent_only = 0;
@@ -754,7 +785,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, const char **a
*/
head = resolve_ref_unsafe("HEAD", 0, &head_oid, &flags);
if (!head)
- if (get_oid("HEAD", &head_oid))
+ if (repo_get_oid(the_repository, "HEAD", &head_oid))
return error(_("bad HEAD - I need a HEAD"));
/*
@@ -765,10 +796,12 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, const char **a
strbuf_read_file(&start_head, git_path_bisect_start(), 0);
strbuf_trim(&start_head);
if (!no_checkout) {
- const char *argv[] = { "checkout", start_head.buf,
- "--", NULL };
+ struct child_process cmd = CHILD_PROCESS_INIT;
- if (run_command_v_opt(argv, RUN_GIT_CMD)) {
+ cmd.git_cmd = 1;
+ strvec_pushl(&cmd.args, "checkout", start_head.buf,
+ "--", NULL);
+ if (run_command(&cmd)) {
res = error(_("checking out '%s' failed."
" Try 'git bisect start "
"<valid-branch>'."),
@@ -778,19 +811,12 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, const char **a
}
} else {
/* Get the rev from where we start. */
- if (!get_oid(head, &head_oid) &&
+ if (!repo_get_oid(the_repository, head, &head_oid) &&
!starts_with(head, "refs/heads/")) {
strbuf_reset(&start_head);
strbuf_addstr(&start_head, oid_to_hex(&head_oid));
- } else if (!get_oid(head, &head_oid) &&
+ } else if (!repo_get_oid(the_repository, head, &head_oid) &&
skip_prefix(head, "refs/heads/", &head)) {
- /*
- * This error message should only be triggered by
- * cogito usage, and cogito users should understand
- * it relates to cg-seek.
- */
- if (!is_empty_or_missing_file(git_path_head_name()))
- return error(_("won't bisect on cg-seek'ed tree"));
strbuf_addstr(&start_head, head);
} else {
return error(_("bad HEAD - strange symbolic ref"));
@@ -812,7 +838,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, const char **a
write_file(git_path_bisect_first_parent(), "\n");
if (no_checkout) {
- if (get_oid(start_head.buf, &oid) < 0) {
+ if (repo_get_oid(the_repository, start_head.buf, &oid) < 0) {
res = error(_("invalid ref: '%s'"), start_head.buf);
goto finish;
}
@@ -885,13 +911,13 @@ static int bisect_autostart(struct bisect_terms *terms)
yesno = git_prompt(_("Do you want me to do it for you "
"[Y/n]? "), PROMPT_ECHO);
res = tolower(*yesno) == 'n' ?
- -1 : bisect_start(terms, empty_strvec, 0);
+ -1 : bisect_start(terms, 0, empty_strvec);
return res;
}
-static enum bisect_error bisect_state(struct bisect_terms *terms, const char **argv,
- int argc)
+static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
+ const char **argv)
{
const char *state;
int i, verify_expected = 1;
@@ -917,11 +943,12 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, const char **a
if (argc == 0) {
const char *head = "BISECT_HEAD";
- enum get_oid_result res_head = get_oid(head, &oid);
+ enum get_oid_result res_head = repo_get_oid(the_repository,
+ head, &oid);
if (res_head == MISSING_OBJECT) {
head = "HEAD";
- res_head = get_oid(head, &oid);
+ res_head = repo_get_oid(the_repository, head, &oid);
}
if (res_head)
@@ -937,7 +964,7 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, const char **a
for (; argc; argc--, argv++) {
struct commit *commit;
- if (get_oid(*argv, &oid)){
+ if (repo_get_oid(the_repository, *argv, &oid)){
error(_("Bad rev input: %s"), *argv);
oid_array_clear(&revs);
return BISECT_FAILED;
@@ -1010,7 +1037,7 @@ static int process_replay_line(struct bisect_terms *terms, struct strbuf *line)
struct strvec argv = STRVEC_INIT;
int res;
sq_dequote_to_strvec(rev, &argv);
- res = bisect_start(terms, argv.v, argv.nr);
+ res = bisect_start(terms, argv.nr, argv.v);
strvec_clear(&argv);
return res;
}
@@ -1060,7 +1087,8 @@ static enum bisect_error bisect_replay(struct bisect_terms *terms, const char *f
return bisect_auto_next(terms, NULL);
}
-static enum bisect_error bisect_skip(struct bisect_terms *terms, const char **argv, int argc)
+static enum bisect_error bisect_skip(struct bisect_terms *terms, int argc,
+ const char **argv)
{
int i;
enum bisect_error res;
@@ -1075,7 +1103,7 @@ static enum bisect_error bisect_skip(struct bisect_terms *terms, const char **ar
struct rev_info revs;
struct commit *commit;
- init_revisions(&revs, NULL);
+ repo_init_revisions(the_repository, &revs, NULL);
setup_revisions(2, argv + i - 1, &revs, NULL);
if (prepare_revision_walk(&revs))
@@ -1090,48 +1118,47 @@ static enum bisect_error bisect_skip(struct bisect_terms *terms, const char **ar
strvec_push(&argv_state, argv[i]);
}
}
- res = bisect_state(terms, argv_state.v, argv_state.nr);
+ res = bisect_state(terms, argv_state.nr, argv_state.v);
strvec_clear(&argv_state);
return res;
}
-static int bisect_visualize(struct bisect_terms *terms, const char **argv, int argc)
+static int bisect_visualize(struct bisect_terms *terms, int argc,
+ const char **argv)
{
- struct strvec args = STRVEC_INIT;
- int flags = RUN_COMMAND_NO_STDIN, res = 0;
+ struct child_process cmd = CHILD_PROCESS_INIT;
struct strbuf sb = STRBUF_INIT;
if (bisect_next_check(terms, NULL) != 0)
return BISECT_FAILED;
+ cmd.no_stdin = 1;
if (!argc) {
if ((getenv("DISPLAY") || getenv("SESSIONNAME") || getenv("MSYSTEM") ||
getenv("SECURITYSESSIONID")) && exists_in_PATH("gitk")) {
- strvec_push(&args, "gitk");
+ strvec_push(&cmd.args, "gitk");
} else {
- strvec_push(&args, "log");
- flags |= RUN_GIT_CMD;
+ strvec_push(&cmd.args, "log");
+ cmd.git_cmd = 1;
}
} else {
if (argv[0][0] == '-') {
- strvec_push(&args, "log");
- flags |= RUN_GIT_CMD;
+ strvec_push(&cmd.args, "log");
+ cmd.git_cmd = 1;
} else if (strcmp(argv[0], "tig") && !starts_with(argv[0], "git"))
- flags |= RUN_GIT_CMD;
+ cmd.git_cmd = 1;
- strvec_pushv(&args, argv);
+ strvec_pushv(&cmd.args, argv);
}
- strvec_pushl(&args, "--bisect", "--", NULL);
+ strvec_pushl(&cmd.args, "--bisect", "--", NULL);
strbuf_read_file(&sb, git_path_bisect_names(), 0);
- sq_dequote_to_strvec(sb.buf, &args);
+ sq_dequote_to_strvec(sb.buf, &cmd.args);
strbuf_release(&sb);
- res = run_command_v_opt(args.v, flags);
- strvec_clear(&args);
- return res;
+ return run_command(&cmd);
}
static int get_first_good(const char *refname UNUSED,
@@ -1142,8 +1169,17 @@ static int get_first_good(const char *refname UNUSED,
return 1;
}
-static int verify_good(const struct bisect_terms *terms,
- const char **quoted_argv)
+static int do_bisect_run(const char *command)
+{
+ struct child_process cmd = CHILD_PROCESS_INIT;
+
+ printf(_("running %s\n"), command);
+ cmd.use_shell = 1;
+ strvec_push(&cmd.args, command);
+ return run_command(&cmd);
+}
+
+static int verify_good(const struct bisect_terms *terms, const char *command)
{
int rc;
enum bisect_error res;
@@ -1163,8 +1199,7 @@ static int verify_good(const struct bisect_terms *terms,
if (res != BISECT_OK)
return -1;
- printf(_("running %s\n"), quoted_argv[0]);
- rc = run_command_v_opt(quoted_argv, RUN_USING_SHELL);
+ rc = do_bisect_run(command);
res = bisect_checkout(&current_rev, no_checkout);
if (res != BISECT_OK)
@@ -1173,11 +1208,10 @@ static int verify_good(const struct bisect_terms *terms,
return rc;
}
-static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
+static int bisect_run(struct bisect_terms *terms, int argc, const char **argv)
{
int res = BISECT_OK;
struct strbuf command = STRBUF_INIT;
- struct strvec run_args = STRVEC_INIT;
const char *new_state;
int temporary_stdout_fd, saved_stdout;
int is_first_run = 1;
@@ -1185,18 +1219,15 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
if (bisect_next_check(terms, NULL))
return BISECT_FAILED;
- if (argc)
- sq_quote_argv(&command, argv);
- else {
+ if (!argc) {
error(_("bisect run failed: no command provided."));
return BISECT_FAILED;
}
- strvec_push(&run_args, command.buf);
-
+ sq_quote_argv(&command, argv);
+ strbuf_ltrim(&command);
while (1) {
- printf(_("running %s\n"), command.buf);
- res = run_command_v_opt(run_args.v, RUN_USING_SHELL);
+ res = do_bisect_run(command.buf);
/*
* Exit code 126 and 127 can either come from the shell
@@ -1206,10 +1237,10 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
* missing or non-executable script.
*/
if (is_first_run && (res == 126 || res == 127)) {
- int rc = verify_good(terms, run_args.v);
+ int rc = verify_good(terms, command.buf);
is_first_run = 0;
- if (rc < 0) {
- error(_("unable to verify '%s' on good"
+ if (rc < 0 || 128 <= rc) {
+ error(_("unable to verify %s on good"
" revision"), command.buf);
res = BISECT_FAILED;
break;
@@ -1224,7 +1255,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
if (res < 0 || 128 <= res) {
error(_("bisect run failed: exit code %d from"
- " '%s' is < 0 or >= 128"), res, command.buf);
+ " %s is < 0 or >= 128"), res, command.buf);
break;
}
@@ -1246,7 +1277,7 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
saved_stdout = dup(1);
dup2(temporary_stdout_fd, 1);
- res = bisect_state(terms, &new_state, 1);
+ res = bisect_state(terms, 1, &new_state);
fflush(stdout);
dup2(saved_stdout, 1);
@@ -1258,14 +1289,14 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
if (res == BISECT_ONLY_SKIPPED_LEFT)
error(_("bisect run cannot continue any more"));
else if (res == BISECT_INTERNAL_SUCCESS_MERGE_BASE) {
- printf(_("bisect run success"));
+ puts(_("bisect run success"));
res = BISECT_OK;
} else if (res == BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND) {
- printf(_("bisect found first bad commit"));
+ puts(_("bisect found first bad commit"));
res = BISECT_OK;
} else if (res) {
- error(_("bisect run failed: 'git bisect--helper --bisect-state"
- " %s' exited with error code %d"), new_state, res);
+ error(_("bisect run failed: 'git bisect %s'"
+ " exited with error code %d"), new_state, res);
} else {
continue;
}
@@ -1273,126 +1304,147 @@ static int bisect_run(struct bisect_terms *terms, const char **argv, int argc)
}
strbuf_release(&command);
- strvec_clear(&run_args);
return res;
}
-int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
+static int cmd_bisect__reset(int argc, const char **argv, const char *prefix UNUSED)
+{
+ if (argc > 1)
+ return error(_("'%s' requires either no argument or a commit"),
+ "git bisect reset");
+ return bisect_reset(argc ? argv[0] : NULL);
+}
+
+static int cmd_bisect__terms(int argc, const char **argv, const char *prefix UNUSED)
+{
+ int res;
+ struct bisect_terms terms = { 0 };
+
+ if (argc > 1)
+ return error(_("'%s' requires 0 or 1 argument"),
+ "git bisect terms");
+ res = bisect_terms(&terms, argc == 1 ? argv[0] : NULL);
+ free_terms(&terms);
+ return res;
+}
+
+static int cmd_bisect__start(int argc, const char **argv, const char *prefix UNUSED)
+{
+ int res;
+ struct bisect_terms terms = { 0 };
+
+ set_terms(&terms, "bad", "good");
+ res = bisect_start(&terms, argc, argv);
+ free_terms(&terms);
+ return res;
+}
+
+static int cmd_bisect__next(int argc, const char **argv UNUSED, const char *prefix)
+{
+ int res;
+ struct bisect_terms terms = { 0 };
+
+ if (argc)
+ return error(_("'%s' requires 0 arguments"),
+ "git bisect next");
+ get_terms(&terms);
+ res = bisect_next(&terms, prefix);
+ free_terms(&terms);
+ return res;
+}
+
+static int cmd_bisect__log(int argc UNUSED, const char **argv UNUSED, const char *prefix UNUSED)
+{
+ return bisect_log();
+}
+
+static int cmd_bisect__replay(int argc, const char **argv, const char *prefix UNUSED)
+{
+ int res;
+ struct bisect_terms terms = { 0 };
+
+ if (argc != 1)
+ return error(_("no logfile given"));
+ set_terms(&terms, "bad", "good");
+ res = bisect_replay(&terms, argv[0]);
+ free_terms(&terms);
+ return res;
+}
+
+static int cmd_bisect__skip(int argc, const char **argv, const char *prefix UNUSED)
+{
+ int res;
+ struct bisect_terms terms = { 0 };
+
+ set_terms(&terms, "bad", "good");
+ get_terms(&terms);
+ res = bisect_skip(&terms, argc, argv);
+ free_terms(&terms);
+ return res;
+}
+
+static int cmd_bisect__visualize(int argc, const char **argv, const char *prefix UNUSED)
{
- enum {
- BISECT_RESET = 1,
- BISECT_NEXT_CHECK,
- BISECT_TERMS,
- BISECT_START,
- BISECT_AUTOSTART,
- BISECT_NEXT,
- BISECT_STATE,
- BISECT_LOG,
- BISECT_REPLAY,
- BISECT_SKIP,
- BISECT_VISUALIZE,
- BISECT_RUN,
- } cmdmode = 0;
- int res = 0, nolog = 0;
+ int res;
+ struct bisect_terms terms = { 0 };
+
+ get_terms(&terms);
+ res = bisect_visualize(&terms, argc, argv);
+ free_terms(&terms);
+ return res;
+}
+
+static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSED)
+{
+ int res;
+ struct bisect_terms terms = { 0 };
+
+ if (!argc)
+ return error(_("'%s' failed: no command provided."), "git bisect run");
+ get_terms(&terms);
+ res = bisect_run(&terms, argc, argv);
+ free_terms(&terms);
+ return res;
+}
+
+int cmd_bisect(int argc, const char **argv, const char *prefix)
+{
+ int res = 0;
+ parse_opt_subcommand_fn *fn = NULL;
struct option options[] = {
- OPT_CMDMODE(0, "bisect-reset", &cmdmode,
- N_("reset the bisection state"), BISECT_RESET),
- OPT_CMDMODE(0, "bisect-next-check", &cmdmode,
- N_("check whether bad or good terms exist"), BISECT_NEXT_CHECK),
- OPT_CMDMODE(0, "bisect-terms", &cmdmode,
- N_("print out the bisect terms"), BISECT_TERMS),
- OPT_CMDMODE(0, "bisect-start", &cmdmode,
- N_("start the bisect session"), BISECT_START),
- OPT_CMDMODE(0, "bisect-next", &cmdmode,
- N_("find the next bisection commit"), BISECT_NEXT),
- OPT_CMDMODE(0, "bisect-state", &cmdmode,
- N_("mark the state of ref (or refs)"), BISECT_STATE),
- OPT_CMDMODE(0, "bisect-log", &cmdmode,
- N_("list the bisection steps so far"), BISECT_LOG),
- OPT_CMDMODE(0, "bisect-replay", &cmdmode,
- N_("replay the bisection process from the given file"), BISECT_REPLAY),
- OPT_CMDMODE(0, "bisect-skip", &cmdmode,
- N_("skip some commits for checkout"), BISECT_SKIP),
- OPT_CMDMODE(0, "bisect-visualize", &cmdmode,
- N_("visualize the bisection"), BISECT_VISUALIZE),
- OPT_CMDMODE(0, "bisect-run", &cmdmode,
- N_("use <cmd>... to automatically bisect"), BISECT_RUN),
- OPT_BOOL(0, "no-log", &nolog,
- N_("no log for BISECT_WRITE")),
+ OPT_SUBCOMMAND("reset", &fn, cmd_bisect__reset),
+ OPT_SUBCOMMAND("terms", &fn, cmd_bisect__terms),
+ OPT_SUBCOMMAND("start", &fn, cmd_bisect__start),
+ OPT_SUBCOMMAND("next", &fn, cmd_bisect__next),
+ OPT_SUBCOMMAND("log", &fn, cmd_bisect__log),
+ OPT_SUBCOMMAND("replay", &fn, cmd_bisect__replay),
+ OPT_SUBCOMMAND("skip", &fn, cmd_bisect__skip),
+ OPT_SUBCOMMAND("visualize", &fn, cmd_bisect__visualize),
+ OPT_SUBCOMMAND("view", &fn, cmd_bisect__visualize),
+ OPT_SUBCOMMAND("run", &fn, cmd_bisect__run),
OPT_END()
};
- struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL };
+ argc = parse_options(argc, argv, prefix, options, git_bisect_usage,
+ PARSE_OPT_SUBCOMMAND_OPTIONAL);
- argc = parse_options(argc, argv, prefix, options,
- git_bisect_helper_usage,
- PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_UNKNOWN_OPT);
+ if (!fn) {
+ struct bisect_terms terms = { 0 };
- if (!cmdmode)
- usage_with_options(git_bisect_helper_usage, options);
+ if (!argc)
+ usage_msg_opt(_("need a command"), git_bisect_usage, options);
- switch (cmdmode) {
- case BISECT_RESET:
- if (argc > 1)
- return error(_("--bisect-reset requires either no argument or a commit"));
- res = bisect_reset(argc ? argv[0] : NULL);
- break;
- case BISECT_TERMS:
- if (argc > 1)
- return error(_("--bisect-terms requires 0 or 1 argument"));
- res = bisect_terms(&terms, argc == 1 ? argv[0] : NULL);
- break;
- case BISECT_START:
- set_terms(&terms, "bad", "good");
- res = bisect_start(&terms, argv, argc);
- break;
- case BISECT_NEXT:
- if (argc)
- return error(_("--bisect-next requires 0 arguments"));
- get_terms(&terms);
- res = bisect_next(&terms, prefix);
- break;
- case BISECT_STATE:
- set_terms(&terms, "bad", "good");
- get_terms(&terms);
- res = bisect_state(&terms, argv, argc);
- break;
- case BISECT_LOG:
- if (argc)
- return error(_("--bisect-log requires 0 arguments"));
- res = bisect_log();
- break;
- case BISECT_REPLAY:
- if (argc != 1)
- return error(_("no logfile given"));
- set_terms(&terms, "bad", "good");
- res = bisect_replay(&terms, argv[0]);
- break;
- case BISECT_SKIP:
set_terms(&terms, "bad", "good");
get_terms(&terms);
- res = bisect_skip(&terms, argv, argc);
- break;
- case BISECT_VISUALIZE:
- get_terms(&terms);
- res = bisect_visualize(&terms, argv, argc);
- break;
- case BISECT_RUN:
- if (!argc)
- return error(_("bisect run failed: no command provided."));
- get_terms(&terms);
- res = bisect_run(&terms, argv, argc);
- break;
- default:
- BUG("unknown subcommand %d", cmdmode);
+ if (check_and_set_terms(&terms, argv[0]))
+ usage_msg_optf(_("unknown command: '%s'"), git_bisect_usage,
+ options, argv[0]);
+ res = bisect_state(&terms, argc, argv);
+ free_terms(&terms);
+ } else {
+ argc--;
+ argv++;
+ res = fn(argc, argv, prefix);
}
- free_terms(&terms);
-
- /*
- * Handle early success
- * From check_merge_bases > check_good_are_ancestors_of_bad > bisect_next_all
- */
- if ((res == BISECT_INTERNAL_SUCCESS_MERGE_BASE) || (res == BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND))
- res = BISECT_OK;
- return -res;
+ return is_bisect_success(res) ? 0 : -res;
}
diff --git a/builtin/blame.c b/builtin/blame.c
index a9fe8cf7a6..2df6039a6e 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -5,10 +5,14 @@
* See COPYING for licensing conditions
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "config.h"
#include "color.h"
#include "builtin.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "commit.h"
#include "diff.h"
@@ -24,12 +28,17 @@
#include "line-log.h"
#include "dir.h"
#include "progress.h"
+#include "object-name.h"
#include "object-store.h"
+#include "pager.h"
#include "blame.h"
#include "refs.h"
+#include "setup.h"
#include "tag.h"
+#include "write-or-die.h"
static char blame_usage[] = N_("git blame [<options>] [<rev-opts>] [<rev>] [--] <file>");
+static char annotate_usage[] = N_("git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>");
static const char *blame_opt_usage[] = {
blame_usage,
@@ -38,6 +47,13 @@ static const char *blame_opt_usage[] = {
NULL
};
+static const char *annotate_opt_usage[] = {
+ annotate_usage,
+ "",
+ N_("<rev-opts> are documented in git-rev-list(1)"),
+ NULL
+};
+
static int longest_file;
static int longest_author;
static int max_orig_digits;
@@ -191,13 +207,13 @@ static void get_commit_info(struct commit *commit,
const char *message;
encoding = get_log_output_encoding();
- message = logmsg_reencode(commit, NULL, encoding);
+ message = repo_logmsg_reencode(the_repository, commit, NULL, encoding);
get_ac_line(message, "\nauthor ",
&ret->author, &ret->author_mail,
&ret->author_time, &ret->author_tz);
if (!detailed) {
- unuse_commit_buffer(commit, message);
+ repo_unuse_commit_buffer(the_repository, commit, message);
return;
}
@@ -211,7 +227,7 @@ static void get_commit_info(struct commit *commit,
else
strbuf_addf(&ret->summary, "(%s)", oid_to_hex(&commit->object.oid));
- unuse_commit_buffer(commit, message);
+ repo_unuse_commit_buffer(the_repository, commit, message);
}
/*
@@ -593,8 +609,9 @@ static int read_ancestry(const char *graft_file)
static int update_auto_abbrev(int auto_abbrev, struct blame_origin *suspect)
{
- const char *uniq = find_unique_abbrev(&suspect->commit->object.oid,
- auto_abbrev);
+ const char *uniq = repo_find_unique_abbrev(the_repository,
+ &suspect->commit->object.oid,
+ auto_abbrev);
int len = strlen(uniq);
if (auto_abbrev < len)
return len;
@@ -794,7 +811,7 @@ static int is_a_rev(const char *name)
{
struct object_id oid;
- if (get_oid(name, &oid))
+ if (repo_get_oid(the_repository, name, &oid))
return 0;
return OBJ_NONE < oid_object_info(the_repository, &oid, NULL);
}
@@ -837,7 +854,7 @@ static void build_ignorelist(struct blame_scoreboard *sb,
peel_to_commit_oid, sb);
}
for_each_string_list_item(i, ignore_rev_list) {
- if (get_oid_committish(i->string, &oid) ||
+ if (repo_get_oid_committish(the_repository, i->string, &oid) ||
peel_to_commit_oid(&oid, sb))
die(_("cannot find revision %s to ignore"), i->string);
oidset_insert(&sb->ignore_list, &oid);
@@ -899,6 +916,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
long anchor;
const int hexsz = the_hash_algo->hexsz;
long num_lines = 0;
+ const char *str_usage = cmd_is_annotate ? annotate_usage : blame_usage;
+ const char **opt_usage = cmd_is_annotate ? annotate_opt_usage : blame_opt_usage;
setup_default_color_by_age();
git_config(git_blame_config, &output_option);
@@ -914,7 +933,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
parse_options_start(&ctx, argc, argv, prefix, options,
PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_ARGV0);
for (;;) {
- switch (parse_options_step(&ctx, options, blame_opt_usage)) {
+ switch (parse_options_step(&ctx, options, opt_usage)) {
case PARSE_OPT_NON_OPTION:
case PARSE_OPT_UNKNOWN:
break;
@@ -934,7 +953,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
ctx.argv[0] = "--children";
reverse = 1;
}
- parse_revision_opt(&revs, &ctx, options, blame_opt_usage);
+ parse_revision_opt(&revs, &ctx, options, opt_usage);
}
parse_done:
revision_opts_finish(&revs);
@@ -1040,7 +1059,7 @@ parse_done:
switch (argc - dashdash_pos - 1) {
case 2: /* (1b) */
if (argc != 4)
- usage_with_options(blame_opt_usage, options);
+ usage_with_options(opt_usage, options);
/* reorder for the new way: <rev> -- <path> */
argv[1] = argv[3];
argv[3] = argv[2];
@@ -1051,11 +1070,11 @@ parse_done:
argv[argc] = NULL;
break;
default:
- usage_with_options(blame_opt_usage, options);
+ usage_with_options(opt_usage, options);
}
} else {
if (argc < 2)
- usage_with_options(blame_opt_usage, options);
+ usage_with_options(opt_usage, options);
if (argc == 3 && is_a_rev(argv[argc - 1])) { /* (2b) */
path = add_prefix(prefix, argv[1]);
argv[1] = argv[2];
@@ -1113,7 +1132,7 @@ parse_done:
nth_line_cb, &sb, lno, anchor,
&bottom, &top, sb.path,
the_repository->index))
- usage(blame_usage);
+ usage(str_usage);
if ((!lno && (top || bottom)) || lno < bottom)
die(Q_("file %s has only %lu line",
"file %s has only %lu lines",
diff --git a/builtin/branch.c b/builtin/branch.c
index e0e0af4320..e6c2655af6 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -8,9 +8,13 @@
#include "cache.h"
#include "config.h"
#include "color.h"
+#include "editor.h"
+#include "environment.h"
#include "refs.h"
#include "commit.h"
#include "builtin.h"
+#include "gettext.h"
+#include "object-name.h"
#include "remote.h"
#include "parse-options.h"
#include "branch.h"
@@ -24,6 +28,7 @@
#include "worktree.h"
#include "help.h"
#include "commit-reach.h"
+#include "wrapper.h"
static const char * const builtin_branch_usage[] = {
N_("git branch [<options>] [-r | -a] [--merged] [--no-merged]"),
@@ -41,6 +46,7 @@ static const char *head;
static struct object_id head_oid;
static int recurse_submodules = 0;
static int submodule_propagate_branches = 0;
+static int omit_empty = 0;
static int branch_use_color = -1;
static char branch_colors[][COLOR_MAXLEN] = {
@@ -150,17 +156,18 @@ static int branch_merged(int kind, const char *name,
if (!reference_rev)
reference_rev = head_rev;
- merged = in_merge_bases(rev, reference_rev);
+ merged = reference_rev ? repo_in_merge_bases(the_repository, rev,
+ reference_rev) : 0;
/*
* After the safety valve is fully redefined to "check with
* upstream, if any, otherwise with HEAD", we should just
- * return the result of the in_merge_bases() above without
+ * return the result of the repo_in_merge_bases() above without
* any of the following code, but during the transition period,
* a gentle reminder is in order.
*/
if ((head_rev != reference_rev) &&
- in_merge_bases(rev, head_rev) != merged) {
+ (head_rev ? repo_in_merge_bases(the_repository, rev, head_rev) : 0) != merged) {
if (merged)
warning(_("deleting branch '%s' that has been merged to\n"
" '%s', but not yet merged to HEAD."),
@@ -216,10 +223,11 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
struct string_list refs_to_delete = STRING_LIST_INIT_DUP;
struct string_list_item *item;
int branch_name_pos;
+ const char *fmt_remotes = "refs/remotes/%s";
switch (kinds) {
case FILTER_REFS_REMOTES:
- fmt = "refs/remotes/%s";
+ fmt = fmt_remotes;
/* For subsequent UI messages */
remote_branch = 1;
allowed_interpret = INTERPRET_BRANCH_REMOTE;
@@ -235,11 +243,8 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
}
branch_name_pos = strcspn(fmt, "%");
- if (!force) {
+ if (!force)
head_rev = lookup_commit_reference(the_repository, &head_oid);
- if (!head_rev)
- die(_("Couldn't look up commit object for HEAD"));
- }
for (i = 0; i < argc; i++, strbuf_reset(&bname)) {
char *target = NULL;
@@ -266,9 +271,25 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
| RESOLVE_REF_ALLOW_BAD_NAME,
&oid, &flags);
if (!target) {
- error(remote_branch
- ? _("remote-tracking branch '%s' not found.")
- : _("branch '%s' not found."), bname.buf);
+ if (remote_branch) {
+ error(_("remote-tracking branch '%s' not found."), bname.buf);
+ } else {
+ char *virtual_name = mkpathdup(fmt_remotes, bname.buf);
+ char *virtual_target = resolve_refdup(virtual_name,
+ RESOLVE_REF_READING
+ | RESOLVE_REF_NO_RECURSE
+ | RESOLVE_REF_ALLOW_BAD_NAME,
+ &oid, &flags);
+ FREE_AND_NULL(virtual_name);
+
+ if (virtual_target)
+ error(_("branch '%s' not found.\n"
+ "Did you forget --remote?"),
+ bname.buf);
+ else
+ error(_("branch '%s' not found."), bname.buf);
+ FREE_AND_NULL(virtual_target);
+ }
ret = 1;
continue;
}
@@ -283,7 +304,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
item = string_list_append(&refs_to_delete, name);
item->util = xstrdup((flags & REF_ISBROKEN) ? "broken"
: (flags & REF_ISSYMREF) ? target
- : find_unique_abbrev(&oid, DEFAULT_ABBREV));
+ : repo_find_unique_abbrev(the_repository, &oid, DEFAULT_ABBREV));
next:
free(target);
@@ -451,6 +472,7 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
if (verify_ref_format(format))
die(_("unable to parse format string"));
+ filter_ahead_behind(the_repository, format, &array);
ref_array_sort(sorting, &array);
for (i = 0; i < array.nr; i++) {
@@ -464,7 +486,8 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
string_list_append(output, out.buf);
} else {
fwrite(out.buf, 1, out.len, stdout);
- putchar('\n');
+ if (out.len || !omit_empty)
+ putchar('\n');
}
}
@@ -489,9 +512,9 @@ static void print_current_branch_name(void)
die(_("HEAD (%s) points outside of refs/heads/"), refname);
}
-static void reject_rebase_or_bisect_branch(const char *target)
+static void reject_rebase_or_bisect_branch(struct worktree **worktrees,
+ const char *target)
{
- struct worktree **worktrees = get_worktrees();
int i;
for (i = 0; worktrees[i]; i++) {
@@ -508,24 +531,50 @@ static void reject_rebase_or_bisect_branch(const char *target)
die(_("Branch %s is being bisected at %s"),
target, wt->path);
}
+}
- free_worktrees(worktrees);
+/*
+ * Update all per-worktree HEADs pointing at the old ref to point the new ref.
+ * This will be used when renaming a branch. Returns 0 if successful, non-zero
+ * otherwise.
+ */
+static int replace_each_worktree_head_symref(struct worktree **worktrees,
+ const char *oldref, const char *newref,
+ const char *logmsg)
+{
+ int ret = 0;
+ int i;
+
+ for (i = 0; worktrees[i]; i++) {
+ struct ref_store *refs;
+
+ if (worktrees[i]->is_detached)
+ continue;
+ if (!worktrees[i]->head_ref)
+ continue;
+ if (strcmp(oldref, worktrees[i]->head_ref))
+ continue;
+
+ refs = get_worktree_ref_store(worktrees[i]);
+ if (refs_create_symref(refs, "HEAD", newref, logmsg))
+ ret = error(_("HEAD of working tree %s is not updated"),
+ worktrees[i]->path);
+ }
+
+ return ret;
}
+#define IS_HEAD 1
+#define IS_ORPHAN 2
+
static void copy_or_rename_branch(const char *oldname, const char *newname, int copy, int force)
{
struct strbuf oldref = STRBUF_INIT, newref = STRBUF_INIT, logmsg = STRBUF_INIT;
struct strbuf oldsection = STRBUF_INIT, newsection = STRBUF_INIT;
const char *interpreted_oldname = NULL;
const char *interpreted_newname = NULL;
- int recovery = 0;
-
- if (!oldname) {
- if (copy)
- die(_("cannot copy the current branch while not on any."));
- else
- die(_("cannot rename the current branch while not on any."));
- }
+ int recovery = 0, oldref_usage = 0;
+ struct worktree **worktrees = get_worktrees();
if (strbuf_check_branch_ref(&oldref, oldname)) {
/*
@@ -538,8 +587,19 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int
die(_("Invalid branch name: '%s'"), oldname);
}
- if ((copy || strcmp(head, oldname)) && !ref_exists(oldref.buf)) {
- if (copy && !strcmp(head, oldname))
+ for (int i = 0; worktrees[i]; i++) {
+ struct worktree *wt = worktrees[i];
+
+ if (wt->head_ref && !strcmp(oldref.buf, wt->head_ref)) {
+ oldref_usage |= IS_HEAD;
+ if (is_null_oid(&wt->head_oid))
+ oldref_usage |= IS_ORPHAN;
+ break;
+ }
+ }
+
+ if ((copy || !(oldref_usage & IS_HEAD)) && !ref_exists(oldref.buf)) {
+ if (oldref_usage & IS_HEAD)
die(_("No commit on branch '%s' yet."), oldname);
else
die(_("No branch named '%s'."), oldname);
@@ -554,7 +614,7 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int
else
validate_new_branchname(newname, &newref, force);
- reject_rebase_or_bisect_branch(oldref.buf);
+ reject_rebase_or_bisect_branch(worktrees, oldref.buf);
if (!skip_prefix(oldref.buf, "refs/heads/", &interpreted_oldname) ||
!skip_prefix(newref.buf, "refs/heads/", &interpreted_newname)) {
@@ -568,8 +628,7 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int
strbuf_addf(&logmsg, "Branch: renamed %s to %s",
oldref.buf, newref.buf);
- if (!copy &&
- (!head || strcmp(oldname, head) || !is_null_oid(&head_oid)) &&
+ if (!copy && !(oldref_usage & IS_ORPHAN) &&
rename_ref(oldref.buf, newref.buf, logmsg.buf))
die(_("Branch rename failed"));
if (copy && copy_existing_ref(oldref.buf, newref.buf, logmsg.buf))
@@ -584,22 +643,24 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int
interpreted_oldname);
}
- if (!copy &&
- replace_each_worktree_head_symref(oldref.buf, newref.buf, logmsg.buf))
+ if (!copy && (oldref_usage & IS_HEAD) &&
+ replace_each_worktree_head_symref(worktrees, oldref.buf, newref.buf,
+ logmsg.buf))
die(_("Branch renamed to %s, but HEAD is not updated!"), newname);
strbuf_release(&logmsg);
strbuf_addf(&oldsection, "branch.%s", interpreted_oldname);
- strbuf_release(&oldref);
strbuf_addf(&newsection, "branch.%s", interpreted_newname);
- strbuf_release(&newref);
if (!copy && git_config_rename_section(oldsection.buf, newsection.buf) < 0)
die(_("Branch is renamed, but update of config-file failed"));
- if (copy && strcmp(oldname, newname) && git_config_copy_section(oldsection.buf, newsection.buf) < 0)
+ if (copy && strcmp(interpreted_oldname, interpreted_newname) && git_config_copy_section(oldsection.buf, newsection.buf) < 0)
die(_("Branch is copied, but update of config-file failed"));
+ strbuf_release(&oldref);
+ strbuf_release(&newref);
strbuf_release(&oldsection);
strbuf_release(&newsection);
+ free_worktrees(worktrees);
}
static GIT_PATH_FUNC(edit_description, "EDIT_DESCRIPTION")
@@ -680,6 +741,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
OPT_BIT('D', NULL, &delete, N_("delete branch (even if not merged)"), 2),
OPT_BIT('m', "move", &rename, N_("move/rename a branch and its reflog"), 1),
OPT_BIT('M', NULL, &rename, N_("move/rename a branch, even if target exists"), 2),
+ OPT_BOOL(0, "omit-empty", &omit_empty,
+ N_("do not output a newline after empty formatted refs")),
OPT_BIT('c', "copy", &copy, N_("copy a branch and its reflog"), 1),
OPT_BIT('C', NULL, &copy, N_("copy a branch, even if target exists"), 2),
OPT_BOOL('l', "list", &list, N_("list branch names")),
@@ -800,53 +863,56 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
} 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)
- branch_name = argv[0];
- else
+ } else if (argc == 1) {
+ strbuf_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 (!ref_exists(branch_ref.buf)) {
- strbuf_release(&branch_ref);
-
- if (!argc || !strcmp(head, branch_name))
- return error(_("No commit on branch '%s' yet."),
- branch_name);
- else
- return error(_("No branch named '%s'."),
- branch_name);
- }
+ if (!ref_exists(branch_ref.buf))
+ error((!argc || branch_checked_out(branch_ref.buf))
+ ? _("No commit on branch '%s' yet.")
+ : _("No branch named '%s'."),
+ branch_name);
+ else if (!edit_branch_description(branch_name))
+ ret = 0; /* happy */
+
strbuf_release(&branch_ref);
+ strbuf_release(&buf);
- if (edit_branch_description(branch_name))
- return 1;
- } else if (copy) {
+ return ret;
+ } else if (copy || rename) {
if (!argc)
die(_("branch name required"));
+ else if ((argc == 1) && filter.detached)
+ die(copy? _("cannot copy the current branch while not on any.")
+ : _("cannot rename the current branch while not on any."));
else if (argc == 1)
- copy_or_rename_branch(head, argv[0], 1, copy > 1);
+ copy_or_rename_branch(head, argv[0], copy, copy + rename > 1);
else if (argc == 2)
- copy_or_rename_branch(argv[0], argv[1], 1, copy > 1);
+ copy_or_rename_branch(argv[0], argv[1], copy, copy + rename > 1);
else
- die(_("too many branches for a copy operation"));
- } else if (rename) {
- if (!argc)
- die(_("branch name required"));
- else if (argc == 1)
- copy_or_rename_branch(head, argv[0], 0, rename > 1);
- else if (argc == 2)
- copy_or_rename_branch(argv[0], argv[1], 0, rename > 1);
- else
- die(_("too many arguments for a rename operation"));
+ die(copy? _("too many branches for a copy operation")
+ : _("too many arguments for a rename operation"));
} else if (new_upstream) {
- struct branch *branch = branch_get(argv[0]);
+ struct branch *branch;
+ struct strbuf buf = STRBUF_INIT;
- if (argc > 1)
+ if (!argc)
+ branch = branch_get(NULL);
+ else if (argc == 1) {
+ strbuf_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
+ branch = branch_get(buf.buf);
+ } else
die(_("too many arguments to set new upstream"));
if (!branch) {
@@ -858,7 +924,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
}
if (!ref_exists(branch->refname)) {
- if (!argc || !strcmp(head, branch->name))
+ if (!argc || branch_checked_out(branch->refname))
die(_("No commit on branch '%s' yet."), branch->name);
die(_("branch '%s' does not exist"), branch->name);
}
@@ -866,11 +932,17 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
dwim_and_setup_tracking(the_repository, branch->name,
new_upstream, BRANCH_TRACK_OVERRIDE,
quiet);
+ strbuf_release(&buf);
} else if (unset_upstream) {
- struct branch *branch = branch_get(argv[0]);
+ struct branch *branch;
struct strbuf buf = STRBUF_INIT;
- if (argc > 1)
+ if (!argc)
+ branch = branch_get(NULL);
+ else if (argc == 1) {
+ strbuf_branchname(&buf, argv[0], INTERPRET_BRANCH_LOCAL);
+ branch = branch_get(buf.buf);
+ } else
die(_("too many arguments to unset upstream"));
if (!branch) {
@@ -883,6 +955,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
if (!branch_has_merge_config(branch))
die(_("Branch '%s' has no upstream information"), branch->name);
+ strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.remote", branch->name);
git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
strbuf_reset(&buf);
diff --git a/builtin/bugreport.c b/builtin/bugreport.c
index 530895be55..daf6c23657 100644
--- a/builtin/bugreport.c
+++ b/builtin/bugreport.c
@@ -1,4 +1,7 @@
#include "builtin.h"
+#include "abspath.h"
+#include "editor.h"
+#include "gettext.h"
#include "parse-options.h"
#include "strbuf.h"
#include "help.h"
@@ -6,7 +9,9 @@
#include "hook.h"
#include "hook-list.h"
#include "diagnose.h"
-
+#include "object-file.h"
+#include "setup.h"
+#include "wrapper.h"
static void get_system_info(struct strbuf *sys_info)
{
@@ -60,7 +65,8 @@ static void get_populated_hooks(struct strbuf *hook_info, int nongit)
}
static const char * const bugreport_usage[] = {
- N_("git bugreport [-o|--output-directory <file>] [-s|--suffix <format>] [--diagnose[=<mode>]"),
+ N_("git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+ " [--diagnose[=<mode>]]"),
NULL
};
@@ -105,6 +111,7 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
const char *user_relative_path = NULL;
char *prefixed_filename;
size_t output_path_len;
+ int ret;
const struct option bugreport_options[] = {
OPT_CALLBACK_F(0, "diagnose", &diagnose, N_("mode"),
@@ -181,7 +188,9 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
user_relative_path);
free(prefixed_filename);
- UNLEAK(buffer);
- UNLEAK(report_path);
- return !!launch_editor(report_path.buf, NULL, NULL);
+ strbuf_release(&buffer);
+
+ ret = !!launch_editor(report_path.buf, NULL, NULL);
+ strbuf_release(&report_path);
+ return ret;
}
diff --git a/builtin/bundle.c b/builtin/bundle.c
index e80efce3a4..44113389d7 100644
--- a/builtin/bundle.c
+++ b/builtin/bundle.c
@@ -1,6 +1,11 @@
#include "builtin.h"
+#include "abspath.h"
+#include "gettext.h"
+#include "setup.h"
#include "strvec.h"
#include "parse-options.h"
+#include "pkt-line.h"
+#include "repository.h"
#include "cache.h"
#include "bundle.h"
@@ -11,32 +16,42 @@
* bundle supporting "fetch", "pull", and "ls-remote".
*/
-static const char * const builtin_bundle_usage[] = {
- N_("git bundle create [<options>] <file> <git-rev-list args>"),
- N_("git bundle verify [<options>] <file>"),
- N_("git bundle list-heads <file> [<refname>...]"),
- N_("git bundle unbundle <file> [<refname>...]"),
- NULL
+#define BUILTIN_BUNDLE_CREATE_USAGE \
+ N_("git bundle create [-q | --quiet | --progress]\n" \
+ " [--version=<version>] <file> <git-rev-list-args>")
+#define BUILTIN_BUNDLE_VERIFY_USAGE \
+ N_("git bundle verify [-q | --quiet] <file>")
+#define BUILTIN_BUNDLE_LIST_HEADS_USAGE \
+ N_("git bundle list-heads <file> [<refname>...]")
+#define BUILTIN_BUNDLE_UNBUNDLE_USAGE \
+ N_("git bundle unbundle [--progress] <file> [<refname>...]")
+
+static char const * const builtin_bundle_usage[] = {
+ BUILTIN_BUNDLE_CREATE_USAGE,
+ BUILTIN_BUNDLE_VERIFY_USAGE,
+ BUILTIN_BUNDLE_LIST_HEADS_USAGE,
+ BUILTIN_BUNDLE_UNBUNDLE_USAGE,
+ NULL,
};
static const char * const builtin_bundle_create_usage[] = {
- N_("git bundle create [<options>] <file> <git-rev-list args>"),
- NULL
+ BUILTIN_BUNDLE_CREATE_USAGE,
+ NULL
};
static const char * const builtin_bundle_verify_usage[] = {
- N_("git bundle verify [<options>] <file>"),
- NULL
+ BUILTIN_BUNDLE_VERIFY_USAGE,
+ NULL
};
static const char * const builtin_bundle_list_heads_usage[] = {
- N_("git bundle list-heads <file> [<refname>...]"),
- NULL
+ BUILTIN_BUNDLE_LIST_HEADS_USAGE,
+ NULL
};
static const char * const builtin_bundle_unbundle_usage[] = {
- N_("git bundle unbundle <file> [<refname>...]"),
- NULL
+ BUILTIN_BUNDLE_UNBUNDLE_USAGE,
+ NULL
};
static int parse_options_cmd_bundle(int argc,
@@ -45,17 +60,16 @@ static int parse_options_cmd_bundle(int argc,
const char * const usagestr[],
const struct option options[],
char **bundle_file) {
- int newargc;
- newargc = parse_options(argc, argv, NULL, options, usagestr,
+ argc = parse_options(argc, argv, NULL, options, usagestr,
PARSE_OPT_STOP_AT_NON_OPTION);
- if (argc < 1)
- usage_with_options(usagestr, options);
- *bundle_file = prefix_filename(prefix, argv[0]);
- return newargc;
+ if (!argc)
+ usage_msg_opt(_("need a <file> argument"), usagestr, options);
+ *bundle_file = prefix_filename_except_for_dash(prefix, argv[0]);
+ return argc;
}
static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {
- int all_progress_implied = 0;
+ int all_progress_implied = 1;
int progress = isatty(STDERR_FILENO);
struct strvec pack_opts;
int version = -1;
@@ -65,11 +79,12 @@ static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {
N_("do not show progress meter"), 0),
OPT_SET_INT(0, "progress", &progress,
N_("show progress meter"), 1),
- OPT_SET_INT(0, "all-progress", &progress,
- N_("show progress meter during object writing phase"), 2),
- OPT_BOOL(0, "all-progress-implied",
- &all_progress_implied,
- N_("similar to --all-progress when progress meter is shown")),
+ OPT_SET_INT_F(0, "all-progress", &progress,
+ N_("historical; same as --progress"), 2,
+ PARSE_OPT_HIDDEN),
+ OPT_HIDDEN_BOOL(0, "all-progress-implied",
+ &all_progress_implied,
+ N_("historical; does nothing")),
OPT_INTEGER(0, "version", &version,
N_("specify bundle format version")),
OPT_END()
@@ -98,6 +113,23 @@ static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {
return ret;
}
+/*
+ * Similar to read_bundle_header(), but handle "-" as stdin.
+ */
+static int open_bundle(const char *path, struct bundle_header *header,
+ const char **name)
+{
+ if (!strcmp(path, "-")) {
+ if (name)
+ *name = "<stdin>";
+ return read_bundle_header_fd(0, header, "<stdin>");
+ }
+
+ if (name)
+ *name = path;
+ return read_bundle_header(path, header);
+}
+
static int cmd_bundle_verify(int argc, const char **argv, const char *prefix) {
struct bundle_header header = BUNDLE_HEADER_INIT;
int bundle_fd = -1;
@@ -109,22 +141,24 @@ static int cmd_bundle_verify(int argc, const char **argv, const char *prefix) {
OPT_END()
};
char *bundle_file;
+ const char *name;
argc = parse_options_cmd_bundle(argc, argv, prefix,
builtin_bundle_verify_usage, options, &bundle_file);
/* bundle internals use argv[1] as further parameters */
- if ((bundle_fd = read_bundle_header(bundle_file, &header)) < 0) {
+ if ((bundle_fd = open_bundle(bundle_file, &header, &name)) < 0) {
ret = 1;
goto cleanup;
}
close(bundle_fd);
- if (verify_bundle(the_repository, &header, !quiet)) {
+ if (verify_bundle(the_repository, &header,
+ quiet ? VERIFY_BUNDLE_QUIET : VERIFY_BUNDLE_VERBOSE)) {
ret = 1;
goto cleanup;
}
- fprintf(stderr, _("%s is okay\n"), bundle_file);
+ fprintf(stderr, _("%s is okay\n"), name);
ret = 0;
cleanup:
free(bundle_file);
@@ -145,7 +179,7 @@ static int cmd_bundle_list_heads(int argc, const char **argv, const char *prefix
builtin_bundle_list_heads_usage, options, &bundle_file);
/* bundle internals use argv[1] as further parameters */
- if ((bundle_fd = read_bundle_header(bundle_file, &header)) < 0) {
+ if ((bundle_fd = open_bundle(bundle_file, &header, NULL)) < 0) {
ret = 1;
goto cleanup;
}
@@ -175,7 +209,7 @@ static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix)
builtin_bundle_unbundle_usage, options, &bundle_file);
/* bundle internals use argv[1] as further parameters */
- if ((bundle_fd = read_bundle_header(bundle_file, &header)) < 0) {
+ if ((bundle_fd = open_bundle(bundle_file, &header, NULL)) < 0) {
ret = 1;
goto cleanup;
}
@@ -185,7 +219,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) ||
+ &extra_index_pack_args, 0) ||
list_bundle_refs(&header, argc, argv);
bundle_header_release(&header);
cleanup:
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 989eee0bb4..0bafc14e6c 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -3,20 +3,30 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "cache.h"
+#include "alloc.h"
#include "config.h"
+#include "convert.h"
#include "builtin.h"
#include "diff.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
+#include "ident.h"
#include "parse-options.h"
#include "userdiff.h"
#include "streaming.h"
#include "tree-walk.h"
#include "oid-array.h"
#include "packfile.h"
+#include "object-file.h"
+#include "object-name.h"
#include "object-store.h"
+#include "replace-object.h"
#include "promisor-remote.h"
#include "mailmap.h"
+#include "write-or-die.h"
enum batch_mode {
BATCH_MODE_CONTENTS,
@@ -60,7 +70,7 @@ static int filter_object(const char *path, unsigned mode,
{
enum object_type type;
- *buf = read_object_file(oid, &type, size);
+ *buf = repo_read_object_file(the_repository, oid, &type, size);
if (!*buf)
return error(_("cannot read object %s '%s'"),
oid_to_hex(oid), path);
@@ -132,14 +142,27 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
case 's':
oi.sizep = &size;
+
+ if (use_mailmap) {
+ oi.typep = &type;
+ oi.contentp = (void**)&buf;
+ }
+
if (oid_object_info_extended(the_repository, &oid, &oi, flags) < 0)
die("git cat-file: could not get object info");
+
+ if (use_mailmap && (type == OBJ_COMMIT || type == OBJ_TAG)) {
+ size_t s = size;
+ buf = replace_idents_using_mailmap(buf, &s);
+ size = cast_size_t_to_ulong(s);
+ }
+
printf("%"PRIuMAX"\n", (uintmax_t)size);
ret = 0;
goto cleanup;
case 'e':
- return !has_object_file(&oid);
+ return !repo_has_object_file(the_repository, &oid);
case 'w':
@@ -174,7 +197,8 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
ret = stream_blob(&oid);
goto cleanup;
}
- buf = read_object_file(&oid, &type, &size);
+ buf = repo_read_object_file(the_repository, &oid, &type,
+ &size);
if (!buf)
die("Cannot read object %s", obj_name);
@@ -194,8 +218,10 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
if (exp_type_id == OBJ_BLOB) {
struct object_id blob_oid;
if (oid_object_info(the_repository, &oid, NULL) == OBJ_TAG) {
- char *buffer = read_object_file(&oid, &type,
- &size);
+ char *buffer = repo_read_object_file(the_repository,
+ &oid,
+ &type,
+ &size);
const char *target;
if (!skip_prefix(buffer, "object ", &target) ||
get_oid_hex(target, &blob_oid))
@@ -370,9 +396,10 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
if (!textconv_object(the_repository,
data->rest, 0100644, oid,
1, &contents, &size))
- contents = read_object_file(oid,
- &type,
- &size);
+ contents = repo_read_object_file(the_repository,
+ oid,
+ &type,
+ &size);
if (!contents)
die("could not convert '%s' %s",
oid_to_hex(oid), data->rest);
@@ -389,7 +416,8 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
unsigned long size;
void *contents;
- contents = read_object_file(oid, &type, &size);
+ contents = repo_read_object_file(the_repository, oid, &type,
+ &size);
if (use_mailmap) {
size_t s = size;
@@ -431,6 +459,9 @@ static void batch_object_write(const char *obj_name,
if (!data->skip_object_info) {
int ret;
+ if (use_mailmap)
+ data->info.typep = &data->type;
+
if (pack)
ret = packed_object_info(the_repository, pack, offset,
&data->info);
@@ -444,6 +475,18 @@ static void batch_object_write(const char *obj_name,
fflush(stdout);
return;
}
+
+ if (use_mailmap && (data->type == OBJ_COMMIT || data->type == OBJ_TAG)) {
+ size_t s = data->size;
+ char *buf = NULL;
+
+ buf = repo_read_object_file(the_repository, &data->oid, &data->type,
+ &data->size);
+ buf = replace_idents_using_mailmap(buf, &s);
+ data->size = cast_size_t_to_ulong(s);
+
+ free(buf);
+ }
}
strbuf_reset(scratch);
@@ -531,7 +574,7 @@ static int batch_object_cb(const struct object_id *oid, void *vdata)
}
static int collect_loose_object(const struct object_id *oid,
- const char *path,
+ const char *path UNUSED,
void *data)
{
oid_array_append(data, oid);
@@ -539,8 +582,8 @@ static int collect_loose_object(const struct object_id *oid,
}
static int collect_packed_object(const struct object_id *oid,
- struct packed_git *pack,
- uint32_t pos,
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED,
void *data)
{
oid_array_append(data, oid);
@@ -563,7 +606,7 @@ static int batch_unordered_object(const struct object_id *oid,
}
static int batch_unordered_loose(const struct object_id *oid,
- const char *path,
+ const char *path UNUSED,
void *data)
{
return batch_unordered_object(oid, NULL, 0, data);
@@ -759,7 +802,7 @@ static int batch_objects(struct batch_options *opt)
if (!memcmp(&data.info, &empty, sizeof(empty)))
data.skip_object_info = 1;
- if (has_promisor_remote())
+ if (repo_has_promisor_remote(the_repository))
warning("This repository uses promisor remotes. Some objects may not be loaded.");
read_replace_refs = 0;
@@ -893,7 +936,7 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
N_("git cat-file (-t | -s) [--allow-unknown-type] <object>"),
N_("git cat-file (--batch | --batch-check | --batch-command) [--batch-all-objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
- " [--textconv | --filters]"),
+ " [--textconv | --filters] [-z]"),
N_("git cat-file (--textconv | --filters)\n"
" [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]"),
NULL
diff --git a/builtin/check-attr.c b/builtin/check-attr.c
index dd83397786..b2b678847f 100644
--- a/builtin/check-attr.c
+++ b/builtin/check-attr.c
@@ -1,17 +1,24 @@
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
#include "cache.h"
#include "config.h"
#include "attr.h"
+#include "environment.h"
+#include "gettext.h"
+#include "object-name.h"
#include "quote.h"
+#include "repository.h"
+#include "setup.h"
#include "parse-options.h"
+#include "write-or-die.h"
static int all_attrs;
static int cached_attrs;
static int stdin_paths;
+static char *source;
static const char * const check_attr_usage[] = {
-N_("git check-attr [-a | --all | <attr>...] [--] <pathname>..."),
-N_("git check-attr --stdin [-z] [-a | --all | <attr>...]"),
+N_("git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] <pathname>..."),
+N_("git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]"),
NULL
};
@@ -23,6 +30,7 @@ static const struct option check_attr_options[] = {
OPT_BOOL(0 , "stdin", &stdin_paths, N_("read file names from stdin")),
OPT_BOOL('z', NULL, &nul_term_line,
N_("terminate input and output records by a NUL character")),
+ OPT_STRING(0, "source", &source, N_("<tree-ish>"), N_("which tree-ish to check attributes at")),
OPT_END()
};
@@ -55,27 +63,26 @@ static void output_attr(struct attr_check *check, const char *file)
}
}
-static void check_attr(const char *prefix,
- struct attr_check *check,
- int collect_all,
+static void check_attr(const char *prefix, struct attr_check *check,
+ const struct object_id *tree_oid, int collect_all,
const char *file)
+
{
char *full_path =
prefix_path(prefix, prefix ? strlen(prefix) : 0, file);
if (collect_all) {
- git_all_attrs(&the_index, full_path, check);
+ git_all_attrs(&the_index, tree_oid, full_path, check);
} else {
- git_check_attr(&the_index, full_path, check);
+ git_check_attr(&the_index, tree_oid, full_path, check);
}
output_attr(check, file);
free(full_path);
}
-static void check_attr_stdin_paths(const char *prefix,
- struct attr_check *check,
- int collect_all)
+static void check_attr_stdin_paths(const char *prefix, struct attr_check *check,
+ const struct object_id *tree_oid, int collect_all)
{
struct strbuf buf = STRBUF_INIT;
struct strbuf unquoted = STRBUF_INIT;
@@ -89,7 +96,7 @@ static void check_attr_stdin_paths(const char *prefix,
die("line is badly quoted");
strbuf_swap(&buf, &unquoted);
}
- check_attr(prefix, check, collect_all, buf.buf);
+ check_attr(prefix, check, tree_oid, collect_all, buf.buf);
maybe_flush_or_die(stdout, "attribute to stdout");
}
strbuf_release(&buf);
@@ -105,6 +112,8 @@ static NORETURN void error_with_usage(const char *msg)
int cmd_check_attr(int argc, const char **argv, const char *prefix)
{
struct attr_check *check;
+ struct object_id *tree_oid = NULL;
+ struct object_id initialized_oid;
int cnt, i, doubledash, filei;
if (!is_bare_repository())
@@ -115,7 +124,7 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, check_attr_options,
check_attr_usage, PARSE_OPT_KEEP_DASHDASH);
- if (read_cache() < 0) {
+ if (repo_read_index(the_repository) < 0) {
die("invalid cache");
}
@@ -176,11 +185,17 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
}
}
+ if (source) {
+ if (repo_get_oid_tree(the_repository, source, &initialized_oid))
+ die("%s: not a valid tree-ish source", source);
+ tree_oid = &initialized_oid;
+ }
+
if (stdin_paths)
- check_attr_stdin_paths(prefix, check, all_attrs);
+ check_attr_stdin_paths(prefix, check, tree_oid, all_attrs);
else {
for (i = filei; i < argc; i++)
- check_attr(prefix, check, all_attrs, argv[i]);
+ check_attr(prefix, check, tree_oid, all_attrs, argv[i]);
maybe_flush_or_die(stdout, "attribute to stdout");
}
diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c
index 2191256965..e4b78782a3 100644
--- a/builtin/check-ignore.c
+++ b/builtin/check-ignore.c
@@ -1,12 +1,15 @@
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
#include "cache.h"
#include "config.h"
#include "dir.h"
+#include "gettext.h"
#include "quote.h"
#include "pathspec.h"
#include "parse-options.h"
+#include "repository.h"
#include "submodule.h"
+#include "write-or-die.h"
static int quiet, verbose, stdin_paths, show_non_matching, no_index;
static const char * const check_ignore_usage[] = {
@@ -179,7 +182,7 @@ int cmd_check_ignore(int argc, const char **argv, const char *prefix)
die(_("--non-matching is only valid with --verbose"));
/* read_cache() is only necessary so we can watch out for submodules. */
- if (!no_index && read_cache() < 0)
+ if (!no_index && repo_read_index(the_repository) < 0)
die(_("index file corrupt"));
setup_standard_excludes(&dir);
diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c
index 7dc47e4793..002d2941e9 100644
--- a/builtin/check-mailmap.c
+++ b/builtin/check-mailmap.c
@@ -1,8 +1,11 @@
#include "builtin.h"
#include "config.h"
+#include "gettext.h"
+#include "ident.h"
#include "mailmap.h"
#include "parse-options.h"
#include "string-list.h"
+#include "write-or-die.h"
static int use_stdin;
static const char * const check_mailmap_usage[] = {
diff --git a/builtin/check-ref-format.c b/builtin/check-ref-format.c
index fd0e5f8683..57f0505070 100644
--- a/builtin/check-ref-format.c
+++ b/builtin/check-ref-format.c
@@ -5,6 +5,7 @@
#include "cache.h"
#include "refs.h"
#include "builtin.h"
+#include "setup.h"
#include "strbuf.h"
static const char builtin_check_ref_format_usage[] =
@@ -60,6 +61,8 @@ int cmd_check_ref_format(int argc, const char **argv, const char *prefix)
char *to_free = NULL;
int ret = 1;
+ BUG_ON_NON_EMPTY_PREFIX(prefix);
+
if (argc == 2 && !strcmp(argv[1], "-h"))
usage(builtin_check_ref_format_usage);
diff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c
index ede7dc32a4..2120dd1d30 100644
--- a/builtin/checkout--worker.c
+++ b/builtin/checkout--worker.c
@@ -1,6 +1,8 @@
#include "builtin.h"
+#include "alloc.h"
#include "config.h"
#include "entry.h"
+#include "gettext.h"
#include "parallel-checkout.h"
#include "parse-options.h"
#include "pkt-line.h"
diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c
index 97e06e8c52..9375a05539 100644
--- a/builtin/checkout-index.c
+++ b/builtin/checkout-index.c
@@ -4,16 +4,19 @@
* Copyright (C) 2005 Linus Torvalds
*
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
#include "config.h"
#include "dir.h"
+#include "gettext.h"
#include "lockfile.h"
#include "quote.h"
+#include "repository.h"
#include "cache-tree.h"
#include "parse-options.h"
#include "entry.h"
#include "parallel-checkout.h"
+#include "setup.h"
#define CHECKOUT_ALL 4
static int nul_term_line;
@@ -65,7 +68,7 @@ static void write_tempfile_record(const char *name, const char *prefix)
static int checkout_file(const char *name, const char *prefix)
{
int namelen = strlen(name);
- int pos = cache_name_pos(name, namelen);
+ int pos = index_name_pos(&the_index, name, namelen);
int has_same_name = 0;
int is_file = 0;
int is_skipped = 1;
@@ -75,8 +78,8 @@ static int checkout_file(const char *name, const char *prefix)
if (pos < 0)
pos = -pos - 1;
- while (pos < active_nr) {
- struct cache_entry *ce = active_cache[pos];
+ while (pos < the_index.cache_nr) {
+ struct cache_entry *ce = the_index.cache[pos];
if (ce_namelen(ce) != namelen ||
memcmp(ce->name, name, namelen))
break;
@@ -136,8 +139,8 @@ static int checkout_all(const char *prefix, int prefix_length)
int i, errs = 0;
struct cache_entry *last_ce = NULL;
- for (i = 0; i < active_nr ; i++) {
- struct cache_entry *ce = active_cache[i];
+ for (i = 0; i < the_index.cache_nr ; i++) {
+ struct cache_entry *ce = the_index.cache[i];
if (S_ISSPARSEDIR(ce->ce_mode)) {
if (!ce_skip_worktree(ce))
@@ -151,7 +154,7 @@ static int checkout_all(const char *prefix, int prefix_length)
*/
if (ignore_skip_worktree) {
ensure_full_index(&the_index);
- ce = active_cache[i];
+ ce = the_index.cache[i];
}
}
@@ -249,7 +252,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
- if (read_cache() < 0) {
+ if (repo_read_index(the_repository) < 0) {
die("invalid cache");
}
@@ -270,7 +273,8 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
if (index_opt && !state.base_dir_len && !to_tempfile) {
state.refresh_cache = 1;
state.istate = &the_index;
- hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &lock_file,
+ LOCK_DIE_ON_ERROR);
}
get_parallel_checkout_configs(&pc_workers, &pc_threshold);
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 2a132392fb..715eeb5048 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1,4 +1,4 @@
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
#include "advice.h"
#include "blob.h"
@@ -9,10 +9,15 @@
#include "config.h"
#include "diff.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "hook.h"
#include "ll-merge.h"
#include "lockfile.h"
+#include "mem-pool.h"
#include "merge-recursive.h"
+#include "object-name.h"
#include "object-store.h"
#include "parse-options.h"
#include "refs.h"
@@ -20,8 +25,11 @@
#include "resolve-undo.h"
#include "revision.h"
#include "run-command.h"
+#include "setup.h"
#include "submodule.h"
#include "submodule-config.h"
+#include "symlinks.h"
+#include "trace2.h"
#include "tree.h"
#include "tree-walk.h"
#include "unpack-trees.h"
@@ -29,6 +37,7 @@
#include "xdiff-interface.h"
#include "entry.h"
#include "parallel-checkout.h"
+#include "add-interactive.h"
static const char * const checkout_usage[] = {
N_("git checkout [<options>] <branch>"),
@@ -74,7 +83,7 @@ struct checkout_opts {
const char *ignore_unmerged_opt;
int ignore_unmerged;
int pathspec_file_nul;
- const char *pathspec_from_file;
+ char *pathspec_from_file;
const char *new_branch;
const char *new_branch_force;
@@ -148,9 +157,9 @@ static int update_some(const struct object_id *oid, struct strbuf *base,
* entry in place. Whether it is UPTODATE or not, checkout_entry will
* do the right thing.
*/
- pos = cache_name_pos(ce->name, ce->ce_namelen);
+ pos = index_name_pos(&the_index, ce->name, ce->ce_namelen);
if (pos >= 0) {
- struct cache_entry *old = active_cache[pos];
+ struct cache_entry *old = the_index.cache[pos];
if (ce->ce_mode == old->ce_mode &&
!ce_intent_to_add(old) &&
oideq(&ce->oid, &old->oid)) {
@@ -160,7 +169,8 @@ static int update_some(const struct object_id *oid, struct strbuf *base,
}
}
- add_cache_entry(ce, ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE);
+ add_index_entry(&the_index, ce,
+ ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE);
return 0;
}
@@ -178,8 +188,8 @@ static int read_tree_some(struct tree *tree, const struct pathspec *pathspec)
static int skip_same_name(const struct cache_entry *ce, int pos)
{
- while (++pos < active_nr &&
- !strcmp(active_cache[pos]->name, ce->name))
+ while (++pos < the_index.cache_nr &&
+ !strcmp(the_index.cache[pos]->name, ce->name))
; /* skip */
return pos;
}
@@ -187,9 +197,9 @@ static int skip_same_name(const struct cache_entry *ce, int pos)
static int check_stage(int stage, const struct cache_entry *ce, int pos,
int overlay_mode)
{
- while (pos < active_nr &&
- !strcmp(active_cache[pos]->name, ce->name)) {
- if (ce_stage(active_cache[pos]) == stage)
+ while (pos < the_index.cache_nr &&
+ !strcmp(the_index.cache[pos]->name, ce->name)) {
+ if (ce_stage(the_index.cache[pos]) == stage)
return 0;
pos++;
}
@@ -206,8 +216,8 @@ static int check_stages(unsigned stages, const struct cache_entry *ce, int pos)
unsigned seen = 0;
const char *name = ce->name;
- while (pos < active_nr) {
- ce = active_cache[pos];
+ while (pos < the_index.cache_nr) {
+ ce = the_index.cache[pos];
if (strcmp(name, ce->name))
break;
seen |= (1 << ce_stage(ce));
@@ -223,15 +233,15 @@ static int checkout_stage(int stage, const struct cache_entry *ce, int pos,
const struct checkout *state, int *nr_checkouts,
int overlay_mode)
{
- while (pos < active_nr &&
- !strcmp(active_cache[pos]->name, ce->name)) {
- if (ce_stage(active_cache[pos]) == stage)
- return checkout_entry(active_cache[pos], state,
+ while (pos < the_index.cache_nr &&
+ !strcmp(the_index.cache[pos]->name, ce->name)) {
+ if (ce_stage(the_index.cache[pos]) == stage)
+ return checkout_entry(the_index.cache[pos], state,
NULL, nr_checkouts);
pos++;
}
if (!overlay_mode) {
- unlink_entry(ce);
+ unlink_entry(ce, NULL);
return 0;
}
if (stage == 2)
@@ -243,7 +253,7 @@ static int checkout_stage(int stage, const struct cache_entry *ce, int pos,
static int checkout_merged(int pos, const struct checkout *state,
int *nr_checkouts, struct mem_pool *ce_mem_pool)
{
- struct cache_entry *ce = active_cache[pos];
+ struct cache_entry *ce = the_index.cache[pos];
const char *path = ce->name;
mmfile_t ancestor, ours, theirs;
enum ll_merge_result merge_status;
@@ -256,7 +266,7 @@ static int checkout_merged(int pos, const struct checkout *state,
int renormalize = 0;
memset(threeway, 0, sizeof(threeway));
- while (pos < active_nr) {
+ while (pos < the_index.cache_nr) {
int stage;
stage = ce_stage(ce);
if (!stage || strcmp(path, ce->name))
@@ -265,7 +275,7 @@ static int checkout_merged(int pos, const struct checkout *state,
if (stage == 2)
mode = create_ce_mode(ce->ce_mode);
pos++;
- ce = active_cache[pos];
+ ce = the_index.cache[pos];
}
if (is_null_oid(&threeway[1]) || is_null_oid(&threeway[2]))
return error(_("path '%s' does not have necessary versions"), path);
@@ -391,8 +401,8 @@ static int checkout_worktree(const struct checkout_opts *opts,
if (pc_workers > 1)
init_parallel_checkout();
- for (pos = 0; pos < active_nr; pos++) {
- struct cache_entry *ce = active_cache[pos];
+ for (pos = 0; pos < the_index.cache_nr; pos++) {
+ struct cache_entry *ce = the_index.cache[pos];
if (ce->ce_flags & CE_MATCHED) {
if (!ce_stage(ce)) {
errs |= checkout_entry(ce, &state,
@@ -430,8 +440,8 @@ static int checkout_worktree(const struct checkout_opts *opts,
"Updated %d paths from %s",
nr_checkouts),
nr_checkouts,
- find_unique_abbrev(&opts->source_tree->object.oid,
- DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, &opts->source_tree->object.oid,
+ DEFAULT_ABBREV));
else if (!nr_unmerged || nr_checkouts)
fprintf_ln(stderr, Q_("Updated %d path from the index",
"Updated %d paths from the index",
@@ -487,18 +497,31 @@ static int checkout_paths(const struct checkout_opts *opts,
die(_("'%s' must be used when '%s' is not specified"),
"--worktree", "--source");
- if (opts->checkout_index && !opts->checkout_worktree &&
- opts->writeout_stage)
- die(_("'%s' or '%s' cannot be used with %s"),
- "--ours", "--theirs", "--staged");
-
- if (opts->checkout_index && !opts->checkout_worktree &&
- opts->merge)
- die(_("'%s' or '%s' cannot be used with %s"),
- "--merge", "--conflict", "--staged");
+ /*
+ * Reject --staged option to the restore command when combined with
+ * merge-related options. Use the accept_ref flag to distinguish it
+ * from the checkout command, which does not accept --staged anyway.
+ *
+ * `restore --ours|--theirs --worktree --staged` could mean resolving
+ * conflicted paths to one side in both the worktree and the index,
+ * but does not currently.
+ *
+ * `restore --merge|--conflict=<style>` already recreates conflicts
+ * in both the worktree and the index, so adding --staged would be
+ * meaningless.
+ */
+ if (!opts->accept_ref && opts->checkout_index) {
+ if (opts->writeout_stage)
+ die(_("'%s' or '%s' cannot be used with %s"),
+ "--ours", "--theirs", "--staged");
+
+ if (opts->merge)
+ die(_("'%s' or '%s' cannot be used with %s"),
+ "--merge", "--conflict", "--staged");
+ }
if (opts->patch_mode) {
- const char *patch_mode;
+ enum add_p_mode patch_mode;
const char *rev = new_branch_info->name;
char rev_oid[GIT_MAX_HEXSZ + 1];
@@ -516,19 +539,20 @@ static int checkout_paths(const struct checkout_opts *opts,
rev = oid_to_hex_r(rev_oid, &new_branch_info->commit->object.oid);
if (opts->checkout_index && opts->checkout_worktree)
- patch_mode = "--patch=checkout";
+ patch_mode = ADD_P_CHECKOUT;
else if (opts->checkout_index && !opts->checkout_worktree)
- patch_mode = "--patch=reset";
+ patch_mode = ADD_P_RESET;
else if (!opts->checkout_index && opts->checkout_worktree)
- patch_mode = "--patch=worktree";
+ patch_mode = ADD_P_WORKTREE;
else
BUG("either flag must have been set, worktree=%d, index=%d",
opts->checkout_worktree, opts->checkout_index);
- return run_add_interactive(rev, patch_mode, &opts->pathspec);
+ return !!run_add_p(the_repository, patch_mode, rev,
+ &opts->pathspec);
}
repo_hold_locked_index(the_repository, &lock_file, LOCK_DIE_ON_ERROR);
- if (read_cache_preload(&opts->pathspec) < 0)
+ if (repo_read_index_preload(the_repository, &opts->pathspec, 0) < 0)
return error(_("index file corrupt"));
if (opts->source_tree)
@@ -540,13 +564,13 @@ static int checkout_paths(const struct checkout_opts *opts,
* Make sure all pathspecs participated in locating the paths
* to be checked out.
*/
- for (pos = 0; pos < active_nr; pos++)
+ for (pos = 0; pos < the_index.cache_nr; pos++)
if (opts->overlay_mode)
- mark_ce_for_checkout_overlay(active_cache[pos],
+ mark_ce_for_checkout_overlay(the_index.cache[pos],
ps_matched,
opts);
else
- mark_ce_for_checkout_no_overlay(active_cache[pos],
+ mark_ce_for_checkout_no_overlay(the_index.cache[pos],
ps_matched,
opts);
@@ -561,8 +585,8 @@ static int checkout_paths(const struct checkout_opts *opts,
unmerge_marked_index(&the_index);
/* Any unmerged paths? */
- for (pos = 0; pos < active_nr; pos++) {
- const struct cache_entry *ce = active_cache[pos];
+ for (pos = 0; pos < the_index.cache_nr; pos++) {
+ const struct cache_entry *ce = the_index.cache[pos];
if (ce->ce_flags & CE_MATCHED) {
if (!ce_stage(ce))
continue;
@@ -637,14 +661,16 @@ static void describe_detached_head(const char *msg, struct commit *commit)
{
struct strbuf sb = STRBUF_INIT;
- if (!parse_commit(commit))
+ if (!repo_parse_commit(the_repository, commit))
pp_commit_easy(CMIT_FMT_ONELINE, commit, &sb);
if (print_sha1_ellipsis()) {
fprintf(stderr, "%s %s... %s\n", msg,
- find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV), sb.buf);
+ repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV),
+ sb.buf);
} else {
fprintf(stderr, "%s %s %s\n", msg,
- find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV), sb.buf);
+ repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV),
+ sb.buf);
}
strbuf_release(&sb);
}
@@ -698,7 +724,8 @@ static void setup_branch_path(struct branch_info *branch)
* If this is a ref, resolve it; otherwise, look up the OID for our
* expression. Failure here is okay.
*/
- if (!dwim_ref(branch->name, strlen(branch->name), &branch->oid, &branch->refname, 0))
+ if (!repo_dwim_ref(the_repository, branch->name, strlen(branch->name),
+ &branch->oid, &branch->refname, 0))
repo_get_oid_committish(the_repository, branch->name, &branch->oid);
strbuf_branchname(&buf, branch->name, INTERPRET_BRANCH_LOCAL);
@@ -722,7 +749,7 @@ static void init_topts(struct unpack_trees_options *topts, int merge,
setup_unpack_trees_porcelain(topts, "checkout");
- topts->initial_checkout = is_cache_unborn();
+ topts->initial_checkout = is_index_unborn(&the_index);
topts->update = 1;
topts->merge = 1;
topts->quiet = merge && old_commit;
@@ -740,17 +767,18 @@ static int merge_working_tree(const struct checkout_opts *opts,
struct lock_file lock_file = LOCK_INIT;
struct tree *new_tree;
- hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
- if (read_cache_preload(NULL) < 0)
+ repo_hold_locked_index(the_repository, &lock_file, LOCK_DIE_ON_ERROR);
+ if (repo_read_index_preload(the_repository, NULL, 0) < 0)
return error(_("index file corrupt"));
- resolve_undo_clear();
+ resolve_undo_clear_index(&the_index);
if (opts->new_orphan_branch && opts->orphan_from_empty_tree) {
if (new_branch_info->commit)
BUG("'switch --orphan' should never accept a commit as starting point");
new_tree = parse_tree_indirect(the_hash_algo->empty_tree);
} else
- new_tree = get_commit_tree(new_branch_info->commit);
+ new_tree = repo_get_commit_tree(the_repository,
+ new_branch_info->commit);
if (opts->discard_changes) {
ret = reset_tree(new_tree, opts, 1, writeout_error, new_branch_info);
if (ret)
@@ -761,9 +789,9 @@ static int merge_working_tree(const struct checkout_opts *opts,
struct unpack_trees_options topts;
const struct object_id *old_commit_oid;
- refresh_cache(REFRESH_QUIET);
+ refresh_index(&the_index, REFRESH_QUIET, NULL, NULL, NULL);
- if (unmerged_cache()) {
+ if (unmerged_index(&the_index)) {
error(_("you need to resolve your current index first"));
return 1;
}
@@ -812,7 +840,8 @@ static int merge_working_tree(const struct checkout_opts *opts,
*/
if (!old_branch_info->commit)
return 1;
- old_tree = get_commit_tree(old_branch_info->commit);
+ old_tree = repo_get_commit_tree(the_repository,
+ old_branch_info->commit);
if (repo_index_has_changes(the_repository, old_tree, &sb))
die(_("cannot continue with staged changes in "
@@ -867,7 +896,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
}
}
- if (!cache_tree_fully_valid(active_cache_tree))
+ if (!cache_tree_fully_valid(the_index.cache_tree))
cache_tree_update(&the_index, WRITE_TREE_SILENT | WRITE_TREE_REPAIR);
if (write_locked_index(&the_index, &lock_file, COMMIT_LOCK))
@@ -1001,7 +1030,7 @@ static void describe_one_orphan(struct strbuf *sb, struct commit *commit)
strbuf_addstr(sb, " ");
strbuf_add_unique_abbrev(sb, &commit->object.oid, DEFAULT_ABBREV);
strbuf_addch(sb, ' ');
- if (!parse_commit(commit))
+ if (!repo_parse_commit(the_repository, commit))
pp_commit_easy(CMIT_FMT_ONELINE, commit, sb);
strbuf_addch(sb, '\n');
}
@@ -1057,7 +1086,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
" git branch <new-branch-name> %s\n\n",
/* Give ngettext() the count */
lost),
- find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV));
}
/*
@@ -1201,7 +1230,8 @@ static void setup_new_branch_info_and_source_tree(
*source_tree = parse_tree_indirect(rev);
} else {
parse_commit_or_die(new_branch_info->commit);
- *source_tree = get_commit_tree(new_branch_info->commit);
+ *source_tree = repo_get_commit_tree(the_repository,
+ new_branch_info->commit);
}
}
@@ -1269,7 +1299,7 @@ static int parse_branchname_arg(int argc, const char **argv,
* between A and B, A...B names that merge base.
*
* (b) If <something> is _not_ a commit, either "--" is present
- * or <something> is not a path, no -t or -b was given, and
+ * or <something> is not a path, no -t or -b was given,
* and there is a tracking branch whose name is <something>
* in one and only one remote (or if the branch exists on the
* remote named in checkout.defaultRemote), then this is a
@@ -1319,7 +1349,7 @@ static int parse_branchname_arg(int argc, const char **argv,
if (!strcmp(arg, "-"))
arg = "@{-1}";
- if (get_oid_mb(arg, rev)) {
+ if (repo_get_oid_mb(the_repository, arg, rev)) {
/*
* Either case (3) or (4), with <something> not being
* a commit, or an attempt to use case (1) with an
@@ -1416,7 +1446,8 @@ static void die_expecting_a_branch(const struct branch_info *branch_info)
char *to_free;
int code;
- if (dwim_ref(branch_info->name, strlen(branch_info->name), &oid, &to_free, 0) == 1) {
+ if (repo_dwim_ref(the_repository, branch_info->name,
+ strlen(branch_info->name), &oid, &to_free, 0) == 1) {
const char *ref = to_free;
if (skip_prefix(ref, "refs/tags/", &ref))
@@ -1470,6 +1501,8 @@ static void die_if_some_operation_in_progress(void)
"or \"git worktree add\"."));
if (state.bisect_in_progress)
warning(_("you are switching branch while bisecting"));
+
+ wt_status_state_free_buffers(&state);
}
static int checkout_branch(struct checkout_opts *opts,
@@ -1743,7 +1776,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
} else if (!opts->accept_ref && opts->from_treeish) {
struct object_id rev;
- if (get_oid_mb(opts->from_treeish, &rev))
+ if (repo_get_oid_mb(the_repository, opts->from_treeish, &rev))
die(_("could not resolve %s"), opts->from_treeish);
setup_new_branch_info_and_source_tree(new_branch_info,
@@ -1871,6 +1904,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
options, checkout_usage, &new_branch_info);
branch_info_release(&new_branch_info);
clear_pathspec(&opts.pathspec);
+ free(opts.pathspec_from_file);
FREE_AND_NULL(options);
return ret;
}
diff --git a/builtin/clean.c b/builtin/clean.c
index 5466636e66..78852d28ce 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -6,12 +6,16 @@
* Based on git-clean.sh by Pavel Roskin
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "abspath.h"
#include "cache.h"
#include "config.h"
#include "dir.h"
+#include "gettext.h"
#include "parse-options.h"
+#include "repository.h"
+#include "setup.h"
#include "string-list.h"
#include "quote.h"
#include "column.h"
@@ -26,7 +30,7 @@ static struct string_list del_list = STRING_LIST_INIT_DUP;
static unsigned int colopts;
static const char *const builtin_clean_usage[] = {
- N_("git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>..."),
+ N_("git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] [<pathspec>...]"),
NULL
};
@@ -560,7 +564,7 @@ static int parse_choice(struct menu_stuff *menu_stuff,
/*
* Implement a git-add-interactive compatible UI, which is borrowed
- * from git-add--interactive.perl.
+ * from add-interactive.c.
*
* Return value:
*
@@ -1012,7 +1016,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
- if (read_cache() < 0)
+ if (repo_read_index(the_repository) < 0)
die(_("index file corrupt"));
pl = add_pattern_list(&dir, EXC_CMDL, "--exclude option");
@@ -1031,7 +1035,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
struct stat st;
const char *rel;
- if (!cache_name_is_other(ent->name, ent->len))
+ if (!index_name_is_other(&the_index, ent->name, ent->len))
continue;
if (lstat(ent->name, &st))
@@ -1092,5 +1096,6 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
strbuf_release(&buf);
string_list_clear(&del_list, 0);
string_list_clear(&exclude_list, 0);
+ clear_pathspec(&pathspec);
return (errors != 0);
}
diff --git a/builtin/clone.c b/builtin/clone.c
index d4a64e1582..15f9912b4c 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -8,14 +8,21 @@
* Clone a repository into a different directory that does not yet exist.
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "abspath.h"
+#include "advice.h"
#include "config.h"
+#include "copy.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "parse-options.h"
#include "fetch-pack.h"
#include "refs.h"
#include "refspec.h"
+#include "object-file.h"
#include "object-store.h"
#include "tree.h"
#include "tree-walk.h"
@@ -29,12 +36,15 @@
#include "branch.h"
#include "remote.h"
#include "run-command.h"
+#include "setup.h"
#include "connected.h"
#include "packfile.h"
+#include "pkt-line.h"
#include "list-objects-filter-options.h"
#include "hook.h"
#include "bundle.h"
#include "bundle-uri.h"
+#include "wrapper.h"
/*
* Overall FIXMEs:
@@ -326,8 +336,18 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest,
iter = dir_iterator_begin(src->buf, DIR_ITERATOR_PEDANTIC);
- if (!iter)
+ if (!iter) {
+ if (errno == ENOTDIR) {
+ int saved_errno = errno;
+ struct stat st;
+
+ if (!lstat(src->buf, &st) && S_ISLNK(st.st_mode))
+ die(_("'%s' is a symlink, refusing to clone with --local"),
+ src->buf);
+ errno = saved_errno;
+ }
die_errno(_("failed to start iterator over '%s'"), src->buf);
+ }
strbuf_addch(src, '/');
src_len = src->len;
@@ -547,9 +567,9 @@ static void write_followtags(const struct ref *refs, const char *msg)
continue;
if (ends_with(ref->name, "^{}"))
continue;
- if (!has_object_file_with_flags(&ref->old_oid,
- OBJECT_INFO_QUICK |
- OBJECT_INFO_SKIP_FETCH_OBJECT))
+ if (!repo_has_object_file_with_flags(the_repository, &ref->old_oid,
+ OBJECT_INFO_QUICK |
+ OBJECT_INFO_SKIP_FETCH_OBJECT))
continue;
update_ref(msg, ref->name, &ref->old_oid, NULL, 0,
UPDATE_REFS_DIE_ON_ERR);
@@ -653,9 +673,9 @@ static void update_head(const struct ref *our, const struct ref *remote,
static int git_sparse_checkout_init(const char *repo)
{
- struct strvec argv = STRVEC_INIT;
+ struct child_process cmd = CHILD_PROCESS_INIT;
int result = 0;
- strvec_pushl(&argv, "-C", repo, "sparse-checkout", "set", NULL);
+ strvec_pushl(&cmd.args, "-C", repo, "sparse-checkout", "set", NULL);
/*
* We must apply the setting in the current process
@@ -663,12 +683,12 @@ static int git_sparse_checkout_init(const char *repo)
*/
core_apply_sparse_checkout = 1;
- if (run_command_v_opt(argv.v, RUN_GIT_CMD)) {
+ cmd.git_cmd = 1;
+ if (run_command(&cmd)) {
error(_("failed to initialize sparse-checkout"));
result = 1;
}
- strvec_clear(&argv);
return result;
}
@@ -703,7 +723,7 @@ static int checkout(int submodule_progress, int filter_submodules)
/* We need to be in the new work tree for the checkout */
setup_work_tree();
- hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &lock_file, LOCK_DIE_ON_ERROR);
memset(&opts, 0, sizeof opts);
opts.update = 1;
@@ -733,37 +753,38 @@ static int checkout(int submodule_progress, int filter_submodules)
oid_to_hex(&oid), "1", NULL);
if (!err && (option_recurse_submodules.nr > 0)) {
- struct strvec args = STRVEC_INIT;
- strvec_pushl(&args, "submodule", "update", "--require-init", "--recursive", NULL);
+ struct child_process cmd = CHILD_PROCESS_INIT;
+ strvec_pushl(&cmd.args, "submodule", "update", "--require-init",
+ "--recursive", NULL);
if (option_shallow_submodules == 1)
- strvec_push(&args, "--depth=1");
+ strvec_push(&cmd.args, "--depth=1");
if (max_jobs != -1)
- strvec_pushf(&args, "--jobs=%d", max_jobs);
+ strvec_pushf(&cmd.args, "--jobs=%d", max_jobs);
if (submodule_progress)
- strvec_push(&args, "--progress");
+ strvec_push(&cmd.args, "--progress");
if (option_verbosity < 0)
- strvec_push(&args, "--quiet");
+ strvec_push(&cmd.args, "--quiet");
if (option_remote_submodules) {
- strvec_push(&args, "--remote");
- strvec_push(&args, "--no-fetch");
+ strvec_push(&cmd.args, "--remote");
+ strvec_push(&cmd.args, "--no-fetch");
}
if (filter_submodules && filter_options.choice)
- strvec_pushf(&args, "--filter=%s",
+ strvec_pushf(&cmd.args, "--filter=%s",
expand_list_objects_filter_spec(&filter_options));
if (option_single_branch >= 0)
- strvec_push(&args, option_single_branch ?
+ strvec_push(&cmd.args, option_single_branch ?
"--single-branch" :
"--no-single-branch");
- err = run_command_v_opt(args.v, RUN_GIT_CMD);
- strvec_clear(&args);
+ cmd.git_cmd = 1;
+ err = run_command(&cmd);
}
return err;
@@ -864,11 +885,15 @@ static void write_refspec_config(const char *src_ref_prefix,
static void dissociate_from_references(void)
{
- static const char* argv[] = { "repack", "-a", "-d", NULL };
char *alternates = git_pathdup("objects/info/alternates");
if (!access(alternates, F_OK)) {
- if (run_command_v_opt(argv, RUN_GIT_CMD|RUN_COMMAND_NO_STDIN))
+ struct child_process cmd = CHILD_PROCESS_INIT;
+
+ cmd.git_cmd = 1;
+ cmd.no_stdin = 1;
+ strvec_pushl(&cmd.args, "repack", "-a", "-d", NULL);
+ if (run_command(&cmd))
die(_("cannot repack to clean up"));
if (unlink(alternates) && errno != ENOENT)
die_errno(_("cannot unlink temporary alternates file"));
@@ -887,6 +912,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
int is_bundle = 0, is_local;
int reject_shallow = 0;
const char *repo_name, *repo, *work_tree, *git_dir;
+ char *repo_to_free = NULL;
char *path = NULL, *dir, *display_repo = NULL;
int dest_exists, real_dest_exists = 0;
const struct ref *refs, *remote_head;
@@ -903,6 +929,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
int err = 0, complete_refs_before_fetch = 1;
int submodule_progress;
int filter_submodules = 0;
+ int hash_algo;
struct transport_ls_refs_options transport_ls_refs_options =
TRANSPORT_LS_REFS_OPTIONS_INIT;
@@ -944,7 +971,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
path = get_repo_path(repo_name, &is_bundle);
if (path) {
FREE_AND_NULL(path);
- repo = absolute_pathdup(repo_name);
+ repo = repo_to_free = absolute_pathdup(repo_name);
} else if (strchr(repo_name, ':')) {
repo = repo_name;
display_repo = transport_anonymize_url(repo);
@@ -1243,12 +1270,16 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
* data from the --bundle-uri option.
*/
if (bundle_uri) {
+ int has_heuristic = 0;
+
/* At this point, we need the_repository to match the cloned repo. */
if (repo_init(the_repository, git_dir, work_tree))
warning(_("failed to initialize the repo, skipping bundle URI"));
- else if (fetch_bundle_uri(the_repository, bundle_uri))
+ else if (fetch_bundle_uri(the_repository, bundle_uri, &has_heuristic))
warning(_("failed to fetch objects from bundle URI '%s'"),
bundle_uri);
+ else if (has_heuristic)
+ git_config_set_gently("fetch.bundleuri", bundle_uri);
}
strvec_push(&transport_ls_refs_options.ref_prefixes, "HEAD");
@@ -1266,15 +1297,36 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (refs)
mapped_refs = wanted_peer_refs(refs, &remote->fetch);
- if (mapped_refs) {
- int hash_algo = hash_algo_by_ptr(transport_get_hash_algo(transport));
+ if (!bundle_uri) {
+ /*
+ * Populate transport->got_remote_bundle_uri and
+ * transport->bundle_uri. We might get nothing.
+ */
+ transport_get_remote_bundle_uri(transport);
+
+ if (transport->bundles &&
+ hashmap_get_size(&transport->bundles->bundles)) {
+ /* At this point, we need the_repository to match the cloned repo. */
+ if (repo_init(the_repository, git_dir, work_tree))
+ warning(_("failed to initialize the repo, skipping bundle URI"));
+ else if (fetch_bundle_list(the_repository,
+ transport->bundles))
+ warning(_("failed to fetch advertised bundles"));
+ } else {
+ clear_bundle_list(transport->bundles);
+ FREE_AND_NULL(transport->bundles);
+ }
+ }
/*
* Now that we know what algorithm the remote side is using,
* let's set ours to the same thing.
*/
- initialize_repository_version(hash_algo, 1);
- repo_set_hash_algo(the_repository, hash_algo);
+ hash_algo = hash_algo_by_ptr(transport_get_hash_algo(transport));
+ initialize_repository_version(hash_algo, 1);
+ repo_set_hash_algo(the_repository, hash_algo);
+
+ if (mapped_refs) {
/*
* transport_get_remote_refs() may return refs with null sha-1
* in mapped_refs (see struct transport->get_refs_list
@@ -1387,7 +1439,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
free(unborn_head);
free(dir);
free(path);
- UNLEAK(repo);
+ free(repo_to_free);
junk_mode = JUNK_LEAVE_ALL;
transport_ls_refs_options_release(&transport_ls_refs_options);
diff --git a/builtin/column.c b/builtin/column.c
index 158fdf53d9..de623a16c2 100644
--- a/builtin/column.c
+++ b/builtin/column.c
@@ -1,6 +1,7 @@
#include "builtin.h"
#include "cache.h"
#include "config.h"
+#include "gettext.h"
#include "strbuf.h"
#include "parse-options.h"
#include "string-list.h"
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index 51557fe786..a3d00fa232 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -1,22 +1,27 @@
#include "builtin.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "parse-options.h"
#include "repository.h"
#include "commit-graph.h"
#include "object-store.h"
#include "progress.h"
+#include "replace-object.h"
#include "tag.h"
+#include "trace2.h"
#define BUILTIN_COMMIT_GRAPH_VERIFY_USAGE \
- N_("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]")
+ N_("git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]")
#define BUILTIN_COMMIT_GRAPH_WRITE_USAGE \
- N_("git commit-graph write [--object-dir <objdir>] [--append] " \
- "[--split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] " \
- "[--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress] " \
- "<split options>")
+ N_("git commit-graph write [--object-dir <dir>] [--append]\n" \
+ " [--split[=<strategy>]] [--reachable | --stdin-packs | --stdin-commits]\n" \
+ " [--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress]\n" \
+ " <split options>")
static const char * builtin_commit_graph_verify_usage[] = {
BUILTIN_COMMIT_GRAPH_VERIFY_USAGE,
@@ -67,6 +72,7 @@ static int graph_verify(int argc, const char **argv, const char *prefix)
int fd;
struct stat st;
int flags = 0;
+ int ret;
static struct option builtin_commit_graph_verify_options[] = {
OPT_BOOL(0, "shallow", &opts.shallow,
@@ -111,8 +117,9 @@ static int graph_verify(int argc, const char **argv, const char *prefix)
if (!graph)
return !!open_ok;
- UNLEAK(graph);
- return verify_commit_graph(the_repository, graph, flags);
+ ret = verify_commit_graph(the_repository, graph, flags);
+ free_commit_graph(graph);
+ return ret;
}
extern int read_replace_refs;
@@ -267,8 +274,8 @@ static int graph_write(int argc, const char **argv, const char *prefix)
if (opts.reachable) {
if (write_commit_graph_reachable(odb, flags, &write_opts))
- return 1;
- return 0;
+ result = 1;
+ goto cleanup;
}
if (opts.stdin_packs) {
diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index 63ea322933..d1d251c3de 100644
--- a/builtin/commit-tree.c
+++ b/builtin/commit-tree.c
@@ -5,6 +5,9 @@
*/
#include "cache.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-name.h"
#include "object-store.h"
#include "repository.h"
#include "commit.h"
@@ -15,8 +18,9 @@
#include "parse-options.h"
static const char * const commit_tree_usage[] = {
- N_("git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...] "
- "[(-F <file>)...] <tree>"),
+ N_("git commit-tree <tree> [(-p <parent>)...]"),
+ N_("git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n"
+ " [(-F <file>)...] <tree>"),
NULL
};
@@ -36,14 +40,6 @@ static void new_parent(struct commit *parent, struct commit_list **parents_p)
commit_list_insert(parent, parents_p);
}
-static int commit_tree_config(const char *var, const char *value, void *cb)
-{
- int status = git_gpg_config(var, value, NULL);
- if (status)
- return status;
- return git_default_config(var, value, cb);
-}
-
static int parse_parent_arg_callback(const struct option *opt,
const char *arg, int unset)
{
@@ -52,7 +48,7 @@ static int parse_parent_arg_callback(const struct option *opt,
BUG_ON_OPT_NEG_NOARG(unset, arg);
- if (get_oid_commit(arg, &oid))
+ if (repo_get_oid_commit(the_repository, arg, &oid))
die(_("not a valid object name %s"), arg);
assert_oid_type(&oid, OBJ_COMMIT);
@@ -120,7 +116,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
OPT_END()
};
- git_config(commit_tree_config, NULL);
+ git_config(git_default_config, NULL);
if (argc < 2 || !strcmp(argv[1], "-h"))
usage_with_options(commit_tree_usage, options);
@@ -130,7 +126,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
if (argc != 1)
die(_("must give exactly one tree"));
- if (get_oid_tree(argv[0], &tree_oid))
+ if (repo_get_oid_tree(the_repository, argv[0], &tree_oid))
die(_("not a valid object name %s"), argv[0]);
if (!buffer.len) {
diff --git a/builtin/commit.c b/builtin/commit.c
index d9de4ef008..e67c4be221 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -5,17 +5,21 @@
* Based on git-commit.sh by Junio C Hamano and Linus Torvalds
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "cache.h"
+#include "advice.h"
#include "config.h"
#include "lockfile.h"
#include "cache-tree.h"
#include "color.h"
#include "dir.h"
+#include "editor.h"
+#include "environment.h"
#include "builtin.h"
#include "diff.h"
#include "diffcore.h"
#include "commit.h"
+#include "gettext.h"
#include "revision.h"
#include "wt-status.h"
#include "run-command.h"
@@ -24,6 +28,7 @@
#include "log-tree.h"
#include "strbuf.h"
#include "utf8.h"
+#include "object-name.h"
#include "parse-options.h"
#include "string-list.h"
#include "rerere.h"
@@ -40,12 +45,19 @@
#include "pretty.h"
static const char * const builtin_commit_usage[] = {
- N_("git commit [<options>] [--] <pathspec>..."),
+ N_("git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
+ " [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|reword):]<commit>)]\n"
+ " [-F <file> | -m <msg>] [--reset-author] [--allow-empty]\n"
+ " [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n"
+ " [--date=<date>] [--cleanup=<mode>] [--[no-]status]\n"
+ " [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+ " [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]\n"
+ " [--] [<pathspec>...]"),
NULL
};
static const char * const builtin_status_usage[] = {
- N_("git status [<options>] [--] <pathspec>..."),
+ N_("git status [<options>] [--] [<pathspec>...]"),
NULL
};
@@ -265,8 +277,8 @@ static int list_paths(struct string_list *list, const char *with_tree,
/* TODO: audit for interaction with sparse-index. */
ensure_full_index(&the_index);
- for (i = 0; i < active_nr; i++) {
- const struct cache_entry *ce = active_cache[i];
+ for (i = 0; i < the_index.cache_nr; i++) {
+ const struct cache_entry *ce = the_index.cache[i];
struct string_list_item *item;
if (ce->ce_flags & CE_UPDATE)
@@ -295,10 +307,10 @@ static void add_remove_files(struct string_list *list)
continue;
if (!lstat(p->string, &st)) {
- if (add_to_cache(p->string, &st, 0))
+ if (add_to_index(&the_index, p->string, &st, 0))
die(_("updating files failed"));
} else
- remove_file_from_cache(p->string);
+ remove_file_from_index(&the_index, p->string);
}
}
@@ -309,7 +321,7 @@ static void create_base_index(const struct commit *current_head)
struct tree_desc t;
if (!current_head) {
- discard_cache();
+ discard_index(&the_index);
return;
}
@@ -336,7 +348,7 @@ static void refresh_cache_or_die(int refresh_flags)
* refresh_flags contains REFRESH_QUIET, so the only errors
* are for unmerged entries.
*/
- if (refresh_cache(refresh_flags | REFRESH_IN_PORCELAIN))
+ if (refresh_index(&the_index, refresh_flags | REFRESH_IN_PORCELAIN, NULL, NULL, NULL))
die_resolve_conflict("commit");
}
@@ -375,12 +387,13 @@ static const char *prepare_index(const char **argv, const char *prefix,
(!amend || (fixup_message && strcmp(fixup_prefix, "amend"))))))
die(_("No paths with --include/--only does not make sense."));
- if (read_cache_preload(&pathspec) < 0)
+ if (repo_read_index_preload(the_repository, &pathspec, 0) < 0)
die(_("index file corrupt"));
if (interactive) {
char *old_index_env = NULL, *old_repo_index_file;
- hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &index_lock,
+ LOCK_DIE_ON_ERROR);
refresh_cache_or_die(refresh_flags);
@@ -403,9 +416,10 @@ static const char *prepare_index(const char **argv, const char *prefix,
unsetenv(INDEX_ENVIRONMENT);
FREE_AND_NULL(old_index_env);
- discard_cache();
- read_cache_from(get_lock_file_path(&index_lock));
- if (update_main_cache_tree(WRITE_TREE_SILENT) == 0) {
+ discard_index(&the_index);
+ read_index_from(&the_index, get_lock_file_path(&index_lock),
+ get_git_dir());
+ if (cache_tree_update(&the_index, WRITE_TREE_SILENT) == 0) {
if (reopen_lock_file(&index_lock) < 0)
die(_("unable to write index file"));
if (write_locked_index(&the_index, &index_lock, 0))
@@ -431,10 +445,11 @@ static const char *prepare_index(const char **argv, const char *prefix,
* (B) on failure, rollback the real index.
*/
if (all || (also && pathspec.nr)) {
- hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &index_lock,
+ LOCK_DIE_ON_ERROR);
add_files_to_cache(also ? prefix : NULL, &pathspec, 0);
refresh_cache_or_die(refresh_flags);
- update_main_cache_tree(WRITE_TREE_SILENT);
+ cache_tree_update(&the_index, WRITE_TREE_SILENT);
if (write_locked_index(&the_index, &index_lock, 0))
die(_("unable to write new_index file"));
commit_style = COMMIT_NORMAL;
@@ -452,11 +467,12 @@ static const char *prepare_index(const char **argv, const char *prefix,
* We still need to refresh the index here.
*/
if (!only && !pathspec.nr) {
- hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &index_lock,
+ LOCK_DIE_ON_ERROR);
refresh_cache_or_die(refresh_flags);
- if (active_cache_changed
- || !cache_tree_fully_valid(active_cache_tree))
- update_main_cache_tree(WRITE_TREE_SILENT);
+ if (the_index.cache_changed
+ || !cache_tree_fully_valid(the_index.cache_tree))
+ cache_tree_update(&the_index, WRITE_TREE_SILENT);
if (write_locked_index(&the_index, &index_lock,
COMMIT_LOCK | SKIP_IF_UNCHANGED))
die(_("unable to write new_index file"));
@@ -498,14 +514,14 @@ static const char *prepare_index(const char **argv, const char *prefix,
if (list_paths(&partial, !current_head ? NULL : "HEAD", &pathspec))
exit(1);
- discard_cache();
- if (read_cache() < 0)
+ discard_index(&the_index);
+ if (repo_read_index(the_repository) < 0)
die(_("cannot read the index"));
- hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &index_lock, LOCK_DIE_ON_ERROR);
add_remove_files(&partial);
- refresh_cache(REFRESH_QUIET);
- update_main_cache_tree(WRITE_TREE_SILENT);
+ refresh_index(&the_index, REFRESH_QUIET, NULL, NULL, NULL);
+ cache_tree_update(&the_index, WRITE_TREE_SILENT);
if (write_locked_index(&the_index, &index_lock, 0))
die(_("unable to write new_index file"));
@@ -516,14 +532,14 @@ static const char *prepare_index(const char **argv, const char *prefix,
create_base_index(current_head);
add_remove_files(&partial);
- refresh_cache(REFRESH_QUIET);
+ refresh_index(&the_index, REFRESH_QUIET, NULL, NULL, NULL);
if (write_locked_index(&the_index, &false_lock, 0))
die(_("unable to write temporary index file"));
- discard_cache();
+ discard_index(&the_index);
ret = get_lock_file_path(&false_lock);
- read_cache_from(ret);
+ read_index_from(&the_index, ret, get_git_dir());
out:
string_list_clear(&partial, 0);
clear_pathspec(&pathspec);
@@ -546,7 +562,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
s->index_file = index_file;
s->fp = fp;
s->nowarn = nowarn;
- s->is_initial = get_oid(s->reference, &oid) ? 1 : 0;
+ s->is_initial = repo_get_oid(the_repository, s->reference, &oid) ? 1 : 0;
if (!s->is_initial)
oidcpy(&s->oid_commit, &oid);
s->status_format = status_format;
@@ -701,15 +717,15 @@ static void prepare_amend_commit(struct commit *commit, struct strbuf *sb,
{
const char *buffer, *subject, *fmt;
- buffer = get_commit_buffer(commit, NULL);
+ buffer = repo_get_commit_buffer(the_repository, commit, NULL);
find_commit_subject(buffer, &subject);
/*
* If we amend the 'amend!' commit then we don't want to
* duplicate the subject line.
*/
fmt = starts_with(subject, "amend!") ? "%b" : "%B";
- format_commit_message(commit, fmt, sb, ctx);
- unuse_commit_buffer(commit, buffer);
+ repo_format_commit_message(the_repository, commit, fmt, sb, ctx);
+ repo_unuse_commit_buffer(the_repository, commit, buffer);
}
static int prepare_to_commit(const char *index_file, const char *prefix,
@@ -749,8 +765,9 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
if (!c)
die(_("could not lookup commit %s"), squash_message);
ctx.output_encoding = get_commit_output_encoding();
- format_commit_message(c, "squash! %s\n\n", &sb,
- &ctx);
+ repo_format_commit_message(the_repository, c,
+ "squash! %s\n\n", &sb,
+ &ctx);
}
}
@@ -784,7 +801,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
die(_("could not lookup commit %s"), fixup_commit);
ctx.output_encoding = get_commit_output_encoding();
fmt = xstrfmt("%s! %%s\n\n", fixup_prefix);
- format_commit_message(commit, fmt, &sb, &ctx);
+ repo_format_commit_message(the_repository, commit, fmt, &sb,
+ &ctx);
free(fmt);
hook_arg1 = "message";
@@ -980,21 +998,24 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
struct object_id oid;
const char *parent = "HEAD";
- if (!active_nr && read_cache() < 0)
- die(_("Cannot read index"));
+ if (!the_index.cache_nr) {
+ discard_index(&the_index);
+ if (repo_read_index(the_repository) < 0)
+ die(_("Cannot read index"));
+ }
if (amend)
parent = "HEAD^1";
- if (get_oid(parent, &oid)) {
+ if (repo_get_oid(the_repository, parent, &oid)) {
int i, ita_nr = 0;
/* TODO: audit for interaction with sparse-index. */
ensure_full_index(&the_index);
- for (i = 0; i < active_nr; i++)
- if (ce_intent_to_add(active_cache[i]))
+ for (i = 0; i < the_index.cache_nr; i++)
+ if (ce_intent_to_add(the_index.cache[i]))
ita_nr++;
- committable = active_nr - ita_nr > 0;
+ committable = the_index.cache_nr - ita_nr > 0;
} else {
/*
* Unless the user did explicitly request a submodule
@@ -1061,11 +1082,11 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
* and could have updated it. We must do this before we invoke
* the editor and after we invoke run_status above.
*/
- discard_cache();
+ discard_index(&the_index);
}
- read_cache_from(index_file);
+ read_index_from(&the_index, index_file, get_git_dir());
- if (update_main_cache_tree(0)) {
+ if (cache_tree_update(&the_index, 0)) {
error(_("Error building trees"));
return 0;
}
@@ -1121,7 +1142,8 @@ static const char *find_author_by_nickname(const char *name)
struct pretty_print_context ctx = {0};
ctx.date_mode.type = DATE_NORMAL;
strbuf_release(&buf);
- format_commit_message(commit, "%aN <%aE>", &buf, &ctx);
+ repo_format_commit_message(the_repository, commit,
+ "%aN <%aE>", &buf, &ctx);
release_revisions(&revs);
return strbuf_detach(&buf, NULL);
}
@@ -1169,7 +1191,7 @@ static const char *read_commit_message(const char *name)
if (!commit)
die(_("could not lookup commit %s"), name);
out_enc = get_commit_output_encoding();
- return logmsg_reencode(commit, NULL, out_enc);
+ return repo_logmsg_reencode(the_repository, commit, NULL, out_enc);
}
/*
@@ -1549,11 +1571,11 @@ int cmd_status(int argc, const char **argv, const char *prefix)
&s.pathspec, NULL, NULL);
if (use_optional_locks())
- fd = hold_locked_index(&index_lock, 0);
+ fd = repo_hold_locked_index(the_repository, &index_lock, 0);
else
fd = -1;
- s.is_initial = get_oid(s.reference, &oid) ? 1 : 0;
+ s.is_initial = repo_get_oid(the_repository, s.reference, &oid) ? 1 : 0;
if (!s.is_initial)
oidcpy(&s.oid_commit, &oid);
@@ -1586,7 +1608,6 @@ int cmd_status(int argc, const char **argv, const char *prefix)
static int git_commit_config(const char *k, const char *v, void *cb)
{
struct wt_status *s = cb;
- int status;
if (!strcmp(k, "commit.template"))
return git_config_pathname(&template_file, k, v);
@@ -1606,9 +1627,6 @@ static int git_commit_config(const char *k, const char *v, void *cb)
return 0;
}
- status = git_gpg_config(k, v, NULL);
- if (status)
- return status;
return git_status_config(k, v, s);
}
@@ -1700,11 +1718,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
status_format = STATUS_FORMAT_NONE; /* Ignore status.short */
s.colopts = 0;
- if (get_oid("HEAD", &oid))
+ if (repo_get_oid(the_repository, "HEAD", &oid))
current_head = NULL;
else {
current_head = lookup_commit_or_die(&oid, "HEAD");
- if (parse_commit(current_head))
+ if (repo_parse_commit(the_repository, current_head))
die(_("could not parse HEAD commit"));
}
verbose = -1; /* unspecified */
@@ -1816,7 +1834,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
append_merge_tag_headers(parents, &tail);
}
- if (commit_tree_extended(sb.buf, sb.len, &active_cache_tree->oid,
+ if (commit_tree_extended(sb.buf, sb.len, &the_index.cache_tree->oid,
parents, &oid, author_ident.buf, NULL,
sign_commit, extra)) {
rollback_index_files();
@@ -1864,8 +1882,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
apply_autostash(git_path_merge_autostash(the_repository));
cleanup:
- UNLEAK(author_ident);
- UNLEAK(err);
- UNLEAK(sb);
+ strbuf_release(&author_ident);
+ strbuf_release(&err);
+ strbuf_release(&sb);
return ret;
}
diff --git a/builtin/config.c b/builtin/config.c
index 753e5fac29..ff2fe8ef12 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -1,11 +1,19 @@
#include "builtin.h"
-#include "cache.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
#include "color.h"
+#include "editor.h"
+#include "environment.h"
+#include "gettext.h"
+#include "ident.h"
#include "parse-options.h"
#include "urlmatch.h"
+#include "path.h"
#include "quote.h"
+#include "setup.h"
#include "worktree.h"
+#include "wrapper.h"
static const char *const builtin_config_usage[] = {
N_("git config [<options>]"),
@@ -639,8 +647,9 @@ static char *default_user_config(void)
int cmd_config(int argc, const char **argv, const char *prefix)
{
int nongit = !startup_info->have_repository;
- char *value;
+ char *value = NULL;
int flags = 0;
+ int ret = 0;
given_config_source.file = xstrdup_or_null(getenv(CONFIG_ENVIRONMENT));
@@ -856,44 +865,38 @@ int cmd_config(int argc, const char **argv, const char *prefix)
free(config_file);
}
else if (actions == ACTION_SET) {
- int ret;
check_write();
check_argc(argc, 2, 2);
value = normalize_value(argv[0], argv[1]);
- UNLEAK(value);
ret = git_config_set_in_file_gently(given_config_source.file, argv[0], value);
if (ret == CONFIG_NOTHING_SET)
error(_("cannot overwrite multiple values with a single value\n"
" Use a regexp, --add or --replace-all to change %s."), argv[0]);
- return ret;
}
else if (actions == ACTION_SET_ALL) {
check_write();
check_argc(argc, 2, 3);
value = normalize_value(argv[0], argv[1]);
- UNLEAK(value);
- return git_config_set_multivar_in_file_gently(given_config_source.file,
- argv[0], value, argv[2],
- flags);
+ ret = git_config_set_multivar_in_file_gently(given_config_source.file,
+ argv[0], value, argv[2],
+ flags);
}
else if (actions == ACTION_ADD) {
check_write();
check_argc(argc, 2, 2);
value = normalize_value(argv[0], argv[1]);
- UNLEAK(value);
- return git_config_set_multivar_in_file_gently(given_config_source.file,
- argv[0], value,
- CONFIG_REGEX_NONE,
- flags);
+ ret = git_config_set_multivar_in_file_gently(given_config_source.file,
+ argv[0], value,
+ CONFIG_REGEX_NONE,
+ flags);
}
else if (actions == ACTION_REPLACE_ALL) {
check_write();
check_argc(argc, 2, 3);
value = normalize_value(argv[0], argv[1]);
- UNLEAK(value);
- return git_config_set_multivar_in_file_gently(given_config_source.file,
- argv[0], value, argv[2],
- flags | CONFIG_FLAGS_MULTI_REPLACE);
+ ret = git_config_set_multivar_in_file_gently(given_config_source.file,
+ argv[0], value, argv[2],
+ flags | CONFIG_FLAGS_MULTI_REPLACE);
}
else if (actions == ACTION_GET) {
check_argc(argc, 1, 2);
@@ -934,26 +937,28 @@ int cmd_config(int argc, const char **argv, const char *prefix)
flags | CONFIG_FLAGS_MULTI_REPLACE);
}
else if (actions == ACTION_RENAME_SECTION) {
- int ret;
check_write();
check_argc(argc, 2, 2);
ret = git_config_rename_section_in_file(given_config_source.file,
argv[0], argv[1]);
if (ret < 0)
return ret;
- if (ret == 0)
+ else if (!ret)
die(_("no such section: %s"), argv[0]);
+ else
+ ret = 0;
}
else if (actions == ACTION_REMOVE_SECTION) {
- int ret;
check_write();
check_argc(argc, 1, 1);
ret = git_config_rename_section_in_file(given_config_source.file,
argv[0], NULL);
if (ret < 0)
return ret;
- if (ret == 0)
+ else if (!ret)
die(_("no such section: %s"), argv[0]);
+ else
+ ret = 0;
}
else if (actions == ACTION_GET_COLOR) {
check_argc(argc, 1, 2);
@@ -966,5 +971,6 @@ int cmd_config(int argc, const char **argv, const char *prefix)
return get_colorbool(argv[0], argc == 2);
}
- return 0;
+ free(value);
+ return ret;
}
diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index 07b9419596..f3d8f1bcbb 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -7,6 +7,8 @@
#include "cache.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
#include "repository.h"
#include "builtin.h"
#include "parse-options.h"
@@ -57,7 +59,8 @@ static void loose_garbage(const char *path)
report_garbage(PACKDIR_FILE_GARBAGE, path);
}
-static int count_loose(const struct object_id *oid, const char *path, void *data)
+static int count_loose(const struct object_id *oid, const char *path,
+ void *data UNUSED)
{
struct stat st;
@@ -72,7 +75,8 @@ static int count_loose(const struct object_id *oid, const char *path, void *data
return 0;
}
-static int count_cruft(const char *basename, const char *path, void *data)
+static int count_cruft(const char *basename UNUSED, const char *path,
+ void *data UNUSED)
{
loose_garbage(path);
return 0;
diff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c
index 4c6c89ab0d..756c5f02ae 100644
--- a/builtin/credential-cache--daemon.c
+++ b/builtin/credential-cache--daemon.c
@@ -1,4 +1,8 @@
#include "builtin.h"
+#include "abspath.h"
+#include "alloc.h"
+#include "gettext.h"
+#include "object-file.h"
#include "parse-options.h"
#ifndef NO_UNIX_SOCKETS
@@ -127,6 +131,12 @@ static void serve_one_client(FILE *in, FILE *out)
if (e) {
fprintf(out, "username=%s\n", e->item.username);
fprintf(out, "password=%s\n", e->item.password);
+ if (e->item.password_expiry_utc != TIME_MAX)
+ fprintf(out, "password_expiry_utc=%"PRItime"\n",
+ e->item.password_expiry_utc);
+ if (e->item.oauth_refresh_token)
+ fprintf(out, "oauth_refresh_token=%s\n",
+ e->item.oauth_refresh_token);
}
}
else if (!strcmp(action.buf, "exit")) {
@@ -267,7 +277,7 @@ int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix)
const char *socket_path;
int ignore_sighup = 0;
static const char *usage[] = {
- "git-credential-cache--daemon [opts] <socket_path>",
+ "git credential-cache--daemon [--debug] <socket-path>",
NULL
};
int debug = 0;
@@ -305,7 +315,7 @@ int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix)
int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix)
{
const char * const usage[] = {
- "git credential-cache--daemon [options] <action>",
+ "git credential-cache--daemon [--debug] <socket-path>",
"",
"credential-cache--daemon is disabled in this build of Git",
NULL
diff --git a/builtin/credential-cache.c b/builtin/credential-cache.c
index 78c02ad531..0ffacfdd83 100644
--- a/builtin/credential-cache.c
+++ b/builtin/credential-cache.c
@@ -1,5 +1,9 @@
#include "builtin.h"
+#include "gettext.h"
#include "parse-options.h"
+#include "path.h"
+#include "wrapper.h"
+#include "write-or-die.h"
#ifndef NO_UNIX_SOCKETS
diff --git a/builtin/credential-store.c b/builtin/credential-store.c
index 62a4f3c265..30c6ccf56c 100644
--- a/builtin/credential-store.c
+++ b/builtin/credential-store.c
@@ -1,9 +1,12 @@
#include "builtin.h"
#include "config.h"
+#include "gettext.h"
#include "lockfile.h"
#include "credential.h"
+#include "path.h"
#include "string-list.h"
#include "parse-options.h"
+#include "write-or-die.h"
static struct lock_file credential_lock;
diff --git a/builtin/credential.c b/builtin/credential.c
index d7b304fa08..7010752987 100644
--- a/builtin/credential.c
+++ b/builtin/credential.c
@@ -6,7 +6,7 @@
static const char usage_msg[] =
"git credential (fill|approve|reject)";
-int cmd_credential(int argc, const char **argv, const char *prefix)
+int cmd_credential(int argc, const char **argv, const char *prefix UNUSED)
{
const char *op;
struct credential c = CREDENTIAL_INIT;
diff --git a/builtin/describe.c b/builtin/describe.c
index e17c4b4c69..55b4baaa22 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -1,6 +1,9 @@
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "cache.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "commit.h"
#include "tag.h"
@@ -8,10 +11,12 @@
#include "refs.h"
#include "builtin.h"
#include "exec-cmd.h"
+#include "object-name.h"
#include "parse-options.h"
#include "revision.h"
#include "diff.h"
#include "hashmap.h"
+#include "setup.h"
#include "strvec.h"
#include "run-command.h"
#include "object-store.h"
@@ -23,8 +28,9 @@
define_commit_slab(commit_names, struct commit_name *);
static const char * const describe_usage[] = {
- N_("git describe [<options>] [<commit-ish>...]"),
- N_("git describe [<options>] --dirty"),
+ N_("git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]"),
+ N_("git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]"),
+ N_("git describe <blob>"),
NULL
};
@@ -260,7 +266,7 @@ static unsigned long finish_depth_computation(
best->depth++;
while (parents) {
struct commit *p = parents->item;
- parse_commit(p);
+ repo_parse_commit(the_repository, p);
if (!(p->object.flags & SEEN))
commit_list_insert_by_date(p, list);
p->object.flags |= c->object.flags;
@@ -297,7 +303,8 @@ static void append_name(struct commit_name *n, struct strbuf *dst)
static void append_suffix(int depth, const struct object_id *oid, struct strbuf *dst)
{
- strbuf_addf(dst, "-%d-g%s", depth, find_unique_abbrev(oid, abbrev));
+ strbuf_addf(dst, "-%d-g%s", depth,
+ repo_find_unique_abbrev(the_repository, oid, abbrev));
}
static void describe_commit(struct object_id *oid, struct strbuf *dst)
@@ -402,7 +409,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)
}
while (parents) {
struct commit *p = parents->item;
- parse_commit(p);
+ repo_parse_commit(the_repository, p);
if (!(p->object.flags & SEEN))
commit_list_insert_by_date(p, &list);
p->object.flags |= c->object.flags;
@@ -530,7 +537,7 @@ static void describe(const char *arg, int last_one)
if (debug)
fprintf(stderr, _("describe %s\n"), arg);
- if (get_oid(arg, &oid))
+ if (repo_get_oid(the_repository, arg, &oid))
die(_("Not a valid object name %s"), arg);
cmit = lookup_commit_reference_gently(the_repository, &oid, 1);
@@ -652,10 +659,13 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
int fd, result;
setup_work_tree();
- read_cache();
+ prepare_repo_settings(the_repository);
+ the_repository->settings.command_requires_full_index = 0;
+ repo_read_index(the_repository);
refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED,
NULL, NULL, NULL);
- fd = hold_locked_index(&index_lock, 0);
+ fd = repo_hold_locked_index(the_repository,
+ &index_lock, 0);
if (0 <= fd)
repo_update_index_if_able(the_repository, &index_lock);
diff --git a/builtin/diagnose.c b/builtin/diagnose.c
index 576e0e8e38..4f22eb2b55 100644
--- a/builtin/diagnose.c
+++ b/builtin/diagnose.c
@@ -1,9 +1,13 @@
#include "builtin.h"
+#include "abspath.h"
+#include "gettext.h"
+#include "object-file.h"
#include "parse-options.h"
#include "diagnose.h"
static const char * const diagnose_usage[] = {
- N_("git diagnose [-o|--output-directory <path>] [-s|--suffix <format>] [--mode=<mode>]"),
+ N_("git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+ " [--mode=<mode>]"),
NULL
};
diff --git a/builtin/diff-files.c b/builtin/diff-files.c
index 92cf6e1e92..dc991f753b 100644
--- a/builtin/diff-files.c
+++ b/builtin/diff-files.c
@@ -3,7 +3,6 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "diff.h"
@@ -15,6 +14,7 @@
static const char diff_files_usage[] =
"git diff-files [-q] [-0 | -1 | -2 | -3 | -c | --cc] [<common-diff-options>] [<path>...]"
+"\n"
COMMON_DIFF_OPTIONS_HELP;
int cmd_diff_files(int argc, const char **argv, const char *prefix)
@@ -75,8 +75,8 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
(rev.diffopt.output_format & DIFF_FORMAT_PATCH))
diff_merges_set_dense_combined_if_unset(&rev);
- if (read_cache_preload(&rev.diffopt.pathspec) < 0) {
- perror("read_cache_preload");
+ if (repo_read_index_preload(the_repository, &rev.diffopt.pathspec, 0) < 0) {
+ perror("repo_read_index_preload");
result = -1;
goto cleanup;
}
diff --git a/builtin/diff-index.c b/builtin/diff-index.c
index 7d158af6b6..b9a19bb7d3 100644
--- a/builtin/diff-index.c
+++ b/builtin/diff-index.c
@@ -1,4 +1,3 @@
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "diff.h"
@@ -6,11 +5,13 @@
#include "commit.h"
#include "revision.h"
#include "builtin.h"
+#include "setup.h"
#include "submodule.h"
static const char diff_cache_usage[] =
-"git diff-index [-m] [--cached] "
+"git diff-index [-m] [--cached] [--merge-base] "
"[<common-diff-options>] <tree-ish> [<path>...]"
+"\n"
COMMON_DIFF_OPTIONS_HELP;
int cmd_diff_index(int argc, const char **argv, const char *prefix)
@@ -61,12 +62,12 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
usage(diff_cache_usage);
if (!(option & DIFF_INDEX_CACHED)) {
setup_work_tree();
- if (read_cache_preload(&rev.diffopt.pathspec) < 0) {
- perror("read_cache_preload");
+ if (repo_read_index_preload(the_repository, &rev.diffopt.pathspec, 0) < 0) {
+ perror("repo_read_index_preload");
return -1;
}
- } else if (read_cache() < 0) {
- perror("read_cache");
+ } else if (repo_read_index(the_repository) < 0) {
+ perror("repo_read_index");
return -1;
}
result = run_diff_index(&rev, option);
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index 116097a404..0b02c62b85 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -1,12 +1,15 @@
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "cache.h"
#include "config.h"
#include "diff.h"
#include "commit.h"
+#include "gettext.h"
+#include "hex.h"
#include "log-tree.h"
#include "builtin.h"
#include "submodule.h"
#include "repository.h"
+#include "tree.h"
static struct rev_info log_tree_opt;
@@ -83,8 +86,10 @@ static int diff_tree_stdin(char *line)
}
static const char diff_tree_usage[] =
-"git diff-tree [--stdin] [-m] [-c | --cc] [-s] [-v] [--pretty] [-t] [-r] [--root] "
-"[<common-diff-options>] <tree-ish> [<tree-ish>] [<path>...]\n"
+"git diff-tree [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]\n"
+" [-t] [-r] [-c | --cc] [--combined-all-paths] [--root] [--merge-base]\n"
+" [<common-diff-options>] <tree-ish> [<tree-ish>] [<path>...]\n"
+"\n"
" -r diff recursively\n"
" -c show combined diff for merge commits\n"
" --cc show combined diff for merge commits removing uninteresting hunks\n"
@@ -118,7 +123,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
repo_init_revisions(the_repository, opt, prefix);
- if (read_cache() < 0)
+ if (repo_read_index(the_repository) < 0)
die(_("index file corrupt"));
opt->abbrev = 0;
opt->diff = 1;
diff --git a/builtin/diff.c b/builtin/diff.c
index 54bb3de964..7b64659fe7 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2006 Junio C Hamano
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "cache.h"
#include "config.h"
#include "ewah/ewok.h"
@@ -11,6 +11,7 @@
#include "color.h"
#include "commit.h"
#include "blob.h"
+#include "gettext.h"
#include "tag.h"
#include "diff.h"
#include "diff-merges.h"
@@ -18,8 +19,10 @@
#include "revision.h"
#include "log-tree.h"
#include "builtin.h"
+#include "setup.h"
#include "submodule.h"
#include "oid-array.h"
+#include "tree.h"
#define DIFF_NO_INDEX_EXPLICIT 1
#define DIFF_NO_INDEX_IMPLICIT 2
@@ -30,7 +33,8 @@ static const char builtin_diff_usage[] =
" or: git diff [<options>] [--merge-base] <commit> [<commit>...] <commit> [--] [<path>...]\n"
" or: git diff [<options>] <commit>...<commit> [--] [<path>...]\n"
" or: git diff [<options>] <blob> <blob>\n"
-" or: git diff [<options>] --no-index [--] <path> <path>\n"
+" or: git diff [<options>] --no-index [--] <path> <path>"
+"\n"
COMMON_DIFF_OPTIONS_HELP;
static const char *blob_path(struct object_array_entry *entry)
@@ -73,7 +77,7 @@ static void stuff_change(struct diff_options *opt,
}
static int builtin_diff_b_f(struct rev_info *revs,
- int argc, const char **argv,
+ int argc, const char **argv UNUSED,
struct object_array_entry **blob)
{
/* Blob vs file in the working tree*/
@@ -108,7 +112,7 @@ static int builtin_diff_b_f(struct rev_info *revs,
}
static int builtin_diff_blobs(struct rev_info *revs,
- int argc, const char **argv,
+ int argc, const char **argv UNUSED,
struct object_array_entry **blob)
{
const unsigned mode = canon_mode(S_IFREG | 0644);
@@ -156,12 +160,13 @@ static int builtin_diff_index(struct rev_info *revs,
usage(builtin_diff_usage);
if (!(option & DIFF_INDEX_CACHED)) {
setup_work_tree();
- if (read_cache_preload(&revs->diffopt.pathspec) < 0) {
- perror("read_cache_preload");
+ if (repo_read_index_preload(the_repository,
+ &revs->diffopt.pathspec, 0) < 0) {
+ perror("repo_read_index_preload");
return -1;
}
- } else if (read_cache() < 0) {
- perror("read_cache");
+ } else if (repo_read_index(the_repository) < 0) {
+ perror("repo_read_cache");
return -1;
}
return run_diff_index(revs, option);
@@ -207,9 +212,9 @@ static int builtin_diff_tree(struct rev_info *revs,
}
static int builtin_diff_combined(struct rev_info *revs,
- int argc, const char **argv,
+ int argc, const char **argv UNUSED,
struct object_array_entry *ent,
- int ents)
+ int ents, int first_non_parent)
{
struct oid_array parents = OID_ARRAY_INIT;
int i;
@@ -217,11 +222,18 @@ static int builtin_diff_combined(struct rev_info *revs,
if (argc > 1)
usage(builtin_diff_usage);
+ if (first_non_parent < 0)
+ die(_("no merge given, only parents."));
+ if (first_non_parent >= ents)
+ BUG("first_non_parent out of range: %d", first_non_parent);
+
diff_merges_set_dense_combined_if_unset(revs);
- for (i = 1; i < ents; i++)
- oid_array_append(&parents, &ent[i].item->oid);
- diff_tree_combined(&ent[0].item->oid, &parents, revs);
+ for (i = 0; i < ents; i++) {
+ if (i != first_non_parent)
+ oid_array_append(&parents, &ent[i].item->oid);
+ }
+ diff_tree_combined(&ent[first_non_parent].item->oid, &parents, revs);
oid_array_clear(&parents);
return 0;
}
@@ -231,12 +243,13 @@ static void refresh_index_quietly(void)
struct lock_file lock_file = LOCK_INIT;
int fd;
- fd = hold_locked_index(&lock_file, 0);
+ fd = repo_hold_locked_index(the_repository, &lock_file, 0);
if (fd < 0)
return;
- discard_cache();
- read_cache();
- refresh_cache(REFRESH_QUIET|REFRESH_UNMERGED);
+ discard_index(&the_index);
+ repo_read_index(the_repository);
+ refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL,
+ NULL);
repo_update_index_if_able(the_repository, &lock_file);
}
@@ -271,8 +284,9 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
diff_merges_set_dense_combined_if_unset(revs);
setup_work_tree();
- if (read_cache_preload(&revs->diffopt.pathspec) < 0) {
- perror("read_cache_preload");
+ if (repo_read_index_preload(the_repository, &revs->diffopt.pathspec,
+ 0) < 0) {
+ perror("repo_read_index_preload");
return -1;
}
return run_diff_files(revs, options);
@@ -385,6 +399,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
int i;
struct rev_info rev;
struct object_array ent = OBJECT_ARRAY_INIT;
+ int first_non_parent = -1;
int blobs = 0, paths = 0;
struct object_array_entry *blob[2];
int nongit = 0, no_index = 0;
@@ -536,13 +551,18 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
if (!obj)
die(_("invalid object '%s' given."), name);
if (obj->type == OBJ_COMMIT)
- obj = &get_commit_tree(((struct commit *)obj))->object;
+ obj = &repo_get_commit_tree(the_repository,
+ ((struct commit *)obj))->object;
if (obj->type == OBJ_TREE) {
if (sdiff.skip && bitmap_get(sdiff.skip, i))
continue;
obj->flags |= flags;
add_object_array(obj, name, &ent);
+ if (first_non_parent < 0 &&
+ (i >= rev.cmdline.nr || /* HEAD by hand. */
+ rev.cmdline.rev[i].whence != REV_CMD_PARENTS_ONLY))
+ first_non_parent = ent.nr - 1;
} else if (obj->type == OBJ_BLOB) {
if (2 <= blobs)
die(_("more than two blobs given: '%s'"), name);
@@ -590,12 +610,13 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
&ent.objects[0], &ent.objects[1]);
} else
result = builtin_diff_combined(&rev, argc, argv,
- ent.objects, ent.nr);
+ ent.objects, ent.nr,
+ first_non_parent);
result = diff_result_code(&rev.diffopt, result);
if (1 < rev.diffopt.skip_stat_unmatch)
refresh_index_quietly();
release_revisions(&rev);
- UNLEAK(ent);
+ object_array_clear(&ent);
UNLEAK(blob);
return result;
}
diff --git a/builtin/difftool.c b/builtin/difftool.c
index 4b10ad1a36..0049342f5c 100644
--- a/builtin/difftool.c
+++ b/builtin/difftool.c
@@ -11,19 +11,27 @@
*
* Copyright (C) 2016 Johannes Schindelin
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "cache.h"
+#include "abspath.h"
#include "config.h"
+#include "copy.h"
#include "builtin.h"
#include "run-command.h"
+#include "environment.h"
#include "exec-cmd.h"
+#include "gettext.h"
+#include "hex.h"
#include "parse-options.h"
#include "strvec.h"
#include "strbuf.h"
#include "lockfile.h"
+#include "object-file.h"
#include "object-store.h"
#include "dir.h"
#include "entry.h"
+#include "setup.h"
+#include "wrapper.h"
static int trust_exit_code;
@@ -44,8 +52,11 @@ static int difftool_config(const char *var, const char *value, void *cb)
static int print_tool_help(void)
{
- const char *argv[] = { "mergetool", "--tool-help=diff", NULL };
- return run_command_v_opt(argv, RUN_GIT_CMD);
+ struct child_process cmd = CHILD_PROCESS_INIT;
+
+ cmd.git_cmd = 1;
+ strvec_pushl(&cmd.args, "mergetool", "--tool-help=diff", NULL);
+ return run_command(&cmd);
}
static int parse_index_info(char *p, int *mode1, int *mode2,
@@ -292,7 +303,8 @@ static char *get_symlink(const struct object_id *oid, const char *path)
} else {
enum object_type type;
unsigned long size;
- data = read_object_file(oid, &type, &size);
+ data = repo_read_object_file(the_repository, oid, &type,
+ &size);
if (!data)
die(_("could not read object %s for symlink %s"),
oid_to_hex(oid), path);
@@ -358,10 +370,10 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
struct hashmap symlinks2 = HASHMAP_INIT(pair_cmp, NULL);
struct hashmap_iter iter;
struct pair_entry *entry;
- struct index_state wtindex;
+ struct index_state wtindex = INDEX_STATE_INIT(the_repository);
struct checkout lstate, rstate;
- int flags = RUN_GIT_CMD, err = 0;
- const char *helper_argv[] = { "difftool--helper", NULL, NULL, NULL };
+ int err = 0;
+ struct child_process cmd = CHILD_PROCESS_INIT;
struct hashmap wt_modified, tmp_modified;
int indices_loaded = 0;
@@ -384,8 +396,6 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
mkdir(ldir.buf, 0700);
mkdir(rdir.buf, 0700);
- memset(&wtindex, 0, sizeof(wtindex));
-
memset(&lstate, 0, sizeof(lstate));
lstate.base_dir = lbase_dir = xstrdup(ldir.buf);
lstate.base_dir_len = ldir.len;
@@ -563,16 +573,17 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
}
strbuf_setlen(&ldir, ldir_len);
- helper_argv[1] = ldir.buf;
strbuf_setlen(&rdir, rdir_len);
- helper_argv[2] = rdir.buf;
if (extcmd) {
- helper_argv[0] = extcmd;
- flags = 0;
- } else
+ strvec_push(&cmd.args, extcmd);
+ } else {
+ strvec_push(&cmd.args, "difftool--helper");
+ cmd.git_cmd = 1;
setenv("GIT_DIFFTOOL_DIRDIFF", "true", 1);
- ret = run_command_v_opt(helper_argv, flags);
+ }
+ strvec_pushl(&cmd.args, ldir.buf, rdir.buf, NULL);
+ ret = run_command(&cmd);
/* TODO: audit for interaction with sparse-index. */
ensure_full_index(&wtindex);
@@ -682,7 +693,7 @@ static int run_file_diff(int prompt, const char *prefix,
int cmd_difftool(int argc, const char **argv, const char *prefix)
{
- int use_gui_tool = 0, dir_diff = 0, prompt = -1, symlinks = 0,
+ int use_gui_tool = -1, dir_diff = 0, prompt = -1, symlinks = 0,
tool_help = 0, no_index = 0;
static char *difftool_cmd = NULL, *extcmd = NULL;
struct option builtin_difftool_options[] = {
@@ -732,13 +743,21 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
} else if (dir_diff)
die(_("options '%s' and '%s' cannot be used together"), "--dir-diff", "--no-index");
- die_for_incompatible_opt3(use_gui_tool, "--gui",
+ die_for_incompatible_opt3(use_gui_tool == 1, "--gui",
!!difftool_cmd, "--tool",
!!extcmd, "--extcmd");
- if (use_gui_tool)
+ /*
+ * Explicitly specified GUI option is forwarded to git-mergetool--lib.sh;
+ * empty or unset means "use the difftool.guiDefault config or default to
+ * false".
+ */
+ if (use_gui_tool == 1)
setenv("GIT_MERGETOOL_GUI", "true", 1);
- else if (difftool_cmd) {
+ else if (use_gui_tool == 0)
+ setenv("GIT_MERGETOOL_GUI", "false", 1);
+
+ if (difftool_cmd) {
if (*difftool_cmd)
setenv("GIT_DIFF_TOOL", difftool_cmd, 1);
else
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 3b3314e7b2..9a95f6a1a8 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -6,8 +6,11 @@
#include "builtin.h"
#include "cache.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
#include "refspec.h"
+#include "object-file.h"
#include "object-store.h"
#include "commit.h"
#include "object.h"
@@ -109,7 +112,7 @@ static struct decoration idnums;
static uint32_t last_idnum;
struct anonymized_entry {
struct hashmap_entry hash;
- const char *anon;
+ char *anon;
const char orig[FLEX_ARRAY];
};
@@ -138,43 +141,56 @@ static int anonymized_entry_cmp(const void *cmp_data UNUSED,
return strcmp(a->orig, b->orig);
}
+static struct anonymized_entry *add_anonymized_entry(struct hashmap *map,
+ unsigned hash,
+ const char *orig, size_t len,
+ char *anon)
+{
+ struct anonymized_entry *ret, *old;
+
+ if (!map->cmpfn)
+ hashmap_init(map, anonymized_entry_cmp, NULL, 0);
+
+ FLEX_ALLOC_MEM(ret, orig, orig, len);
+ hashmap_entry_init(&ret->hash, hash);
+ ret->anon = anon;
+ old = hashmap_put_entry(map, ret, hash);
+
+ if (old) {
+ free(old->anon);
+ free(old);
+ }
+
+ return ret;
+}
+
/*
* Basically keep a cache of X->Y so that we can repeatedly replace
* the same anonymized string with another. The actual generation
* is farmed out to the generate function.
*/
static const char *anonymize_str(struct hashmap *map,
- char *(*generate)(void *),
- const char *orig, size_t len,
- void *data)
+ char *(*generate)(void),
+ const char *orig, size_t len)
{
struct anonymized_entry_key key;
struct anonymized_entry *ret;
- if (!map->cmpfn)
- hashmap_init(map, anonymized_entry_cmp, NULL, 0);
-
hashmap_entry_init(&key.hash, memhash(orig, len));
key.orig = orig;
key.orig_len = len;
/* First check if it's a token the user configured manually... */
- if (anonymized_seeds.cmpfn)
- ret = hashmap_get_entry(&anonymized_seeds, &key, hash, &key);
- else
- ret = NULL;
+ ret = hashmap_get_entry(&anonymized_seeds, &key, hash, &key);
/* ...otherwise check if we've already seen it in this context... */
if (!ret)
ret = hashmap_get_entry(map, &key, hash, &key);
/* ...and finally generate a new mapping if necessary */
- if (!ret) {
- FLEX_ALLOC_MEM(ret, orig, orig, len);
- hashmap_entry_init(&ret->hash, key.hash.hash);
- ret->anon = generate(data);
- hashmap_put(map, &ret->hash);
- }
+ if (!ret)
+ ret = add_anonymized_entry(map, key.hash.hash,
+ orig, len, generate());
return ret->anon;
}
@@ -187,12 +203,12 @@ static const char *anonymize_str(struct hashmap *map,
*/
static void anonymize_path(struct strbuf *out, const char *path,
struct hashmap *map,
- char *(*generate)(void *))
+ char *(*generate)(void))
{
while (*path) {
const char *end_of_component = strchrnul(path, '/');
size_t len = end_of_component - path;
- const char *c = anonymize_str(map, generate, path, len, NULL);
+ const char *c = anonymize_str(map, generate, path, len);
strbuf_addstr(out, c);
path = end_of_component;
if (*path)
@@ -296,7 +312,7 @@ static void export_blob(const struct object_id *oid)
object = (struct object *)lookup_blob(the_repository, oid);
eaten = 0;
} else {
- buf = read_object_file(oid, &type, &size);
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
if (!buf)
die("could not read blob %s", oid_to_hex(oid));
if (check_object_signature(the_repository, oid, buf, size,
@@ -367,7 +383,7 @@ static void print_path_1(const char *path)
printf("%s", path);
}
-static char *anonymize_path_component(void *data)
+static char *anonymize_path_component(void)
{
static int counter;
struct strbuf out = STRBUF_INIT;
@@ -389,7 +405,7 @@ static void print_path(const char *path)
}
}
-static char *generate_fake_oid(void *data)
+static char *generate_fake_oid(void)
{
static uint32_t counter = 1; /* avoid null oid */
const unsigned hashsz = the_hash_algo->rawsz;
@@ -405,11 +421,11 @@ static const char *anonymize_oid(const char *oid_hex)
{
static struct hashmap objs;
size_t len = strlen(oid_hex);
- return anonymize_str(&objs, generate_fake_oid, oid_hex, len, NULL);
+ return anonymize_str(&objs, generate_fake_oid, oid_hex, len);
}
static void show_filemodify(struct diff_queue_struct *q,
- struct diff_options *options, void *data)
+ struct diff_options *options UNUSED, void *data)
{
int i;
struct string_list *changed = data;
@@ -502,7 +518,7 @@ static const char *find_encoding(const char *begin, const char *end)
return bol;
}
-static char *anonymize_ref_component(void *data)
+static char *anonymize_ref_component(void)
{
static int counter;
struct strbuf out = STRBUF_INIT;
@@ -542,13 +558,13 @@ static const char *anonymize_refname(const char *refname)
* We do not even bother to cache commit messages, as they are unlikely
* to be repeated verbatim, and it is not that interesting when they are.
*/
-static char *anonymize_commit_message(const char *old)
+static char *anonymize_commit_message(void)
{
static int counter;
return xstrfmt("subject %d\n\nbody\n", counter++);
}
-static char *anonymize_ident(void *data)
+static char *anonymize_ident(void)
{
static int counter;
struct strbuf out = STRBUF_INIT;
@@ -591,7 +607,7 @@ static void anonymize_ident_line(const char **beg, const char **end)
len = split.mail_end - split.name_begin;
ident = anonymize_str(&idents, anonymize_ident,
- split.name_begin, len, NULL);
+ split.name_begin, len);
strbuf_addstr(out, ident);
strbuf_addch(out, ' ');
strbuf_add(out, split.date_begin, split.tz_end - split.date_begin);
@@ -618,7 +634,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,
rev->diffopt.output_format = DIFF_FORMAT_CALLBACK;
parse_commit_or_die(commit);
- commit_buffer = get_commit_buffer(commit, NULL);
+ commit_buffer = repo_get_commit_buffer(the_repository, commit, NULL);
author = strstr(commit_buffer, "\nauthor ");
if (!author)
die("could not find author in commit %s",
@@ -669,7 +685,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,
mark_next_object(&commit->object);
if (anonymize) {
- reencoded = anonymize_commit_message(message);
+ reencoded = anonymize_commit_message();
} else if (encoding) {
switch(reencode_mode) {
case REENCODE_YES:
@@ -699,7 +715,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,
? strlen(message) : 0),
reencoded ? reencoded : message ? message : "");
free(reencoded);
- unuse_commit_buffer(commit, commit_buffer);
+ repo_unuse_commit_buffer(the_repository, commit, commit_buffer);
for (i = 0, p = commit->parents; p; p = p->next) {
struct object *obj = &p->item->object;
@@ -732,7 +748,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,
show_progress();
}
-static char *anonymize_tag(void *data)
+static char *anonymize_tag(void)
{
static int counter;
struct strbuf out = STRBUF_INIT;
@@ -766,7 +782,8 @@ static void handle_tag(const char *name, struct tag *tag)
return;
}
- buf = read_object_file(&tag->object.oid, &type, &size);
+ buf = repo_read_object_file(the_repository, &tag->object.oid, &type,
+ &size);
if (!buf)
die("could not read tag %s", oid_to_hex(&tag->object.oid));
message = memmem(buf, size, "\n\n", 2);
@@ -794,7 +811,7 @@ static void handle_tag(const char *name, struct tag *tag)
if (message) {
static struct hashmap tags;
message = anonymize_str(&tags, anonymize_tag,
- message, message_size, NULL);
+ message, message_size);
message_size = strlen(message);
}
}
@@ -917,7 +934,8 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
if (e->flags & UNINTERESTING)
continue;
- if (dwim_ref(e->name, strlen(e->name), &oid, &full_name, 0) != 1)
+ if (repo_dwim_ref(the_repository, e->name, strlen(e->name),
+ &oid, &full_name, 0) != 1)
continue;
if (refspecs.nr) {
@@ -1125,11 +1143,6 @@ static void handle_deletes(void)
}
}
-static char *anonymize_seed(void *data)
-{
- return xstrdup(data);
-}
-
static int parse_opt_anonymize_map(const struct option *opt,
const char *arg, int unset)
{
@@ -1151,7 +1164,8 @@ static int parse_opt_anonymize_map(const struct option *opt,
if (!keylen || !*value)
return error(_("--anonymize-map token cannot be empty"));
- anonymize_str(map, anonymize_seed, arg, keylen, (void *)value);
+ add_anonymized_entry(map, memhash(arg, keylen), arg, keylen,
+ xstrdup(value));
return 0;
}
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 7134683ab9..bbd9b2b3e7 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -1,5 +1,9 @@
#include "builtin.h"
+#include "abspath.h"
#include "cache.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "config.h"
#include "lockfile.h"
@@ -15,11 +19,14 @@
#include "dir.h"
#include "run-command.h"
#include "packfile.h"
+#include "object-file.h"
+#include "object-name.h"
#include "object-store.h"
#include "mem-pool.h"
#include "commit-reach.h"
#include "khash.h"
#include "date.h"
+#include "wrapper.h"
#define PACK_ID_BITS 16
#define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
@@ -175,6 +182,7 @@ static FILE *pack_edges;
static unsigned int show_stats = 1;
static int global_argc;
static const char **global_argv;
+static const char *global_prefix;
/* Memory pools */
static struct mem_pool fi_mem_pool = {
@@ -436,7 +444,7 @@ static void set_checkpoint_signal(void)
#else
-static void checkpoint_signal(int signo)
+static void checkpoint_signal(int signo UNUSED)
{
checkpoint_requested = 1;
}
@@ -1265,7 +1273,7 @@ static void load_tree(struct tree_entry *root)
die("Can't load tree %s", oid_to_hex(oid));
} else {
enum object_type type;
- buf = read_object_file(oid, &type, &size);
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
if (!buf || type != OBJ_TREE)
die("Can't load tree %s", oid_to_hex(oid));
}
@@ -1625,7 +1633,7 @@ static int update_branch(struct branch *b)
if (!old_cmit || !new_cmit)
return error("Branch %s is missing commits.", b->name);
- if (!in_merge_bases(old_cmit, new_cmit)) {
+ if (!repo_in_merge_bases(the_repository, old_cmit, new_cmit)) {
warning("Not updating %s"
" (new tip %s does not contain %s)",
b->name, oid_to_hex(&b->oid),
@@ -2486,7 +2494,7 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa
if (commit_oe->type != OBJ_COMMIT)
die("Mark :%" PRIuMAX " not a commit", commit_mark);
oidcpy(&commit_oid, &commit_oe->idx.oid);
- } else if (!get_oid(p, &commit_oid)) {
+ } else if (!repo_get_oid(the_repository, p, &commit_oid)) {
unsigned long size;
char *buf = read_object_with_reference(the_repository,
&commit_oid,
@@ -2599,7 +2607,7 @@ static int parse_objectish(struct branch *b, const char *objectish)
} else
parse_from_existing(b);
}
- } else if (!get_oid(objectish, &b->oid)) {
+ } else if (!repo_get_oid(the_repository, objectish, &b->oid)) {
parse_from_existing(b);
if (is_null_oid(&b->oid))
b->delete = 1;
@@ -2654,7 +2662,7 @@ static struct hash_list *parse_merge(unsigned int *count)
if (oe->type != OBJ_COMMIT)
die("Mark :%" PRIuMAX " not a commit", idnum);
oidcpy(&n->oid, &oe->idx.oid);
- } else if (!get_oid(from, &n->oid)) {
+ } else if (!repo_get_oid(the_repository, from, &n->oid)) {
unsigned long size;
char *buf = read_object_with_reference(the_repository,
&n->oid,
@@ -2827,7 +2835,7 @@ static void parse_new_tag(const char *arg)
oe = find_mark(marks, from_mark);
type = oe->type;
oidcpy(&oid, &oe->idx.oid);
- } else if (!get_oid(from, &oid)) {
+ } else if (!repo_get_oid(the_repository, from, &oid)) {
struct object_entry *oe = find_object(&oid);
if (!oe) {
type = oid_object_info(the_repository, &oid, NULL);
@@ -2936,7 +2944,7 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
char *buf;
if (!oe || oe->pack_id == MAX_PACK_ID) {
- buf = read_object_file(oid, &type, &size);
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
} else {
type = oe->type;
buf = gfi_unpack_entry(oe, &size);
@@ -3044,7 +3052,8 @@ static struct object_entry *dereference(struct object_entry *oe,
buf = gfi_unpack_entry(oe, &size);
} else {
enum object_type unused;
- buf = read_object_file(oid, &unused, &size);
+ buf = repo_read_object_file(the_repository, oid, &unused,
+ &size);
}
if (!buf)
die("Can't load object %s", oid_to_hex(oid));
@@ -3245,7 +3254,7 @@ static void parse_alias(void)
static char* make_fast_import_path(const char *path)
{
if (!relative_marks_paths || is_absolute_path(path))
- return xstrdup(path);
+ return prefix_filename(global_prefix, path);
return git_pathdup("info/fast-import/%s", path);
}
@@ -3316,9 +3325,11 @@ static void option_cat_blob_fd(const char *fd)
static void option_export_pack_edges(const char *edges)
{
+ char *fn = prefix_filename(global_prefix, edges);
if (pack_edges)
fclose(pack_edges);
- pack_edges = xfopen(edges, "a");
+ pack_edges = xfopen(fn, "a");
+ free(fn);
}
static void option_rewrite_submodules(const char *arg, struct string_list *list)
@@ -3333,11 +3344,13 @@ static void option_rewrite_submodules(const char *arg, struct string_list *list)
f++;
CALLOC_ARRAY(ms, 1);
+ f = prefix_filename(global_prefix, f);
fp = fopen(f, "r");
if (!fp)
die_errno("cannot read '%s'", f);
read_mark_file(&ms, fp, insert_oid_entry);
fclose(fp);
+ free(f);
string_list_insert(list, s)->util = ms;
}
@@ -3551,6 +3564,7 @@ int cmd_fast_import(int argc, const char **argv, const char *prefix)
global_argc = argc;
global_argv = argv;
+ global_prefix = prefix;
rc_free = mem_pool_alloc(&fi_mem_pool, cmd_save * sizeof(*rc_free));
for (i = 0; i < (cmd_save - 1); i++)
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index afe679368d..3ba0fe5a39 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -1,4 +1,8 @@
#include "builtin.h"
+#include "alloc.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-file.h"
#include "pkt-line.h"
#include "fetch-pack.h"
#include "remote.h"
@@ -40,7 +44,7 @@ static void add_sought_entry(struct ref ***sought, int *nr, int *alloc,
(*sought)[*nr - 1] = ref;
}
-int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
+int cmd_fetch_pack(int argc, const char **argv, const char *prefix UNUSED)
{
int i, ret;
struct ref *ref = NULL;
@@ -211,8 +215,8 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
int flags = args.verbose ? CONNECT_VERBOSE : 0;
if (args.diag_url)
flags |= CONNECT_DIAG_URL;
- conn = git_connect(fd, dest, args.uploadpack,
- flags);
+ conn = git_connect(fd, dest, "git-upload-pack",
+ args.uploadpack, flags);
if (!conn)
return args.diag_url ? 0 : 1;
}
diff --git a/builtin/fetch.c b/builtin/fetch.c
index a0fca93bb6..4d7c289752 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -2,12 +2,18 @@
* "git fetch"
*/
#include "cache.h"
+#include "advice.h"
#include "config.h"
+#include "gettext.h"
+#include "environment.h"
+#include "hex.h"
#include "repository.h"
#include "refs.h"
#include "refspec.h"
+#include "object-name.h"
#include "object-store.h"
#include "oidset.h"
+#include "oid-array.h"
#include "commit.h"
#include "builtin.h"
#include "string-list.h"
@@ -22,13 +28,18 @@
#include "strvec.h"
#include "utf8.h"
#include "packfile.h"
+#include "pager.h"
+#include "pkt-line.h"
#include "list-objects-filter-options.h"
#include "commit-reach.h"
#include "branch.h"
#include "promisor-remote.h"
#include "commit-graph.h"
#include "shallow.h"
+#include "trace.h"
+#include "trace2.h"
#include "worktree.h"
+#include "bundle-uri.h"
#define FORCED_UPDATES_DELAY_WARNING_IN_MS (10 * 1000)
@@ -46,6 +57,16 @@ enum {
TAGS_SET = 2
};
+struct display_state {
+ struct strbuf buf;
+
+ int refcol_width;
+ int compact_format;
+
+ char *url;
+ int url_len, shown_url;
+};
+
static int fetch_prune_config = -1; /* unspecified */
static int fetch_show_forced_updates = 1;
static uint64_t forced_updates_ms = 0;
@@ -78,7 +99,6 @@ static const char *submodule_prefix = "";
static int recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
static int recurse_submodules_cli = RECURSE_SUBMODULES_DEFAULT;
static int recurse_submodules_default = RECURSE_SUBMODULES_ON_DEMAND;
-static int shown_url = 0;
static struct refspec refmap = REFSPEC_INIT_FETCH;
static struct list_objects_filter_options filter_options = LIST_OBJECTS_FILTER_INIT;
static struct string_list server_options = STRING_LIST_INIT_DUP;
@@ -122,6 +142,8 @@ static int git_fetch_config(const char *k, const char *v, void *cb)
fetch_parallel_config = git_config_int(k, v);
if (fetch_parallel_config < 0)
die(_("fetch.parallel cannot be negative"));
+ if (!fetch_parallel_config)
+ fetch_parallel_config = online_cpus();
return 0;
}
@@ -404,9 +426,9 @@ static void find_non_local_tags(const struct ref *refs,
*/
if (ends_with(ref->name, "^{}")) {
if (item &&
- !has_object_file_with_flags(&ref->old_oid, quick_flags) &&
+ !repo_has_object_file_with_flags(the_repository, &ref->old_oid, quick_flags) &&
!oidset_contains(&fetch_oids, &ref->old_oid) &&
- !has_object_file_with_flags(&item->oid, quick_flags) &&
+ !repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&
!oidset_contains(&fetch_oids, &item->oid))
clear_item(item);
item = NULL;
@@ -420,7 +442,7 @@ static void find_non_local_tags(const struct ref *refs,
* fetch.
*/
if (item &&
- !has_object_file_with_flags(&item->oid, quick_flags) &&
+ !repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&
!oidset_contains(&fetch_oids, &item->oid))
clear_item(item);
@@ -441,7 +463,7 @@ static void find_non_local_tags(const struct ref *refs,
* checked to see if it needs fetching.
*/
if (item &&
- !has_object_file_with_flags(&item->oid, quick_flags) &&
+ !repo_has_object_file_with_flags(the_repository, &item->oid, quick_flags) &&
!oidset_contains(&fetch_oids, &item->oid))
clear_item(item);
@@ -738,16 +760,13 @@ out:
return ret;
}
-static int refcol_width = 10;
-static int compact_format;
-
-static void adjust_refcol_width(const struct ref *ref)
+static int refcol_width(const struct ref *ref, int compact_format)
{
int max, rlen, llen, len;
/* uptodate lines are only shown on high verbosity level */
if (verbosity <= 0 && oideq(&ref->peer_ref->old_oid, &ref->old_oid))
- return;
+ return 0;
max = term_columns();
rlen = utf8_strwidth(prettify_refname(ref->name));
@@ -766,48 +785,78 @@ static void adjust_refcol_width(const struct ref *ref)
}
len = 21 /* flag and summary */ + rlen + 4 /* -> */ + llen;
if (len >= max)
- return;
+ return 0;
- /*
- * Not precise calculation for compact mode because '*' can
- * appear on the left hand side of '->' and shrink the column
- * back.
- */
- if (refcol_width < rlen)
- refcol_width = rlen;
+ return rlen;
}
-static void prepare_format_display(struct ref *ref_map)
+static void display_state_init(struct display_state *display_state, struct ref *ref_map,
+ const char *raw_url)
{
struct ref *rm;
const char *format = "full";
+ int i;
+
+ memset(display_state, 0, sizeof(*display_state));
+
+ strbuf_init(&display_state->buf, 0);
+
+ if (raw_url)
+ display_state->url = transport_anonymize_url(raw_url);
+ else
+ display_state->url = xstrdup("foreign");
+
+ display_state->url_len = strlen(display_state->url);
+ for (i = display_state->url_len - 1; display_state->url[i] == '/' && 0 <= i; i--)
+ ;
+ display_state->url_len = i + 1;
+ if (4 < i && !strncmp(".git", display_state->url + i - 3, 4))
+ display_state->url_len = i - 3;
if (verbosity < 0)
return;
git_config_get_string_tmp("fetch.output", &format);
if (!strcasecmp(format, "full"))
- compact_format = 0;
+ display_state->compact_format = 0;
else if (!strcasecmp(format, "compact"))
- compact_format = 1;
+ display_state->compact_format = 1;
else
die(_("invalid value for '%s': '%s'"),
"fetch.output", format);
+ display_state->refcol_width = 10;
for (rm = ref_map; rm; rm = rm->next) {
+ int width;
+
if (rm->status == REF_STATUS_REJECT_SHALLOW ||
!rm->peer_ref ||
!strcmp(rm->name, "HEAD"))
continue;
- adjust_refcol_width(rm);
+ width = refcol_width(rm, display_state->compact_format);
+
+ /*
+ * Not precise calculation for compact mode because '*' can
+ * appear on the left hand side of '->' and shrink the column
+ * back.
+ */
+ if (display_state->refcol_width < width)
+ display_state->refcol_width = width;
}
}
-static void print_remote_to_local(struct strbuf *display,
+static void display_state_release(struct display_state *display_state)
+{
+ strbuf_release(&display_state->buf);
+ free(display_state->url);
+}
+
+static void print_remote_to_local(struct display_state *display_state,
const char *remote, const char *local)
{
- strbuf_addf(display, "%-*s -> %s", refcol_width, remote, local);
+ strbuf_addf(&display_state->buf, "%-*s -> %s",
+ display_state->refcol_width, remote, local);
}
static int find_and_replace(struct strbuf *haystack,
@@ -837,14 +886,14 @@ static int find_and_replace(struct strbuf *haystack,
return 1;
}
-static void print_compact(struct strbuf *display,
+static void print_compact(struct display_state *display_state,
const char *remote, const char *local)
{
struct strbuf r = STRBUF_INIT;
struct strbuf l = STRBUF_INIT;
if (!strcmp(remote, local)) {
- strbuf_addf(display, "%-*s -> *", refcol_width, remote);
+ strbuf_addf(&display_state->buf, "%-*s -> *", display_state->refcol_width, remote);
return;
}
@@ -853,40 +902,51 @@ static void print_compact(struct strbuf *display,
if (!find_and_replace(&r, local, "*"))
find_and_replace(&l, remote, "*");
- print_remote_to_local(display, r.buf, l.buf);
+ print_remote_to_local(display_state, r.buf, l.buf);
strbuf_release(&r);
strbuf_release(&l);
}
-static void format_display(struct strbuf *display, char code,
- const char *summary, const char *error,
- const char *remote, const char *local,
- int summary_width)
+static void display_ref_update(struct display_state *display_state, char code,
+ const char *summary, const char *error,
+ const char *remote, const char *local,
+ int summary_width)
{
int width;
if (verbosity < 0)
return;
+ strbuf_reset(&display_state->buf);
+
+ if (!display_state->shown_url) {
+ strbuf_addf(&display_state->buf, _("From %.*s\n"),
+ display_state->url_len, display_state->url);
+ display_state->shown_url = 1;
+ }
+
width = (summary_width + strlen(summary) - gettext_width(summary));
- strbuf_addf(display, "%c %-*s ", code, width, summary);
- if (!compact_format)
- print_remote_to_local(display, remote, local);
+ strbuf_addf(&display_state->buf, " %c %-*s ", code, width, summary);
+ if (!display_state->compact_format)
+ print_remote_to_local(display_state, remote, prettify_refname(local));
else
- print_compact(display, remote, local);
+ print_compact(display_state, remote, prettify_refname(local));
if (error)
- strbuf_addf(display, " (%s)", error);
+ strbuf_addf(&display_state->buf, " (%s)", error);
+ strbuf_addch(&display_state->buf, '\n');
+
+ fputs(display_state->buf.buf, stderr);
}
static int update_local_ref(struct ref *ref,
struct ref_transaction *transaction,
+ struct display_state *display_state,
const char *remote, const struct ref *remote_ref,
- struct strbuf *display, int summary_width)
+ int summary_width)
{
struct commit *current = NULL, *updated;
- const char *pretty_ref = prettify_refname(ref->name);
int fast_forward = 0;
if (!repo_has_object_file(the_repository, &ref->new_oid))
@@ -894,8 +954,8 @@ static int update_local_ref(struct ref *ref,
if (oideq(&ref->old_oid, &ref->new_oid)) {
if (verbosity > 0)
- format_display(display, '=', _("[up to date]"), NULL,
- remote, pretty_ref, summary_width);
+ display_ref_update(display_state, '=', _("[up to date]"), NULL,
+ remote, ref->name, summary_width);
return 0;
}
@@ -906,9 +966,9 @@ static int update_local_ref(struct ref *ref,
* If this is the head, and it's not okay to update
* the head, and the old value of the head isn't empty...
*/
- format_display(display, '!', _("[rejected]"),
- _("can't fetch into checked-out branch"),
- remote, pretty_ref, summary_width);
+ display_ref_update(display_state, '!', _("[rejected]"),
+ _("can't fetch into checked-out branch"),
+ remote, ref->name, summary_width);
return 1;
}
@@ -917,13 +977,14 @@ static int update_local_ref(struct ref *ref,
if (force || ref->force) {
int r;
r = s_update_ref("updating tag", ref, transaction, 0);
- format_display(display, r ? '!' : 't', _("[tag update]"),
- r ? _("unable to update local ref") : NULL,
- remote, pretty_ref, summary_width);
+ display_ref_update(display_state, r ? '!' : 't', _("[tag update]"),
+ r ? _("unable to update local ref") : NULL,
+ remote, ref->name, summary_width);
return r;
} else {
- format_display(display, '!', _("[rejected]"), _("would clobber existing tag"),
- remote, pretty_ref, summary_width);
+ display_ref_update(display_state, '!', _("[rejected]"),
+ _("would clobber existing tag"),
+ remote, ref->name, summary_width);
return 1;
}
}
@@ -954,15 +1015,16 @@ static int update_local_ref(struct ref *ref,
}
r = s_update_ref(msg, ref, transaction, 0);
- format_display(display, r ? '!' : '*', what,
- r ? _("unable to update local ref") : NULL,
- remote, pretty_ref, summary_width);
+ display_ref_update(display_state, r ? '!' : '*', what,
+ r ? _("unable to update local ref") : NULL,
+ remote, ref->name, summary_width);
return r;
}
if (fetch_show_forced_updates) {
uint64_t t_before = getnanotime();
- fast_forward = in_merge_bases(current, updated);
+ fast_forward = repo_in_merge_bases(the_repository, current,
+ updated);
forced_updates_ms += (getnanotime() - t_before) / 1000000;
} else {
fast_forward = 1;
@@ -976,9 +1038,9 @@ static int update_local_ref(struct ref *ref,
strbuf_addstr(&quickref, "..");
strbuf_add_unique_abbrev(&quickref, &ref->new_oid, DEFAULT_ABBREV);
r = s_update_ref("fast-forward", ref, transaction, 1);
- format_display(display, r ? '!' : ' ', quickref.buf,
- r ? _("unable to update local ref") : NULL,
- remote, pretty_ref, summary_width);
+ display_ref_update(display_state, r ? '!' : ' ', quickref.buf,
+ r ? _("unable to update local ref") : NULL,
+ remote, ref->name, summary_width);
strbuf_release(&quickref);
return r;
} else if (force || ref->force) {
@@ -988,14 +1050,14 @@ static int update_local_ref(struct ref *ref,
strbuf_addstr(&quickref, "...");
strbuf_add_unique_abbrev(&quickref, &ref->new_oid, DEFAULT_ABBREV);
r = s_update_ref("forced-update", ref, transaction, 1);
- format_display(display, r ? '!' : '+', quickref.buf,
- r ? _("unable to update local ref") : _("forced update"),
- remote, pretty_ref, summary_width);
+ display_ref_update(display_state, r ? '!' : '+', quickref.buf,
+ r ? _("unable to update local ref") : _("forced update"),
+ remote, ref->name, summary_width);
strbuf_release(&quickref);
return r;
} else {
- format_display(display, '!', _("[rejected]"), _("non-fast-forward"),
- remote, pretty_ref, summary_width);
+ display_ref_update(display_state, '!', _("[rejected]"), _("non-fast-forward"),
+ remote, ref->name, summary_width);
return 1;
}
}
@@ -1105,39 +1167,34 @@ N_("it took %.2f seconds to check forced updates; you can use\n"
"'--no-show-forced-updates' or run 'git config fetch.showForcedUpdates false'\n"
"to avoid this check\n");
-static int store_updated_refs(const char *raw_url, const char *remote_name,
+static int store_updated_refs(struct display_state *display_state,
+ const char *remote_name,
int connectivity_checked,
struct ref_transaction *transaction, struct ref *ref_map,
struct fetch_head *fetch_head)
{
- int url_len, i, rc = 0;
+ int rc = 0;
struct strbuf note = STRBUF_INIT;
const char *what, *kind;
struct ref *rm;
- char *url;
int want_status;
int summary_width = 0;
if (verbosity >= 0)
summary_width = transport_summary_width(ref_map);
- if (raw_url)
- url = transport_anonymize_url(raw_url);
- else
- url = xstrdup("foreign");
-
if (!connectivity_checked) {
struct check_connected_options opt = CHECK_CONNECTED_INIT;
+ opt.exclude_hidden_refs_section = "fetch";
rm = ref_map;
if (check_connected(iterate_ref_map, &rm, &opt)) {
- rc = error(_("%s did not send all necessary objects\n"), url);
+ rc = error(_("%s did not send all necessary objects\n"),
+ display_state->url);
goto abort;
}
}
- prepare_format_display(ref_map);
-
/*
* We do a pass for each fetch_head_status type in their enum order, so
* merged entries are written before not-for-merge. That lets readers
@@ -1217,13 +1274,6 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
what = rm->name;
}
- url_len = strlen(url);
- for (i = url_len - 1; url[i] == '/' && 0 <= i; i--)
- ;
- url_len = i + 1;
- if (4 < i && !strncmp(".git", url + i - 3, 4))
- url_len = i - 3;
-
strbuf_reset(&note);
if (*what) {
if (*kind)
@@ -1233,12 +1283,12 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
append_fetch_head(fetch_head, &rm->old_oid,
rm->fetch_head_status,
- note.buf, url, url_len);
+ note.buf, display_state->url,
+ display_state->url_len);
- strbuf_reset(&note);
if (ref) {
- rc |= update_local_ref(ref, transaction, what,
- rm, &note, summary_width);
+ rc |= update_local_ref(ref, transaction, display_state, what,
+ rm, summary_width);
free(ref);
} else if (write_fetch_head || dry_run) {
/*
@@ -1246,18 +1296,10 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
* would be written to FETCH_HEAD, if --dry-run
* is set).
*/
- format_display(&note, '*',
- *kind ? kind : "branch", NULL,
- *what ? what : "HEAD",
- "FETCH_HEAD", summary_width);
- }
- if (note.len) {
- if (!shown_url) {
- fprintf(stderr, _("From %.*s\n"),
- url_len, url);
- shown_url = 1;
- }
- fprintf(stderr, " %s\n", note.buf);
+ display_ref_update(display_state, '*',
+ *kind ? kind : "branch", NULL,
+ *what ? what : "HEAD",
+ "FETCH_HEAD", summary_width);
}
}
}
@@ -1278,7 +1320,6 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
abort:
strbuf_release(&note);
- free(url);
return rc;
}
@@ -1316,16 +1357,18 @@ static int check_exist_and_connected(struct ref *ref_map)
* we need all direct targets to exist.
*/
for (r = rm; r; r = r->next) {
- if (!has_object_file_with_flags(&r->old_oid,
- OBJECT_INFO_SKIP_FETCH_OBJECT))
+ if (!repo_has_object_file_with_flags(the_repository, &r->old_oid,
+ OBJECT_INFO_SKIP_FETCH_OBJECT))
return -1;
}
opt.quiet = 1;
+ opt.exclude_hidden_refs_section = "fetch";
return check_connected(iterate_ref_map, &rm, &opt);
}
-static int fetch_and_consume_refs(struct transport *transport,
+static int fetch_and_consume_refs(struct display_state *display_state,
+ struct transport *transport,
struct ref_transaction *transaction,
struct ref *ref_map,
struct fetch_head *fetch_head)
@@ -1349,7 +1392,7 @@ static int fetch_and_consume_refs(struct transport *transport,
}
trace2_region_enter("fetch", "consume_refs", the_repository);
- ret = store_updated_refs(transport->url, transport->remote->name,
+ ret = store_updated_refs(display_state, transport->remote->name,
connectivity_checked, transaction, ref_map,
fetch_head);
trace2_region_leave("fetch", "consume_refs", the_repository);
@@ -1359,32 +1402,18 @@ out:
return ret;
}
-static int prune_refs(struct refspec *rs,
+static int prune_refs(struct display_state *display_state,
+ struct refspec *rs,
struct ref_transaction *transaction,
- struct ref *ref_map,
- const char *raw_url)
+ struct ref *ref_map)
{
- int url_len, i, result = 0;
+ int result = 0;
struct ref *ref, *stale_refs = get_stale_heads(rs, ref_map);
struct strbuf err = STRBUF_INIT;
- char *url;
const char *dangling_msg = dry_run
? _(" (%s will become dangling)")
: _(" (%s has become dangling)");
- if (raw_url)
- url = transport_anonymize_url(raw_url);
- else
- url = xstrdup("foreign");
-
- url_len = strlen(url);
- for (i = url_len - 1; url[i] == '/' && 0 <= i; i--)
- ;
-
- url_len = i + 1;
- if (4 < i && !strncmp(".git", url + i - 3, 4))
- url_len = i - 3;
-
if (!dry_run) {
if (transaction) {
for (ref = stale_refs; ref; ref = ref->next) {
@@ -1408,23 +1437,15 @@ static int prune_refs(struct refspec *rs,
int summary_width = transport_summary_width(stale_refs);
for (ref = stale_refs; ref; ref = ref->next) {
- struct strbuf sb = STRBUF_INIT;
- if (!shown_url) {
- fprintf(stderr, _("From %.*s\n"), url_len, url);
- shown_url = 1;
- }
- format_display(&sb, '-', _("[deleted]"), NULL,
- _("(none)"), prettify_refname(ref->name),
- summary_width);
- fprintf(stderr, " %s\n",sb.buf);
- strbuf_release(&sb);
+ display_ref_update(display_state, '-', _("[deleted]"), NULL,
+ _("(none)"), ref->name,
+ summary_width);
warn_dangling_symref(stderr, dangling_msg, ref->name);
}
}
cleanup:
strbuf_release(&err);
- free(url);
free_refs(stale_refs);
return result;
}
@@ -1484,7 +1505,7 @@ static void add_negotiation_tips(struct git_transport_options *smart_options)
int old_nr;
if (!has_glob_specials(s)) {
struct object_id oid;
- if (get_oid(s, &oid))
+ if (repo_get_oid(the_repository, s, &oid))
die(_("%s is not a valid object"), s);
if (!has_object(the_repository, &oid, 0))
die(_("the object %s does not exist"), s);
@@ -1539,7 +1560,8 @@ static struct transport *prepare_transport(struct remote *remote, int deepen)
return transport;
}
-static int backfill_tags(struct transport *transport,
+static int backfill_tags(struct display_state *display_state,
+ struct transport *transport,
struct ref_transaction *transaction,
struct ref *ref_map,
struct fetch_head *fetch_head)
@@ -1563,7 +1585,7 @@ static int backfill_tags(struct transport *transport,
transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, NULL);
transport_set_option(transport, TRANS_OPT_DEPTH, "0");
transport_set_option(transport, TRANS_OPT_DEEPEN_RELATIVE, NULL);
- retcode = fetch_and_consume_refs(transport, transaction, ref_map, fetch_head);
+ retcode = fetch_and_consume_refs(display_state, transport, transaction, ref_map, fetch_head);
if (gsecondary) {
transport_disconnect(gsecondary);
@@ -1578,6 +1600,7 @@ static int do_fetch(struct transport *transport,
{
struct ref_transaction *transaction = NULL;
struct ref *ref_map = NULL;
+ struct display_state display_state = { 0 };
int autotags = (transport->remote->fetch_tags == 1);
int retcode = 0;
const struct ref *remote_refs;
@@ -1659,6 +1682,8 @@ static int do_fetch(struct transport *transport,
if (retcode)
goto cleanup;
+ display_state_init(&display_state, ref_map, transport->url);
+
if (atomic_fetch) {
transaction = ref_transaction_begin(&err);
if (!transaction) {
@@ -1676,17 +1701,16 @@ static int do_fetch(struct transport *transport,
* don't care whether --tags was specified.
*/
if (rs->nr) {
- retcode = prune_refs(rs, transaction, ref_map, transport->url);
+ retcode = prune_refs(&display_state, rs, transaction, ref_map);
} else {
- retcode = prune_refs(&transport->remote->fetch,
- transaction, ref_map,
- transport->url);
+ retcode = prune_refs(&display_state, &transport->remote->fetch,
+ transaction, ref_map);
}
if (retcode != 0)
retcode = 1;
}
- if (fetch_and_consume_refs(transport, transaction, ref_map, &fetch_head)) {
+ if (fetch_and_consume_refs(&display_state, transport, transaction, ref_map, &fetch_head)) {
retcode = 1;
goto cleanup;
}
@@ -1708,7 +1732,7 @@ static int do_fetch(struct transport *transport,
* when `--atomic` is passed: in that case we'll abort
* the transaction and don't commit anything.
*/
- if (backfill_tags(transport, transaction, tags_ref_map,
+ if (backfill_tags(&display_state, transport, transaction, tags_ref_map,
&fetch_head))
retcode = 1;
}
@@ -1791,6 +1815,7 @@ cleanup:
error("%s", err.buf);
}
+ display_state_release(&display_state);
close_fetch_head(&fetch_head);
strbuf_release(&err);
free_refs(ref_map);
@@ -1877,6 +1902,8 @@ static void add_options_to_argv(struct strvec *argv)
strvec_push(argv, "--ipv4");
else if (family == TRANSPORT_FAMILY_IPV6)
strvec_push(argv, "--ipv6");
+ if (!write_fetch_head)
+ strvec_push(argv, "--no-write-fetch-head");
}
/* Fetch multiple remotes in parallel */
@@ -1887,7 +1914,8 @@ struct parallel_fetch_state {
int next, result;
};
-static int fetch_next_remote(struct child_process *cp, struct strbuf *out,
+static int fetch_next_remote(struct child_process *cp,
+ struct strbuf *out UNUSED,
void *cb, void **task_cb)
{
struct parallel_fetch_state *state = cb;
@@ -1909,7 +1937,8 @@ static int fetch_next_remote(struct child_process *cp, struct strbuf *out,
return 1;
}
-static int fetch_failed_to_start(struct strbuf *out, void *cb, void *task_cb)
+static int fetch_failed_to_start(struct strbuf *out UNUSED,
+ void *cb, void *task_cb)
{
struct parallel_fetch_state *state = cb;
const char *remote = task_cb;
@@ -1945,34 +1974,47 @@ static int fetch_multiple(struct string_list *list, int max_children)
return errcode;
}
- strvec_pushl(&argv, "fetch", "--append", "--no-auto-gc",
+ /*
+ * Cancel out the fetch.bundleURI config when running subprocesses,
+ * to avoid fetching from the same bundle list multiple times.
+ */
+ strvec_pushl(&argv, "-c", "fetch.bundleURI=",
+ "fetch", "--append", "--no-auto-gc",
"--no-write-commit-graph", NULL);
add_options_to_argv(&argv);
if (max_children != 1 && list->nr != 1) {
struct parallel_fetch_state state = { argv.v, list, 0, 0 };
+ const struct run_process_parallel_opts opts = {
+ .tr2_category = "fetch",
+ .tr2_label = "parallel/fetch",
+
+ .processes = max_children,
+
+ .get_next_task = &fetch_next_remote,
+ .start_failure = &fetch_failed_to_start,
+ .task_finished = &fetch_finished,
+ .data = &state,
+ };
strvec_push(&argv, "--end-of-options");
- result = run_processes_parallel_tr2(max_children,
- &fetch_next_remote,
- &fetch_failed_to_start,
- &fetch_finished,
- &state,
- "fetch", "parallel/fetch");
-
- if (!result)
- result = state.result;
+
+ run_processes_parallel(&opts);
+ result = state.result;
} else
for (i = 0; i < list->nr; i++) {
const char *name = list->items[i].string;
- strvec_push(&argv, name);
+ struct child_process cmd = CHILD_PROCESS_INIT;
+
+ strvec_pushv(&cmd.args, argv.v);
+ strvec_push(&cmd.args, name);
if (verbosity >= 0)
printf(_("Fetching %s\n"), name);
- if (run_command_v_opt(argv.v, RUN_GIT_CMD)) {
+ cmd.git_cmd = 1;
+ if (run_command(&cmd)) {
error(_("could not fetch %s"), name);
result = 1;
}
- strvec_pop(&argv);
}
strvec_clear(&argv);
@@ -1996,7 +2038,7 @@ static inline void fetch_one_setup_partial(struct remote *remote)
* If no prior partial clone/fetch and the current fetch DID NOT
* request a partial-fetch, do a normal fetch.
*/
- if (!has_promisor_remote() && !filter_options.choice)
+ if (!repo_has_promisor_remote(the_repository) && !filter_options.choice)
return;
/*
@@ -2099,6 +2141,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv,
int cmd_fetch(int argc, const char **argv, const char *prefix)
{
int i;
+ const char *bundle_uri;
struct string_list list = STRING_LIST_INIT_DUP;
struct remote *remote = NULL;
int result = 0;
@@ -2184,6 +2227,13 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
if (dry_run)
write_fetch_head = 0;
+ if (!max_jobs)
+ max_jobs = online_cpus();
+
+ if (!git_config_get_string_tmp("fetch.bundleuri", &bundle_uri) &&
+ fetch_bundle_uri(the_repository, bundle_uri, NULL))
+ warning(_("failed to fetch bundles from '%s'"), bundle_uri);
+
if (all) {
if (argc == 1)
die(_("fetch --all does not take a repository argument"));
@@ -2218,6 +2268,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
argv++;
}
}
+ string_list_remove_duplicates(&list, 0);
if (negotiate_only) {
struct oidset acked_commits = OIDSET_INIT;
@@ -2243,7 +2294,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
printf("%s\n", oid_to_hex(oid));
oidset_clear(&acked_commits);
} else if (remote) {
- if (filter_options.choice || has_promisor_remote())
+ if (filter_options.choice || repo_has_promisor_remote(the_repository))
fetch_one_setup_partial(remote);
result = fetch_one(remote, argc, argv, prune_tags_ok, stdin_refspecs);
} else {
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 8d8fd393f8..cc81241642 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -1,7 +1,9 @@
#include "builtin.h"
#include "config.h"
#include "fmt-merge-msg.h"
+#include "gettext.h"
#include "parse-options.h"
+#include "wrapper.h"
static const char * const fmt_merge_msg_usage[] = {
N_("git fmt-merge-msg [-m <message>] [--log[=<n>] | --no-log] [--file <file>]"),
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 6f62f40d12..695fc8f4a5 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -1,10 +1,13 @@
#include "builtin.h"
#include "cache.h"
#include "config.h"
+#include "gettext.h"
#include "refs.h"
#include "object.h"
#include "parse-options.h"
#include "ref-filter.h"
+#include "strvec.h"
+#include "commit-reach.h"
static char const * const for_each_ref_usage[] = {
N_("git for-each-ref [<options>] [<pattern>]"),
@@ -19,12 +22,14 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
int i;
struct ref_sorting *sorting;
struct string_list sorting_options = STRING_LIST_INIT_DUP;
- int maxcount = 0, icase = 0;
+ int maxcount = 0, icase = 0, omit_empty = 0;
struct ref_array array;
struct ref_filter filter;
struct ref_format format = REF_FORMAT_INIT;
struct strbuf output = STRBUF_INIT;
struct strbuf err = STRBUF_INIT;
+ int from_stdin = 0;
+ struct strvec vec = STRVEC_INIT;
struct option opts[] = {
OPT_BIT('s', "shell", &format.quote_style,
@@ -35,6 +40,8 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
N_("quote placeholders suitably for python"), QUOTE_PYTHON),
OPT_BIT(0 , "tcl", &format.quote_style,
N_("quote placeholders suitably for Tcl"), QUOTE_TCL),
+ OPT_BOOL(0, "omit-empty", &omit_empty,
+ N_("do not output a newline after empty formatted refs")),
OPT_GROUP(""),
OPT_INTEGER( 0 , "count", &maxcount, N_("show only <n> matched refs")),
@@ -49,6 +56,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
OPT_CONTAINS(&filter.with_commit, N_("print only refs which contain the commit")),
OPT_NO_CONTAINS(&filter.no_commit, N_("print only refs which don't contain the commit")),
OPT_BOOL(0, "ignore-case", &icase, N_("sorting and filtering are case insensitive")),
+ OPT_BOOL(0, "stdin", &from_stdin, N_("read reference patterns from stdin")),
OPT_END(),
};
@@ -75,9 +83,27 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
ref_sorting_set_sort_flags_all(sorting, REF_SORTING_ICASE, icase);
filter.ignore_case = icase;
- filter.name_patterns = argv;
+ if (from_stdin) {
+ struct strbuf line = STRBUF_INIT;
+
+ if (argv[0])
+ die(_("unknown arguments supplied with --stdin"));
+
+ while (strbuf_getline(&line, stdin) != EOF)
+ strvec_push(&vec, line.buf);
+
+ strbuf_release(&line);
+
+ /* vec.v is NULL-terminated, just like 'argv'. */
+ filter.name_patterns = vec.v;
+ } else {
+ filter.name_patterns = argv;
+ }
+
filter.match_as_path = 1;
filter_refs(&array, &filter, FILTER_REFS_ALL);
+ filter_ahead_behind(the_repository, &format, &array);
+
ref_array_sort(sorting, &array);
if (!maxcount || array.nr < maxcount)
@@ -88,7 +114,8 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
if (format_ref_array_item(array.items[i], &format, &output, &err))
die("%s", err.buf);
fwrite(output.buf, 1, output.len, stdout);
- putchar('\n');
+ if (output.len || !omit_empty)
+ putchar('\n');
}
strbuf_release(&err);
@@ -97,5 +124,6 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
free_commit_list(filter.with_commit);
free_commit_list(filter.no_commit);
ref_sorting_release(sorting);
+ strvec_clear(&vec);
return 0;
}
diff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c
index fd86e5a861..37daf7bec1 100644
--- a/builtin/for-each-repo.c
+++ b/builtin/for-each-repo.c
@@ -1,12 +1,15 @@
#include "cache.h"
#include "config.h"
#include "builtin.h"
+#include "gettext.h"
#include "parse-options.h"
+#include "path.h"
+#include "repository.h"
#include "run-command.h"
#include "string-list.h"
static const char * const for_each_repo_usage[] = {
- N_("git for-each-repo --config=<config> <command-args>"),
+ N_("git for-each-repo --config=<config> [--] <arguments>"),
NULL
};
@@ -14,13 +17,16 @@ static int run_command_on_repo(const char *path, int argc, const char ** argv)
{
int i;
struct child_process child = CHILD_PROCESS_INIT;
+ char *abspath = interpolate_path(path, 0);
child.git_cmd = 1;
- strvec_pushl(&child.args, "-C", path, NULL);
+ strvec_pushl(&child.args, "-C", abspath, NULL);
for (i = 0; i < argc; i++)
strvec_push(&child.args, argv[i]);
+ free(abspath);
+
return run_command(&child);
}
@@ -29,6 +35,7 @@ int cmd_for_each_repo(int argc, const char **argv, const char *prefix)
static const char *config_key = NULL;
int i, result = 0;
const struct string_list *values;
+ int err;
const struct option options[] = {
OPT_STRING(0, "config", &config_key, N_("config"),
@@ -42,14 +49,11 @@ int cmd_for_each_repo(int argc, const char **argv, const char *prefix)
if (!config_key)
die(_("missing --config=<config>"));
- values = repo_config_get_value_multi(the_repository,
- config_key);
-
- /*
- * Do nothing on an empty list, which is equivalent to the case
- * where the config variable does not exist at all.
- */
- if (!values)
+ err = repo_config_get_string_multi(the_repository, config_key, &values);
+ if (err < 0)
+ usage_msg_optf(_("got bad config --config=%s"),
+ for_each_repo_usage, options, config_key);
+ else if (err)
return 0;
for (i = 0; !result && i < values->nr; i++)
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 41acbc229e..dcc165bf0c 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -1,6 +1,7 @@
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "cache.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "config.h"
#include "commit.h"
@@ -18,10 +19,15 @@
#include "streaming.h"
#include "decorate.h"
#include "packfile.h"
+#include "object-file.h"
+#include "object-name.h"
#include "object-store.h"
+#include "replace-object.h"
#include "resolve-undo.h"
#include "run-command.h"
#include "worktree.h"
+#include "pack-revindex.h"
+#include "pack-bitmap.h"
#define REACHABLE 0x0001
#define SEEN 0x0002
@@ -51,6 +57,8 @@ static int name_objects;
#define ERROR_REFS 010
#define ERROR_COMMIT_GRAPH 020
#define ERROR_MULTI_PACK_INDEX 040
+#define ERROR_PACK_REV_INDEX 0100
+#define ERROR_BITMAP 0200
static const char *describe_object(const struct object_id *oid)
{
@@ -233,17 +241,17 @@ static void mark_unreachable_referents(const struct object_id *oid)
}
static int mark_loose_unreachable_referents(const struct object_id *oid,
- const char *path,
- void *data)
+ const char *path UNUSED,
+ void *data UNUSED)
{
mark_unreachable_referents(oid);
return 0;
}
static int mark_packed_unreachable_referents(const struct object_id *oid,
- struct packed_git *pack,
- uint32_t pos,
- void *data)
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED,
+ void *data UNUSED)
{
mark_unreachable_referents(oid);
return 0;
@@ -661,14 +669,15 @@ static int fsck_loose(const struct object_id *oid, const char *path, void *data)
return 0; /* keep checking other objects, even if we saw an error */
}
-static int fsck_cruft(const char *basename, const char *path, void *data)
+static int fsck_cruft(const char *basename, const char *path,
+ void *data UNUSED)
{
if (!starts_with(basename, "tmp_obj_"))
fprintf_ln(stderr, _("bad sha1 file: %s"), path);
return 0;
}
-static int fsck_subdir(unsigned int nr, const char *path, void *data)
+static int fsck_subdir(unsigned int nr, const char *path UNUSED, void *data)
{
struct for_each_loose_cb *cb_data = data;
struct progress *progress = cb_data->progress;
@@ -732,19 +741,19 @@ static int fsck_head_link(const char *head_ref_name,
return 0;
}
-static int fsck_cache_tree(struct cache_tree *it)
+static int fsck_cache_tree(struct cache_tree *it, const char *index_path)
{
int i;
int err = 0;
if (verbose)
- fprintf_ln(stderr, _("Checking cache tree"));
+ fprintf_ln(stderr, _("Checking cache tree of %s"), index_path);
if (0 <= it->entry_count) {
struct object *obj = parse_object(the_repository, &it->oid);
if (!obj) {
- error(_("%s: invalid sha1 pointer in cache-tree"),
- oid_to_hex(&it->oid));
+ error(_("%s: invalid sha1 pointer in cache-tree of %s"),
+ oid_to_hex(&it->oid), index_path);
errors_found |= ERROR_REFS;
return 1;
}
@@ -755,11 +764,12 @@ static int fsck_cache_tree(struct cache_tree *it)
err |= objerror(obj, _("non-tree in cache-tree"));
}
for (i = 0; i < it->subtree_nr; i++)
- err |= fsck_cache_tree(it->down[i]->cache_tree);
+ err |= fsck_cache_tree(it->down[i]->cache_tree, index_path);
return err;
}
-static int fsck_resolve_undo(struct index_state *istate)
+static int fsck_resolve_undo(struct index_state *istate,
+ const char *index_path)
{
struct string_list_item *item;
struct string_list *resolve_undo = istate->resolve_undo;
@@ -782,8 +792,9 @@ static int fsck_resolve_undo(struct index_state *istate)
obj = parse_object(the_repository, &ru->oid[i]);
if (!obj) {
- error(_("%s: invalid sha1 pointer in resolve-undo"),
- oid_to_hex(&ru->oid[i]));
+ error(_("%s: invalid sha1 pointer in resolve-undo of %s"),
+ oid_to_hex(&ru->oid[i]),
+ index_path);
errors_found |= ERROR_REFS;
continue;
}
@@ -796,6 +807,38 @@ static int fsck_resolve_undo(struct index_state *istate)
return 0;
}
+static void fsck_index(struct index_state *istate, const char *index_path,
+ int is_main_index)
+{
+ unsigned int i;
+
+ /* TODO: audit for interaction with sparse-index. */
+ ensure_full_index(istate);
+ for (i = 0; i < istate->cache_nr; i++) {
+ unsigned int mode;
+ struct blob *blob;
+ struct object *obj;
+
+ mode = istate->cache[i]->ce_mode;
+ if (S_ISGITLINK(mode))
+ continue;
+ blob = lookup_blob(the_repository,
+ &istate->cache[i]->oid);
+ if (!blob)
+ continue;
+ obj = &blob->object;
+ obj->flags |= USED;
+ fsck_put_object_name(&fsck_walk_options, &obj->oid,
+ "%s:%s",
+ is_main_index ? "" : index_path,
+ istate->cache[i]->name);
+ mark_object_reachable(obj);
+ }
+ if (istate->cache_tree)
+ fsck_cache_tree(istate->cache_tree, index_path);
+ fsck_resolve_undo(istate, index_path);
+}
+
static void mark_object_for_connectivity(const struct object_id *oid)
{
struct object *obj = lookup_unknown_object(the_repository, oid);
@@ -803,24 +846,59 @@ static void mark_object_for_connectivity(const struct object_id *oid)
}
static int mark_loose_for_connectivity(const struct object_id *oid,
- const char *path,
- void *data)
+ const char *path UNUSED,
+ void *data UNUSED)
{
mark_object_for_connectivity(oid);
return 0;
}
static int mark_packed_for_connectivity(const struct object_id *oid,
- struct packed_git *pack,
- uint32_t pos,
- void *data)
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED,
+ void *data UNUSED)
{
mark_object_for_connectivity(oid);
return 0;
}
+static int check_pack_rev_indexes(struct repository *r, int show_progress)
+{
+ struct progress *progress = NULL;
+ uint32_t pack_count = 0;
+ int res = 0;
+
+ if (show_progress) {
+ for (struct packed_git *p = get_all_packs(r); p; p = p->next)
+ pack_count++;
+ progress = start_delayed_progress("Verifying reverse pack-indexes", pack_count);
+ pack_count = 0;
+ }
+
+ for (struct packed_git *p = get_all_packs(r); p; p = p->next) {
+ int load_error = load_pack_revindex_from_disk(p);
+
+ if (load_error < 0) {
+ error(_("unable to load rev-index for pack '%s'"), p->pack_name);
+ res = ERROR_PACK_REV_INDEX;
+ } else if (!load_error &&
+ !load_pack_revindex(r, p) &&
+ verify_pack_revindex(p)) {
+ error(_("invalid rev-index for pack '%s'"), p->pack_name);
+ res = ERROR_PACK_REV_INDEX;
+ }
+ display_progress(progress, ++pack_count);
+ }
+ stop_progress(&progress);
+
+ return res;
+}
+
static char const * const fsck_usage[] = {
- N_("git fsck [<options>] [<object>...]"),
+ N_("git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+ " [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+ " [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+ " [--[no-]name-objects] [<object>...]"),
NULL
};
@@ -920,7 +998,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
for (i = 0; i < argc; i++) {
const char *arg = argv[i];
struct object_id oid;
- if (!get_oid(arg, &oid)) {
+ if (!repo_get_oid(the_repository, arg, &oid)) {
struct object *obj = lookup_object(the_repository,
&oid);
@@ -953,34 +1031,36 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
}
if (keep_cache_objects) {
+ struct worktree **worktrees, **p;
+
verify_index_checksum = 1;
verify_ce_order = 1;
- read_cache();
- /* TODO: audit for interaction with sparse-index. */
- ensure_full_index(&the_index);
- for (i = 0; i < active_nr; i++) {
- unsigned int mode;
- struct blob *blob;
- struct object *obj;
- mode = active_cache[i]->ce_mode;
- if (S_ISGITLINK(mode))
- continue;
- blob = lookup_blob(the_repository,
- &active_cache[i]->oid);
- if (!blob)
- continue;
- obj = &blob->object;
- obj->flags |= USED;
- fsck_put_object_name(&fsck_walk_options, &obj->oid,
- ":%s", active_cache[i]->name);
- mark_object_reachable(obj);
+ worktrees = get_worktrees();
+ for (p = worktrees; *p; p++) {
+ struct worktree *wt = *p;
+ struct index_state istate =
+ INDEX_STATE_INIT(the_repository);
+ char *path;
+
+ /*
+ * Make a copy since the buffer is reusable
+ * and may get overwritten by other calls
+ * while we're examining the index.
+ */
+ path = xstrdup(worktree_git_path(wt, "index"));
+ read_index_from(&istate, path, get_worktree_git_dir(wt));
+ fsck_index(&istate, path, wt->is_current);
+ discard_index(&istate);
+ free(path);
}
- if (active_cache_tree)
- fsck_cache_tree(active_cache_tree);
- fsck_resolve_undo(&the_index);
+ free_worktrees(worktrees);
}
+ errors_found |= check_pack_rev_indexes(the_repository, show_progress);
+ if (verify_bitmap_files(the_repository))
+ errors_found |= ERROR_BITMAP;
+
check_connectivity();
if (the_repository->settings.core_commit_graph) {
diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c
index c69da93ece..f6dd9a784c 100644
--- a/builtin/fsmonitor--daemon.c
+++ b/builtin/fsmonitor--daemon.c
@@ -1,14 +1,20 @@
#include "builtin.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
#include "parse-options.h"
#include "fsmonitor.h"
#include "fsmonitor-ipc.h"
+#include "fsmonitor-path-utils.h"
#include "compat/fsmonitor/fsm-health.h"
#include "compat/fsmonitor/fsm-listen.h"
#include "fsmonitor--daemon.h"
#include "simple-ipc.h"
#include "khash.h"
#include "pkt-line.h"
+#include "trace2.h"
static const char * const builtin_fsmonitor__daemon_usage[] = {
N_("git fsmonitor--daemon start [<options>]"),
@@ -709,6 +715,7 @@ static int do_handle_client(struct fsmonitor_daemon_state *state,
"fsmonitor: unsupported V1 protocol '%s'"),
command);
do_trivial = 1;
+ do_cookie = 1;
} else {
/* We have "builtin:*" */
@@ -718,6 +725,7 @@ static int do_handle_client(struct fsmonitor_daemon_state *state,
"fsmonitor: invalid V2 protocol token '%s'",
command);
do_trivial = 1;
+ do_cookie = 1;
} else {
/*
@@ -1208,7 +1216,7 @@ static int fsmonitor_run_daemon_1(struct fsmonitor_daemon_state *state)
* events.
*/
if (pthread_create(&state->listener_thread, NULL,
- fsm_listen__thread_proc, state) < 0) {
+ fsm_listen__thread_proc, state)) {
ipc_server_stop_async(state->ipc_server_data);
err = error(_("could not start fsmonitor listener thread"));
goto cleanup;
@@ -1219,7 +1227,7 @@ static int fsmonitor_run_daemon_1(struct fsmonitor_daemon_state *state)
* Start the health thread to watch over our process.
*/
if (pthread_create(&state->health_thread, NULL,
- fsm_health__thread_proc, state) < 0) {
+ fsm_health__thread_proc, state)) {
ipc_server_stop_async(state->ipc_server_data);
err = error(_("could not start fsmonitor health thread"));
goto cleanup;
@@ -1282,6 +1290,11 @@ static int fsmonitor_run_daemon(void)
strbuf_addstr(&state.path_worktree_watch, absolute_path(get_git_work_tree()));
state.nr_paths_watching = 1;
+ strbuf_init(&state.alias.alias, 0);
+ strbuf_init(&state.alias.points_to, 0);
+ if ((err = fsmonitor__get_alias(state.path_worktree_watch.buf, &state.alias)))
+ goto done;
+
/*
* We create and delete cookie files somewhere inside the .git
* directory to help us keep sync with the file system. If
@@ -1343,7 +1356,8 @@ static int fsmonitor_run_daemon(void)
* directory.)
*/
strbuf_init(&state.path_ipc, 0);
- strbuf_addstr(&state.path_ipc, absolute_path(fsmonitor_ipc__get_path()));
+ strbuf_addstr(&state.path_ipc,
+ absolute_path(fsmonitor_ipc__get_path(the_repository)));
/*
* Confirm that we can create platform-specific resources for the
@@ -1390,6 +1404,8 @@ done:
strbuf_release(&state.path_gitdir_watch);
strbuf_release(&state.path_cookie_prefix);
strbuf_release(&state.path_ipc);
+ strbuf_release(&state.alias.alias);
+ strbuf_release(&state.alias.points_to);
return err;
}
@@ -1563,7 +1579,7 @@ int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix)
}
#else
-int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix)
+int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix UNUSED)
{
struct option options[] = {
OPT_END()
diff --git a/builtin/gc.c b/builtin/gc.c
index ceff31ea00..f3942188a6 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -11,6 +11,10 @@
*/
#include "builtin.h"
+#include "abspath.h"
+#include "date.h"
+#include "environment.h"
+#include "hex.h"
#include "repository.h"
#include "config.h"
#include "tempfile.h"
@@ -22,6 +26,7 @@
#include "commit.h"
#include "commit-graph.h"
#include "packfile.h"
+#include "object-file.h"
#include "object-store.h"
#include "pack.h"
#include "pack-objects.h"
@@ -31,7 +36,11 @@
#include "refs.h"
#include "remote.h"
#include "exec-cmd.h"
+#include "gettext.h"
#include "hook.h"
+#include "setup.h"
+#include "trace2.h"
+#include "wrapper.h"
#define FAILED_RUN "failed to run %s"
@@ -42,7 +51,7 @@ static const char * const builtin_gc_usage[] = {
static int pack_refs = 1;
static int prune_reflogs = 1;
-static int cruft_packs = 0;
+static int cruft_packs = 1;
static int aggressive_depth = 50;
static int aggressive_window = 250;
static int gc_auto_threshold = 6700;
@@ -167,9 +176,11 @@ static void gc_config(void)
struct maintenance_run_opts;
static int maintenance_task_pack_refs(MAYBE_UNUSED struct maintenance_run_opts *opts)
{
- const char *argv[] = { "pack-refs", "--all", "--prune", NULL };
+ struct child_process cmd = CHILD_PROCESS_INIT;
- return run_command_v_opt(argv, RUN_GIT_CMD);
+ cmd.git_cmd = 1;
+ strvec_pushl(&cmd.args, "pack-refs", "--all", "--prune", NULL);
+ return run_command(&cmd);
}
static int too_many_loose_objects(void)
@@ -211,7 +222,7 @@ static struct packed_git *find_base_packs(struct string_list *packs,
struct packed_git *p, *base = NULL;
for (p = get_all_packs(the_repository); p; p = p->next) {
- if (!p->pack_local)
+ if (!p->pack_local || p->is_cruft)
continue;
if (limit) {
if (p->pack_size >= limit)
@@ -282,7 +293,7 @@ static uint64_t total_ram(void)
static uint64_t estimate_repack_memory(struct packed_git *pack)
{
- unsigned long nr_objects = approximate_object_count();
+ unsigned long nr_objects = repo_approximate_object_count(the_repository);
size_t os_cache, heap;
if (!pack || !nr_objects)
@@ -322,7 +333,7 @@ static uint64_t estimate_repack_memory(struct packed_git *pack)
return os_cache + heap;
}
-static int keep_one_pack(struct string_list_item *item, void *data)
+static int keep_one_pack(struct string_list_item *item, void *data UNUSED)
{
strvec_pushf(&repack, "--keep-pack=%s", basename(item->string));
return 0;
@@ -535,8 +546,14 @@ static void gc_before_repack(void)
if (pack_refs && maintenance_task_pack_refs(NULL))
die(FAILED_RUN, "pack-refs");
- if (prune_reflogs && run_command_v_opt(reflog.v, RUN_GIT_CMD))
- die(FAILED_RUN, reflog.v[0]);
+ if (prune_reflogs) {
+ struct child_process cmd = CHILD_PROCESS_INIT;
+
+ cmd.git_cmd = 1;
+ strvec_pushv(&cmd.args, reflog.v);
+ if (run_command(&cmd))
+ die(FAILED_RUN, reflog.v[0]);
+ }
}
int cmd_gc(int argc, const char **argv, const char *prefix)
@@ -550,6 +567,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
int daemonized = 0;
int keep_largest_pack = -1;
timestamp_t dummy;
+ struct child_process rerere_cmd = CHILD_PROCESS_INIT;
struct option builtin_gc_options[] = {
OPT__QUIET(&quiet, N_("suppress progress reporting")),
@@ -671,30 +689,44 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
gc_before_repack();
if (!repository_format_precious_objects) {
- if (run_command_v_opt(repack.v,
- RUN_GIT_CMD | RUN_CLOSE_OBJECT_STORE))
+ struct child_process repack_cmd = CHILD_PROCESS_INIT;
+
+ repack_cmd.git_cmd = 1;
+ repack_cmd.close_object_store = 1;
+ strvec_pushv(&repack_cmd.args, repack.v);
+ if (run_command(&repack_cmd))
die(FAILED_RUN, repack.v[0]);
if (prune_expire) {
+ struct child_process prune_cmd = CHILD_PROCESS_INIT;
+
/* run `git prune` even if using cruft packs */
strvec_push(&prune, prune_expire);
if (quiet)
strvec_push(&prune, "--no-progress");
- if (has_promisor_remote())
+ if (repo_has_promisor_remote(the_repository))
strvec_push(&prune,
"--exclude-promisor-objects");
- if (run_command_v_opt(prune.v, RUN_GIT_CMD))
+ prune_cmd.git_cmd = 1;
+ strvec_pushv(&prune_cmd.args, prune.v);
+ if (run_command(&prune_cmd))
die(FAILED_RUN, prune.v[0]);
}
}
if (prune_worktrees_expire) {
+ struct child_process prune_worktrees_cmd = CHILD_PROCESS_INIT;
+
strvec_push(&prune_worktrees, prune_worktrees_expire);
- if (run_command_v_opt(prune_worktrees.v, RUN_GIT_CMD))
+ prune_worktrees_cmd.git_cmd = 1;
+ strvec_pushv(&prune_worktrees_cmd.args, prune_worktrees.v);
+ if (run_command(&prune_worktrees_cmd))
die(FAILED_RUN, prune_worktrees.v[0]);
}
- if (run_command_v_opt(rerere.v, RUN_GIT_CMD))
+ rerere_cmd.git_cmd = 1;
+ strvec_pushv(&rerere_cmd.args, rerere.v);
+ if (run_command(&rerere_cmd))
die(FAILED_RUN, rerere.v[0]);
report_garbage = report_pack_garbage;
@@ -704,7 +736,6 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
clean_pack_garbage();
}
- prepare_repo_settings(the_repository);
if (the_repository->settings.gc_write_commit_graph == 1)
write_commit_graph_reachable(the_repository->objects->odb,
!quiet && !daemonized ? COMMIT_GRAPH_WRITE_PROGRESS : 0,
@@ -794,7 +825,7 @@ static int dfs_on_ref(const char *refname UNUSED,
commit = lookup_commit(the_repository, oid);
if (!commit)
return 0;
- if (parse_commit(commit) ||
+ if (repo_parse_commit(the_repository, commit) ||
commit_graph_position(commit) != COMMIT_NOT_FROM_GRAPH)
return 0;
@@ -811,7 +842,7 @@ static int dfs_on_ref(const char *refname UNUSED,
commit = pop_commit(&stack);
for (parent = commit->parents; parent; parent = parent->next) {
- if (parse_commit(parent->item) ||
+ if (repo_parse_commit(the_repository, parent->item) ||
commit_graph_position(parent->item) != COMMIT_NOT_FROM_GRAPH ||
parent->item->object.flags & SEEN)
continue;
@@ -950,9 +981,9 @@ struct write_loose_object_data {
static int loose_object_auto_limit = 100;
-static int loose_object_count(const struct object_id *oid,
- const char *path,
- void *data)
+static int loose_object_count(const struct object_id *oid UNUSED,
+ const char *path UNUSED,
+ void *data)
{
int *count = (int*)data;
if (++(*count) >= loose_object_auto_limit)
@@ -977,15 +1008,15 @@ static int loose_object_auto_condition(void)
NULL, NULL, &count);
}
-static int bail_on_loose(const struct object_id *oid,
- const char *path,
- void *data)
+static int bail_on_loose(const struct object_id *oid UNUSED,
+ const char *path UNUSED,
+ void *data UNUSED)
{
return 1;
}
static int write_loose_object_to_stdin(const struct object_id *oid,
- const char *path,
+ const char *path UNUSED,
void *data)
{
struct write_loose_object_data *d = (struct write_loose_object_data *)data;
@@ -1454,20 +1485,22 @@ static char *get_maintpath(void)
}
static char const * const builtin_maintenance_register_usage[] = {
- "git maintenance register",
+ "git maintenance register [--config-file <path>]",
NULL
};
static int maintenance_register(int argc, const char **argv, const char *prefix)
{
+ char *config_file = NULL;
struct option options[] = {
+ OPT_STRING(0, "config-file", &config_file, N_("file"), N_("use given config file")),
OPT_END(),
};
- int rc;
- char *config_value;
- struct child_process config_set = CHILD_PROCESS_INIT;
- struct child_process config_get = CHILD_PROCESS_INIT;
+ int found = 0;
+ const char *key = "maintenance.repo";
char *maintpath = get_maintpath();
+ struct string_list_item *item;
+ const struct string_list *list;
argc = parse_options(argc, argv, prefix, options,
builtin_maintenance_register_usage, 0);
@@ -1479,51 +1512,65 @@ static int maintenance_register(int argc, const char **argv, const char *prefix)
git_config_set("maintenance.auto", "false");
/* Set maintenance strategy, if unset */
- if (!git_config_get_string("maintenance.strategy", &config_value))
- free(config_value);
- else
+ if (git_config_get("maintenance.strategy"))
git_config_set("maintenance.strategy", "incremental");
- config_get.git_cmd = 1;
- strvec_pushl(&config_get.args, "config", "--global", "--get",
- "--fixed-value", "maintenance.repo", maintpath, NULL);
- config_get.out = -1;
-
- if (start_command(&config_get)) {
- rc = error(_("failed to run 'git config'"));
- goto done;
- }
-
- /* We already have this value in our config! */
- if (!finish_command(&config_get)) {
- rc = 0;
- goto done;
+ if (!git_config_get_string_multi(key, &list)) {
+ for_each_string_list_item(item, list) {
+ if (!strcmp(maintpath, item->string)) {
+ found = 1;
+ break;
+ }
+ }
}
- config_set.git_cmd = 1;
- strvec_pushl(&config_set.args, "config", "--add", "--global", "maintenance.repo",
- maintpath, NULL);
+ if (!found) {
+ int rc;
+ char *user_config = NULL, *xdg_config = NULL;
- rc = run_command(&config_set);
+ if (!config_file) {
+ git_global_config(&user_config, &xdg_config);
+ config_file = user_config;
+ if (!user_config)
+ die(_("$HOME not set"));
+ }
+ rc = git_config_set_multivar_in_file_gently(
+ config_file, "maintenance.repo", maintpath,
+ CONFIG_REGEX_NONE, 0);
+ free(user_config);
+ free(xdg_config);
+
+ if (rc)
+ die(_("unable to add '%s' value of '%s'"),
+ key, maintpath);
+ }
-done:
free(maintpath);
- return rc;
+ return 0;
}
static char const * const builtin_maintenance_unregister_usage[] = {
- "git maintenance unregister",
+ "git maintenance unregister [--config-file <path>] [--force]",
NULL
};
static int maintenance_unregister(int argc, const char **argv, const char *prefix)
{
+ int force = 0;
+ char *config_file = NULL;
struct option options[] = {
+ OPT_STRING(0, "config-file", &config_file, N_("file"), N_("use given config file")),
+ OPT__FORCE(&force,
+ N_("return success even if repository was not registered"),
+ PARSE_OPT_NOCOMPLETE),
OPT_END(),
};
- int rc;
- struct child_process config_unset = CHILD_PROCESS_INIT;
+ const char *key = "maintenance.repo";
char *maintpath = get_maintpath();
+ int found = 0;
+ struct string_list_item *item;
+ const struct string_list *list;
+ struct config_set cs = { { 0 } };
argc = parse_options(argc, argv, prefix, options,
builtin_maintenance_unregister_usage, 0);
@@ -1531,13 +1578,47 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi
usage_with_options(builtin_maintenance_unregister_usage,
options);
- config_unset.git_cmd = 1;
- strvec_pushl(&config_unset.args, "config", "--global", "--unset",
- "--fixed-value", "maintenance.repo", maintpath, NULL);
+ if (config_file) {
+ git_configset_init(&cs);
+ git_configset_add_file(&cs, config_file);
+ }
+ if (!(config_file
+ ? git_configset_get_string_multi(&cs, key, &list)
+ : git_config_get_string_multi(key, &list))) {
+ for_each_string_list_item(item, list) {
+ if (!strcmp(maintpath, item->string)) {
+ found = 1;
+ break;
+ }
+ }
+ }
+
+ if (found) {
+ int rc;
+ char *user_config = NULL, *xdg_config = NULL;
+ if (!config_file) {
+ git_global_config(&user_config, &xdg_config);
+ config_file = user_config;
+ if (!user_config)
+ die(_("$HOME not set"));
+ }
+ rc = git_config_set_multivar_in_file_gently(
+ config_file, key, NULL, maintpath,
+ CONFIG_FLAGS_MULTI_REPLACE | CONFIG_FLAGS_FIXED_VALUE);
+ free(user_config);
+ free(xdg_config);
+
+ if (rc &&
+ (!force || rc == CONFIG_NOTHING_SET))
+ die(_("unable to unset '%s' value of '%s'"),
+ key, maintpath);
+ } else if (!force) {
+ die(_("repository '%s' is not registered"), maintpath);
+ }
- rc = run_command(&config_unset);
+ git_configset_clear(&cs);
free(maintpath);
- return rc;
+ return 0;
}
static const char *get_frequency(enum schedule_priority schedule)
@@ -1605,11 +1686,11 @@ static int get_schedule_cmd(const char **cmd, int *is_available)
if (is_available)
*is_available = 0;
- string_list_split_in_place(&list, testing, ',', -1);
+ string_list_split_in_place(&list, testing, ",", -1);
for_each_string_list_item(item, &list) {
struct string_list pair = STRING_LIST_INIT_NODUP;
- if (string_list_split_in_place(&pair, item->string, ':', 2) != 2)
+ if (string_list_split_in_place(&pair, item->string, ":", 2) != 2)
continue;
if (!strcmp(*cmd, pair.items[0].string)) {
@@ -1874,20 +1955,16 @@ static char *schtasks_task_name(const char *frequency)
static int schtasks_remove_task(enum schedule_priority schedule)
{
const char *cmd = "schtasks";
- int result;
- struct strvec args = STRVEC_INIT;
+ struct child_process child = CHILD_PROCESS_INIT;
const char *frequency = get_frequency(schedule);
char *name = schtasks_task_name(frequency);
get_schedule_cmd(&cmd, NULL);
- strvec_split(&args, cmd);
- strvec_pushl(&args, "/delete", "/tn", name, "/f", NULL);
-
- result = run_command_v_opt(args.v, 0);
-
- strvec_clear(&args);
+ strvec_split(&child.args, cmd);
+ strvec_pushl(&child.args, "/delete", "/tn", name, "/f", NULL);
free(name);
- return result;
+
+ return run_command(&child);
}
static int schtasks_remove_tasks(void)
diff --git a/builtin/get-tar-commit-id.c b/builtin/get-tar-commit-id.c
index 491af9202d..564cfcac4f 100644
--- a/builtin/get-tar-commit-id.c
+++ b/builtin/get-tar-commit-id.c
@@ -6,6 +6,7 @@
#include "tar.h"
#include "builtin.h"
#include "quote.h"
+#include "wrapper.h"
static const char builtin_get_tar_commit_id_usage[] =
"git get-tar-commit-id";
@@ -14,7 +15,7 @@ static const char builtin_get_tar_commit_id_usage[] =
#define RECORDSIZE (512)
#define HEADERSIZE (2 * RECORDSIZE)
-int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix)
+int cmd_get_tar_commit_id(int argc, const char **argv UNUSED, const char *prefix)
{
char buffer[HEADERSIZE];
struct ustar_header *header = (struct ustar_header *)buffer;
@@ -24,6 +25,8 @@ int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix)
long len;
char *end;
+ BUG_ON_NON_EMPTY_PREFIX(prefix);
+
if (argc != 1)
usage(builtin_get_tar_commit_id_usage);
@@ -32,7 +35,7 @@ int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix)
die_errno("git get-tar-commit-id: read error");
if (n != HEADERSIZE)
die_errno("git get-tar-commit-id: EOF before reading tar header");
- if (header->typeflag[0] != 'g')
+ if (header->typeflag[0] != TYPEFLAG_GLOBAL_HEADER)
return 1;
len = strtol(content, &end, 10);
diff --git a/builtin/grep.c b/builtin/grep.c
index e6bcdf860c..b86c754def 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -3,8 +3,10 @@
*
* Copyright (c) 2006 Junio C Hamano
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
+#include "alloc.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "config.h"
#include "blob.h"
@@ -21,10 +23,15 @@
#include "quote.h"
#include "dir.h"
#include "pathspec.h"
+#include "setup.h"
#include "submodule.h"
#include "submodule-config.h"
+#include "object-file.h"
+#include "object-name.h"
#include "object-store.h"
#include "packfile.h"
+#include "pager.h"
+#include "write-or-die.h"
static const char *grep_prefix;
@@ -458,6 +465,33 @@ static int grep_submodule(struct grep_opt *opt,
* subrepo's odbs to the in-memory alternates list.
*/
obj_read_lock();
+
+ /*
+ * NEEDSWORK: when reading a submodule, the sparsity settings in the
+ * superproject are incorrectly forgotten or misused. For example:
+ *
+ * 1. "command_requires_full_index"
+ * When this setting is turned on for `grep`, only the superproject
+ * knows it. All the submodules are read with their own configs
+ * and get prepare_repo_settings()'d. Therefore, these submodules
+ * "forget" the sparse-index feature switch. As a result, the index
+ * of these submodules are expanded unexpectedly.
+ *
+ * 2. "core_apply_sparse_checkout"
+ * When running `grep` in the superproject, this setting is
+ * populated using the superproject's configs. However, once
+ * initialized, this config is globally accessible and is read by
+ * prepare_repo_settings() for the submodules. For instance, if a
+ * submodule is using a sparse-checkout, however, the superproject
+ * is not, the result is that the config from the superproject will
+ * dictate the behavior for the submodule, making it "forget" its
+ * sparse-checkout state.
+ *
+ * 3. "core_sparse_checkout_cone"
+ * ditto.
+ *
+ * Note that this list is not exhaustive.
+ */
repo_read_gitmodules(subrepo, 0);
/*
@@ -520,8 +554,6 @@ static int grep_cache(struct grep_opt *opt,
if (repo_read_index(repo) < 0)
die(_("index file corrupt"));
- /* TODO: audit for interaction with sparse-index. */
- ensure_full_index(repo->index);
for (nr = 0; nr < repo->index->cache_nr; nr++) {
const struct cache_entry *ce = repo->index->cache[nr];
@@ -530,8 +562,21 @@ static int grep_cache(struct grep_opt *opt,
strbuf_setlen(&name, name_base_len);
strbuf_addstr(&name, ce->name);
+ if (S_ISSPARSEDIR(ce->ce_mode)) {
+ enum object_type type;
+ struct tree_desc tree;
+ void *data;
+ unsigned long size;
- if (S_ISREG(ce->ce_mode) &&
+ data = repo_read_object_file(the_repository, &ce->oid,
+ &type, &size);
+ init_tree_desc(&tree, data, size);
+
+ hit |= grep_tree(opt, pathspec, &tree, &name, 0, 0);
+ strbuf_setlen(&name, name_base_len);
+ strbuf_addstr(&name, ce->name);
+ free(data);
+ } else if (S_ISREG(ce->ce_mode) &&
match_pathspec(repo->index, pathspec, name.buf, name.len, 0, NULL,
S_ISDIR(ce->ce_mode) ||
S_ISGITLINK(ce->ce_mode))) {
@@ -614,7 +659,8 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec,
void *data;
unsigned long size;
- data = read_object_file(&entry.oid, &type, &size);
+ data = repo_read_object_file(the_repository,
+ &entry.oid, &type, &size);
if (!data)
die(_("unable to read tree (%s)"),
oid_to_hex(&entry.oid));
@@ -984,6 +1030,11 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
PARSE_OPT_KEEP_DASHDASH |
PARSE_OPT_STOP_AT_NON_OPTION);
+ if (the_repository->gitdir) {
+ prepare_repo_settings(the_repository);
+ the_repository->settings.command_requires_full_index = 0;
+ }
+
if (use_index && !startup_info->have_repository) {
int fallback = 0;
git_config_get_bool("grep.fallbacktonoindex", &fallback);
diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index fbae878c2b..a380121166 100644
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
@@ -5,12 +5,18 @@
* Copyright (C) Junio C Hamano, 2005
*/
#include "builtin.h"
+#include "abspath.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-file.h"
#include "object-store.h"
#include "blob.h"
#include "quote.h"
#include "parse-options.h"
#include "exec-cmd.h"
+#include "setup.h"
+#include "write-or-die.h"
/*
* This is to create corrupt objects for debugging and as such it
@@ -27,6 +33,7 @@ static int hash_literally(struct object_id *oid, int fd, const char *type, unsig
else
ret = write_object_file_literally(buf.buf, buf.len, type, oid,
flags);
+ close(fd);
strbuf_release(&buf);
return ret;
}
@@ -80,8 +87,9 @@ static void hash_stdin_paths(const char *type, int no_filters, unsigned flags,
int cmd_hash_object(int argc, const char **argv, const char *prefix)
{
static const char * const hash_object_usage[] = {
- N_("git hash-object [-t <type>] [-w] [--path=<file> | --no-filters] [--stdin] [--] <file>..."),
- "git hash-object --stdin-paths",
+ N_("git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]\n"
+ " [--stdin [--literally]] [--] <file>..."),
+ N_("git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]"),
NULL
};
const char *type = blob_type;
diff --git a/builtin/help.c b/builtin/help.c
index 6f2796f211..d3cf4af3f6 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -5,11 +5,15 @@
#include "config.h"
#include "builtin.h"
#include "exec-cmd.h"
+#include "gettext.h"
+#include "pager.h"
#include "parse-options.h"
+#include "path.h"
#include "run-command.h"
#include "config-list.h"
#include "help.h"
#include "alias.h"
+#include "setup.h"
#ifndef DEFAULT_HELP_FORMAT
#define DEFAULT_HELP_FORMAT "man"
@@ -88,7 +92,7 @@ static struct option builtin_help_options[] = {
};
static const char * const builtin_help_usage[] = {
- "git help [-a|--all] [--[no-]verbose]] [--[no-]external-commands] [--[no-]aliases]",
+ "git help [-a|--all] [--[no-]verbose] [--[no-]external-commands] [--[no-]aliases]",
N_("git help [[-i|--info] [-m|--man] [-w|--web]] [<command>|<doc>]"),
"git help [-g|--guides]",
"git help [-c|--config]",
diff --git a/builtin/hook.c b/builtin/hook.c
index b6530d189a..88051795c7 100644
--- a/builtin/hook.c
+++ b/builtin/hook.c
@@ -1,13 +1,14 @@
#include "cache.h"
#include "builtin.h"
#include "config.h"
+#include "gettext.h"
#include "hook.h"
#include "parse-options.h"
#include "strbuf.h"
#include "strvec.h"
#define BUILTIN_HOOK_RUN_USAGE \
- N_("git hook run [--ignore-missing] <hook-name> [-- <hook-args>]")
+ N_("git hook run [--ignore-missing] [--to-stdin=<path>] <hook-name> [-- <hook-args>]")
static const char * const builtin_hook_usage[] = {
BUILTIN_HOOK_RUN_USAGE,
@@ -28,6 +29,8 @@ static int run(int argc, const char **argv, const char *prefix)
struct option run_options[] = {
OPT_BOOL(0, "ignore-missing", &ignore_missing,
N_("silently ignore missing requested <hook-name>")),
+ OPT_STRING(0, "to-stdin", &opt.path_to_stdin, N_("path"),
+ N_("file to read into hooks' stdin")),
OPT_END(),
};
int ret;
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 6648f2daef..bb67e16655 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1,6 +1,10 @@
#include "builtin.h"
+#include "alloc.h"
#include "config.h"
#include "delta.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "pack.h"
#include "csum-file.h"
#include "blob.h"
@@ -13,8 +17,14 @@
#include "streaming.h"
#include "thread-utils.h"
#include "packfile.h"
+#include "pack-revindex.h"
+#include "object-file.h"
#include "object-store.h"
+#include "oid-array.h"
+#include "replace-object.h"
#include "promisor-remote.h"
+#include "setup.h"
+#include "wrapper.h"
static const char index_pack_usage[] =
"git index-pack [-v] [-o <index-file>] [--keep | --keep=<msg>] [--[no-]rev-index] [--verify] [--strict] (<pack-file> | --stdin [--fix-thin] [<pack-file>])";
@@ -801,7 +811,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
if (startup_info->have_repository) {
read_lock();
collision_test_needed =
- has_object_file_with_flags(oid, OBJECT_INFO_QUICK);
+ repo_has_object_file_with_flags(the_repository, oid,
+ OBJECT_INFO_QUICK);
read_unlock();
}
@@ -821,7 +832,8 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
die(_("cannot read existing object info %s"), oid_to_hex(oid));
if (has_type != type || has_size != size)
die(_("SHA1 COLLISION FOUND WITH %s !"), oid_to_hex(oid));
- has_data = read_object_file(oid, &has_type, &has_size);
+ has_data = repo_read_object_file(the_repository, oid,
+ &has_type, &has_size);
read_unlock();
if (!data)
data = new_data = get_data_from_pack(obj_entry);
@@ -1388,7 +1400,7 @@ static void fix_unresolved_deltas(struct hashfile *f)
sorted_by_pos[i] = &ref_deltas[i];
QSORT(sorted_by_pos, nr_ref_deltas, delta_pos_compare);
- if (has_promisor_remote()) {
+ if (repo_has_promisor_remote(the_repository)) {
/*
* Prefetch the delta bases.
*/
@@ -1414,7 +1426,8 @@ static void fix_unresolved_deltas(struct hashfile *f)
if (objects[d->obj_no].real_type != OBJ_REF_DELTA)
continue;
- data = read_object_file(&d->oid, &type, &size);
+ data = repo_read_object_file(the_repository, &d->oid, &type,
+ &size);
if (!data)
continue;
@@ -1743,12 +1756,13 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
fsck_options.walk = mark_link;
reset_pack_idx_option(&opts);
+ opts.flags |= WRITE_REV;
git_config(git_index_pack_config, &opts);
if (prefix && chdir(prefix))
die(_("Cannot come back to cwd"));
- if (git_env_bool(GIT_TEST_WRITE_REV_INDEX, 0))
- rev_index = 1;
+ if (git_env_bool(GIT_TEST_NO_WRITE_REV_INDEX, 0))
+ rev_index = 0;
else
rev_index = !!(opts.flags & (WRITE_REV_VERIFY | WRITE_REV));
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 546f9c595e..aef4036105 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -4,12 +4,20 @@
* Copyright (C) Linus Torvalds, 2005
*/
#include "cache.h"
+#include "abspath.h"
#include "config.h"
+#include "copy.h"
+#include "environment.h"
+#include "gettext.h"
#include "refs.h"
#include "builtin.h"
#include "exec-cmd.h"
+#include "object-file.h"
#include "parse-options.h"
+#include "path.h"
+#include "setup.h"
#include "worktree.h"
+#include "wrapper.h"
#ifndef DEFAULT_GIT_TEMPLATE_DIR
#define DEFAULT_GIT_TEMPLATE_DIR "/usr/share/git-core/templates"
@@ -515,7 +523,10 @@ static int shared_callback(const struct option *opt, const char *arg, int unset)
}
static const char *const init_db_usage[] = {
- N_("git init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]] [<directory>]"),
+ N_("git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
+ " [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+ " [-b <branch-name> | --initial-branch=<branch-name>]\n"
+ " [--shared[=<permissions>]] [<directory>]"),
NULL
};
diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c
index 84748eafc0..107ac28f0e 100644
--- a/builtin/interpret-trailers.c
+++ b/builtin/interpret-trailers.c
@@ -7,13 +7,16 @@
#include "cache.h"
#include "builtin.h"
+#include "gettext.h"
#include "parse-options.h"
#include "string-list.h"
#include "trailer.h"
#include "config.h"
static const char * const git_interpret_trailers_usage[] = {
- N_("git interpret-trailers [--in-place] [--trim-empty] [(--trailer <token>[(=|:)<value>])...] [<file>...]"),
+ N_("git interpret-trailers [--in-place] [--trim-empty]\n"
+ " [(--trailer <token>[(=|:)<value>])...]\n"
+ " [--parse] [<file>...]"),
NULL
};
diff --git a/builtin/log.c b/builtin/log.c
index ee19dc5d45..676de107d6 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -4,11 +4,18 @@
* (C) Copyright 2006 Linus Torvalds
* 2006 Junio Hamano
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
+#include "object-file.h"
+#include "object-name.h"
#include "object-store.h"
+#include "pager.h"
#include "color.h"
#include "commit.h"
#include "diff.h"
@@ -16,6 +23,7 @@
#include "revision.h"
#include "log-tree.h"
#include "builtin.h"
+#include "oid-array.h"
#include "tag.h"
#include "reflog-walk.h"
#include "patch-ids.h"
@@ -36,6 +44,8 @@
#include "commit-reach.h"
#include "range-diff.h"
#include "tmp-objdir.h"
+#include "tree.h"
+#include "write-or-die.h"
#define MAIL_DEFAULT_WRAP 72
#define COVER_FROM_AUTO_MAX_SUBJECT_LEN 100
@@ -53,9 +63,11 @@ static int decoration_style;
static int decoration_given;
static int use_mailmap_config = 1;
static unsigned int force_in_body_from;
+static int stdout_mboxrd;
static const char *fmt_patch_subject_prefix = "PATCH";
static int fmt_patch_name_max = FORMAT_PATCH_NAME_MAX_DEFAULT;
static const char *fmt_pretty;
+static int format_no_prefix;
static const char * const builtin_log_usage[] = {
N_("git log [<options>] [<revision-range>] [[--] <path>...]"),
@@ -182,10 +194,10 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
int i;
char *value = NULL;
struct string_list *include = decoration_filter->include_ref_pattern;
- const struct string_list *config_exclude =
- git_config_get_value_multi("log.excludeDecoration");
+ const struct string_list *config_exclude;
- if (config_exclude) {
+ if (!git_config_get_string_multi("log.excludeDecoration",
+ &config_exclude)) {
struct string_list_item *item;
for_each_string_list_item(item, config_exclude)
string_list_append(decoration_filter->exclude_ref_config_pattern,
@@ -436,7 +448,7 @@ static void log_show_early(struct rev_info *revs, struct commit_list *list)
setitimer(ITIMER_REAL, &early_output_timer, NULL);
}
-static void early_output(int signal)
+static void early_output(int signal UNUSED)
{
show_early_output = log_show_early;
}
@@ -601,8 +613,6 @@ static int git_log_config(const char *var, const char *value, void *cb)
return 0;
}
- if (git_gpg_config(var, value, cb) < 0)
- return -1;
return git_diff_ui_config(var, value, cb);
}
@@ -675,7 +685,7 @@ static int show_tag_object(const struct object_id *oid, struct rev_info *rev)
{
unsigned long size;
enum object_type type;
- char *buf = read_object_file(oid, &type, &size);
+ char *buf = repo_read_object_file(the_repository, oid, &type, &size);
int offset = 0;
if (!buf)
@@ -1007,6 +1017,8 @@ static int git_format_config(const char *var, const char *value, void *cb)
if (!strcmp(var, "format.attach")) {
if (value && *value)
default_attach = xstrdup(value);
+ else if (value && !*value)
+ FREE_AND_NULL(default_attach);
else
default_attach = xstrdup(git_version_string);
return 0;
@@ -1078,6 +1090,23 @@ static int git_format_config(const char *var, const char *value, void *cb)
cover_from_description_mode = parse_cover_from_description(value);
return 0;
}
+ if (!strcmp(var, "format.mboxrd")) {
+ stdout_mboxrd = git_config_bool(var, value);
+ return 0;
+ }
+ if (!strcmp(var, "format.noprefix")) {
+ format_no_prefix = 1;
+ return 0;
+ }
+
+ /*
+ * ignore some porcelain config which would otherwise be parsed by
+ * git_diff_ui_config(), via git_log_config(); we can't just avoid
+ * diff_ui_config completely, because we do care about some ui options
+ * like color.
+ */
+ if (!strcmp(var, "diff.noprefix"))
+ return 0;
return git_log_config(var, value, cb);
}
@@ -1198,7 +1227,8 @@ static char *find_branch_name(struct rev_info *rev)
return NULL;
ref = rev->cmdline.rev[positive].name;
tip_oid = &rev->cmdline.rev[positive].item->oid;
- if (dwim_ref(ref, strlen(ref), &branch_oid, &full_ref, 0) &&
+ if (repo_dwim_ref(the_repository, ref, strlen(ref), &branch_oid,
+ &full_ref, 0) &&
skip_prefix(full_ref, "refs/heads/", &v) &&
oideq(tip_oid, &branch_oid))
branch = xstrdup(v);
@@ -1308,10 +1338,11 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,
log_write_email_headers(rev, head, &pp.after_subject, &need_8bit_cte, 0);
for (i = 0; !need_8bit_cte && i < nr; i++) {
- const char *buf = get_commit_buffer(list[i], NULL);
+ const char *buf = repo_get_commit_buffer(the_repository,
+ list[i], NULL);
if (has_non_ascii(buf))
need_8bit_cte = 1;
- unuse_commit_buffer(list[i], buf);
+ repo_unuse_commit_buffer(the_repository, list[i], buf);
}
if (!branch_name)
@@ -1334,6 +1365,7 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,
log.in2 = 4;
log.file = rev->diffopt.file;
log.groups = SHORTLOG_GROUP_AUTHOR;
+ shortlog_finish_setup(&log);
for (i = 0; i < nr; i++)
shortlog_add_commit(&log, list[i]);
@@ -1363,7 +1395,7 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,
.other_arg = &other_arg
};
- diff_setup(&opts);
+ repo_diff_setup(the_repository, &opts);
opts.file = rev->diffopt.file;
opts.use_color = rev->diffopt.use_color;
diff_setup_done(&opts);
@@ -1635,14 +1667,16 @@ static struct commit *get_base_commit(const char *base_commit,
struct commit *commit;
struct object_id oid;
- if (get_oid(upstream, &oid)) {
+ if (repo_get_oid(the_repository, upstream, &oid)) {
if (die_on_failure)
die(_("failed to resolve '%s' as a valid ref"), upstream);
else
return NULL;
}
commit = lookup_commit_or_die(&oid, "upstream base");
- base_list = get_merge_bases_many(commit, total, list);
+ base_list = repo_get_merge_bases_many(the_repository,
+ commit, total,
+ list);
/* There should be one and only one merge base. */
if (!base_list || base_list->next) {
if (die_on_failure) {
@@ -1676,7 +1710,9 @@ static struct commit *get_base_commit(const char *base_commit,
while (rev_nr > 1) {
for (i = 0; i < rev_nr / 2; i++) {
struct commit_list *merge_base;
- merge_base = get_merge_bases(rev[2 * i], rev[2 * i + 1]);
+ merge_base = repo_get_merge_bases(the_repository,
+ rev[2 * i],
+ rev[2 * i + 1]);
if (!merge_base || merge_base->next) {
if (die_on_failure) {
die(_("failed to find exact merge base"));
@@ -1694,7 +1730,7 @@ static struct commit *get_base_commit(const char *base_commit,
rev_nr = DIV_ROUND_UP(rev_nr, 2);
}
- if (!in_merge_bases(base, rev[0])) {
+ if (!repo_in_merge_bases(the_repository, base, rev[0])) {
if (die_on_failure) {
die(_("base commit should be the ancestor of revision list"));
} else {
@@ -1763,7 +1799,7 @@ static void prepare_bases(struct base_tree_info *bases,
struct object_id *patch_id;
if (*commit_base_at(&commit_base, commit))
continue;
- if (commit_patch_id(commit, &diffopt, &oid, 0, 1))
+ if (commit_patch_id(commit, &diffopt, &oid, 0))
die(_("cannot get patch id"));
ALLOC_GROW(bases->patch_id, bases->nr_patch_id + 1, bases->alloc_patch_id);
patch_id = bases->patch_id + bases->nr_patch_id;
@@ -1870,6 +1906,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
struct strbuf rdiff1 = STRBUF_INIT;
struct strbuf rdiff2 = STRBUF_INIT;
struct strbuf rdiff_title = STRBUF_INIT;
+ struct strbuf sprefix = STRBUF_INIT;
int creation_factor = -1;
const struct option builtin_format_patch_options[] = {
@@ -1985,6 +2022,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
s_r_opt.def = "HEAD";
s_r_opt.revarg_opt = REVARG_COMMITTISH;
+ if (format_no_prefix)
+ diff_set_noprefix(&rev.diffopt);
+
if (default_attach) {
rev.mime_boundary = default_attach;
rev.no_inline = 1;
@@ -2010,12 +2050,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
cover_from_description_mode = parse_cover_from_description(cover_from_description_arg);
if (reroll_count) {
- struct strbuf sprefix = STRBUF_INIT;
-
strbuf_addf(&sprefix, "%s v%s",
rev.subject_prefix, reroll_count);
rev.reroll_count = reroll_count;
- rev.subject_prefix = strbuf_detach(&sprefix, NULL);
+ rev.subject_prefix = sprefix.buf;
}
for (i = 0; i < extra_hdr.nr; i++) {
@@ -2091,6 +2129,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
/* Always generate a patch */
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
+ rev.always_show_header = 1;
rev.zero_commit = zero_commit;
rev.patch_name_max = fmt_patch_name_max;
@@ -2105,6 +2144,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
rev.diffopt.close_file, "--output",
!!output_directory, "--output-directory");
+ if (use_stdout && stdout_mboxrd)
+ rev.commit_format = CMIT_FMT_MBOXRD;
+
if (use_stdout) {
setup_pager();
} else if (!rev.diffopt.close_file) {
@@ -2376,6 +2418,7 @@ done:
strbuf_release(&rdiff1);
strbuf_release(&rdiff2);
strbuf_release(&rdiff_title);
+ strbuf_release(&sprefix);
free(to_free);
if (rev.ref_message_ids)
string_list_clear(rev.ref_message_ids, 0);
@@ -2386,7 +2429,7 @@ done:
static int add_pending_commit(const char *arg, struct rev_info *revs, int flags)
{
struct object_id oid;
- if (get_oid(arg, &oid) == 0) {
+ if (repo_get_oid(the_repository, arg, &oid) == 0) {
struct commit *commit = lookup_commit_reference(the_repository,
&oid);
if (commit) {
@@ -2408,12 +2451,12 @@ static void print_commit(char sign, struct commit *commit, int verbose,
{
if (!verbose) {
fprintf(file, "%c %s\n", sign,
- find_unique_abbrev(&commit->object.oid, abbrev));
+ repo_find_unique_abbrev(the_repository, &commit->object.oid, abbrev));
} else {
struct strbuf buf = STRBUF_INIT;
pp_commit_easy(CMIT_FMT_ONELINE, commit, &buf);
fprintf(file, "%c %s %s\n", sign,
- find_unique_abbrev(&commit->object.oid, abbrev),
+ repo_find_unique_abbrev(the_repository, &commit->object.oid, abbrev),
buf.buf);
strbuf_release(&buf);
}
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index 4cf8a23648..625f48f0d6 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -8,9 +8,12 @@
#include "cache.h"
#include "repository.h"
#include "config.h"
+#include "convert.h"
#include "quote.h"
#include "dir.h"
#include "builtin.h"
+#include "gettext.h"
+#include "object-name.h"
#include "strbuf.h"
#include "tree.h"
#include "cache-tree.h"
@@ -19,6 +22,7 @@
#include "string-list.h"
#include "pathspec.h"
#include "run-command.h"
+#include "setup.h"
#include "submodule.h"
#include "submodule-config.h"
@@ -89,12 +93,15 @@ static void write_name(const char *name)
static void write_name_to_buf(struct strbuf *sb, const char *name)
{
- const char *rel = relative_path(name, prefix_len ? prefix : NULL, sb);
+ struct strbuf buf = STRBUF_INIT;
+ const char *rel = relative_path(name, prefix_len ? prefix : NULL, &buf);
if (line_terminator)
quote_c_style(rel, sb, NULL, 0);
else
strbuf_addstr(sb, rel);
+
+ strbuf_release(&buf);
}
static const char *get_tag(const struct cache_entry *ce, const char *tag)
@@ -360,7 +367,7 @@ static void show_ru_info(struct index_state *istate)
if (!ui->mode[i])
continue;
printf("%s%06o %s %d\t", tag_resolve_undo, ui->mode[i],
- find_unique_abbrev(&ui->oid[i], abbrev),
+ repo_find_unique_abbrev(the_repository, &ui->oid[i], abbrev),
i + 1);
write_name(path);
}
@@ -575,7 +582,7 @@ void overlay_tree_on_index(struct index_state *istate,
read_tree_fn_t fn = NULL;
int err;
- if (get_oid(tree_name, &oid))
+ if (repo_get_oid(the_repository, tree_name, &oid))
die("tree-ish %s not found.", tree_name);
tree = parse_tree_indirect(&oid);
if (!tree)
@@ -613,6 +620,7 @@ void overlay_tree_on_index(struct index_state *istate,
if (!fn)
fn = read_one_entry_quick;
err = read_tree(the_repository, tree, &pathspec, fn, istate);
+ clear_pathspec(&pathspec);
if (err)
die("unable to read tree entries %s", tree_name);
diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
index df44e5cc0d..cb6cb77e08 100644
--- a/builtin/ls-remote.c
+++ b/builtin/ls-remote.c
@@ -1,14 +1,18 @@
#include "builtin.h"
#include "cache.h"
+#include "gettext.h"
+#include "hex.h"
#include "transport.h"
+#include "pkt-line.h"
#include "ref-filter.h"
#include "remote.h"
#include "refs.h"
+#include "parse-options.h"
static const char * const ls_remote_usage[] = {
N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
- " [-q | --quiet] [--exit-code] [--get-url]\n"
- " [--symref] [<repository> [<refs>...]]"),
+ " [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n"
+ " [--symref] [<repository> [<patterns>...]]"),
NULL
};
diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c
index c3ea09281a..077977a461 100644
--- a/builtin/ls-tree.c
+++ b/builtin/ls-tree.c
@@ -5,6 +5,9 @@
*/
#include "cache.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-name.h"
#include "object-store.h"
#include "blob.h"
#include "tree.h"
@@ -14,37 +17,11 @@
#include "parse-options.h"
#include "pathspec.h"
-static int line_termination = '\n';
-#define LS_RECURSIVE 1
-#define LS_TREE_ONLY (1 << 1)
-#define LS_SHOW_TREES (1 << 2)
-static int abbrev;
-static int ls_options;
-static struct pathspec pathspec;
-static int chomp_prefix;
-static const char *ls_tree_prefix;
-static const char *format;
-struct show_tree_data {
- unsigned mode;
- enum object_type type;
- const struct object_id *oid;
- const char *pathname;
- struct strbuf *base;
-};
-
-static const char * const ls_tree_usage[] = {
+static const char * const ls_tree_usage[] = {
N_("git ls-tree [<options>] <tree-ish> [<path>...]"),
NULL
};
-static enum ls_tree_cmdmode {
- MODE_DEFAULT = 0,
- MODE_LONG,
- MODE_NAME_ONLY,
- MODE_NAME_STATUS,
- MODE_OBJECT_ONLY,
-} cmdmode;
-
static void expand_objectsize(struct strbuf *line, const struct object_id *oid,
const enum object_type type, unsigned int padded)
{
@@ -64,10 +41,34 @@ static void expand_objectsize(struct strbuf *line, const struct object_id *oid,
}
}
+struct ls_tree_options {
+ unsigned null_termination:1;
+ int abbrev;
+ enum ls_tree_path_options {
+ LS_RECURSIVE = 1 << 0,
+ LS_TREE_ONLY = 1 << 1,
+ LS_SHOW_TREES = 1 << 2,
+ } ls_options;
+ struct pathspec pathspec;
+ int chomp_prefix;
+ const char *ls_tree_prefix;
+ const char *format;
+};
+
+struct show_tree_data {
+ struct ls_tree_options *options;
+ unsigned mode;
+ enum object_type type;
+ const struct object_id *oid;
+ const char *pathname;
+ struct strbuf *base;
+};
+
static size_t expand_show_tree(struct strbuf *sb, const char *start,
void *context)
{
struct show_tree_data *data = context;
+ struct ls_tree_options *options = data->options;
const char *end;
const char *p;
unsigned int errlen;
@@ -92,18 +93,18 @@ static size_t expand_show_tree(struct strbuf *sb, const char *start,
} else if (skip_prefix(start, "(objectsize)", &p)) {
expand_objectsize(sb, data->oid, data->type, 0);
} else if (skip_prefix(start, "(objectname)", &p)) {
- strbuf_add_unique_abbrev(sb, data->oid, abbrev);
+ strbuf_add_unique_abbrev(sb, data->oid, options->abbrev);
} else if (skip_prefix(start, "(path)", &p)) {
const char *name = data->base->buf;
- const char *prefix = chomp_prefix ? ls_tree_prefix : NULL;
- struct strbuf quoted = STRBUF_INIT;
+ const char *prefix = options->chomp_prefix ? options->ls_tree_prefix : NULL;
struct strbuf sbuf = STRBUF_INIT;
+ size_t baselen = data->base->len;
+
strbuf_addstr(data->base, data->pathname);
name = relative_path(data->base->buf, prefix, &sbuf);
- quote_c_style(name, &quoted, NULL, 0);
- strbuf_addbuf(sb, &quoted);
+ quote_c_style(name, sb, NULL, 0);
+ strbuf_setlen(data->base, baselen);
strbuf_release(&sbuf);
- strbuf_release(&quoted);
} else {
errlen = (unsigned long)len;
die(_("bad ls-tree format: %%%.*s"), errlen, start);
@@ -111,18 +112,19 @@ static size_t expand_show_tree(struct strbuf *sb, const char *start,
return len;
}
-static int show_recursive(const char *base, size_t baselen, const char *pathname)
+static int show_recursive(struct ls_tree_options *options, const char *base,
+ size_t baselen, const char *pathname)
{
int i;
- if (ls_options & LS_RECURSIVE)
+ if (options->ls_options & LS_RECURSIVE)
return 1;
- if (!pathspec.nr)
+ if (!options->pathspec.nr)
return 0;
- for (i = 0; i < pathspec.nr; i++) {
- const char *spec = pathspec.items[i].match;
+ for (i = 0; i < options->pathspec.nr; i++) {
+ const char *spec = options->pathspec.items[i].match;
size_t len, speclen;
if (strncmp(base, spec, baselen))
@@ -142,14 +144,14 @@ static int show_recursive(const char *base, size_t baselen, const char *pathname
}
static int show_tree_fmt(const struct object_id *oid, struct strbuf *base,
- const char *pathname, unsigned mode, void *context UNUSED)
+ const char *pathname, unsigned mode, void *context)
{
- size_t baselen;
+ struct ls_tree_options *options = context;
int recurse = 0;
struct strbuf sb = STRBUF_INIT;
enum object_type type = object_type(mode);
-
- struct show_tree_data data = {
+ struct show_tree_data cb_data = {
+ .options = options,
.mode = mode,
.type = type,
.oid = oid,
@@ -157,94 +159,100 @@ static int show_tree_fmt(const struct object_id *oid, struct strbuf *base,
.base = base,
};
- if (type == OBJ_TREE && show_recursive(base->buf, base->len, pathname))
+ if (type == OBJ_TREE && show_recursive(options, base->buf, base->len, pathname))
recurse = READ_TREE_RECURSIVE;
- if (type == OBJ_TREE && recurse && !(ls_options & LS_SHOW_TREES))
+ if (type == OBJ_TREE && recurse && !(options->ls_options & LS_SHOW_TREES))
return recurse;
- if (type == OBJ_BLOB && (ls_options & LS_TREE_ONLY))
+ if (type == OBJ_BLOB && (options->ls_options & LS_TREE_ONLY))
return 0;
- baselen = base->len;
- strbuf_expand(&sb, format, expand_show_tree, &data);
- strbuf_addch(&sb, line_termination);
+ strbuf_expand(&sb, options->format, expand_show_tree, &cb_data);
+ strbuf_addch(&sb, options->null_termination ? '\0' : '\n');
fwrite(sb.buf, sb.len, 1, stdout);
strbuf_release(&sb);
- strbuf_setlen(base, baselen);
return recurse;
}
-static int show_tree_common(struct show_tree_data *data, int *recurse,
- const struct object_id *oid, struct strbuf *base,
- const char *pathname, unsigned mode)
+static int show_tree_common(struct ls_tree_options *options, int *recurse,
+ struct strbuf *base, const char *pathname,
+ enum object_type type)
{
- enum object_type type = object_type(mode);
int ret = -1;
-
*recurse = 0;
- data->mode = mode;
- data->type = type;
- data->oid = oid;
- data->pathname = pathname;
- data->base = base;
if (type == OBJ_BLOB) {
- if (ls_options & LS_TREE_ONLY)
+ if (options->ls_options & LS_TREE_ONLY)
ret = 0;
} else if (type == OBJ_TREE &&
- show_recursive(base->buf, base->len, pathname)) {
+ show_recursive(options, base->buf, base->len, pathname)) {
*recurse = READ_TREE_RECURSIVE;
- if (!(ls_options & LS_SHOW_TREES))
+ if (!(options->ls_options & LS_SHOW_TREES))
ret = *recurse;
}
return ret;
}
-static void show_tree_common_default_long(struct strbuf *base,
+static void show_tree_common_default_long(struct ls_tree_options *options,
+ struct strbuf *base,
const char *pathname,
const size_t baselen)
{
+ const char *prefix = options->chomp_prefix ? options->ls_tree_prefix : NULL;
+
strbuf_addstr(base, pathname);
- write_name_quoted_relative(base->buf,
- chomp_prefix ? ls_tree_prefix : NULL, stdout,
- line_termination);
+
+ if (options->null_termination) {
+ struct strbuf sb = STRBUF_INIT;
+ const char *name = relative_path(base->buf, prefix, &sb);
+
+ fputs(name, stdout);
+ fputc('\0', stdout);
+
+ strbuf_release(&sb);
+ } else {
+ write_name_quoted_relative(base->buf, prefix, stdout, '\n');
+ }
+
strbuf_setlen(base, baselen);
}
static int show_tree_default(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode,
- void *context UNUSED)
+ void *context)
{
+ struct ls_tree_options *options = context;
int early;
int recurse;
- struct show_tree_data data = { 0 };
+ enum object_type type = object_type(mode);
- early = show_tree_common(&data, &recurse, oid, base, pathname, mode);
+ early = show_tree_common(options, &recurse, base, pathname, type);
if (early >= 0)
return early;
- printf("%06o %s %s\t", data.mode, type_name(data.type),
- find_unique_abbrev(data.oid, abbrev));
- show_tree_common_default_long(base, pathname, data.base->len);
+ printf("%06o %s %s\t", mode, type_name(object_type(mode)),
+ repo_find_unique_abbrev(the_repository, oid, options->abbrev));
+ show_tree_common_default_long(options, base, pathname, base->len);
return recurse;
}
static int show_tree_long(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode,
- void *context UNUSED)
+ void *context)
{
+ struct ls_tree_options *options = context;
int early;
int recurse;
- struct show_tree_data data = { 0 };
char size_text[24];
+ enum object_type type = object_type(mode);
- early = show_tree_common(&data, &recurse, oid, base, pathname, mode);
+ early = show_tree_common(options, &recurse, base, pathname, type);
if (early >= 0)
return early;
- if (data.type == OBJ_BLOB) {
+ if (type == OBJ_BLOB) {
unsigned long size;
- if (oid_object_info(the_repository, data.oid, &size) == OBJ_BAD)
+ if (oid_object_info(the_repository, oid, &size) == OBJ_BAD)
xsnprintf(size_text, sizeof(size_text), "BAD");
else
xsnprintf(size_text, sizeof(size_text),
@@ -253,49 +261,77 @@ static int show_tree_long(const struct object_id *oid, struct strbuf *base,
xsnprintf(size_text, sizeof(size_text), "-");
}
- printf("%06o %s %s %7s\t", data.mode, type_name(data.type),
- find_unique_abbrev(data.oid, abbrev), size_text);
- show_tree_common_default_long(base, pathname, data.base->len);
+ printf("%06o %s %s %7s\t", mode, type_name(type),
+ repo_find_unique_abbrev(the_repository, oid, options->abbrev),
+ size_text);
+ show_tree_common_default_long(options, base, pathname, base->len);
return recurse;
}
static int show_tree_name_only(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode,
- void *context UNUSED)
+ void *context)
{
+ struct ls_tree_options *options = context;
int early;
int recurse;
const size_t baselen = base->len;
- struct show_tree_data data = { 0 };
+ enum object_type type = object_type(mode);
+ const char *prefix;
- early = show_tree_common(&data, &recurse, oid, base, pathname, mode);
+ early = show_tree_common(options, &recurse, base, pathname, type);
if (early >= 0)
return early;
+ prefix = options->chomp_prefix ? options->ls_tree_prefix : NULL;
strbuf_addstr(base, pathname);
- write_name_quoted_relative(base->buf,
- chomp_prefix ? ls_tree_prefix : NULL,
- stdout, line_termination);
+ if (options->null_termination) {
+ struct strbuf sb = STRBUF_INIT;
+ const char *name = relative_path(base->buf, prefix, &sb);
+
+ fputs(name, stdout);
+ fputc('\0', stdout);
+
+ strbuf_release(&sb);
+ } else {
+ write_name_quoted_relative(base->buf, prefix, stdout, '\n');
+ }
strbuf_setlen(base, baselen);
return recurse;
}
static int show_tree_object(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode,
- void *context UNUSED)
+ void *context)
{
+ struct ls_tree_options *options = context;
int early;
int recurse;
- struct show_tree_data data = { 0 };
+ enum object_type type = object_type(mode);
+ const char *str;
- early = show_tree_common(&data, &recurse, oid, base, pathname, mode);
+ early = show_tree_common(options, &recurse, base, pathname, type);
if (early >= 0)
return early;
- printf("%s%c", find_unique_abbrev(oid, abbrev), line_termination);
+ str = repo_find_unique_abbrev(the_repository, oid, options->abbrev);
+ if (options->null_termination) {
+ fputs(str, stdout);
+ fputc('\0', stdout);
+ } else {
+ puts(str);
+ }
return recurse;
}
+enum ls_tree_cmdmode {
+ MODE_DEFAULT = 0,
+ MODE_LONG,
+ MODE_NAME_ONLY,
+ MODE_NAME_STATUS,
+ MODE_OBJECT_ONLY,
+};
+
struct ls_tree_cmdmode_to_fmt {
enum ls_tree_cmdmode mode;
const char *const fmt;
@@ -335,15 +371,18 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
struct tree *tree;
int i, full_tree = 0;
read_tree_fn_t fn = NULL;
+ enum ls_tree_cmdmode cmdmode = MODE_DEFAULT;
+ int null_termination = 0;
+ struct ls_tree_options options = { 0 };
const struct option ls_tree_options[] = {
- OPT_BIT('d', NULL, &ls_options, N_("only show trees"),
+ OPT_BIT('d', NULL, &options.ls_options, N_("only show trees"),
LS_TREE_ONLY),
- OPT_BIT('r', NULL, &ls_options, N_("recurse into subtrees"),
+ OPT_BIT('r', NULL, &options.ls_options, N_("recurse into subtrees"),
LS_RECURSIVE),
- OPT_BIT('t', NULL, &ls_options, N_("show trees when recursing"),
+ OPT_BIT('t', NULL, &options.ls_options, N_("show trees when recursing"),
LS_SHOW_TREES),
- OPT_SET_INT('z', NULL, &line_termination,
- N_("terminate entries with NUL byte"), 0),
+ OPT_BOOL('z', NULL, &null_termination,
+ N_("terminate entries with NUL byte")),
OPT_CMDMODE('l', "long", &cmdmode, N_("include object size"),
MODE_LONG),
OPT_CMDMODE(0, "name-only", &cmdmode, N_("list only filenames"),
@@ -352,29 +391,32 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
MODE_NAME_STATUS),
OPT_CMDMODE(0, "object-only", &cmdmode, N_("list only objects"),
MODE_OBJECT_ONLY),
- OPT_SET_INT(0, "full-name", &chomp_prefix,
+ OPT_SET_INT(0, "full-name", &options.chomp_prefix,
N_("use full path names"), 0),
OPT_BOOL(0, "full-tree", &full_tree,
N_("list entire tree; not just current directory "
"(implies --full-name)")),
- OPT_STRING_F(0, "format", &format, N_("format"),
+ OPT_STRING_F(0, "format", &options.format, N_("format"),
N_("format to use for the output"),
PARSE_OPT_NONEG),
- OPT__ABBREV(&abbrev),
+ OPT__ABBREV(&options.abbrev),
OPT_END()
};
struct ls_tree_cmdmode_to_fmt *m2f = ls_tree_cmdmode_format;
+ int ret;
git_config(git_default_config, NULL);
- ls_tree_prefix = prefix;
+ options.ls_tree_prefix = prefix;
if (prefix)
- chomp_prefix = strlen(prefix);
+ options.chomp_prefix = strlen(prefix);
argc = parse_options(argc, argv, prefix, ls_tree_options,
ls_tree_usage, 0);
+ options.null_termination = null_termination;
+
if (full_tree) {
- ls_tree_prefix = prefix = NULL;
- chomp_prefix = 0;
+ options.ls_tree_prefix = prefix = NULL;
+ options.chomp_prefix = 0;
}
/*
* We wanted to detect conflicts between --name-only and
@@ -386,16 +428,16 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
/* -d -r should imply -t, but -d by itself should not have to. */
if ( (LS_TREE_ONLY|LS_RECURSIVE) ==
- ((LS_TREE_ONLY|LS_RECURSIVE) & ls_options))
- ls_options |= LS_SHOW_TREES;
+ ((LS_TREE_ONLY|LS_RECURSIVE) & options.ls_options))
+ options.ls_options |= LS_SHOW_TREES;
- if (format && cmdmode)
+ if (options.format && cmdmode)
usage_msg_opt(
_("--format can't be combined with other format-altering options"),
ls_tree_usage, ls_tree_options);
if (argc < 1)
usage_with_options(ls_tree_usage, ls_tree_options);
- if (get_oid(argv[0], &oid))
+ if (repo_get_oid(the_repository, argv[0], &oid))
die("Not a valid object name %s", argv[0]);
/*
@@ -404,13 +446,13 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
* cannot be lifted until it is converted to use
* match_pathspec() or tree_entry_interesting()
*/
- parse_pathspec(&pathspec, PATHSPEC_ALL_MAGIC &
- ~(PATHSPEC_FROMTOP | PATHSPEC_LITERAL),
+ parse_pathspec(&options.pathspec, PATHSPEC_ALL_MAGIC &
+ ~(PATHSPEC_FROMTOP | PATHSPEC_LITERAL),
PATHSPEC_PREFER_CWD,
prefix, argv + 1);
- for (i = 0; i < pathspec.nr; i++)
- pathspec.items[i].nowildcard_len = pathspec.items[i].len;
- pathspec.has_wildcard = 0;
+ for (i = 0; i < options.pathspec.nr; i++)
+ options.pathspec.items[i].nowildcard_len = options.pathspec.items[i].len;
+ options.pathspec.has_wildcard = 0;
tree = parse_tree_indirect(&oid);
if (!tree)
die("not a tree object");
@@ -420,11 +462,11 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
*/
while (m2f) {
if (!m2f->fmt) {
- fn = format ? show_tree_fmt : show_tree_default;
- } else if (format && !strcmp(format, m2f->fmt)) {
+ fn = options.format ? show_tree_fmt : show_tree_default;
+ } else if (options.format && !strcmp(options.format, m2f->fmt)) {
cmdmode = m2f->mode;
fn = m2f->fn;
- } else if (!format && cmdmode == m2f->mode) {
+ } else if (!options.format && cmdmode == m2f->mode) {
fn = m2f->fn;
} else {
m2f++;
@@ -433,5 +475,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
break;
}
- return !!read_tree(the_repository, tree, &pathspec, fn, NULL);
+ ret = !!read_tree(the_repository, tree, &options.pathspec, fn, &options);
+ clear_pathspec(&options.pathspec);
+ return ret;
}
diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c
index 01d16ef9e5..a032a1c388 100644
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
@@ -3,7 +3,10 @@
* email to figure out authorship and subject
*/
#include "cache.h"
+#include "abspath.h"
#include "builtin.h"
+#include "environment.h"
+#include "gettext.h"
#include "utf8.h"
#include "strbuf.h"
#include "mailinfo.h"
diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c
index 73509f651b..0b6193a091 100644
--- a/builtin/mailsplit.c
+++ b/builtin/mailsplit.c
@@ -6,6 +6,7 @@
*/
#include "cache.h"
#include "builtin.h"
+#include "gettext.h"
#include "string-list.h"
#include "strbuf.h"
@@ -277,6 +278,8 @@ int cmd_mailsplit(int argc, const char **argv, const char *prefix)
const char **argp;
static const char *stdin_only[] = { "-", NULL };
+ BUG_ON_NON_EMPTY_PREFIX(prefix);
+
for (argp = argv+1; *argp; argp++) {
const char *arg = *argp;
diff --git a/builtin/merge-base.c b/builtin/merge-base.c
index a11f8c6e4b..854019a32d 100644
--- a/builtin/merge-base.c
+++ b/builtin/merge-base.c
@@ -2,9 +2,12 @@
#include "cache.h"
#include "config.h"
#include "commit.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
#include "diff.h"
#include "revision.h"
+#include "object-name.h"
#include "parse-options.h"
#include "repository.h"
#include "commit-reach.h"
@@ -13,7 +16,8 @@ static int show_merge_base(struct commit **rev, int rev_nr, int show_all)
{
struct commit_list *result, *r;
- result = get_merge_bases_many_dirty(rev[0], rev_nr - 1, rev + 1);
+ result = repo_get_merge_bases_many_dirty(the_repository, rev[0],
+ rev_nr - 1, rev + 1);
if (!result)
return 1;
@@ -31,8 +35,8 @@ static int show_merge_base(struct commit **rev, int rev_nr, int show_all)
static const char * const merge_base_usage[] = {
N_("git merge-base [-a | --all] <commit> <commit>..."),
N_("git merge-base [-a | --all] --octopus <commit>..."),
- N_("git merge-base --independent <commit>..."),
N_("git merge-base --is-ancestor <commit> <commit>"),
+ N_("git merge-base --independent <commit>..."),
N_("git merge-base --fork-point <ref> [<commit>]"),
NULL
};
@@ -42,7 +46,7 @@ static struct commit *get_commit_reference(const char *arg)
struct object_id revkey;
struct commit *r;
- if (get_oid(arg, &revkey))
+ if (repo_get_oid(the_repository, arg, &revkey))
die("Not a valid object name %s", arg);
r = lookup_commit_reference(the_repository, &revkey);
if (!r)
@@ -105,7 +109,7 @@ static int handle_is_ancestor(int argc, const char **argv)
die("--is-ancestor takes exactly two commits");
one = get_commit_reference(argv[0]);
two = get_commit_reference(argv[1]);
- if (in_merge_bases(one, two))
+ if (repo_in_merge_bases(the_repository, one, two))
return 0;
else
return 1;
@@ -118,7 +122,7 @@ static int handle_fork_point(int argc, const char **argv)
const char *commitname;
commitname = (argc == 2) ? argv[1] : "HEAD";
- if (get_oid(commitname, &oid))
+ if (repo_get_oid(the_repository, commitname, &oid))
die("Not a valid object name: '%s'", commitname);
derived = lookup_commit_reference(the_repository, &oid);
diff --git a/builtin/merge-file.c b/builtin/merge-file.c
index c923bbf2ab..781818d08f 100644
--- a/builtin/merge-file.c
+++ b/builtin/merge-file.c
@@ -1,6 +1,9 @@
#include "builtin.h"
+#include "abspath.h"
#include "cache.h"
#include "config.h"
+#include "gettext.h"
+#include "setup.h"
#include "xdiff/xdiff.h"
#include "xdiff-interface.h"
#include "parse-options.h"
diff --git a/builtin/merge-index.c b/builtin/merge-index.c
index c0383fe9df..ab16e70f23 100644
--- a/builtin/merge-index.c
+++ b/builtin/merge-index.c
@@ -1,5 +1,7 @@
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "hex.h"
+#include "repository.h"
#include "run-command.h"
static const char *pgm;
@@ -12,12 +14,13 @@ static int merge_entry(int pos, const char *path)
const char *arguments[] = { pgm, "", "", "", path, "", "", "", NULL };
char hexbuf[4][GIT_MAX_HEXSZ + 1];
char ownbuf[4][60];
+ struct child_process cmd = CHILD_PROCESS_INIT;
- if (pos >= active_nr)
+ if (pos >= the_index.cache_nr)
die("git merge-index: %s not in the cache", path);
found = 0;
do {
- const struct cache_entry *ce = active_cache[pos];
+ const struct cache_entry *ce = the_index.cache[pos];
int stage = ce_stage(ce);
if (strcmp(ce->name, path))
@@ -27,11 +30,12 @@ static int merge_entry(int pos, const char *path)
xsnprintf(ownbuf[stage], sizeof(ownbuf[stage]), "%o", ce->ce_mode);
arguments[stage] = hexbuf[stage];
arguments[stage + 4] = ownbuf[stage];
- } while (++pos < active_nr);
+ } while (++pos < the_index.cache_nr);
if (!found)
die("git merge-index: %s not in the cache", path);
- if (run_command_v_opt(arguments, 0)) {
+ strvec_pushv(&cmd.args, arguments);
+ if (run_command(&cmd)) {
if (one_shot)
err++;
else {
@@ -45,7 +49,7 @@ static int merge_entry(int pos, const char *path)
static void merge_one_path(const char *path)
{
- int pos = cache_name_pos(path, strlen(path));
+ int pos = index_name_pos(&the_index, path, strlen(path));
/*
* If it already exists in the cache as stage0, it's
@@ -60,15 +64,15 @@ static void merge_all(void)
int i;
/* TODO: audit for interaction with sparse-index. */
ensure_full_index(&the_index);
- for (i = 0; i < active_nr; i++) {
- const struct cache_entry *ce = active_cache[i];
+ for (i = 0; i < the_index.cache_nr; i++) {
+ const struct cache_entry *ce = the_index.cache[i];
if (!ce_stage(ce))
continue;
i += merge_entry(i, ce->name)-1;
}
}
-int cmd_merge_index(int argc, const char **argv, const char *prefix)
+int cmd_merge_index(int argc, const char **argv, const char *prefix UNUSED)
{
int i, force_file = 0;
@@ -80,7 +84,7 @@ int cmd_merge_index(int argc, const char **argv, const char *prefix)
if (argc < 3)
usage("git merge-index [-o] [-q] <merge-program> (-a | [--] [<filename>...])");
- read_cache();
+ repo_read_index(the_repository);
/* TODO: audit for interaction with sparse-index. */
ensure_full_index(&the_index);
diff --git a/builtin/merge-ours.c b/builtin/merge-ours.c
index 3583cff71c..c2e519301e 100644
--- a/builtin/merge-ours.c
+++ b/builtin/merge-ours.c
@@ -7,7 +7,6 @@
*
* Pretend we resolved the heads, but declare our tree trumps everybody else.
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "git-compat-util.h"
#include "builtin.h"
#include "diff.h"
@@ -15,7 +14,7 @@
static const char builtin_merge_ours_usage[] =
"git merge-ours <base>... -- HEAD <remote>...";
-int cmd_merge_ours(int argc, const char **argv, const char *prefix)
+int cmd_merge_ours(int argc, const char **argv, const char *prefix UNUSED)
{
if (argc == 2 && !strcmp(argv[1], "-h"))
usage(builtin_merge_ours_usage);
@@ -25,7 +24,7 @@ int cmd_merge_ours(int argc, const char **argv, const char *prefix)
* commit. The index must match HEAD, or this merge cannot go
* through.
*/
- if (read_cache() < 0)
+ if (repo_read_index(the_repository) < 0)
die_errno("read_cache failed");
if (index_differs_from(the_repository, "HEAD", NULL, 0))
return 2;
diff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c
index b9acbf5d34..b9e980384a 100644
--- a/builtin/merge-recursive.c
+++ b/builtin/merge-recursive.c
@@ -1,8 +1,13 @@
#include "cache.h"
#include "builtin.h"
+#include "advice.h"
#include "commit.h"
+#include "gettext.h"
+#include "hash.h"
#include "tag.h"
#include "merge-recursive.h"
+#include "object-name.h"
+#include "repository.h"
#include "xdiff-interface.h"
static const char builtin_merge_recursive_usage[] =
@@ -20,7 +25,7 @@ static char *better_branch_name(const char *branch)
return xstrdup(name ? name : branch);
}
-int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
+int cmd_merge_recursive(int argc, const char **argv, const char *prefix UNUSED)
{
const struct object_id *bases[21];
unsigned bases_count = 0;
@@ -49,7 +54,7 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
}
if (bases_count < ARRAY_SIZE(bases)-1) {
struct object_id *oid = xmalloc(sizeof(struct object_id));
- if (get_oid(argv[i], oid))
+ if (repo_get_oid(the_repository, argv[i], oid))
die(_("could not parse object '%s'"), argv[i]);
bases[bases_count++] = oid;
}
@@ -70,9 +75,9 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
o.branch1 = argv[++i];
o.branch2 = argv[++i];
- if (get_oid(o.branch1, &h1))
+ if (repo_get_oid(the_repository, o.branch1, &h1))
die(_("could not resolve ref '%s'"), o.branch1);
- if (get_oid(o.branch2, &h2))
+ if (repo_get_oid(the_repository, o.branch2, &h2))
die(_("could not resolve ref '%s'"), o.branch2);
o.branch1 = better1 = better_branch_name(o.branch1);
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index ae5782917b..aa8040c2a6 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -1,10 +1,14 @@
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
#include "tree-walk.h"
#include "xdiff-interface.h"
#include "help.h"
+#include "gettext.h"
+#include "hex.h"
+#include "commit.h"
#include "commit-reach.h"
#include "merge-ort.h"
+#include "object-name.h"
#include "object-store.h"
#include "parse-options.h"
#include "repository.h"
@@ -12,6 +16,7 @@
#include "exec-cmd.h"
#include "merge-blobs.h"
#include "quote.h"
+#include "tree.h"
static int line_termination = '\n';
@@ -68,7 +73,9 @@ static void *result(struct merge_list *entry, unsigned long *size)
const char *path = entry->path;
if (!entry->stage)
- return read_object_file(&entry->blob->object.oid, &type, size);
+ return repo_read_object_file(the_repository,
+ &entry->blob->object.oid, &type,
+ size);
base = NULL;
if (entry->stage == 1) {
base = entry->blob;
@@ -91,14 +98,15 @@ static void *origin(struct merge_list *entry, unsigned long *size)
enum object_type type;
while (entry) {
if (entry->stage == 2)
- return read_object_file(&entry->blob->object.oid,
- &type, size);
+ return repo_read_object_file(the_repository,
+ &entry->blob->object.oid,
+ &type, size);
entry = entry->link;
}
return NULL;
}
-static int show_outf(void *priv_, mmbuffer_t *mb, int nbuf)
+static int show_outf(void *priv UNUSED, mmbuffer_t *mb, int nbuf)
{
int i;
for (i = 0; i < nbuf; i++)
@@ -402,9 +410,11 @@ struct merge_tree_options {
int allow_unrelated_histories;
int show_messages;
int name_only;
+ int use_stdin;
};
static int real_merge(struct merge_tree_options *o,
+ const char *merge_base,
const char *branch1, const char *branch2,
const char *prefix)
{
@@ -412,6 +422,7 @@ static int real_merge(struct merge_tree_options *o,
struct commit_list *merge_bases = NULL;
struct merge_options opt;
struct merge_result result = { 0 };
+ int show_messages = o->show_messages;
parent1 = get_merge_parent(branch1);
if (!parent1)
@@ -430,22 +441,40 @@ static int real_merge(struct merge_tree_options *o,
opt.branch1 = branch1;
opt.branch2 = branch2;
- /*
- * Get the merge bases, in reverse order; see comment above
- * merge_incore_recursive in merge-ort.h
- */
- merge_bases = get_merge_bases(parent1, parent2);
- if (!merge_bases && !o->allow_unrelated_histories)
- die(_("refusing to merge unrelated histories"));
- merge_bases = reverse_commit_list(merge_bases);
+ if (merge_base) {
+ struct commit *base_commit;
+ struct tree *base_tree, *parent1_tree, *parent2_tree;
+
+ base_commit = lookup_commit_reference_by_name(merge_base);
+ if (!base_commit)
+ die(_("could not lookup commit %s"), merge_base);
+
+ opt.ancestor = merge_base;
+ base_tree = repo_get_commit_tree(the_repository, base_commit);
+ parent1_tree = repo_get_commit_tree(the_repository, parent1);
+ parent2_tree = repo_get_commit_tree(the_repository, parent2);
+ merge_incore_nonrecursive(&opt, base_tree, parent1_tree, parent2_tree, &result);
+ } else {
+ /*
+ * Get the merge bases, in reverse order; see comment above
+ * merge_incore_recursive in merge-ort.h
+ */
+ merge_bases = repo_get_merge_bases(the_repository, parent1,
+ parent2);
+ if (!merge_bases && !o->allow_unrelated_histories)
+ die(_("refusing to merge unrelated histories"));
+ merge_bases = reverse_commit_list(merge_bases);
+ merge_incore_recursive(&opt, merge_bases, parent1, parent2, &result);
+ }
- merge_incore_recursive(&opt, merge_bases, parent1, parent2, &result);
if (result.clean < 0)
die(_("failure to merge"));
- if (o->show_messages == -1)
- o->show_messages = !result.clean;
+ if (show_messages == -1)
+ show_messages = !result.clean;
+ if (o->use_stdin)
+ printf("%d%c", result.clean, line_termination);
printf("%s%c", oid_to_hex(&result.tree->object.oid), line_termination);
if (!result.clean) {
struct string_list conflicted_files = STRING_LIST_INIT_NODUP;
@@ -467,11 +496,13 @@ static int real_merge(struct merge_tree_options *o,
}
string_list_clear(&conflicted_files, 1);
}
- if (o->show_messages) {
+ if (show_messages) {
putchar(line_termination);
merge_display_update_messages(&opt, line_termination == '\0',
&result);
}
+ if (o->use_stdin)
+ putchar(line_termination);
merge_finalize(&opt, &result);
return !result.clean; /* result.clean < 0 handled above */
}
@@ -481,6 +512,7 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
struct merge_tree_options o = { .show_messages = -1 };
int expected_remaining_argc;
int original_argc;
+ const char *merge_base = NULL;
const char * const merge_tree_usage[] = {
N_("git merge-tree [--write-tree] [<options>] <branch1> <branch2>"),
@@ -505,6 +537,14 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
&o.allow_unrelated_histories,
N_("allow merging unrelated histories"),
PARSE_OPT_NONEG),
+ OPT_BOOL_F(0, "stdin",
+ &o.use_stdin,
+ N_("perform multiple merges, one per line of input"),
+ PARSE_OPT_NONEG),
+ OPT_STRING(0, "merge-base",
+ &merge_base,
+ N_("commit"),
+ N_("specify a merge-base for the merge")),
OPT_END()
};
@@ -512,6 +552,51 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
original_argc = argc - 1; /* ignoring argv[0] */
argc = parse_options(argc, argv, prefix, mt_options,
merge_tree_usage, PARSE_OPT_STOP_AT_NON_OPTION);
+
+ /* Handle --stdin */
+ if (o.use_stdin) {
+ struct strbuf buf = STRBUF_INIT;
+
+ if (o.mode == MODE_TRIVIAL)
+ die(_("--trivial-merge is incompatible with all other options"));
+ if (merge_base)
+ die(_("--merge-base is incompatible with --stdin"));
+ line_termination = '\0';
+ while (strbuf_getline_lf(&buf, stdin) != EOF) {
+ struct strbuf **split;
+ int result;
+ const char *input_merge_base = NULL;
+
+ split = strbuf_split(&buf, ' ');
+ if (!split[0] || !split[1])
+ die(_("malformed input line: '%s'."), buf.buf);
+ strbuf_rtrim(split[0]);
+ strbuf_rtrim(split[1]);
+
+ /* parse the merge-base */
+ if (!strcmp(split[1]->buf, "--")) {
+ input_merge_base = split[0]->buf;
+ }
+
+ if (input_merge_base && split[2] && split[3] && !split[4]) {
+ strbuf_rtrim(split[2]);
+ strbuf_rtrim(split[3]);
+ result = real_merge(&o, input_merge_base, split[2]->buf, split[3]->buf, prefix);
+ } else if (!input_merge_base && !split[2]) {
+ result = real_merge(&o, NULL, split[0]->buf, split[1]->buf, prefix);
+ } else {
+ die(_("malformed input line: '%s'."), buf.buf);
+ }
+
+ if (result < 0)
+ die(_("merging cannot continue; got unclean result of %d"), result);
+ strbuf_list_free(split);
+ }
+ strbuf_release(&buf);
+ return 0;
+ }
+
+ /* Figure out which mode to use */
switch (o.mode) {
default:
BUG("unexpected command mode %d", o.mode);
@@ -545,7 +630,7 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
/* Do the relevant type of merge */
if (o.mode == MODE_REAL)
- return real_merge(&o, argv[0], argv[1], prefix);
+ return real_merge(&o, merge_base, argv[0], argv[1], prefix);
else
return trivial_merge(argv[0], argv[1], argv[2]);
}
diff --git a/builtin/merge.c b/builtin/merge.c
index 5900b81729..8da3e46abb 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -6,9 +6,17 @@
* Based on git-merge.sh by Junio C Hamano.
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "cache.h"
+#include "abspath.h"
+#include "advice.h"
+#include "alloc.h"
#include "config.h"
+#include "editor.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-name.h"
#include "parse-options.h"
#include "builtin.h"
#include "lockfile.h"
@@ -44,6 +52,7 @@
#include "commit-reach.h"
#include "wt-status.h"
#include "commit-graph.h"
+#include "wrapper.h"
#define DEFAULT_TWOHEAD (1<<0)
#define DEFAULT_OCTOPUS (1<<1)
@@ -188,7 +197,7 @@ static struct strategy *get_strategy(const char *name)
for (i = 0; i < main_cmds.cnt; i++) {
int j, found = 0;
struct cmdname *ent = main_cmds.names[i];
- for (j = 0; j < ARRAY_SIZE(all_strategy); j++)
+ for (j = 0; !found && j < ARRAY_SIZE(all_strategy); j++)
if (!strncmp(ent->name, all_strategy[j].name, ent->len)
&& !all_strategy[j].name[ent->len])
found = 1;
@@ -318,7 +327,7 @@ static int save_state(struct object_id *stash)
int rc = -1;
fd = repo_hold_locked_index(the_repository, &lock_file, 0);
- refresh_cache(REFRESH_QUIET);
+ refresh_index(&the_index, REFRESH_QUIET, NULL, NULL, NULL);
if (0 <= fd)
repo_update_index_if_able(the_repository, &lock_file);
rollback_lock_file(&lock_file);
@@ -337,7 +346,7 @@ static int save_state(struct object_id *stash)
else if (!len) /* no changes */
goto out;
strbuf_setlen(&buffer, buffer.len-1);
- if (get_oid(buffer.buf, stash))
+ if (repo_get_oid(the_repository, buffer.buf, stash))
die(_("not a valid object: %s"), buffer.buf);
rc = 0;
out:
@@ -345,63 +354,53 @@ out:
return rc;
}
-static void read_empty(const struct object_id *oid, int verbose)
+static void read_empty(const struct object_id *oid)
{
- int i = 0;
- const char *args[7];
-
- args[i++] = "read-tree";
- if (verbose)
- args[i++] = "-v";
- args[i++] = "-m";
- args[i++] = "-u";
- args[i++] = empty_tree_oid_hex();
- args[i++] = oid_to_hex(oid);
- args[i] = NULL;
+ struct child_process cmd = CHILD_PROCESS_INIT;
+
+ strvec_pushl(&cmd.args, "read-tree", "-m", "-u", empty_tree_oid_hex(),
+ oid_to_hex(oid), NULL);
+ cmd.git_cmd = 1;
- if (run_command_v_opt(args, RUN_GIT_CMD))
+ if (run_command(&cmd))
die(_("read-tree failed"));
}
-static void reset_hard(const struct object_id *oid, int verbose)
+static void reset_hard(const struct object_id *oid)
{
- int i = 0;
- const char *args[6];
-
- args[i++] = "read-tree";
- if (verbose)
- args[i++] = "-v";
- args[i++] = "--reset";
- args[i++] = "-u";
- args[i++] = oid_to_hex(oid);
- args[i] = NULL;
+ struct child_process cmd = CHILD_PROCESS_INIT;
+
+ strvec_pushl(&cmd.args, "read-tree", "-v", "--reset", "-u",
+ oid_to_hex(oid), NULL);
+ cmd.git_cmd = 1;
- if (run_command_v_opt(args, RUN_GIT_CMD))
+ if (run_command(&cmd))
die(_("read-tree failed"));
}
static void restore_state(const struct object_id *head,
const struct object_id *stash)
{
- struct strvec args = STRVEC_INIT;
+ struct child_process cmd = CHILD_PROCESS_INIT;
- reset_hard(head, 1);
+ reset_hard(head);
if (is_null_oid(stash))
goto refresh_cache;
- strvec_pushl(&args, "stash", "apply", "--index", "--quiet", NULL);
- strvec_push(&args, oid_to_hex(stash));
+ strvec_pushl(&cmd.args, "stash", "apply", "--index", "--quiet", NULL);
+ strvec_push(&cmd.args, oid_to_hex(stash));
/*
* It is OK to ignore error here, for example when there was
* nothing to restore.
*/
- run_command_v_opt(args.v, RUN_GIT_CMD);
- strvec_clear(&args);
+ cmd.git_cmd = 1;
+ run_command(&cmd);
refresh_cache:
- if (discard_cache() < 0 || read_cache() < 0)
+ discard_index(&the_index);
+ if (repo_read_index(the_repository) < 0)
die(_("could not read index"));
}
@@ -527,7 +526,8 @@ static void merge_name(const char *remote, struct strbuf *msg)
if (!remote_head)
die(_("'%s' does not point to a commit"), remote);
- if (dwim_ref(remote, strlen(remote), &branch_head, &found_ref, 0) > 0) {
+ if (repo_dwim_ref(the_repository, remote, strlen(remote), &branch_head,
+ &found_ref, 0) > 0) {
if (starts_with(found_ref, "refs/heads/")) {
strbuf_addf(msg, "%s\t\tbranch '%s' of .\n",
oid_to_hex(&branch_head), remote);
@@ -671,9 +671,6 @@ static int git_merge_config(const char *k, const char *v, void *cb)
status = fmt_merge_msg_config(k, v, cb);
if (status)
return status;
- status = git_gpg_config(k, v, NULL);
- if (status)
- return status;
return git_diff_ui_config(k, v, cb);
}
@@ -704,7 +701,7 @@ static int read_tree_trivial(struct object_id *common, struct object_id *head,
if (!trees[nr_trees++])
return -1;
opts.fn = threeway_merge;
- cache_tree_free(&active_cache_tree);
+ cache_tree_free(&the_index.cache_tree);
for (i = 0; i < nr_trees; i++) {
parse_tree(trees[i]);
init_tree_desc(t+i, trees[i]->buffer, trees[i]->size);
@@ -716,7 +713,7 @@ static int read_tree_trivial(struct object_id *common, struct object_id *head,
static void write_tree_trivial(struct object_id *oid)
{
- if (write_cache_as_tree(oid, 0, NULL))
+ if (write_index_as_tree(oid, &the_index, get_index_file(), 0, NULL))
die(_("git write-tree failed to write a tree"));
}
@@ -726,7 +723,9 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
{
const char *head_arg = "HEAD";
- if (refresh_and_write_cache(REFRESH_QUIET, SKIP_IF_UNCHANGED, 0) < 0)
+ if (repo_refresh_and_write_index(the_repository, REFRESH_QUIET,
+ SKIP_IF_UNCHANGED, 0, NULL, NULL,
+ NULL) < 0)
return error(_("Unable to write index."));
if (!strcmp(strategy, "recursive") || !strcmp(strategy, "subtree") ||
@@ -760,7 +759,8 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
for (j = common; j; j = j->next)
commit_list_insert(j->item, &reversed);
- hold_locked_index(&lock, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &lock,
+ LOCK_DIE_ON_ERROR);
if (!strcmp(strategy, "ort"))
clean = merge_ort_recursive(&o, head, remoteheads->item,
reversed, &result);
@@ -783,7 +783,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
}
static void count_diff_files(struct diff_queue_struct *q,
- struct diff_options *opt, void *data)
+ struct diff_options *opt UNUSED, void *data)
{
int *count = data;
@@ -794,8 +794,8 @@ static int count_unmerged_entries(void)
{
int i, ret = 0;
- for (i = 0; i < active_nr; i++)
- if (ce_stage(active_cache[i]))
+ for (i = 0; i < the_index.cache_nr; i++)
+ if (ce_stage(the_index.cache[i]))
ret++;
return ret;
@@ -869,9 +869,9 @@ static void prepare_to_commit(struct commit_list *remoteheads)
* the editor and after we invoke run_status above.
*/
if (invoked_hook)
- discard_cache();
+ discard_index(&the_index);
}
- read_cache_from(index_file);
+ read_index_from(&the_index, index_file, get_git_dir());
strbuf_addbuf(&msg, &merge_msg);
if (squash)
BUG("the control must not reach here under --squash");
@@ -920,7 +920,9 @@ static int merge_trivial(struct commit *head, struct commit_list *remoteheads)
struct object_id result_tree, result_commit;
struct commit_list *parents, **pptr = &parents;
- if (refresh_and_write_cache(REFRESH_QUIET, SKIP_IF_UNCHANGED, 0) < 0)
+ if (repo_refresh_and_write_index(the_repository, REFRESH_QUIET,
+ SKIP_IF_UNCHANGED, 0, NULL, NULL,
+ NULL) < 0)
return error(_("Unable to write index."));
write_tree_trivial(&result_tree);
@@ -1386,7 +1388,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
goto done;
}
- if (read_cache_unmerged())
+ if (repo_read_index_unmerged(the_repository))
die_resolve_conflict("merge");
if (file_exists(git_path_merge_head(the_repository))) {
@@ -1407,7 +1409,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
else
die(_("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists)."));
}
- resolve_undo_clear();
+ resolve_undo_clear_index(&the_index);
if (option_edit < 0)
option_edit = default_edit_option();
@@ -1470,7 +1472,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
check_trust_level);
remote_head_oid = &remoteheads->item->object.oid;
- read_empty(remote_head_oid, 0);
+ read_empty(remote_head_oid);
update_ref("initial pull", "HEAD", remote_head_oid, NULL, 0,
UPDATE_REFS_DIE_ON_ERR);
goto done;
@@ -1536,7 +1538,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
if (!remoteheads)
; /* already up-to-date */
else if (!remoteheads->next)
- common = get_merge_bases(head_commit, remoteheads->item);
+ common = repo_get_merge_bases(the_repository, head_commit,
+ remoteheads->item);
else {
struct commit_list *list = remoteheads;
commit_list_insert(head_commit, &list);
@@ -1565,20 +1568,18 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
!common->next &&
oideq(&common->item->object.oid, &head_commit->object.oid)) {
/* Again the most common case of merging one remote. */
- struct strbuf msg = STRBUF_INIT;
+ const char *msg = have_message ?
+ "Fast-forward (no commit created; -m option ignored)" :
+ "Fast-forward";
struct commit *commit;
if (verbosity >= 0) {
printf(_("Updating %s..%s\n"),
- find_unique_abbrev(&head_commit->object.oid,
- DEFAULT_ABBREV),
- find_unique_abbrev(&remoteheads->item->object.oid,
- DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, &head_commit->object.oid,
+ DEFAULT_ABBREV),
+ repo_find_unique_abbrev(the_repository, &remoteheads->item->object.oid,
+ DEFAULT_ABBREV));
}
- strbuf_addstr(&msg, "Fast-forward");
- if (have_message)
- strbuf_addstr(&msg,
- " (no commit created; -m option ignored)");
commit = remoteheads->item;
if (!commit) {
ret = 1;
@@ -1597,9 +1598,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
goto done;
}
- finish(head_commit, remoteheads, &commit->object.oid, msg.buf);
+ finish(head_commit, remoteheads, &commit->object.oid, msg);
remove_merge_branch_state(the_repository);
- strbuf_release(&msg);
goto done;
} else if (!remoteheads->next && common->next)
;
@@ -1612,13 +1612,14 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
* We are not doing octopus, not fast-forward, and have
* only one common.
*/
- refresh_cache(REFRESH_QUIET);
+ refresh_index(&the_index, REFRESH_QUIET, NULL, NULL, NULL);
if (allow_trivial && fast_forward != FF_ONLY) {
/*
* Must first ensure that index matches HEAD before
* attempting a trivial merge.
*/
- struct tree *head_tree = get_commit_tree(head_commit);
+ struct tree *head_tree = repo_get_commit_tree(the_repository,
+ head_commit);
struct strbuf sb = STRBUF_INIT;
if (repo_index_has_changes(the_repository, head_tree,
@@ -1626,7 +1627,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
error(_("Your local changes to the following files would be overwritten by merge:\n %s"),
sb.buf);
strbuf_release(&sb);
- return 2;
+ ret = 2;
+ goto done;
}
/* See if it is really trivial. */
@@ -1656,7 +1658,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
* merge_bases again, otherwise "git merge HEAD^
* HEAD^^" would be missed.
*/
- common_one = get_merge_bases(head_commit, j->item);
+ common_one = repo_get_merge_bases(the_repository,
+ head_commit,
+ j->item);
if (!oideq(&common_one->item->object.oid, &j->item->object.oid)) {
up_to_date = 0;
break;
@@ -1794,5 +1798,6 @@ done:
}
strbuf_release(&buf);
free(branch_to_free);
+ discard_index(&the_index);
return ret;
}
diff --git a/builtin/mktag.c b/builtin/mktag.c
index 5d22909122..44fa56eff3 100644
--- a/builtin/mktag.c
+++ b/builtin/mktag.c
@@ -1,7 +1,10 @@
#include "builtin.h"
+#include "gettext.h"
+#include "hex.h"
#include "parse-options.h"
#include "tag.h"
#include "replace-object.h"
+#include "object-file.h"
#include "object-store.h"
#include "fsck.h"
#include "config.h"
@@ -51,7 +54,8 @@ static int verify_object_in_tag(struct object_id *tagged_oid, int *tagged_type)
void *buffer;
const struct object_id *repl;
- buffer = read_object_file(tagged_oid, &type, &size);
+ buffer = repo_read_object_file(the_repository, tagged_oid, &type,
+ &size);
if (!buffer)
die(_("could not read tagged object '%s'"),
oid_to_hex(tagged_oid));
@@ -80,7 +84,7 @@ int cmd_mktag(int argc, const char **argv, const char *prefix)
int tagged_type;
struct object_id result;
- argc = parse_options(argc, argv, NULL,
+ argc = parse_options(argc, argv, prefix,
builtin_mktag_options,
builtin_mktag_usage, 0);
diff --git a/builtin/mktree.c b/builtin/mktree.c
index 06d81400f5..09a7bd5c5c 100644
--- a/builtin/mktree.c
+++ b/builtin/mktree.c
@@ -4,6 +4,9 @@
* Copyright (c) Junio C Hamano, 2006, 2009
*/
#include "builtin.h"
+#include "alloc.h"
+#include "gettext.h"
+#include "hex.h"
#include "quote.h"
#include "tree.h"
#include "parse-options.h"
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index 9a18a82b05..1b5083f8b2 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -1,6 +1,9 @@
#include "builtin.h"
+#include "abspath.h"
#include "cache.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
#include "parse-options.h"
#include "midx.h"
#include "trace2.h"
diff --git a/builtin/mv.c b/builtin/mv.c
index 3413ad1c9b..665bd27448 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -3,15 +3,23 @@
*
* Copyright (C) 2006 Johannes Schindelin
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "abspath.h"
+#include "advice.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "object-file.h"
#include "pathspec.h"
#include "lockfile.h"
#include "dir.h"
#include "cache-tree.h"
#include "string-list.h"
#include "parse-options.h"
+#include "repository.h"
+#include "setup.h"
#include "submodule.h"
#include "entry.h"
@@ -87,7 +95,7 @@ static void prepare_move_submodule(const char *src, int first,
const char **submodule_gitfile)
{
struct strbuf submodule_dotgit = STRBUF_INIT;
- if (!S_ISGITLINK(active_cache[first]->ce_mode))
+ if (!S_ISGITLINK(the_index.cache[first]->ce_mode))
die(_("Directory %s is in index and no submodule?"), src);
if (!is_staging_gitmodules_ok(&the_index))
die(_("Please stage your changes to .gitmodules or stash them to proceed"));
@@ -106,13 +114,13 @@ static int index_range_of_same_dir(const char *src, int length,
const char *src_w_slash = add_slash(src);
int first, last, len_w_slash = length + 1;
- first = cache_name_pos(src_w_slash, len_w_slash);
+ first = index_name_pos(&the_index, src_w_slash, len_w_slash);
if (first >= 0)
die(_("%.*s is in index"), len_w_slash, src_w_slash);
first = -1 - first;
- for (last = first; last < active_nr; last++) {
- const char *path = active_cache[last]->name;
+ for (last = first; last < the_index.cache_nr; last++) {
+ const char *path = the_index.cache[last]->name;
if (strncmp(path, src_w_slash, len_w_slash))
break;
}
@@ -136,14 +144,14 @@ static int empty_dir_has_sparse_contents(const char *name)
const char *with_slash = add_slash(name);
int length = strlen(with_slash);
- int pos = cache_name_pos(with_slash, length);
+ int pos = index_name_pos(&the_index, with_slash, length);
const struct cache_entry *ce;
if (pos < 0) {
pos = -pos - 1;
if (pos >= the_index.cache_nr)
goto free_return;
- ce = active_cache[pos];
+ ce = the_index.cache[pos];
if (strncmp(with_slash, ce->name, length))
goto free_return;
if (ce_skip_worktree(ce))
@@ -189,8 +197,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
if (--argc < 1)
usage_with_options(builtin_mv_usage, builtin_mv_options);
- hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
- if (read_cache() < 0)
+ repo_hold_locked_index(the_repository, &lock_file, LOCK_DIE_ON_ERROR);
+ if (repo_read_index(the_repository) < 0)
die(_("index file corrupt"));
source = internal_prefix_pathspec(prefix, argv, argc, 0);
@@ -255,7 +263,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
int pos;
const struct cache_entry *ce;
- pos = cache_name_pos(src, length);
+ pos = index_name_pos(&the_index, src, length);
if (pos < 0) {
const char *src_w_slash = add_slash(src);
if (!path_in_sparse_checkout(src_w_slash, &the_index) &&
@@ -268,7 +276,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
bad = _("bad source");
goto act_on_entry;
}
- ce = active_cache[pos];
+ ce = the_index.cache[pos];
if (!ce_skip_worktree(ce)) {
bad = _("bad source");
goto act_on_entry;
@@ -278,7 +286,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
goto act_on_entry;
}
/* Check if dst exists in index */
- if (cache_name_pos(dst, strlen(dst)) < 0) {
+ if (index_name_pos(&the_index, dst, strlen(dst)) < 0) {
modes[i] |= SPARSE;
goto act_on_entry;
}
@@ -303,7 +311,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
dir_check:
if (S_ISDIR(st.st_mode)) {
int j, dst_len, n;
- int first = cache_name_pos(src, length), last;
+ int first = index_name_pos(&the_index, src, length), last;
if (first >= 0) {
prepare_move_submodule(src, first,
@@ -331,7 +339,7 @@ dir_check:
dst_len = strlen(dst);
for (j = 0; j < last - first; j++) {
- const struct cache_entry *ce = active_cache[first + j];
+ const struct cache_entry *ce = the_index.cache[first + j];
const char *path = ce->name;
source[argc + j] = path;
destination[argc + j] =
@@ -343,7 +351,7 @@ dir_check:
argc += last - first;
goto act_on_entry;
}
- if (!(ce = cache_file_exists(src, length, 0))) {
+ if (!(ce = index_file_exists(&the_index, src, length, 0))) {
bad = _("not under version control");
goto act_on_entry;
}
@@ -468,11 +476,14 @@ remove_entry:
if (mode & (WORKING_DIRECTORY | SKIP_WORKTREE_DIR))
continue;
- pos = cache_name_pos(src, strlen(src));
+ pos = index_name_pos(&the_index, src, strlen(src));
assert(pos >= 0);
if (!(mode & SPARSE) && !lstat(src, &st))
- sparse_and_dirty = ce_modified(active_cache[pos], &st, 0);
- rename_cache_entry_at(pos, dst);
+ sparse_and_dirty = ie_modified(&the_index,
+ the_index.cache[pos],
+ &st,
+ 0);
+ rename_index_entry_at(&the_index, pos, dst);
if (ignore_sparse &&
core_apply_sparse_checkout &&
@@ -486,8 +497,9 @@ remove_entry:
if ((mode & SPARSE) &&
path_in_sparse_checkout(dst, &the_index)) {
/* from out-of-cone to in-cone */
- int dst_pos = cache_name_pos(dst, strlen(dst));
- struct cache_entry *dst_ce = active_cache[dst_pos];
+ int dst_pos = index_name_pos(&the_index, dst,
+ strlen(dst));
+ struct cache_entry *dst_ce = the_index.cache[dst_pos];
dst_ce->ce_flags &= ~CE_SKIP_WORKTREE;
@@ -497,8 +509,9 @@ remove_entry:
!(mode & SPARSE) &&
!path_in_sparse_checkout(dst, &the_index)) {
/* from in-cone to out-of-cone */
- int dst_pos = cache_name_pos(dst, strlen(dst));
- struct cache_entry *dst_ce = active_cache[dst_pos];
+ int dst_pos = index_name_pos(&the_index, dst,
+ strlen(dst));
+ struct cache_entry *dst_ce = the_index.cache[dst_pos];
/*
* if src is clean, it will suffice to remove it
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index 15535e914a..593f0506a1 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -1,10 +1,15 @@
#include "builtin.h"
-#include "cache.h"
+#include "alloc.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "config.h"
#include "commit.h"
#include "tag.h"
#include "refs.h"
+#include "object-name.h"
+#include "pager.h"
#include "parse-options.h"
#include "prio-queue.h"
#include "hash-lookup.h"
@@ -108,19 +113,11 @@ static int is_better_name(struct rev_name *name,
int name_distance = effective_distance(name->distance, name->generation);
int new_distance = effective_distance(distance, generation);
- /*
- * When comparing names based on tags, prefer names
- * based on the older tag, even if it is farther away.
- */
+ /* If both are tags, we prefer the nearer one. */
if (from_tag && name->from_tag)
- return (name->taggerdate > taggerdate ||
- (name->taggerdate == taggerdate &&
- name_distance > new_distance));
+ return name_distance > new_distance;
- /*
- * We know that at least one of them is a non-tag at this point.
- * favor a tag over a non-tag.
- */
+ /* Favor a tag over a non-tag. */
if (name->from_tag != from_tag)
return from_tag;
@@ -189,7 +186,7 @@ static void name_rev(struct commit *start_commit,
size_t parents_to_queue_nr, parents_to_queue_alloc = 0;
struct rev_name *start_name;
- parse_commit(start_commit);
+ repo_parse_commit(the_repository, start_commit);
if (commit_is_before_cutoff(start_commit))
return;
@@ -219,7 +216,7 @@ static void name_rev(struct commit *start_commit,
struct rev_name *parent_name;
int generation, distance;
- parse_commit(parent);
+ repo_parse_commit(the_repository, parent);
if (commit_is_before_cutoff(parent))
continue;
@@ -273,17 +270,6 @@ static int subpath_matches(const char *path, const char *filter)
return -1;
}
-static const char *name_ref_abbrev(const char *refname, int shorten_unambiguous)
-{
- if (shorten_unambiguous)
- refname = shorten_unambiguous_ref(refname, 0);
- else if (skip_prefix(refname, "refs/heads/", &refname))
- ; /* refname already advanced */
- else
- skip_prefix(refname, "refs/", &refname);
- return refname;
-}
-
struct name_ref_data {
int tags_only;
int name_only;
@@ -309,11 +295,19 @@ static void add_to_tip_table(const struct object_id *oid, const char *refname,
int shorten_unambiguous, struct commit *commit,
timestamp_t taggerdate, int from_tag, int deref)
{
- refname = name_ref_abbrev(refname, shorten_unambiguous);
+ char *short_refname = NULL;
+
+ if (shorten_unambiguous)
+ short_refname = shorten_unambiguous_ref(refname, 0);
+ else if (skip_prefix(refname, "refs/heads/", &refname))
+ ; /* refname already advanced */
+ else
+ skip_prefix(refname, "refs/", &refname);
ALLOC_GROW(tip_table.table, tip_table.nr + 1, tip_table.alloc);
oidcpy(&tip_table.table[tip_table.nr].oid, oid);
- tip_table.table[tip_table.nr].refname = xstrdup(refname);
+ tip_table.table[tip_table.nr].refname = short_refname ?
+ short_refname : xstrdup(refname);
tip_table.table[tip_table.nr].commit = commit;
tip_table.table[tip_table.nr].taggerdate = taggerdate;
tip_table.table[tip_table.nr].from_tag = from_tag;
@@ -504,7 +498,8 @@ static void show_name(const struct object *obj,
else if (allow_undefined)
printf("undefined\n");
else if (always)
- printf("%s\n", find_unique_abbrev(oid, DEFAULT_ABBREV));
+ printf("%s\n",
+ repo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV));
else
die("cannot describe '%s'", oid_to_hex(oid));
strbuf_release(&buf);
@@ -538,7 +533,7 @@ static void name_rev_line(char *p, struct name_ref_data *data)
counter = 0;
*(p+1) = 0;
- if (!get_oid(p - (hexsz - 1), &oid)) {
+ if (!repo_get_oid(the_repository, p - (hexsz - 1), &oid)) {
struct object *o =
lookup_object(the_repository, &oid);
if (o)
@@ -615,7 +610,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
struct object *object;
struct commit *commit;
- if (get_oid(*argv, &oid)) {
+ if (repo_get_oid(the_repository, *argv, &oid)) {
fprintf(stderr, "Could not get sha1 for %s. Skipping.\n",
*argv);
continue;
diff --git a/builtin/notes.c b/builtin/notes.c
index be51f69225..d5788352b6 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -10,7 +10,11 @@
#include "cache.h"
#include "config.h"
#include "builtin.h"
+#include "editor.h"
+#include "gettext.h"
+#include "hex.h"
#include "notes.h"
+#include "object-name.h"
#include "object-store.h"
#include "repository.h"
#include "blob.h"
@@ -23,6 +27,7 @@
#include "notes-merge.h"
#include "notes-utils.h"
#include "worktree.h"
+#include "write-or-die.h"
static const char * const git_notes_usage[] = {
N_("git notes [--ref <notes-ref>] [list [<object>]]"),
@@ -113,8 +118,9 @@ static void free_note_data(struct note_data *d)
}
static int list_each_note(const struct object_id *object_oid,
- const struct object_id *note_oid, char *note_path,
- void *cb_data)
+ const struct object_id *note_oid,
+ char *note_path UNUSED,
+ void *cb_data UNUSED)
{
printf("%s %s\n", oid_to_hex(note_oid), oid_to_hex(object_oid));
return 0;
@@ -124,7 +130,7 @@ static void copy_obj_to_fd(int fd, const struct object_id *oid)
{
unsigned long size;
enum object_type type;
- char *buf = read_object_file(oid, &type, &size);
+ char *buf = repo_read_object_file(the_repository, oid, &type, &size);
if (buf) {
if (size)
write_or_die(fd, buf, size);
@@ -181,7 +187,7 @@ static void prepare_note_data(const struct object_id *object, struct note_data *
strbuf_addch(&buf, '\n');
strbuf_add_commented_lines(&buf, "\n", strlen("\n"));
strbuf_add_commented_lines(&buf, _(note_template), strlen(_(note_template)));
- strbuf_addch(&buf, '\n');
+ strbuf_add_commented_lines(&buf, "\n", strlen("\n"));
write_or_die(fd, buf.buf, buf.len);
write_commented_object(fd, object);
@@ -257,9 +263,9 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)
if (d->buf.len)
strbuf_addch(&d->buf, '\n');
- if (get_oid(arg, &object))
+ if (repo_get_oid(the_repository, arg, &object))
die(_("failed to resolve '%s' as a valid ref."), arg);
- if (!(buf = read_object_file(&object, &type, &len)))
+ if (!(buf = repo_read_object_file(the_repository, &object, &type, &len)))
die(_("failed to read object '%s'."), arg);
if (type != OBJ_BLOB) {
free(buf);
@@ -307,9 +313,9 @@ static int notes_copy_from_stdin(int force, const char *rewrite_cmd)
die(_("malformed input line: '%s'."), buf.buf);
strbuf_rtrim(split[0]);
strbuf_rtrim(split[1]);
- if (get_oid(split[0]->buf, &from_obj))
+ if (repo_get_oid(the_repository, split[0]->buf, &from_obj))
die(_("failed to resolve '%s' as a valid ref."), split[0]->buf);
- if (get_oid(split[1]->buf, &to_obj))
+ if (repo_get_oid(the_repository, split[1]->buf, &to_obj))
die(_("failed to resolve '%s' as a valid ref."), split[1]->buf);
if (rewrite_cmd)
@@ -377,7 +383,7 @@ static int list(int argc, const char **argv, const char *prefix)
t = init_notes_check("list", 0);
if (argc) {
- if (get_oid(argv[0], &object))
+ if (repo_get_oid(the_repository, argv[0], &object))
die(_("failed to resolve '%s' as a valid ref."), argv[0]);
note = get_note(t, &object);
if (note) {
@@ -432,7 +438,7 @@ static int add(int argc, const char **argv, const char *prefix)
object_ref = argc > 1 ? argv[1] : "HEAD";
- if (get_oid(object_ref, &object))
+ if (repo_get_oid(the_repository, object_ref, &object))
die(_("failed to resolve '%s' as a valid ref."), object_ref);
t = init_notes_check("add", NOTES_INIT_WRITABLE);
@@ -520,12 +526,12 @@ static int copy(int argc, const char **argv, const char *prefix)
usage_with_options(git_notes_copy_usage, options);
}
- if (get_oid(argv[0], &from_obj))
+ if (repo_get_oid(the_repository, argv[0], &from_obj))
die(_("failed to resolve '%s' as a valid ref."), argv[0]);
object_ref = 1 < argc ? argv[1] : "HEAD";
- if (get_oid(object_ref, &object))
+ if (repo_get_oid(the_repository, object_ref, &object))
die(_("failed to resolve '%s' as a valid ref."), object_ref);
t = init_notes_check("copy", NOTES_INIT_WRITABLE);
@@ -604,7 +610,7 @@ static int append_edit(int argc, const char **argv, const char *prefix)
object_ref = 1 < argc ? argv[1] : "HEAD";
- if (get_oid(object_ref, &object))
+ if (repo_get_oid(the_repository, object_ref, &object))
die(_("failed to resolve '%s' as a valid ref."), object_ref);
t = init_notes_check(argv[0], NOTES_INIT_WRITABLE);
@@ -616,7 +622,8 @@ static int append_edit(int argc, const char **argv, const char *prefix)
/* Append buf to previous note contents */
unsigned long size;
enum object_type type;
- char *prev_buf = read_object_file(note, &type, &size);
+ char *prev_buf = repo_read_object_file(the_repository, note,
+ &type, &size);
strbuf_grow(&d.buf, size + 1);
if (d.buf.len && prev_buf && size)
@@ -666,7 +673,7 @@ static int show(int argc, const char **argv, const char *prefix)
object_ref = argc ? argv[0] : "HEAD";
- if (get_oid(object_ref, &object))
+ if (repo_get_oid(the_repository, object_ref, &object))
die(_("failed to resolve '%s' as a valid ref."), object_ref);
t = init_notes_check("show", 0);
@@ -716,11 +723,11 @@ static int merge_commit(struct notes_merge_options *o)
* and target notes ref from .git/NOTES_MERGE_REF.
*/
- if (get_oid("NOTES_MERGE_PARTIAL", &oid))
+ if (repo_get_oid(the_repository, "NOTES_MERGE_PARTIAL", &oid))
die(_("failed to read ref NOTES_MERGE_PARTIAL"));
else if (!(partial = lookup_commit_reference(the_repository, &oid)))
die(_("could not find commit from NOTES_MERGE_PARTIAL."));
- else if (parse_commit(partial))
+ else if (repo_parse_commit(the_repository, partial))
die(_("could not parse commit from NOTES_MERGE_PARTIAL."));
if (partial->parents)
@@ -741,7 +748,8 @@ static int merge_commit(struct notes_merge_options *o)
/* Reuse existing commit message in reflog message */
memset(&pretty_ctx, 0, sizeof(pretty_ctx));
- format_commit_message(partial, "%s", &msg, &pretty_ctx);
+ repo_format_commit_message(the_repository, partial, "%s", &msg,
+ &pretty_ctx);
strbuf_trim(&msg);
strbuf_insertstr(&msg, 0, "notes: ");
update_ref(msg.buf, o->local_ref, &oid,
@@ -895,7 +903,7 @@ static int remove_one_note(struct notes_tree *t, const char *name, unsigned flag
{
int status;
struct object_id oid;
- if (get_oid(name, &oid))
+ if (repo_get_oid(the_repository, name, &oid))
return error(_("Failed to resolve '%s' as a valid ref."), name);
status = remove_note(t, oid.hash);
if (status)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 3658c05caf..a5b466839b 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1,5 +1,8 @@
#include "builtin.h"
-#include "cache.h"
+#include "alloc.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "config.h"
#include "attr.h"
@@ -30,13 +33,17 @@
#include "strvec.h"
#include "list.h"
#include "packfile.h"
+#include "object-file.h"
#include "object-store.h"
+#include "replace-object.h"
#include "dir.h"
#include "midx.h"
#include "trace2.h"
#include "shallow.h"
#include "promisor-remote.h"
#include "pack-mtimes.h"
+#include "parse-options.h"
+#include "wrapper.h"
/*
* Objects we are going to pack are collected in the `to_pack` structure.
@@ -180,8 +187,8 @@ static inline void oe_set_delta_size(struct packing_data *pack,
#define SET_DELTA_SIBLING(obj, val) oe_set_delta_sibling(&to_pack, obj, val)
static const char *pack_usage[] = {
- N_("git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"),
- N_("git pack-objects [<options>...] <base-name> [< <ref-list> | < <object-list>]"),
+ N_("git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"),
+ N_("git pack-objects [<options>] <base-name> [< <ref-list> | < <object-list>]"),
NULL
};
@@ -288,11 +295,13 @@ static void *get_delta(struct object_entry *entry)
void *buf, *base_buf, *delta_buf;
enum object_type type;
- buf = read_object_file(&entry->idx.oid, &type, &size);
+ buf = repo_read_object_file(the_repository, &entry->idx.oid, &type,
+ &size);
if (!buf)
die(_("unable to read %s"), oid_to_hex(&entry->idx.oid));
- base_buf = read_object_file(&DELTA(entry)->idx.oid, &type,
- &base_size);
+ base_buf = repo_read_object_file(the_repository,
+ &DELTA(entry)->idx.oid, &type,
+ &base_size);
if (!base_buf)
die("unable to read %s",
oid_to_hex(&DELTA(entry)->idx.oid));
@@ -454,7 +463,9 @@ static unsigned long write_no_reuse_object(struct hashfile *f, struct object_ent
&size, NULL)) != NULL)
buf = NULL;
else {
- buf = read_object_file(&entry->idx.oid, &type, &size);
+ buf = repo_read_object_file(the_repository,
+ &entry->idx.oid, &type,
+ &size);
if (!buf)
die(_("unable to read %s"),
oid_to_hex(&entry->idx.oid));
@@ -929,8 +940,10 @@ static struct object_entry **compute_write_order(void)
*/
for_each_tag_ref(mark_tagged, NULL);
- if (use_delta_islands)
+ if (use_delta_islands) {
max_layers = compute_pack_layers(&to_pack);
+ free_island_marks();
+ }
ALLOC_ARRAY(wo, to_pack.nr_objects);
wo_end = 0;
@@ -1318,7 +1331,7 @@ static int no_try_delta(const char *path)
if (!check)
check = attr_check_initl("delta", NULL);
- git_check_attr(the_repository->index, path, check);
+ git_check_attr(the_repository->index, NULL, path, check);
if (ATTR_FALSE(check->items[0].value))
return 1;
return 0;
@@ -1588,7 +1601,7 @@ static int add_object_entry(const struct object_id *oid, enum object_type type,
static int add_object_entry_from_bitmap(const struct object_id *oid,
enum object_type type,
- int flags, uint32_t name_hash,
+ int flags UNUSED, uint32_t name_hash,
struct packed_git *pack, off_t offset)
{
display_progress(progress_state, ++nr_seen);
@@ -1663,7 +1676,7 @@ static struct pbase_tree_cache *pbase_tree_get(const struct object_id *oid)
/* Did not find one. Either we got a bogus request or
* we need to read and perhaps cache.
*/
- data = read_object_file(oid, &type, &size);
+ data = repo_read_object_file(the_repository, oid, &type, &size);
if (!data)
return NULL;
if (type != OBJ_TREE) {
@@ -1708,17 +1721,14 @@ static void pbase_tree_put(struct pbase_tree_cache *cache)
free(cache);
}
-static int name_cmp_len(const char *name)
+static size_t name_cmp_len(const char *name)
{
- int i;
- for (i = 0; name[i] && name[i] != '\n' && name[i] != '/'; i++)
- ;
- return i;
+ return strcspn(name, "\n/");
}
static void add_pbase_object(struct tree_desc *tree,
const char *name,
- int cmplen,
+ size_t cmplen,
const char *fullname)
{
struct name_entry entry;
@@ -1743,7 +1753,7 @@ static void add_pbase_object(struct tree_desc *tree,
struct tree_desc sub;
struct pbase_tree_cache *tree;
const char *down = name+cmplen+1;
- int downlen = name_cmp_len(down);
+ size_t downlen = name_cmp_len(down);
tree = pbase_tree_get(&entry.oid);
if (!tree)
@@ -1795,7 +1805,7 @@ static int check_pbase_path(unsigned hash)
static void add_preferred_base_object(const char *name)
{
struct pbase_tree *it;
- int cmplen;
+ size_t cmplen;
unsigned hash = pack_name_hash(name);
if (!num_preferred_base || check_pbase_path(hash))
@@ -2075,7 +2085,7 @@ static void check_object(struct object_entry *entry, uint32_t object_index)
if (oid_object_info_extended(the_repository, &entry->idx.oid, &oi,
OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_LOOKUP_REPLACE) < 0) {
- if (has_promisor_remote()) {
+ if (repo_has_promisor_remote(the_repository)) {
prefetch_to_pack(object_index);
if (oid_object_info_extended(the_repository, &entry->idx.oid, &oi,
OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_LOOKUP_REPLACE) < 0)
@@ -2526,7 +2536,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
/* Load data if not already done */
if (!trg->data) {
packing_data_lock(&to_pack);
- trg->data = read_object_file(&trg_entry->idx.oid, &type, &sz);
+ trg->data = repo_read_object_file(the_repository,
+ &trg_entry->idx.oid, &type,
+ &sz);
packing_data_unlock(&to_pack);
if (!trg->data)
die(_("object %s cannot be read"),
@@ -2539,7 +2551,9 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
}
if (!src->data) {
packing_data_lock(&to_pack);
- src->data = read_object_file(&src_entry->idx.oid, &type, &sz);
+ src->data = repo_read_object_file(the_repository,
+ &src_entry->idx.oid, &type,
+ &sz);
packing_data_unlock(&to_pack);
if (!src->data) {
if (src_entry->preferred_base) {
@@ -3261,13 +3275,14 @@ static int add_object_entry_from_pack(const struct object_id *oid,
return 0;
}
-static void show_commit_pack_hint(struct commit *commit, void *_data)
+static void show_commit_pack_hint(struct commit *commit UNUSED,
+ void *data UNUSED)
{
/* nothing to do; commits don't have a namehash */
}
static void show_object_pack_hint(struct object *object, const char *name,
- void *_data)
+ void *data UNUSED)
{
struct object_entry *oe = packlist_find(&to_pack, &object->oid);
if (!oe)
@@ -3345,16 +3360,16 @@ static void read_packs_list_from_stdin(void)
}
string_list_sort(&include_packs);
+ string_list_remove_duplicates(&include_packs, 0);
string_list_sort(&exclude_packs);
+ string_list_remove_duplicates(&exclude_packs, 0);
for (p = get_all_packs(the_repository); p; p = p->next) {
const char *pack_name = pack_basename(p);
- item = string_list_lookup(&include_packs, pack_name);
- if (!item)
- item = string_list_lookup(&exclude_packs, pack_name);
-
- if (item)
+ if ((item = string_list_lookup(&include_packs, pack_name)))
+ item->util = p;
+ if ((item = string_list_lookup(&exclude_packs, pack_name)))
item->util = p;
}
@@ -3465,7 +3480,7 @@ static void add_cruft_object_entry(const struct object_id *oid, enum object_type
return;
}
-static void show_cruft_object(struct object *obj, const char *name, void *data)
+static void show_cruft_object(struct object *obj, const char *name, void *data UNUSED)
{
/*
* if we did not record it earlier, it's at least as old as our
@@ -3485,7 +3500,7 @@ static void show_cruft_commit(struct commit *commit, void *data)
show_cruft_object((struct object*)commit, NULL, data);
}
-static int cruft_include_check_obj(struct object *obj, 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);
}
@@ -3664,7 +3679,7 @@ static void read_object_list_from_stdin(void)
}
}
-static void show_commit(struct commit *commit, void *data)
+static void show_commit(struct commit *commit, void *data UNUSED)
{
add_object_entry(&commit->object.oid, OBJ_COMMIT, NULL, 0);
@@ -3675,7 +3690,8 @@ static void show_commit(struct commit *commit, void *data)
propagate_island_marks(commit);
}
-static void show_object(struct object *obj, const char *name, void *data)
+static void show_object(struct object *obj, const char *name,
+ void *data UNUSED)
{
add_preferred_base_object(name);
add_object_entry(&obj->oid, obj->type, name, 0);
@@ -3762,7 +3778,7 @@ static void show_edge(struct commit *commit)
static int add_object_in_unpacked_pack(const struct object_id *oid,
struct packed_git *pack,
uint32_t pos,
- void *_data)
+ void *data UNUSED)
{
if (cruft) {
off_t offset;
@@ -3796,7 +3812,7 @@ static void add_objects_in_unpacked_packs(void)
}
static int add_loose_object(const struct object_id *oid, const char *path,
- void *data)
+ void *data UNUSED)
{
enum object_type type = oid_object_info(the_repository, oid, NULL);
@@ -3947,13 +3963,13 @@ static int get_object_list_from_bitmap(struct rev_info *revs)
}
static void record_recent_object(struct object *obj,
- const char *name,
- void *data)
+ const char *name UNUSED,
+ void *data UNUSED)
{
oid_array_append(&recent_objects, &obj->oid);
}
-static void record_recent_commit(struct commit *commit, void *data)
+static void record_recent_commit(struct commit *commit, void *data UNUSED)
{
oid_array_append(&recent_objects, &commit->object.oid);
}
@@ -4149,21 +4165,6 @@ static int option_parse_cruft_expiration(const struct option *opt,
return 0;
}
-struct po_filter_data {
- unsigned have_revs:1;
- struct rev_info revs;
-};
-
-static struct list_objects_filter_options *po_filter_revs_init(void *value)
-{
- struct po_filter_data *data = value;
-
- repo_init_revisions(the_repository, &data->revs, NULL);
- data->have_revs = 1;
-
- return &data->revs.filter;
-}
-
int cmd_pack_objects(int argc, const char **argv, const char *prefix)
{
int use_internal_rev_list = 0;
@@ -4174,7 +4175,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
int rev_list_index = 0;
int stdin_packs = 0;
struct string_list keep_pack_list = STRING_LIST_INIT_NODUP;
- struct po_filter_data pfd = { .have_revs = 0 };
+ struct list_objects_filter_options filter_options =
+ LIST_OBJECTS_FILTER_INIT;
struct option pack_objects_options[] = {
OPT_SET_INT('q', "quiet", &progress,
@@ -4265,7 +4267,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
&write_bitmap_index,
N_("write a bitmap index if possible"),
WRITE_BITMAP_QUIET, PARSE_OPT_HIDDEN),
- OPT_PARSE_LIST_OBJECTS_FILTER_INIT(&pfd, po_filter_revs_init),
+ OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options),
OPT_CALLBACK_F(0, "missing", NULL, N_("action"),
N_("handling for missing objects"), PARSE_OPT_NONEG,
option_parse_missing_action),
@@ -4292,9 +4294,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
}
reset_pack_idx_option(&pack_idx_opts);
+ pack_idx_opts.flags |= WRITE_REV;
git_config(git_pack_config, NULL);
- if (git_env_bool(GIT_TEST_WRITE_REV_INDEX, 0))
- pack_idx_opts.flags |= WRITE_REV;
+ if (git_env_bool(GIT_TEST_NO_WRITE_REV_INDEX, 0))
+ pack_idx_opts.flags &= ~WRITE_REV;
progress = isatty(2);
argc = parse_options(argc, argv, prefix, pack_objects_options,
@@ -4385,7 +4388,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
if (!rev_list_all || !rev_list_reflog || !rev_list_index)
unpack_unreachable_expiration = 0;
- if (pfd.have_revs && pfd.revs.filter.choice) {
+ if (filter_options.choice) {
if (!pack_to_stdout)
die(_("cannot use --filter without --stdout"));
if (stdin_packs)
@@ -4472,13 +4475,11 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
read_cruft_objects();
} else if (!use_internal_rev_list) {
read_object_list_from_stdin();
- } else if (pfd.have_revs) {
- get_object_list(&pfd.revs, rp.nr, rp.v);
- release_revisions(&pfd.revs);
} else {
struct rev_info revs;
repo_init_revisions(the_repository, &revs, NULL);
+ list_objects_filter_copy(&revs.filter, &filter_options);
get_object_list(&revs, rp.nr, rp.v);
release_revisions(&revs);
}
@@ -4513,6 +4514,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
reuse_packfile_objects);
cleanup:
+ list_objects_filter_release(&filter_options);
strvec_clear(&rp);
return 0;
diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c
index ed9b9013a5..43e9d12dfd 100644
--- a/builtin/pack-redundant.c
+++ b/builtin/pack-redundant.c
@@ -7,6 +7,8 @@
*/
#include "builtin.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "packfile.h"
#include "object-store.h"
@@ -14,7 +16,7 @@
#define BLKSIZE 512
static const char pack_redundant_usage[] =
-"git pack-redundant [--verbose] [--alt-odb] (--all | <filename.pack>...)";
+"git pack-redundant [--verbose] [--alt-odb] (--all | <pack-filename>...)";
static int load_all_packs, verbose, alt_odb;
@@ -557,7 +559,7 @@ static void load_all(void)
}
}
-int cmd_pack_redundant(int argc, const char **argv, const char *prefix)
+int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED)
{
int i;
int i_still_use_this = 0;
@@ -603,6 +605,7 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix)
"option, '--i-still-use-this', on the command line\n"
"and let us know you still use it by sending an e-mail\n"
"to <git@vger.kernel.org>. Thanks.\n"), stderr);
+ die(_("refusing to run without --i-still-use-this"));
}
if (load_all_packs)
diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c
index cfbd5c36c7..9833815fb3 100644
--- a/builtin/pack-refs.c
+++ b/builtin/pack-refs.c
@@ -1,11 +1,12 @@
#include "builtin.h"
#include "config.h"
+#include "gettext.h"
#include "parse-options.h"
#include "refs.h"
#include "repository.h"
static char const * const pack_refs_usage[] = {
- N_("git pack-refs [<options>]"),
+ N_("git pack-refs [--all] [--no-prune]"),
NULL
};
diff --git a/builtin/patch-id.c b/builtin/patch-id.c
index 881fcf3273..9d5585d3a7 100644
--- a/builtin/patch-id.c
+++ b/builtin/patch-id.c
@@ -2,6 +2,9 @@
#include "builtin.h"
#include "config.h"
#include "diff.h"
+#include "gettext.h"
+#include "hex.h"
+#include "parse-options.h"
static void flush_current_id(int patchlen, struct object_id *id, struct object_id *result)
{
@@ -57,10 +60,12 @@ static int scan_hunk_header(const char *p, int *p_before, int *p_after)
}
static int get_one_patchid(struct object_id *next_oid, struct object_id *result,
- struct strbuf *line_buf, int stable)
+ struct strbuf *line_buf, int stable, int verbatim)
{
int patchlen = 0, found_next = 0;
int before = -1, after = -1;
+ int diff_is_binary = 0;
+ char pre_oid_str[GIT_MAX_HEXSZ + 1], post_oid_str[GIT_MAX_HEXSZ + 1];
git_hash_ctx ctx;
the_hash_algo->init_fn(&ctx);
@@ -71,11 +76,14 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result,
const char *p = line;
int len;
- if (!skip_prefix(line, "diff-tree ", &p) &&
- !skip_prefix(line, "commit ", &p) &&
+ /* Possibly skip over the prefix added by "log" or "format-patch" */
+ if (!skip_prefix(line, "commit ", &p) &&
!skip_prefix(line, "From ", &p) &&
- starts_with(line, "\\ ") && 12 < strlen(line))
+ starts_with(line, "\\ ") && 12 < strlen(line)) {
+ if (verbatim)
+ the_hash_algo->update_fn(&ctx, line, strlen(line));
continue;
+ }
if (!get_oid_hex(p, next_oid)) {
found_next = 1;
@@ -88,14 +96,44 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result,
/* Parsing diff header? */
if (before == -1) {
- if (starts_with(line, "index "))
+ if (starts_with(line, "GIT binary patch") ||
+ starts_with(line, "Binary files")) {
+ diff_is_binary = 1;
+ before = 0;
+ the_hash_algo->update_fn(&ctx, pre_oid_str,
+ strlen(pre_oid_str));
+ the_hash_algo->update_fn(&ctx, post_oid_str,
+ strlen(post_oid_str));
+ if (stable)
+ flush_one_hunk(result, &ctx);
+ continue;
+ } else if (skip_prefix(line, "index ", &p)) {
+ char *oid1_end = strstr(line, "..");
+ char *oid2_end = NULL;
+ if (oid1_end)
+ oid2_end = strstr(oid1_end, " ");
+ if (!oid2_end)
+ oid2_end = line + strlen(line) - 1;
+ if (oid1_end != NULL && oid2_end != NULL) {
+ *oid1_end = *oid2_end = '\0';
+ strlcpy(pre_oid_str, p, GIT_MAX_HEXSZ + 1);
+ strlcpy(post_oid_str, oid1_end + 2, GIT_MAX_HEXSZ + 1);
+ }
continue;
- else if (starts_with(line, "--- "))
+ } else if (starts_with(line, "--- "))
before = after = 1;
else if (!isalpha(line[0]))
break;
}
+ if (diff_is_binary) {
+ if (starts_with(line, "diff ")) {
+ diff_is_binary = 0;
+ before = -1;
+ }
+ continue;
+ }
+
/* Looking for a valid hunk header? */
if (before == 0 && after == 0) {
if (starts_with(line, "@@ -")) {
@@ -120,8 +158,8 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result,
if (line[0] == '+' || line[0] == ' ')
after--;
- /* Compute the sha without whitespace */
- len = remove_space(line);
+ /* Add line to hash algo (possibly removing whitespace) */
+ len = verbatim ? strlen(line) : remove_space(line);
patchlen += len;
the_hash_algo->update_fn(&ctx, line, len);
}
@@ -134,7 +172,7 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result,
return patchlen;
}
-static void generate_id_list(int stable)
+static void generate_id_list(int stable, int verbatim)
{
struct object_id oid, n, result;
int patchlen;
@@ -142,21 +180,32 @@ static void generate_id_list(int stable)
oidclr(&oid);
while (!feof(stdin)) {
- patchlen = get_one_patchid(&n, &result, &line_buf, stable);
+ patchlen = get_one_patchid(&n, &result, &line_buf, stable, verbatim);
flush_current_id(patchlen, &oid, &result);
oidcpy(&oid, &n);
}
strbuf_release(&line_buf);
}
-static const char patch_id_usage[] = "git patch-id [--stable | --unstable]";
+static const char *const patch_id_usage[] = {
+ N_("git patch-id [--stable | --unstable | --verbatim]"), NULL
+};
+
+struct patch_id_opts {
+ int stable;
+ int verbatim;
+};
static int git_patch_id_config(const char *var, const char *value, void *cb)
{
- int *stable = cb;
+ struct patch_id_opts *opts = cb;
if (!strcmp(var, "patchid.stable")) {
- *stable = git_config_bool(var, value);
+ opts->stable = git_config_bool(var, value);
+ return 0;
+ }
+ if (!strcmp(var, "patchid.verbatim")) {
+ opts->verbatim = git_config_bool(var, value);
return 0;
}
@@ -165,21 +214,29 @@ static int git_patch_id_config(const char *var, const char *value, void *cb)
int cmd_patch_id(int argc, const char **argv, const char *prefix)
{
- int stable = -1;
-
- git_config(git_patch_id_config, &stable);
-
- /* If nothing is set, default to unstable. */
- if (stable < 0)
- stable = 0;
-
- if (argc == 2 && !strcmp(argv[1], "--stable"))
- stable = 1;
- else if (argc == 2 && !strcmp(argv[1], "--unstable"))
- stable = 0;
- else if (argc != 1)
- usage(patch_id_usage);
-
- generate_id_list(stable);
+ /* if nothing is set, default to unstable */
+ struct patch_id_opts config = {0, 0};
+ int opts = 0;
+ struct option builtin_patch_id_options[] = {
+ OPT_CMDMODE(0, "unstable", &opts,
+ N_("use the unstable patch-id algorithm"), 1),
+ OPT_CMDMODE(0, "stable", &opts,
+ N_("use the stable patch-id algorithm"), 2),
+ OPT_CMDMODE(0, "verbatim", &opts,
+ N_("don't strip whitespace from the patch"), 3),
+ OPT_END()
+ };
+
+ git_config(git_patch_id_config, &config);
+
+ /* verbatim implies stable */
+ if (config.verbatim)
+ config.stable = 1;
+
+ argc = parse_options(argc, argv, prefix, builtin_patch_id_options,
+ patch_id_usage, 0);
+
+ generate_id_list(opts ? opts > 1 : config.stable,
+ opts ? opts == 3 : config.verbatim);
return 0;
}
diff --git a/builtin/prune-packed.c b/builtin/prune-packed.c
index da3273a268..ca3578e158 100644
--- a/builtin/prune-packed.c
+++ b/builtin/prune-packed.c
@@ -1,4 +1,5 @@
#include "builtin.h"
+#include "gettext.h"
#include "parse-options.h"
#include "prune-packed.h"
diff --git a/builtin/prune.c b/builtin/prune.c
index df376b2ed1..5dc9b20720 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -1,12 +1,18 @@
#include "cache.h"
#include "commit.h"
#include "diff.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "revision.h"
#include "builtin.h"
#include "reachable.h"
#include "parse-options.h"
#include "progress.h"
#include "prune-packed.h"
+#include "replace-object.h"
+#include "object-file.h"
+#include "object-name.h"
#include "object-store.h"
#include "shallow.h"
@@ -98,7 +104,8 @@ static int prune_object(const struct object_id *oid, const char *fullpath,
return 0;
}
-static int prune_cruft(const char *basename, const char *path, void *data)
+static int prune_cruft(const char *basename, const char *path,
+ void *data UNUSED)
{
if (starts_with(basename, "tmp_obj_"))
prune_tmp_file(path);
@@ -107,7 +114,8 @@ static int prune_cruft(const char *basename, const char *path, void *data)
return 0;
}
-static int prune_subdir(unsigned int nr, const char *path, void *data)
+static int prune_subdir(unsigned int nr UNUSED, const char *path,
+ void *data UNUSED)
{
if (!show_only)
rmdir(path);
@@ -127,7 +135,9 @@ static void remove_temporary_files(const char *path)
dir = opendir(path);
if (!dir) {
- fprintf(stderr, "Unable to open directory %s\n", path);
+ if (errno != ENOENT)
+ fprintf(stderr, "Unable to open directory %s: %s\n",
+ path, strerror(errno));
return;
}
while ((de = readdir(dir)) != NULL)
@@ -166,7 +176,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
struct object_id oid;
const char *name = *argv++;
- if (!get_oid(name, &oid)) {
+ if (!repo_get_oid(the_repository, name, &oid)) {
struct object *object = parse_object_or_die(&oid,
name);
add_pending_object(&revs, object, "");
diff --git a/builtin/pull.c b/builtin/pull.c
index 403a24d7ca..0c7bac97b7 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -5,10 +5,14 @@
*
* Fetch one or more remote refs and merge it/them into the current HEAD.
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "cache.h"
+#include "advice.h"
#include "config.h"
#include "builtin.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-name.h"
#include "parse-options.h"
#include "exec-cmd.h"
#include "run-command.h"
@@ -359,8 +363,6 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)
*/
static int git_pull_config(const char *var, const char *value, void *cb)
{
- int status;
-
if (!strcmp(var, "rebase.autostash")) {
config_autostash = git_config_bool(var, value);
return 0;
@@ -372,10 +374,6 @@ static int git_pull_config(const char *var, const char *value, void *cb)
check_trust_level = 0;
}
- status = git_gpg_config(var, value, cb);
- if (status)
- return status;
-
return git_default_config(var, value, cb);
}
@@ -515,76 +513,75 @@ static void parse_repo_refspecs(int argc, const char **argv, const char **repo,
*/
static int run_fetch(const char *repo, const char **refspecs)
{
- struct strvec args = STRVEC_INIT;
- int ret;
+ struct child_process cmd = CHILD_PROCESS_INIT;
- strvec_pushl(&args, "fetch", "--update-head-ok", NULL);
+ strvec_pushl(&cmd.args, "fetch", "--update-head-ok", NULL);
/* Shared options */
- argv_push_verbosity(&args);
+ argv_push_verbosity(&cmd.args);
if (opt_progress)
- strvec_push(&args, opt_progress);
+ strvec_push(&cmd.args, opt_progress);
/* Options passed to git-fetch */
if (opt_all)
- strvec_push(&args, opt_all);
+ strvec_push(&cmd.args, opt_all);
if (opt_append)
- strvec_push(&args, opt_append);
+ strvec_push(&cmd.args, opt_append);
if (opt_upload_pack)
- strvec_push(&args, opt_upload_pack);
- argv_push_force(&args);
+ strvec_push(&cmd.args, opt_upload_pack);
+ argv_push_force(&cmd.args);
if (opt_tags)
- strvec_push(&args, opt_tags);
+ strvec_push(&cmd.args, opt_tags);
if (opt_prune)
- strvec_push(&args, opt_prune);
+ strvec_push(&cmd.args, opt_prune);
if (recurse_submodules_cli != RECURSE_SUBMODULES_DEFAULT)
switch (recurse_submodules_cli) {
case RECURSE_SUBMODULES_ON:
- strvec_push(&args, "--recurse-submodules=on");
+ strvec_push(&cmd.args, "--recurse-submodules=on");
break;
case RECURSE_SUBMODULES_OFF:
- strvec_push(&args, "--recurse-submodules=no");
+ strvec_push(&cmd.args, "--recurse-submodules=no");
break;
case RECURSE_SUBMODULES_ON_DEMAND:
- strvec_push(&args, "--recurse-submodules=on-demand");
+ strvec_push(&cmd.args, "--recurse-submodules=on-demand");
break;
default:
BUG("submodule recursion option not understood");
}
if (max_children)
- strvec_push(&args, max_children);
+ strvec_push(&cmd.args, max_children);
if (opt_dry_run)
- strvec_push(&args, "--dry-run");
+ strvec_push(&cmd.args, "--dry-run");
if (opt_keep)
- strvec_push(&args, opt_keep);
+ strvec_push(&cmd.args, opt_keep);
if (opt_depth)
- strvec_push(&args, opt_depth);
+ strvec_push(&cmd.args, opt_depth);
if (opt_unshallow)
- strvec_push(&args, opt_unshallow);
+ strvec_push(&cmd.args, opt_unshallow);
if (opt_update_shallow)
- strvec_push(&args, opt_update_shallow);
+ strvec_push(&cmd.args, opt_update_shallow);
if (opt_refmap)
- strvec_push(&args, opt_refmap);
+ strvec_push(&cmd.args, opt_refmap);
if (opt_ipv4)
- strvec_push(&args, opt_ipv4);
+ strvec_push(&cmd.args, opt_ipv4);
if (opt_ipv6)
- strvec_push(&args, opt_ipv6);
+ strvec_push(&cmd.args, opt_ipv6);
if (opt_show_forced_updates > 0)
- strvec_push(&args, "--show-forced-updates");
+ strvec_push(&cmd.args, "--show-forced-updates");
else if (opt_show_forced_updates == 0)
- strvec_push(&args, "--no-show-forced-updates");
+ strvec_push(&cmd.args, "--no-show-forced-updates");
if (set_upstream)
- strvec_push(&args, set_upstream);
- strvec_pushv(&args, opt_fetch.v);
+ strvec_push(&cmd.args, set_upstream);
+ strvec_pushv(&cmd.args, opt_fetch.v);
if (repo) {
- strvec_push(&args, repo);
- strvec_pushv(&args, refspecs);
+ strvec_push(&cmd.args, repo);
+ strvec_pushv(&cmd.args, refspecs);
} else if (*refspecs)
BUG("refspecs without repo?");
- ret = run_command_v_opt(args.v, RUN_GIT_CMD | RUN_CLOSE_OBJECT_STORE);
- strvec_clear(&args);
- return ret;
+ cmd.git_cmd = 1;
+ cmd.close_object_store = 1;
+ return run_command(&cmd);
}
/**
@@ -653,52 +650,50 @@ static int update_submodules(void)
*/
static int run_merge(void)
{
- int ret;
- struct strvec args = STRVEC_INIT;
+ struct child_process cmd = CHILD_PROCESS_INIT;
- strvec_pushl(&args, "merge", NULL);
+ strvec_pushl(&cmd.args, "merge", NULL);
/* Shared options */
- argv_push_verbosity(&args);
+ argv_push_verbosity(&cmd.args);
if (opt_progress)
- strvec_push(&args, opt_progress);
+ strvec_push(&cmd.args, opt_progress);
/* Options passed to git-merge */
if (opt_diffstat)
- strvec_push(&args, opt_diffstat);
+ strvec_push(&cmd.args, opt_diffstat);
if (opt_log)
- strvec_push(&args, opt_log);
+ strvec_push(&cmd.args, opt_log);
if (opt_signoff)
- strvec_push(&args, opt_signoff);
+ strvec_push(&cmd.args, opt_signoff);
if (opt_squash)
- strvec_push(&args, opt_squash);
+ strvec_push(&cmd.args, opt_squash);
if (opt_commit)
- strvec_push(&args, opt_commit);
+ strvec_push(&cmd.args, opt_commit);
if (opt_edit)
- strvec_push(&args, opt_edit);
+ strvec_push(&cmd.args, opt_edit);
if (cleanup_arg)
- strvec_pushf(&args, "--cleanup=%s", cleanup_arg);
+ strvec_pushf(&cmd.args, "--cleanup=%s", cleanup_arg);
if (opt_ff)
- strvec_push(&args, opt_ff);
+ strvec_push(&cmd.args, opt_ff);
if (opt_verify)
- strvec_push(&args, opt_verify);
+ strvec_push(&cmd.args, opt_verify);
if (opt_verify_signatures)
- strvec_push(&args, opt_verify_signatures);
- strvec_pushv(&args, opt_strategies.v);
- strvec_pushv(&args, opt_strategy_opts.v);
+ strvec_push(&cmd.args, opt_verify_signatures);
+ strvec_pushv(&cmd.args, opt_strategies.v);
+ strvec_pushv(&cmd.args, opt_strategy_opts.v);
if (opt_gpg_sign)
- strvec_push(&args, opt_gpg_sign);
+ strvec_push(&cmd.args, opt_gpg_sign);
if (opt_autostash == 0)
- strvec_push(&args, "--no-autostash");
+ strvec_push(&cmd.args, "--no-autostash");
else if (opt_autostash == 1)
- strvec_push(&args, "--autostash");
+ strvec_push(&cmd.args, "--autostash");
if (opt_allow_unrelated_histories > 0)
- strvec_push(&args, "--allow-unrelated-histories");
+ strvec_push(&cmd.args, "--allow-unrelated-histories");
- strvec_push(&args, "FETCH_HEAD");
- ret = run_command_v_opt(args.v, RUN_GIT_CMD);
- strvec_clear(&args);
- return ret;
+ strvec_push(&cmd.args, "FETCH_HEAD");
+ cmd.git_cmd = 1;
+ return run_command(&cmd);
}
/**
@@ -879,43 +874,41 @@ static int get_rebase_newbase_and_upstream(struct object_id *newbase,
static int run_rebase(const struct object_id *newbase,
const struct object_id *upstream)
{
- int ret;
- struct strvec args = STRVEC_INIT;
+ struct child_process cmd = CHILD_PROCESS_INIT;
- strvec_push(&args, "rebase");
+ strvec_push(&cmd.args, "rebase");
/* Shared options */
- argv_push_verbosity(&args);
+ argv_push_verbosity(&cmd.args);
/* Options passed to git-rebase */
if (opt_rebase == REBASE_MERGES)
- strvec_push(&args, "--rebase-merges");
+ strvec_push(&cmd.args, "--rebase-merges");
else if (opt_rebase == REBASE_INTERACTIVE)
- strvec_push(&args, "--interactive");
+ strvec_push(&cmd.args, "--interactive");
if (opt_diffstat)
- strvec_push(&args, opt_diffstat);
- strvec_pushv(&args, opt_strategies.v);
- strvec_pushv(&args, opt_strategy_opts.v);
+ strvec_push(&cmd.args, opt_diffstat);
+ strvec_pushv(&cmd.args, opt_strategies.v);
+ strvec_pushv(&cmd.args, opt_strategy_opts.v);
if (opt_gpg_sign)
- strvec_push(&args, opt_gpg_sign);
+ strvec_push(&cmd.args, opt_gpg_sign);
if (opt_signoff)
- strvec_push(&args, opt_signoff);
+ strvec_push(&cmd.args, opt_signoff);
if (opt_autostash == 0)
- strvec_push(&args, "--no-autostash");
+ strvec_push(&cmd.args, "--no-autostash");
else if (opt_autostash == 1)
- strvec_push(&args, "--autostash");
+ strvec_push(&cmd.args, "--autostash");
if (opt_verify_signatures &&
!strcmp(opt_verify_signatures, "--verify-signatures"))
warning(_("ignoring --verify-signatures for rebase"));
- strvec_push(&args, "--onto");
- strvec_push(&args, oid_to_hex(newbase));
+ strvec_push(&cmd.args, "--onto");
+ strvec_push(&cmd.args, oid_to_hex(newbase));
- strvec_push(&args, oid_to_hex(upstream));
+ strvec_push(&cmd.args, oid_to_hex(upstream));
- ret = run_command_v_opt(args.v, RUN_GIT_CMD);
- strvec_clear(&args);
- return ret;
+ cmd.git_cmd = 1;
+ return run_command(&cmd);
}
static int get_can_ff(struct object_id *orig_head,
@@ -1035,26 +1028,26 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
if (opt_rebase < 0)
opt_rebase = config_get_rebase(&rebase_unspecified);
- if (read_cache_unmerged())
+ if (repo_read_index_unmerged(the_repository))
die_resolve_conflict("pull");
if (file_exists(git_path_merge_head(the_repository)))
die_conclude_merge();
- if (get_oid("HEAD", &orig_head))
+ if (repo_get_oid(the_repository, "HEAD", &orig_head))
oidclr(&orig_head);
if (opt_rebase) {
if (opt_autostash == -1)
opt_autostash = config_autostash;
- if (is_null_oid(&orig_head) && !is_cache_unborn())
+ if (is_null_oid(&orig_head) && !is_index_unborn(&the_index))
die(_("Updating an unborn branch with changes added to the index."));
if (!opt_autostash)
require_clean_work_tree(the_repository,
N_("pull with rebase"),
- _("please commit or stash them."), 1, 0);
+ _("Please commit or stash them."), 1, 0);
if (get_rebase_fork_point(&rebase_fork_point, repo, *refspecs))
oidclr(&rebase_fork_point);
@@ -1066,7 +1059,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
if (opt_dry_run)
return 0;
- if (get_oid("HEAD", &curr_head))
+ if (repo_get_oid(the_repository, "HEAD", &curr_head))
oidclr(&curr_head);
if (!is_null_oid(&orig_head) && !is_null_oid(&curr_head) &&
diff --git a/builtin/push.c b/builtin/push.c
index df0d68e599..4e5780dd50 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -2,8 +2,11 @@
* "git push"
*/
#include "cache.h"
+#include "advice.h"
#include "branch.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
#include "refs.h"
#include "refspec.h"
#include "run-command.h"
@@ -11,9 +14,12 @@
#include "remote.h"
#include "transport.h"
#include "parse-options.h"
+#include "pkt-line.h"
+#include "repository.h"
#include "submodule.h"
#include "submodule-config.h"
#include "send-pack.h"
+#include "trace2.h"
#include "color.h"
static const char * const push_usage[] = {
@@ -63,16 +69,9 @@ static struct refspec rs = REFSPEC_INIT_PUSH;
static struct string_list push_options_config = STRING_LIST_INIT_DUP;
static void refspec_append_mapped(struct refspec *refspec, const char *ref,
- struct remote *remote, struct ref *local_refs)
+ struct remote *remote, struct ref *matched)
{
const char *branch_name;
- struct ref *matched = NULL;
-
- /* Does "ref" uniquely name our ref? */
- if (count_refspec_match(ref, local_refs, &matched) != 1) {
- refspec_append(refspec, ref);
- return;
- }
if (remote->push.nr) {
struct refspec_item query;
@@ -120,15 +119,28 @@ static void set_refspecs(const char **refs, int nr, const char *repo)
die(_("--delete only accepts plain target ref names"));
refspec_appendf(&rs, ":%s", ref);
} else if (!strchr(ref, ':')) {
- if (!remote) {
- /* lazily grab remote and local_refs */
- remote = remote_get(repo);
+ struct ref *matched = NULL;
+
+ /* lazily grab local_refs */
+ if (!local_refs)
local_refs = get_local_heads();
+
+ /* Does "ref" uniquely name our ref? */
+ if (count_refspec_match(ref, local_refs, &matched) != 1) {
+ refspec_append(&rs, ref);
+ } else {
+ /* lazily grab remote */
+ if (!remote)
+ remote = remote_get(repo);
+ if (!remote)
+ BUG("must get a remote for repo '%s'", repo);
+
+ refspec_append_mapped(&rs, ref, remote, matched);
}
- refspec_append_mapped(&rs, ref, remote, local_refs);
} else
refspec_append(&rs, ref);
}
+ free_refs(local_refs);
}
static int push_url_of_remote(struct remote *remote, const char ***url_p)
@@ -169,8 +181,8 @@ static NORETURN void die_push_simple(struct branch *branch,
if (git_branch_track != BRANCH_TRACK_SIMPLE)
advice_automergesimple_maybe = _("\n"
"To avoid automatically configuring "
- "upstream branches when their name\n"
- "doesn't match the local branch, see option "
+ "an upstream branch when its name\n"
+ "won't match the local branch, see option "
"'simple' of branch.autoSetupMerge\n"
"in 'git help config'.\n");
die(_("The upstream branch of your current branch does not match\n"
@@ -466,8 +478,16 @@ static int option_parse_recurse_submodules(const struct option *opt,
if (unset)
*recurse_submodules = RECURSE_SUBMODULES_OFF;
- else
- *recurse_submodules = parse_push_recurse_submodules_arg(opt->long_name, arg);
+ else {
+ if (!strcmp(arg, "only-is-on-demand")) {
+ if (*recurse_submodules == RECURSE_SUBMODULES_ONLY) {
+ warning(_("recursing into submodule with push.recurseSubmodules=only; using on-demand instead"));
+ *recurse_submodules = RECURSE_SUBMODULES_ON_DEMAND;
+ }
+ } else {
+ *recurse_submodules = parse_push_recurse_submodules_arg(opt->long_name, arg);
+ }
+ }
return 0;
}
@@ -494,11 +514,6 @@ static int git_push_config(const char *k, const char *v, void *cb)
{
const char *slot_name;
int *flags = cb;
- int status;
-
- status = git_gpg_config(k, v, NULL);
- if (status)
- return status;
if (!strcmp(k, "push.followtags")) {
if (git_config_bool(k, v))
diff --git a/builtin/range-diff.c b/builtin/range-diff.c
index e2a74efb42..04339a92ea 100644
--- a/builtin/range-diff.c
+++ b/builtin/range-diff.c
@@ -1,5 +1,7 @@
#include "cache.h"
#include "builtin.h"
+#include "gettext.h"
+#include "object-name.h"
#include "parse-options.h"
#include "range-diff.h"
#include "config.h"
@@ -47,7 +49,7 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix)
repo_diff_setup(the_repository, &diffopt);
- options = parse_options_concat(range_diff_options, diffopt.parseopts);
+ options = add_diff_options(range_diff_options, &diffopt);
argc = parse_options(argc, argv, prefix, options,
builtin_range_diff_usage, PARSE_OPT_KEEP_DASHDASH);
@@ -65,20 +67,20 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix)
if (dash_dash == 3 ||
(dash_dash < 0 && argc > 2 &&
- !get_oid_committish(argv[0], &oid) &&
- !get_oid_committish(argv[1], &oid) &&
- !get_oid_committish(argv[2], &oid))) {
+ !repo_get_oid_committish(the_repository, argv[0], &oid) &&
+ !repo_get_oid_committish(the_repository, argv[1], &oid) &&
+ !repo_get_oid_committish(the_repository, argv[2], &oid))) {
if (dash_dash < 0)
; /* already validated arguments */
- else if (get_oid_committish(argv[0], &oid))
+ else if (repo_get_oid_committish(the_repository, argv[0], &oid))
usage_msg_optf(_("not a revision: '%s'"),
builtin_range_diff_usage, options,
argv[0]);
- else if (get_oid_committish(argv[1], &oid))
+ else if (repo_get_oid_committish(the_repository, argv[1], &oid))
usage_msg_optf(_("not a revision: '%s'"),
builtin_range_diff_usage, options,
argv[1]);
- else if (get_oid_committish(argv[2], &oid))
+ else if (repo_get_oid_committish(the_repository, argv[2], &oid))
usage_msg_optf(_("not a revision: '%s'"),
builtin_range_diff_usage, options,
argv[2]);
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index 9f1f33e954..440f19b1b8 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -4,11 +4,14 @@
* Copyright (C) Linus Torvalds, 2005
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "cache.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "object.h"
+#include "object-name.h"
#include "tree.h"
#include "tree-walk.h"
#include "cache-tree.h"
@@ -16,7 +19,9 @@
#include "dir.h"
#include "builtin.h"
#include "parse-options.h"
+#include "repository.h"
#include "resolve-undo.h"
+#include "setup.h"
#include "submodule.h"
#include "submodule-config.h"
@@ -38,7 +43,9 @@ static int list_tree(struct object_id *oid)
}
static const char * const read_tree_usage[] = {
- N_("git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>) [-u | -i]] [--no-sparse-checkout] [--index-output=<file>] (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"),
+ N_("git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>)\n"
+ " [-u | -i]] [--index-output=<file>] [--no-sparse-checkout]\n"
+ " (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"),
NULL
};
@@ -85,9 +92,9 @@ static int debug_merge(const struct cache_entry * const *stages,
{
int i;
- printf("* %d-way merge\n", o->merge_size);
+ printf("* %d-way merge\n", o->internal.merge_size);
debug_stage("index", stages[0], o);
- for (i = 1; i <= o->merge_size; i++) {
+ for (i = 1; i <= o->internal.merge_size; i++) {
char buf[24];
xsnprintf(buf, sizeof(buf), "ent#%d", i);
debug_stage(buf, stages[i], o);
@@ -112,6 +119,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
int prefix_set = 0;
struct lock_file lock_file = LOCK_INIT;
const struct option read_tree_options[] = {
+ OPT__SUPER_PREFIX(&opts.super_prefix),
OPT_CALLBACK_F(0, "index-output", NULL, N_("file"),
N_("write resulting index to <file>"),
PARSE_OPT_NONEG, index_output_cb),
@@ -141,7 +149,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
OPT__DRY_RUN(&opts.dry_run, N_("don't update the index or the work tree")),
OPT_BOOL(0, "no-sparse-checkout", &opts.skip_sparse_checkout,
N_("skip applying sparse checkout filter")),
- OPT_BOOL(0, "debug-unpack", &opts.debug_unpack,
+ OPT_BOOL(0, "debug-unpack", &opts.internal.debug_unpack,
N_("debug unpack-trees")),
OPT_CALLBACK_F(0, "recurse-submodules", NULL,
"checkout", "control recursive updating of submodules",
@@ -174,7 +182,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
- hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &lock_file, LOCK_DIE_ON_ERROR);
/*
* NEEDSWORK
@@ -186,16 +194,16 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
*/
if (opts.reset || opts.merge || opts.prefix) {
- if (read_cache_unmerged() && (opts.prefix || opts.merge))
+ if (repo_read_index_unmerged(the_repository) && (opts.prefix || opts.merge))
die(_("You need to resolve your current index first"));
stage = opts.merge = 1;
}
- resolve_undo_clear();
+ resolve_undo_clear_index(&the_index);
for (i = 0; i < argc; i++) {
const char *arg = argv[i];
- if (get_oid(arg, &oid))
+ if (repo_get_oid(the_repository, arg, &oid))
die("Not a valid object name %s", arg);
if (list_tree(&oid) < 0)
die("failed to unpack tree object %s", arg);
@@ -230,7 +238,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
break;
case 2:
opts.fn = twoway_merge;
- opts.initial_checkout = is_cache_unborn();
+ opts.initial_checkout = is_index_unborn(&the_index);
break;
case 3:
default:
@@ -244,10 +252,14 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
opts.head_idx = 1;
}
- if (opts.debug_unpack)
+ if (opts.internal.debug_unpack)
opts.fn = debug_merge;
- cache_tree_free(&active_cache_tree);
+ /* If we're going to prime_cache_tree later, skip cache tree update */
+ if (nr_trees == 1 && !opts.prefix)
+ opts.skip_cache_tree_update = 1;
+
+ cache_tree_free(&the_index.cache_tree);
for (i = 0; i < nr_trees; i++) {
struct tree *tree = trees[i];
parse_tree(tree);
@@ -256,7 +268,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
if (unpack_trees(nr_trees, t, &opts))
return 128;
- if (opts.debug_unpack || opts.dry_run)
+ if (opts.internal.debug_unpack || opts.dry_run)
return 0; /* do not write the index out */
/*
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 56e4214b44..ace1d5e8d1 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -4,8 +4,12 @@
* Copyright (c) 2018 Pratik Karki
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "abspath.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "run-command.h"
#include "exec-cmd.h"
#include "strvec.h"
@@ -17,6 +21,8 @@
#include "cache-tree.h"
#include "unpack-trees.h"
#include "lockfile.h"
+#include "object-file.h"
+#include "object-name.h"
#include "parse-options.h"
#include "commit.h"
#include "diff.h"
@@ -28,9 +34,9 @@
#include "sequencer.h"
#include "rebase-interactive.h"
#include "reset.h"
+#include "trace2.h"
#include "hook.h"
-
-#define DEFAULT_REFLOG_ACTION "rebase"
+#include "wrapper.h"
static char const * const builtin_rebase_usage[] = {
N_("git rebase [-i] [options] [--exec <cmd>] "
@@ -59,6 +65,26 @@ enum empty_type {
EMPTY_ASK
};
+enum action {
+ ACTION_NONE = 0,
+ ACTION_CONTINUE,
+ ACTION_SKIP,
+ ACTION_ABORT,
+ ACTION_QUIT,
+ ACTION_EDIT_TODO,
+ ACTION_SHOW_CURRENT_PATCH
+};
+
+static const char *action_names[] = {
+ "undefined",
+ "continue",
+ "skip",
+ "abort",
+ "quit",
+ "edit_todo",
+ "show_current_patch"
+};
+
struct rebase_options {
enum rebase_type type;
enum empty_type empty;
@@ -68,7 +94,7 @@ struct rebase_options {
const char *upstream_name;
const char *upstream_arg;
char *head_name;
- struct object_id orig_head;
+ struct commit *orig_head;
struct commit *onto;
const char *onto_name;
const char *revisions;
@@ -85,7 +111,8 @@ struct rebase_options {
REBASE_INTERACTIVE_EXPLICIT = 1<<4,
} flags;
struct strvec git_am_opts;
- const char *action;
+ enum action action;
+ char *reflog_action;
int signoff;
int allow_rerere_autoupdate;
int keep_empty;
@@ -94,15 +121,19 @@ struct rebase_options {
int autostash;
int committer_date_is_author_date;
int ignore_date;
- char *cmd;
+ struct string_list exec;
int allow_empty_message;
int rebase_merges, rebase_cousins;
- char *strategy, *strategy_opts;
+ char *strategy;
+ struct string_list strategy_opts;
struct strbuf git_format_patch_opt;
int reschedule_failed_exec;
int reapply_cherry_picks;
int fork_point;
int update_refs;
+ int config_autosquash;
+ int config_rebase_merges;
+ int config_update_refs;
};
#define REBASE_OPTIONS_INIT { \
@@ -112,8 +143,18 @@ struct rebase_options {
.default_backend = "merge", \
.flags = REBASE_NO_QUIET, \
.git_am_opts = STRVEC_INIT, \
+ .exec = STRING_LIST_INIT_NODUP, \
.git_format_patch_opt = STRBUF_INIT, \
.fork_point = -1, \
+ .reapply_cherry_picks = -1, \
+ .allow_empty_message = 1, \
+ .autosquash = -1, \
+ .config_autosquash = -1, \
+ .rebase_merges = -1, \
+ .config_rebase_merges = -1, \
+ .update_refs = -1, \
+ .config_update_refs = -1, \
+ .strategy_opts = STRING_LIST_INIT_NODUP,\
}
static struct replay_opts get_replay_opts(const struct rebase_options *opts)
@@ -139,6 +180,7 @@ static struct replay_opts get_replay_opts(const struct rebase_options *opts)
opts->committer_date_is_author_date;
replay.ignore_date = opts->ignore_date;
replay.gpg_sign = xstrdup_or_null(opts->gpg_sign_opt);
+ replay.reflog_action = xstrdup(opts->reflog_action);
if (opts->strategy)
replay.strategy = xstrdup_or_null(opts->strategy);
else if (!replay.strategy && replay.default_strategy) {
@@ -146,8 +188,8 @@ static struct replay_opts get_replay_opts(const struct rebase_options *opts)
replay.default_strategy = NULL;
}
- if (opts->strategy_opts)
- parse_strategy_opts(&replay, opts->strategy_opts);
+ for (size_t i = 0; i < opts->strategy_opts.nr; i++)
+ strvec_push(&replay.xopts, opts->strategy_opts.items[i].string);
if (opts->squash_onto) {
oidcpy(&replay.squash_onto, opts->squash_onto);
@@ -157,24 +199,6 @@ static struct replay_opts get_replay_opts(const struct rebase_options *opts)
return replay;
}
-enum action {
- ACTION_NONE = 0,
- ACTION_CONTINUE,
- ACTION_SKIP,
- ACTION_ABORT,
- ACTION_QUIT,
- ACTION_EDIT_TODO,
- ACTION_SHOW_CURRENT_PATCH
-};
-
-static const char *action_names[] = { "undefined",
- "continue",
- "skip",
- "abort",
- "quit",
- "edit_todo",
- "show_current_patch" };
-
static int edit_todo_file(unsigned flags)
{
const char *todo_file = rebase_path_todo();
@@ -207,13 +231,15 @@ static int get_revision_ranges(struct commit *upstream, struct commit *onto,
*revisions = xstrfmt("%s...%s", oid_to_hex(&base_rev->object.oid),
oid_to_hex(orig_head));
- shorthead = find_unique_abbrev(orig_head, DEFAULT_ABBREV);
+ shorthead = repo_find_unique_abbrev(the_repository, orig_head,
+ DEFAULT_ABBREV);
if (upstream) {
const char *shortrev;
- shortrev = find_unique_abbrev(&base_rev->object.oid,
- DEFAULT_ABBREV);
+ shortrev = repo_find_unique_abbrev(the_repository,
+ &base_rev->object.oid,
+ DEFAULT_ABBREV);
*shortrevisions = xstrfmt("%s..%s", shortrev, shorthead);
} else
@@ -241,38 +267,22 @@ static int init_basic_state(struct replay_opts *opts, const char *head_name,
return write_basic_state(opts, head_name, onto, orig_head);
}
-static void split_exec_commands(const char *cmd, struct string_list *commands)
-{
- if (cmd && *cmd) {
- string_list_split(commands, cmd, '\n', -1);
-
- /* rebase.c adds a new line to cmd after every command,
- * so here the last command is always empty */
- string_list_remove_empty_items(commands, 0);
- }
-}
-
static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
{
- int ret;
+ int ret = -1;
char *revisions = NULL, *shortrevisions = NULL;
struct strvec make_script_args = STRVEC_INIT;
struct todo_list todo_list = TODO_LIST_INIT;
struct replay_opts replay = get_replay_opts(opts);
- struct string_list commands = STRING_LIST_INIT_DUP;
- if (get_revision_ranges(opts->upstream, opts->onto, &opts->orig_head,
+ if (get_revision_ranges(opts->upstream, opts->onto, &opts->orig_head->object.oid,
&revisions, &shortrevisions))
- return -1;
+ goto cleanup;
if (init_basic_state(&replay,
opts->head_name ? opts->head_name : "detached HEAD",
- opts->onto, &opts->orig_head)) {
- free(revisions);
- free(shortrevisions);
-
- return -1;
- }
+ opts->onto, &opts->orig_head->object.oid))
+ goto cleanup;
if (!opts->upstream && opts->squash_onto)
write_file(path_squash_onto(), "%s\n",
@@ -290,20 +300,19 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
if (ret)
error(_("could not generate todo list"));
else {
- discard_cache();
+ discard_index(&the_index);
if (todo_list_parse_insn_buffer(the_repository, todo_list.buf.buf,
&todo_list))
BUG("unusable todo list");
- split_exec_commands(opts->cmd, &commands);
ret = complete_action(the_repository, &replay, flags,
shortrevisions, opts->onto_name, opts->onto,
- &opts->orig_head, &commands, opts->autosquash,
- opts->update_refs,
- &todo_list);
+ &opts->orig_head->object.oid, &opts->exec,
+ opts->autosquash, opts->update_refs, &todo_list);
}
- string_list_clear(&commands, 0);
+cleanup:
+ replay_opts_release(&replay);
free(revisions);
free(shortrevisions);
todo_list_release(&todo_list);
@@ -312,8 +321,7 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
return ret;
}
-static int run_sequencer_rebase(struct rebase_options *opts,
- enum action command)
+static int run_sequencer_rebase(struct rebase_options *opts)
{
unsigned flags = 0;
int abbreviate_commands = 0, ret = 0;
@@ -328,7 +336,7 @@ static int run_sequencer_rebase(struct rebase_options *opts,
flags |= opts->reapply_cherry_picks ? TODO_LIST_REAPPLY_CHERRY_PICKS : 0;
flags |= opts->flags & REBASE_NO_QUIET ? TODO_LIST_WARN_SKIPPED_CHERRY_PICKS : 0;
- switch (command) {
+ switch (opts->action) {
case ACTION_NONE: {
if (!opts->onto && !opts->upstream)
die(_("a base commit must be provided with --upstream or --onto"));
@@ -346,6 +354,7 @@ static int run_sequencer_rebase(struct rebase_options *opts,
struct replay_opts replay_opts = get_replay_opts(opts);
ret = sequencer_continue(the_repository, &replay_opts);
+ replay_opts_release(&replay_opts);
break;
}
case ACTION_EDIT_TODO:
@@ -361,7 +370,7 @@ static int run_sequencer_rebase(struct rebase_options *opts,
break;
}
default:
- BUG("invalid command '%d'", command);
+ BUG("invalid command '%d'", opts->action);
}
return ret;
@@ -431,9 +440,9 @@ static int read_basic_state(struct rebase_options *opts)
opts->head_name = starts_with(head_name.buf, "refs/") ?
xstrdup(head_name.buf) : NULL;
strbuf_release(&head_name);
- if (get_oid(buf.buf, &oid))
- return error(_("could not get 'onto': '%s'"), buf.buf);
- opts->onto = lookup_commit_or_die(&oid, buf.buf);
+ if (get_oid_hex(buf.buf, &oid) ||
+ !(opts->onto = lookup_commit_object(the_repository, &oid)))
+ return error(_("invalid onto: '%s'"), buf.buf);
/*
* We always write to orig-head, but interactive rebase used to write to
@@ -448,7 +457,8 @@ static int read_basic_state(struct rebase_options *opts)
} else if (!read_oneliner(&buf, state_dir_path("head", opts),
READ_ONELINER_WARN_MISSING))
return -1;
- if (get_oid(buf.buf, &opts->orig_head))
+ if (get_oid_hex(buf.buf, &oid) ||
+ !(opts->orig_head = lookup_commit_object(the_repository, &oid)))
return error(_("invalid orig-head: '%s'"), buf.buf);
if (file_exists(state_dir_path("quiet", opts)))
@@ -487,24 +497,6 @@ static int read_basic_state(struct rebase_options *opts)
opts->gpg_sign_opt = xstrdup(buf.buf);
}
- if (file_exists(state_dir_path("strategy", opts))) {
- strbuf_reset(&buf);
- if (!read_oneliner(&buf, state_dir_path("strategy", opts),
- READ_ONELINER_WARN_MISSING))
- return -1;
- free(opts->strategy);
- opts->strategy = xstrdup(buf.buf);
- }
-
- if (file_exists(state_dir_path("strategy_opts", opts))) {
- strbuf_reset(&buf);
- if (!read_oneliner(&buf, state_dir_path("strategy_opts", opts),
- READ_ONELINER_WARN_MISSING))
- return -1;
- free(opts->strategy_opts);
- opts->strategy_opts = xstrdup(buf.buf);
- }
-
strbuf_release(&buf);
return 0;
@@ -517,17 +509,11 @@ static int rebase_write_basic_state(struct rebase_options *opts)
write_file(state_dir_path("onto", opts), "%s",
opts->onto ? oid_to_hex(&opts->onto->object.oid) : "");
write_file(state_dir_path("orig-head", opts), "%s",
- oid_to_hex(&opts->orig_head));
+ oid_to_hex(&opts->orig_head->object.oid));
if (!(opts->flags & REBASE_NO_QUIET))
write_file(state_dir_path("quiet", opts), "%s", "");
if (opts->flags & REBASE_VERBOSE)
write_file(state_dir_path("verbose", opts), "%s", "");
- if (opts->strategy)
- write_file(state_dir_path("strategy", opts), "%s",
- opts->strategy);
- if (opts->strategy_opts)
- write_file(state_dir_path("strategy_opts", opts), "%s",
- opts->strategy_opts);
if (opts->allow_rerere_autoupdate > 0)
write_file(state_dir_path("allow_rerere_autoupdate", opts),
"-%s-rerere-autoupdate",
@@ -560,6 +546,7 @@ static int finish_rebase(struct rebase_options *opts)
replay.action = REPLAY_INTERACTIVE_REBASE;
ret = sequencer_remove_state(&replay);
+ replay_opts_release(&replay);
} else {
strbuf_addstr(&dir, opts->state_dir);
if (remove_dir_recursively(&dir, 0))
@@ -583,10 +570,11 @@ static int move_to_original_branch(struct rebase_options *opts)
if (!opts->onto)
BUG("move_to_original_branch without onto");
- strbuf_addf(&branch_reflog, "rebase finished: %s onto %s",
+ strbuf_addf(&branch_reflog, "%s (finish): %s onto %s",
+ opts->reflog_action,
opts->head_name, oid_to_hex(&opts->onto->object.oid));
- strbuf_addf(&head_reflog, "rebase finished: returning to %s",
- opts->head_name);
+ strbuf_addf(&head_reflog, "%s (finish): returning to %s",
+ opts->reflog_action, opts->head_name);
ropts.branch = opts->head_name;
ropts.flags = RESET_HEAD_REFS_ONLY;
ropts.branch_msg = branch_reflog.buf;
@@ -615,8 +603,9 @@ static int run_am(struct rebase_options *opts)
am.git_cmd = 1;
strvec_push(&am.args, "am");
-
- if (opts->action && !strcmp("continue", opts->action)) {
+ strvec_pushf(&am.env, GIT_REFLOG_ACTION_ENVIRONMENT "=%s (pick)",
+ opts->reflog_action);
+ if (opts->action == ACTION_CONTINUE) {
strvec_push(&am.args, "--resolved");
strvec_pushf(&am.args, "--resolvemsg=%s", resolvemsg);
if (opts->gpg_sign_opt)
@@ -627,7 +616,7 @@ static int run_am(struct rebase_options *opts)
return move_to_original_branch(opts);
}
- if (opts->action && !strcmp("skip", opts->action)) {
+ if (opts->action == ACTION_SKIP) {
strvec_push(&am.args, "--skip");
strvec_pushf(&am.args, "--resolvemsg=%s", resolvemsg);
status = run_command(&am);
@@ -636,7 +625,7 @@ static int run_am(struct rebase_options *opts)
return move_to_original_branch(opts);
}
- if (opts->action && !strcmp("show-current-patch", opts->action)) {
+ if (opts->action == ACTION_SHOW_CURRENT_PATCH) {
strvec_push(&am.args, "--show-current-patch");
return run_command(&am);
}
@@ -646,7 +635,7 @@ static int run_am(struct rebase_options *opts)
/* this is now equivalent to !opts->upstream */
&opts->onto->object.oid :
&opts->upstream->object.oid),
- oid_to_hex(&opts->orig_head));
+ oid_to_hex(&opts->orig_head->object.oid));
rebased_patches = xstrdup(git_path("rebased-patches"));
format_patch.out = open(rebased_patches,
@@ -662,7 +651,7 @@ static int run_am(struct rebase_options *opts)
format_patch.git_cmd = 1;
strvec_pushl(&format_patch.args, "format-patch", "-k", "--stdout",
"--full-index", "--cherry-pick", "--right-only",
- "--src-prefix=a/", "--dst-prefix=b/", "--no-renames",
+ "--default-prefix", "--no-renames",
"--no-cover-letter", "--pretty=mboxrd", "--topo-order",
"--no-base", NULL);
if (opts->git_format_patch_opt.len)
@@ -680,9 +669,9 @@ static int run_am(struct rebase_options *opts)
free(rebased_patches);
strvec_clear(&am.args);
- ropts.oid = &opts->orig_head;
+ ropts.oid = &opts->orig_head->object.oid;
ropts.branch = opts->head_name;
- ropts.default_reflog_action = DEFAULT_REFLOG_ACTION;
+ ropts.default_reflog_action = opts->reflog_action;
reset_head(the_repository, &ropts);
error(_("\ngit encountered an error while preparing the "
"patches to replay\n"
@@ -729,7 +718,7 @@ static int run_am(struct rebase_options *opts)
return status;
}
-static int run_specific_rebase(struct rebase_options *opts, enum action action)
+static int run_specific_rebase(struct rebase_options *opts)
{
int status;
@@ -747,7 +736,7 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
opts->gpg_sign_opt = tmp;
}
- status = run_sequencer_rebase(opts, action);
+ status = run_sequencer_rebase(opts);
} else if (opts->type == REBASE_APPLY)
status = run_am(opts);
else
@@ -773,6 +762,16 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
return status ? -1 : 0;
}
+static void parse_rebase_merges_value(struct rebase_options *options, const char *value)
+{
+ if (!strcmp("no-rebase-cousins", value))
+ options->rebase_cousins = 0;
+ else if (!strcmp("rebase-cousins", value))
+ options->rebase_cousins = 1;
+ else
+ die(_("Unknown rebase-merges mode: %s"), value);
+}
+
static int rebase_config(const char *var, const char *value, void *data)
{
struct rebase_options *opts = data;
@@ -786,7 +785,7 @@ static int rebase_config(const char *var, const char *value, void *data)
}
if (!strcmp(var, "rebase.autosquash")) {
- opts->autosquash = git_config_bool(var, value);
+ opts->config_autosquash = git_config_bool(var, value);
return 0;
}
@@ -802,8 +801,19 @@ static int rebase_config(const char *var, const char *value, void *data)
return 0;
}
+ if (!strcmp(var, "rebase.rebasemerges")) {
+ opts->config_rebase_merges = git_parse_maybe_bool(value);
+ if (opts->config_rebase_merges < 0) {
+ opts->config_rebase_merges = 1;
+ parse_rebase_merges_value(opts, value);
+ } else {
+ opts->rebase_cousins = 0;
+ }
+ return 0;
+ }
+
if (!strcmp(var, "rebase.updaterefs")) {
- opts->update_refs = git_config_bool(var, value);
+ opts->config_update_refs = git_config_bool(var, value);
return 0;
}
@@ -831,9 +841,8 @@ static int checkout_up_to_date(struct rebase_options *options)
int ret = 0;
strbuf_addf(&buf, "%s: checkout %s",
- getenv(GIT_REFLOG_ACTION_ENVIRONMENT),
- options->switch_to);
- ropts.oid = &options->orig_head;
+ options->reflog_action, options->switch_to);
+ ropts.oid = &options->orig_head->object.oid;
ropts.branch = options->head_name;
ropts.flags = RESET_HEAD_RUN_POST_CHECKOUT_HOOK;
if (!ropts.branch)
@@ -854,7 +863,7 @@ static int checkout_up_to_date(struct rebase_options *options)
static int is_linear_history(struct commit *from, struct commit *to)
{
while (to && to != from) {
- parse_commit(to);
+ repo_parse_commit(the_repository, to);
if (!to->parents)
return 1;
if (to->parents->next)
@@ -866,33 +875,24 @@ static int is_linear_history(struct commit *from, struct commit *to)
static int can_fast_forward(struct commit *onto, struct commit *upstream,
struct commit *restrict_revision,
- struct object_id *head_oid, struct object_id *merge_base)
+ struct commit *head, struct object_id *branch_base)
{
- struct commit *head = lookup_commit(the_repository, head_oid);
struct commit_list *merge_bases = NULL;
int res = 0;
- if (!head)
- goto done;
+ if (is_null_oid(branch_base))
+ goto done; /* fill_branch_base() found multiple merge bases */
- merge_bases = get_merge_bases(onto, head);
- if (!merge_bases || merge_bases->next) {
- oidcpy(merge_base, null_oid());
+ if (!oideq(branch_base, &onto->object.oid))
goto done;
- }
- oidcpy(merge_base, &merge_bases->item->object.oid);
- if (!oideq(merge_base, &onto->object.oid))
- goto done;
-
- if (restrict_revision && !oideq(&restrict_revision->object.oid, merge_base))
+ if (restrict_revision && !oideq(&restrict_revision->object.oid, branch_base))
goto done;
if (!upstream)
goto done;
- free_commit_list(merge_bases);
- merge_bases = get_merge_bases(upstream, head);
+ merge_bases = repo_get_merge_bases(the_repository, upstream, head);
if (!merge_bases || merge_bases->next)
goto done;
@@ -906,6 +906,21 @@ done:
return res && is_linear_history(onto, head);
}
+static void fill_branch_base(struct rebase_options *options,
+ struct object_id *branch_base)
+{
+ struct commit_list *merge_bases = NULL;
+
+ merge_bases = repo_get_merge_bases(the_repository, options->onto,
+ options->orig_head);
+ if (!merge_bases || merge_bases->next)
+ oidcpy(branch_base, null_oid());
+ else
+ oidcpy(branch_base, &merge_bases->item->object.oid);
+
+ free_commit_list(merge_bases);
+}
+
static int parse_opt_am(const struct option *opt, const char *arg, int unset)
{
struct rebase_options *opts = opt->value;
@@ -913,6 +928,9 @@ static int parse_opt_am(const struct option *opt, const char *arg, int unset)
BUG_ON_OPT_NEG(unset);
BUG_ON_OPT_ARG(arg);
+ if (opts->type != REBASE_UNSPECIFIED && opts->type != REBASE_APPLY)
+ die(_("apply options and merge options cannot be used together"));
+
opts->type = REBASE_APPLY;
return 0;
@@ -926,8 +944,10 @@ static int parse_opt_merge(const struct option *opt, const char *arg, int unset)
BUG_ON_OPT_NEG(unset);
BUG_ON_OPT_ARG(arg);
- if (!is_merge(opts))
- opts->type = REBASE_MERGE;
+ if (opts->type != REBASE_UNSPECIFIED && opts->type != REBASE_MERGE)
+ die(_("apply options and merge options cannot be used together"));
+
+ opts->type = REBASE_MERGE;
return 0;
}
@@ -941,6 +961,9 @@ static int parse_opt_interactive(const struct option *opt, const char *arg,
BUG_ON_OPT_NEG(unset);
BUG_ON_OPT_ARG(arg);
+ if (opts->type != REBASE_UNSPECIFIED && opts->type != REBASE_MERGE)
+ die(_("apply options and merge options cannot be used together"));
+
opts->type = REBASE_MERGE;
opts->flags |= REBASE_INTERACTIVE_EXPLICIT;
@@ -970,6 +993,28 @@ static int parse_opt_empty(const struct option *opt, const char *arg, int unset)
return 0;
}
+static int parse_opt_rebase_merges(const struct option *opt, const char *arg, int unset)
+{
+ struct rebase_options *options = opt->value;
+
+ options->rebase_merges = !unset;
+ options->rebase_cousins = 0;
+
+ if (arg) {
+ if (!*arg) {
+ warning(_("--rebase-merges with an empty string "
+ "argument is deprecated and will stop "
+ "working in a future version of Git. Use "
+ "--rebase-merges without an argument "
+ "instead, which does the same thing."));
+ return 0;
+ }
+ parse_rebase_merges_value(options, arg);
+ }
+
+ return 0;
+}
+
static void NORETURN error_on_missing_default_upstream(void)
{
struct branch *current_branch = branch_get(NULL);
@@ -1000,23 +1045,6 @@ static void NORETURN error_on_missing_default_upstream(void)
exit(1);
}
-static void set_reflog_action(struct rebase_options *options)
-{
- const char *env;
- struct strbuf buf = STRBUF_INIT;
-
- if (!is_merge(options))
- return;
-
- env = getenv(GIT_REFLOG_ACTION_ENVIRONMENT);
- if (env && strcmp("rebase", env))
- return; /* only override it if it is "rebase" */
-
- strbuf_addf(&buf, "rebase (%s)", options->action);
- setenv(GIT_REFLOG_ACTION_ENVIRONMENT, buf.buf, 1);
- strbuf_release(&buf);
-}
-
static int check_exec_cmd(const char *cmd)
{
if (strchr(cmd, '\n'))
@@ -1039,15 +1067,12 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
struct strbuf msg = STRBUF_INIT;
struct strbuf revisions = STRBUF_INIT;
struct strbuf buf = STRBUF_INIT;
- struct object_id merge_base;
+ struct object_id branch_base;
int ignore_whitespace = 0;
- enum action action = ACTION_NONE;
const char *gpg_sign = NULL;
- struct string_list exec = STRING_LIST_INIT_NODUP;
- const char *rebase_merges = NULL;
- struct string_list strategy_options = STRING_LIST_INIT_NODUP;
struct object_id squash_onto;
char *squash_onto_name = NULL;
+ char *keep_base_onto_name = NULL;
int reschedule_failed_exec = -1;
int allow_preemptive_ff = 1;
int preserve_merges_selected = 0;
@@ -1090,18 +1115,18 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
OPT_BIT(0, "no-ff", &options.flags,
N_("cherry-pick all commits, even if unchanged"),
REBASE_FORCE),
- OPT_CMDMODE(0, "continue", &action, N_("continue"),
+ OPT_CMDMODE(0, "continue", &options.action, N_("continue"),
ACTION_CONTINUE),
- OPT_CMDMODE(0, "skip", &action,
+ OPT_CMDMODE(0, "skip", &options.action,
N_("skip current patch and continue"), ACTION_SKIP),
- OPT_CMDMODE(0, "abort", &action,
+ OPT_CMDMODE(0, "abort", &options.action,
N_("abort and check out the original branch"),
ACTION_ABORT),
- OPT_CMDMODE(0, "quit", &action,
+ OPT_CMDMODE(0, "quit", &options.action,
N_("abort but keep HEAD where it is"), ACTION_QUIT),
- OPT_CMDMODE(0, "edit-todo", &action, N_("edit the todo list "
+ OPT_CMDMODE(0, "edit-todo", &options.action, N_("edit the todo list "
"during an interactive rebase"), ACTION_EDIT_TODO),
- OPT_CMDMODE(0, "show-current-patch", &action,
+ OPT_CMDMODE(0, "show-current-patch", &options.action,
N_("show the patch file being applied or merged"),
ACTION_SHOW_CURRENT_PATCH),
OPT_CALLBACK_F(0, "apply", &options, NULL,
@@ -1138,22 +1163,21 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
N_("GPG-sign commits"),
PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
OPT_AUTOSTASH(&options.autostash),
- OPT_STRING_LIST('x', "exec", &exec, N_("exec"),
+ OPT_STRING_LIST('x', "exec", &options.exec, N_("exec"),
N_("add exec lines after each commit of the "
"editable list")),
OPT_BOOL_F(0, "allow-empty-message",
&options.allow_empty_message,
N_("allow rebasing commits with empty messages"),
PARSE_OPT_HIDDEN),
- {OPTION_STRING, 'r', "rebase-merges", &rebase_merges,
- N_("mode"),
+ OPT_CALLBACK_F('r', "rebase-merges", &options, N_("mode"),
N_("try to rebase merges instead of skipping them"),
- PARSE_OPT_OPTARG, NULL, (intptr_t)""},
+ PARSE_OPT_OPTARG, parse_opt_rebase_merges),
OPT_BOOL(0, "fork-point", &options.fork_point,
N_("use 'merge-base --fork-point' to refine upstream")),
OPT_STRING('s', "strategy", &options.strategy,
N_("strategy"), N_("use the given merge strategy")),
- OPT_STRING_LIST('X', "strategy-option", &strategy_options,
+ OPT_STRING_LIST('X', "strategy-option", &options.strategy_opts,
N_("option"),
N_("pass the argument through to the merge "
"strategy")),
@@ -1175,7 +1199,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
- options.allow_empty_message = 1;
git_config(rebase_config, &options);
/* options.gpg_sign_opt will be either "-S" or NULL */
gpg_sign = options.gpg_sign_opt ? "" : NULL;
@@ -1192,7 +1215,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
} else if (is_directory(merge_dir())) {
strbuf_reset(&buf);
strbuf_addf(&buf, "%s/rewritten", merge_dir());
- if (!(action == ACTION_ABORT) && is_directory(buf.buf)) {
+ if (!(options.action == ACTION_ABORT) && is_directory(buf.buf)) {
die(_("`rebase --preserve-merges` (-p) is no longer supported.\n"
"Use `git rebase --abort` to terminate current rebase.\n"
"Or downgrade to v2.33, or earlier, to complete the rebase."));
@@ -1219,7 +1242,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
"Note: Your `pull.rebase` configuration may also be set to 'preserve',\n"
"which is no longer supported; use 'merges' instead"));
- if (action != ACTION_NONE && total_argc != 2) {
+ if (options.action != ACTION_NONE && total_argc != 2) {
usage_with_options(builtin_rebase_usage,
builtin_rebase_options);
}
@@ -1233,42 +1256,47 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
die(_("options '%s' and '%s' cannot be used together"), "--keep-base", "--onto");
if (options.root)
die(_("options '%s' and '%s' cannot be used together"), "--keep-base", "--root");
+ /*
+ * --keep-base defaults to --no-fork-point to keep the
+ * base the same.
+ */
+ if (options.fork_point < 0)
+ options.fork_point = 0;
}
-
if (options.root && options.fork_point > 0)
die(_("options '%s' and '%s' cannot be used together"), "--root", "--fork-point");
- if (action != ACTION_NONE && !in_progress)
+ if (options.action != ACTION_NONE && !in_progress)
die(_("No rebase in progress?"));
- setenv(GIT_REFLOG_ACTION_ENVIRONMENT, "rebase", 0);
- if (action == ACTION_EDIT_TODO && !is_merge(&options))
+ if (options.action == ACTION_EDIT_TODO && !is_merge(&options))
die(_("The --edit-todo action can only be used during "
"interactive rebase."));
if (trace2_is_enabled()) {
if (is_merge(&options))
trace2_cmd_mode("interactive");
- else if (exec.nr)
+ else if (options.exec.nr)
trace2_cmd_mode("interactive-exec");
else
- trace2_cmd_mode(action_names[action]);
+ trace2_cmd_mode(action_names[options.action]);
}
- switch (action) {
+ options.reflog_action = getenv(GIT_REFLOG_ACTION_ENVIRONMENT);
+ options.reflog_action =
+ xstrdup(options.reflog_action ? options.reflog_action : "rebase");
+
+ switch (options.action) {
case ACTION_CONTINUE: {
struct object_id head;
struct lock_file lock_file = LOCK_INIT;
int fd;
- options.action = "continue";
- set_reflog_action(&options);
-
/* Sanity check */
- if (get_oid("HEAD", &head))
+ if (repo_get_oid(the_repository, "HEAD", &head))
die(_("Cannot read HEAD"));
- fd = hold_locked_index(&lock_file, 0);
+ fd = repo_hold_locked_index(the_repository, &lock_file, 0);
if (repo_read_index(the_repository) < 0)
die(_("could not read index"));
refresh_index(the_repository->index, REFRESH_QUIET, NULL, NULL,
@@ -1289,9 +1317,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
case ACTION_SKIP: {
struct string_list merge_rr = STRING_LIST_INIT_DUP;
- options.action = "skip";
- set_reflog_action(&options);
-
rerere_clear(the_repository, &merge_rr);
string_list_clear(&merge_rr, 1);
ropts.flags = RESET_HEAD_HARD;
@@ -1304,21 +1329,26 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
}
case ACTION_ABORT: {
struct string_list merge_rr = STRING_LIST_INIT_DUP;
- options.action = "abort";
- set_reflog_action(&options);
+ struct strbuf head_msg = STRBUF_INIT;
rerere_clear(the_repository, &merge_rr);
string_list_clear(&merge_rr, 1);
if (read_basic_state(&options))
exit(1);
- ropts.oid = &options.orig_head;
+
+ strbuf_addf(&head_msg, "%s (abort): returning to %s",
+ options.reflog_action,
+ options.head_name ? options.head_name
+ : oid_to_hex(&options.orig_head->object.oid));
+ ropts.oid = &options.orig_head->object.oid;
+ ropts.head_msg = head_msg.buf;
ropts.branch = options.head_name;
ropts.flags = RESET_HEAD_HARD;
- ropts.default_reflog_action = DEFAULT_REFLOG_ACTION;
if (reset_head(the_repository, &ropts) < 0)
die(_("could not move back to %s"),
- oid_to_hex(&options.orig_head));
+ oid_to_hex(&options.orig_head->object.oid));
+ strbuf_release(&head_msg);
remove_branch_state(the_repository, 0);
ret = finish_rebase(&options);
goto cleanup;
@@ -1330,6 +1360,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
replay.action = REPLAY_INTERACTIVE_REBASE;
ret = sequencer_remove_state(&replay);
+ replay_opts_release(&replay);
} else {
strbuf_reset(&buf);
strbuf_addstr(&buf, options.state_dir);
@@ -1341,17 +1372,15 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
goto cleanup;
}
case ACTION_EDIT_TODO:
- options.action = "edit-todo";
options.dont_finish_rebase = 1;
goto run_rebase;
case ACTION_SHOW_CURRENT_PATCH:
- options.action = "show-current-patch";
options.dont_finish_rebase = 1;
goto run_rebase;
case ACTION_NONE:
break;
default:
- BUG("action: %d", action);
+ BUG("action: %d", options.action);
}
/* Make sure no rebase is in progress */
@@ -1375,9 +1404,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
}
if ((options.flags & REBASE_INTERACTIVE_EXPLICIT) ||
- (action != ACTION_NONE) ||
- (exec.nr > 0) ||
- options.autosquash) {
+ (options.action != ACTION_NONE) ||
+ (options.exec.nr > 0) ||
+ (options.autosquash == -1 && options.config_autosquash == 1) ||
+ options.autosquash == 1) {
allow_preemptive_ff = 0;
}
if (options.committer_date_is_author_date || options.ignore_date)
@@ -1400,8 +1430,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
}
}
- for (i = 0; i < exec.nr; i++)
- if (check_exec_cmd(exec.items[i].string))
+ for (i = 0; i < options.exec.nr; i++)
+ if (check_exec_cmd(options.exec.items[i].string))
exit(1);
if (!(options.flags & REBASE_NO_QUIET))
@@ -1410,34 +1440,34 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
if (options.empty != EMPTY_UNSPECIFIED)
imply_merge(&options, "--empty");
- if (options.reapply_cherry_picks)
- imply_merge(&options, "--reapply-cherry-picks");
+ if (options.reapply_cherry_picks < 0)
+ /*
+ * We default to --no-reapply-cherry-picks unless
+ * --keep-base is given; when --keep-base is given, we want
+ * to default to --reapply-cherry-picks.
+ */
+ options.reapply_cherry_picks = keep_base;
+ else if (!keep_base)
+ /*
+ * The apply backend always searches for and drops cherry
+ * picks. This is often not wanted with --keep-base, so
+ * --keep-base allows --reapply-cherry-picks to be
+ * simulated by altering the upstream such that
+ * cherry-picks cannot be detected and thus all commits are
+ * reapplied. Thus, --[no-]reapply-cherry-picks is
+ * supported when --keep-base is specified, but not when
+ * --keep-base is left out.
+ */
+ imply_merge(&options, options.reapply_cherry_picks ?
+ "--reapply-cherry-picks" :
+ "--no-reapply-cherry-picks");
if (gpg_sign)
options.gpg_sign_opt = xstrfmt("-S%s", gpg_sign);
- if (exec.nr) {
- int i;
-
+ if (options.exec.nr)
imply_merge(&options, "--exec");
- strbuf_reset(&buf);
- for (i = 0; i < exec.nr; i++)
- strbuf_addf(&buf, "exec %s\n", exec.items[i].string);
- options.cmd = xstrdup(buf.buf);
- }
-
- if (rebase_merges) {
- if (!*rebase_merges)
- ; /* default mode; do nothing */
- else if (!strcmp("rebase-cousins", rebase_merges))
- options.rebase_cousins = 1;
- else if (strcmp("no-rebase-cousins", rebase_merges))
- die(_("Unknown mode: %s"), rebase_merges);
- options.rebase_merges = 1;
- imply_merge(&options, "--rebase-merges");
- }
-
if (options.type == REBASE_APPLY) {
if (ignore_whitespace)
strvec_push(&options.git_am_opts,
@@ -1450,23 +1480,13 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
} else {
/* REBASE_MERGE */
if (ignore_whitespace) {
- string_list_append(&strategy_options,
+ string_list_append(&options.strategy_opts,
"ignore-space-change");
}
}
- if (strategy_options.nr) {
- int i;
-
- if (!options.strategy)
- options.strategy = "ort";
-
- strbuf_reset(&buf);
- for (i = 0; i < strategy_options.nr; i++)
- strbuf_addf(&buf, " --%s",
- strategy_options.items[i].string);
- options.strategy_opts = xstrdup(buf.buf);
- }
+ if (options.strategy_opts.nr && !options.strategy)
+ options.strategy = "ort";
if (options.strategy) {
options.strategy = xstrdup(options.strategy);
@@ -1499,15 +1519,36 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
if (strcmp(options.git_am_opts.v[i], "-q"))
break;
- if (i >= 0) {
+ if (i >= 0 || options.type == REBASE_APPLY) {
if (is_merge(&options))
die(_("apply options and merge options "
"cannot be used together"));
+ else if (options.autosquash == -1 && options.config_autosquash == 1)
+ die(_("apply options are incompatible with rebase.autoSquash. Consider adding --no-autosquash"));
+ else if (options.rebase_merges == -1 && options.config_rebase_merges == 1)
+ die(_("apply options are incompatible with rebase.rebaseMerges. Consider adding --no-rebase-merges"));
+ else if (options.update_refs == -1 && options.config_update_refs == 1)
+ die(_("apply options are incompatible with rebase.updateRefs. Consider adding --no-update-refs"));
else
options.type = REBASE_APPLY;
}
}
+ if (options.update_refs == 1)
+ imply_merge(&options, "--update-refs");
+ options.update_refs = (options.update_refs >= 0) ? options.update_refs :
+ ((options.config_update_refs >= 0) ? options.config_update_refs : 0);
+
+ if (options.rebase_merges == 1)
+ imply_merge(&options, "--rebase-merges");
+ options.rebase_merges = (options.rebase_merges >= 0) ? options.rebase_merges :
+ ((options.config_rebase_merges >= 0) ? options.config_rebase_merges : 0);
+
+ if (options.autosquash == 1)
+ imply_merge(&options, "--autosquash");
+ options.autosquash = (options.autosquash >= 0) ? options.autosquash :
+ ((options.config_autosquash >= 0) ? options.config_autosquash : 0);
+
if (options.type == REBASE_UNSPECIFIED) {
if (!strcmp(options.default_backend, "merge"))
imply_merge(&options, "--merge");
@@ -1537,7 +1578,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
if (options.empty == EMPTY_UNSPECIFIED) {
if (options.flags & REBASE_INTERACTIVE_EXPLICIT)
options.empty = EMPTY_ASK;
- else if (exec.nr > 0)
+ else if (options.exec.nr > 0)
options.empty = EMPTY_KEEP;
else
options.empty = EMPTY_DROP;
@@ -1604,25 +1645,27 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
*/
if (argc == 1) {
/* Is it "rebase other branchname" or "rebase other commit"? */
+ struct object_id branch_oid;
branch_name = argv[0];
options.switch_to = argv[0];
/* Is it a local branch? */
strbuf_reset(&buf);
strbuf_addf(&buf, "refs/heads/%s", branch_name);
- if (!read_ref(buf.buf, &options.orig_head)) {
+ if (!read_ref(buf.buf, &branch_oid)) {
die_if_checked_out(buf.buf, 1);
options.head_name = xstrdup(buf.buf);
+ options.orig_head =
+ lookup_commit_object(the_repository,
+ &branch_oid);
/* If not is it a valid ref (branch or commit)? */
} else {
- struct commit *commit =
+ options.orig_head =
lookup_commit_reference_by_name(branch_name);
- if (!commit)
- die(_("no such branch/commit '%s'"),
- branch_name);
- oidcpy(&options.orig_head, &commit->object.oid);
options.head_name = NULL;
}
+ if (!options.orig_head)
+ die(_("no such branch/commit '%s'"), branch_name);
} else if (argc == 0) {
/* Do not need to switch branches, we are already on it. */
options.head_name =
@@ -1639,8 +1682,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
FREE_AND_NULL(options.head_name);
branch_name = "HEAD";
}
- if (get_oid("HEAD", &options.orig_head))
- die(_("Could not resolve HEAD to a revision"));
+ options.orig_head = lookup_commit_reference_by_name("HEAD");
+ if (!options.orig_head)
+ die(_("Could not resolve HEAD to a commit"));
} else
BUG("unexpected number of arguments left to parse");
@@ -1650,11 +1694,11 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
strbuf_addstr(&buf, options.upstream_name);
strbuf_addstr(&buf, "...");
strbuf_addstr(&buf, branch_name);
- options.onto_name = xstrdup(buf.buf);
+ options.onto_name = keep_base_onto_name = xstrdup(buf.buf);
} else if (!options.onto_name)
options.onto_name = options.upstream_name;
if (strstr(options.onto_name, "...")) {
- if (get_oid_mb(options.onto_name, &merge_base) < 0) {
+ if (repo_get_oid_mb(the_repository, options.onto_name, &branch_base) < 0) {
if (keep_base)
die(_("'%s': need exactly one merge base with branch"),
options.upstream_name);
@@ -1662,7 +1706,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
die(_("'%s': need exactly one merge base"),
options.onto_name);
}
- options.onto = lookup_commit_or_die(&merge_base,
+ options.onto = lookup_commit_or_die(&branch_base,
options.onto_name);
} else {
options.onto =
@@ -1670,15 +1714,15 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
if (!options.onto)
die(_("Does not point to a valid commit '%s'"),
options.onto_name);
+ fill_branch_base(&options, &branch_base);
}
- if (options.fork_point > 0) {
- struct commit *head =
- lookup_commit_reference(the_repository,
- &options.orig_head);
+ if (keep_base && options.reapply_cherry_picks)
+ options.upstream = options.onto;
+
+ if (options.fork_point > 0)
options.restrict_revision =
- get_fork_point(options.upstream_name, head);
- }
+ get_fork_point(options.upstream_name, options.orig_head);
if (repo_read_index(the_repository) < 0)
die(_("could not read index"));
@@ -1703,13 +1747,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
* Check if we are already based on onto with linear history,
* in which case we could fast-forward without replacing the commits
* with new commits recreated by replaying their changes.
- *
- * Note that can_fast_forward() initializes merge_base, so we have to
- * call it before checking allow_preemptive_ff.
*/
- if (can_fast_forward(options.onto, options.upstream, options.restrict_revision,
- &options.orig_head, &merge_base) &&
- allow_preemptive_ff) {
+ if (allow_preemptive_ff &&
+ can_fast_forward(options.onto, options.upstream, options.restrict_revision,
+ options.orig_head, &branch_base)) {
int flag;
if (!(options.flags & REBASE_FORCE)) {
@@ -1750,25 +1791,25 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
struct diff_options opts;
if (options.flags & REBASE_VERBOSE) {
- if (is_null_oid(&merge_base))
+ if (is_null_oid(&branch_base))
printf(_("Changes to %s:\n"),
oid_to_hex(&options.onto->object.oid));
else
printf(_("Changes from %s to %s:\n"),
- oid_to_hex(&merge_base),
+ oid_to_hex(&branch_base),
oid_to_hex(&options.onto->object.oid));
}
/* We want color (if set), but no pager */
- diff_setup(&opts);
+ repo_diff_setup(the_repository, &opts);
opts.stat_width = -1; /* use full terminal width */
opts.stat_graph_width = -1; /* respect statGraphWidth config */
opts.output_format |=
DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
opts.detect_rename = DIFF_DETECT_RENAME;
diff_setup_done(&opts);
- diff_tree_oid(is_null_oid(&merge_base) ?
- the_hash_algo->empty_tree : &merge_base,
+ diff_tree_oid(is_null_oid(&branch_base) ?
+ the_hash_algo->empty_tree : &branch_base,
&options.onto->object.oid, "", &opts);
diffcore_std(&opts);
diff_flush(&opts);
@@ -1782,14 +1823,14 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
printf(_("First, rewinding head to replay your work on top of "
"it...\n"));
- strbuf_addf(&msg, "%s: checkout %s",
- getenv(GIT_REFLOG_ACTION_ENVIRONMENT), options.onto_name);
+ strbuf_addf(&msg, "%s (start): checkout %s",
+ options.reflog_action, options.onto_name);
ropts.oid = &options.onto->object.oid;
- ropts.orig_head = &options.orig_head,
+ ropts.orig_head = &options.orig_head->object.oid,
ropts.flags = RESET_HEAD_DETACH | RESET_ORIG_HEAD |
RESET_HEAD_RUN_POST_CHECKOUT_HOOK;
ropts.head_msg = msg.buf;
- ropts.default_reflog_action = DEFAULT_REFLOG_ACTION;
+ ropts.default_reflog_action = options.reflog_action;
if (reset_head(the_repository, &ropts))
die(_("Could not detach HEAD"));
strbuf_release(&msg);
@@ -1798,19 +1839,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
* If the onto is a proper descendant of the tip of the branch, then
* we just fast-forwarded.
*/
- strbuf_reset(&msg);
- if (oideq(&merge_base, &options.orig_head)) {
+ if (oideq(&branch_base, &options.orig_head->object.oid)) {
printf(_("Fast-forwarded %s to %s.\n"),
branch_name, options.onto_name);
- strbuf_addf(&msg, "rebase finished: %s onto %s",
- options.head_name ? options.head_name : "detached HEAD",
- oid_to_hex(&options.onto->object.oid));
- memset(&ropts, 0, sizeof(ropts));
- ropts.branch = options.head_name;
- ropts.flags = RESET_HEAD_REFS_ONLY;
- ropts.head_msg = msg.buf;
- reset_head(the_repository, &ropts);
- strbuf_release(&msg);
+ move_to_original_branch(&options);
ret = finish_rebase(&options);
goto cleanup;
}
@@ -1820,21 +1852,25 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
(options.restrict_revision ?
oid_to_hex(&options.restrict_revision->object.oid) :
oid_to_hex(&options.upstream->object.oid)),
- oid_to_hex(&options.orig_head));
+ oid_to_hex(&options.orig_head->object.oid));
options.revisions = revisions.buf;
run_rebase:
- ret = run_specific_rebase(&options, action);
+ ret = run_specific_rebase(&options);
cleanup:
strbuf_release(&buf);
strbuf_release(&revisions);
+ free(options.reflog_action);
free(options.head_name);
+ strvec_clear(&options.git_am_opts);
free(options.gpg_sign_opt);
- free(options.cmd);
+ string_list_clear(&options.exec, 0);
free(options.strategy);
+ string_list_clear(&options.strategy_opts, 0);
strbuf_release(&options.git_format_patch_opt);
free(squash_onto_name);
+ free(keep_base_onto_name);
return !!ret;
}
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 44bcea3a5b..1a31a58367 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1,6 +1,10 @@
#include "builtin.h"
+#include "abspath.h"
#include "repository.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "pack.h"
#include "refs.h"
@@ -25,11 +29,17 @@
#include "tmp-objdir.h"
#include "oidset.h"
#include "packfile.h"
+#include "object-name.h"
#include "object-store.h"
#include "protocol.h"
#include "commit-reach.h"
+#include "server-info.h"
+#include "trace.h"
+#include "trace2.h"
#include "worktree.h"
#include "shallow.h"
+#include "parse-options.h"
+#include "wrapper.h"
static const char * const receive_pack_usage[] = {
N_("git receive-pack <git-dir>"),
@@ -80,6 +90,7 @@ static struct object_id push_cert_oid;
static struct signature_check sigcheck;
static const char *push_cert_nonce;
static const char *cert_nonce_seed;
+static struct string_list hidden_refs = STRING_LIST_INIT_DUP;
static const char *NONCE_UNSOLICITED = "UNSOLICITED";
static const char *NONCE_BAD = "BAD";
@@ -130,15 +141,11 @@ static enum deny_action parse_deny_action(const char *var, const char *value)
static int receive_pack_config(const char *var, const char *value, void *cb)
{
- int status = parse_hide_refs_config(var, value, "receive");
+ int status = parse_hide_refs_config(var, value, "receive", &hidden_refs);
if (status)
return status;
- status = git_gpg_config(var, value, NULL);
- if (status)
- return status;
-
if (strcmp(var, "receive.denydeletes") == 0) {
deny_deletes = git_config_bool(var, value);
return 0;
@@ -296,7 +303,7 @@ static int show_ref_cb(const char *path_full, const struct object_id *oid,
struct oidset *seen = data;
const char *path = strip_namespace(path_full);
- if (ref_is_hidden(path, path_full))
+ if (ref_is_hidden(path, path_full, &hidden_refs))
return 0;
/*
@@ -1346,7 +1353,7 @@ static int head_has_history(void)
{
struct object_id oid;
- return !get_oid("HEAD", &oid);
+ return !repo_get_oid(the_repository, "HEAD", &oid);
}
static const char *push_to_deploy(unsigned char *sha1,
@@ -1462,8 +1469,10 @@ static const char *update(struct command *cmd, struct shallow_info *si)
find_shared_symref(worktrees, "HEAD", name);
/* only refs/... are allowed */
- if (!starts_with(name, "refs/") || check_refname_format(name + 5, 0)) {
- rp_error("refusing to create funny ref '%s' remotely", name);
+ if (!starts_with(name, "refs/") ||
+ check_refname_format(name + 5, is_null_oid(new_oid) ?
+ REFNAME_ALLOW_ONELEVEL : 0)) {
+ rp_error("refusing to update funny ref '%s' remotely", name);
ret = "funny refname";
goto out;
}
@@ -1493,7 +1502,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)
}
}
- if (!is_null_oid(new_oid) && !has_object_file(new_oid)) {
+ if (!is_null_oid(new_oid) && !repo_has_object_file(the_repository, new_oid)) {
error("unpack should have generated %s, "
"but I can't find it!", oid_to_hex(new_oid));
ret = "bad pack";
@@ -1547,7 +1556,7 @@ static const char *update(struct command *cmd, struct shallow_info *si)
}
old_commit = (struct commit *)old_object;
new_commit = (struct commit *)new_object;
- if (!in_merge_bases(old_commit, new_commit)) {
+ if (!repo_in_merge_bases(the_repository, old_commit, new_commit)) {
rp_error("denying non-fast-forward %s"
" (you should pull first)", name);
ret = "non-fast-forward";
@@ -1680,11 +1689,11 @@ static void check_aliased_update_internal(struct command *cmd,
rp_error("refusing inconsistent update between symref '%s' (%s..%s) and"
" its target '%s' (%s..%s)",
cmd->ref_name,
- find_unique_abbrev(&cmd->old_oid, DEFAULT_ABBREV),
- find_unique_abbrev(&cmd->new_oid, DEFAULT_ABBREV),
+ repo_find_unique_abbrev(the_repository, &cmd->old_oid, DEFAULT_ABBREV),
+ repo_find_unique_abbrev(the_repository, &cmd->new_oid, DEFAULT_ABBREV),
dst_cmd->ref_name,
- find_unique_abbrev(&dst_cmd->old_oid, DEFAULT_ABBREV),
- find_unique_abbrev(&dst_cmd->new_oid, DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, &dst_cmd->old_oid, DEFAULT_ABBREV),
+ repo_find_unique_abbrev(the_repository, &dst_cmd->new_oid, DEFAULT_ABBREV));
cmd->error_string = dst_cmd->error_string =
"inconsistent aliased update";
@@ -1794,7 +1803,7 @@ static void reject_updates_to_hidden(struct command *commands)
strbuf_setlen(&refname_full, prefix_len);
strbuf_addstr(&refname_full, cmd->ref_name);
- if (!ref_is_hidden(cmd->ref_name, refname_full.buf))
+ if (!ref_is_hidden(cmd->ref_name, refname_full.buf, &hidden_refs))
continue;
if (is_null_oid(&cmd->new_oid))
cmd->error_string = "deny deleting a hidden ref";
@@ -1928,6 +1937,8 @@ static void execute_commands(struct command *commands,
opt.err_fd = err_fd;
opt.progress = err_fd && !quiet;
opt.env = tmp_objdir_env(tmp_objdir);
+ opt.exclude_hidden_refs_section = "receive";
+
if (check_connected(iterate_receive_command_list, &data, &opt))
set_connectivity_errors(commands, si);
@@ -2029,6 +2040,16 @@ static struct command **queue_command(struct command **tail,
return &cmd->next;
}
+static void free_commands(struct command *commands)
+{
+ while (commands) {
+ struct command *next = commands->next;
+
+ free(commands);
+ commands = next;
+ }
+}
+
static void queue_commands_from_cert(struct command **tail,
struct strbuf *push_cert)
{
@@ -2076,7 +2097,7 @@ static struct command *read_head_info(struct packet_reader *reader,
const char *feature_list = reader->line + linelen + 1;
const char *hash = NULL;
const char *client_sid;
- int len = 0;
+ size_t len = 0;
if (parse_feature_request(feature_list, "report-status"))
report_status = 1;
if (parse_feature_request(feature_list, "report-status-v2"))
@@ -2171,7 +2192,7 @@ static const char *parse_pack_header(struct pack_header *hdr)
}
}
-static const char *pack_lockfile;
+static struct tempfile *pack_lockfile;
static void push_header_arg(struct strvec *args, struct pack_header *hdr)
{
@@ -2238,6 +2259,7 @@ static const char *unpack(int err_fd, struct shallow_info *si)
return "unpack-objects abnormal exit";
} else {
char hostname[HOST_NAME_MAX + 1];
+ char *lockfile;
strvec_pushl(&child.args, "index-pack", "--stdin", NULL);
push_header_arg(&child.args, &hdr);
@@ -2267,8 +2289,14 @@ static const char *unpack(int err_fd, struct shallow_info *si)
status = start_command(&child);
if (status)
return "index-pack fork failed";
- pack_lockfile = index_pack_lockfile(child.out, NULL);
+
+ lockfile = index_pack_lockfile(child.out, NULL);
+ if (lockfile) {
+ pack_lockfile = register_tempfile(lockfile);
+ free(lockfile);
+ }
close(child.out);
+
status = finish_command(&child);
if (status)
return "index-pack abnormal exit";
@@ -2555,8 +2583,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
use_keepalive = KEEPALIVE_ALWAYS;
execute_commands(commands, unpack_status, &si,
&push_options);
- if (pack_lockfile)
- unlink_or_warn(pack_lockfile);
+ delete_tempfile(&pack_lockfile);
sigchain_push(SIGPIPE, SIG_IGN);
if (report_status_v2)
report_v2(commands, unpack_status);
@@ -2566,6 +2593,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
run_receive_hook(commands, "post-receive", 1,
&push_options);
run_update_post_hook(commands);
+ free_commands(commands);
string_list_clear(&push_options, 0);
if (auto_gc) {
struct child_process proc = CHILD_PROCESS_INIT;
@@ -2591,6 +2619,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
packet_flush(1);
oid_array_clear(&shallow);
oid_array_clear(&ref);
+ string_list_clear(&hidden_refs, 0);
free((void *)push_cert_nonce);
return 0;
}
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 57c5c0d061..a1fa0c855f 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -1,9 +1,11 @@
#include "builtin.h"
#include "config.h"
+#include "gettext.h"
#include "revision.h"
#include "reachable.h"
#include "worktree.h"
#include "reflog.h"
+#include "parse-options.h"
#define BUILTIN_REFLOG_SHOW_USAGE \
N_("git reflog [show] [<log-options>] [<ref>]")
@@ -67,7 +69,8 @@ static int collect_reflog(const char *ref, const struct object_id *oid UNUSED,
* Avoid collecting the same shared ref multiple times because
* they are available via all worktrees.
*/
- if (!worktree->is_current && ref_type(ref) == REF_TYPE_NORMAL)
+ if (!worktree->is_current &&
+ parse_worktree_ref(ref, NULL, NULL, NULL) == REF_WORKTREE_SHARED)
return 0;
strbuf_worktree_ref(worktree, &newref, ref);
diff --git a/builtin/remote-ext.c b/builtin/remote-ext.c
index fd3538d4f0..282782eccd 100644
--- a/builtin/remote-ext.c
+++ b/builtin/remote-ext.c
@@ -169,6 +169,8 @@ static int command_loop(const char *child)
while (1) {
size_t i;
+ const char *arg;
+
if (!fgets(buffer, MAXCOMMAND - 1, stdin)) {
if (ferror(stdin))
die("Command input error");
@@ -182,10 +184,10 @@ static int command_loop(const char *child)
if (!strcmp(buffer, "capabilities")) {
printf("*connect\n\n");
fflush(stdout);
- } else if (!strncmp(buffer, "connect ", 8)) {
+ } else if (skip_prefix(buffer, "connect ", &arg)) {
printf("\n");
fflush(stdout);
- return run_child(child, buffer + 8);
+ return run_child(child, arg);
} else {
fprintf(stderr, "Bad command");
return 1;
@@ -195,6 +197,8 @@ static int command_loop(const char *child)
int cmd_remote_ext(int argc, const char **argv, const char *prefix)
{
+ BUG_ON_NON_EMPTY_PREFIX(prefix);
+
if (argc != 3)
usage(usage_msg);
diff --git a/builtin/remote-fd.c b/builtin/remote-fd.c
index 91dfe07e06..9020fab9c5 100644
--- a/builtin/remote-fd.c
+++ b/builtin/remote-fd.c
@@ -40,7 +40,7 @@ static void command_loop(int input_fd, int output_fd)
if (!strcmp(buffer, "capabilities")) {
printf("*connect\n\n");
fflush(stdout);
- } else if (!strncmp(buffer, "connect ", 8)) {
+ } else if (starts_with(buffer, "connect ")) {
printf("\n");
fflush(stdout);
if (bidirectional_transfer_loop(input_fd,
@@ -59,6 +59,8 @@ int cmd_remote_fd(int argc, const char **argv, const char *prefix)
int output_fd = -1;
char *end;
+ BUG_ON_NON_EMPTY_PREFIX(prefix);
+
if (argc != 3)
usage(usage_msg);
diff --git a/builtin/remote.c b/builtin/remote.c
index 910f7b9316..1e0b137d97 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -1,5 +1,6 @@
#include "builtin.h"
#include "config.h"
+#include "gettext.h"
#include "parse-options.h"
#include "transport.h"
#include "remote.h"
@@ -92,13 +93,15 @@ static int verbose;
static int fetch_remote(const char *name)
{
- const char *argv[] = { "fetch", name, NULL, NULL };
- if (verbose) {
- argv[1] = "-v";
- argv[2] = name;
- }
+ struct child_process cmd = CHILD_PROCESS_INIT;
+
+ strvec_push(&cmd.args, "fetch");
+ if (verbose)
+ strvec_push(&cmd.args, "-v");
+ strvec_push(&cmd.args, name);
+ cmd.git_cmd = 1;
printf_ln(_("Updating %s"), name);
- if (run_command_v_opt(argv, RUN_GIT_CMD))
+ if (run_command(&cmd))
return error(_("Could not fetch %s"), name);
return 0;
}
@@ -441,7 +444,7 @@ static int get_push_ref_states(const struct ref *remote_refs,
info->status = PUSH_STATUS_UPTODATE;
else if (is_null_oid(&ref->old_oid))
info->status = PUSH_STATUS_CREATE;
- else if (has_object_file(&ref->old_oid) &&
+ else if (repo_has_object_file(the_repository, &ref->old_oid) &&
ref_newer(&ref->new_oid, &ref->old_oid))
info->status = PUSH_STATUS_FASTFORWARD;
else
@@ -942,7 +945,7 @@ static int rm(int argc, const char **argv, const char *prefix)
return result;
}
-static void clear_push_info(void *util, const char *string)
+static void clear_push_info(void *util, const char *string UNUSED)
{
struct push_info *info = util;
free(info->dest);
@@ -1508,37 +1511,35 @@ static int update(int argc, const char **argv, const char *prefix)
N_("prune remotes after fetching")),
OPT_END()
};
- struct strvec fetch_argv = STRVEC_INIT;
+ struct child_process cmd = CHILD_PROCESS_INIT;
int default_defined = 0;
- int retval;
argc = parse_options(argc, argv, prefix, options,
builtin_remote_update_usage,
PARSE_OPT_KEEP_ARGV0);
- strvec_push(&fetch_argv, "fetch");
+ strvec_push(&cmd.args, "fetch");
if (prune != -1)
- strvec_push(&fetch_argv, prune ? "--prune" : "--no-prune");
+ strvec_push(&cmd.args, prune ? "--prune" : "--no-prune");
if (verbose)
- strvec_push(&fetch_argv, "-v");
- strvec_push(&fetch_argv, "--multiple");
+ strvec_push(&cmd.args, "-v");
+ strvec_push(&cmd.args, "--multiple");
if (argc < 2)
- strvec_push(&fetch_argv, "default");
+ strvec_push(&cmd.args, "default");
for (i = 1; i < argc; i++)
- strvec_push(&fetch_argv, argv[i]);
+ strvec_push(&cmd.args, argv[i]);
- if (strcmp(fetch_argv.v[fetch_argv.nr-1], "default") == 0) {
+ if (strcmp(cmd.args.v[cmd.args.nr-1], "default") == 0) {
git_config(get_remote_default, &default_defined);
if (!default_defined) {
- strvec_pop(&fetch_argv);
- strvec_push(&fetch_argv, "--all");
+ strvec_pop(&cmd.args);
+ strvec_push(&cmd.args, "--all");
}
}
- retval = run_command_v_opt(fetch_argv.v, RUN_GIT_CMD);
- strvec_clear(&fetch_argv);
- return retval;
+ cmd.git_cmd = 1;
+ return run_command(&cmd);
}
static int remove_all_fetch_refspecs(const char *key)
diff --git a/builtin/repack.c b/builtin/repack.c
index a5bacc7797..0541c3ce15 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -1,9 +1,13 @@
#include "builtin.h"
-#include "cache.h"
+#include "alloc.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "parse-options.h"
#include "run-command.h"
+#include "server-info.h"
#include "sigchain.h"
#include "strbuf.h"
#include "string-list.h"
@@ -32,7 +36,6 @@ static int write_bitmaps = -1;
static int use_delta_islands;
static int run_update_server_info = 1;
static char *packdir, *packtmp_name, *packtmp;
-static char *cruft_expiration;
static const char *const git_repack_usage[] = {
N_("git repack [<options>]"),
@@ -92,44 +95,6 @@ static int repack_config(const char *var, const char *value, void *cb)
}
/*
- * Remove temporary $GIT_OBJECT_DIRECTORY/pack/.tmp-$$-pack-* files.
- */
-static void remove_temporary_files(void)
-{
- struct strbuf buf = STRBUF_INIT;
- size_t dirlen, prefixlen;
- DIR *dir;
- struct dirent *e;
-
- dir = opendir(packdir);
- if (!dir)
- return;
-
- /* Point at the slash at the end of ".../objects/pack/" */
- dirlen = strlen(packdir) + 1;
- strbuf_addstr(&buf, packtmp);
- /* Hold the length of ".tmp-%d-pack-" */
- prefixlen = buf.len - dirlen;
-
- while ((e = readdir(dir))) {
- if (strncmp(e->d_name, buf.buf + dirlen, prefixlen))
- continue;
- strbuf_setlen(&buf, dirlen);
- strbuf_addstr(&buf, e->d_name);
- unlink(buf.buf);
- }
- closedir(dir);
- strbuf_release(&buf);
-}
-
-static void remove_pack_on_signal(int signo)
-{
- remove_temporary_files();
- sigchain_pop(signo);
- raise(signo);
-}
-
-/*
* Adds all packs hex strings to either fname_nonkept_list or
* fname_kept_list based on whether each pack has a corresponding
* .keep file or not. Packs without a .keep file are not to be kept
@@ -188,7 +153,8 @@ static void remove_redundant_pack(const char *dir_name, const char *base_name)
}
static void prepare_pack_objects(struct child_process *cmd,
- const struct pack_objects_args *args)
+ const struct pack_objects_args *args,
+ const char *out)
{
strvec_push(&cmd->args, "pack-objects");
if (args->window)
@@ -211,7 +177,7 @@ static void prepare_pack_objects(struct child_process *cmd,
strvec_push(&cmd->args, "--quiet");
if (delta_base_offset)
strvec_push(&cmd->args, "--delta-base-offset");
- strvec_push(&cmd->args, packtmp);
+ strvec_push(&cmd->args, out);
cmd->git_cmd = 1;
cmd->out = -1;
}
@@ -220,8 +186,9 @@ static void prepare_pack_objects(struct child_process *cmd,
* Write oid to the given struct child_process's stdin, starting it first if
* necessary.
*/
-static int write_oid(const struct object_id *oid, struct packed_git *pack,
- uint32_t pos, void *data)
+static int write_oid(const struct object_id *oid,
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED, void *data)
{
struct child_process *cmd = data;
@@ -247,11 +214,15 @@ static struct {
{".idx"},
};
-static unsigned populate_pack_exts(char *name)
+struct generated_pack_data {
+ struct tempfile *tempfiles[ARRAY_SIZE(exts)];
+};
+
+static struct generated_pack_data *populate_pack_exts(const char *name)
{
struct stat statbuf;
struct strbuf path = STRBUF_INIT;
- unsigned ret = 0;
+ struct generated_pack_data *data = xcalloc(1, sizeof(*data));
int i;
for (i = 0; i < ARRAY_SIZE(exts); i++) {
@@ -261,11 +232,11 @@ static unsigned populate_pack_exts(char *name)
if (stat(path.buf, &statbuf))
continue;
- ret |= (1 << i);
+ data->tempfiles[i] = register_tempfile(path.buf);
}
strbuf_release(&path);
- return ret;
+ return data;
}
static void repack_promisor_objects(const struct pack_objects_args *args,
@@ -275,7 +246,7 @@ static void repack_promisor_objects(const struct pack_objects_args *args,
FILE *out;
struct strbuf line = STRBUF_INIT;
- prepare_pack_objects(&cmd, args);
+ prepare_pack_objects(&cmd, args, packtmp);
cmd.in = -1;
/*
@@ -320,7 +291,7 @@ static void repack_promisor_objects(const struct pack_objects_args *args,
line.buf);
write_promisor_file(promisor_name, NULL, 0);
- item->util = (void *)(uintptr_t)populate_pack_exts(item->string);
+ item->util = populate_pack_exts(item->string);
free(promisor_name);
}
@@ -355,7 +326,8 @@ static int geometry_cmp(const void *va, const void *vb)
}
static void init_pack_geometry(struct pack_geometry **geometry_p,
- struct string_list *existing_kept_packs)
+ struct string_list *existing_kept_packs,
+ const struct pack_objects_args *args)
{
struct packed_git *p;
struct pack_geometry *geometry;
@@ -365,6 +337,14 @@ static void init_pack_geometry(struct pack_geometry **geometry_p,
geometry = *geometry_p;
for (p = get_all_packs(the_repository); p; p = p->next) {
+ if (args->local && !p->pack_local)
+ /*
+ * When asked to only repack local packfiles we skip
+ * over any packfiles that are borrowed from alternate
+ * object directories.
+ */
+ continue;
+
if (!pack_kept_objects) {
/*
* Any pack that has its pack_keep bit set will appear
@@ -478,8 +458,10 @@ static void split_pack_geometry(struct pack_geometry *geometry, int factor)
geometry->split = split;
}
-static struct packed_git *get_largest_active_pack(struct pack_geometry *geometry)
+static struct packed_git *get_preferred_pack(struct pack_geometry *geometry)
{
+ uint32_t i;
+
if (!geometry) {
/*
* No geometry means either an all-into-one repack (in which
@@ -494,7 +476,21 @@ static struct packed_git *get_largest_active_pack(struct pack_geometry *geometry
}
if (geometry->split == geometry->pack_nr)
return NULL;
- return geometry->pack[geometry->pack_nr - 1];
+
+ /*
+ * The preferred pack is the largest pack above the split line. In
+ * other words, it is the largest pack that does not get rolled up in
+ * the geometric repack.
+ */
+ for (i = geometry->pack_nr; i > geometry->split; i--)
+ /*
+ * A pack that is not local would never be included in a
+ * multi-pack index. We thus skip over any non-local packs.
+ */
+ if (geometry->pack[i - 1]->pack_local)
+ return geometry->pack[i - 1];
+
+ return NULL;
}
static void clear_pack_geometry(struct pack_geometry *geometry)
@@ -588,6 +584,17 @@ static void midx_included_packs(struct string_list *include,
for (i = geometry->split; i < geometry->pack_nr; i++) {
struct packed_git *p = geometry->pack[i];
+ /*
+ * The multi-pack index never refers to packfiles part
+ * of an alternate object database, so we skip these.
+ * While git-multi-pack-index(1) would silently ignore
+ * them anyway, this allows us to skip executing the
+ * command completely when we have only non-local
+ * packfiles.
+ */
+ if (!p->pack_local)
+ continue;
+
strbuf_addstr(&buf, pack_basename(p));
strbuf_strip_suffix(&buf, ".pack");
strbuf_addstr(&buf, ".idx");
@@ -621,7 +628,7 @@ static int write_midx_included_packs(struct string_list *include,
{
struct child_process cmd = CHILD_PROCESS_INIT;
struct string_list_item *item;
- struct packed_git *largest = get_largest_active_pack(geometry);
+ struct packed_git *preferred = get_preferred_pack(geometry);
FILE *in;
int ret;
@@ -642,9 +649,9 @@ static int write_midx_included_packs(struct string_list *include,
if (write_bitmaps)
strvec_push(&cmd.args, "--bitmap");
- if (largest)
+ if (preferred)
strvec_pushf(&cmd.args, "--preferred-pack=%s",
- pack_basename(largest));
+ pack_basename(preferred));
if (refs_snapshot)
strvec_pushf(&cmd.args, "--refs-snapshot=%s", refs_snapshot);
@@ -661,8 +668,39 @@ static int write_midx_included_packs(struct string_list *include,
return finish_command(&cmd);
}
+static void remove_redundant_bitmaps(struct string_list *include,
+ const char *packdir)
+{
+ struct strbuf path = STRBUF_INIT;
+ struct string_list_item *item;
+ size_t packdir_len;
+
+ strbuf_addstr(&path, packdir);
+ strbuf_addch(&path, '/');
+ packdir_len = path.len;
+
+ /*
+ * Remove any pack bitmaps corresponding to packs which are now
+ * included in the MIDX.
+ */
+ for_each_string_list_item(item, include) {
+ strbuf_addstr(&path, item->string);
+ strbuf_strip_suffix(&path, ".idx");
+ strbuf_addstr(&path, ".bitmap");
+
+ if (unlink(path.buf) && errno != ENOENT)
+ warning_errno(_("could not remove stale bitmap: %s"),
+ path.buf);
+
+ strbuf_setlen(&path, packdir_len);
+ }
+ strbuf_release(&path);
+}
+
static int write_cruft_pack(const struct pack_objects_args *args,
+ const char *destination,
const char *pack_prefix,
+ const char *cruft_expiration,
struct string_list *names,
struct string_list *existing_packs,
struct string_list *existing_kept_packs)
@@ -672,8 +710,10 @@ static int write_cruft_pack(const struct pack_objects_args *args,
struct string_list_item *item;
FILE *in, *out;
int ret;
+ const char *scratch;
+ int local = skip_prefix(destination, packdir, &scratch);
- prepare_pack_objects(&cmd, args);
+ prepare_pack_objects(&cmd, args, destination);
strvec_push(&cmd.args, "--cruft");
if (cruft_expiration)
@@ -698,6 +738,10 @@ static int write_cruft_pack(const struct pack_objects_args *args,
* By the time it is read here, it contains only the pack(s)
* that were just written, which is exactly the set of packs we
* want to consider kept.
+ *
+ * If `--expire-to` is given, the double-use served by `names`
+ * ensures that the pack written to `--expire-to` excludes any
+ * objects contained in the cruft pack.
*/
in = xfdopen(cmd.in, "w");
for_each_string_list_item(item, names)
@@ -710,10 +754,19 @@ static int write_cruft_pack(const struct pack_objects_args *args,
out = xfdopen(cmd.out, "r");
while (strbuf_getline_lf(&line, out) != EOF) {
+ struct string_list_item *item;
+
if (line.len != the_hash_algo->hexsz)
die(_("repack: Expecting full hex object ID lines only "
"from pack-objects."));
- string_list_append(names, line.buf);
+ /*
+ * avoid putting packs written outside of the repository in the
+ * list of names
+ */
+ if (local) {
+ item = string_list_append(names, line.buf);
+ item->util = populate_pack_exts(line.buf);
+ }
}
fclose(out);
@@ -745,6 +798,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
struct pack_objects_args cruft_po_args = {NULL};
int geometric_factor = 0;
int write_midx = 0;
+ const char *cruft_expiration = NULL;
+ const char *expire_to = NULL;
struct option builtin_repack_options[] = {
OPT_BIT('a', NULL, &pack_everything,
@@ -756,7 +811,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
N_("same as -a, pack unreachable cruft objects separately"),
PACK_CRUFT),
OPT_STRING(0, "cruft-expiration", &cruft_expiration, N_("approxidate"),
- N_("with -C, expire objects older than this")),
+ N_("with --cruft, expire objects older than this")),
OPT_BOOL('d', NULL, &delete_redundant,
N_("remove redundant packs, and run git-prune-packed")),
OPT_BOOL('f', NULL, &po_args.no_reuse_delta,
@@ -794,6 +849,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
N_("find a geometric progression with factor <N>")),
OPT_BOOL('m', "write-midx", &write_midx,
N_("write a multi-pack index of the resulting packs")),
+ OPT_STRING(0, "expire-to", &expire_to, N_("dir"),
+ N_("pack prefix to store a pack containing pruned objects")),
OPT_END()
};
@@ -833,6 +890,18 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
if (write_bitmaps && !(pack_everything & ALL_INTO_ONE) && !write_midx)
die(_(incremental_bitmap_conflict_error));
+ if (write_bitmaps && po_args.local && has_alt_odb(the_repository)) {
+ /*
+ * When asked to do a local repack, but we have
+ * packfiles that are inherited from an alternate, then
+ * we cannot guarantee that the multi-pack-index would
+ * have full coverage of all objects. We thus disable
+ * writing bitmaps in that case.
+ */
+ warning(_("disabling bitmap writing, as some objects are not being packed"));
+ write_bitmaps = 0;
+ }
+
if (write_midx && write_bitmaps) {
struct strbuf path = STRBUF_INIT;
@@ -855,13 +924,11 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
if (geometric_factor) {
if (pack_everything)
die(_("options '%s' and '%s' cannot be used together"), "--geometric", "-A/-a");
- init_pack_geometry(&geometry, &existing_kept_packs);
+ init_pack_geometry(&geometry, &existing_kept_packs, &po_args);
split_pack_geometry(geometry, geometric_factor);
}
- sigchain_push_common(remove_pack_on_signal);
-
- prepare_pack_objects(&cmd, &po_args);
+ prepare_pack_objects(&cmd, &po_args, packtmp);
show_progress = !po_args.quiet && isatty(2);
@@ -887,7 +954,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
strvec_push(&cmd.args, "--reflog");
strvec_push(&cmd.args, "--indexed-objects");
}
- if (has_promisor_remote())
+ if (repo_has_promisor_remote(the_repository))
strvec_push(&cmd.args, "--exclude-promisor-objects");
if (!write_midx) {
if (write_bitmaps > 0)
@@ -934,7 +1001,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
ret = start_command(&cmd);
if (ret)
- return ret;
+ goto cleanup;
if (geometry) {
FILE *in = xfdopen(cmd.in, "w");
@@ -952,14 +1019,18 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
out = xfdopen(cmd.out, "r");
while (strbuf_getline_lf(&line, out) != EOF) {
+ struct string_list_item *item;
+
if (line.len != the_hash_algo->hexsz)
die(_("repack: Expecting full hex object ID lines only from pack-objects."));
- string_list_append(&names, line.buf);
+ item = string_list_append(&names, line.buf);
+ item->util = populate_pack_exts(item->string);
}
+ strbuf_release(&line);
fclose(out);
ret = finish_command(&cmd);
if (ret)
- return ret;
+ goto cleanup;
if (!names.nr && !po_args.quiet)
printf_ln(_("Nothing new to pack."));
@@ -984,49 +1055,81 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
cruft_po_args.local = po_args.local;
cruft_po_args.quiet = po_args.quiet;
- ret = write_cruft_pack(&cruft_po_args, pack_prefix, &names,
+ ret = write_cruft_pack(&cruft_po_args, packtmp, pack_prefix,
+ cruft_expiration, &names,
&existing_nonkept_packs,
&existing_kept_packs);
if (ret)
- return ret;
+ goto cleanup;
+
+ if (delete_redundant && expire_to) {
+ /*
+ * If `--expire-to` is given with `-d`, it's possible
+ * that we're about to prune some objects. With cruft
+ * packs, pruning is implicit: any objects from existing
+ * packs that weren't picked up by new packs are removed
+ * when their packs are deleted.
+ *
+ * Generate an additional cruft pack, with one twist:
+ * `names` now includes the name of the cruft pack
+ * written in the previous step. So the contents of
+ * _this_ cruft pack exclude everything contained in the
+ * existing cruft pack (that is, all of the unreachable
+ * objects which are no older than
+ * `--cruft-expiration`).
+ *
+ * To make this work, cruft_expiration must become NULL
+ * so that this cruft pack doesn't actually prune any
+ * objects. If it were non-NULL, this call would always
+ * generate an empty pack (since every object not in the
+ * cruft pack generated above will have an mtime older
+ * than the expiration).
+ */
+ ret = write_cruft_pack(&cruft_po_args, expire_to,
+ pack_prefix,
+ NULL,
+ &names,
+ &existing_nonkept_packs,
+ &existing_kept_packs);
+ if (ret)
+ goto cleanup;
+ }
}
string_list_sort(&names);
- for_each_string_list_item(item, &names) {
- item->util = (void *)(uintptr_t)populate_pack_exts(item->string);
- }
-
close_object_store(the_repository->objects);
/*
* Ok we have prepared all new packfiles.
*/
for_each_string_list_item(item, &names) {
+ struct generated_pack_data *data = item->util;
+
for (ext = 0; ext < ARRAY_SIZE(exts); ext++) {
- char *fname, *fname_old;
+ char *fname;
fname = mkpathdup("%s/pack-%s%s",
packdir, item->string, exts[ext].name);
- fname_old = mkpathdup("%s-%s%s",
- packtmp, item->string, exts[ext].name);
- if (((uintptr_t)item->util) & ((uintptr_t)1 << ext)) {
+ if (data->tempfiles[ext]) {
+ const char *fname_old = get_tempfile_path(data->tempfiles[ext]);
struct stat statbuffer;
+
if (!stat(fname_old, &statbuffer)) {
statbuffer.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
chmod(fname_old, statbuffer.st_mode);
}
- if (rename(fname_old, fname))
- die_errno(_("renaming '%s' failed"), fname_old);
+ if (rename_tempfile(&data->tempfiles[ext], fname))
+ die_errno(_("renaming pack to '%s' failed"), fname);
} else if (!exts[ext].optional)
- die(_("missing required file: %s"), fname_old);
+ die(_("pack-objects did not write a '%s' file for pack %s-%s"),
+ exts[ext].name, packtmp, item->string);
else if (unlink(fname) < 0 && errno != ENOENT)
die_errno(_("could not unlink: %s"), fname);
free(fname);
- free(fname_old);
}
}
/* End of pack replacement. */
@@ -1059,10 +1162,13 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
refs_snapshot ? get_tempfile_path(refs_snapshot) : NULL,
show_progress, write_bitmaps > 0);
+ if (!ret && write_bitmaps)
+ remove_redundant_bitmaps(&include, packdir);
+
string_list_clear(&include, 0);
if (ret)
- return ret;
+ goto cleanup;
}
reprepare_packed_git(the_repository);
@@ -1089,6 +1195,11 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
strbuf_addstr(&buf, pack_basename(p));
strbuf_strip_suffix(&buf, ".pack");
+ if ((p->pack_keep) ||
+ (string_list_has_string(&existing_kept_packs,
+ buf.buf)))
+ continue;
+
remove_redundant_pack(packdir, buf.buf);
}
strbuf_release(&buf);
@@ -1106,7 +1217,6 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
if (run_update_server_info)
update_server_info(0);
- remove_temporary_files();
if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0)) {
unsigned flags = 0;
@@ -1115,11 +1225,11 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
write_midx_file(get_object_directory(), NULL, NULL, flags);
}
- string_list_clear(&names, 0);
+cleanup:
+ string_list_clear(&names, 1);
string_list_clear(&existing_nonkept_packs, 0);
string_list_clear(&existing_kept_packs, 0);
clear_pack_geometry(geometry);
- strbuf_release(&line);
- return 0;
+ return ret;
}
diff --git a/builtin/replace.c b/builtin/replace.c
index a29e911d30..981f189443 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -11,10 +11,17 @@
#include "cache.h"
#include "config.h"
#include "builtin.h"
+#include "editor.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
#include "parse-options.h"
#include "run-command.h"
+#include "object-file.h"
+#include "object-name.h"
#include "object-store.h"
+#include "replace-object.h"
#include "repository.h"
#include "tag.h"
@@ -54,7 +61,7 @@ static int show_reference(struct repository *r, const char *refname,
struct object_id object;
enum object_type obj_type, repl_type;
- if (get_oid(refname, &object))
+ if (repo_get_oid(r, refname, &object))
return error(_("failed to resolve '%s' as a valid ref"), refname);
obj_type = oid_object_info(r, &object, NULL);
@@ -112,7 +119,7 @@ static int for_each_replace_name(const char **argv, each_replace_name_fn fn)
base_len = ref.len;
for (p = argv; *p; p++) {
- if (get_oid(*p, &oid)) {
+ if (repo_get_oid(the_repository, *p, &oid)) {
error("failed to resolve '%s' as a valid ref", *p);
had_error = 1;
continue;
@@ -206,10 +213,10 @@ static int replace_object(const char *object_ref, const char *replace_ref, int f
{
struct object_id object, repl;
- if (get_oid(object_ref, &object))
+ if (repo_get_oid(the_repository, object_ref, &object))
return error(_("failed to resolve '%s' as a valid ref"),
object_ref);
- if (get_oid(replace_ref, &repl))
+ if (repo_get_oid(the_repository, replace_ref, &repl))
return error(_("failed to resolve '%s' as a valid ref"),
replace_ref);
@@ -320,7 +327,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)
struct object_id old_oid, new_oid, prev;
struct strbuf ref = STRBUF_INIT;
- if (get_oid(object_ref, &old_oid) < 0)
+ if (repo_get_oid(the_repository, object_ref, &old_oid) < 0)
return error(_("not a valid object name: '%s'"), object_ref);
type = oid_object_info(the_repository, &old_oid, NULL);
@@ -375,7 +382,7 @@ static int replace_parents(struct strbuf *buf, int argc, const char **argv)
struct object_id oid;
struct commit *commit;
- if (get_oid(argv[i], &oid) < 0) {
+ if (repo_get_oid(the_repository, argv[i], &oid) < 0) {
strbuf_release(&new_parents);
return error(_("not a valid object name: '%s'"),
argv[i]);
@@ -422,7 +429,7 @@ static int check_one_mergetag(struct commit *commit,
/* iterate over new parents */
for (i = 1; i < mergetag_data->argc; i++) {
struct object_id oid;
- if (get_oid(mergetag_data->argv[i], &oid) < 0)
+ if (repo_get_oid(the_repository, mergetag_data->argv[i], &oid) < 0)
return error(_("not a valid object name: '%s'"),
mergetag_data->argv[i]);
if (oideq(get_tagged_oid(tag), &oid))
@@ -452,15 +459,15 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
const char *buffer;
unsigned long size;
- if (get_oid(old_ref, &old_oid) < 0)
+ if (repo_get_oid(the_repository, old_ref, &old_oid) < 0)
return error(_("not a valid object name: '%s'"), old_ref);
commit = lookup_commit_reference(the_repository, &old_oid);
if (!commit)
return error(_("could not parse %s"), old_ref);
- buffer = get_commit_buffer(commit, &size);
+ buffer = repo_get_commit_buffer(the_repository, commit, &size);
strbuf_add(&buf, buffer, size);
- unuse_commit_buffer(commit, buffer);
+ repo_unuse_commit_buffer(the_repository, commit, buffer);
if (replace_parents(&buf, argc - 1, &argv[1]) < 0) {
strbuf_release(&buf);
diff --git a/builtin/rerere.c b/builtin/rerere.c
index 83d7a778e3..d4bd52797f 100644
--- a/builtin/rerere.c
+++ b/builtin/rerere.c
@@ -2,19 +2,22 @@
#include "cache.h"
#include "config.h"
#include "dir.h"
+#include "gettext.h"
#include "parse-options.h"
+#include "repository.h"
#include "string-list.h"
#include "rerere.h"
+#include "wrapper.h"
#include "xdiff/xdiff.h"
#include "xdiff-interface.h"
#include "pathspec.h"
static const char * const rerere_usage[] = {
- N_("git rerere [clear | forget <path>... | status | remaining | diff | gc]"),
+ N_("git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"),
NULL,
};
-static int outf(void *dummy, mmbuffer_t *ptr, int nbuf)
+static int outf(void *dummy UNUSED, mmbuffer_t *ptr, int nbuf)
{
int i;
for (i = 0; i < nbuf; i++)
diff --git a/builtin/reset.c b/builtin/reset.c
index fdce6f8c85..f99f32d580 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -7,9 +7,13 @@
*
* Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "advice.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "tag.h"
#include "object.h"
@@ -20,12 +24,17 @@
#include "diffcore.h"
#include "tree.h"
#include "branch.h"
+#include "object-name.h"
#include "parse-options.h"
#include "unpack-trees.h"
#include "cache-tree.h"
+#include "setup.h"
#include "submodule.h"
#include "submodule-config.h"
+#include "trace.h"
+#include "trace2.h"
#include "dir.h"
+#include "add-interactive.h"
#define REFRESH_INDEX_DELAY_WARNING_IN_MS (2 * 1000)
@@ -73,20 +82,22 @@ static int reset_index(const char *ref, const struct object_id *oid, int reset_t
case HARD:
opts.update = 1;
opts.reset = UNPACK_RESET_OVERWRITE_UNTRACKED;
+ opts.skip_cache_tree_update = 1;
break;
case MIXED:
opts.reset = UNPACK_RESET_PROTECT_UNTRACKED;
+ opts.skip_cache_tree_update = 1;
/* but opts.update=0, so working tree not updated */
break;
default:
BUG("invalid reset_type passed to reset_index");
}
- read_cache_unmerged();
+ repo_read_index_unmerged(the_repository);
if (reset_type == KEEP) {
struct object_id head_oid;
- if (get_oid("HEAD", &head_oid))
+ if (repo_get_oid(the_repository, "HEAD", &head_oid))
return error(_("You do not have a valid HEAD."));
if (!fill_tree_descriptor(the_repository, desc + nr, &head_oid))
return error(_("Failed to find tree of HEAD."));
@@ -121,7 +132,7 @@ static void print_new_head_line(struct commit *commit)
struct strbuf buf = STRBUF_INIT;
printf(_("HEAD is now at %s"),
- find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV));
pp_commit_easy(CMIT_FMT_ONELINE, commit, &buf);
if (buf.len > 0)
@@ -131,7 +142,8 @@ static void print_new_head_line(struct commit *commit)
}
static void update_index_from_diff(struct diff_queue_struct *q,
- struct diff_options *opt, void *data)
+ struct diff_options *opt UNUSED,
+ void *data)
{
int i;
int intent_to_add = *(int *)data;
@@ -143,7 +155,7 @@ static void update_index_from_diff(struct diff_queue_struct *q,
struct cache_entry *ce;
if (!is_in_reset_tree && !intent_to_add) {
- remove_file_from_cache(one->path);
+ remove_file_from_index(&the_index, one->path);
continue;
}
@@ -158,8 +170,8 @@ static void update_index_from_diff(struct diff_queue_struct *q,
* if this entry is outside the sparse cone - this is necessary
* to properly construct the reset sparse directory.
*/
- pos = cache_name_pos(one->path, strlen(one->path));
- if ((pos >= 0 && ce_skip_worktree(active_cache[pos])) ||
+ pos = index_name_pos(&the_index, one->path, strlen(one->path));
+ if ((pos >= 0 && ce_skip_worktree(the_index.cache[pos])) ||
(pos < 0 && !path_in_sparse_checkout(one->path, &the_index)))
ce->ce_flags |= CE_SKIP_WORKTREE;
@@ -170,7 +182,8 @@ static void update_index_from_diff(struct diff_queue_struct *q,
ce->ce_flags |= CE_INTENT_TO_ADD;
set_object_name_for_intent_to_add_entry(ce);
}
- add_cache_entry(ce, ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE);
+ add_index_entry(&the_index, ce,
+ ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE);
}
}
@@ -218,7 +231,7 @@ static void set_reflog_message(struct strbuf *sb, const char *action,
static void die_if_unmerged_cache(int reset_type)
{
- if (is_merge() || unmerged_cache())
+ if (is_merge() || unmerged_index(&the_index))
die(_("Cannot do a %s reset in the middle of a merge."),
_(reset_type_names[reset_type]));
@@ -255,8 +268,8 @@ static void parse_args(struct pathspec *pathspec,
* has to be unambiguous. If there is a single argument, it
* can not be a tree
*/
- else if ((!argv[1] && !get_oid_committish(argv[0], &unused)) ||
- (argv[1] && !get_oid_treeish(argv[0], &unused))) {
+ else if ((!argv[1] && !repo_get_oid_committish(the_repository, argv[0], &unused)) ||
+ (argv[1] && !repo_get_oid_treeish(the_repository, argv[0], &unused))) {
/*
* Ok, argv[0] looks like a commit/tree; it should not
* be a filename.
@@ -283,9 +296,9 @@ static int reset_refs(const char *rev, const struct object_id *oid)
struct object_id *orig = NULL, oid_orig,
*old_orig = NULL, oid_old_orig;
- if (!get_oid("ORIG_HEAD", &oid_old_orig))
+ if (!repo_get_oid(the_repository, "ORIG_HEAD", &oid_old_orig))
old_orig = &oid_old_orig;
- if (!get_oid("HEAD", &oid_orig)) {
+ if (!repo_get_oid(the_repository, "HEAD", &oid_orig)) {
orig = &oid_orig;
set_reflog_message(&msg, "updating ORIG_HEAD", NULL);
update_ref(msg.buf, "ORIG_HEAD", orig, old_orig, 0,
@@ -312,7 +325,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
int reset_type = NONE, update_ref_status = 0, quiet = 0;
int no_refresh = 0;
int patch_mode = 0, pathspec_file_nul = 0, unborn;
- const char *rev, *pathspec_from_file = NULL;
+ const char *rev;
+ char *pathspec_from_file = NULL;
struct object_id oid;
struct pathspec pathspec;
int intent_to_add = 0;
@@ -360,13 +374,14 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file");
}
- unborn = !strcmp(rev, "HEAD") && get_oid("HEAD", &oid);
+ unborn = !strcmp(rev, "HEAD") && repo_get_oid(the_repository, "HEAD",
+ &oid);
if (unborn) {
/* reset on unborn branch: treat as reset to empty tree */
oidcpy(&oid, the_hash_algo->empty_tree);
} else if (!pathspec.nr && !patch_mode) {
struct commit *commit;
- if (get_oid_committish(rev, &oid))
+ if (repo_get_oid_committish(the_repository, rev, &oid))
die(_("Failed to resolve '%s' as a valid revision."), rev);
commit = lookup_commit_reference(the_repository, &oid);
if (!commit)
@@ -374,7 +389,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
oidcpy(&oid, &commit->object.oid);
} else {
struct tree *tree;
- if (get_oid_treeish(rev, &oid))
+ if (repo_get_oid_treeish(the_repository, rev, &oid))
die(_("Failed to resolve '%s' as a valid tree."), rev);
tree = parse_tree_indirect(&oid);
if (!tree)
@@ -386,7 +401,9 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
if (reset_type != NONE)
die(_("options '%s' and '%s' cannot be used together"), "--patch", "--{hard,mixed,soft}");
trace2_cmd_mode("patch-interactive");
- return run_add_interactive(rev, "--patch=reset", &pathspec);
+ update_ref_status = !!run_add_p(the_repository, ADD_P_RESET, rev,
+ &pathspec);
+ goto cleanup;
}
/* git reset tree [--] paths... can be used to
@@ -420,7 +437,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
- if (read_cache() < 0)
+ if (repo_read_index(the_repository) < 0)
die(_("index file corrupt"));
/* Soft reset does not touch the index file nor the working tree
@@ -431,11 +448,14 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
if (reset_type != SOFT) {
struct lock_file lock = LOCK_INIT;
- hold_locked_index(&lock, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &lock,
+ LOCK_DIE_ON_ERROR);
if (reset_type == MIXED) {
int flags = quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN;
- if (read_from_tree(&pathspec, &oid, intent_to_add))
- return 1;
+ if (read_from_tree(&pathspec, &oid, intent_to_add)) {
+ update_ref_status = 1;
+ goto cleanup;
+ }
the_index.updated_skipworktree = 1;
if (!no_refresh && get_git_work_tree()) {
uint64_t t_begin, t_delta_in_ms;
@@ -454,7 +474,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
char *ref = NULL;
int err;
- dwim_ref(rev, strlen(rev), &dummy, &ref, 0);
+ repo_dwim_ref(the_repository, rev, strlen(rev),
+ &dummy, &ref, 0);
if (ref && !starts_with(ref, "refs/"))
FREE_AND_NULL(ref);
@@ -481,5 +502,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
if (!pathspec.nr)
remove_branch_state(the_repository, 0);
+ discard_index(&the_index);
+
+cleanup:
+ clear_pathspec(&pathspec);
+ free(pathspec_from_file);
return update_ref_status;
}
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index fba6f5d51f..6dc8be492a 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -2,11 +2,16 @@
#include "config.h"
#include "commit.h"
#include "diff.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "revision.h"
#include "list-objects.h"
#include "list-objects-filter.h"
#include "list-objects-filter-options.h"
#include "object.h"
+#include "object-name.h"
+#include "object-file.h"
#include "object-store.h"
#include "pack.h"
#include "pack-bitmap.h"
@@ -20,7 +25,8 @@
#include "packfile.h"
static const char rev_list_usage[] =
-"git rev-list [<options>] <commit-id>... [-- <path>...]\n"
+"git rev-list [<options>] <commit>... [--] [<path>...]\n"
+"\n"
" limiting output:\n"
" --max-count=<n>\n"
" --max-age=<epoch>\n"
@@ -37,6 +43,7 @@ static const char rev_list_usage[] =
" --tags\n"
" --remotes\n"
" --stdin\n"
+" --exclude-hidden=[fetch|receive|uploadpack]\n"
" --quiet\n"
" ordering output:\n"
" --topo-order\n"
@@ -132,7 +139,7 @@ static void show_commit(struct commit *commit, void *data)
if (!revs->graph)
fputs(get_revision_mark(revs, commit), stdout);
if (revs->abbrev_commit && revs->abbrev)
- fputs(find_unique_abbrev(&commit->object.oid, revs->abbrev),
+ fputs(repo_find_unique_abbrev(the_repository, &commit->object.oid, revs->abbrev),
stdout);
else
fputs(oid_to_hex(&commit->object.oid), stdout);
@@ -255,7 +262,8 @@ static inline void finish_object__ma(struct object *obj)
}
}
-static int finish_object(struct object *obj, const char *name, void *cb_data)
+static int finish_object(struct object *obj, const char *name UNUSED,
+ void *cb_data)
{
struct rev_list_info *info = cb_data;
if (oid_object_info_extended(the_repository, &obj->oid, NULL, 0) < 0) {
@@ -360,11 +368,11 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
static int show_object_fast(
const struct object_id *oid,
- enum object_type type,
- int exclude,
- uint32_t name_hash,
- struct packed_git *found_pack,
- off_t found_offset)
+ enum object_type type UNUSED,
+ int exclude UNUSED,
+ uint32_t name_hash UNUSED,
+ struct packed_git *found_pack UNUSED,
+ off_t found_offset UNUSED)
{
fprintf(stdout, "%s\n", oid_to_hex(oid));
return 1;
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 8f61050bde..852e49e340 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -3,16 +3,23 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "cache.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
#include "commit.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
#include "quote.h"
#include "builtin.h"
+#include "object-name.h"
#include "parse-options.h"
#include "diff.h"
#include "revision.h"
+#include "setup.h"
#include "split-index.h"
#include "submodule.h"
#include "commit-reach.h"
@@ -39,7 +46,7 @@ static int abbrev_ref_strict;
static int output_sq;
static int stuck_long;
-static struct string_list *ref_excludes;
+static struct ref_exclusions ref_excludes = REF_EXCLUSIONS_INIT;
/*
* Some arguments are relevant "revision" arguments,
@@ -136,7 +143,9 @@ static void show_rev(int type, const struct object_id *oid, const char *name)
struct object_id discard;
char *full;
- switch (dwim_ref(name, strlen(name), &discard, &full, 0)) {
+ switch (repo_dwim_ref(the_repository, name,
+ strlen(name), &discard, &full,
+ 0)) {
case 0:
/*
* Not found -- not a ref. We could
@@ -162,7 +171,8 @@ static void show_rev(int type, const struct object_id *oid, const char *name)
}
}
else if (abbrev)
- show_with_type(type, find_unique_abbrev(oid, abbrev));
+ show_with_type(type,
+ repo_find_unique_abbrev(the_repository, oid, abbrev));
else
show_with_type(type, oid_to_hex(oid));
}
@@ -187,7 +197,7 @@ static int show_default(void)
struct object_id oid;
def = NULL;
- if (!get_oid(s, &oid)) {
+ if (!repo_get_oid(the_repository, s, &oid)) {
show_rev(NORMAL, &oid, s);
return 1;
}
@@ -198,7 +208,7 @@ static int show_default(void)
static int show_reference(const char *refname, const struct object_id *oid,
int flag UNUSED, void *cb_data UNUSED)
{
- if (ref_excluded(ref_excludes, refname))
+ if (ref_excluded(&ref_excludes, refname))
return 0;
show_rev(NORMAL, oid, refname);
return 0;
@@ -279,7 +289,7 @@ static int try_difference(const char *arg)
return 0;
}
- if (!get_oid_committish(start, &start_oid) && !get_oid_committish(end, &end_oid)) {
+ if (!repo_get_oid_committish(the_repository, start, &start_oid) && !repo_get_oid_committish(the_repository, end, &end_oid)) {
show_rev(NORMAL, &end_oid, end);
show_rev(symmetric ? NORMAL : REVERSED, &start_oid, start);
if (symmetric) {
@@ -291,7 +301,7 @@ static int try_difference(const char *arg)
*dotdot = '.';
return 0;
}
- exclude = get_merge_bases(a, b);
+ exclude = repo_get_merge_bases(the_repository, a, b);
while (exclude) {
struct commit *commit = pop_commit(&exclude);
show_rev(REVERSED, &commit->object.oid, NULL);
@@ -337,7 +347,7 @@ static int try_parent_shorthands(const char *arg)
return 0;
*dotdot = 0;
- if (get_oid_committish(arg, &oid) ||
+ if (repo_get_oid_committish(the_repository, arg, &oid) ||
!(commit = lookup_commit_reference(the_repository, &oid))) {
*dotdot = '^';
return 0;
@@ -530,6 +540,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
strbuf_addstr(&parsed, " --");
sq_quote_argv(&parsed, argv);
puts(parsed.buf);
+ strbuf_release(&parsed);
return 0;
}
@@ -585,7 +596,7 @@ static void handle_ref_opt(const char *pattern, const char *prefix)
for_each_glob_ref_in(show_reference, pattern, prefix, NULL);
else
for_each_ref_in(prefix, show_reference, NULL);
- clear_ref_exclusion(&ref_excludes);
+ clear_ref_exclusions(&ref_excludes);
}
enum format_type {
@@ -863,11 +874,12 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
}
if (!strcmp(arg, "--all")) {
for_each_ref(show_reference, NULL);
- clear_ref_exclusion(&ref_excludes);
+ clear_ref_exclusions(&ref_excludes);
continue;
}
if (skip_prefix(arg, "--disambiguate=", &arg)) {
- for_each_abbrev(arg, show_abbrev, NULL);
+ repo_for_each_abbrev(the_repository, arg,
+ show_abbrev, NULL);
continue;
}
if (!strcmp(arg, "--bisect")) {
@@ -876,10 +888,14 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
continue;
}
if (opt_with_value(arg, "--branches", &arg)) {
+ if (ref_excludes.hidden_refs_configured)
+ return error(_("--exclude-hidden cannot be used together with --branches"));
handle_ref_opt(arg, "refs/heads/");
continue;
}
if (opt_with_value(arg, "--tags", &arg)) {
+ if (ref_excludes.hidden_refs_configured)
+ return error(_("--exclude-hidden cannot be used together with --tags"));
handle_ref_opt(arg, "refs/tags/");
continue;
}
@@ -888,6 +904,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
continue;
}
if (opt_with_value(arg, "--remotes", &arg)) {
+ if (ref_excludes.hidden_refs_configured)
+ return error(_("--exclude-hidden cannot be used together with --remotes"));
handle_ref_opt(arg, "refs/remotes/");
continue;
}
@@ -895,6 +913,10 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
add_ref_exclusion(&ref_excludes, arg);
continue;
}
+ if (skip_prefix(arg, "--exclude-hidden=", &arg)) {
+ exclude_hidden_refs(&ref_excludes, arg);
+ continue;
+ }
if (!strcmp(arg, "--show-toplevel")) {
const char *work_tree = get_git_work_tree();
if (work_tree)
@@ -997,7 +1019,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
continue;
}
if (!strcmp(arg, "--shared-index-path")) {
- if (read_cache() < 0)
+ if (repo_read_index(the_repository) < 0)
die(_("Could not read the index"));
if (the_index.split_index) {
const struct object_id *oid = &the_index.split_index->base_oid;
diff --git a/builtin/revert.c b/builtin/revert.c
index ee2a0807f0..0240ec8593 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -1,8 +1,10 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "config.h"
#include "builtin.h"
#include "parse-options.h"
#include "diff.h"
+#include "gettext.h"
#include "revision.h"
#include "rerere.h"
#include "dir.h"
@@ -21,14 +23,15 @@
*/
static const char * const revert_usage[] = {
- N_("git revert [<options>] <commit-ish>..."),
- N_("git revert <subcommand>"),
+ N_("git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] <commit>..."),
+ N_("git revert (--continue | --skip | --abort | --quit)"),
NULL
};
static const char * const cherry_pick_usage[] = {
- N_("git cherry-pick [<options>] <commit-ish>..."),
- N_("git cherry-pick <subcommand>"),
+ N_("git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n"
+ " [-S[<keyid>]] <commit>..."),
+ N_("git cherry-pick (--continue | --skip | --abort | --quit)"),
NULL
};
@@ -42,20 +45,6 @@ static const char * const *revert_or_cherry_pick_usage(struct replay_opts *opts)
return opts->action == REPLAY_REVERT ? revert_usage : cherry_pick_usage;
}
-static int option_parse_x(const struct option *opt,
- const char *arg, int unset)
-{
- struct replay_opts **opts_ptr = opt->value;
- struct replay_opts *opts = *opts_ptr;
-
- if (unset)
- return 0;
-
- ALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc);
- opts->xopts[opts->xopts_nr++] = xstrdup(arg);
- return 0;
-}
-
static int option_parse_m(const struct option *opt,
const char *arg, int unset)
{
@@ -92,7 +81,8 @@ static void verify_opt_compatible(const char *me, const char *base_opt, ...)
die(_("%s: %s cannot be used with %s"), me, this_opt, base_opt);
}
-static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
+static int run_sequencer(int argc, const char **argv, const char *prefix,
+ struct replay_opts *opts)
{
const char * const * usage_str = revert_or_cherry_pick_usage(opts);
const char *me = action_name(opts);
@@ -112,8 +102,8 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
N_("select mainline parent"), option_parse_m),
OPT_RERERE_AUTOUPDATE(&opts->allow_rerere_auto),
OPT_STRING(0, "strategy", &opts->strategy, N_("strategy"), N_("merge strategy")),
- OPT_CALLBACK('X', "strategy-option", &opts, N_("option"),
- N_("option for merge strategy"), option_parse_x),
+ OPT_STRVEC('X', "strategy-option", &opts->xopts, N_("option"),
+ N_("option for merge strategy")),
{ OPTION_STRING, 'S', "gpg-sign", &opts->gpg_sign, N_("key-id"),
N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
OPT_END()
@@ -139,7 +129,7 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
options = parse_options_concat(options, cp_extra);
}
- argc = parse_options(argc, argv, NULL, options, usage_str,
+ argc = parse_options(argc, argv, prefix, options, usage_str,
PARSE_OPT_KEEP_ARGV0 |
PARSE_OPT_KEEP_UNKNOWN_OPT);
@@ -174,7 +164,7 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
"--signoff", opts->signoff,
"--mainline", opts->mainline,
"--strategy", opts->strategy ? 1 : 0,
- "--strategy-option", opts->xopts ? 1 : 0,
+ "--strategy-option", opts->xopts.nr ? 1 : 0,
"-x", opts->record_origin,
"--ff", opts->allow_ff,
"--rerere-autoupdate", opts->allow_rerere_auto == RERERE_AUTOUPDATE,
@@ -220,6 +210,7 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
opts->strategy = xstrdup_or_null(opts->strategy);
if (!opts->strategy && getenv("GIT_TEST_MERGE_ALGORITHM"))
opts->strategy = xstrdup(getenv("GIT_TEST_MERGE_ALGORITHM"));
+ free(options);
if (cmd == 'q') {
int ret = sequencer_remove_state(opts);
@@ -243,12 +234,10 @@ int cmd_revert(int argc, const char **argv, const char *prefix)
opts.action = REPLAY_REVERT;
sequencer_init_config(&opts);
- res = run_sequencer(argc, argv, &opts);
+ res = run_sequencer(argc, argv, prefix, &opts);
if (res < 0)
die(_("revert failed"));
- if (opts.revs)
- release_revisions(opts.revs);
- free(opts.revs);
+ replay_opts_release(&opts);
return res;
}
@@ -259,8 +248,9 @@ int cmd_cherry_pick(int argc, const char **argv, const char *prefix)
opts.action = REPLAY_PICK;
sequencer_init_config(&opts);
- res = run_sequencer(argc, argv, &opts);
+ res = run_sequencer(argc, argv, prefix, &opts);
if (res < 0)
die(_("cherry-pick failed"));
+ replay_opts_release(&opts);
return res;
}
diff --git a/builtin/rm.c b/builtin/rm.c
index b6ba859fe4..b4589c824c 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -3,21 +3,29 @@
*
* Copyright (C) Linus Torvalds 2006
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "alloc.h"
#include "advice.h"
#include "config.h"
#include "lockfile.h"
#include "dir.h"
#include "cache-tree.h"
+#include "gettext.h"
+#include "hash.h"
#include "tree-walk.h"
+#include "object-name.h"
#include "parse-options.h"
+#include "repository.h"
#include "string-list.h"
+#include "setup.h"
#include "submodule.h"
#include "pathspec.h"
static const char * const builtin_rm_usage[] = {
- N_("git rm [<options>] [--] <file>..."),
+ N_("git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+ " [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+ " [--] [<pathspec>...]"),
NULL
};
@@ -33,8 +41,8 @@ static int get_ours_cache_pos(const char *path, int pos)
{
int i = -pos - 1;
- while ((i < active_nr) && !strcmp(active_cache[i]->name, path)) {
- if (ce_stage(active_cache[i]) == 2)
+ while ((i < the_index.cache_nr) && !strcmp(the_index.cache[i]->name, path)) {
+ if (ce_stage(the_index.cache[i]) == 2)
return i;
i++;
}
@@ -70,13 +78,13 @@ static void submodules_absorb_gitdir_if_needed(void)
int pos;
const struct cache_entry *ce;
- pos = cache_name_pos(name, strlen(name));
+ pos = index_name_pos(&the_index, name, strlen(name));
if (pos < 0) {
pos = get_ours_cache_pos(name, pos);
if (pos < 0)
continue;
}
- ce = active_cache[pos];
+ ce = the_index.cache[pos];
if (!S_ISGITLINK(ce->ce_mode) ||
!file_exists(ce->name) ||
@@ -84,8 +92,7 @@ static void submodules_absorb_gitdir_if_needed(void)
continue;
if (!submodule_uses_gitfile(name))
- absorb_git_dir_into_superproject(name,
- ABSORB_GITDIR_RECURSE_SUBMODULES);
+ absorb_git_dir_into_superproject(name, NULL);
}
}
@@ -115,7 +122,7 @@ static int check_local_mod(struct object_id *head, int index_only)
int local_changes = 0;
int staged_changes = 0;
- pos = cache_name_pos(name, strlen(name));
+ pos = index_name_pos(&the_index, name, strlen(name));
if (pos < 0) {
/*
* Skip unmerged entries except for populated submodules
@@ -125,11 +132,11 @@ static int check_local_mod(struct object_id *head, int index_only)
if (pos < 0)
continue;
- if (!S_ISGITLINK(active_cache[pos]->ce_mode) ||
+ if (!S_ISGITLINK(the_index.cache[pos]->ce_mode) ||
is_empty_dir(name))
continue;
}
- ce = active_cache[pos];
+ ce = the_index.cache[pos];
if (lstat(ce->name, &st) < 0) {
if (!is_missing_file_error(errno))
@@ -166,7 +173,7 @@ static int check_local_mod(struct object_id *head, int index_only)
* Is the index different from the file in the work tree?
* If it's a submodule, is its work tree modified?
*/
- if (ce_match_stat(ce, &st, 0) ||
+ if (ie_match_stat(&the_index, ce, &st, 0) ||
(S_ISGITLINK(ce->ce_mode) &&
bad_to_remove_submodule(ce->name,
SUBMODULE_REMOVAL_DIE_ON_ERROR |
@@ -289,9 +296,9 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
- hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &lock_file, LOCK_DIE_ON_ERROR);
- if (read_cache() < 0)
+ if (repo_read_index(the_repository) < 0)
die(_("index file corrupt"));
refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, &pathspec, NULL, NULL);
@@ -301,8 +308,8 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
if (pathspec_needs_expanded_index(&the_index, &pathspec))
ensure_full_index(&the_index);
- for (i = 0; i < active_nr; i++) {
- const struct cache_entry *ce = active_cache[i];
+ for (i = 0; i < the_index.cache_nr; i++) {
+ const struct cache_entry *ce = the_index.cache[i];
if (!include_sparse &&
(ce_skip_worktree(ce) ||
@@ -369,7 +376,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
*/
if (!force) {
struct object_id oid;
- if (get_oid("HEAD", &oid))
+ if (repo_get_oid(the_repository, "HEAD", &oid))
oidclr(&oid);
if (check_local_mod(&oid, index_only))
exit(1);
@@ -384,7 +391,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
if (!quiet)
printf("rm '%s'\n", path);
- if (remove_file_from_cache(path))
+ if (remove_file_from_index(&the_index, path))
die(_("git rm: unable to remove %s"), path);
}
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 64962be016..4784143004 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -1,6 +1,7 @@
#include "builtin.h"
#include "config.h"
#include "commit.h"
+#include "hex.h"
#include "refs.h"
#include "pkt-line.h"
#include "sideband.h"
@@ -15,11 +16,14 @@
#include "gpg-interface.h"
#include "gettext.h"
#include "protocol.h"
+#include "parse-options.h"
+#include "write-or-die.h"
static const char * const send_pack_usage[] = {
N_("git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+ " [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<host>:]<directory> (--all | <ref>...)"),
NULL,
};
@@ -129,8 +133,6 @@ static void print_helper_status(struct ref *ref)
static int send_pack_config(const char *k, const char *v, void *cb)
{
- git_gpg_config(k, v, NULL);
-
if (!strcmp(k, "push.gpgsign")) {
const char *value;
if (!git_config_get_value("push.gpgsign", &value)) {
@@ -274,7 +276,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
fd[0] = 0;
fd[1] = 1;
} else {
- conn = git_connect(fd, dest, receivepack,
+ conn = git_connect(fd, dest, "git-receive-pack", receivepack,
args.verbose ? CONNECT_VERBOSE : 0);
}
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index 7a1e1fe7c0..46f4e0832a 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -3,10 +3,13 @@
#include "config.h"
#include "commit.h"
#include "diff.h"
+#include "environment.h"
+#include "gettext.h"
#include "string-list.h"
#include "revision.h"
#include "utf8.h"
#include "mailmap.h"
+#include "setup.h"
#include "shortlog.h"
#include "parse-options.h"
#include "trailer.h"
@@ -132,7 +135,9 @@ static void read_from_stdin(struct shortlog *log)
match = committer_match;
break;
case SHORTLOG_GROUP_TRAILER:
- die(_("using --group=trailer with stdin is not supported"));
+ die(_("using %s with stdin is not supported"), "--group=trailer");
+ case SHORTLOG_GROUP_FORMAT:
+ die(_("using %s with stdin is not supported"), "--group=format");
default:
BUG("unhandled shortlog group");
}
@@ -170,11 +175,15 @@ static void insert_records_from_trailers(struct shortlog *log,
const char *commit_buffer, *body;
struct strbuf ident = STRBUF_INIT;
+ if (!log->trailers.nr)
+ return;
+
/*
- * Using format_commit_message("%B") would be simpler here, but
+ * Using repo_format_commit_message("%B") would be simpler here, but
* this saves us copying the message.
*/
- commit_buffer = logmsg_reencode(commit, NULL, ctx->output_encoding);
+ commit_buffer = repo_logmsg_reencode(the_repository, commit, NULL,
+ ctx->output_encoding);
body = strstr(commit_buffer, "\n\n");
if (!body)
return;
@@ -197,12 +206,38 @@ static void insert_records_from_trailers(struct shortlog *log,
trailer_iterator_release(&iter);
strbuf_release(&ident);
- unuse_commit_buffer(commit, commit_buffer);
+ repo_unuse_commit_buffer(the_repository, commit, commit_buffer);
+}
+
+static int shortlog_needs_dedup(const struct shortlog *log)
+{
+ return HAS_MULTI_BITS(log->groups) || log->format.nr > 1 || log->trailers.nr;
+}
+
+static void insert_records_from_format(struct shortlog *log,
+ struct strset *dups,
+ struct commit *commit,
+ struct pretty_print_context *ctx,
+ const char *oneline)
+{
+ struct strbuf buf = STRBUF_INIT;
+ struct string_list_item *item;
+
+ for_each_string_list_item(item, &log->format) {
+ strbuf_reset(&buf);
+
+ repo_format_commit_message(the_repository, commit,
+ item->string, &buf, ctx);
+
+ if (!shortlog_needs_dedup(log) || strset_add(dups, buf.buf))
+ insert_one_record(log, buf.buf, oneline);
+ }
+
+ strbuf_release(&buf);
}
void shortlog_add_commit(struct shortlog *log, struct commit *commit)
{
- struct strbuf ident = STRBUF_INIT;
struct strbuf oneline = STRBUF_INIT;
struct strset dups = STRSET_INIT;
struct pretty_print_context ctx = {0};
@@ -211,41 +246,22 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)
ctx.fmt = CMIT_FMT_USERFORMAT;
ctx.abbrev = log->abbrev;
ctx.print_email_subject = 1;
- ctx.date_mode.type = DATE_NORMAL;
+ ctx.date_mode = log->date_mode;
ctx.output_encoding = get_log_output_encoding();
if (!log->summary) {
if (log->user_format)
pretty_print_commit(&ctx, commit, &oneline);
else
- format_commit_message(commit, "%s", &oneline, &ctx);
+ repo_format_commit_message(the_repository, commit,
+ "%s", &oneline, &ctx);
}
oneline_str = oneline.len ? oneline.buf : "<none>";
- if (log->groups & SHORTLOG_GROUP_AUTHOR) {
- strbuf_reset(&ident);
- format_commit_message(commit,
- log->email ? "%aN <%aE>" : "%aN",
- &ident, &ctx);
- if (!HAS_MULTI_BITS(log->groups) ||
- strset_add(&dups, ident.buf))
- insert_one_record(log, ident.buf, oneline_str);
- }
- if (log->groups & SHORTLOG_GROUP_COMMITTER) {
- strbuf_reset(&ident);
- format_commit_message(commit,
- log->email ? "%cN <%cE>" : "%cN",
- &ident, &ctx);
- if (!HAS_MULTI_BITS(log->groups) ||
- strset_add(&dups, ident.buf))
- insert_one_record(log, ident.buf, oneline_str);
- }
- if (log->groups & SHORTLOG_GROUP_TRAILER) {
- insert_records_from_trailers(log, &dups, commit, &ctx, oneline_str);
- }
+ insert_records_from_trailers(log, &dups, commit, &ctx, oneline_str);
+ insert_records_from_format(log, &dups, commit, &ctx, oneline_str);
strset_clear(&dups);
- strbuf_release(&ident);
strbuf_release(&oneline);
}
@@ -314,6 +330,7 @@ static int parse_group_option(const struct option *opt, const char *arg, int uns
if (unset) {
log->groups = 0;
string_list_clear(&log->trailers, 0);
+ string_list_clear(&log->format, 0);
} else if (!strcasecmp(arg, "author"))
log->groups |= SHORTLOG_GROUP_AUTHOR;
else if (!strcasecmp(arg, "committer"))
@@ -321,8 +338,15 @@ static int parse_group_option(const struct option *opt, const char *arg, int uns
else if (skip_prefix(arg, "trailer:", &field)) {
log->groups |= SHORTLOG_GROUP_TRAILER;
string_list_append(&log->trailers, field);
- } else
+ } else if (skip_prefix(arg, "format:", &field)) {
+ log->groups |= SHORTLOG_GROUP_FORMAT;
+ string_list_append(&log->format, field);
+ } else if (strchr(arg, '%')) {
+ log->groups |= SHORTLOG_GROUP_FORMAT;
+ string_list_append(&log->format, arg);
+ } else {
return error(_("unknown group type: %s"), arg);
+ }
return 0;
}
@@ -340,6 +364,19 @@ void shortlog_init(struct shortlog *log)
log->in2 = DEFAULT_INDENT2;
log->trailers.strdup_strings = 1;
log->trailers.cmp = strcasecmp;
+ log->format.strdup_strings = 1;
+}
+
+void shortlog_finish_setup(struct shortlog *log)
+{
+ if (log->groups & SHORTLOG_GROUP_AUTHOR)
+ string_list_append(&log->format,
+ log->email ? "%aN <%aE>" : "%aN");
+ if (log->groups & SHORTLOG_GROUP_COMMITTER)
+ string_list_append(&log->format,
+ log->email ? "%cN <%cE>" : "%cN");
+
+ string_list_sort(&log->trailers);
}
int cmd_shortlog(int argc, const char **argv, const char *prefix)
@@ -407,10 +444,11 @@ parse_done:
log.user_format = rev.commit_format == CMIT_FMT_USERFORMAT;
log.abbrev = rev.abbrev;
log.file = rev.diffopt.file;
+ log.date_mode = rev.date_mode;
if (!log.groups)
log.groups = SHORTLOG_GROUP_AUTHOR;
- string_list_sort(&log.trailers);
+ shortlog_finish_setup(&log);
/* assume HEAD if from a tty */
if (!nongit && !rev.pending.nr && isatty(0))
@@ -479,4 +517,5 @@ void shortlog_output(struct shortlog *log)
log->list.strdup_strings = 1;
string_list_clear(&log->list, 1);
clear_mailmap(&log->mailmap);
+ string_list_clear(&log->format, 0);
}
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index d3f5715e3e..7ef4a642c1 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -1,11 +1,17 @@
#include "cache.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hash.h"
+#include "hex.h"
#include "pretty.h"
#include "refs.h"
#include "builtin.h"
#include "color.h"
#include "strvec.h"
+#include "object-name.h"
#include "parse-options.h"
+#include "repository.h"
#include "dir.h"
#include "commit-slab.h"
#include "date.h"
@@ -14,7 +20,8 @@ static const char* show_branch_usage[] = {
N_("git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<when>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
- " [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"),
+ " [--no-name | --sha1-name] [--topics]\n"
+ " [(<rev> | <glob>)...]"),
N_("git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]"),
NULL
};
@@ -239,7 +246,7 @@ static void join_revs(struct commit_list **list_p,
parents = parents->next;
if ((this_flag & flags) == flags)
continue;
- parse_commit(p);
+ repo_parse_commit(the_repository, p);
if (mark_seen(p, seen_p) && !still_interesting)
extra--;
p->object.flags |= flags;
@@ -311,8 +318,8 @@ static void show_one_commit(struct commit *commit, int no_name)
}
else
printf("[%s] ",
- find_unique_abbrev(&commit->object.oid,
- DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, &commit->object.oid,
+ DEFAULT_ABBREV));
}
puts(pretty_str);
strbuf_release(&pretty);
@@ -413,7 +420,7 @@ static int append_head_ref(const char *refname, const struct object_id *oid,
/* If both heads/foo and tags/foo exists, get_sha1 would
* get confused.
*/
- if (get_oid(refname + ofs, &tmp) || !oideq(&tmp, oid))
+ if (repo_get_oid(the_repository, refname + ofs, &tmp) || !oideq(&tmp, oid))
ofs = 5;
return append_ref(refname + ofs, oid, 0);
}
@@ -428,7 +435,7 @@ static int append_remote_ref(const char *refname, const struct object_id *oid,
/* If both heads/foo and tags/foo exists, get_sha1 would
* get confused.
*/
- if (get_oid(refname + ofs, &tmp) || !oideq(&tmp, oid))
+ if (repo_get_oid(the_repository, refname + ofs, &tmp) || !oideq(&tmp, oid))
ofs = 5;
return append_ref(refname + ofs, oid, 0);
}
@@ -532,7 +539,7 @@ static int show_independent(struct commit **rev,
static void append_one_rev(const char *av)
{
struct object_id revkey;
- if (!get_oid(av, &revkey)) {
+ if (!repo_get_oid(the_repository, av, &revkey)) {
append_ref(av, &revkey, 0);
return;
}
@@ -745,7 +752,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
die(Q_("only %d entry can be shown at one time.",
"only %d entries can be shown at one time.",
MAX_REVS), MAX_REVS);
- if (!dwim_ref(*av, strlen(*av), &oid, &ref, 0))
+ if (!repo_dwim_ref(the_repository, *av, strlen(*av), &oid,
+ &ref, 0))
die(_("no such ref %s"), *av);
/* Has the base been specified? */
@@ -835,13 +843,13 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
die(Q_("cannot handle more than %d rev.",
"cannot handle more than %d revs.",
MAX_REVS), MAX_REVS);
- if (get_oid(ref_name[num_rev], &revkey))
+ if (repo_get_oid(the_repository, ref_name[num_rev], &revkey))
die(_("'%s' is not a valid ref."), ref_name[num_rev]);
commit = lookup_commit_reference(the_repository, &revkey);
if (!commit)
die(_("cannot find commit %s (%s)"),
ref_name[num_rev], oid_to_hex(&revkey));
- parse_commit(commit);
+ repo_parse_commit(the_repository, commit);
mark_seen(commit, &seen);
/* rev#0 uses bit REV_SHIFT, rev#1 uses bit REV_SHIFT+1,
@@ -955,5 +963,6 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
if (shown_merge_point && --extra < 0)
break;
}
+ free(head);
return 0;
}
diff --git a/builtin/show-index.c b/builtin/show-index.c
index 0e0b9fb95b..d839e55335 100644
--- a/builtin/show-index.c
+++ b/builtin/show-index.c
@@ -1,7 +1,11 @@
#include "builtin.h"
#include "cache.h"
+#include "gettext.h"
+#include "hash.h"
+#include "hex.h"
#include "pack.h"
#include "parse-options.h"
+#include "repository.h"
static const char *const show_index_usage[] = {
"git show-index [--object-format=<hash-algorithm>]",
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 4856906108..a2243b4219 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -1,7 +1,10 @@
#include "builtin.h"
#include "cache.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
+#include "object-name.h"
#include "object-store.h"
#include "object.h"
#include "tag.h"
@@ -9,7 +12,9 @@
#include "parse-options.h"
static const char * const show_ref_usage[] = {
- N_("git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]"),
+ N_("git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+ " [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+ " [--heads] [--] [<pattern>...]"),
N_("git show-ref --exclude-existing[=<pattern>]"),
NULL
};
@@ -24,14 +29,14 @@ static void show_one(const char *refname, const struct object_id *oid)
const char *hex;
struct object_id peeled;
- if (!has_object_file(oid))
+ if (!repo_has_object_file(the_repository, oid))
die("git show-ref: bad ref %s (%s)", refname,
oid_to_hex(oid));
if (quiet)
return;
- hex = find_unique_abbrev(oid, abbrev);
+ hex = repo_find_unique_abbrev(the_repository, oid, abbrev);
if (hash_only)
printf("%s\n", hex);
else
@@ -41,7 +46,7 @@ static void show_one(const char *refname, const struct object_id *oid)
return;
if (!peel_iterated_oid(oid, &peeled)) {
- hex = find_unique_abbrev(&peeled, abbrev);
+ hex = repo_find_unique_abbrev(the_repository, &peeled, abbrev);
printf("%s %s^{}\n", hex, refname);
}
}
diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c
index 287716db68..40d420f06c 100644
--- a/builtin/sparse-checkout.c
+++ b/builtin/sparse-checkout.c
@@ -2,6 +2,10 @@
#include "cache.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "object-file.h"
+#include "object-name.h"
#include "parse-options.h"
#include "pathspec.h"
#include "repository.h"
@@ -14,13 +18,14 @@
#include "unpack-trees.h"
#include "wt-status.h"
#include "quote.h"
+#include "setup.h"
#include "sparse-index.h"
#include "worktree.h"
static const char *empty_base = "";
static char const * const builtin_sparse_checkout_usage[] = {
- N_("git sparse-checkout (init|list|set|add|reapply|disable) <options>"),
+ N_("git sparse-checkout (init | list | set | add | reapply | disable | check-rules) [<options>]"),
NULL
};
@@ -57,6 +62,7 @@ static int sparse_checkout_list(int argc, const char **argv, const char *prefix)
char *sparse_filename;
int res;
+ setup_work_tree();
if (!core_apply_sparse_checkout)
die(_("this worktree is not sparse"));
@@ -218,14 +224,13 @@ static int update_working_directory(struct pattern_list *pl)
o.src_index = r->index;
o.dst_index = r->index;
o.skip_sparse_checkout = 0;
- o.pl = pl;
setup_work_tree();
repo_hold_locked_index(r, &lock_file, LOCK_DIE_ON_ERROR);
setup_unpack_trees_porcelain(&o, "sparse-checkout");
- result = update_sparsity(&o);
+ result = update_sparsity(&o, pl);
clear_unpack_trees_porcelain(&o);
if (result == UPDATE_SPARSITY_WARNINGS)
@@ -382,13 +387,7 @@ static int set_config(enum sparse_checkout_mode mode)
return 0;
}
-static int update_modes(int *cone_mode, int *sparse_index)
-{
- int mode, record_mode;
-
- /* Determine if we need to record the mode; ensure sparse checkout on */
- record_mode = (*cone_mode != -1) || !core_apply_sparse_checkout;
-
+static enum sparse_checkout_mode update_cone_mode(int *cone_mode) {
/* If not specified, use previous definition of cone mode */
if (*cone_mode == -1 && core_apply_sparse_checkout)
*cone_mode = core_sparse_checkout_cone;
@@ -396,12 +395,21 @@ static int update_modes(int *cone_mode, int *sparse_index)
/* Set cone/non-cone mode appropriately */
core_apply_sparse_checkout = 1;
if (*cone_mode == 1 || *cone_mode == -1) {
- mode = MODE_CONE_PATTERNS;
core_sparse_checkout_cone = 1;
- } else {
- mode = MODE_ALL_PATTERNS;
- core_sparse_checkout_cone = 0;
+ return MODE_CONE_PATTERNS;
}
+ core_sparse_checkout_cone = 0;
+ return MODE_ALL_PATTERNS;
+}
+
+static int update_modes(int *cone_mode, int *sparse_index)
+{
+ int mode, record_mode;
+
+ /* Determine if we need to record the mode; ensure sparse checkout on */
+ record_mode = (*cone_mode != -1) || !core_apply_sparse_checkout;
+
+ mode = update_cone_mode(cone_mode);
if (record_mode && set_config(mode))
return 1;
@@ -447,6 +455,7 @@ static int sparse_checkout_init(int argc, const char **argv, const char *prefix)
OPT_END(),
};
+ setup_work_tree();
repo_read_index(the_repository);
init_opts.cone_mode = -1;
@@ -470,7 +479,7 @@ static int sparse_checkout_init(int argc, const char **argv, const char *prefix)
return update_working_directory(NULL);
}
- if (get_oid("HEAD", &oid)) {
+ if (repo_get_oid(the_repository, "HEAD", &oid)) {
FILE *fp;
/* assume we are in a fresh repo, but update the sparse-checkout file */
@@ -544,7 +553,7 @@ static void strbuf_to_cone_pattern(struct strbuf *line, struct pattern_list *pl)
static void add_patterns_from_input(struct pattern_list *pl,
int argc, const char **argv,
- int use_stdin)
+ FILE *file)
{
int i;
if (core_sparse_checkout_cone) {
@@ -554,9 +563,9 @@ static void add_patterns_from_input(struct pattern_list *pl,
hashmap_init(&pl->parent_hashmap, pl_hashmap_cmp, NULL, 0);
pl->use_cone_patterns = 1;
- if (use_stdin) {
+ if (file) {
struct strbuf unquoted = STRBUF_INIT;
- while (!strbuf_getline(&line, stdin)) {
+ while (!strbuf_getline(&line, file)) {
if (line.buf[0] == '"') {
strbuf_reset(&unquoted);
if (unquote_c_style(&unquoted, line.buf, NULL))
@@ -578,10 +587,10 @@ static void add_patterns_from_input(struct pattern_list *pl,
}
}
} else {
- if (use_stdin) {
+ if (file) {
struct strbuf line = STRBUF_INIT;
- while (!strbuf_getline(&line, stdin)) {
+ while (!strbuf_getline(&line, file)) {
size_t len;
char *buf = strbuf_detach(&line, &len);
add_pattern(buf, empty_base, 0, pl, 0);
@@ -608,7 +617,8 @@ static void add_patterns_cone_mode(int argc, const char **argv,
struct pattern_list existing;
char *sparse_filename = get_sparse_checkout_filename();
- add_patterns_from_input(pl, argc, argv, use_stdin);
+ add_patterns_from_input(pl, argc, argv,
+ use_stdin ? stdin : NULL);
memset(&existing, 0, sizeof(existing));
existing.use_cone_patterns = core_sparse_checkout_cone;
@@ -645,7 +655,7 @@ static void add_patterns_literal(int argc, const char **argv,
pl, NULL, 0))
die(_("unable to load existing sparse-checkout patterns"));
free(sparse_filename);
- add_patterns_from_input(pl, argc, argv, use_stdin);
+ add_patterns_from_input(pl, argc, argv, use_stdin ? stdin : NULL);
}
static int modify_pattern_list(int argc, const char **argv, int use_stdin,
@@ -664,7 +674,8 @@ static int modify_pattern_list(int argc, const char **argv, int use_stdin,
break;
case REPLACE:
- add_patterns_from_input(pl, argc, argv, use_stdin);
+ add_patterns_from_input(pl, argc, argv,
+ use_stdin ? stdin : NULL);
break;
}
@@ -759,6 +770,7 @@ static int sparse_checkout_add(int argc, const char **argv, const char *prefix)
OPT_END(),
};
+ setup_work_tree();
if (!core_apply_sparse_checkout)
die(_("no sparse-checkout to add to"));
@@ -805,6 +817,7 @@ static int sparse_checkout_set(int argc, const char **argv, const char *prefix)
OPT_END(),
};
+ setup_work_tree();
repo_read_index(the_repository);
set_opts.cone_mode = -1;
@@ -854,6 +867,7 @@ static int sparse_checkout_reapply(int argc, const char **argv,
OPT_END(),
};
+ setup_work_tree();
if (!core_apply_sparse_checkout)
die(_("must be in a sparse-checkout to reapply sparsity patterns"));
@@ -897,6 +911,7 @@ static int sparse_checkout_disable(int argc, const char **argv,
* forcibly return to a dense checkout regardless of initial state.
*/
+ setup_work_tree();
argc = parse_options(argc, argv, prefix,
builtin_sparse_checkout_disable_options,
builtin_sparse_checkout_disable_usage, 0);
@@ -922,6 +937,91 @@ static int sparse_checkout_disable(int argc, const char **argv,
return set_config(MODE_NO_PATTERNS);
}
+static char const * const builtin_sparse_checkout_check_rules_usage[] = {
+ N_("git sparse-checkout check-rules [-z] [--skip-checks]"
+ "[--[no-]cone] [--rules-file <file>]"),
+ NULL
+};
+
+static struct sparse_checkout_check_rules_opts {
+ int cone_mode;
+ int null_termination;
+ char *rules_file;
+} check_rules_opts;
+
+static int check_rules(struct pattern_list *pl, int null_terminated) {
+ struct strbuf line = STRBUF_INIT;
+ struct strbuf unquoted = STRBUF_INIT;
+ char *path;
+ int line_terminator = null_terminated ? 0 : '\n';
+ strbuf_getline_fn getline_fn = null_terminated ? strbuf_getline_nul
+ : strbuf_getline;
+ the_repository->index->sparse_checkout_patterns = pl;
+ while (!getline_fn(&line, stdin)) {
+ path = line.buf;
+ if (!null_terminated && line.buf[0] == '"') {
+ strbuf_reset(&unquoted);
+ if (unquote_c_style(&unquoted, line.buf, NULL))
+ die(_("unable to unquote C-style string '%s'"),
+ line.buf);
+
+ path = unquoted.buf;
+ }
+
+ if (path_in_sparse_checkout(path, the_repository->index))
+ write_name_quoted(path, stdout, line_terminator);
+ }
+ strbuf_release(&line);
+ strbuf_release(&unquoted);
+
+ return 0;
+}
+
+static int sparse_checkout_check_rules(int argc, const char **argv, const char *prefix)
+{
+ static struct option builtin_sparse_checkout_check_rules_options[] = {
+ OPT_BOOL('z', NULL, &check_rules_opts.null_termination,
+ N_("terminate input and output files by a NUL character")),
+ OPT_BOOL(0, "cone", &check_rules_opts.cone_mode,
+ N_("when used with --rules-file interpret patterns as cone mode patterns")),
+ OPT_FILENAME(0, "rules-file", &check_rules_opts.rules_file,
+ N_("use patterns in <file> instead of the current ones.")),
+ OPT_END(),
+ };
+
+ FILE *fp;
+ int ret;
+ struct pattern_list pl = {0};
+ char *sparse_filename;
+ check_rules_opts.cone_mode = -1;
+
+ argc = parse_options(argc, argv, prefix,
+ builtin_sparse_checkout_check_rules_options,
+ builtin_sparse_checkout_check_rules_usage,
+ PARSE_OPT_KEEP_UNKNOWN_OPT);
+
+ if (check_rules_opts.rules_file && check_rules_opts.cone_mode < 0)
+ check_rules_opts.cone_mode = 1;
+
+ update_cone_mode(&check_rules_opts.cone_mode);
+ pl.use_cone_patterns = core_sparse_checkout_cone;
+ if (check_rules_opts.rules_file) {
+ fp = xfopen(check_rules_opts.rules_file, "r");
+ add_patterns_from_input(&pl, argc, argv, fp);
+ fclose(fp);
+ } else {
+ sparse_filename = get_sparse_checkout_filename();
+ if (add_patterns_from_file_to_list(sparse_filename, "", 0, &pl,
+ NULL, 0))
+ die(_("unable to load existing sparse-checkout patterns"));
+ free(sparse_filename);
+ }
+
+ ret = check_rules(&pl, check_rules_opts.null_termination);
+ clear_pattern_list(&pl);
+ return ret;
+}
+
int cmd_sparse_checkout(int argc, const char **argv, const char *prefix)
{
parse_opt_subcommand_fn *fn = NULL;
@@ -932,6 +1032,7 @@ int cmd_sparse_checkout(int argc, const char **argv, const char *prefix)
OPT_SUBCOMMAND("add", &fn, sparse_checkout_add),
OPT_SUBCOMMAND("reapply", &fn, sparse_checkout_reapply),
OPT_SUBCOMMAND("disable", &fn, sparse_checkout_disable),
+ OPT_SUBCOMMAND("check-rules", &fn, sparse_checkout_check_rules),
OPT_END(),
};
diff --git a/builtin/stash.c b/builtin/stash.c
index 2274aae255..a7e17ffe38 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -1,6 +1,11 @@
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "abspath.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-name.h"
#include "parse-options.h"
#include "refs.h"
#include "lockfile.h"
@@ -14,79 +19,104 @@
#include "entry.h"
#include "rerere.h"
#include "revision.h"
+#include "setup.h"
#include "log-tree.h"
#include "diffcore.h"
#include "exec-cmd.h"
#include "reflog.h"
+#include "add-interactive.h"
#define INCLUDE_ALL_FILES 2
+#define BUILTIN_STASH_LIST_USAGE \
+ N_("git stash list [<log-options>]")
+#define BUILTIN_STASH_SHOW_USAGE \
+ N_("git stash show [-u | --include-untracked | --only-untracked] [<diff-options>] [<stash>]")
+#define BUILTIN_STASH_DROP_USAGE \
+ N_("git stash drop [-q | --quiet] [<stash>]")
+#define BUILTIN_STASH_POP_USAGE \
+ N_("git stash pop [--index] [-q | --quiet] [<stash>]")
+#define BUILTIN_STASH_APPLY_USAGE \
+ N_("git stash apply [--index] [-q | --quiet] [<stash>]")
+#define BUILTIN_STASH_BRANCH_USAGE \
+ N_("git stash branch <branchname> [<stash>]")
+#define BUILTIN_STASH_STORE_USAGE \
+ N_("git stash store [(-m | --message) <message>] [-q | --quiet] <commit>")
+#define BUILTIN_STASH_PUSH_USAGE \
+ N_("git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
+ " [-u | --include-untracked] [-a | --all] [(-m | --message) <message>]\n" \
+ " [--pathspec-from-file=<file> [--pathspec-file-nul]]\n" \
+ " [--] [<pathspec>...]]")
+#define BUILTIN_STASH_SAVE_USAGE \
+ N_("git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | --quiet]\n" \
+ " [-u | --include-untracked] [-a | --all] [<message>]")
+#define BUILTIN_STASH_CREATE_USAGE \
+ N_("git stash create [<message>]")
+#define BUILTIN_STASH_CLEAR_USAGE \
+ "git stash clear"
+
static const char * const git_stash_usage[] = {
- N_("git stash list [<options>]"),
- N_("git stash show [<options>] [<stash>]"),
- N_("git stash drop [-q|--quiet] [<stash>]"),
- N_("git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"),
- N_("git stash branch <branchname> [<stash>]"),
- "git stash clear",
- N_("git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--quiet]\n"
- " [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
- " [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
- " [--] [<pathspec>...]]"),
- N_("git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--quiet]\n"
- " [-u|--include-untracked] [-a|--all] [<message>]"),
+ BUILTIN_STASH_LIST_USAGE,
+ BUILTIN_STASH_SHOW_USAGE,
+ BUILTIN_STASH_DROP_USAGE,
+ BUILTIN_STASH_POP_USAGE,
+ BUILTIN_STASH_APPLY_USAGE,
+ BUILTIN_STASH_BRANCH_USAGE,
+ BUILTIN_STASH_PUSH_USAGE,
+ BUILTIN_STASH_SAVE_USAGE,
+ BUILTIN_STASH_CLEAR_USAGE,
+ BUILTIN_STASH_CREATE_USAGE,
+ BUILTIN_STASH_STORE_USAGE,
NULL
};
static const char * const git_stash_list_usage[] = {
- N_("git stash list [<options>]"),
+ BUILTIN_STASH_LIST_USAGE,
NULL
};
static const char * const git_stash_show_usage[] = {
- N_("git stash show [<options>] [<stash>]"),
+ BUILTIN_STASH_SHOW_USAGE,
NULL
};
static const char * const git_stash_drop_usage[] = {
- N_("git stash drop [-q|--quiet] [<stash>]"),
+ BUILTIN_STASH_DROP_USAGE,
NULL
};
static const char * const git_stash_pop_usage[] = {
- N_("git stash pop [--index] [-q|--quiet] [<stash>]"),
+ BUILTIN_STASH_POP_USAGE,
NULL
};
static const char * const git_stash_apply_usage[] = {
- N_("git stash apply [--index] [-q|--quiet] [<stash>]"),
+ BUILTIN_STASH_APPLY_USAGE,
NULL
};
static const char * const git_stash_branch_usage[] = {
- N_("git stash branch <branchname> [<stash>]"),
+ BUILTIN_STASH_BRANCH_USAGE,
NULL
};
static const char * const git_stash_clear_usage[] = {
- "git stash clear",
+ BUILTIN_STASH_CLEAR_USAGE,
NULL
};
static const char * const git_stash_store_usage[] = {
- N_("git stash store [-m|--message <message>] [-q|--quiet] <commit>"),
+ BUILTIN_STASH_STORE_USAGE,
NULL
};
static const char * const git_stash_push_usage[] = {
- N_("git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
- " [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
- " [--] [<pathspec>...]]"),
+ BUILTIN_STASH_PUSH_USAGE,
NULL
};
static const char * const git_stash_save_usage[] = {
- N_("git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
- " [-u|--include-untracked] [-a|--all] [<message>]"),
+ BUILTIN_STASH_SAVE_USAGE,
NULL
};
@@ -177,7 +207,7 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)
revision = info->revision.buf;
- if (get_oid(revision, &info->w_commit))
+ if (repo_get_oid(the_repository, revision, &info->w_commit))
return error(_("%s is not a valid reference"), revision);
assert_stash_like(info, revision);
@@ -187,7 +217,8 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)
end_of_rev = strchrnul(revision, '@');
strbuf_add(&symbolic, revision, end_of_rev - revision);
- ret = dwim_ref(symbolic.buf, symbolic.len, &dummy, &expanded_ref, 0);
+ ret = repo_dwim_ref(the_repository, symbolic.buf, symbolic.len,
+ &dummy, &expanded_ref, 0);
strbuf_release(&symbolic);
switch (ret) {
case 0: /* Not found, but valid ref */
@@ -207,7 +238,7 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)
static int do_clear_stash(void)
{
struct object_id obj;
- if (get_oid(ref_stash, &obj))
+ if (repo_get_oid(the_repository, ref_stash, &obj))
return 0;
return delete_ref(NULL, ref_stash, &obj, 0);
@@ -238,11 +269,11 @@ static int reset_tree(struct object_id *i_tree, int update, int reset)
struct tree *tree;
struct lock_file lock_file = LOCK_INIT;
- read_cache_preload(NULL);
- if (refresh_cache(REFRESH_QUIET))
+ repo_read_index_preload(the_repository, NULL, 0);
+ if (refresh_index(&the_index, REFRESH_QUIET, NULL, NULL, NULL))
return -1;
- hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &lock_file, LOCK_DIE_ON_ERROR);
memset(&opts, 0, sizeof(opts));
@@ -403,7 +434,7 @@ static void unstage_changes_unless_new(struct object_id *orig_tree)
* to the index before a merge was run) and the current index
* (reflecting the changes brought in by the merge).
*/
- diff_setup(&diff_opts);
+ repo_diff_setup(the_repository, &diff_opts);
diff_opts.flags.recursive = 1;
diff_opts.detect_rename = 0;
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
@@ -431,10 +462,10 @@ static void unstage_changes_unless_new(struct object_id *orig_tree)
* path, but left it out of the working tree, then clear the
* SKIP_WORKTREE bit and write it to the working tree.
*/
- if (pos >= 0 && ce_skip_worktree(active_cache[pos])) {
+ if (pos >= 0 && ce_skip_worktree(the_index.cache[pos])) {
struct stat st;
- ce = active_cache[pos];
+ ce = the_index.cache[pos];
if (!lstat(ce->name, &st)) {
/* Conflicting path present; relocate it */
struct strbuf new_path = STRBUF_INIT;
@@ -500,11 +531,13 @@ static int do_apply_stash(const char *prefix, struct stash_info *info,
struct tree *head, *merge, *merge_base;
struct lock_file lock = LOCK_INIT;
- read_cache_preload(NULL);
- if (refresh_and_write_cache(REFRESH_QUIET, 0, 0))
+ repo_read_index_preload(the_repository, NULL, 0);
+ if (repo_refresh_and_write_index(the_repository, REFRESH_QUIET, 0, 0,
+ NULL, NULL, NULL))
return -1;
- if (write_cache_as_tree(&c_tree, 0, NULL))
+ if (write_index_as_tree(&c_tree, &the_index, get_index_file(), 0,
+ NULL))
return error(_("cannot apply a stash in the middle of a merge"));
if (index) {
@@ -526,14 +559,15 @@ static int do_apply_stash(const char *prefix, struct stash_info *info,
return error(_("conflicts in index. "
"Try without --index."));
- discard_cache();
- read_cache();
- if (write_cache_as_tree(&index_tree, 0, NULL))
+ discard_index(&the_index);
+ repo_read_index(the_repository);
+ if (write_index_as_tree(&index_tree, &the_index,
+ get_index_file(), 0, NULL))
return error(_("could not save index tree"));
reset_head();
- discard_cache();
- read_cache();
+ discard_index(&the_index);
+ repo_read_index(the_repository);
}
}
@@ -573,7 +607,7 @@ static int do_apply_stash(const char *prefix, struct stash_info *info,
ret = error(_("could not write index"));
if (ret) {
- rerere(0);
+ repo_rerere(the_repository, 0);
if (index)
fprintf_ln(stderr, _("Index was not unstashed."));
@@ -873,7 +907,7 @@ static int show_stash(int argc, const char **argv, const char *prefix)
init_diff_ui_defaults();
git_config(git_diff_ui_config, NULL);
- init_revisions(&rev, prefix);
+ repo_init_revisions(the_repository, &rev, prefix);
argc = parse_options(argc, argv, prefix, options, git_stash_show_usage,
PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN_OPT |
@@ -1056,13 +1090,13 @@ static int check_changes_tracked_files(const struct pathspec *ps)
int ret = 0;
/* No initial commit. */
- if (get_oid("HEAD", &dummy))
+ if (repo_get_oid(the_repository, "HEAD", &dummy))
return -1;
- if (read_cache() < 0)
+ if (repo_read_index(the_repository) < 0)
return -1;
- init_revisions(&rev, NULL);
+ repo_init_revisions(the_repository, &rev, NULL);
copy_pathspec(&rev.prune_data, ps);
rev.diffopt.flags.quick = 1;
@@ -1113,7 +1147,7 @@ static int save_untracked_files(struct stash_info *info, struct strbuf *msg,
int ret = 0;
struct strbuf untracked_msg = STRBUF_INIT;
struct child_process cp_upd_index = CHILD_PROCESS_INIT;
- struct index_state istate = { NULL };
+ struct index_state istate = INDEX_STATE_INIT(the_repository);
cp_upd_index.git_cmd = 1;
strvec_pushl(&cp_upd_index.args, "update-index", "-z", "--add",
@@ -1141,7 +1175,7 @@ static int save_untracked_files(struct stash_info *info, struct strbuf *msg,
}
done:
- discard_index(&istate);
+ release_index(&istate);
strbuf_release(&untracked_msg);
remove_path(stash_index_path.buf);
return ret;
@@ -1152,7 +1186,7 @@ static int stash_staged(struct stash_info *info, struct strbuf *out_patch,
{
int ret = 0;
struct child_process cp_diff_tree = CHILD_PROCESS_INIT;
- struct index_state istate = { NULL };
+ struct index_state istate = INDEX_STATE_INIT(the_repository);
if (write_index_as_tree(&info->w_tree, &istate, the_repository->index_file,
0, NULL)) {
@@ -1175,7 +1209,7 @@ static int stash_staged(struct stash_info *info, struct strbuf *out_patch,
}
done:
- discard_index(&istate);
+ release_index(&istate);
return ret;
}
@@ -1185,7 +1219,7 @@ static int stash_patch(struct stash_info *info, const struct pathspec *ps,
int ret = 0;
struct child_process cp_read_tree = CHILD_PROCESS_INIT;
struct child_process cp_diff_tree = CHILD_PROCESS_INIT;
- struct index_state istate = { NULL };
+ struct index_state istate = INDEX_STATE_INIT(the_repository);
char *old_index_env = NULL, *old_repo_index_file;
remove_path(stash_index_path.buf);
@@ -1205,7 +1239,7 @@ static int stash_patch(struct stash_info *info, const struct pathspec *ps,
old_index_env = xstrdup_or_null(getenv(INDEX_ENVIRONMENT));
setenv(INDEX_ENVIRONMENT, the_repository->index_file, 1);
- ret = run_add_interactive(NULL, "--patch=stash", ps);
+ ret = !!run_add_p(the_repository, ADD_P_STASH, NULL, ps);
the_repository->index_file = old_repo_index_file;
if (old_index_env && *old_index_env)
@@ -1236,7 +1270,7 @@ static int stash_patch(struct stash_info *info, const struct pathspec *ps,
}
done:
- discard_index(&istate);
+ release_index(&istate);
remove_path(stash_index_path.buf);
return ret;
}
@@ -1247,9 +1281,9 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps
struct rev_info rev;
struct child_process cp_upd_index = CHILD_PROCESS_INIT;
struct strbuf diff_output = STRBUF_INIT;
- struct index_state istate = { NULL };
+ struct index_state istate = INDEX_STATE_INIT(the_repository);
- init_revisions(&rev, NULL);
+ repo_init_revisions(the_repository, &rev, NULL);
copy_pathspec(&rev.prune_data, ps);
set_alternate_index_output(stash_index_path.buf);
@@ -1263,7 +1297,7 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps
rev.diffopt.format_callback = add_diff_to_buf;
rev.diffopt.format_callback_data = &diff_output;
- if (read_cache_preload(&rev.diffopt.pathspec) < 0) {
+ if (repo_read_index_preload(the_repository, &rev.diffopt.pathspec, 0) < 0) {
ret = -1;
goto done;
}
@@ -1295,7 +1329,7 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps
}
done:
- discard_index(&istate);
+ release_index(&istate);
release_revisions(&rev);
strbuf_release(&diff_output);
remove_path(stash_index_path.buf);
@@ -1321,13 +1355,14 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b
prepare_fallback_ident("git stash", "git@stash");
- read_cache_preload(NULL);
- if (refresh_and_write_cache(REFRESH_QUIET, 0, 0) < 0) {
+ repo_read_index_preload(the_repository, NULL, 0);
+ if (repo_refresh_and_write_index(the_repository, REFRESH_QUIET, 0, 0,
+ NULL, NULL, NULL) < 0) {
ret = -1;
goto done;
}
- if (get_oid("HEAD", &info->b_commit)) {
+ if (repo_get_oid(the_repository, "HEAD", &info->b_commit)) {
if (!quiet)
fprintf_ln(stderr, _("You do not have "
"the initial commit yet"));
@@ -1345,14 +1380,16 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b
branch_ref = resolve_ref_unsafe("HEAD", 0, NULL, &flags);
if (flags & REF_ISSYMREF)
skip_prefix(branch_ref, "refs/heads/", &branch_name);
- head_short_sha1 = find_unique_abbrev(&head_commit->object.oid,
- DEFAULT_ABBREV);
+ head_short_sha1 = repo_find_unique_abbrev(the_repository,
+ &head_commit->object.oid,
+ DEFAULT_ABBREV);
strbuf_addf(&msg, "%s: %s ", branch_name, head_short_sha1);
pp_commit_easy(CMIT_FMT_ONELINE, head_commit, &msg);
strbuf_addf(&commit_tree_label, "index on %s\n", msg.buf);
commit_list_insert(head_commit, &parents);
- if (write_cache_as_tree(&info->i_tree, 0, NULL) ||
+ if (write_index_as_tree(&info->i_tree, &the_index, get_index_file(), 0,
+ NULL) ||
commit_tree(commit_tree_label.buf, commit_tree_label.len,
&info->i_tree, parents, &info->i_commit, NULL, NULL)) {
if (!quiet)
@@ -1436,7 +1473,7 @@ done:
return ret;
}
-static int create_stash(int argc, const char **argv, const char *prefix)
+static int create_stash(int argc, const char **argv, const char *prefix UNUSED)
{
int ret;
struct strbuf stash_msg_buf = STRBUF_INIT;
@@ -1490,15 +1527,15 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
goto done;
}
- read_cache_preload(NULL);
+ repo_read_index_preload(the_repository, NULL, 0);
if (!include_untracked && ps->nr) {
int i;
char *ps_matched = xcalloc(ps->nr, 1);
/* TODO: audit for interaction with sparse-index. */
ensure_full_index(&the_index);
- for (i = 0; i < active_nr; i++)
- ce_path_match(&the_index, active_cache[i], ps,
+ for (i = 0; i < the_index.cache_nr; i++)
+ ce_path_match(&the_index, the_index.cache[i], ps,
ps_matched);
if (report_path_error(ps_matched, ps)) {
@@ -1510,7 +1547,8 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
free(ps_matched);
}
- if (refresh_and_write_cache(REFRESH_QUIET, 0, 0)) {
+ if (repo_refresh_and_write_index(the_repository, REFRESH_QUIET, 0, 0,
+ NULL, NULL, NULL)) {
ret = -1;
goto done;
}
@@ -1567,7 +1605,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
goto done;
}
}
- discard_cache();
+ discard_index(&the_index);
if (ps->nr) {
struct child_process cp_add = CHILD_PROCESS_INIT;
struct child_process cp_diff = CHILD_PROCESS_INIT;
@@ -1663,8 +1701,10 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
}
done:
+ strbuf_release(&patch);
free_stash_info(&info);
strbuf_release(&stash_msg_buf);
+ strbuf_release(&untracked_files);
return ret;
}
@@ -1699,6 +1739,7 @@ static int push_stash(int argc, const char **argv, const char *prefix,
OPT_PATHSPEC_FILE_NUL(&pathspec_file_nul),
OPT_END()
};
+ int ret;
if (argc) {
force_assume = !strcmp(argv[0], "-p");
@@ -1738,8 +1779,10 @@ static int push_stash(int argc, const char **argv, const char *prefix,
die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file");
}
- return do_push_stash(&ps, stash_msg, quiet, keep_index, patch_mode,
- include_untracked, only_staged);
+ ret = do_push_stash(&ps, stash_msg, quiet, keep_index, patch_mode,
+ include_untracked, only_staged);
+ clear_pathspec(&ps);
+ return ret;
}
static int push_stash_unassumed(int argc, const char **argv, const char *prefix)
diff --git a/builtin/stripspace.c b/builtin/stripspace.c
index 1e34cf2beb..9451eb69ff 100644
--- a/builtin/stripspace.c
+++ b/builtin/stripspace.c
@@ -1,8 +1,11 @@
#include "builtin.h"
#include "cache.h"
#include "config.h"
+#include "gettext.h"
#include "parse-options.h"
+#include "setup.h"
#include "strbuf.h"
+#include "write-or-die.h"
static void comment_lines(struct strbuf *buf)
{
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 0b4acb442b..6bf8d666ce 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1,5 +1,10 @@
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "abspath.h"
+#include "alloc.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "cache.h"
#include "config.h"
@@ -7,6 +12,7 @@
#include "quote.h"
#include "pathspec.h"
#include "dir.h"
+#include "setup.h"
#include "submodule.h"
#include "submodule-config.h"
#include "string-list.h"
@@ -18,6 +24,8 @@
#include "revision.h"
#include "diffcore.h"
#include "diff.h"
+#include "object-file.h"
+#include "object-name.h"
#include "object-store.h"
#include "advice.h"
#include "branch.h"
@@ -113,10 +121,9 @@ static char *resolve_relative_url(const char *rel_url, const char *up_path, int
}
/* the result should be freed by the caller. */
-static char *get_submodule_displaypath(const char *path, const char *prefix)
+static char *get_submodule_displaypath(const char *path, const char *prefix,
+ const char *super_prefix)
{
- const char *super_prefix = get_super_prefix();
-
if (prefix && super_prefix) {
BUG("cannot have prefix '%s' and superprefix '%s'",
prefix, super_prefix);
@@ -181,7 +188,7 @@ static void module_list_release(struct module_list *ml)
free(ml->entries);
}
-static int module_list_compute(int argc, const char **argv,
+static int module_list_compute(const char **argv,
const char *prefix,
struct pathspec *pathspec,
struct module_list *list)
@@ -196,11 +203,11 @@ static int module_list_compute(int argc, const char **argv,
if (pathspec->nr)
ps_matched = xcalloc(pathspec->nr, 1);
- if (read_cache() < 0)
+ if (repo_read_index(the_repository) < 0)
die(_("index file corrupt"));
- for (i = 0; i < active_nr; i++) {
- const struct cache_entry *ce = active_cache[i];
+ for (i = 0; i < the_index.cache_nr; i++) {
+ const struct cache_entry *ce = the_index.cache[i];
if (!match_pathspec(&the_index, pathspec, ce->name, ce_namelen(ce),
0, ps_matched, 1) ||
@@ -209,8 +216,8 @@ static int module_list_compute(int argc, const char **argv,
ALLOC_GROW(list->entries, list->nr + 1, list->alloc);
list->entries[list->nr++] = ce;
- while (i + 1 < active_nr &&
- !strcmp(ce->name, active_cache[i + 1]->name))
+ while (i + 1 < the_index.cache_nr &&
+ !strcmp(ce->name, the_index.cache[i + 1]->name))
/*
* Skip entries with the same name in different stages
* to make sure an entry is returned only once.
@@ -279,6 +286,7 @@ struct foreach_cb {
int argc;
const char **argv;
const char *prefix;
+ const char *super_prefix;
int quiet;
int recursive;
};
@@ -294,7 +302,8 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item,
struct child_process cp = CHILD_PROCESS_INIT;
char *displaypath;
- displaypath = get_submodule_displaypath(path, info->prefix);
+ displaypath = get_submodule_displaypath(path, info->prefix,
+ info->super_prefix);
sub = submodule_from_path(the_repository, null_oid(), path);
@@ -364,10 +373,10 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item,
cpr.dir = path;
prepare_submodule_repo_env(&cpr.env);
- strvec_pushl(&cpr.args, "--super-prefix", NULL);
- strvec_pushf(&cpr.args, "%s/", displaypath);
strvec_pushl(&cpr.args, "submodule--helper", "foreach", "--recursive",
NULL);
+ strvec_pushl(&cpr.args, "--super-prefix", NULL);
+ strvec_pushf(&cpr.args, "%s/", displaypath);
if (info->quiet)
strvec_push(&cpr.args, "--quiet");
@@ -391,6 +400,7 @@ static int module_foreach(int argc, const char **argv, const char *prefix)
struct pathspec pathspec = { 0 };
struct module_list list = MODULE_LIST_INIT;
struct option module_foreach_options[] = {
+ OPT__SUPER_PREFIX(&info.super_prefix),
OPT__QUIET(&info.quiet, N_("suppress output of entering each submodule command")),
OPT_BOOL(0, "recursive", &info.recursive,
N_("recurse into nested submodules")),
@@ -405,7 +415,7 @@ static int module_foreach(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, module_foreach_options,
git_submodule_helper_usage, 0);
- if (module_list_compute(0, NULL, prefix, &pathspec, &list) < 0)
+ if (module_list_compute(NULL, prefix, &pathspec, &list) < 0)
goto cleanup;
info.argc = argc;
@@ -435,11 +445,13 @@ static int starts_with_dot_dot_slash(const char *const path)
struct init_cb {
const char *prefix;
+ const char *super_prefix;
unsigned int flags;
};
#define INIT_CB_INIT { 0 }
static void init_submodule(const char *path, const char *prefix,
+ const char *super_prefix,
unsigned int flags)
{
const struct submodule *sub;
@@ -447,7 +459,7 @@ static void init_submodule(const char *path, const char *prefix,
const char *upd;
char *url = NULL, *displaypath;
- displaypath = get_submodule_displaypath(path, prefix);
+ displaypath = get_submodule_displaypath(path, prefix, super_prefix);
sub = submodule_from_path(the_repository, null_oid(), path);
@@ -523,7 +535,8 @@ static void init_submodule_cb(const struct cache_entry *list_item, void *cb_data
{
struct init_cb *info = cb_data;
- init_submodule(list_item->name, info->prefix, info->flags);
+ init_submodule(list_item->name, info->prefix, info->super_prefix,
+ info->flags);
}
static int module_init(int argc, const char **argv, const char *prefix)
@@ -545,14 +558,14 @@ static int module_init(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, module_init_options,
git_submodule_helper_usage, 0);
- if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0)
+ if (module_list_compute(argv, prefix, &pathspec, &list) < 0)
goto cleanup;
/*
* If there are no path args and submodule.active is set then,
* by default, only initialize 'active' modules.
*/
- if (!argc && git_config_get_value_multi("submodule.active"))
+ if (!argc && !git_config_get("submodule.active"))
module_list_active(&list);
info.prefix = prefix;
@@ -570,6 +583,7 @@ cleanup:
struct status_cb {
const char *prefix;
+ const char *super_prefix;
unsigned int flags;
};
#define STATUS_CB_INIT { 0 }
@@ -608,7 +622,7 @@ static int handle_submodule_head_ref(const char *refname UNUSED,
static void status_submodule(const char *path, const struct object_id *ce_oid,
unsigned int ce_flags, const char *prefix,
- unsigned int flags)
+ const char *super_prefix, unsigned int flags)
{
char *displaypath;
struct strvec diff_files_args = STRVEC_INIT;
@@ -616,12 +630,15 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
int diff_files_result;
struct strbuf buf = STRBUF_INIT;
const char *git_dir;
+ struct setup_revision_opt opt = {
+ .free_removed_argv_elements = 1,
+ };
if (!submodule_from_path(the_repository, null_oid(), path))
die(_("no submodule mapping found in .gitmodules for path '%s'"),
path);
- displaypath = get_submodule_displaypath(path, prefix);
+ displaypath = get_submodule_displaypath(path, prefix, super_prefix);
if ((CE_STAGEMASK & ce_flags) >> CE_STAGESHIFT) {
print_status(flags, 'U', path, null_oid(), displaypath);
@@ -649,9 +666,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
repo_init_revisions(the_repository, &rev, NULL);
rev.abbrev = 0;
- diff_files_args.nr = setup_revisions(diff_files_args.nr,
- diff_files_args.v,
- &rev, NULL);
+ setup_revisions(diff_files_args.nr, diff_files_args.v, &rev, &opt);
diff_files_result = run_diff_files(&rev, 0);
if (!diff_result_code(&rev.diffopt, diff_files_result)) {
@@ -681,10 +696,10 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
cpr.dir = path;
prepare_submodule_repo_env(&cpr.env);
- strvec_push(&cpr.args, "--super-prefix");
- strvec_pushf(&cpr.args, "%s/", displaypath);
strvec_pushl(&cpr.args, "submodule--helper", "status",
"--recursive", NULL);
+ strvec_push(&cpr.args, "--super-prefix");
+ strvec_pushf(&cpr.args, "%s/", displaypath);
if (flags & OPT_CACHED)
strvec_push(&cpr.args, "--cached");
@@ -708,7 +723,7 @@ static void status_submodule_cb(const struct cache_entry *list_item,
struct status_cb *info = cb_data;
status_submodule(list_item->name, &list_item->oid, list_item->ce_flags,
- info->prefix, info->flags);
+ info->prefix, info->super_prefix, info->flags);
}
static int module_status(int argc, const char **argv, const char *prefix)
@@ -718,6 +733,7 @@ static int module_status(int argc, const char **argv, const char *prefix)
struct module_list list = MODULE_LIST_INIT;
int quiet = 0;
struct option module_status_options[] = {
+ OPT__SUPER_PREFIX(&info.super_prefix),
OPT__QUIET(&quiet, N_("suppress submodule status output")),
OPT_BIT(0, "cached", &info.flags, N_("use commit stored in the index instead of the one stored in the submodule HEAD"), OPT_CACHED),
OPT_BIT(0, "recursive", &info.flags, N_("recurse into nested submodules"), OPT_RECURSIVE),
@@ -732,7 +748,7 @@ static int module_status(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, module_status_options,
git_submodule_helper_usage, 0);
- if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0)
+ if (module_list_compute(argv, prefix, &pathspec, &list) < 0)
goto cleanup;
info.prefix = prefix;
@@ -786,6 +802,7 @@ struct summary_cb {
int argc;
const char **argv;
const char *prefix;
+ const char *super_prefix;
unsigned int cached: 1;
unsigned int for_status: 1;
unsigned int files: 1;
@@ -947,7 +964,8 @@ static void generate_submodule_summary(struct summary_cb *info,
dst_abbrev = xstrndup(oid_to_hex(&p->oid_dst), 7);
}
- displaypath = get_submodule_displaypath(p->sm_path, info->prefix);
+ displaypath = get_submodule_displaypath(p->sm_path, info->prefix,
+ info->super_prefix);
if (!missing_src && !missing_dst) {
struct child_process cp_rev_list = CHILD_PROCESS_INIT;
@@ -1042,7 +1060,7 @@ static void prepare_submodule_summary(struct summary_cb *info,
}
static void submodule_summary_callback(struct diff_queue_struct *q,
- struct diff_options *options,
+ struct diff_options *options UNUSED,
void *data)
{
int i;
@@ -1098,7 +1116,7 @@ static int compute_summary_module_list(struct object_id *head_oid,
strvec_pushv(&diff_args, info->argv);
git_config(git_diff_basic_config, NULL);
- init_revisions(&rev, info->prefix);
+ repo_init_revisions(the_repository, &rev, info->prefix);
rev.abbrev = 0;
precompose_argv_prefix(diff_args.nr, diff_args.v, NULL);
setup_revisions(diff_args.nr, diff_args.v, &rev, &opt);
@@ -1109,13 +1127,13 @@ static int compute_summary_module_list(struct object_id *head_oid,
if (!info->cached) {
if (diff_cmd == DIFF_INDEX)
setup_work_tree();
- if (read_cache_preload(&rev.diffopt.pathspec) < 0) {
- perror("read_cache_preload");
+ if (repo_read_index_preload(the_repository, &rev.diffopt.pathspec, 0) < 0) {
+ perror("repo_read_index_preload");
ret = -1;
goto cleanup;
}
- } else if (read_cache() < 0) {
- perror("read_cache");
+ } else if (repo_read_index(the_repository) < 0) {
+ perror("repo_read_cache");
ret = -1;
goto cleanup;
}
@@ -1164,7 +1182,7 @@ static int module_summary(int argc, const char **argv, const char *prefix)
if (!summary_limit)
return 0;
- if (!get_oid(argc ? argv[0] : "HEAD", &head_oid)) {
+ if (!repo_get_oid(the_repository, argc ? argv[0] : "HEAD", &head_oid)) {
if (argc) {
argv++;
argc--;
@@ -1177,7 +1195,7 @@ static int module_summary(int argc, const char **argv, const char *prefix)
argc--;
}
} else {
- if (get_oid("HEAD", &head_oid))
+ if (repo_get_oid(the_repository, "HEAD", &head_oid))
die(_("could not fetch a revision for HEAD"));
}
@@ -1202,12 +1220,13 @@ static int module_summary(int argc, const char **argv, const char *prefix)
struct sync_cb {
const char *prefix;
+ const char *super_prefix;
unsigned int flags;
};
#define SYNC_CB_INIT { 0 }
static void sync_submodule(const char *path, const char *prefix,
- unsigned int flags)
+ const char *super_prefix, unsigned int flags)
{
const struct submodule *sub;
char *remote_key = NULL;
@@ -1238,7 +1257,7 @@ static void sync_submodule(const char *path, const char *prefix,
super_config_url = xstrdup("");
}
- displaypath = get_submodule_displaypath(path, prefix);
+ displaypath = get_submodule_displaypath(path, prefix, super_prefix);
if (!(flags & OPT_QUIET))
printf(_("Synchronizing submodule url for '%s'\n"),
@@ -1275,10 +1294,11 @@ static void sync_submodule(const char *path, const char *prefix,
cpr.dir = path;
prepare_submodule_repo_env(&cpr.env);
- strvec_push(&cpr.args, "--super-prefix");
- strvec_pushf(&cpr.args, "%s/", displaypath);
strvec_pushl(&cpr.args, "submodule--helper", "sync",
"--recursive", NULL);
+ strvec_push(&cpr.args, "--super-prefix");
+ strvec_pushf(&cpr.args, "%s/", displaypath);
+
if (flags & OPT_QUIET)
strvec_push(&cpr.args, "--quiet");
@@ -1301,7 +1321,8 @@ static void sync_submodule_cb(const struct cache_entry *list_item, void *cb_data
{
struct sync_cb *info = cb_data;
- sync_submodule(list_item->name, info->prefix, info->flags);
+ sync_submodule(list_item->name, info->prefix, info->super_prefix,
+ info->flags);
}
static int module_sync(int argc, const char **argv, const char *prefix)
@@ -1312,6 +1333,7 @@ static int module_sync(int argc, const char **argv, const char *prefix)
int quiet = 0;
int recursive = 0;
struct option module_sync_options[] = {
+ OPT__SUPER_PREFIX(&info.super_prefix),
OPT__QUIET(&quiet, N_("suppress output of synchronizing submodule url")),
OPT_BOOL(0, "recursive", &recursive,
N_("recurse into nested submodules")),
@@ -1326,7 +1348,7 @@ static int module_sync(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, module_sync_options,
git_submodule_helper_usage, 0);
- if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0)
+ if (module_list_compute(argv, prefix, &pathspec, &list) < 0)
goto cleanup;
info.prefix = prefix;
@@ -1364,7 +1386,7 @@ static void deinit_submodule(const char *path, const char *prefix,
if (!sub || !sub->name)
goto cleanup;
- displaypath = get_submodule_displaypath(path, prefix);
+ displaypath = get_submodule_displaypath(path, prefix, NULL);
/* remove the submodule work tree (unless the user already did it) */
if (is_directory(path)) {
@@ -1378,8 +1400,7 @@ static void deinit_submodule(const char *path, const char *prefix,
".git file by using absorbgitdirs."),
displaypath);
- absorb_git_dir_into_superproject(path,
- ABSORB_GITDIR_RECURSE_SUBMODULES);
+ absorb_git_dir_into_superproject(path, NULL);
}
@@ -1479,7 +1500,7 @@ static int module_deinit(int argc, const char **argv, const char *prefix)
if (!argc && !all)
die(_("Use '--all' if you really want to deinitialize all submodules"));
- if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0)
+ if (module_list_compute(argv, prefix, &pathspec, &list) < 0)
goto cleanup;
info.prefix = prefix;
@@ -1883,6 +1904,7 @@ static void submodule_update_clone_release(struct submodule_update_clone *suc)
struct update_data {
const char *prefix;
+ const char *super_prefix;
char *displaypath;
enum submodule_update_type update_default;
struct object_id suboid;
@@ -1958,7 +1980,8 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
enum submodule_update_type update_type;
char *key;
const struct update_data *ud = suc->update_data;
- char *displaypath = get_submodule_displaypath(ce->name, ud->prefix);
+ char *displaypath = get_submodule_displaypath(ce->name, ud->prefix,
+ ud->super_prefix);
struct strbuf sb = STRBUF_INIT;
int needs_cloning = 0;
int need_free_url = 0;
@@ -2117,9 +2140,9 @@ static int update_clone_get_next_task(struct child_process *child,
return 0;
}
-static int update_clone_start_failure(struct strbuf *err,
+static int update_clone_start_failure(struct strbuf *err UNUSED,
void *suc_cb,
- void *idx_task_cb)
+ void *idx_task_cb UNUSED)
{
struct submodule_update_clone *suc = suc_cb;
@@ -2438,11 +2461,11 @@ static void update_data_to_args(const struct update_data *update_data,
{
enum submodule_update_type update_type = update_data->update_default;
+ strvec_pushl(args, "submodule--helper", "update", "--recursive", NULL);
if (update_data->displaypath) {
strvec_push(args, "--super-prefix");
strvec_pushf(args, "%s/", update_data->displaypath);
}
- strvec_pushl(args, "submodule--helper", "update", "--recursive", NULL);
strvec_pushf(args, "--jobs=%d", update_data->max_jobs);
if (update_data->quiet)
strvec_push(args, "--quiet");
@@ -2567,12 +2590,20 @@ static int update_submodules(struct update_data *update_data)
{
int i, ret = 0;
struct submodule_update_clone suc = SUBMODULE_UPDATE_CLONE_INIT;
+ const struct run_process_parallel_opts opts = {
+ .tr2_category = "submodule",
+ .tr2_label = "parallel/update",
+
+ .processes = update_data->max_jobs,
+
+ .get_next_task = update_clone_get_next_task,
+ .start_failure = update_clone_start_failure,
+ .task_finished = update_clone_task_finished,
+ .data = &suc,
+ };
suc.update_data = update_data;
- run_processes_parallel_tr2(suc.update_data->max_jobs, update_clone_get_next_task,
- update_clone_start_failure,
- update_clone_task_finished, &suc, "submodule",
- "parallel/update");
+ run_processes_parallel(&opts);
/*
* We saved the output and put it out all at once now.
@@ -2600,7 +2631,8 @@ static int update_submodules(struct update_data *update_data)
goto fail;
update_data->displaypath = get_submodule_displaypath(
- update_data->sm_path, update_data->prefix);
+ update_data->sm_path, update_data->prefix,
+ update_data->super_prefix);
code = update_submodule(update_data);
FREE_AND_NULL(update_data->displaypath);
fail:
@@ -2626,6 +2658,7 @@ static int module_update(int argc, const char **argv, const char *prefix)
LIST_OBJECTS_FILTER_INIT;
int ret;
struct option module_update_options[] = {
+ OPT__SUPER_PREFIX(&opt.super_prefix),
OPT__FORCE(&opt.force, N_("force checkout updates"), 0),
OPT_BOOL(0, "init", &opt.init,
N_("initialize uninitialized submodules before update")),
@@ -2635,9 +2668,6 @@ static int module_update(int argc, const char **argv, const char *prefix)
N_("traverse submodules recursively")),
OPT_BOOL('N', "no-fetch", &opt.nofetch,
N_("don't fetch new objects from the remote site")),
- OPT_STRING(0, "prefix", &opt.prefix,
- N_("path"),
- N_("path into the working tree")),
OPT_SET_INT(0, "checkout", &opt.update_default,
N_("use the 'checkout' update strategy (default)"),
SM_UPDATE_CHECKOUT),
@@ -2693,11 +2723,12 @@ static int module_update(int argc, const char **argv, const char *prefix)
}
opt.filter_options = &filter_options;
+ opt.prefix = prefix;
if (opt.update_default)
opt.update_strategy.type = opt.update_default;
- if (module_list_compute(argc, argv, prefix, &pathspec, &opt.list) < 0) {
+ if (module_list_compute(argv, prefix, &pathspec, &opt.list) < 0) {
ret = 1;
goto cleanup;
}
@@ -2709,7 +2740,7 @@ static int module_update(int argc, const char **argv, const char *prefix)
struct module_list list = MODULE_LIST_INIT;
struct init_cb info = INIT_CB_INIT;
- if (module_list_compute(argc, argv, opt.prefix,
+ if (module_list_compute(argv, opt.prefix,
&pathspec2, &list) < 0) {
module_list_release(&list);
ret = 1;
@@ -2720,10 +2751,11 @@ static int module_update(int argc, const char **argv, const char *prefix)
* If there are no path args and submodule.active is set then,
* by default, only initialize 'active' modules.
*/
- if (!argc && git_config_get_value_multi("submodule.active"))
+ if (!argc && !git_config_get("submodule.active"))
module_list_active(&list);
info.prefix = opt.prefix;
+ info.super_prefix = opt.super_prefix;
if (opt.quiet)
info.flags |= OPT_QUIET;
@@ -2740,7 +2772,7 @@ cleanup:
return ret;
}
-static int push_check(int argc, const char **argv, const char *prefix)
+static int push_check(int argc, const char **argv, const char *prefix UNUSED)
{
struct remote *remote;
const char *superproject_head;
@@ -2822,13 +2854,9 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
int i;
struct pathspec pathspec = { 0 };
struct module_list list = MODULE_LIST_INIT;
- unsigned flags = ABSORB_GITDIR_RECURSE_SUBMODULES;
+ const char *super_prefix = NULL;
struct option embed_gitdir_options[] = {
- OPT_STRING(0, "prefix", &prefix,
- N_("path"),
- N_("path into the working tree")),
- OPT_BIT(0, "--recursive", &flags, N_("recurse into submodules"),
- ABSORB_GITDIR_RECURSE_SUBMODULES),
+ OPT__SUPER_PREFIX(&super_prefix),
OPT_END()
};
const char *const git_submodule_helper_usage[] = {
@@ -2840,11 +2868,12 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, embed_gitdir_options,
git_submodule_helper_usage, 0);
- if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0)
+ if (module_list_compute(argv, prefix, &pathspec, &list) < 0)
goto cleanup;
for (i = 0; i < list.nr; i++)
- absorb_git_dir_into_superproject(list.entries[i]->name, flags);
+ absorb_git_dir_into_superproject(list.entries[i]->name,
+ super_prefix);
ret = 0;
cleanup:
@@ -2853,51 +2882,6 @@ cleanup:
return ret;
}
-static int module_config(int argc, const char **argv, const char *prefix)
-{
- enum {
- CHECK_WRITEABLE = 1,
- DO_UNSET = 2
- } command = 0;
- struct option module_config_options[] = {
- OPT_CMDMODE(0, "check-writeable", &command,
- N_("check if it is safe to write to the .gitmodules file"),
- CHECK_WRITEABLE),
- OPT_CMDMODE(0, "unset", &command,
- N_("unset the config in the .gitmodules file"),
- DO_UNSET),
- OPT_END()
- };
- const char *const git_submodule_helper_usage[] = {
- N_("git submodule--helper config <name> [<value>]"),
- N_("git submodule--helper config --unset <name>"),
- "git submodule--helper config --check-writeable",
- NULL
- };
-
- argc = parse_options(argc, argv, prefix, module_config_options,
- git_submodule_helper_usage, PARSE_OPT_KEEP_ARGV0);
-
- if (argc == 1 && command == CHECK_WRITEABLE)
- return is_writing_gitmodules_ok() ? 0 : -1;
-
- /* Equivalent to ACTION_GET in builtin/config.c */
- if (argc == 2 && command != DO_UNSET)
- return print_config_from_gitmodules(the_repository, argv[1]);
-
- /* Equivalent to ACTION_SET in builtin/config.c */
- if (argc == 3 || (argc == 2 && command == DO_UNSET)) {
- const char *value = (argc == 3) ? argv[2] : NULL;
-
- if (!is_writing_gitmodules_ok())
- die(_("please make sure that the .gitmodules file is in the working tree"));
-
- return config_set_in_gitmodules_file_gently(argv[1], value);
- }
-
- usage_with_options(git_submodule_helper_usage, module_config_options);
-}
-
static int module_set_url(int argc, const char **argv, const char *prefix)
{
int quiet = 0;
@@ -2921,7 +2905,7 @@ static int module_set_url(int argc, const char **argv, const char *prefix)
config_name = xstrfmt("submodule.%s.url", path);
config_set_in_gitmodules_file_gently(config_name, newurl);
- sync_submodule(path, prefix, quiet ? OPT_QUIET : 0);
+ sync_submodule(path, prefix, NULL, quiet ? OPT_QUIET : 0);
free(config_name);
@@ -3164,7 +3148,6 @@ static int config_submodule_in_gitmodules(const char *name, const char *var, con
static void configure_added_submodule(struct add_data *add_data)
{
char *key;
- const char *val;
struct child_process add_submod = CHILD_PROCESS_INIT;
struct child_process add_gitmodules = CHILD_PROCESS_INIT;
@@ -3209,7 +3192,7 @@ static void configure_added_submodule(struct add_data *add_data)
* is_submodule_active(), since that function needs to find
* out the value of "submodule.active" again anyway.
*/
- if (!git_config_get_string_tmp("submodule.active", &val)) {
+ if (!git_config_get("submodule.active")) {
/*
* If the submodule being added isn't already covered by the
* current configured pathspec, set the submodule's active flag
@@ -3232,7 +3215,7 @@ static void die_on_index_match(const char *path, int force)
const char *args[] = { path, NULL };
parse_pathspec(&ps, 0, PATHSPEC_PREFER_CWD, NULL, args);
- if (read_cache_preload(NULL) < 0)
+ if (repo_read_index_preload(the_repository, NULL, 0) < 0)
die(_("index file corrupt"));
if (ps.nr) {
@@ -3243,19 +3226,18 @@ static void die_on_index_match(const char *path, int force)
ensure_full_index(&the_index);
/*
- * Since there is only one pathspec, we just need
- * need to check ps_matched[0] to know if a cache
- * entry matched.
+ * Since there is only one pathspec, we just need to
+ * check ps_matched[0] to know if a cache entry matched.
*/
- for (i = 0; i < active_nr; i++) {
- ce_path_match(&the_index, active_cache[i], &ps,
+ for (i = 0; i < the_index.cache_nr; i++) {
+ ce_path_match(&the_index, the_index.cache[i], &ps,
ps_matched);
if (ps_matched[0]) {
if (!force)
die(_("'%s' already exists in the index"),
path);
- if (!S_ISGITLINK(active_cache[i]->ce_mode))
+ if (!S_ISGITLINK(the_index.cache[i]->ce_mode))
die(_("'%s' already exists in the index "
"and is not a submodule"), path);
break;
@@ -3396,48 +3378,31 @@ cleanup:
return ret;
}
-#define SUPPORT_SUPER_PREFIX (1<<0)
-
-struct cmd_struct {
- const char *cmd;
- int (*fn)(int, const char **, const char *);
- unsigned option;
-};
-
-static struct cmd_struct commands[] = {
- {"clone", module_clone, SUPPORT_SUPER_PREFIX},
- {"add", module_add, 0},
- {"update", module_update, SUPPORT_SUPER_PREFIX},
- {"foreach", module_foreach, SUPPORT_SUPER_PREFIX},
- {"init", module_init, 0},
- {"status", module_status, SUPPORT_SUPER_PREFIX},
- {"sync", module_sync, SUPPORT_SUPER_PREFIX},
- {"deinit", module_deinit, 0},
- {"summary", module_summary, 0},
- {"push-check", push_check, 0},
- {"absorbgitdirs", absorb_git_dirs, SUPPORT_SUPER_PREFIX},
- {"config", module_config, 0},
- {"set-url", module_set_url, 0},
- {"set-branch", module_set_branch, 0},
- {"create-branch", module_create_branch, 0},
-};
-
int cmd_submodule__helper(int argc, const char **argv, const char *prefix)
{
- int i;
- if (argc < 2 || !strcmp(argv[1], "-h"))
- usage("git submodule--helper <command>");
-
- for (i = 0; i < ARRAY_SIZE(commands); i++) {
- if (!strcmp(argv[1], commands[i].cmd)) {
- if (get_super_prefix() &&
- !(commands[i].option & SUPPORT_SUPER_PREFIX))
- die(_("%s doesn't support --super-prefix"),
- commands[i].cmd);
- return commands[i].fn(argc - 1, argv + 1, prefix);
- }
- }
+ parse_opt_subcommand_fn *fn = NULL;
+ const char *const usage[] = {
+ N_("git submodule--helper <command>"),
+ NULL
+ };
+ struct option options[] = {
+ OPT_SUBCOMMAND("clone", &fn, module_clone),
+ OPT_SUBCOMMAND("add", &fn, module_add),
+ OPT_SUBCOMMAND("update", &fn, module_update),
+ OPT_SUBCOMMAND("foreach", &fn, module_foreach),
+ OPT_SUBCOMMAND("init", &fn, module_init),
+ OPT_SUBCOMMAND("status", &fn, module_status),
+ OPT_SUBCOMMAND("sync", &fn, module_sync),
+ OPT_SUBCOMMAND("deinit", &fn, module_deinit),
+ OPT_SUBCOMMAND("summary", &fn, module_summary),
+ OPT_SUBCOMMAND("push-check", &fn, push_check),
+ OPT_SUBCOMMAND("absorbgitdirs", &fn, absorb_git_dirs),
+ OPT_SUBCOMMAND("set-url", &fn, module_set_url),
+ OPT_SUBCOMMAND("set-branch", &fn, module_set_branch),
+ OPT_SUBCOMMAND("create-branch", &fn, module_create_branch),
+ OPT_END()
+ };
+ argc = parse_options(argc, argv, prefix, options, usage, 0);
- die(_("'%s' is not a valid submodule--helper "
- "subcommand"), argv[1]);
+ return fn(argc, argv, prefix);
}
diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c
index 1b0f10225f..10198a74fa 100644
--- a/builtin/symbolic-ref.c
+++ b/builtin/symbolic-ref.c
@@ -1,19 +1,24 @@
#include "builtin.h"
#include "config.h"
#include "cache.h"
+#include "gettext.h"
#include "refs.h"
#include "parse-options.h"
static const char * const git_symbolic_ref_usage[] = {
- N_("git symbolic-ref [<options>] <name> [<ref>]"),
- N_("git symbolic-ref -d [-q] <name>"),
+ N_("git symbolic-ref [-m <reason>] <name> <ref>"),
+ N_("git symbolic-ref [-q] [--short] [--no-recurse] <name>"),
+ N_("git symbolic-ref --delete [-q] <name>"),
NULL
};
-static int check_symref(const char *HEAD, int quiet, int shorten, int print)
+static int check_symref(const char *HEAD, int quiet, int shorten, int recurse, int print)
{
- int flag;
- const char *refname = resolve_ref_unsafe(HEAD, 0, NULL, &flag);
+ int resolve_flags, flag;
+ const char *refname;
+
+ resolve_flags = (recurse ? 0 : RESOLVE_REF_NO_RECURSE);
+ refname = resolve_ref_unsafe(HEAD, resolve_flags, NULL, &flag);
if (!refname)
die("No such ref: %s", HEAD);
@@ -35,13 +40,14 @@ static int check_symref(const char *HEAD, int quiet, int shorten, int print)
int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
{
- int quiet = 0, delete = 0, shorten = 0, ret = 0;
+ int quiet = 0, delete = 0, shorten = 0, recurse = 1, ret = 0;
const char *msg = NULL;
struct option options[] = {
OPT__QUIET(&quiet,
N_("suppress error message for non-symbolic (detached) refs")),
OPT_BOOL('d', "delete", &delete, N_("delete symbolic ref")),
OPT_BOOL(0, "short", &shorten, N_("shorten ref output")),
+ OPT_BOOL(0, "recurse", &recurse, N_("recursively dereference (default)")),
OPT_STRING('m', NULL, &msg, N_("reason"), N_("reason of the update")),
OPT_END(),
};
@@ -55,7 +61,7 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
if (delete) {
if (argc != 1)
usage_with_options(git_symbolic_ref_usage, options);
- ret = check_symref(argv[0], 1, 0, 0);
+ ret = check_symref(argv[0], 1, 0, 0, 0);
if (ret)
die("Cannot delete %s, not a symbolic ref", argv[0]);
if (!strcmp(argv[0], "HEAD"))
@@ -65,7 +71,7 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
switch (argc) {
case 1:
- ret = check_symref(argv[0], quiet, shorten, 1);
+ ret = check_symref(argv[0], quiet, shorten, recurse, 1);
break;
case 2:
if (!strcmp(argv[0], "HEAD") &&
diff --git a/builtin/tag.c b/builtin/tag.c
index 75dece0e4f..1850a6a6fd 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -7,9 +7,15 @@
*/
#include "cache.h"
+#include "advice.h"
#include "config.h"
#include "builtin.h"
+#include "editor.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
+#include "object-name.h"
#include "object-store.h"
#include "tag.h"
#include "run-command.h"
@@ -21,13 +27,16 @@
#include "column.h"
#include "ref-filter.h"
#include "date.h"
+#include "write-or-die.h"
static const char * const git_tag_usage[] = {
- N_("git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]\n"
- " <tagname> [<head>]"),
+ N_("git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n"
+ " <tagname> [<commit> | <object>]"),
N_("git tag -d <tagname>..."),
- N_("git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--points-at <object>]\n"
- " [--format=<format>] [--merged <commit>] [--no-merged <commit>] [<pattern>...]"),
+ N_("git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]\n"
+ " [--points-at <object>] [--column[=<options>] | --no-column]\n"
+ " [--create-reflog] [--sort=<key>] [--format=<format>]\n"
+ " [--merged <commit>] [--no-merged <commit>] [<pattern>...]"),
N_("git tag -v [--format=<format>] <tagname>..."),
NULL
};
@@ -35,6 +44,7 @@ static const char * const git_tag_usage[] = {
static unsigned int colopts;
static int force_sign_annotate;
static int config_sign_tag = -1; /* unspecified */
+static int omit_empty = 0;
static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting,
struct ref_format *format)
@@ -64,6 +74,7 @@ static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting,
die(_("unable to parse format string"));
filter->with_commit_tag_algo = 1;
filter_refs(&array, filter, FILTER_REFS_TAGS);
+ filter_ahead_behind(the_repository, format, &array);
ref_array_sort(sorting, &array);
for (i = 0; i < array.nr; i++) {
@@ -72,7 +83,8 @@ static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting,
if (format_ref_array_item(array.items[i], format, &output, &err))
die("%s", err.buf);
fwrite(output.buf, 1, output.len, stdout);
- putchar('\n');
+ if (output.len || !omit_empty)
+ putchar('\n');
}
strbuf_release(&err);
@@ -135,7 +147,7 @@ static int delete_tags(const char **argv)
if (!ref_exists(name))
printf(_("Deleted tag '%s' (was %s)\n"),
item->string + 10,
- find_unique_abbrev(oid, DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV));
free(oid);
}
@@ -178,8 +190,6 @@ static const char tag_template_nocleanup[] =
static int git_tag_config(const char *var, const char *value, void *cb)
{
- int status;
-
if (!strcmp(var, "tag.gpgsign")) {
config_sign_tag = git_config_bool(var, value);
return 0;
@@ -192,9 +202,6 @@ static int git_tag_config(const char *var, const char *value, void *cb)
return 0;
}
- status = git_gpg_config(var, value, cb);
- if (status)
- return status;
if (!strcmp(var, "tag.forcesignannotated")) {
force_sign_annotate = git_config_bool(var, value);
return 0;
@@ -213,7 +220,7 @@ static void write_tag_body(int fd, const struct object_id *oid)
struct strbuf payload = STRBUF_INIT;
struct strbuf signature = STRBUF_INIT;
- orig = buf = read_object_file(oid, &type, &size);
+ orig = buf = repo_read_object_file(the_repository, oid, &type, &size);
if (!buf)
return;
if (parse_signature(buf, size, &payload, &signature)) {
@@ -364,7 +371,7 @@ static void create_reflog_msg(const struct object_id *oid, struct strbuf *sb)
strbuf_addstr(sb, "object of unknown type");
break;
case OBJ_COMMIT:
- if ((buf = read_object_file(oid, &type, &size))) {
+ if ((buf = repo_read_object_file(the_repository, oid, &type, &size))) {
subject_len = find_commit_subject(buf, &subject_start);
strbuf_insert(sb, sb->len, subject_start, subject_len);
} else {
@@ -431,7 +438,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
int create_reflog = 0;
int annotate = 0, force = 0;
int cmdmode = 0, create_tag_object = 0;
- const char *msgfile = NULL, *keyid = NULL;
+ char *msgfile = NULL;
+ const char *keyid = NULL;
struct msg_arg msg = { .buf = STRBUF_INIT };
struct ref_transaction *transaction;
struct strbuf err = STRBUF_INIT;
@@ -471,6 +479,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
OPT_WITHOUT(&filter.no_commit, N_("print only tags that don't contain the commit")),
OPT_MERGED(&filter, N_("print only tags that are merged")),
OPT_NO_MERGED(&filter, N_("print only tags that are not merged")),
+ OPT_BOOL(0, "omit-empty", &omit_empty,
+ N_("do not output a newline after empty formatted refs")),
OPT_REF_SORT(&sorting_options),
{
OPTION_CALLBACK, 0, "points-at", &filter.points_at, N_("object"),
@@ -591,7 +601,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
if (argc > 2)
die(_("too many arguments"));
- if (get_oid(object_ref, &object))
+ 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))
@@ -632,7 +642,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
ref_transaction_free(transaction);
if (force && !is_null_oid(&prev) && !oideq(&prev, &object))
printf(_("Updated tag '%s' (was %s)\n"), tag,
- find_unique_abbrev(&prev, DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, &prev, DEFAULT_ABBREV));
cleanup:
ref_sorting_release(sorting);
@@ -641,5 +651,6 @@ cleanup:
strbuf_release(&reflog_msg);
strbuf_release(&msg.buf);
strbuf_release(&err);
+ free(msgfile);
return ret;
}
diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c
index 58652229f2..b35a4b9dfe 100644
--- a/builtin/unpack-file.c
+++ b/builtin/unpack-file.c
@@ -1,6 +1,9 @@
#include "builtin.h"
#include "config.h"
+#include "hex.h"
+#include "object-name.h"
#include "object-store.h"
+#include "wrapper.h"
static char *create_temp_file(struct object_id *oid)
{
@@ -10,7 +13,7 @@ static char *create_temp_file(struct object_id *oid)
unsigned long size;
int fd;
- buf = read_object_file(oid, &type, &size);
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
if (!buf || type != OBJ_BLOB)
die("unable to read blob object %s", oid_to_hex(oid));
@@ -19,16 +22,17 @@ static char *create_temp_file(struct object_id *oid)
if (write_in_full(fd, buf, size) < 0)
die_errno("unable to write temp-file");
close(fd);
+ free(buf);
return path;
}
-int cmd_unpack_file(int argc, const char **argv, const char *prefix)
+int cmd_unpack_file(int argc, const char **argv, const char *prefix UNUSED)
{
struct object_id oid;
if (argc != 2 || !strcmp(argv[1], "-h"))
- usage("git unpack-file <sha1>");
- if (get_oid(argv[1], &oid))
+ usage("git unpack-file <blob>");
+ if (repo_get_oid(the_repository, argv[1], &oid))
die("Not a valid object name %s", argv[1]);
git_config(git_default_config, NULL);
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index 43789b8ef2..2c52c3a741 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -2,12 +2,17 @@
#include "cache.h"
#include "bulk-checkin.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "git-zlib.h"
+#include "hex.h"
#include "object-store.h"
#include "object.h"
#include "delta.h"
#include "pack.h"
#include "blob.h"
#include "commit.h"
+#include "replace-object.h"
#include "tag.h"
#include "tree.h"
#include "tree-walk.h"
@@ -442,7 +447,7 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,
delta_data = get_data(delta_size);
if (!delta_data)
return;
- if (has_object_file(&base_oid))
+ if (repo_has_object_file(the_repository, &base_oid))
; /* Ok we have this one */
else if (resolve_against_held(nr, &base_oid,
delta_data, delta_size))
@@ -508,7 +513,8 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,
if (resolve_against_held(nr, &base_oid, delta_data, delta_size))
return;
- base = read_object_file(&base_oid, &type, &base_size);
+ base = repo_read_object_file(the_repository, &base_oid, &type,
+ &base_size);
if (!base) {
error("failed to read delta-pack base object %s",
oid_to_hex(&base_oid));
@@ -598,7 +604,7 @@ static void unpack_all(void)
die("unresolved deltas left after unpacking");
}
-int cmd_unpack_objects(int argc, const char **argv, const char *prefix)
+int cmd_unpack_objects(int argc, const char **argv, const char *prefix UNUSED)
{
int i;
struct object_id oid;
diff --git a/builtin/update-index.c b/builtin/update-index.c
index b62249905f..5fab9ad2ec 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -3,22 +3,31 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "cache.h"
#include "bulk-checkin.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hash.h"
+#include "hex.h"
#include "lockfile.h"
#include "quote.h"
#include "cache-tree.h"
#include "tree-walk.h"
#include "builtin.h"
+#include "object-file.h"
#include "refs.h"
#include "resolve-undo.h"
#include "parse-options.h"
#include "pathspec.h"
#include "dir.h"
+#include "repository.h"
+#include "setup.h"
#include "split-index.h"
+#include "symlinks.h"
#include "fsmonitor.h"
+#include "write-or-die.h"
/*
* Default to not allowing changes to the list of files. The
@@ -237,16 +246,16 @@ done:
static int mark_ce_flags(const char *path, int flag, int mark)
{
int namelen = strlen(path);
- int pos = cache_name_pos(path, namelen);
+ int pos = index_name_pos(&the_index, path, namelen);
if (0 <= pos) {
- mark_fsmonitor_invalid(&the_index, active_cache[pos]);
+ mark_fsmonitor_invalid(&the_index, the_index.cache[pos]);
if (mark)
- active_cache[pos]->ce_flags |= flag;
+ the_index.cache[pos]->ce_flags |= flag;
else
- active_cache[pos]->ce_flags &= ~flag;
- active_cache[pos]->ce_flags |= CE_UPDATE_IN_BASE;
+ the_index.cache[pos]->ce_flags &= ~flag;
+ the_index.cache[pos]->ce_flags |= CE_UPDATE_IN_BASE;
cache_tree_invalidate_path(&the_index, path);
- active_cache_changed |= CE_ENTRY_CHANGED;
+ the_index.cache_changed |= CE_ENTRY_CHANGED;
return 0;
}
return -1;
@@ -256,7 +265,7 @@ static int remove_one_path(const char *path)
{
if (!allow_remove)
return error("%s: does not exist and --remove not passed", path);
- if (remove_file_from_cache(path))
+ if (remove_file_from_index(&the_index, path))
return error("%s: cannot remove from the index", path);
return 0;
}
@@ -281,7 +290,7 @@ static int add_one_path(const struct cache_entry *old, const char *path, int len
struct cache_entry *ce;
/* Was the old index entry already up-to-date? */
- if (old && !ce_stage(old) && !ce_match_stat(old, st, 0))
+ if (old && !ce_stage(old) && !ie_match_stat(&the_index, old, st, 0))
return 0;
ce = make_empty_cache_entry(&the_index, len);
@@ -298,7 +307,7 @@ static int add_one_path(const struct cache_entry *old, const char *path, int len
}
option = allow_add ? ADD_CACHE_OK_TO_ADD : 0;
option |= allow_replace ? ADD_CACHE_OK_TO_REPLACE : 0;
- if (add_cache_entry(ce, option)) {
+ if (add_index_entry(&the_index, ce, option)) {
discard_cache_entry(ce);
return error("%s: cannot add to the index - missing --add option?", path);
}
@@ -331,11 +340,11 @@ static int add_one_path(const struct cache_entry *old, const char *path, int len
static int process_directory(const char *path, int len, struct stat *st)
{
struct object_id oid;
- int pos = cache_name_pos(path, len);
+ int pos = index_name_pos(&the_index, path, len);
/* Exact match: file or existing gitlink */
if (pos >= 0) {
- const struct cache_entry *ce = active_cache[pos];
+ const struct cache_entry *ce = the_index.cache[pos];
if (S_ISGITLINK(ce->ce_mode)) {
/* Do nothing to the index if there is no HEAD! */
@@ -350,8 +359,8 @@ static int process_directory(const char *path, int len, struct stat *st)
/* Inexact match: is there perhaps a subdirectory match? */
pos = -pos-1;
- while (pos < active_nr) {
- const struct cache_entry *ce = active_cache[pos++];
+ while (pos < the_index.cache_nr) {
+ const struct cache_entry *ce = the_index.cache[pos++];
if (strncmp(ce->name, path, len))
break;
@@ -381,8 +390,8 @@ static int process_path(const char *path, struct stat *st, int stat_errno)
if (has_symlink_leading_path(path, len))
return error("'%s' is beyond a symbolic link", path);
- pos = cache_name_pos(path, len);
- ce = pos < 0 ? NULL : active_cache[pos];
+ pos = index_name_pos(&the_index, path, len);
+ ce = pos < 0 ? NULL : the_index.cache[pos];
if (ce && ce_skip_worktree(ce)) {
/*
* working directory version is assumed "good"
@@ -390,7 +399,7 @@ static int process_path(const char *path, struct stat *st, int stat_errno)
* On the other hand, removing it from index should work
*/
if (!ignore_skip_worktree_entries && allow_remove &&
- remove_file_from_cache(path))
+ remove_file_from_index(&the_index, path))
return error("%s: cannot remove from the index", path);
return 0;
}
@@ -429,7 +438,7 @@ static int add_cacheinfo(unsigned int mode, const struct object_id *oid,
ce->ce_flags |= CE_VALID;
option = allow_add ? ADD_CACHE_OK_TO_ADD : 0;
option |= allow_replace ? ADD_CACHE_OK_TO_REPLACE : 0;
- if (add_cache_entry(ce, option))
+ if (add_index_entry(&the_index, ce, option))
return error("%s: cannot add to the index - missing --add option?",
path);
report("add '%s'", path);
@@ -441,11 +450,11 @@ static void chmod_path(char flip, const char *path)
int pos;
struct cache_entry *ce;
- pos = cache_name_pos(path, strlen(path));
+ pos = index_name_pos(&the_index, path, strlen(path));
if (pos < 0)
goto fail;
- ce = active_cache[pos];
- if (chmod_cache_entry(ce, flip) < 0)
+ ce = the_index.cache[pos];
+ if (chmod_index_entry(&the_index, ce, flip) < 0)
goto fail;
report("chmod %cx '%s'", flip, path);
@@ -488,7 +497,7 @@ static void update_one(const char *path)
}
if (force_remove) {
- if (remove_file_from_cache(path))
+ if (remove_file_from_index(&the_index, path))
die("git update-index: unable to remove %s", path);
report("remove '%s'", path);
return;
@@ -571,7 +580,7 @@ static void read_index_info(int nul_term_line)
if (!mode) {
/* mode == 0 means there is no such path -- remove */
- if (remove_file_from_cache(path_name))
+ if (remove_file_from_index(&the_index, path_name))
die("git update-index: unable to remove %s",
ptr);
}
@@ -638,12 +647,12 @@ static int unresolve_one(const char *path)
struct cache_entry *ce_2 = NULL, *ce_3 = NULL;
/* See if there is such entry in the index. */
- pos = cache_name_pos(path, namelen);
+ pos = index_name_pos(&the_index, path, namelen);
if (0 <= pos) {
/* already merged */
- pos = unmerge_cache_entry_at(pos);
- if (pos < active_nr) {
- const struct cache_entry *ce = active_cache[pos];
+ pos = unmerge_index_entry_at(&the_index, pos);
+ if (pos < the_index.cache_nr) {
+ const struct cache_entry *ce = the_index.cache[pos];
if (ce_stage(ce) &&
ce_namelen(ce) == namelen &&
!memcmp(ce->name, path, namelen))
@@ -656,8 +665,8 @@ static int unresolve_one(const char *path)
* want to do anything in the former case.
*/
pos = -pos-1;
- if (pos < active_nr) {
- const struct cache_entry *ce = active_cache[pos];
+ if (pos < the_index.cache_nr) {
+ const struct cache_entry *ce = the_index.cache[pos];
if (ce_namelen(ce) == namelen &&
!memcmp(ce->name, path, namelen)) {
fprintf(stderr,
@@ -686,13 +695,13 @@ static int unresolve_one(const char *path)
goto free_return;
}
- remove_file_from_cache(path);
- if (add_cache_entry(ce_2, ADD_CACHE_OK_TO_ADD)) {
+ remove_file_from_index(&the_index, path);
+ if (add_index_entry(&the_index, ce_2, ADD_CACHE_OK_TO_ADD)) {
error("%s: cannot add our version to the index.", path);
ret = -1;
goto free_return;
}
- if (!add_cache_entry(ce_3, ADD_CACHE_OK_TO_ADD))
+ if (!add_index_entry(&the_index, ce_3, ADD_CACHE_OK_TO_ADD))
return 0;
error("%s: cannot add their version to the index.", path);
ret = -1;
@@ -732,7 +741,7 @@ static int do_unresolve(int ac, const char **av,
return err;
}
-static int do_reupdate(int ac, const char **av,
+static int do_reupdate(const char **paths,
const char *prefix)
{
/* Read HEAD and run update-index on paths that are
@@ -744,7 +753,7 @@ static int do_reupdate(int ac, const char **av,
parse_pathspec(&pathspec, 0,
PATHSPEC_PREFER_CWD,
- prefix, av + 1);
+ prefix, paths);
if (read_ref("HEAD", &head_oid))
/* If there is no HEAD, that means it is an initial
@@ -752,8 +761,8 @@ static int do_reupdate(int ac, const char **av,
*/
has_head = 0;
redo:
- for (pos = 0; pos < active_nr; pos++) {
- const struct cache_entry *ce = active_cache[pos];
+ for (pos = 0; pos < the_index.cache_nr; pos++) {
+ const struct cache_entry *ce = the_index.cache[pos];
struct cache_entry *old = NULL;
int save_nr;
char *path;
@@ -782,12 +791,12 @@ static int do_reupdate(int ac, const char **av,
* path anymore, in which case, under 'allow_remove',
* or worse yet 'allow_replace', active_nr may decrease.
*/
- save_nr = active_nr;
+ save_nr = the_index.cache_nr;
path = xstrdup(ce->name);
update_one(path);
free(path);
discard_cache_entry(old);
- if (save_nr != active_nr)
+ if (save_nr != the_index.cache_nr)
goto redo;
}
clear_pathspec(&pathspec);
@@ -802,18 +811,19 @@ struct refresh_params {
static int refresh(struct refresh_params *o, unsigned int flag)
{
setup_work_tree();
- read_cache();
- *o->has_errors |= refresh_cache(o->flags | flag);
+ repo_read_index(the_repository);
+ *o->has_errors |= refresh_index(&the_index, o->flags | flag, NULL,
+ NULL, NULL);
if (has_racy_timestamp(&the_index)) {
/*
* Even if nothing else has changed, updating the file
* increases the chance that racy timestamps become
* non-racy, helping future run-time performance.
* We do that even in case of "errors" returned by
- * refresh_cache() as these are no actual errors.
+ * refresh_index() as these are no actual errors.
* cmd_status() does the same.
*/
- active_cache_changed |= SOMETHING_CHANGED;
+ the_index.cache_changed |= SOMETHING_CHANGED;
}
return 0;
}
@@ -850,7 +860,7 @@ static int resolve_undo_clear_callback(const struct option *opt,
{
BUG_ON_OPT_NEG(unset);
BUG_ON_OPT_ARG(arg);
- resolve_undo_clear();
+ resolve_undo_clear_index(&the_index);
return 0;
}
@@ -951,7 +961,7 @@ static enum parse_opt_result unresolve_callback(
*has_errors = do_unresolve(ctx->argc, ctx->argv,
prefix, prefix ? strlen(prefix) : 0);
if (*has_errors)
- active_cache_changed = 0;
+ the_index.cache_changed = 0;
ctx->argv += ctx->argc - 1;
ctx->argc = 1;
@@ -970,9 +980,9 @@ static enum parse_opt_result reupdate_callback(
/* consume remaining arguments. */
setup_work_tree();
- *has_errors = do_reupdate(ctx->argc, ctx->argv, prefix);
+ *has_errors = do_reupdate(ctx->argv + 1, prefix);
if (*has_errors)
- active_cache_changed = 0;
+ the_index.cache_changed = 0;
ctx->argv += ctx->argc - 1;
ctx->argc = 1;
@@ -1109,11 +1119,11 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
the_repository->settings.command_requires_full_index = 0;
/* we will diagnose later if it turns out that we need to update it */
- newfd = hold_locked_index(&lock_file, 0);
+ newfd = repo_hold_locked_index(the_repository, &lock_file, 0);
if (newfd < 0)
lock_error = errno;
- entries = read_cache();
+ entries = repo_read_index(the_repository);
if (entries < 0)
die("cache corrupted");
@@ -1178,7 +1188,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
INDEX_FORMAT_LB, INDEX_FORMAT_UB);
if (the_index.version != preferred_index_format)
- active_cache_changed |= SOMETHING_CHANGED;
+ the_index.cache_changed |= SOMETHING_CHANGED;
the_index.version = preferred_index_format;
}
@@ -1290,7 +1300,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
report(_("fsmonitor disabled"));
}
- if (active_cache_changed || force_write) {
+ if (the_index.cache_changed || force_write) {
if (newfd < 0) {
if (refresh_args.flags & REFRESH_QUIET)
exit(128);
diff --git a/builtin/update-ref.c b/builtin/update-ref.c
index a84e7b47a2..0c59b1c9ef 100644
--- a/builtin/update-ref.c
+++ b/builtin/update-ref.c
@@ -1,9 +1,13 @@
#include "cache.h"
#include "config.h"
+#include "gettext.h"
+#include "hash.h"
#include "refs.h"
#include "builtin.h"
+#include "object-name.h"
#include "parse-options.h"
#include "quote.h"
+#include "repository.h"
#include "strvec.h"
static const char * const git_update_ref_usage[] = {
@@ -116,7 +120,7 @@ static int parse_next_oid(const char **next, const char *end,
(*next)++;
*next = parse_arg(*next, &arg);
if (arg.len) {
- if (get_oid(arg.buf, oid))
+ if (repo_get_oid(the_repository, arg.buf, oid))
goto invalid;
} else {
/* Without -z, an empty value means all zeros: */
@@ -134,7 +138,7 @@ static int parse_next_oid(const char **next, const char *end,
*next += arg.len;
if (arg.len) {
- if (get_oid(arg.buf, oid))
+ if (repo_get_oid(the_repository, arg.buf, oid))
goto invalid;
} else if (flags & PARSE_SHA1_ALLOW_EMPTY) {
/* With -z, treat an empty value as all zeros: */
@@ -549,7 +553,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
refname = argv[0];
value = argv[1];
oldval = argv[2];
- if (get_oid(value, &oid))
+ if (repo_get_oid(the_repository, value, &oid))
die("%s: not a valid SHA1", value);
}
@@ -560,7 +564,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
* must not already exist:
*/
oidclr(&oldoid);
- else if (get_oid(oldval, &oldoid))
+ else if (repo_get_oid(the_repository, oldval, &oldoid))
die("%s: not a valid old SHA1", oldval);
}
diff --git a/builtin/update-server-info.c b/builtin/update-server-info.c
index 880fffec58..19dce3c065 100644
--- a/builtin/update-server-info.c
+++ b/builtin/update-server-info.c
@@ -1,10 +1,12 @@
#include "cache.h"
#include "config.h"
#include "builtin.h"
+#include "gettext.h"
#include "parse-options.h"
+#include "server-info.h"
static const char * const update_server_info_usage[] = {
- "git update-server-info [--force]",
+ "git update-server-info [-f | --force]",
NULL
};
diff --git a/builtin/upload-archive.c b/builtin/upload-archive.c
index 98d028dae6..44ad400e18 100644
--- a/builtin/upload-archive.c
+++ b/builtin/upload-archive.c
@@ -6,11 +6,12 @@
#include "archive.h"
#include "pkt-line.h"
#include "sideband.h"
+#include "repository.h"
#include "run-command.h"
#include "strvec.h"
static const char upload_archive_usage[] =
- "git upload-archive <repo>";
+ "git upload-archive <repository>";
static const char deadchild[] =
"git upload-archive: archiver died with error";
@@ -79,6 +80,8 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix)
{
struct child_process writer = CHILD_PROCESS_INIT;
+ BUG_ON_NON_EMPTY_PREFIX(prefix);
+
if (argc == 2 && !strcmp(argv[1], "-h"))
usage(upload_archive_usage);
diff --git a/builtin/upload-pack.c b/builtin/upload-pack.c
index 125af53885..beb9dd0861 100644
--- a/builtin/upload-pack.c
+++ b/builtin/upload-pack.c
@@ -1,14 +1,17 @@
#include "cache.h"
#include "builtin.h"
#include "exec-cmd.h"
+#include "gettext.h"
#include "pkt-line.h"
#include "parse-options.h"
#include "protocol.h"
+#include "replace-object.h"
#include "upload-pack.h"
#include "serve.h"
static const char * const upload_pack_usage[] = {
- N_("git upload-pack [<options>] <dir>"),
+ N_("git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+ " [--advertise-refs] <directory>"),
NULL
};
diff --git a/builtin/var.c b/builtin/var.c
index 491db27429..2149998980 100644
--- a/builtin/var.c
+++ b/builtin/var.c
@@ -5,18 +5,21 @@
*/
#include "builtin.h"
#include "config.h"
+#include "editor.h"
+#include "ident.h"
+#include "pager.h"
#include "refs.h"
static const char var_usage[] = "git var (-l | <variable>)";
static const char *editor(int flag)
{
- const char *pgm = git_editor();
-
- if (!pgm && flag & IDENT_STRICT)
- die("Terminal is dumb, but EDITOR unset");
+ return git_editor();
+}
- return pgm;
+static const char *sequence_editor(int flag)
+{
+ return git_sequence_editor();
}
static const char *pager(int flag)
@@ -41,6 +44,7 @@ static struct git_var git_vars[] = {
{ "GIT_COMMITTER_IDENT", git_committer_info },
{ "GIT_AUTHOR_IDENT", git_author_info },
{ "GIT_EDITOR", editor },
+ { "GIT_SEQUENCE_EDITOR", sequence_editor },
{ "GIT_PAGER", pager },
{ "GIT_DEFAULT_BRANCH", default_branch },
{ "", NULL },
@@ -56,18 +60,15 @@ static void list_vars(void)
printf("%s=%s\n", ptr->name, val);
}
-static const char *read_var(const char *var)
+static const struct git_var *get_git_var(const char *var)
{
struct git_var *ptr;
- const char *val;
- val = NULL;
for (ptr = git_vars; ptr->read; ptr++) {
if (strcmp(var, ptr->name) == 0) {
- val = ptr->read(IDENT_STRICT);
- break;
+ return ptr;
}
}
- return val;
+ return NULL;
}
static int show_config(const char *var, const char *value, void *cb)
@@ -79,9 +80,11 @@ static int show_config(const char *var, const char *value, void *cb)
return git_default_config(var, value, cb);
}
-int cmd_var(int argc, const char **argv, const char *prefix)
+int cmd_var(int argc, const char **argv, const char *prefix UNUSED)
{
- const char *val = NULL;
+ const struct git_var *git_var;
+ const char *val;
+
if (argc != 2)
usage(var_usage);
@@ -91,10 +94,15 @@ int cmd_var(int argc, const char **argv, const char *prefix)
return 0;
}
git_config(git_default_config, NULL);
- val = read_var(argv[1]);
- if (!val)
+
+ git_var = get_git_var(argv[1]);
+ if (!git_var)
usage(var_usage);
+ val = git_var->read(IDENT_STRICT);
+ if (!val)
+ return 1;
+
printf("%s\n", val);
return 0;
diff --git a/builtin/verify-commit.c b/builtin/verify-commit.c
index 40c69a0bed..5d99b82a64 100644
--- a/builtin/verify-commit.c
+++ b/builtin/verify-commit.c
@@ -8,6 +8,8 @@
#include "cache.h"
#include "config.h"
#include "builtin.h"
+#include "gettext.h"
+#include "object-name.h"
#include "object-store.h"
#include "repository.h"
#include "commit.h"
@@ -16,7 +18,7 @@
#include "gpg-interface.h"
static const char * const verify_commit_usage[] = {
- N_("git verify-commit [-v | --verbose] <commit>..."),
+ N_("git verify-commit [-v | --verbose] [--raw] <commit>..."),
NULL
};
@@ -39,7 +41,7 @@ static int verify_commit(const char *name, unsigned flags)
struct object_id oid;
struct object *obj;
- if (get_oid(name, &oid))
+ if (repo_get_oid(the_repository, name, &oid))
return error("commit '%s' not found.", name);
obj = parse_object(the_repository, &oid);
@@ -52,14 +54,6 @@ static int verify_commit(const char *name, unsigned flags)
return run_gpg_verify((struct commit *)obj, flags);
}
-static int git_verify_commit_config(const char *var, const char *value, void *cb)
-{
- int status = git_gpg_config(var, value, cb);
- if (status)
- return status;
- return git_default_config(var, value, cb);
-}
-
int cmd_verify_commit(int argc, const char **argv, const char *prefix)
{
int i = 1, verbose = 0, had_error = 0;
@@ -70,7 +64,7 @@ int cmd_verify_commit(int argc, const char **argv, const char *prefix)
OPT_END()
};
- git_config(git_verify_commit_config, NULL);
+ git_config(git_default_config, NULL);
argc = parse_options(argc, argv, prefix, verify_commit_options,
verify_commit_usage, PARSE_OPT_KEEP_ARGV0);
diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c
index 05c5213594..190fd69540 100644
--- a/builtin/verify-pack.c
+++ b/builtin/verify-pack.c
@@ -1,6 +1,7 @@
#include "builtin.h"
#include "cache.h"
#include "config.h"
+#include "gettext.h"
#include "run-command.h"
#include "parse-options.h"
@@ -56,7 +57,7 @@ static int verify_one_pack(const char *path, unsigned int flags, const char *has
}
static const char * const verify_pack_usage[] = {
- N_("git verify-pack [-v | --verbose] [-s | --stat-only] <pack>..."),
+ N_("git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pack>.idx..."),
NULL
};
diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c
index f45136a06b..c6019a0ad8 100644
--- a/builtin/verify-tag.c
+++ b/builtin/verify-tag.c
@@ -8,25 +8,19 @@
#include "cache.h"
#include "config.h"
#include "builtin.h"
+#include "gettext.h"
#include "tag.h"
#include "run-command.h"
+#include "object-name.h"
#include "parse-options.h"
#include "gpg-interface.h"
#include "ref-filter.h"
static const char * const verify_tag_usage[] = {
- N_("git verify-tag [-v | --verbose] [--format=<format>] <tag>..."),
+ N_("git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."),
NULL
};
-static int git_verify_tag_config(const char *var, const char *value, void *cb)
-{
- int status = git_gpg_config(var, value, cb);
- if (status)
- return status;
- return git_default_config(var, value, cb);
-}
-
int cmd_verify_tag(int argc, const char **argv, const char *prefix)
{
int i = 1, verbose = 0, had_error = 0;
@@ -39,7 +33,7 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
OPT_END()
};
- git_config(git_verify_tag_config, NULL);
+ git_config(git_default_config, NULL);
argc = parse_options(argc, argv, prefix, verify_tag_options,
verify_tag_usage, PARSE_OPT_KEEP_ARGV0);
@@ -60,7 +54,7 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
struct object_id oid;
const char *name = argv[i++];
- if (get_oid(name, &oid)) {
+ if (repo_get_oid(the_repository, name, &oid)) {
had_error = !!error("tag '%s' not found.", name);
continue;
}
diff --git a/builtin/worktree.c b/builtin/worktree.c
index c6710b2552..f3180463be 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -1,29 +1,96 @@
#include "cache.h"
+#include "abspath.h"
#include "checkout.h"
#include "config.h"
+#include "copy.h"
#include "builtin.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-file.h"
+#include "object-name.h"
#include "parse-options.h"
#include "strvec.h"
#include "branch.h"
#include "refs.h"
+#include "repository.h"
#include "run-command.h"
#include "hook.h"
#include "sigchain.h"
#include "submodule.h"
#include "utf8.h"
#include "worktree.h"
+#include "wrapper.h"
#include "quote.h"
-static const char * const worktree_usage[] = {
- N_("git worktree add [<options>] <path> [<commit-ish>]"),
- N_("git worktree list [<options>]"),
- N_("git worktree lock [<options>] <path>"),
- N_("git worktree move <worktree> <new-path>"),
- N_("git worktree prune [<options>]"),
- N_("git worktree remove [<options>] <worktree>"),
- N_("git worktree repair [<path>...]"),
- N_("git worktree unlock <path>"),
+#define BUILTIN_WORKTREE_ADD_USAGE \
+ N_("git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]\n" \
+ " [-b <new-branch>] <path> [<commit-ish>]")
+#define BUILTIN_WORKTREE_LIST_USAGE \
+ N_("git worktree list [-v | --porcelain [-z]]")
+#define BUILTIN_WORKTREE_LOCK_USAGE \
+ N_("git worktree lock [--reason <string>] <worktree>")
+#define BUILTIN_WORKTREE_MOVE_USAGE \
+ N_("git worktree move <worktree> <new-path>")
+#define BUILTIN_WORKTREE_PRUNE_USAGE \
+ N_("git worktree prune [-n] [-v] [--expire <expire>]")
+#define BUILTIN_WORKTREE_REMOVE_USAGE \
+ N_("git worktree remove [-f] <worktree>")
+#define BUILTIN_WORKTREE_REPAIR_USAGE \
+ N_("git worktree repair [<path>...]")
+#define BUILTIN_WORKTREE_UNLOCK_USAGE \
+ N_("git worktree unlock <worktree>")
+
+static const char * const git_worktree_usage[] = {
+ BUILTIN_WORKTREE_ADD_USAGE,
+ BUILTIN_WORKTREE_LIST_USAGE,
+ BUILTIN_WORKTREE_LOCK_USAGE,
+ BUILTIN_WORKTREE_MOVE_USAGE,
+ BUILTIN_WORKTREE_PRUNE_USAGE,
+ BUILTIN_WORKTREE_REMOVE_USAGE,
+ BUILTIN_WORKTREE_REPAIR_USAGE,
+ BUILTIN_WORKTREE_UNLOCK_USAGE,
+ NULL
+};
+
+static const char * const git_worktree_add_usage[] = {
+ BUILTIN_WORKTREE_ADD_USAGE,
+ NULL,
+};
+
+static const char * const git_worktree_list_usage[] = {
+ BUILTIN_WORKTREE_LIST_USAGE,
+ NULL
+};
+
+static const char * const git_worktree_lock_usage[] = {
+ BUILTIN_WORKTREE_LOCK_USAGE,
+ NULL
+};
+
+static const char * const git_worktree_move_usage[] = {
+ BUILTIN_WORKTREE_MOVE_USAGE,
+ NULL
+};
+
+static const char * const git_worktree_prune_usage[] = {
+ BUILTIN_WORKTREE_PRUNE_USAGE,
+ NULL
+};
+
+static const char * const git_worktree_remove_usage[] = {
+ BUILTIN_WORKTREE_REMOVE_USAGE,
+ NULL
+};
+
+static const char * const git_worktree_repair_usage[] = {
+ BUILTIN_WORKTREE_REPAIR_USAGE,
+ NULL
+};
+
+static const char * const git_worktree_unlock_usage[] = {
+ BUILTIN_WORKTREE_UNLOCK_USAGE,
NULL
};
@@ -115,7 +182,7 @@ static void prune_worktrees(void)
{
struct strbuf reason = STRBUF_INIT;
struct strbuf main_path = STRBUF_INIT;
- struct string_list kept = STRING_LIST_INIT_NODUP;
+ struct string_list kept = STRING_LIST_INIT_DUP;
DIR *dir = opendir(git_path("worktrees"));
struct dirent *d;
if (!dir)
@@ -126,14 +193,14 @@ static void prune_worktrees(void)
if (should_prune_worktree(d->d_name, &reason, &path, expire))
prune_worktree(d->d_name, reason.buf);
else if (path)
- string_list_append(&kept, path)->util = xstrdup(d->d_name);
+ string_list_append_nodup(&kept, path)->util = xstrdup(d->d_name);
}
closedir(dir);
strbuf_add_absolute_path(&main_path, get_git_common_dir());
/* massage main worktree absolute path to match 'gitdir' content */
strbuf_strip_suffix(&main_path, "/.");
- string_list_append(&kept, strbuf_detach(&main_path, NULL));
+ string_list_append_nodup(&kept, strbuf_detach(&main_path, NULL));
prune_dups(&kept);
string_list_clear(&kept, 1);
@@ -153,9 +220,10 @@ static int prune(int ac, const char **av, const char *prefix)
};
expire = TIME_MAX;
- ac = parse_options(ac, av, prefix, options, worktree_usage, 0);
+ ac = parse_options(ac, av, prefix, options, git_worktree_prune_usage,
+ 0);
if (ac)
- usage_with_options(worktree_usage, options);
+ usage_with_options(git_worktree_prune_usage, options);
prune_worktrees();
return 0;
}
@@ -260,7 +328,6 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)
if (file_exists(from_file)) {
struct config_set cs = { { 0 } };
- const char *core_worktree;
int bare;
if (safe_create_leading_directories(to_file) ||
@@ -279,7 +346,7 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)
to_file, "core.bare", NULL, "true", 0))
error(_("failed to unset '%s' in '%s'"),
"core.bare", to_file);
- if (!git_configset_get_value(&cs, "core.worktree", &core_worktree) &&
+ if (!git_configset_get(&cs, "core.worktree") &&
git_config_set_in_file_gently(to_file,
"core.worktree", NULL))
error(_("failed to unset '%s' in '%s'"),
@@ -493,7 +560,7 @@ static void print_preparing_worktree_line(int detach,
else
fprintf_ln(stderr, _("Preparing worktree (resetting branch '%s'; was at %s)"),
new_branch,
- find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV));
} else if (new_branch) {
fprintf_ln(stderr, _("Preparing worktree (new branch '%s')"), new_branch);
} else {
@@ -507,7 +574,7 @@ static void print_preparing_worktree_line(int detach,
if (!commit)
die(_("invalid reference: %s"), branch);
fprintf_ln(stderr, _("Preparing worktree (detached HEAD %s)"),
- find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV));
}
strbuf_release(&s);
}
@@ -570,10 +637,11 @@ static int add(int ac, const char **av, const char *prefix)
N_("try to match the new branch name with a remote-tracking branch")),
OPT_END()
};
+ int ret;
memset(&opts, 0, sizeof(opts));
opts.checkout = 1;
- ac = parse_options(ac, av, prefix, options, worktree_usage, 0);
+ 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");
if (lock_reason && !keep_locked)
@@ -584,7 +652,7 @@ static int add(int ac, const char **av, const char *prefix)
opts.keep_locked = _("added with --lock");
if (ac < 1 || ac > 2)
- usage_with_options(worktree_usage, options);
+ usage_with_options(git_worktree_add_usage, options);
path = prefix_filename(prefix, av[0]);
branch = ac < 2 ? "HEAD" : av[1];
@@ -646,9 +714,9 @@ static int add(int ac, const char **av, const char *prefix)
die(_("--[no-]track can only be used if a new branch is created"));
}
- UNLEAK(path);
- UNLEAK(opts);
- return add_worktree(path, branch, &opts);
+ ret = add_worktree(path, branch, &opts);
+ free(path);
+ return ret;
}
static void show_worktree_porcelain(struct worktree *wt, int line_terminator)
@@ -696,7 +764,7 @@ static void show_worktree(struct worktree *wt, int path_maxlen, int abbrev_len)
strbuf_addstr(&sb, "(bare)");
else {
strbuf_addf(&sb, "%-*s ", abbrev_len,
- find_unique_abbrev(&wt->head_oid, DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, &wt->head_oid, DEFAULT_ABBREV));
if (wt->is_detached)
strbuf_addstr(&sb, "(detached HEAD)");
else if (wt->head_ref) {
@@ -733,7 +801,7 @@ static void measure_widths(struct worktree **wt, int *abbrev, int *maxlen)
if (path_len > *maxlen)
*maxlen = path_len;
- sha1_len = strlen(find_unique_abbrev(&wt[i]->head_oid, *abbrev));
+ sha1_len = strlen(repo_find_unique_abbrev(the_repository, &wt[i]->head_oid, *abbrev));
if (sha1_len > *abbrev)
*abbrev = sha1_len;
}
@@ -772,9 +840,9 @@ static int list(int ac, const char **av, const char *prefix)
};
expire = TIME_MAX;
- ac = parse_options(ac, av, prefix, options, worktree_usage, 0);
+ ac = parse_options(ac, av, prefix, options, git_worktree_list_usage, 0);
if (ac)
- usage_with_options(worktree_usage, options);
+ usage_with_options(git_worktree_list_usage, options);
else if (verbose && porcelain)
die(_("options '%s' and '%s' cannot be used together"), "--verbose", "--porcelain");
else if (!line_terminator && !porcelain)
@@ -811,9 +879,9 @@ static int lock_worktree(int ac, const char **av, const char *prefix)
};
struct worktree **worktrees, *wt;
- ac = parse_options(ac, av, prefix, options, worktree_usage, 0);
+ ac = parse_options(ac, av, prefix, options, git_worktree_lock_usage, 0);
if (ac != 1)
- usage_with_options(worktree_usage, options);
+ usage_with_options(git_worktree_lock_usage, options);
worktrees = get_worktrees();
wt = find_worktree(worktrees, prefix, av[0]);
@@ -844,9 +912,9 @@ static int unlock_worktree(int ac, const char **av, const char *prefix)
struct worktree **worktrees, *wt;
int ret;
- ac = parse_options(ac, av, prefix, options, worktree_usage, 0);
+ ac = parse_options(ac, av, prefix, options, git_worktree_unlock_usage, 0);
if (ac != 1)
- usage_with_options(worktree_usage, options);
+ usage_with_options(git_worktree_unlock_usage, options);
worktrees = get_worktrees();
wt = find_worktree(worktrees, prefix, av[0]);
@@ -863,7 +931,7 @@ static int unlock_worktree(int ac, const char **av, const char *prefix)
static void validate_no_submodules(const struct worktree *wt)
{
- struct index_state istate = { NULL };
+ struct index_state istate = INDEX_STATE_INIT(the_repository);
struct strbuf path = STRBUF_INIT;
int i, found_submodules = 0;
@@ -914,9 +982,10 @@ static int move_worktree(int ac, const char **av, const char *prefix)
const char *reason = NULL;
char *path;
- ac = parse_options(ac, av, prefix, options, worktree_usage, 0);
+ ac = parse_options(ac, av, prefix, options, git_worktree_move_usage,
+ 0);
if (ac != 2)
- usage_with_options(worktree_usage, options);
+ usage_with_options(git_worktree_move_usage, options);
path = prefix_filename(prefix, av[1]);
strbuf_addstr(&dst, path);
@@ -1042,9 +1111,9 @@ static int remove_worktree(int ac, const char **av, const char *prefix)
const char *reason = NULL;
int ret = 0;
- ac = parse_options(ac, av, prefix, options, worktree_usage, 0);
+ ac = parse_options(ac, av, prefix, options, git_worktree_remove_usage, 0);
if (ac != 1)
- usage_with_options(worktree_usage, options);
+ usage_with_options(git_worktree_remove_usage, options);
worktrees = get_worktrees();
wt = find_worktree(worktrees, prefix, av[0]);
@@ -1102,7 +1171,7 @@ static int repair(int ac, const char **av, const char *prefix)
};
int rc = 0;
- ac = parse_options(ac, av, prefix, options, worktree_usage, 0);
+ 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);
@@ -1130,6 +1199,6 @@ int cmd_worktree(int ac, const char **av, const char *prefix)
if (!prefix)
prefix = "";
- ac = parse_options(ac, av, prefix, options, worktree_usage, 0);
+ ac = parse_options(ac, av, prefix, options, git_worktree_usage, 0);
return fn(ac, av, prefix);
}
diff --git a/builtin/write-tree.c b/builtin/write-tree.c
index 45d61707e7..84b83318c9 100644
--- a/builtin/write-tree.c
+++ b/builtin/write-tree.c
@@ -3,13 +3,17 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
#include "cache.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "tree.h"
#include "cache-tree.h"
#include "parse-options.h"
+#include "repository.h"
static const char * const write_tree_usage[] = {
N_("git write-tree [--missing-ok] [--prefix=<prefix>/]"),
@@ -38,7 +42,11 @@ int cmd_write_tree(int argc, const char **argv, const char *cmd_prefix)
argc = parse_options(argc, argv, cmd_prefix, write_tree_options,
write_tree_usage, 0);
- ret = write_cache_as_tree(&oid, flags, tree_prefix);
+ prepare_repo_settings(the_repository);
+ the_repository->settings.command_requires_full_index = 0;
+
+ ret = write_index_as_tree(&oid, &the_index, get_index_file(), flags,
+ tree_prefix);
switch (ret) {
case 0:
printf("%s\n", oid_to_hex(&oid));
diff --git a/bulk-checkin.c b/bulk-checkin.c
index 855b68ec23..d843279715 100644
--- a/bulk-checkin.c
+++ b/bulk-checkin.c
@@ -1,8 +1,12 @@
/*
* Copyright (c) 2011, Google Inc.
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "bulk-checkin.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "repository.h"
#include "csum-file.h"
@@ -11,7 +15,9 @@
#include "string-list.h"
#include "tmp-objdir.h"
#include "packfile.h"
+#include "object-file.h"
#include "object-store.h"
+#include "wrapper.h"
static int odb_transaction_nesting;
@@ -124,7 +130,7 @@ static int already_written(struct bulk_checkin_packfile *state, struct object_id
int i;
/* The object may already exist in the repository */
- if (has_object_file(oid))
+ if (repo_has_object_file(the_repository, oid))
return 1;
/* Might want to keep the list sorted */
diff --git a/bulk-checkin.h b/bulk-checkin.h
index 8281b9cb15..48fe9a6e91 100644
--- a/bulk-checkin.h
+++ b/bulk-checkin.h
@@ -4,7 +4,7 @@
#ifndef BULK_CHECKIN_H
#define BULK_CHECKIN_H
-#include "cache.h"
+#include "object.h"
void prepare_loose_object_bulk_checkin(void);
void fsync_loose_object_bulk_checkin(int fd, const char *filename);
diff --git a/bundle-uri.c b/bundle-uri.c
index 4a8cc74ed0..2a2db1a1d3 100644
--- a/bundle-uri.c
+++ b/bundle-uri.c
@@ -1,26 +1,285 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "bundle-uri.h"
#include "bundle.h"
+#include "copy.h"
+#include "environment.h"
+#include "gettext.h"
#include "object-store.h"
#include "refs.h"
#include "run-command.h"
+#include "hashmap.h"
+#include "pkt-line.h"
+#include "config.h"
+#include "remote.h"
-static int find_temp_filename(struct strbuf *name)
+static struct {
+ enum bundle_list_heuristic heuristic;
+ const char *name;
+} heuristics[BUNDLE_HEURISTIC__COUNT] = {
+ { BUNDLE_HEURISTIC_NONE, ""},
+ { BUNDLE_HEURISTIC_CREATIONTOKEN, "creationToken" },
+};
+
+static int compare_bundles(const void *hashmap_cmp_fn_data,
+ const struct hashmap_entry *he1,
+ const struct hashmap_entry *he2,
+ const void *id)
+{
+ const struct remote_bundle_info *e1 =
+ container_of(he1, const struct remote_bundle_info, ent);
+ const struct remote_bundle_info *e2 =
+ container_of(he2, const struct remote_bundle_info, ent);
+
+ return strcmp(e1->id, id ? (const char *)id : e2->id);
+}
+
+void init_bundle_list(struct bundle_list *list)
+{
+ memset(list, 0, sizeof(*list));
+
+ /* Implied defaults. */
+ list->mode = BUNDLE_MODE_ALL;
+ list->version = 1;
+
+ hashmap_init(&list->bundles, compare_bundles, NULL, 0);
+}
+
+static int clear_remote_bundle_info(struct remote_bundle_info *bundle,
+ void *data)
+{
+ FREE_AND_NULL(bundle->id);
+ FREE_AND_NULL(bundle->uri);
+ FREE_AND_NULL(bundle->file);
+ bundle->unbundled = 0;
+ return 0;
+}
+
+void clear_bundle_list(struct bundle_list *list)
+{
+ if (!list)
+ return;
+
+ for_all_bundles_in_list(list, clear_remote_bundle_info, NULL);
+ hashmap_clear_and_free(&list->bundles, struct remote_bundle_info, ent);
+ free(list->baseURI);
+}
+
+int for_all_bundles_in_list(struct bundle_list *list,
+ bundle_iterator iter,
+ void *data)
+{
+ struct remote_bundle_info *info;
+ struct hashmap_iter i;
+
+ hashmap_for_each_entry(&list->bundles, &i, info, ent) {
+ int result = iter(info, data);
+
+ if (result)
+ return result;
+ }
+
+ return 0;
+}
+
+static int summarize_bundle(struct remote_bundle_info *info, void *data)
+{
+ FILE *fp = data;
+ fprintf(fp, "[bundle \"%s\"]\n", info->id);
+ fprintf(fp, "\turi = %s\n", info->uri);
+
+ if (info->creationToken)
+ fprintf(fp, "\tcreationToken = %"PRIu64"\n", info->creationToken);
+ return 0;
+}
+
+void print_bundle_list(FILE *fp, struct bundle_list *list)
+{
+ const char *mode;
+
+ switch (list->mode) {
+ case BUNDLE_MODE_ALL:
+ mode = "all";
+ break;
+
+ case BUNDLE_MODE_ANY:
+ mode = "any";
+ break;
+
+ case BUNDLE_MODE_NONE:
+ default:
+ mode = "<unknown>";
+ }
+
+ fprintf(fp, "[bundle]\n");
+ fprintf(fp, "\tversion = %d\n", list->version);
+ fprintf(fp, "\tmode = %s\n", mode);
+
+ if (list->heuristic) {
+ int i;
+ for (i = 0; i < BUNDLE_HEURISTIC__COUNT; i++) {
+ if (heuristics[i].heuristic == list->heuristic) {
+ printf("\theuristic = %s\n",
+ heuristics[list->heuristic].name);
+ break;
+ }
+ }
+ }
+
+ for_all_bundles_in_list(list, summarize_bundle, fp);
+}
+
+/**
+ * Given a key-value pair, update the state of the given bundle list.
+ * Returns 0 if the key-value pair is understood. Returns -1 if the key
+ * is not understood or the value is malformed.
+ */
+static int bundle_list_update(const char *key, const char *value,
+ struct bundle_list *list)
+{
+ struct strbuf id = STRBUF_INIT;
+ struct remote_bundle_info lookup = REMOTE_BUNDLE_INFO_INIT;
+ struct remote_bundle_info *bundle;
+ const char *subsection, *subkey;
+ size_t subsection_len;
+
+ if (parse_config_key(key, "bundle", &subsection, &subsection_len, &subkey))
+ return -1;
+
+ if (!subsection_len) {
+ if (!strcmp(subkey, "version")) {
+ int version;
+ if (!git_parse_int(value, &version))
+ return -1;
+ if (version != 1)
+ return -1;
+
+ list->version = version;
+ return 0;
+ }
+
+ if (!strcmp(subkey, "mode")) {
+ if (!strcmp(value, "all"))
+ list->mode = BUNDLE_MODE_ALL;
+ else if (!strcmp(value, "any"))
+ list->mode = BUNDLE_MODE_ANY;
+ else
+ return -1;
+ return 0;
+ }
+
+ if (!strcmp(subkey, "heuristic")) {
+ int i;
+ for (i = 0; i < BUNDLE_HEURISTIC__COUNT; i++) {
+ if (heuristics[i].heuristic &&
+ heuristics[i].name &&
+ !strcmp(value, heuristics[i].name)) {
+ list->heuristic = heuristics[i].heuristic;
+ return 0;
+ }
+ }
+
+ /* Ignore unknown heuristics. */
+ return 0;
+ }
+
+ /* Ignore other unknown global keys. */
+ return 0;
+ }
+
+ strbuf_add(&id, subsection, subsection_len);
+
+ /*
+ * Check for an existing bundle with this <id>, or create one
+ * if necessary.
+ */
+ lookup.id = id.buf;
+ hashmap_entry_init(&lookup.ent, strhash(lookup.id));
+ if (!(bundle = hashmap_get_entry(&list->bundles, &lookup, ent, NULL))) {
+ CALLOC_ARRAY(bundle, 1);
+ bundle->id = strbuf_detach(&id, NULL);
+ hashmap_entry_init(&bundle->ent, strhash(bundle->id));
+ hashmap_add(&list->bundles, &bundle->ent);
+ }
+ strbuf_release(&id);
+
+ if (!strcmp(subkey, "uri")) {
+ if (bundle->uri)
+ return -1;
+ bundle->uri = relative_url(list->baseURI, value, NULL);
+ return 0;
+ }
+
+ if (!strcmp(subkey, "creationtoken")) {
+ if (sscanf(value, "%"PRIu64, &bundle->creationToken) != 1)
+ warning(_("could not parse bundle list key %s with value '%s'"),
+ "creationToken", value);
+ return 0;
+ }
+
+ /*
+ * At this point, we ignore any information that we don't
+ * understand, assuming it to be hints for a heuristic the client
+ * does not currently understand.
+ */
+ return 0;
+}
+
+static int config_to_bundle_list(const char *key, const char *value, void *data)
+{
+ struct bundle_list *list = data;
+ return bundle_list_update(key, value, list);
+}
+
+int bundle_uri_parse_config_format(const char *uri,
+ const char *filename,
+ struct bundle_list *list)
+{
+ int result;
+ struct config_options opts = {
+ .error_action = CONFIG_ERROR_ERROR,
+ };
+
+ if (!list->baseURI) {
+ struct strbuf baseURI = STRBUF_INIT;
+ strbuf_addstr(&baseURI, uri);
+
+ /*
+ * If the URI does not end with a trailing slash, then
+ * remove the filename portion of the path. This is
+ * important for relative URIs.
+ */
+ strbuf_strip_file_from_path(&baseURI);
+ list->baseURI = strbuf_detach(&baseURI, NULL);
+ }
+ result = git_config_from_file_with_options(config_to_bundle_list,
+ filename, list,
+ &opts);
+
+ if (!result && list->mode == BUNDLE_MODE_NONE) {
+ warning(_("bundle list at '%s' has no mode"), uri);
+ result = 1;
+ }
+
+ return result;
+}
+
+static char *find_temp_filename(void)
{
int fd;
+ struct strbuf name = STRBUF_INIT;
/*
* Find a temporary filename that is available. This is briefly
* racy, but unlikely to collide.
*/
- fd = odb_mkstemp(name, "bundles/tmp_uri_XXXXXX");
+ fd = odb_mkstemp(&name, "bundles/tmp_uri_XXXXXX");
if (fd < 0) {
warning(_("failed to create temporary file"));
- return -1;
+ return NULL;
}
close(fd);
- unlink(name->buf);
- return 0;
+ unlink(name.buf);
+ return strbuf_detach(&name, NULL);
}
static int download_https_uri_to_file(const char *file, const char *uri)
@@ -32,6 +291,7 @@ static int download_https_uri_to_file(const char *file, const char *uri)
int found_get = 0;
strvec_pushl(&cp.args, "git-remote-https", uri, NULL);
+ cp.err = -1;
cp.in = -1;
cp.out = -1;
@@ -105,7 +365,13 @@ static int unbundle_from_file(struct repository *r, const char *file)
if ((bundle_fd = read_bundle_header(file, &header)) < 0)
return 1;
- if ((result = unbundle(r, &header, bundle_fd, NULL)))
+ /*
+ * Skip the reachability walk here, since we will be adding
+ * a reachable ref pointing to the new tips, which will reach
+ * the prerequisite commits.
+ */
+ if ((result = unbundle(r, &header, bundle_fd, NULL,
+ VERIFY_BUNDLE_QUIET)))
return 1;
/*
@@ -138,31 +404,527 @@ static int unbundle_from_file(struct repository *r, const char *file)
return result;
}
-int fetch_bundle_uri(struct repository *r, const char *uri)
+struct bundle_list_context {
+ struct repository *r;
+ struct bundle_list *list;
+ enum bundle_list_mode mode;
+ int count;
+ int depth;
+};
+
+/*
+ * This early definition is necessary because we use indirect recursion:
+ *
+ * While iterating through a bundle list that was downloaded as part
+ * of fetch_bundle_uri_internal(), iterator methods eventually call it
+ * again, but with depth + 1.
+ */
+static int fetch_bundle_uri_internal(struct repository *r,
+ struct remote_bundle_info *bundle,
+ int depth,
+ struct bundle_list *list);
+
+static int download_bundle_to_file(struct remote_bundle_info *bundle, void *data)
+{
+ int res;
+ struct bundle_list_context *ctx = data;
+
+ if (ctx->mode == BUNDLE_MODE_ANY && ctx->count)
+ return 0;
+
+ res = fetch_bundle_uri_internal(ctx->r, bundle, ctx->depth + 1, ctx->list);
+
+ /*
+ * Only increment count if the download succeeded. If our mode is
+ * BUNDLE_MODE_ANY, then we will want to try other URIs in the
+ * list in case they work instead.
+ */
+ if (!res)
+ ctx->count++;
+
+ /*
+ * To be opportunistic as possible, we continue iterating and
+ * download as many bundles as we can, so we can apply the ones
+ * that work, even in BUNDLE_MODE_ALL mode.
+ */
+ return 0;
+}
+
+struct bundles_for_sorting {
+ struct remote_bundle_info **items;
+ size_t alloc;
+ size_t nr;
+};
+
+static int append_bundle(struct remote_bundle_info *bundle, void *data)
+{
+ struct bundles_for_sorting *list = data;
+ list->items[list->nr++] = bundle;
+ return 0;
+}
+
+/**
+ * For use in QSORT() to get a list sorted by creationToken
+ * in decreasing order.
+ */
+static int compare_creation_token_decreasing(const void *va, const void *vb)
+{
+ const struct remote_bundle_info * const *a = va;
+ const struct remote_bundle_info * const *b = vb;
+
+ if ((*a)->creationToken > (*b)->creationToken)
+ return -1;
+ if ((*a)->creationToken < (*b)->creationToken)
+ return 1;
+ return 0;
+}
+
+static int fetch_bundles_by_token(struct repository *r,
+ struct bundle_list *list)
+{
+ int cur;
+ int move_direction = 0;
+ const char *creationTokenStr;
+ uint64_t maxCreationToken = 0, newMaxCreationToken = 0;
+ struct bundle_list_context ctx = {
+ .r = r,
+ .list = list,
+ .mode = list->mode,
+ };
+ struct bundles_for_sorting bundles = {
+ .alloc = hashmap_get_size(&list->bundles),
+ };
+
+ ALLOC_ARRAY(bundles.items, bundles.alloc);
+
+ for_all_bundles_in_list(list, append_bundle, &bundles);
+
+ if (!bundles.nr) {
+ free(bundles.items);
+ return 0;
+ }
+
+ QSORT(bundles.items, bundles.nr, compare_creation_token_decreasing);
+
+ /*
+ * If fetch.bundleCreationToken exists, parses to a uint64t, and
+ * is not strictly smaller than the maximum creation token in the
+ * bundle list, then do not download any bundles.
+ */
+ if (!repo_config_get_value(r,
+ "fetch.bundlecreationtoken",
+ &creationTokenStr) &&
+ sscanf(creationTokenStr, "%"PRIu64, &maxCreationToken) == 1 &&
+ bundles.items[0]->creationToken <= maxCreationToken) {
+ free(bundles.items);
+ return 0;
+ }
+
+ /*
+ * Attempt to download and unbundle the minimum number of bundles by
+ * creationToken in decreasing order. If we fail to unbundle (after
+ * a successful download) then move to the next non-downloaded bundle
+ * and attempt downloading. Once we succeed in applying a bundle,
+ * move to the previous unapplied bundle and attempt to unbundle it
+ * again.
+ *
+ * In the case of a fresh clone, we will likely download all of the
+ * bundles before successfully unbundling the oldest one, then the
+ * rest of the bundles unbundle successfully in increasing order
+ * of creationToken.
+ *
+ * If there are existing objects, then this process may terminate
+ * early when all required commits from "new" bundles exist in the
+ * repo's object store.
+ */
+ cur = 0;
+ while (cur >= 0 && cur < bundles.nr) {
+ struct remote_bundle_info *bundle = bundles.items[cur];
+
+ /*
+ * If we need to dig into bundles below the previous
+ * creation token value, then likely we are in an erroneous
+ * state due to missing or invalid bundles. Halt the process
+ * instead of continuing to download extra data.
+ */
+ if (bundle->creationToken <= maxCreationToken)
+ break;
+
+ if (!bundle->file) {
+ /*
+ * Not downloaded yet. Try downloading.
+ *
+ * Note that bundle->file is non-NULL if a download
+ * was attempted, even if it failed to download.
+ */
+ if (fetch_bundle_uri_internal(ctx.r, bundle, ctx.depth + 1, ctx.list)) {
+ /* Mark as unbundled so we do not retry. */
+ bundle->unbundled = 1;
+
+ /* Try looking deeper in the list. */
+ move_direction = 1;
+ goto move;
+ }
+
+ /* We expect bundles when using creationTokens. */
+ if (!is_bundle(bundle->file, 1)) {
+ warning(_("file downloaded from '%s' is not a bundle"),
+ bundle->uri);
+ break;
+ }
+ }
+
+ if (bundle->file && !bundle->unbundled) {
+ /*
+ * This was downloaded, but not successfully
+ * unbundled. Try unbundling again.
+ */
+ if (unbundle_from_file(ctx.r, bundle->file)) {
+ /* Try looking deeper in the list. */
+ move_direction = 1;
+ } else {
+ /*
+ * Succeeded in unbundle. Retry bundles
+ * that previously failed to unbundle.
+ */
+ move_direction = -1;
+ bundle->unbundled = 1;
+
+ if (bundle->creationToken > newMaxCreationToken)
+ newMaxCreationToken = bundle->creationToken;
+ }
+ }
+
+ /*
+ * Else case: downloaded and unbundled successfully.
+ * Skip this by moving in the same direction as the
+ * previous step.
+ */
+
+move:
+ /* Move in the specified direction and repeat. */
+ cur += move_direction;
+ }
+
+ /*
+ * We succeed if the loop terminates because 'cur' drops below
+ * zero. The other case is that we terminate because 'cur'
+ * reaches the end of the list, so we have a failure no matter
+ * which bundles we apply from the list.
+ */
+ if (cur < 0) {
+ struct strbuf value = STRBUF_INIT;
+ strbuf_addf(&value, "%"PRIu64"", newMaxCreationToken);
+ if (repo_config_set_multivar_gently(ctx.r,
+ "fetch.bundleCreationToken",
+ value.buf, NULL, 0))
+ warning(_("failed to store maximum creation token"));
+
+ strbuf_release(&value);
+ }
+
+ free(bundles.items);
+ return cur >= 0;
+}
+
+static int download_bundle_list(struct repository *r,
+ struct bundle_list *local_list,
+ struct bundle_list *global_list,
+ int depth)
+{
+ struct bundle_list_context ctx = {
+ .r = r,
+ .list = global_list,
+ .depth = depth + 1,
+ .mode = local_list->mode,
+ };
+
+ return for_all_bundles_in_list(local_list, download_bundle_to_file, &ctx);
+}
+
+static int fetch_bundle_list_in_config_format(struct repository *r,
+ struct bundle_list *global_list,
+ struct remote_bundle_info *bundle,
+ int depth)
+{
+ int result;
+ struct bundle_list list_from_bundle;
+
+ init_bundle_list(&list_from_bundle);
+
+ if ((result = bundle_uri_parse_config_format(bundle->uri,
+ bundle->file,
+ &list_from_bundle)))
+ goto cleanup;
+
+ if (list_from_bundle.mode == BUNDLE_MODE_NONE) {
+ warning(_("unrecognized bundle mode from URI '%s'"),
+ bundle->uri);
+ result = -1;
+ goto cleanup;
+ }
+
+ /*
+ * If this list uses the creationToken heuristic, then the URIs
+ * it advertises are expected to be bundles, not nested lists.
+ * We can drop 'global_list' and 'depth'.
+ */
+ if (list_from_bundle.heuristic == BUNDLE_HEURISTIC_CREATIONTOKEN) {
+ result = fetch_bundles_by_token(r, &list_from_bundle);
+ global_list->heuristic = BUNDLE_HEURISTIC_CREATIONTOKEN;
+ } else if ((result = download_bundle_list(r, &list_from_bundle,
+ global_list, depth)))
+ goto cleanup;
+
+cleanup:
+ clear_bundle_list(&list_from_bundle);
+ return result;
+}
+
+/**
+ * This limits the recursion on fetch_bundle_uri_internal() when following
+ * bundle lists.
+ */
+static int max_bundle_uri_depth = 4;
+
+/**
+ * Recursively download all bundles advertised at the given URI
+ * to files. If the file is a bundle, then add it to the given
+ * 'list'. Otherwise, expect a bundle list and recurse on the
+ * URIs in that list according to the list mode (ANY or ALL).
+ */
+static int fetch_bundle_uri_internal(struct repository *r,
+ struct remote_bundle_info *bundle,
+ int depth,
+ struct bundle_list *list)
{
int result = 0;
- struct strbuf filename = STRBUF_INIT;
+ struct remote_bundle_info *bcopy;
- if ((result = find_temp_filename(&filename)))
+ if (depth >= max_bundle_uri_depth) {
+ warning(_("exceeded bundle URI recursion limit (%d)"),
+ max_bundle_uri_depth);
+ return -1;
+ }
+
+ if (!bundle->file &&
+ !(bundle->file = find_temp_filename())) {
+ result = -1;
goto cleanup;
+ }
- if ((result = copy_uri_to_file(filename.buf, uri))) {
- warning(_("failed to download bundle from URI '%s'"), uri);
+ if ((result = copy_uri_to_file(bundle->file, bundle->uri))) {
+ warning(_("failed to download bundle from URI '%s'"), bundle->uri);
goto cleanup;
}
- if ((result = !is_bundle(filename.buf, 0))) {
- warning(_("file at URI '%s' is not a bundle"), uri);
+ if ((result = !is_bundle(bundle->file, 1))) {
+ result = fetch_bundle_list_in_config_format(
+ r, list, bundle, depth);
+ if (result)
+ warning(_("file at URI '%s' is not a bundle or bundle list"),
+ bundle->uri);
goto cleanup;
}
- if ((result = unbundle_from_file(r, filename.buf))) {
- warning(_("failed to unbundle bundle from URI '%s'"), uri);
+ /* Copy the bundle and insert it into the global list. */
+ CALLOC_ARRAY(bcopy, 1);
+ bcopy->id = xstrdup(bundle->id);
+ bcopy->file = xstrdup(bundle->file);
+ hashmap_entry_init(&bcopy->ent, strhash(bcopy->id));
+ hashmap_add(&list->bundles, &bcopy->ent);
+
+cleanup:
+ if (result && bundle->file)
+ unlink(bundle->file);
+ return result;
+}
+
+/**
+ * This loop iterator breaks the loop with nonzero return code on the
+ * first successful unbundling of a bundle.
+ */
+static int attempt_unbundle(struct remote_bundle_info *info, void *data)
+{
+ struct repository *r = data;
+
+ if (!info->file || info->unbundled)
+ return 0;
+
+ if (!unbundle_from_file(r, info->file)) {
+ info->unbundled = 1;
+ return 1;
+ }
+
+ return 0;
+}
+
+static int unbundle_all_bundles(struct repository *r,
+ struct bundle_list *list)
+{
+ /*
+ * Iterate through all bundles looking for ones that can
+ * successfully unbundle. If any succeed, then perhaps another
+ * will succeed in the next attempt.
+ *
+ * Keep in mind that a non-zero result for the loop here means
+ * the loop terminated early on a successful unbundling, which
+ * signals that we can try again.
+ */
+ while (for_all_bundles_in_list(list, attempt_unbundle, r)) ;
+
+ return 0;
+}
+
+static int unlink_bundle(struct remote_bundle_info *info, void *data)
+{
+ if (info->file)
+ unlink_or_warn(info->file);
+ return 0;
+}
+
+int fetch_bundle_uri(struct repository *r, const char *uri,
+ int *has_heuristic)
+{
+ int result;
+ struct bundle_list list;
+ struct remote_bundle_info bundle = {
+ .uri = xstrdup(uri),
+ .id = xstrdup(""),
+ };
+
+ init_bundle_list(&list);
+
+ /*
+ * Do not fetch an empty bundle URI. An empty bundle URI
+ * could signal that a configured bundle URI has been disabled.
+ */
+ if (!*uri) {
+ result = 0;
goto cleanup;
}
+ /* If a bundle is added to this global list, then it is required. */
+ list.mode = BUNDLE_MODE_ALL;
+
+ if ((result = fetch_bundle_uri_internal(r, &bundle, 0, &list)))
+ goto cleanup;
+
+ result = unbundle_all_bundles(r, &list);
+
cleanup:
- unlink(filename.buf);
- strbuf_release(&filename);
+ if (has_heuristic)
+ *has_heuristic = (list.heuristic != BUNDLE_HEURISTIC_NONE);
+ for_all_bundles_in_list(&list, unlink_bundle, NULL);
+ clear_bundle_list(&list);
+ clear_remote_bundle_info(&bundle, NULL);
+ return result;
+}
+
+int fetch_bundle_list(struct repository *r, struct bundle_list *list)
+{
+ int result;
+ struct bundle_list global_list;
+
+ /*
+ * If the creationToken heuristic is used, then the URIs
+ * advertised by 'list' are not nested lists and instead
+ * direct bundles. We do not need to use global_list.
+ */
+ if (list->heuristic == BUNDLE_HEURISTIC_CREATIONTOKEN)
+ return fetch_bundles_by_token(r, list);
+
+ init_bundle_list(&global_list);
+
+ /* If a bundle is added to this global list, then it is required. */
+ global_list.mode = BUNDLE_MODE_ALL;
+
+ if ((result = download_bundle_list(r, list, &global_list, 0)))
+ goto cleanup;
+
+ if (list->heuristic == BUNDLE_HEURISTIC_CREATIONTOKEN)
+ result = fetch_bundles_by_token(r, list);
+ else
+ result = unbundle_all_bundles(r, &global_list);
+
+cleanup:
+ for_all_bundles_in_list(&global_list, unlink_bundle, NULL);
+ clear_bundle_list(&global_list);
+ return result;
+}
+
+/**
+ * API for serve.c.
+ */
+
+int bundle_uri_advertise(struct repository *r, struct strbuf *value UNUSED)
+{
+ static int advertise_bundle_uri = -1;
+
+ if (advertise_bundle_uri != -1)
+ goto cached;
+
+ advertise_bundle_uri = 0;
+ repo_config_get_maybe_bool(r, "uploadpack.advertisebundleuris", &advertise_bundle_uri);
+
+cached:
+ return advertise_bundle_uri;
+}
+
+static int config_to_packet_line(const char *key, const char *value, void *data)
+{
+ struct packet_reader *writer = data;
+
+ if (starts_with(key, "bundle."))
+ packet_write_fmt(writer->fd, "%s=%s", key, value);
+
+ return 0;
+}
+
+int bundle_uri_command(struct repository *r,
+ struct packet_reader *request)
+{
+ struct packet_writer writer;
+ packet_writer_init(&writer, 1);
+
+ while (packet_reader_read(request) == PACKET_READ_NORMAL)
+ die(_("bundle-uri: unexpected argument: '%s'"), request->line);
+ if (request->status != PACKET_READ_FLUSH)
+ die(_("bundle-uri: expected flush after arguments"));
+
+ /*
+ * Read all "bundle.*" config lines to the client as key=value
+ * packet lines.
+ */
+ repo_config(r, config_to_packet_line, &writer);
+
+ packet_writer_flush(&writer);
+
+ return 0;
+}
+
+/**
+ * General API for {transport,connect}.c etc.
+ */
+int bundle_uri_parse_line(struct bundle_list *list, const char *line)
+{
+ int result;
+ const char *equals;
+ struct strbuf key = STRBUF_INIT;
+
+ if (!strlen(line))
+ return error(_("bundle-uri: got an empty line"));
+
+ equals = strchr(line, '=');
+
+ if (!equals)
+ return error(_("bundle-uri: line is not of the form 'key=value'"));
+ if (line == equals || !*(equals + 1))
+ return error(_("bundle-uri: line has empty key or value"));
+
+ strbuf_add(&key, line, equals - line);
+ result = bundle_list_update(key.buf, equals + 1, list);
+ strbuf_release(&key);
+
return result;
}
diff --git a/bundle-uri.h b/bundle-uri.h
index 8a152f1ef1..6dbc780f66 100644
--- a/bundle-uri.h
+++ b/bundle-uri.h
@@ -1,14 +1,168 @@
#ifndef BUNDLE_URI_H
#define BUNDLE_URI_H
+#include "hashmap.h"
+#include "strbuf.h"
+
+struct packet_reader;
struct repository;
+struct string_list;
+
+/**
+ * The remote_bundle_info struct contains information for a single bundle
+ * URI. This may be initialized simply by a given URI or might have
+ * additional metadata associated with it if the bundle was advertised by
+ * a bundle list.
+ */
+struct remote_bundle_info {
+ struct hashmap_entry ent;
+
+ /**
+ * The 'id' is a name given to the bundle for reference
+ * by other bundle infos.
+ */
+ char *id;
+
+ /**
+ * The 'uri' is the location of the remote bundle so
+ * it can be downloaded on-demand. This will be NULL
+ * if there was no table of contents.
+ */
+ char *uri;
+
+ /**
+ * If the bundle has been downloaded, then 'file' is a
+ * filename storing its contents. Otherwise, 'file' is
+ * NULL.
+ */
+ char *file;
+
+ /**
+ * If the bundle has been unbundled successfully, then
+ * this boolean is true.
+ */
+ unsigned unbundled:1;
+
+ /**
+ * If the bundle is part of a list with the creationToken
+ * heuristic, then we use this member for sorting the bundles.
+ */
+ uint64_t creationToken;
+};
+
+#define REMOTE_BUNDLE_INFO_INIT { 0 }
+
+enum bundle_list_mode {
+ BUNDLE_MODE_NONE = 0,
+ BUNDLE_MODE_ALL,
+ BUNDLE_MODE_ANY
+};
+
+enum bundle_list_heuristic {
+ BUNDLE_HEURISTIC_NONE = 0,
+ BUNDLE_HEURISTIC_CREATIONTOKEN,
+
+ /* Must be last. */
+ BUNDLE_HEURISTIC__COUNT
+};
+
+/**
+ * A bundle_list contains an unordered set of remote_bundle_info structs,
+ * as well as information about the bundle listing, such as version and
+ * mode.
+ */
+struct bundle_list {
+ int version;
+ enum bundle_list_mode mode;
+ struct hashmap bundles;
+
+ /**
+ * The baseURI of a bundle_list is the URI that provided the list.
+ *
+ * In the case of the 'bundle-uri' protocol v2 command, the base
+ * URI is the URI of the Git remote.
+ *
+ * Otherwise, the bundle list was downloaded over HTTP from some
+ * known URI. 'baseURI' is set to that value.
+ *
+ * The baseURI is used as the base for any relative URIs
+ * advertised by the bundle list at that location.
+ */
+ char *baseURI;
+
+ /**
+ * A list can have a heuristic, which helps reduce the number of
+ * downloaded bundles.
+ */
+ enum bundle_list_heuristic heuristic;
+};
+
+void init_bundle_list(struct bundle_list *list);
+void clear_bundle_list(struct bundle_list *list);
+
+typedef int (*bundle_iterator)(struct remote_bundle_info *bundle,
+ void *data);
+
+int for_all_bundles_in_list(struct bundle_list *list,
+ bundle_iterator iter,
+ void *data);
+
+struct FILE;
+void print_bundle_list(FILE *fp, struct bundle_list *list);
+
+/**
+ * A bundle URI may point to a bundle list where the key=value
+ * pairs are provided in config file format. This method is
+ * exposed publicly for testing purposes.
+ */
+int bundle_uri_parse_config_format(const char *uri,
+ const char *filename,
+ struct bundle_list *list);
/**
* Fetch data from the given 'uri' and unbundle the bundle data found
* based on that information.
*
* Returns non-zero if no bundle information is found at the given 'uri'.
+ *
+ * If the pointer 'has_heuristic' is non-NULL, then the value it points to
+ * will be set to be non-zero if and only if the fetched list has a
+ * heuristic value. Such a value indicates that the list was designed for
+ * incremental fetches.
+ */
+int fetch_bundle_uri(struct repository *r, const char *uri,
+ int *has_heuristic);
+
+/**
+ * Given a bundle list that was already advertised (likely by the
+ * bundle-uri protocol v2 verb) at the given uri, fetch and unbundle the
+ * bundles according to the bundle strategy of that list.
+ *
+ * It is expected that the given 'list' is initialized, including its
+ * 'baseURI' value.
+ *
+ * Returns non-zero if there was an error trying to download the list
+ * or any of its advertised bundles.
+ */
+int fetch_bundle_list(struct repository *r,
+ struct bundle_list *list);
+
+/**
+ * API for serve.c.
+ */
+int bundle_uri_advertise(struct repository *r, struct strbuf *value);
+int bundle_uri_command(struct repository *r, struct packet_reader *request);
+
+/**
+ * General API for {transport,connect}.c etc.
+ */
+
+/**
+ * Parse a "key=value" packet line from the bundle-uri verb.
+ *
+ * Returns 0 on success and non-zero on error.
*/
-int fetch_bundle_uri(struct repository *r, const char *uri);
+int bundle_uri_parse_line(struct bundle_list *list,
+ const char *line);
#endif
diff --git a/bundle.c b/bundle.c
index 0208e6d90d..a5505368de 100644
--- a/bundle.c
+++ b/bundle.c
@@ -1,6 +1,9 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "lockfile.h"
#include "bundle.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "object-store.h"
#include "repository.h"
#include "object.h"
@@ -12,6 +15,8 @@
#include "refs.h"
#include "strvec.h"
#include "list-objects-filter-options.h"
+#include "connected.h"
+#include "write-or-die.h"
static const char v2_bundle_signature[] = "# v2 git bundle\n";
static const char v3_bundle_signature[] = "# v3 git bundle\n";
@@ -187,79 +192,65 @@ static int list_refs(struct string_list *r, int argc, const char **argv)
/* Remember to update object flag allocation in object.h */
#define PREREQ_MARK (1u<<16)
+struct string_list_iterator {
+ struct string_list *list;
+ size_t cur;
+};
+
+static const struct object_id *iterate_ref_map(void *cb_data)
+{
+ struct string_list_iterator *iter = cb_data;
+
+ if (iter->cur >= iter->list->nr)
+ return NULL;
+
+ return iter->list->items[iter->cur++].util;
+}
+
int verify_bundle(struct repository *r,
struct bundle_header *header,
- int verbose)
+ enum verify_bundle_flags flags)
{
/*
* Do fast check, then if any prereqs are missing then go line by line
* to be verbose about the errors
*/
struct string_list *p = &header->prerequisites;
- struct rev_info revs = REV_INFO_INIT;
- const char *argv[] = {NULL, "--all", NULL};
- struct commit *commit;
- int i, ret = 0, req_nr;
+ int i, ret = 0;
const char *message = _("Repository lacks these prerequisite commits:");
+ struct string_list_iterator iter = {
+ .list = p,
+ };
+ struct check_connected_options opts = {
+ .quiet = 1,
+ };
- if (!r || !r->objects || !r->objects->odb) {
- ret = error(_("need a repository to verify a bundle"));
- goto cleanup;
- }
+ if (!r || !r->objects || !r->objects->odb)
+ return error(_("need a repository to verify a bundle"));
- repo_init_revisions(r, &revs, NULL);
for (i = 0; i < p->nr; i++) {
struct string_list_item *e = p->items + i;
const char *name = e->string;
struct object_id *oid = e->util;
struct object *o = parse_object(r, oid);
- if (o) {
- o->flags |= PREREQ_MARK;
- add_pending_object(&revs, o, name);
+ if (o)
continue;
- }
- if (++ret == 1)
- error("%s", message);
- error("%s %s", oid_to_hex(oid), name);
- }
- if (revs.pending.nr != p->nr)
- goto cleanup;
- req_nr = revs.pending.nr;
- setup_revisions(2, argv, &revs, NULL);
-
- list_objects_filter_copy(&revs.filter, &header->filter);
-
- if (prepare_revision_walk(&revs))
- die(_("revision walk setup failed"));
-
- i = req_nr;
- while (i && (commit = get_revision(&revs)))
- if (commit->object.flags & PREREQ_MARK)
- i--;
-
- for (i = 0; i < p->nr; i++) {
- struct string_list_item *e = p->items + i;
- const char *name = e->string;
- const struct object_id *oid = e->util;
- struct object *o = parse_object(r, oid);
- assert(o); /* otherwise we'd have returned early */
- if (o->flags & SHOWN)
+ ret++;
+ if (flags & VERIFY_BUNDLE_QUIET)
continue;
- if (++ret == 1)
+ if (ret == 1)
error("%s", message);
error("%s %s", oid_to_hex(oid), name);
}
+ if (ret)
+ goto cleanup;
- /* Clean up objects used, as they will be reused. */
- for (i = 0; i < p->nr; i++) {
- struct string_list_item *e = p->items + i;
- struct object_id *oid = e->util;
- commit = lookup_commit_reference_gently(r, oid, 1);
- if (commit)
- clear_commit_marks(commit, ALL_REV_FLAGS);
- }
+ if ((ret = check_connected(iterate_ref_map, &iter, &opts)))
+ error(_("some prerequisite commits exist in the object store, "
+ "but are not connected to the repository's history"));
- if (verbose) {
+ /* TODO: preserve this verbose language. */
+ if (flags & VERIFY_BUNDLE_VERBOSE) {
struct string_list *r;
r = &header->references;
@@ -287,7 +278,6 @@ int verify_bundle(struct repository *r,
list_objects_filter_spec(&header->filter));
}
cleanup:
- release_revisions(&revs);
return ret;
}
@@ -307,7 +297,7 @@ static int is_tag_in_date_range(struct object *tag, struct rev_info *revs)
if (revs->max_age == -1 && revs->min_age == -1)
goto out;
- buf = read_object_file(&tag->oid, &type, &size);
+ buf = repo_read_object_file(the_repository, &tag->oid, &type, &size);
if (!buf)
goto out;
line = memmem(buf, size, "\ntagger ", 8);
@@ -396,7 +386,8 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs)
if (e->item->flags & UNINTERESTING)
continue;
- if (dwim_ref(e->name, strlen(e->name), &oid, &ref, 0) != 1)
+ if (repo_dwim_ref(the_repository, e->name, strlen(e->name),
+ &oid, &ref, 0) != 1)
goto skip_write_ref;
if (read_ref_full(e->name, RESOLVE_REF_READING, &oid, &flag))
flag = 0;
@@ -620,9 +611,14 @@ err:
}
int unbundle(struct repository *r, struct bundle_header *header,
- int bundle_fd, struct strvec *extra_index_pack_args)
+ int bundle_fd, struct strvec *extra_index_pack_args,
+ enum verify_bundle_flags flags)
{
struct child_process ip = CHILD_PROCESS_INIT;
+
+ if (verify_bundle(r, header, flags))
+ return -1;
+
strvec_pushl(&ip.args, "index-pack", "--fix-thin", "--stdin", NULL);
/* If there is a filter, then we need to create the promisor pack. */
@@ -634,8 +630,6 @@ int unbundle(struct repository *r, struct bundle_header *header,
strvec_clear(extra_index_pack_args);
}
- if (verify_bundle(r, header, 0))
- return -1;
ip.in = bundle_fd;
ip.no_stdout = 1;
ip.git_cmd = 1;
diff --git a/bundle.h b/bundle.h
index 68ff39a0a7..021adbdcbb 100644
--- a/bundle.h
+++ b/bundle.h
@@ -2,7 +2,6 @@
#define BUNDLE_H
#include "strvec.h"
-#include "cache.h"
#include "string-list.h"
#include "list-objects-filter-options.h"
@@ -30,7 +29,14 @@ int read_bundle_header_fd(int fd, struct bundle_header *header,
int create_bundle(struct repository *r, const char *path,
int argc, const char **argv, struct strvec *pack_options,
int version);
-int verify_bundle(struct repository *r, struct bundle_header *header, int verbose);
+
+enum verify_bundle_flags {
+ VERIFY_BUNDLE_VERBOSE = (1 << 0),
+ VERIFY_BUNDLE_QUIET = (1 << 1),
+};
+
+int verify_bundle(struct repository *r, struct bundle_header *header,
+ enum verify_bundle_flags flags);
/**
* Unbundle after reading the header with read_bundle_header().
@@ -41,9 +47,13 @@ int verify_bundle(struct repository *r, struct bundle_header *header, int verbos
* Provide "extra_index_pack_args" to pass any extra arguments
* (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'.
*/
int unbundle(struct repository *r, struct bundle_header *header,
- int bundle_fd, struct strvec *extra_index_pack_args);
+ int bundle_fd, struct strvec *extra_index_pack_args,
+ enum verify_bundle_flags flags);
int list_bundle_refs(struct bundle_header *header,
int argc, const char **argv);
diff --git a/cache-tree.c b/cache-tree.c
index c97111cccf..ebfe649b33 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -1,13 +1,19 @@
#include "cache.h"
+#include "alloc.h"
+#include "environment.h"
+#include "hex.h"
#include "lockfile.h"
#include "tree.h"
#include "tree-walk.h"
#include "cache-tree.h"
#include "bulk-checkin.h"
+#include "object-file.h"
#include "object-store.h"
#include "replace-object.h"
#include "promisor-remote.h"
#include "sparse-index.h"
+#include "trace.h"
+#include "trace2.h"
#ifndef DEBUG_CACHE_TREE
#define DEBUG_CACHE_TREE 0
@@ -229,7 +235,7 @@ int cache_tree_fully_valid(struct cache_tree *it)
int i;
if (!it)
return 0;
- if (it->entry_count < 0 || !has_object_file(&it->oid))
+ if (it->entry_count < 0 || !repo_has_object_file(the_repository, &it->oid))
return 0;
for (i = 0; i < it->subtree_nr; i++) {
if (!cache_tree_fully_valid(it->down[i]->cache_tree))
@@ -240,7 +246,7 @@ int cache_tree_fully_valid(struct cache_tree *it)
static int must_check_existence(const struct cache_entry *ce)
{
- return !(has_promisor_remote() && ce_skip_worktree(ce));
+ return !(repo_has_promisor_remote(the_repository) && ce_skip_worktree(ce));
}
static int update_one(struct cache_tree *it,
@@ -280,7 +286,7 @@ static int update_one(struct cache_tree *it,
}
}
- if (0 <= it->entry_count && has_object_file(&it->oid))
+ if (0 <= it->entry_count && repo_has_object_file(the_repository, &it->oid))
return it->entry_count;
/*
@@ -386,7 +392,7 @@ static int update_one(struct cache_tree *it,
ce_missing_ok = mode == S_IFGITLINK || missing_ok ||
!must_check_existence(ce);
if (is_null_oid(oid) ||
- (!ce_missing_ok && !has_object_file(oid))) {
+ (!ce_missing_ok && !repo_has_object_file(the_repository, oid))) {
strbuf_release(&buffer);
if (expected_missing)
return -1;
@@ -405,7 +411,7 @@ static int update_one(struct cache_tree *it,
}
/*
- * CE_INTENT_TO_ADD entries exist on on-disk index but
+ * CE_INTENT_TO_ADD entries exist in on-disk index but
* they are not part of generated trees. Invalidate up
* to root to force cache-tree users to read elsewhere.
*/
@@ -434,7 +440,7 @@ static int update_one(struct cache_tree *it,
struct object_id oid;
hash_object_file(the_hash_algo, buffer.buf, buffer.len,
OBJ_TREE, &oid);
- if (has_object_file_with_flags(&oid, OBJECT_INFO_SKIP_FETCH_OBJECT))
+ if (repo_has_object_file_with_flags(the_repository, &oid, OBJECT_INFO_SKIP_FETCH_OBJECT))
oidcpy(&it->oid, &oid);
else
to_invalidate = 1;
@@ -470,7 +476,7 @@ int cache_tree_update(struct index_state *istate, int flags)
if (!istate->cache_tree)
istate->cache_tree = cache_tree();
- if (!(flags & WRITE_TREE_MISSING_OK) && has_promisor_remote())
+ if (!(flags & WRITE_TREE_MISSING_OK) && repo_has_promisor_remote(the_repository))
prefetch_cache_entries(istate, must_check_existence);
trace_performance_enter();
@@ -760,7 +766,7 @@ static void prime_cache_tree_rec(struct repository *r,
struct tree_desc desc;
struct name_entry entry;
int cnt;
- int base_path_len = tree_path->len;
+ size_t base_path_len = tree_path->len;
oidcpy(&it->oid, &tree->object.oid);
@@ -785,7 +791,6 @@ static void prime_cache_tree_rec(struct repository *r,
*/
if (r->index->sparse_index) {
strbuf_setlen(tree_path, base_path_len);
- strbuf_grow(tree_path, base_path_len + entry.pathlen + 1);
strbuf_add(tree_path, entry.path, entry.pathlen);
strbuf_addch(tree_path, '/');
}
@@ -815,14 +820,14 @@ void prime_cache_tree(struct repository *r,
{
struct strbuf tree_path = STRBUF_INIT;
- trace2_region_enter("cache-tree", "prime_cache_tree", the_repository);
+ trace2_region_enter("cache-tree", "prime_cache_tree", r);
cache_tree_free(&istate->cache_tree);
istate->cache_tree = cache_tree();
prime_cache_tree_rec(r, istate->cache_tree, tree, &tree_path);
strbuf_release(&tree_path);
istate->cache_changed |= CACHE_TREE_CHANGED;
- trace2_region_leave("cache-tree", "prime_cache_tree", the_repository);
+ trace2_region_leave("cache-tree", "prime_cache_tree", r);
}
/*
diff --git a/cache-tree.h b/cache-tree.h
index 8efeccebfc..faae88be63 100644
--- a/cache-tree.h
+++ b/cache-tree.h
@@ -1,7 +1,6 @@
#ifndef CACHE_TREE_H
#define CACHE_TREE_H
-#include "cache.h"
#include "tree.h"
#include "tree-walk.h"
@@ -53,19 +52,4 @@ int write_index_as_tree(struct object_id *oid, struct index_state *index_state,
void prime_cache_tree(struct repository *, struct index_state *, struct tree *);
int cache_tree_matches_traversal(struct cache_tree *, struct name_entry *ent, struct traverse_info *info);
-
-#ifdef USE_THE_INDEX_COMPATIBILITY_MACROS
-static inline int write_cache_as_tree(struct object_id *oid, int flags, const char *prefix)
-{
- return write_index_as_tree(oid, &the_index, get_index_file(), flags, prefix);
-}
-
-static inline int update_main_cache_tree(int flags)
-{
- if (!the_index.cache_tree)
- the_index.cache_tree = cache_tree();
- return cache_tree_update(&the_index, flags);
-}
-#endif
-
#endif
diff --git a/cache.h b/cache.h
index 26ed03bd6d..bdedb87e83 100644
--- a/cache.h
+++ b/cache.h
@@ -4,105 +4,9 @@
#include "git-compat-util.h"
#include "strbuf.h"
#include "hashmap.h"
-#include "list.h"
-#include "advice.h"
-#include "gettext.h"
-#include "convert.h"
-#include "trace.h"
-#include "trace2.h"
-#include "string-list.h"
-#include "pack-revindex.h"
-#include "hash.h"
-#include "path.h"
-#include "oid-array.h"
-#include "repository.h"
-#include "mem-pool.h"
-
-typedef struct git_zstream {
- z_stream z;
- unsigned long avail_in;
- unsigned long avail_out;
- unsigned long total_in;
- unsigned long total_out;
- unsigned char *next_in;
- unsigned char *next_out;
-} git_zstream;
-
-void git_inflate_init(git_zstream *);
-void git_inflate_init_gzip_only(git_zstream *);
-void git_inflate_end(git_zstream *);
-int git_inflate(git_zstream *, int flush);
-
-void git_deflate_init(git_zstream *, int level);
-void git_deflate_init_gzip(git_zstream *, int level);
-void git_deflate_init_raw(git_zstream *, int level);
-void git_deflate_end(git_zstream *);
-int git_deflate_abort(git_zstream *);
-int git_deflate_end_gently(git_zstream *);
-int git_deflate(git_zstream *, int flush);
-unsigned long git_deflate_bound(git_zstream *, unsigned long);
-
-#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)
-#define DTYPE(de) ((de)->d_type)
-#else
-#undef DT_UNKNOWN
-#undef DT_DIR
-#undef DT_REG
-#undef DT_LNK
-#define DT_UNKNOWN 0
-#define DT_DIR 1
-#define DT_REG 2
-#define DT_LNK 3
-#define DTYPE(de) DT_UNKNOWN
-#endif
-
-/* unknown mode (impossible combination S_IFIFO|S_IFCHR) */
-#define S_IFINVALID 0030000
-
-/*
- * A "directory link" is a link to another git directory.
- *
- * The value 0160000 is not normally a valid mode, and
- * also just happens to be S_IFDIR + S_IFLNK
- */
-#define S_IFGITLINK 0160000
-#define S_ISGITLINK(m) (((m) & S_IFMT) == S_IFGITLINK)
-
-/*
- * Some mode bits are also used internally for computations.
- *
- * They *must* not overlap with any valid modes, and they *must* not be emitted
- * to outside world - i.e. appear on disk or network. In other words, it's just
- * temporary fields, which we internally use, but they have to stay in-house.
- *
- * ( such approach is valid, as standard S_IF* fits into 16 bits, and in Git
- * codebase mode is `unsigned int` which is assumed to be at least 32 bits )
- */
-
-/* used internally in tree-diff */
-#define S_DIFFTREE_IFXMIN_NEQ 0x80000000
-
-
-/*
- * Intensive research over the course of many years has shown that
- * port 9418 is totally unused by anything else. Or
- *
- * Your search - "port 9418" - did not match any documents.
- *
- * as www.google.com puts it.
- *
- * This port has been properly assigned for git use by IANA:
- * git (Assigned-9418) [I06-050728-0001].
- *
- * git 9418/tcp git pack transfer service
- * git 9418/udp git pack transfer service
- *
- * with Linus Torvalds <torvalds@osdl.org> as the point of
- * contact. September 2005.
- *
- * See http://www.iana.org/assignments/port-numbers
- */
-#define DEFAULT_GIT_PORT 9418
+#include "pathspec.h"
+#include "object.h"
+#include "statinfo.h"
/*
* Basic data structures for the directory cache
@@ -118,26 +22,6 @@ struct cache_header {
#define INDEX_FORMAT_LB 2
#define INDEX_FORMAT_UB 4
-/*
- * The "cache_time" is just the low 32 bits of the
- * time. It doesn't matter if it overflows - we only
- * check it for equality in the 32 bits we save.
- */
-struct cache_time {
- uint32_t sec;
- uint32_t nsec;
-};
-
-struct stat_data {
- struct cache_time sd_ctime;
- struct cache_time sd_mtime;
- unsigned int sd_dev;
- unsigned int sd_ino;
- unsigned int sd_uid;
- unsigned int sd_gid;
- unsigned int sd_size;
-};
-
struct cache_entry {
struct hashmap_entry ent;
struct stat_data ce_stat_data;
@@ -203,11 +87,8 @@ struct cache_entry {
#error "CE_EXTENDED_FLAGS out of range"
#endif
-#define S_ISSPARSEDIR(m) ((m) == S_IFDIR)
-
/* Forward structure decls */
struct pathspec;
-struct child_process;
struct tree;
/*
@@ -245,17 +126,6 @@ static inline unsigned create_ce_flags(unsigned stage)
#define ce_mark_uptodate(ce) ((ce)->ce_flags |= CE_UPTODATE)
#define ce_intent_to_add(ce) ((ce)->ce_flags & CE_INTENT_TO_ADD)
-#define ce_permissions(mode) (((mode) & 0100) ? 0755 : 0644)
-static inline unsigned int create_ce_mode(unsigned int mode)
-{
- if (S_ISLNK(mode))
- return S_IFLNK;
- if (S_ISSPARSEDIR(mode))
- return S_IFDIR;
- if (S_ISDIR(mode) || S_ISGITLINK(mode))
- return S_IFGITLINK;
- return S_IFREG | ce_permissions(mode);
-}
static inline unsigned int ce_mode_from_stat(const struct cache_entry *ce,
unsigned int mode)
{
@@ -282,15 +152,14 @@ static inline int ce_to_dtype(const struct cache_entry *ce)
else
return DT_UNKNOWN;
}
-static inline unsigned int canon_mode(unsigned int mode)
+
+static inline int ce_path_match(struct index_state *istate,
+ const struct cache_entry *ce,
+ const struct pathspec *pathspec,
+ char *seen)
{
- if (S_ISREG(mode))
- return S_IFREG | ce_permissions(mode);
- if (S_ISLNK(mode))
- return S_IFLNK;
- if (S_ISDIR(mode))
- return S_IFDIR;
- return S_IFGITLINK;
+ return match_pathspec(istate, pathspec, ce->name, ce_namelen(ce), 0, seen,
+ S_ISDIR(ce->ce_mode) || S_ISGITLINK(ce->ce_mode));
}
#define cache_entry_size(len) (offsetof(struct cache_entry,name) + (len) + 1)
@@ -360,6 +229,22 @@ struct index_state {
struct pattern_list *sparse_checkout_patterns;
};
+/**
+ * A "struct index_state istate" must be initialized with
+ * INDEX_STATE_INIT or the corresponding index_state_init().
+ *
+ * If the variable won't be used again, use release_index() to free()
+ * its resources. If it needs to be used again use discard_index(),
+ * which does the same thing, but will use use index_state_init() at
+ * the end. The discard_index() will use its own "istate->repo" as the
+ * "r" argument to index_state_init() in that case.
+ */
+#define INDEX_STATE_INIT(r) { \
+ .repo = (r), \
+}
+void index_state_init(struct index_state *istate, struct repository *r);
+void release_index(struct index_state *istate);
+
/* Name hashing */
int test_lazy_init_name_hash(struct index_state *istate, int try_threaded);
void add_name_hash(struct index_state *istate, struct cache_entry *ce);
@@ -427,244 +312,16 @@ void validate_cache_entries(const struct index_state *istate);
/*
* Bulk prefetch all missing cache entries that are not GITLINKs and that match
* the given predicate. This function should only be called if
- * has_promisor_remote() returns true.
+ * repo_has_promisor_remote() returns true.
*/
typedef int (*must_prefetch_predicate)(const struct cache_entry *);
void prefetch_cache_entries(const struct index_state *istate,
must_prefetch_predicate must_prefetch);
-#ifdef USE_THE_INDEX_COMPATIBILITY_MACROS
+#ifdef USE_THE_INDEX_VARIABLE
extern struct index_state the_index;
-
-#define active_cache (the_index.cache)
-#define active_nr (the_index.cache_nr)
-#define active_alloc (the_index.cache_alloc)
-#define active_cache_changed (the_index.cache_changed)
-#define active_cache_tree (the_index.cache_tree)
-
-#define read_cache() repo_read_index(the_repository)
-#define read_cache_from(path) read_index_from(&the_index, (path), (get_git_dir()))
-#define read_cache_preload(pathspec) repo_read_index_preload(the_repository, (pathspec), 0)
-#define is_cache_unborn() is_index_unborn(&the_index)
-#define read_cache_unmerged() repo_read_index_unmerged(the_repository)
-#define discard_cache() discard_index(&the_index)
-#define unmerged_cache() unmerged_index(&the_index)
-#define cache_name_pos(name, namelen) index_name_pos(&the_index,(name),(namelen))
-#define add_cache_entry(ce, option) add_index_entry(&the_index, (ce), (option))
-#define rename_cache_entry_at(pos, new_name) rename_index_entry_at(&the_index, (pos), (new_name))
-#define remove_cache_entry_at(pos) remove_index_entry_at(&the_index, (pos))
-#define remove_file_from_cache(path) remove_file_from_index(&the_index, (path))
-#define add_to_cache(path, st, flags) add_to_index(&the_index, (path), (st), (flags))
-#define add_file_to_cache(path, flags) add_file_to_index(&the_index, (path), (flags))
-#define chmod_cache_entry(ce, flip) chmod_index_entry(&the_index, (ce), (flip))
-#define refresh_cache(flags) refresh_index(&the_index, (flags), NULL, NULL, NULL)
-#define refresh_and_write_cache(refresh_flags, write_flags, gentle) repo_refresh_and_write_index(the_repository, (refresh_flags), (write_flags), (gentle), NULL, NULL, NULL)
-#define ce_match_stat(ce, st, options) ie_match_stat(&the_index, (ce), (st), (options))
-#define ce_modified(ce, st, options) ie_modified(&the_index, (ce), (st), (options))
-#define cache_dir_exists(name, namelen) index_dir_exists(&the_index, (name), (namelen))
-#define cache_file_exists(name, namelen, igncase) index_file_exists(&the_index, (name), (namelen), (igncase))
-#define cache_name_is_other(name, namelen) index_name_is_other(&the_index, (name), (namelen))
-#define resolve_undo_clear() resolve_undo_clear_index(&the_index)
-#define unmerge_cache_entry_at(at) unmerge_index_entry_at(&the_index, at)
-#define unmerge_cache(pathspec) unmerge_index(&the_index, pathspec)
-#define read_blob_data_from_cache(path, sz) read_blob_data_from_index(&the_index, (path), (sz))
-#define hold_locked_index(lock_file, flags) repo_hold_locked_index(the_repository, (lock_file), (flags))
#endif
-#define TYPE_BITS 3
-
-/*
- * Values in this enum (except those outside the 3 bit range) are part
- * of pack file format. See gitformat-pack(5) for more information.
- */
-enum object_type {
- OBJ_BAD = -1,
- OBJ_NONE = 0,
- OBJ_COMMIT = 1,
- OBJ_TREE = 2,
- OBJ_BLOB = 3,
- OBJ_TAG = 4,
- /* 5 for future expansion */
- OBJ_OFS_DELTA = 6,
- OBJ_REF_DELTA = 7,
- OBJ_ANY,
- OBJ_MAX
-};
-
-static inline enum object_type object_type(unsigned int mode)
-{
- return S_ISDIR(mode) ? OBJ_TREE :
- S_ISGITLINK(mode) ? OBJ_COMMIT :
- OBJ_BLOB;
-}
-
-/* Double-check local_repo_env below if you add to this list. */
-#define GIT_DIR_ENVIRONMENT "GIT_DIR"
-#define GIT_COMMON_DIR_ENVIRONMENT "GIT_COMMON_DIR"
-#define GIT_NAMESPACE_ENVIRONMENT "GIT_NAMESPACE"
-#define GIT_WORK_TREE_ENVIRONMENT "GIT_WORK_TREE"
-#define GIT_PREFIX_ENVIRONMENT "GIT_PREFIX"
-#define GIT_SUPER_PREFIX_ENVIRONMENT "GIT_INTERNAL_SUPER_PREFIX"
-#define DEFAULT_GIT_DIR_ENVIRONMENT ".git"
-#define DB_ENVIRONMENT "GIT_OBJECT_DIRECTORY"
-#define INDEX_ENVIRONMENT "GIT_INDEX_FILE"
-#define GRAFT_ENVIRONMENT "GIT_GRAFT_FILE"
-#define GIT_SHALLOW_FILE_ENVIRONMENT "GIT_SHALLOW_FILE"
-#define TEMPLATE_DIR_ENVIRONMENT "GIT_TEMPLATE_DIR"
-#define CONFIG_ENVIRONMENT "GIT_CONFIG"
-#define CONFIG_DATA_ENVIRONMENT "GIT_CONFIG_PARAMETERS"
-#define CONFIG_COUNT_ENVIRONMENT "GIT_CONFIG_COUNT"
-#define EXEC_PATH_ENVIRONMENT "GIT_EXEC_PATH"
-#define CEILING_DIRECTORIES_ENVIRONMENT "GIT_CEILING_DIRECTORIES"
-#define NO_REPLACE_OBJECTS_ENVIRONMENT "GIT_NO_REPLACE_OBJECTS"
-#define GIT_REPLACE_REF_BASE_ENVIRONMENT "GIT_REPLACE_REF_BASE"
-#define GITATTRIBUTES_FILE ".gitattributes"
-#define INFOATTRIBUTES_FILE "info/attributes"
-#define ATTRIBUTE_MACRO_PREFIX "[attr]"
-#define GITMODULES_FILE ".gitmodules"
-#define GITMODULES_INDEX ":.gitmodules"
-#define GITMODULES_HEAD "HEAD:.gitmodules"
-#define GIT_NOTES_REF_ENVIRONMENT "GIT_NOTES_REF"
-#define GIT_NOTES_DEFAULT_REF "refs/notes/commits"
-#define GIT_NOTES_DISPLAY_REF_ENVIRONMENT "GIT_NOTES_DISPLAY_REF"
-#define GIT_NOTES_REWRITE_REF_ENVIRONMENT "GIT_NOTES_REWRITE_REF"
-#define GIT_NOTES_REWRITE_MODE_ENVIRONMENT "GIT_NOTES_REWRITE_MODE"
-#define GIT_LITERAL_PATHSPECS_ENVIRONMENT "GIT_LITERAL_PATHSPECS"
-#define GIT_GLOB_PATHSPECS_ENVIRONMENT "GIT_GLOB_PATHSPECS"
-#define GIT_NOGLOB_PATHSPECS_ENVIRONMENT "GIT_NOGLOB_PATHSPECS"
-#define GIT_ICASE_PATHSPECS_ENVIRONMENT "GIT_ICASE_PATHSPECS"
-#define GIT_QUARANTINE_ENVIRONMENT "GIT_QUARANTINE_PATH"
-#define GIT_OPTIONAL_LOCKS_ENVIRONMENT "GIT_OPTIONAL_LOCKS"
-#define GIT_TEXT_DOMAIN_DIR_ENVIRONMENT "GIT_TEXTDOMAINDIR"
-
-/*
- * Environment variable used in handshaking the wire protocol.
- * Contains a colon ':' separated list of keys with optional values
- * 'key[=value]'. Presence of unknown keys and values must be
- * ignored.
- */
-#define GIT_PROTOCOL_ENVIRONMENT "GIT_PROTOCOL"
-/* HTTP header used to handshake the wire protocol */
-#define GIT_PROTOCOL_HEADER "Git-Protocol"
-
-/*
- * This environment variable is expected to contain a boolean indicating
- * whether we should or should not treat:
- *
- * GIT_DIR=foo.git git ...
- *
- * as if GIT_WORK_TREE=. was given. It's not expected that users will make use
- * of this, but we use it internally to communicate to sub-processes that we
- * are in a bare repo. If not set, defaults to true.
- */
-#define GIT_IMPLICIT_WORK_TREE_ENVIRONMENT "GIT_IMPLICIT_WORK_TREE"
-
-/*
- * Repository-local GIT_* environment variables; these will be cleared
- * when git spawns a sub-process that runs inside another repository.
- * The array is NULL-terminated, which makes it easy to pass in the "env"
- * parameter of a run-command invocation, or to do a simple walk.
- */
-extern const char * const local_repo_env[];
-
-void setup_git_env(const char *git_dir);
-
-/*
- * Returns true iff we have a configured git repository (either via
- * setup_git_directory, or in the environment via $GIT_DIR).
- */
-int have_git_dir(void);
-
-extern int is_bare_repository_cfg;
-int is_bare_repository(void);
-int is_inside_git_dir(void);
-extern char *git_work_tree_cfg;
-int is_inside_work_tree(void);
-const char *get_git_dir(void);
-const char *get_git_common_dir(void);
-const char *get_object_directory(void);
-char *get_index_file(void);
-char *get_graft_file(struct repository *r);
-void set_git_dir(const char *path, int make_realpath);
-int get_common_dir_noenv(struct strbuf *sb, const char *gitdir);
-int get_common_dir(struct strbuf *sb, const char *gitdir);
-const char *get_git_namespace(void);
-const char *strip_namespace(const char *namespaced_ref);
-const char *get_super_prefix(void);
-const char *get_git_work_tree(void);
-
-/*
- * Return true if the given path is a git directory; note that this _just_
- * looks at the directory itself. If you want to know whether "foo/.git"
- * is a repository, you must feed that path, not just "foo".
- */
-int is_git_directory(const char *path);
-
-/*
- * Return 1 if the given path is the root of a git repository or
- * submodule, else 0. Will not return 1 for bare repositories with the
- * exception of creating a bare repository in "foo/.git" and calling
- * is_git_repository("foo").
- *
- * If we run into read errors, we err on the side of saying "yes, it is",
- * as we usually consider sub-repos precious, and would prefer to err on the
- * side of not disrupting or deleting them.
- */
-int is_nonbare_repository_dir(struct strbuf *path);
-
-#define READ_GITFILE_ERR_STAT_FAILED 1
-#define READ_GITFILE_ERR_NOT_A_FILE 2
-#define READ_GITFILE_ERR_OPEN_FAILED 3
-#define READ_GITFILE_ERR_READ_FAILED 4
-#define READ_GITFILE_ERR_INVALID_FORMAT 5
-#define READ_GITFILE_ERR_NO_PATH 6
-#define READ_GITFILE_ERR_NOT_A_REPO 7
-#define READ_GITFILE_ERR_TOO_LARGE 8
-void read_gitfile_error_die(int error_code, const char *path, const char *dir);
-const char *read_gitfile_gently(const char *path, int *return_error_code);
-#define read_gitfile(path) read_gitfile_gently((path), NULL)
-const char *resolve_gitdir_gently(const char *suspect, int *return_error_code);
-#define resolve_gitdir(path) resolve_gitdir_gently((path), NULL)
-
-void set_git_work_tree(const char *tree);
-
-#define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"
-
-void setup_work_tree(void);
-/*
- * Find the commondir and gitdir of the repository that contains the current
- * working directory, without changing the working directory or other global
- * state. The result is appended to commondir and gitdir. If the discovered
- * gitdir does not correspond to a worktree, then 'commondir' and 'gitdir' will
- * both have the same result appended to the buffer. The return value is
- * either 0 upon success and non-zero if no repository was found.
- */
-int discover_git_directory(struct strbuf *commondir,
- struct strbuf *gitdir);
-const char *setup_git_directory_gently(int *);
-const char *setup_git_directory(void);
-char *prefix_path(const char *prefix, int len, const char *path);
-char *prefix_path_gently(const char *prefix, int len, int *remaining, const char *path);
-
-/*
- * Concatenate "prefix" (if len is non-zero) and "path", with no
- * connecting characters (so "prefix" should end with a "/").
- * Unlike prefix_path, this should be used if the named file does
- * not have to interact with index entry; i.e. name of a random file
- * on the filesystem.
- *
- * The return value is always a newly allocated string (even if the
- * prefix was empty).
- */
-char *prefix_filename(const char *prefix, const char *path);
-
-int check_filename(const char *prefix, const char *name);
-void verify_filename(const char *prefix,
- const char *name,
- int diagnose_misspelt_rev);
-void verify_non_filename(const char *prefix, const char *name);
-int path_inside_repo(const char *prefix, const char *path);
-
#define INIT_DB_QUIET 0x0001
#define INIT_DB_EXIST_OK 0x0002
@@ -673,84 +330,6 @@ int init_db(const char *git_dir, const char *real_git_dir,
const char *initial_branch, unsigned int flags);
void initialize_repository_version(int hash_algo, int reinit);
-void sanitize_stdfds(void);
-int daemonize(void);
-
-#define alloc_nr(x) (((x)+16)*3/2)
-
-/**
- * Dynamically growing an array using realloc() is error prone and boring.
- *
- * Define your array with:
- *
- * - a pointer (`item`) that points at the array, initialized to `NULL`
- * (although please name the variable based on its contents, not on its
- * type);
- *
- * - an integer variable (`alloc`) that keeps track of how big the current
- * allocation is, initialized to `0`;
- *
- * - another integer variable (`nr`) to keep track of how many elements the
- * array currently has, initialized to `0`.
- *
- * Then before adding `n`th element to the item, call `ALLOC_GROW(item, n,
- * alloc)`. This ensures that the array can hold at least `n` elements by
- * calling `realloc(3)` and adjusting `alloc` variable.
- *
- * ------------
- * sometype *item;
- * size_t nr;
- * size_t alloc
- *
- * for (i = 0; i < nr; i++)
- * if (we like item[i] already)
- * return;
- *
- * // we did not like any existing one, so add one
- * ALLOC_GROW(item, nr + 1, alloc);
- * item[nr++] = value you like;
- * ------------
- *
- * You are responsible for updating the `nr` variable.
- *
- * If you need to specify the number of elements to allocate explicitly
- * then use the macro `REALLOC_ARRAY(item, alloc)` instead of `ALLOC_GROW`.
- *
- * Consider using ALLOC_GROW_BY instead of ALLOC_GROW as it has some
- * added niceties.
- *
- * DO NOT USE any expression with side-effect for 'x', 'nr', or 'alloc'.
- */
-#define ALLOC_GROW(x, nr, alloc) \
- do { \
- if ((nr) > alloc) { \
- if (alloc_nr(alloc) < (nr)) \
- alloc = (nr); \
- else \
- alloc = alloc_nr(alloc); \
- REALLOC_ARRAY(x, alloc); \
- } \
- } while (0)
-
-/*
- * Similar to ALLOC_GROW but handles updating of the nr value and
- * zeroing the bytes of the newly-grown array elements.
- *
- * DO NOT USE any expression with side-effect for any of the
- * arguments.
- */
-#define ALLOC_GROW_BY(x, nr, increase, alloc) \
- do { \
- if (increase) { \
- size_t new_nr = nr + (increase); \
- if (new_nr < nr) \
- BUG("negative growth in ALLOC_GROW_BY"); \
- ALLOC_GROW(x, new_nr, alloc); \
- memset((x) + nr, 0, sizeof(*(x)) * (increase)); \
- nr = new_nr; \
- } \
- } while (0)
-
/* Initialize and use the cache information */
struct lock_file;
void preload_index(struct index_state *index,
@@ -789,7 +368,7 @@ void ensure_full_index(struct index_state *istate);
*/
int write_locked_index(struct index_state *, struct lock_file *lock, unsigned flags);
-int discard_index(struct index_state *);
+void discard_index(struct index_state *);
void move_index_extensions(struct index_state *dst, struct index_state *src);
int unmerged_index(const struct index_state *);
@@ -917,13 +496,6 @@ int has_racy_timestamp(struct index_state *istate);
int ie_match_stat(struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
int ie_modified(struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
-#define HASH_WRITE_OBJECT 1
-#define HASH_FORMAT_CHECK 2
-#define HASH_RENORMALIZE 4
-#define HASH_SILENT 8
-int index_fd(struct index_state *istate, struct object_id *oid, int fd, struct stat *st, enum object_type type, const char *path, unsigned flags);
-int index_path(struct index_state *istate, struct object_id *oid, const char *path, struct stat *st, unsigned flags);
-
/*
* Record to sd the data from st that we use to check whether a file
* might have changed.
@@ -975,238 +547,6 @@ void set_alternate_index_output(const char *);
extern int verify_index_checksum;
extern int verify_ce_order;
-/* Environment bits from configuration mechanism */
-extern int trust_executable_bit;
-extern int trust_ctime;
-extern int check_stat;
-extern int quote_path_fully;
-extern int has_symlinks;
-extern int minimum_abbrev, default_abbrev;
-extern int ignore_case;
-extern int assume_unchanged;
-extern int prefer_symlink_refs;
-extern int warn_ambiguous_refs;
-extern int warn_on_object_refname_ambiguity;
-extern char *apply_default_whitespace;
-extern char *apply_default_ignorewhitespace;
-extern const char *git_attributes_file;
-extern const char *git_hooks_path;
-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;
-
-/*
- * Accessors for the core.sharedrepository config which lazy-load the value
- * from the config (if not already set). The "reset" function can be
- * used to unset "set" or cached value, meaning that the value will be loaded
- * fresh from the config file on the next call to get_shared_repository().
- */
-void set_shared_repository(int value);
-int get_shared_repository(void);
-void reset_shared_repository(void);
-
-/*
- * Do replace refs need to be checked this run? This variable is
- * initialized to true unless --no-replace-object is used or
- * $GIT_NO_REPLACE_OBJECTS is set, but is set to false by some
- * commands that do not want replace references to be active.
- */
-extern int read_replace_refs;
-
-/*
- * These values are used to help identify parts of a repository to fsync.
- * FSYNC_COMPONENT_NONE identifies data that will not be a persistent part of the
- * repository and so shouldn't be fsynced.
- */
-enum fsync_component {
- FSYNC_COMPONENT_NONE,
- FSYNC_COMPONENT_LOOSE_OBJECT = 1 << 0,
- FSYNC_COMPONENT_PACK = 1 << 1,
- FSYNC_COMPONENT_PACK_METADATA = 1 << 2,
- FSYNC_COMPONENT_COMMIT_GRAPH = 1 << 3,
- FSYNC_COMPONENT_INDEX = 1 << 4,
- FSYNC_COMPONENT_REFERENCE = 1 << 5,
-};
-
-#define FSYNC_COMPONENTS_OBJECTS (FSYNC_COMPONENT_LOOSE_OBJECT | \
- FSYNC_COMPONENT_PACK)
-
-#define FSYNC_COMPONENTS_DERIVED_METADATA (FSYNC_COMPONENT_PACK_METADATA | \
- FSYNC_COMPONENT_COMMIT_GRAPH)
-
-#define FSYNC_COMPONENTS_DEFAULT ((FSYNC_COMPONENTS_OBJECTS | \
- FSYNC_COMPONENTS_DERIVED_METADATA) & \
- ~FSYNC_COMPONENT_LOOSE_OBJECT)
-
-#define FSYNC_COMPONENTS_COMMITTED (FSYNC_COMPONENTS_OBJECTS | \
- FSYNC_COMPONENT_REFERENCE)
-
-#define FSYNC_COMPONENTS_ADDED (FSYNC_COMPONENTS_COMMITTED | \
- FSYNC_COMPONENT_INDEX)
-
-#define FSYNC_COMPONENTS_ALL (FSYNC_COMPONENT_LOOSE_OBJECT | \
- FSYNC_COMPONENT_PACK | \
- FSYNC_COMPONENT_PACK_METADATA | \
- FSYNC_COMPONENT_COMMIT_GRAPH | \
- FSYNC_COMPONENT_INDEX | \
- FSYNC_COMPONENT_REFERENCE)
-
-#ifndef FSYNC_COMPONENTS_PLATFORM_DEFAULT
-#define FSYNC_COMPONENTS_PLATFORM_DEFAULT FSYNC_COMPONENTS_DEFAULT
-#endif
-
-/*
- * A bitmask indicating which components of the repo should be fsynced.
- */
-extern enum fsync_component fsync_components;
-extern int fsync_object_files;
-extern int use_fsync;
-
-enum fsync_method {
- FSYNC_METHOD_FSYNC,
- FSYNC_METHOD_WRITEOUT_ONLY,
- FSYNC_METHOD_BATCH,
-};
-
-extern enum fsync_method fsync_method;
-extern int core_preload_index;
-extern int precomposed_unicode;
-extern int protect_hfs;
-extern int protect_ntfs;
-
-extern int core_apply_sparse_checkout;
-extern int core_sparse_checkout_cone;
-extern int sparse_expect_files_outside_of_patterns;
-
-/*
- * Returns the boolean value of $GIT_OPTIONAL_LOCKS (or the default value).
- */
-int use_optional_locks(void);
-
-/*
- * The character that begins a commented line in user-editable file
- * that is subject to stripspace.
- */
-extern char comment_line_char;
-extern int auto_comment_line_char;
-
-enum log_refs_config {
- LOG_REFS_UNSET = -1,
- LOG_REFS_NONE = 0,
- LOG_REFS_NORMAL,
- LOG_REFS_ALWAYS
-};
-extern enum log_refs_config log_all_ref_updates;
-
-enum rebase_setup_type {
- AUTOREBASE_NEVER = 0,
- AUTOREBASE_LOCAL,
- AUTOREBASE_REMOTE,
- AUTOREBASE_ALWAYS
-};
-
-enum push_default_type {
- PUSH_DEFAULT_NOTHING = 0,
- PUSH_DEFAULT_MATCHING,
- PUSH_DEFAULT_SIMPLE,
- PUSH_DEFAULT_UPSTREAM,
- PUSH_DEFAULT_CURRENT,
- PUSH_DEFAULT_UNSPECIFIED
-};
-
-extern enum rebase_setup_type autorebase;
-extern enum push_default_type push_default;
-
-enum object_creation_mode {
- OBJECT_CREATION_USES_HARDLINKS = 0,
- OBJECT_CREATION_USES_RENAMES = 1
-};
-
-extern enum object_creation_mode object_creation_mode;
-
-extern char *notes_ref_name;
-
-extern int grafts_replace_parents;
-
-/*
- * GIT_REPO_VERSION is the version we write by default. The
- * _READ variant is the highest number we know how to
- * handle.
- */
-#define GIT_REPO_VERSION 0
-#define GIT_REPO_VERSION_READ 1
-extern int repository_format_precious_objects;
-extern int repository_format_worktree_config;
-
-/*
- * You _have_ to initialize a `struct repository_format` using
- * `= REPOSITORY_FORMAT_INIT` before calling `read_repository_format()`.
- */
-struct repository_format {
- int version;
- int precious_objects;
- char *partial_clone; /* value of extensions.partialclone */
- int worktree_config;
- int is_bare;
- int hash_algo;
- int sparse_index;
- char *work_tree;
- struct string_list unknown_extensions;
- struct string_list v1_only_extensions;
-};
-
-/*
- * Always use this to initialize a `struct repository_format`
- * to a well-defined, default state before calling
- * `read_repository()`.
- */
-#define REPOSITORY_FORMAT_INIT \
-{ \
- .version = -1, \
- .is_bare = -1, \
- .hash_algo = GIT_HASH_SHA1, \
- .unknown_extensions = STRING_LIST_INIT_DUP, \
- .v1_only_extensions = STRING_LIST_INIT_DUP, \
-}
-
-/*
- * Read the repository format characteristics from the config file "path" into
- * "format" struct. Returns the numeric version. On error, or if no version is
- * found in the configuration, -1 is returned, format->version is set to -1,
- * and all other fields in the struct are set to the default configuration
- * (REPOSITORY_FORMAT_INIT). Always initialize the struct using
- * REPOSITORY_FORMAT_INIT before calling this function.
- */
-int read_repository_format(struct repository_format *format, const char *path);
-
-/*
- * Free the memory held onto by `format`, but not the struct itself.
- * (No need to use this after `read_repository_format()` fails.)
- */
-void clear_repository_format(struct repository_format *format);
-
-/*
- * Verify that the repository described by repository_format is something we
- * can read. If it is, return 0. Otherwise, return -1, and "err" will describe
- * any errors encountered.
- */
-int verify_repository_format(const struct repository_format *format,
- struct strbuf *err);
-
-/*
- * Check the repository format version in the path found in get_git_dir(),
- * and die if it is a version we don't understand. Generally one would
- * set_git_dir() before calling this, and use it only for "are we in a valid
- * repo?".
- *
- * If successful and fmt is not NULL, fill fmt with data.
- */
-void check_repository_format(struct repository_format *fmt);
-
#define MTIME_CHANGED 0x0001
#define CTIME_CHANGED 0x0002
#define OWNER_CHANGED 0x0004
@@ -1215,642 +555,7 @@ void check_repository_format(struct repository_format *fmt);
#define DATA_CHANGED 0x0020
#define TYPE_CHANGED 0x0040
-/*
- * Return an abbreviated sha1 unique within this repository's object database.
- * The result will be at least `len` characters long, and will be NUL
- * terminated.
- *
- * The non-`_r` version returns a static buffer which remains valid until 4
- * more calls to find_unique_abbrev are made.
- *
- * The `_r` variant writes to a buffer supplied by the caller, which must be at
- * least `GIT_MAX_HEXSZ + 1` bytes. The return value is the number of bytes
- * written (excluding the NUL terminator).
- *
- * Note that while this version avoids the static buffer, it is not fully
- * reentrant, as it calls into other non-reentrant git code.
- */
-const char *repo_find_unique_abbrev(struct repository *r, const struct object_id *oid, int len);
-#define find_unique_abbrev(oid, len) repo_find_unique_abbrev(the_repository, oid, len)
-int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len);
-#define find_unique_abbrev_r(hex, oid, len) repo_find_unique_abbrev_r(the_repository, hex, oid, len)
-
-/* set default permissions by passing mode arguments to open(2) */
-int git_mkstemps_mode(char *pattern, int suffix_len, int mode);
-int git_mkstemp_mode(char *pattern, int mode);
-
-/*
- * NOTE NOTE NOTE!!
- *
- * PERM_UMASK, OLD_PERM_GROUP and OLD_PERM_EVERYBODY enumerations must
- * not be changed. Old repositories have core.sharedrepository written in
- * numeric format, and therefore these values are preserved for compatibility
- * reasons.
- */
-enum sharedrepo {
- PERM_UMASK = 0,
- OLD_PERM_GROUP = 1,
- OLD_PERM_EVERYBODY = 2,
- PERM_GROUP = 0660,
- PERM_EVERYBODY = 0664
-};
-int git_config_perm(const char *var, const char *value);
-int adjust_shared_perm(const char *path);
-
-/*
- * Create the directory containing the named path, using care to be
- * somewhat safe against races. Return one of the scld_error values to
- * indicate success/failure. On error, set errno to describe the
- * problem.
- *
- * SCLD_VANISHED indicates that one of the ancestor directories of the
- * path existed at one point during the function call and then
- * suddenly vanished, probably because another process pruned the
- * directory while we were working. To be robust against this kind of
- * race, callers might want to try invoking the function again when it
- * returns SCLD_VANISHED.
- *
- * safe_create_leading_directories() temporarily changes path while it
- * is working but restores it before returning.
- * safe_create_leading_directories_const() doesn't modify path, even
- * temporarily. Both these variants adjust the permissions of the
- * created directories to honor core.sharedRepository, so they are best
- * suited for files inside the git dir. For working tree files, use
- * safe_create_leading_directories_no_share() instead, as it ignores
- * the core.sharedRepository setting.
- */
-enum scld_error {
- SCLD_OK = 0,
- SCLD_FAILED = -1,
- SCLD_PERMS = -2,
- SCLD_EXISTS = -3,
- SCLD_VANISHED = -4
-};
-enum scld_error safe_create_leading_directories(char *path);
-enum scld_error safe_create_leading_directories_const(const char *path);
-enum scld_error safe_create_leading_directories_no_share(char *path);
-
-int mkdir_in_gitdir(const char *path);
-char *interpolate_path(const char *path, int real_home);
-/* NEEDSWORK: remove this synonym once in-flight topics have migrated */
-#define expand_user_path interpolate_path
-const char *enter_repo(const char *path, int strict);
-static inline int is_absolute_path(const char *path)
-{
- return is_dir_sep(path[0]) || has_dos_drive_prefix(path);
-}
-int is_directory(const char *);
-char *strbuf_realpath(struct strbuf *resolved, const char *path,
- int die_on_error);
-char *strbuf_realpath_forgiving(struct strbuf *resolved, const char *path,
- int die_on_error);
-char *real_pathdup(const char *path, int die_on_error);
-const char *absolute_path(const char *path);
-char *absolute_pathdup(const char *path);
-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);
-int normalize_path_copy(char *dst, const char *src);
-int longest_ancestor_length(const char *path, struct string_list *prefixes);
-char *strip_path_suffix(const char *path, const char *suffix);
-int daemon_avoid_alias(const char *path);
-
-/*
- * These functions match their is_hfs_dotgit() counterparts; see utf8.h for
- * details.
- */
-int is_ntfs_dotgit(const char *name);
-int is_ntfs_dotgitmodules(const char *name);
-int is_ntfs_dotgitignore(const char *name);
-int is_ntfs_dotgitattributes(const char *name);
-int is_ntfs_dotmailmap(const char *name);
-
-/*
- * Returns true iff "str" could be confused as a command-line option when
- * passed to a sub-program like "ssh". Note that this has nothing to do with
- * shell-quoting, which should be handled separately; we're assuming here that
- * the string makes it verbatim to the sub-program.
- */
-int looks_like_command_line_option(const char *str);
-
-/**
- * Return a newly allocated string with the evaluation of
- * "$XDG_CONFIG_HOME/$subdir/$filename" if $XDG_CONFIG_HOME is non-empty, otherwise
- * "$HOME/.config/$subdir/$filename". Return NULL upon error.
- */
-char *xdg_config_home_for(const char *subdir, const char *filename);
-
-/**
- * Return a newly allocated string with the evaluation of
- * "$XDG_CONFIG_HOME/git/$filename" if $XDG_CONFIG_HOME is non-empty, otherwise
- * "$HOME/.config/git/$filename". Return NULL upon error.
- */
-char *xdg_config_home(const char *filename);
-
-/**
- * Return a newly allocated string with the evaluation of
- * "$XDG_CACHE_HOME/git/$filename" if $XDG_CACHE_HOME is non-empty, otherwise
- * "$HOME/.cache/git/$filename". Return NULL upon error.
- */
-char *xdg_cache_home(const char *filename);
-
-int git_open_cloexec(const char *name, int flags);
-#define git_open(name) git_open_cloexec(name, O_RDONLY)
-
-/**
- * unpack_loose_header() initializes the data stream needed to unpack
- * a loose object header.
- *
- * Returns:
- *
- * - ULHR_OK on success
- * - ULHR_BAD on error
- * - ULHR_TOO_LONG if the header was too long
- *
- * It will only parse up to MAX_HEADER_LEN bytes unless an optional
- * "hdrbuf" argument is non-NULL. This is intended for use with
- * OBJECT_INFO_ALLOW_UNKNOWN_TYPE to extract the bad type for (error)
- * reporting. The full header will be extracted to "hdrbuf" for use
- * with parse_loose_header(), ULHR_TOO_LONG will still be returned
- * from this function to indicate that the header was too long.
- */
-enum unpack_loose_header_result {
- ULHR_OK,
- ULHR_BAD,
- ULHR_TOO_LONG,
-};
-enum unpack_loose_header_result unpack_loose_header(git_zstream *stream,
- unsigned char *map,
- unsigned long mapsize,
- void *buffer,
- unsigned long bufsiz,
- struct strbuf *hdrbuf);
-
-/**
- * parse_loose_header() parses the starting "<type> <len>\0" of an
- * object. If it doesn't follow that format -1 is returned. To check
- * the validity of the <type> populate the "typep" in the "struct
- * object_info". It will be OBJ_BAD if the object type is unknown. The
- * parsed <len> can be retrieved via "oi->sizep", and from there
- * passed to unpack_loose_rest().
- */
-struct object_info;
-int parse_loose_header(const char *hdr, struct object_info *oi);
-
-/**
- * With in-core object data in "buf", rehash it to make sure the
- * object name actually matches "oid" to detect object corruption.
- *
- * A negative value indicates an error, usually that the OID is not
- * what we expected, but it might also indicate another error.
- */
-int check_object_signature(struct repository *r, const struct object_id *oid,
- void *map, unsigned long size,
- enum object_type type);
-
-/**
- * A streaming version of check_object_signature().
- * Try reading the object named with "oid" using
- * the streaming interface and rehash it to do the same.
- */
-int stream_object_signature(struct repository *r, const struct object_id *oid);
-
-int finalize_object_file(const char *tmpfile, const char *filename);
-
-/* Helper to check and "touch" a file */
-int check_and_freshen_file(const char *fn, int freshen);
-
-extern const signed char hexval_table[256];
-static inline unsigned int hexval(unsigned char c)
-{
- return hexval_table[c];
-}
-
-/*
- * Convert two consecutive hexadecimal digits into a char. Return a
- * negative value on error. Don't run over the end of short strings.
- */
-static inline int hex2chr(const char *s)
-{
- unsigned int val = hexval(s[0]);
- return (val & ~0xf) ? val : (val << 4) | hexval(s[1]);
-}
-
-/* Convert to/from hex/sha1 representation */
-#define MINIMUM_ABBREV minimum_abbrev
-#define DEFAULT_ABBREV default_abbrev
-
-/* used when the code does not know or care what the default abbrev is */
-#define FALLBACK_DEFAULT_ABBREV 7
-
-struct object_context {
- unsigned short mode;
- /*
- * symlink_path is only used by get_tree_entry_follow_symlinks,
- * and only for symlinks that point outside the repository.
- */
- struct strbuf symlink_path;
- /*
- * If GET_OID_RECORD_PATH is set, this will record path (if any)
- * found when resolving the name. The caller is responsible for
- * releasing the memory.
- */
- char *path;
-};
-
-#define GET_OID_QUIETLY 01
-#define GET_OID_COMMIT 02
-#define GET_OID_COMMITTISH 04
-#define GET_OID_TREE 010
-#define GET_OID_TREEISH 020
-#define GET_OID_BLOB 040
-#define GET_OID_FOLLOW_SYMLINKS 0100
-#define GET_OID_RECORD_PATH 0200
-#define GET_OID_ONLY_TO_DIE 04000
-#define GET_OID_REQUIRE_PATH 010000
-
-#define GET_OID_DISAMBIGUATORS \
- (GET_OID_COMMIT | GET_OID_COMMITTISH | \
- GET_OID_TREE | GET_OID_TREEISH | \
- GET_OID_BLOB)
-
-enum get_oid_result {
- FOUND = 0,
- MISSING_OBJECT = -1, /* The requested object is missing */
- SHORT_NAME_AMBIGUOUS = -2,
- /* The following only apply when symlinks are followed */
- DANGLING_SYMLINK = -4, /*
- * The initial symlink is there, but
- * (transitively) points to a missing
- * in-tree file
- */
- SYMLINK_LOOP = -5,
- NOT_DIR = -6, /*
- * Somewhere along the symlink chain, a path is
- * requested which contains a file as a
- * non-final element.
- */
-};
-
-int repo_get_oid(struct repository *r, const char *str, struct object_id *oid);
-__attribute__((format (printf, 2, 3)))
-int get_oidf(struct object_id *oid, const char *fmt, ...);
-int repo_get_oid_commit(struct repository *r, const char *str, struct object_id *oid);
-int repo_get_oid_committish(struct repository *r, const char *str, struct object_id *oid);
-int repo_get_oid_tree(struct repository *r, const char *str, struct object_id *oid);
-int repo_get_oid_treeish(struct repository *r, const char *str, struct object_id *oid);
-int repo_get_oid_blob(struct repository *r, const char *str, struct object_id *oid);
-int repo_get_oid_mb(struct repository *r, const char *str, struct object_id *oid);
-void maybe_die_on_misspelt_object_name(struct repository *repo,
- const char *name,
- const char *prefix);
-enum get_oid_result get_oid_with_context(struct repository *repo, const char *str,
- unsigned flags, struct object_id *oid,
- struct object_context *oc);
-
-#define get_oid(str, oid) repo_get_oid(the_repository, str, oid)
-#define get_oid_commit(str, oid) repo_get_oid_commit(the_repository, str, oid)
-#define get_oid_committish(str, oid) repo_get_oid_committish(the_repository, str, oid)
-#define get_oid_tree(str, oid) repo_get_oid_tree(the_repository, str, oid)
-#define get_oid_treeish(str, oid) repo_get_oid_treeish(the_repository, str, oid)
-#define get_oid_blob(str, oid) repo_get_oid_blob(the_repository, str, oid)
-#define get_oid_mb(str, oid) repo_get_oid_mb(the_repository, str, oid)
-
-typedef int each_abbrev_fn(const struct object_id *oid, void *);
-int repo_for_each_abbrev(struct repository *r, const char *prefix, each_abbrev_fn, void *);
-#define for_each_abbrev(prefix, fn, data) repo_for_each_abbrev(the_repository, prefix, fn, data)
-
-int set_disambiguate_hint_config(const char *var, const char *value);
-
-/*
- * Try to read a SHA1 in hexadecimal format from the 40 characters
- * starting at hex. Write the 20-byte result to sha1 in binary form.
- * Return 0 on success. Reading stops if a NUL is encountered in the
- * input, so it is safe to pass this function an arbitrary
- * null-terminated string.
- */
-int get_sha1_hex(const char *hex, unsigned char *sha1);
-int get_oid_hex(const char *hex, struct object_id *sha1);
-
-/* Like get_oid_hex, but for an arbitrary hash algorithm. */
-int get_oid_hex_algop(const char *hex, struct object_id *oid, const struct git_hash_algo *algop);
-
-/*
- * Read `len` pairs of hexadecimal digits from `hex` and write the
- * values to `binary` as `len` bytes. Return 0 on success, or -1 if
- * the input does not consist of hex digits).
- */
-int hex_to_bytes(unsigned char *binary, const char *hex, size_t len);
-
-/*
- * Convert a binary hash in "unsigned char []" or an object name in
- * "struct object_id *" to its hex equivalent. The `_r` variant is reentrant,
- * and writes the NUL-terminated output to the buffer `out`, which must be at
- * least `GIT_MAX_HEXSZ + 1` bytes, and returns a pointer to out for
- * convenience.
- *
- * The non-`_r` variant returns a static buffer, but uses a ring of 4
- * buffers, making it safe to make multiple calls for a single statement, like:
- *
- * printf("%s -> %s", hash_to_hex(one), hash_to_hex(two));
- * printf("%s -> %s", oid_to_hex(one), oid_to_hex(two));
- */
-char *hash_to_hex_algop_r(char *buffer, const unsigned char *hash, const struct git_hash_algo *);
-char *oid_to_hex_r(char *out, const struct object_id *oid);
-char *hash_to_hex_algop(const unsigned char *hash, const struct git_hash_algo *); /* static buffer result! */
-char *hash_to_hex(const unsigned char *hash); /* same static buffer */
-char *oid_to_hex(const struct object_id *oid); /* same static buffer */
-
-/*
- * Parse a 40-character hexadecimal object ID starting from hex, updating the
- * pointer specified by end when parsing stops. The resulting object ID is
- * stored in oid. Returns 0 on success. Parsing will stop on the first NUL or
- * other invalid character. end is only updated on success; otherwise, it is
- * unmodified.
- */
-int parse_oid_hex(const char *hex, struct object_id *oid, const char **end);
-
-/* Like parse_oid_hex, but for an arbitrary hash algorithm. */
-int parse_oid_hex_algop(const char *hex, struct object_id *oid, const char **end,
- const struct git_hash_algo *algo);
-
-
-/*
- * These functions work like get_oid_hex and parse_oid_hex, but they will parse
- * a hex value for any algorithm. The algorithm is detected based on the length
- * and the algorithm in use is returned. If this is not a hex object ID in any
- * algorithm, returns GIT_HASH_UNKNOWN.
- */
-int get_oid_hex_any(const char *hex, struct object_id *oid);
-int parse_oid_hex_any(const char *hex, struct object_id *oid, const char **end);
-
-/*
- * This reads short-hand syntax that not only evaluates to a commit
- * object name, but also can act as if the end user spelled the name
- * of the branch from the command line.
- *
- * - "@{-N}" finds the name of the Nth previous branch we were on, and
- * places the name of the branch in the given buf and returns the
- * number of characters parsed if successful.
- *
- * - "<branch>@{upstream}" finds the name of the other ref that
- * <branch> is configured to merge with (missing <branch> defaults
- * to the current branch), and places the name of the branch in the
- * given buf and returns the number of characters parsed if
- * successful.
- *
- * If the input is not of the accepted format, it returns a negative
- * number to signal an error.
- *
- * If the input was ok but there are not N branch switches in the
- * reflog, it returns 0.
- */
-#define INTERPRET_BRANCH_LOCAL (1<<0)
-#define INTERPRET_BRANCH_REMOTE (1<<1)
-#define INTERPRET_BRANCH_HEAD (1<<2)
-struct interpret_branch_name_options {
- /*
- * If "allowed" is non-zero, it is a treated as a bitfield of allowable
- * expansions: local branches ("refs/heads/"), remote branches
- * ("refs/remotes/"), or "HEAD". If no "allowed" bits are set, any expansion is
- * allowed, even ones to refs outside of those namespaces.
- */
- unsigned allowed;
-
- /*
- * If ^{upstream} or ^{push} (or equivalent) is requested, and the
- * branch in question does not have such a reference, return -1 instead
- * of die()-ing.
- */
- unsigned nonfatal_dangling_mark : 1;
-};
-int repo_interpret_branch_name(struct repository *r,
- const char *str, int len,
- struct strbuf *buf,
- const struct interpret_branch_name_options *options);
-#define interpret_branch_name(str, len, buf, options) \
- repo_interpret_branch_name(the_repository, str, len, buf, options)
-
-int validate_headref(const char *ref);
-
-int base_name_compare(const char *name1, int len1, int mode1, const char *name2, int len2, int mode2);
-int df_name_compare(const char *name1, int len1, int mode1, const char *name2, int len2, int mode2);
-int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);
-int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);
-
-void *read_object_with_reference(struct repository *r,
- const struct object_id *oid,
- enum object_type required_type,
- unsigned long *size,
- struct object_id *oid_ret);
-
-struct object *repo_peel_to_type(struct repository *r,
- const char *name, int namelen,
- struct object *o, enum object_type);
-#define peel_to_type(name, namelen, obj, type) \
- repo_peel_to_type(the_repository, name, namelen, obj, type)
-
-#define IDENT_STRICT 1
-#define IDENT_NO_DATE 2
-#define IDENT_NO_NAME 4
-
-enum want_ident {
- WANT_BLANK_IDENT,
- WANT_AUTHOR_IDENT,
- WANT_COMMITTER_IDENT
-};
-
-const char *git_author_info(int);
-const char *git_committer_info(int);
-const char *fmt_ident(const char *name, const char *email,
- enum want_ident whose_ident,
- const char *date_str, int);
-const char *fmt_name(enum want_ident);
-const char *ident_default_name(void);
-const char *ident_default_email(void);
-const char *git_editor(void);
-const char *git_sequence_editor(void);
-const char *git_pager(int stdout_is_tty);
-int is_terminal_dumb(void);
-int git_ident_config(const char *, const char *, void *);
-/*
- * Prepare an ident to fall back on if the user didn't configure it.
- */
-void prepare_fallback_ident(const char *name, const char *email);
-void reset_ident_date(void);
-
-struct ident_split {
- const char *name_begin;
- const char *name_end;
- const char *mail_begin;
- const char *mail_end;
- const char *date_begin;
- const char *date_end;
- const char *tz_begin;
- const char *tz_end;
-};
-/*
- * Signals an success with 0, but time part of the result may be NULL
- * if the input lacks timestamp and zone
- */
-int split_ident_line(struct ident_split *, const char *, int);
-
-/*
- * Given a commit or tag object buffer and the commit or tag headers, replaces
- * the idents in the headers with their canonical versions using the mailmap mechanism.
- */
-void apply_mailmap_to_header(struct strbuf *, const char **, struct string_list *);
-
-/*
- * Compare split idents for equality or strict ordering. Note that we
- * compare only the ident part of the line, ignoring any timestamp.
- *
- * Because there are two fields, we must choose one as the primary key; we
- * currently arbitrarily pick the email.
- */
-int ident_cmp(const struct ident_split *, const struct ident_split *);
-
-struct cache_def {
- struct strbuf path;
- int flags;
- int track_flags;
- int prefix_len_stat_func;
-};
-#define CACHE_DEF_INIT { \
- .path = STRBUF_INIT, \
-}
-static inline void cache_def_clear(struct cache_def *cache)
-{
- strbuf_release(&cache->path);
-}
-
-int has_symlink_leading_path(const char *name, int len);
-int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);
-int check_leading_path(const char *name, int len, int warn_on_lstat_err);
-int has_dirs_only_path(const char *name, int len, int prefix_len);
-void invalidate_lstat_cache(void);
-void schedule_dir_for_removal(const char *name, int len);
-void remove_scheduled_dirs(void);
-
-struct pack_window {
- struct pack_window *next;
- unsigned char *base;
- off_t offset;
- size_t len;
- unsigned int last_used;
- unsigned int inuse_cnt;
-};
-
-struct pack_entry {
- off_t offset;
- struct packed_git *p;
-};
-
-/*
- * Create a temporary file rooted in the object database directory, or
- * die on failure. The filename is taken from "pattern", which should have the
- * usual "XXXXXX" trailer, and the resulting filename is written into the
- * "template" buffer. Returns the open descriptor.
- */
-int odb_mkstemp(struct strbuf *temp_filename, const char *pattern);
-
-/*
- * Create a pack .keep file named "name" (which should generally be the output
- * of odb_pack_name). Returns a file descriptor opened for writing, or -1 on
- * error.
- */
-int odb_pack_keep(const char *name);
-
-/*
- * Set this to 0 to prevent oid_object_info_extended() from fetching missing
- * blobs. This has a difference only if extensions.partialClone is set.
- *
- * Its default value is 1.
- */
-extern int fetch_if_missing;
-
-/* Dumb servers support */
-int update_server_info(int);
-
-const char *get_log_output_encoding(void);
-const char *get_commit_output_encoding(void);
-
-int committer_ident_sufficiently_given(void);
-int author_ident_sufficiently_given(void);
-
-extern const char *git_commit_encoding;
-extern const char *git_log_output_encoding;
-extern const char *git_mailmap_file;
-extern const char *git_mailmap_blob;
-
-/* IO helper functions */
-void maybe_flush_or_die(FILE *, const char *);
-__attribute__((format (printf, 2, 3)))
-void fprintf_or_die(FILE *, const char *fmt, ...);
-void fwrite_or_die(FILE *f, const void *buf, size_t count);
-void fflush_or_die(FILE *f);
-
-#define COPY_READ_ERROR (-2)
-#define COPY_WRITE_ERROR (-3)
-int copy_fd(int ifd, int ofd);
-int copy_file(const char *dst, const char *src, int mode);
-int copy_file_with_time(const char *dst, const char *src, int mode);
-
-void write_or_die(int fd, const void *buf, size_t count);
-void fsync_or_die(int fd, const char *);
-int fsync_component(enum fsync_component component, int fd);
-void fsync_component_or_die(enum fsync_component component, int fd, const char *msg);
-
-static inline int batch_fsync_enabled(enum fsync_component component)
-{
- return (fsync_components & component) && (fsync_method == FSYNC_METHOD_BATCH);
-}
-
-ssize_t read_in_full(int fd, void *buf, size_t count);
-ssize_t write_in_full(int fd, const void *buf, size_t count);
-ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset);
-
-static inline ssize_t write_str_in_full(int fd, const char *str)
-{
- return write_in_full(fd, str, strlen(str));
-}
-
-/**
- * Open (and truncate) the file at path, write the contents of buf to it,
- * and close it. Dies if any errors are encountered.
- */
-void write_file_buf(const char *path, const char *buf, size_t len);
-
-/**
- * Like write_file_buf(), but format the contents into a buffer first.
- * Additionally, write_file() will append a newline if one is not already
- * present, making it convenient to write text files:
- *
- * write_file(path, "counter: %d", ctr);
- */
-__attribute__((format (printf, 2, 3)))
-void write_file(const char *path, const char *fmt, ...);
-
-/* pager.c */
-void setup_pager(void);
-int pager_in_use(void);
-extern int pager_use_color;
-int term_columns(void);
-void term_clear_line(void);
-int decimal_width(uintmax_t);
-int check_pager_config(const char *cmd);
-void prepare_pager_args(struct child_process *, const char *pager);
-
-extern const char *editor_program;
-extern const char *askpass_program;
-extern const char *excludes_file;
-
-/* base85 */
-int decode_85(char *dst, const char *line, int linelen);
-void encode_85(char *buf, const unsigned char *data, int bytes);
-
-/* pkt-line.c */
-void packet_trace_identity(const char *prog);
+int cmp_cache_name_compare(const void *a_, const void *b_);
/* add */
/*
@@ -1862,49 +567,10 @@ int add_files_to_cache(const char *prefix, const struct pathspec *pathspec, int
/* diff.c */
extern int diff_auto_refresh_index;
-/* match-trees.c */
-void shift_tree(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, int);
-void shift_tree_by(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, const char *);
-
-/*
- * whitespace rules.
- * used by both diff and apply
- * last two digits are tab width
- */
-#define WS_BLANK_AT_EOL 0100
-#define WS_SPACE_BEFORE_TAB 0200
-#define WS_INDENT_WITH_NON_TAB 0400
-#define WS_CR_AT_EOL 01000
-#define WS_BLANK_AT_EOF 02000
-#define WS_TAB_IN_INDENT 04000
-#define WS_TRAILING_SPACE (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF)
-#define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB|8)
-#define WS_TAB_WIDTH_MASK 077
-/* All WS_* -- when extended, adapt diff.c emit_symbol */
-#define WS_RULE_MASK 07777
-extern unsigned whitespace_rule_cfg;
-unsigned whitespace_rule(struct index_state *, const char *);
-unsigned parse_whitespace_rule(const char *);
-unsigned ws_check(const char *line, int len, unsigned ws_rule);
-void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws);
-char *whitespace_error_string(unsigned ws);
-void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *);
-int ws_blank_line(const char *line, int len, unsigned ws_rule);
-#define ws_tab_width(rule) ((rule) & WS_TAB_WIDTH_MASK)
-
/* ls-files */
void overlay_tree_on_index(struct index_state *istate,
const char *tree_name, const char *prefix);
-/* setup.c */
-struct startup_info {
- int have_repository;
- const char *prefix;
- const char *original_cwd;
-};
-extern struct startup_info *startup_info;
-extern const char *tmp_original_cwd;
-
/* merge.c */
struct commit_list;
int try_merge_command(struct repository *r,
@@ -1946,23 +612,4 @@ int stat_validity_check(struct stat_validity *sv, const char *path);
*/
void stat_validity_update(struct stat_validity *sv, int fd);
-int versioncmp(const char *s1, const char *s2);
-
-/*
- * Create a directory and (if share is nonzero) adjust its permissions
- * according to the shared_repository setting. Only use this for
- * directories under $GIT_DIR. Don't use it for working tree
- * directories.
- */
-void safe_create_dir(const char *dir, int share);
-
-/*
- * Should we print an ellipsis after an abbreviated SHA-1 value
- * when doing diff-raw output or indicating a detached HEAD?
- */
-int print_sha1_ellipsis(void);
-
-/* Return 1 if the file is empty or does not exists, 0 otherwise. */
-int is_empty_or_missing_file(const char *filename);
-
#endif /* CACHE_H */
diff --git a/cbtree.c b/cbtree.c
index 336e46dbba..c1cc30a5dc 100644
--- a/cbtree.c
+++ b/cbtree.c
@@ -4,6 +4,7 @@
* Based on Adam Langley's adaptation of Dan Bernstein's public domain code
* git clone https://github.com/agl/critbit.git
*/
+#include "git-compat-util.h"
#include "cbtree.h"
static struct cb_node *cb_node_of(const void *p)
diff --git a/cbtree.h b/cbtree.h
index 0be14fb7ee..43193abdda 100644
--- a/cbtree.h
+++ b/cbtree.h
@@ -14,8 +14,6 @@
#ifndef CBTREE_H
#define CBTREE_H
-#include "git-compat-util.h"
-
struct cb_node;
struct cb_node {
struct cb_node *child[2];
diff --git a/chdir-notify.c b/chdir-notify.c
index 5f7f2c2ac2..0d7bc04607 100644
--- a/chdir-notify.c
+++ b/chdir-notify.c
@@ -1,7 +1,10 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
#include "chdir-notify.h"
#include "list.h"
+#include "path.h"
#include "strbuf.h"
+#include "trace.h"
struct chdir_notify_entry {
const char *name;
diff --git a/checkout.c b/checkout.c
index 2e39dae684..4256e71a7c 100644
--- a/checkout.c
+++ b/checkout.c
@@ -1,8 +1,11 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "object-name.h"
#include "remote.h"
#include "refspec.h"
+#include "repository.h"
#include "checkout.h"
#include "config.h"
+#include "strbuf.h"
struct tracking_name_data {
/* const */ char *src_ref;
@@ -23,7 +26,7 @@ static int check_tracking_name(struct remote *remote, void *cb_data)
memset(&query, 0, sizeof(struct refspec_item));
query.src = cb->src_ref;
if (remote_find_tracking(remote, &query) ||
- get_oid(query.dst, cb->dst_oid)) {
+ repo_get_oid(the_repository, query.dst, cb->dst_oid)) {
free(query.dst);
return 0;
}
diff --git a/checkout.h b/checkout.h
index 1152133bd7..3c514a5ab4 100644
--- a/checkout.h
+++ b/checkout.h
@@ -1,7 +1,7 @@
#ifndef CHECKOUT_H
#define CHECKOUT_H
-#include "cache.h"
+#include "hash-ll.h"
/*
* Check if the branch name uniquely matches a branch name on a remote
diff --git a/chunk-format.c b/chunk-format.c
index 0275b74a89..e7d613c907 100644
--- a/chunk-format.c
+++ b/chunk-format.c
@@ -1,6 +1,10 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "chunk-format.h"
#include "csum-file.h"
+#include "gettext.h"
+#include "hash.h"
+#include "trace2.h"
/*
* When writing a chunk-based file format, collect the chunks in
diff --git a/chunk-format.h b/chunk-format.h
index 7885aa0848..c7794e84ad 100644
--- a/chunk-format.h
+++ b/chunk-format.h
@@ -1,8 +1,7 @@
#ifndef CHUNK_FORMAT_H
#define CHUNK_FORMAT_H
-#include "git-compat-util.h"
-#include "hash.h"
+#include "hash-ll.h"
struct hashfile;
struct chunkfile;
diff --git a/ci/lib.sh b/ci/lib.sh
index 6561216a65..db7105e8a8 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -258,6 +258,7 @@ macos-*)
MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python3)"
else
MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python2)"
+ MAKEFLAGS="$MAKEFLAGS APPLE_COMMON_CRYPTO_SHA1=Yes"
fi
;;
esac
@@ -277,6 +278,12 @@ linux-leaks)
export GIT_TEST_PASSING_SANITIZE_LEAK=true
export GIT_TEST_SANITIZE_LEAK_LOG=true
;;
+linux-asan)
+ export SANITIZE=address
+ ;;
+linux-ubsan)
+ export SANITIZE=undefined
+ ;;
esac
MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}"
diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh
index 8ebff42596..a18b13a41d 100755
--- a/ci/run-build-and-tests.sh
+++ b/ci/run-build-and-tests.sh
@@ -26,9 +26,8 @@ linux-TEST-vars)
export GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1
export GIT_TEST_MULTI_PACK_INDEX=1
export GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=1
- export GIT_TEST_ADD_I_USE_BUILTIN=0
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
- export GIT_TEST_WRITE_REV_INDEX=1
+ export GIT_TEST_NO_WRITE_REV_INDEX=1
export GIT_TEST_CHECKOUT_WORKERS=2
;;
linux-clang)
diff --git a/color.c b/color.c
index f05d8a81d7..83abb11eda 100644
--- a/color.c
+++ b/color.c
@@ -1,6 +1,11 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "color.h"
+#include "editor.h"
+#include "gettext.h"
+#include "hex.h"
+#include "pager.h"
+#include "strbuf.h"
static int git_use_color_default = GIT_COLOR_AUTO;
int color_stdout_is_tty = -1;
diff --git a/column.c b/column.c
index fbf88639aa..ff2f0abf39 100644
--- a/column.c
+++ b/column.c
@@ -1,7 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "column.h"
#include "string-list.h"
+#include "pager.h"
#include "parse-options.h"
#include "run-command.h"
#include "utf8.h"
diff --git a/combine-diff.c b/combine-diff.c
index b0ece95480..1e3cd7fb17 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -1,17 +1,23 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "object-store.h"
#include "commit.h"
+#include "convert.h"
#include "blob.h"
#include "diff.h"
#include "diffcore.h"
+#include "environment.h"
+#include "hex.h"
+#include "object-name.h"
#include "quote.h"
#include "xdiff-interface.h"
#include "xdiff/xmacros.h"
#include "log-tree.h"
#include "refs.h"
+#include "tree.h"
#include "userdiff.h"
#include "oid-array.h"
#include "revision.h"
+#include "wrapper.h"
static int compare_paths(const struct combine_diff_path *one,
const struct diff_filespec *two)
@@ -332,7 +338,7 @@ static char *grab_blob(struct repository *r,
*size = fill_textconv(r, textconv, df, &blob);
free_filespec(df);
} else {
- blob = read_object_file(oid, &type, size);
+ blob = repo_read_object_file(r, oid, &type, size);
if (type != OBJ_BLOB)
die("object '%s' is not a blob!", oid_to_hex(oid));
}
@@ -372,7 +378,7 @@ struct combine_diff_state {
static void consume_hunk(void *state_,
long ob, long on,
long nb, long nn,
- const char *funcline, long funclen)
+ const char *func UNUSED, long funclen UNUSED)
{
struct combine_diff_state *state = state_;
@@ -948,11 +954,11 @@ static void show_combined_header(struct combine_diff_path *elem,
"", elem->path, line_prefix, c_meta, c_reset);
printf("%s%sindex ", line_prefix, c_meta);
for (i = 0; i < num_parent; i++) {
- abb = find_unique_abbrev(&elem->parent[i].oid,
- abbrev);
+ abb = repo_find_unique_abbrev(the_repository,
+ &elem->parent[i].oid, abbrev);
printf("%s%s", i ? "," : "", abb);
}
- abb = find_unique_abbrev(&elem->oid, abbrev);
+ abb = repo_find_unique_abbrev(the_repository, &elem->oid, abbrev);
printf("..%s%s\n", abb, c_reset);
if (mode_differs) {
diff --git a/commit-graph.c b/commit-graph.c
index a7d8755932..843bdb458d 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -1,5 +1,7 @@
#include "git-compat-util.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "pack.h"
#include "packfile.h"
@@ -9,7 +11,9 @@
#include "revision.h"
#include "hash-lookup.h"
#include "commit-graph.h"
+#include "object-file.h"
#include "object-store.h"
+#include "oid-array.h"
#include "alloc.h"
#include "hashmap.h"
#include "replace-object.h"
@@ -19,7 +23,9 @@
#include "shallow.h"
#include "json-writer.h"
#include "trace2.h"
+#include "tree.h"
#include "chunk-format.h"
+#include "wrapper.h"
void git_test_write_commit_graph_or_die(void)
{
@@ -116,12 +122,10 @@ timestamp_t commit_graph_generation(const struct commit *c)
struct commit_graph_data *data =
commit_graph_data_slab_peek(&commit_graph_data_slab, c);
- if (!data)
- return GENERATION_NUMBER_INFINITY;
- else if (data->graph_pos == COMMIT_NOT_FROM_GRAPH)
- return GENERATION_NUMBER_INFINITY;
+ if (data && data->generation)
+ return data->generation;
- return data->generation;
+ return GENERATION_NUMBER_INFINITY;
}
static struct commit_graph_data *commit_graph_data_at(const struct commit *c)
@@ -1446,24 +1450,52 @@ static void close_reachable(struct write_commit_graph_context *ctx)
stop_progress(&ctx->progress);
}
-static void compute_topological_levels(struct write_commit_graph_context *ctx)
+struct compute_generation_info {
+ struct repository *r;
+ struct packed_commit_list *commits;
+ struct progress *progress;
+ int progress_cnt;
+
+ timestamp_t (*get_generation)(struct commit *c, void *data);
+ void (*set_generation)(struct commit *c, timestamp_t gen, void *data);
+ void *data;
+};
+
+static timestamp_t compute_generation_from_max(struct commit *c,
+ timestamp_t max_gen,
+ int generation_version)
+{
+ switch (generation_version) {
+ case 1: /* topological levels */
+ if (max_gen > GENERATION_NUMBER_V1_MAX - 1)
+ max_gen = GENERATION_NUMBER_V1_MAX - 1;
+ return max_gen + 1;
+
+ case 2: /* corrected commit date */
+ if (c->date && c->date > max_gen)
+ max_gen = c->date - 1;
+ return max_gen + 1;
+
+ default:
+ BUG("attempting unimplemented version");
+ }
+}
+
+static void compute_reachable_generation_numbers(
+ struct compute_generation_info *info,
+ int generation_version)
{
int i;
struct commit_list *list = NULL;
- if (ctx->report_progress)
- ctx->progress = start_delayed_progress(
- _("Computing commit graph topological levels"),
- ctx->commits.nr);
- for (i = 0; i < ctx->commits.nr; i++) {
- struct commit *c = ctx->commits.list[i];
- uint32_t level;
-
- repo_parse_commit(ctx->r, c);
- level = *topo_level_slab_at(ctx->topo_levels, c);
+ for (i = 0; i < info->commits->nr; i++) {
+ struct commit *c = info->commits->list[i];
+ timestamp_t gen;
+ repo_parse_commit(info->r, c);
+ gen = info->get_generation(c, info->data);
+ display_progress(info->progress, info->progress_cnt + 1);
- display_progress(ctx->progress, i + 1);
- if (level != GENERATION_NUMBER_ZERO)
+ if (gen != GENERATION_NUMBER_ZERO && gen != GENERATION_NUMBER_INFINITY)
continue;
commit_list_insert(c, &list);
@@ -1471,41 +1503,91 @@ static void compute_topological_levels(struct write_commit_graph_context *ctx)
struct commit *current = list->item;
struct commit_list *parent;
int all_parents_computed = 1;
- uint32_t max_level = 0;
+ uint32_t max_gen = 0;
for (parent = current->parents; parent; parent = parent->next) {
- repo_parse_commit(ctx->r, parent->item);
- level = *topo_level_slab_at(ctx->topo_levels, parent->item);
+ repo_parse_commit(info->r, parent->item);
+ gen = info->get_generation(parent->item, info->data);
- if (level == GENERATION_NUMBER_ZERO) {
+ if (gen == GENERATION_NUMBER_ZERO) {
all_parents_computed = 0;
commit_list_insert(parent->item, &list);
break;
}
- if (level > max_level)
- max_level = level;
+ if (gen > max_gen)
+ max_gen = gen;
}
if (all_parents_computed) {
pop_commit(&list);
-
- if (max_level > GENERATION_NUMBER_V1_MAX - 1)
- max_level = GENERATION_NUMBER_V1_MAX - 1;
- *topo_level_slab_at(ctx->topo_levels, current) = max_level + 1;
+ gen = compute_generation_from_max(
+ current, max_gen,
+ generation_version);
+ info->set_generation(current, gen, info->data);
}
}
}
+}
+
+static timestamp_t get_topo_level(struct commit *c, void *data)
+{
+ struct write_commit_graph_context *ctx = data;
+ return *topo_level_slab_at(ctx->topo_levels, c);
+}
+
+static void set_topo_level(struct commit *c, timestamp_t t, void *data)
+{
+ struct write_commit_graph_context *ctx = data;
+ *topo_level_slab_at(ctx->topo_levels, c) = (uint32_t)t;
+}
+
+static void compute_topological_levels(struct write_commit_graph_context *ctx)
+{
+ struct compute_generation_info info = {
+ .r = ctx->r,
+ .commits = &ctx->commits,
+ .get_generation = get_topo_level,
+ .set_generation = set_topo_level,
+ .data = ctx,
+ };
+
+ if (ctx->report_progress)
+ info.progress = ctx->progress
+ = start_delayed_progress(
+ _("Computing commit graph topological levels"),
+ ctx->commits.nr);
+
+ compute_reachable_generation_numbers(&info, 1);
+
stop_progress(&ctx->progress);
}
+static timestamp_t get_generation_from_graph_data(struct commit *c, void *data)
+{
+ return commit_graph_data_at(c)->generation;
+}
+
+static void set_generation_v2(struct commit *c, timestamp_t t, void *data)
+{
+ struct commit_graph_data *g = commit_graph_data_at(c);
+ g->generation = t;
+}
+
static void compute_generation_numbers(struct write_commit_graph_context *ctx)
{
int i;
- struct commit_list *list = NULL;
+ struct compute_generation_info info = {
+ .r = ctx->r,
+ .commits = &ctx->commits,
+ .get_generation = get_generation_from_graph_data,
+ .set_generation = set_generation_v2,
+ .data = ctx,
+ };
if (ctx->report_progress)
- ctx->progress = start_delayed_progress(
+ info.progress = ctx->progress
+ = start_delayed_progress(
_("Computing commit graph generation numbers"),
ctx->commits.nr);
@@ -1517,47 +1599,7 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx)
}
}
- for (i = 0; i < ctx->commits.nr; i++) {
- struct commit *c = ctx->commits.list[i];
- timestamp_t corrected_commit_date;
-
- repo_parse_commit(ctx->r, c);
- corrected_commit_date = commit_graph_data_at(c)->generation;
-
- display_progress(ctx->progress, i + 1);
- if (corrected_commit_date != GENERATION_NUMBER_ZERO)
- continue;
-
- commit_list_insert(c, &list);
- while (list) {
- struct commit *current = list->item;
- struct commit_list *parent;
- int all_parents_computed = 1;
- timestamp_t max_corrected_commit_date = 0;
-
- for (parent = current->parents; parent; parent = parent->next) {
- repo_parse_commit(ctx->r, parent->item);
- corrected_commit_date = commit_graph_data_at(parent->item)->generation;
-
- if (corrected_commit_date == GENERATION_NUMBER_ZERO) {
- all_parents_computed = 0;
- commit_list_insert(parent->item, &list);
- break;
- }
-
- if (corrected_commit_date > max_corrected_commit_date)
- max_corrected_commit_date = corrected_commit_date;
- }
-
- if (all_parents_computed) {
- pop_commit(&list);
-
- if (current->date && current->date > max_corrected_commit_date)
- max_corrected_commit_date = current->date - 1;
- commit_graph_data_at(current)->generation = max_corrected_commit_date + 1;
- }
- }
- }
+ compute_reachable_generation_numbers(&info, 2);
for (i = 0; i < ctx->commits.nr; i++) {
struct commit *c = ctx->commits.list[i];
@@ -1568,6 +1610,35 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx)
stop_progress(&ctx->progress);
}
+static void set_generation_in_graph_data(struct commit *c, timestamp_t t,
+ void *data)
+{
+ commit_graph_data_at(c)->generation = t;
+}
+
+/*
+ * After this method, all commits reachable from those in the given
+ * list will have non-zero, non-infinite generation numbers.
+ */
+void ensure_generations_valid(struct repository *r,
+ struct commit **commits, size_t nr)
+{
+ int generation_version = get_configured_generation_version(r);
+ struct packed_commit_list list = {
+ .list = commits,
+ .alloc = nr,
+ .nr = nr,
+ };
+ struct compute_generation_info info = {
+ .r = r,
+ .commits = &list,
+ .get_generation = get_generation_from_graph_data,
+ .set_generation = set_generation_in_graph_data,
+ };
+
+ compute_reachable_generation_numbers(&info, generation_version);
+}
+
static void trace2_bloom_filter_write_statistics(struct write_commit_graph_context *ctx)
{
trace2_data_intmax("commit-graph", ctx->r, "filter-computed",
@@ -1594,8 +1665,7 @@ static void compute_bloom_filters(struct write_commit_graph_context *ctx)
_("Computing commit changed paths Bloom filters"),
ctx->commits.nr);
- ALLOC_ARRAY(sorted_commits, ctx->commits.nr);
- COPY_ARRAY(sorted_commits, ctx->commits.list, ctx->commits.nr);
+ DUP_ARRAY(sorted_commits, ctx->commits.list, ctx->commits.nr);
if (ctx->order_by_pack)
QSORT(sorted_commits, ctx->commits.nr, commit_pos_cmp);
@@ -2361,7 +2431,7 @@ int write_commit_graph(struct object_directory *odb,
replace = ctx->opts->split_flags & COMMIT_GRAPH_SPLIT_REPLACE;
}
- ctx->approx_nr_objects = approximate_object_count();
+ ctx->approx_nr_objects = repo_approximate_object_count(the_repository);
if (ctx->append && ctx->r->objects->commit_graph) {
struct commit_graph *g = ctx->r->objects->commit_graph;
@@ -2550,7 +2620,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags)
graph_commit = lookup_commit(r, &cur_oid);
odb_commit = (struct commit *)create_object(r, &cur_oid, alloc_commit_node(r));
- if (parse_commit_internal(odb_commit, 0, 0)) {
+ if (repo_parse_commit_internal(r, odb_commit, 0, 0)) {
graph_report(_("failed to parse commit %s from object database for commit-graph"),
oid_to_hex(&cur_oid));
continue;
diff --git a/commit-graph.h b/commit-graph.h
index 37faee6b66..83aaa1dbb9 100644
--- a/commit-graph.h
+++ b/commit-graph.h
@@ -1,7 +1,6 @@
#ifndef COMMIT_GRAPH_H
#define COMMIT_GRAPH_H
-#include "git-compat-util.h"
#include "object-store.h"
#include "oidset.h"
@@ -190,4 +189,12 @@ struct commit_graph_data {
*/
timestamp_t commit_graph_generation(const struct commit *);
uint32_t commit_graph_position(const struct commit *);
+
+/*
+ * After this method, all commits reachable from those in the given
+ * list will have non-zero, non-infinite generation numbers.
+ */
+void ensure_generations_valid(struct repository *r,
+ struct commit **commits, size_t nr);
+
#endif
diff --git a/commit-reach.c b/commit-reach.c
index c226ee3da4..70bde8af05 100644
--- a/commit-reach.c
+++ b/commit-reach.c
@@ -1,13 +1,16 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "commit.h"
#include "commit-graph.h"
#include "decorate.h"
+#include "hex.h"
#include "prio-queue.h"
#include "tree.h"
#include "ref-filter.h"
#include "revision.h"
#include "tag.h"
#include "commit-reach.h"
+#include "ewah/ewok.h"
/* Remember to update object flag allocation in object.h */
#define PARENT1 (1u<<16)
@@ -162,7 +165,8 @@ struct commit_list *get_octopus_merge_bases(struct commit_list *in)
for (j = ret; j; j = j->next) {
struct commit_list *bases;
- bases = get_merge_bases(i->item, j->item);
+ bases = repo_get_merge_bases(the_repository, i->item,
+ j->item);
if (!new_commits)
new_commits = bases;
else
@@ -245,8 +249,7 @@ static int remove_redundant_with_gen(struct repository *r,
* min_gen_pos points to the current position within 'array'
* that is not yet known to be STALE.
*/
- ALLOC_ARRAY(sorted, cnt);
- COPY_ARRAY(sorted, array, cnt);
+ DUP_ARRAY(sorted, array, cnt);
QSORT(sorted, cnt, compare_commits_by_gen);
min_generation = commit_graph_generation(sorted[0]);
@@ -448,7 +451,7 @@ int repo_is_descendant_of(struct repository *r,
if (!with_commit)
return 1;
- if (generation_numbers_enabled(the_repository)) {
+ if (generation_numbers_enabled(r)) {
struct commit_list *from_list = NULL;
int result;
commit_list_insert(commit, &from_list);
@@ -585,7 +588,7 @@ int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid)
return 0;
new_commit = (struct commit *) o;
- if (parse_commit(new_commit) < 0)
+ if (repo_parse_commit(the_repository, new_commit) < 0)
return 0;
commit_list_insert(old_commit, &old_commit_list);
@@ -749,7 +752,7 @@ int can_all_from_reach_with_flag(struct object_array *from,
}
list[nr_commits] = (struct commit *)from_one;
- if (parse_commit(list[nr_commits]) ||
+ if (repo_parse_commit(the_repository, list[nr_commits]) ||
commit_graph_generation(list[nr_commits]) < min_generation) {
result = 0;
goto cleanup;
@@ -784,7 +787,7 @@ int can_all_from_reach_with_flag(struct object_array *from,
if (!(parent->item->object.flags & assign_flag)) {
parent->item->object.flags |= assign_flag;
- if (parse_commit(parent->item) ||
+ if (repo_parse_commit(the_repository, parent->item) ||
parent->item->date < min_commit_date ||
commit_graph_generation(parent->item) < min_generation)
continue;
@@ -808,8 +811,12 @@ cleanup:
clear_commit_marks_many(nr_commits, list, RESULT | assign_flag);
free(list);
- for (i = 0; i < from->nr; i++)
- from->objects[i].item->flags &= ~assign_flag;
+ for (i = 0; i < from->nr; i++) {
+ struct object *from_one = from->objects[i].item;
+
+ if (from_one)
+ from_one->flags &= ~assign_flag;
+ }
return result;
}
@@ -826,7 +833,7 @@ int can_all_from_reach(struct commit_list *from, struct commit_list *to,
while (from_iter) {
add_object_array(&from_iter->item->object, NULL, &from_objs);
- if (!parse_commit(from_iter->item)) {
+ if (!repo_parse_commit(the_repository, from_iter->item)) {
timestamp_t generation;
if (from_iter->item->date < min_commit_date)
min_commit_date = from_iter->item->date;
@@ -840,7 +847,7 @@ int can_all_from_reach(struct commit_list *from, struct commit_list *to,
}
while (to_iter) {
- if (!parse_commit(to_iter->item)) {
+ if (!repo_parse_commit(the_repository, to_iter->item)) {
timestamp_t generation;
if (to_iter->item->date < min_commit_date)
min_commit_date = to_iter->item->date;
@@ -890,7 +897,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
timestamp_t generation;
struct commit *c = *item;
- parse_commit(c);
+ repo_parse_commit(the_repository, c);
generation = commit_graph_generation(c);
if (generation < min_generation)
min_generation = generation;
@@ -905,7 +912,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
struct commit *c = *item;
if (!(c->object.flags & PARENT2)) {
c->object.flags |= PARENT2;
- parse_commit(c);
+ repo_parse_commit(the_repository, c);
prio_queue_put(&queue, *item);
}
@@ -924,7 +931,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
for (parents = current->parents; parents; parents = parents->next) {
struct commit *p = parents->item;
- parse_commit(p);
+ repo_parse_commit(the_repository, p);
if (commit_graph_generation(p) < min_generation)
continue;
@@ -942,3 +949,218 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
return found_commits;
}
+
+define_commit_slab(bit_arrays, struct bitmap *);
+static struct bit_arrays bit_arrays;
+
+static void insert_no_dup(struct prio_queue *queue, struct commit *c)
+{
+ if (c->object.flags & PARENT2)
+ return;
+ prio_queue_put(queue, c);
+ c->object.flags |= PARENT2;
+}
+
+static struct bitmap *get_bit_array(struct commit *c, int width)
+{
+ struct bitmap **bitmap = bit_arrays_at(&bit_arrays, c);
+ if (!*bitmap)
+ *bitmap = bitmap_word_alloc(width);
+ return *bitmap;
+}
+
+static void free_bit_array(struct commit *c)
+{
+ struct bitmap **bitmap = bit_arrays_at(&bit_arrays, c);
+ if (!*bitmap)
+ return;
+ bitmap_free(*bitmap);
+ *bitmap = NULL;
+}
+
+void ahead_behind(struct repository *r,
+ struct commit **commits, size_t commits_nr,
+ struct ahead_behind_count *counts, size_t counts_nr)
+{
+ struct prio_queue queue = { .compare = compare_commits_by_gen_then_commit_date };
+ size_t width = DIV_ROUND_UP(commits_nr, BITS_IN_EWORD);
+
+ if (!commits_nr || !counts_nr)
+ return;
+
+ for (size_t i = 0; i < counts_nr; i++) {
+ counts[i].ahead = 0;
+ counts[i].behind = 0;
+ }
+
+ ensure_generations_valid(r, commits, commits_nr);
+
+ init_bit_arrays(&bit_arrays);
+
+ for (size_t i = 0; i < commits_nr; i++) {
+ struct commit *c = commits[i];
+ struct bitmap *bitmap = get_bit_array(c, width);
+
+ bitmap_set(bitmap, i);
+ insert_no_dup(&queue, c);
+ }
+
+ while (queue_has_nonstale(&queue)) {
+ struct commit *c = prio_queue_get(&queue);
+ struct commit_list *p;
+ struct bitmap *bitmap_c = get_bit_array(c, width);
+
+ for (size_t i = 0; i < counts_nr; i++) {
+ int reach_from_tip = !!bitmap_get(bitmap_c, counts[i].tip_index);
+ int reach_from_base = !!bitmap_get(bitmap_c, counts[i].base_index);
+
+ if (reach_from_tip ^ reach_from_base) {
+ if (reach_from_base)
+ counts[i].behind++;
+ else
+ counts[i].ahead++;
+ }
+ }
+
+ for (p = c->parents; p; p = p->next) {
+ struct bitmap *bitmap_p;
+
+ repo_parse_commit(r, p->item);
+
+ bitmap_p = get_bit_array(p->item, width);
+ bitmap_or(bitmap_p, bitmap_c);
+
+ /*
+ * If this parent is reachable from every starting
+ * commit, then none of its ancestors can contribute
+ * to the ahead/behind count. Mark it as STALE, so
+ * we can stop the walk when every commit in the
+ * queue is STALE.
+ */
+ if (bitmap_popcount(bitmap_p) == commits_nr)
+ p->item->object.flags |= STALE;
+
+ insert_no_dup(&queue, p->item);
+ }
+
+ free_bit_array(c);
+ }
+
+ /* STALE is used here, PARENT2 is used by insert_no_dup(). */
+ repo_clear_commit_marks(r, PARENT2 | STALE);
+ clear_bit_arrays(&bit_arrays);
+ clear_prio_queue(&queue);
+}
+
+struct commit_and_index {
+ struct commit *commit;
+ unsigned int index;
+ timestamp_t generation;
+};
+
+static int compare_commit_and_index_by_generation(const void *va, const void *vb)
+{
+ const struct commit_and_index *a = (const struct commit_and_index *)va;
+ const struct commit_and_index *b = (const struct commit_and_index *)vb;
+
+ if (a->generation > b->generation)
+ return 1;
+ if (a->generation < b->generation)
+ return -1;
+ return 0;
+}
+
+void tips_reachable_from_bases(struct repository *r,
+ struct commit_list *bases,
+ struct commit **tips, size_t tips_nr,
+ int mark)
+{
+ struct commit_and_index *commits;
+ size_t min_generation_index = 0;
+ timestamp_t min_generation;
+ struct commit_list *stack = NULL;
+
+ if (!bases || !tips || !tips_nr)
+ return;
+
+ /*
+ * Do a depth-first search starting at 'bases' to search for the
+ * tips. Stop at the lowest (un-found) generation number. When
+ * finding the lowest commit, increase the minimum generation
+ * number to the next lowest (un-found) generation number.
+ */
+
+ CALLOC_ARRAY(commits, tips_nr);
+
+ for (size_t i = 0; i < tips_nr; i++) {
+ commits[i].commit = tips[i];
+ commits[i].index = i;
+ commits[i].generation = commit_graph_generation(tips[i]);
+ }
+
+ /* Sort with generation number ascending. */
+ QSORT(commits, tips_nr, compare_commit_and_index_by_generation);
+ min_generation = commits[0].generation;
+
+ while (bases) {
+ repo_parse_commit(r, bases->item);
+ commit_list_insert(bases->item, &stack);
+ bases = bases->next;
+ }
+
+ while (stack) {
+ int explored_all_parents = 1;
+ struct commit_list *p;
+ struct commit *c = stack->item;
+ timestamp_t c_gen = commit_graph_generation(c);
+
+ /* Does it match any of our tips? */
+ for (size_t j = min_generation_index; j < tips_nr; j++) {
+ if (c_gen < commits[j].generation)
+ break;
+
+ if (commits[j].commit == c) {
+ tips[commits[j].index]->object.flags |= mark;
+
+ if (j == min_generation_index) {
+ unsigned int k = j + 1;
+ while (k < tips_nr &&
+ (tips[commits[k].index]->object.flags & mark))
+ k++;
+
+ /* Terminate early if all found. */
+ if (k >= tips_nr)
+ goto done;
+
+ min_generation_index = k;
+ min_generation = commits[k].generation;
+ }
+ }
+ }
+
+ for (p = c->parents; p; p = p->next) {
+ repo_parse_commit(r, p->item);
+
+ /* Have we already explored this parent? */
+ if (p->item->object.flags & SEEN)
+ continue;
+
+ /* Is it below the current minimum generation? */
+ if (commit_graph_generation(p->item) < min_generation)
+ continue;
+
+ /* Ok, we will explore from here on. */
+ p->item->object.flags |= SEEN;
+ explored_all_parents = 0;
+ commit_list_insert(p->item, &stack);
+ break;
+ }
+
+ if (explored_all_parents)
+ pop_commit(&stack);
+ }
+
+done:
+ free(commits);
+ repo_clear_commit_marks(r, SEEN);
+}
diff --git a/commit-reach.h b/commit-reach.h
index 148b56fea5..35c4da4948 100644
--- a/commit-reach.h
+++ b/commit-reach.h
@@ -19,11 +19,6 @@ struct commit_list *repo_get_merge_bases_many(struct repository *r,
struct commit_list *repo_get_merge_bases_many_dirty(struct repository *r,
struct commit *one, int n,
struct commit **twos);
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define get_merge_bases(r1, r2) repo_get_merge_bases(the_repository, r1, r2)
-#define get_merge_bases_many(one, n, two) repo_get_merge_bases_many(the_repository, one, n, two)
-#define get_merge_bases_many_dirty(one, n, twos) repo_get_merge_bases_many_dirty(the_repository, one, n, twos)
-#endif
struct commit_list *get_octopus_merge_bases(struct commit_list *in);
@@ -36,10 +31,6 @@ int repo_in_merge_bases(struct repository *r,
int repo_in_merge_bases_many(struct repository *r,
struct commit *commit,
int nr_reference, struct commit **reference);
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define in_merge_bases(c1, c2) repo_in_merge_bases(the_repository, c1, c2)
-#define in_merge_bases_many(c1, n, cs) repo_in_merge_bases_many(the_repository, c1, n, cs)
-#endif
/*
* Takes a list of commits and returns a new list where those
@@ -104,4 +95,44 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from,
struct commit **to, int nr_to,
unsigned int reachable_flag);
+struct ahead_behind_count {
+ /**
+ * As input, the *_index members indicate which positions in
+ * the 'tips' array correspond to the tip and base of this
+ * comparison.
+ */
+ size_t tip_index;
+ size_t base_index;
+
+ /**
+ * These values store the computed counts for each side of the
+ * symmetric difference:
+ *
+ * 'ahead' stores the number of commits reachable from the tip
+ * and not reachable from the base.
+ *
+ * 'behind' stores the number of commits reachable from the base
+ * and not reachable from the tip.
+ */
+ unsigned int ahead;
+ unsigned int behind;
+};
+
+/*
+ * Given an array of commits and an array of ahead_behind_count pairs,
+ * compute the ahead/behind counts for each pair.
+ */
+void ahead_behind(struct repository *r,
+ struct commit **commits, size_t commits_nr,
+ struct ahead_behind_count *counts, size_t counts_nr);
+
+/*
+ * For all tip commits, add 'mark' to their flags if and only if they
+ * are reachable from one of the commits in 'bases'.
+ */
+void tips_reachable_from_bases(struct repository *r,
+ struct commit_list *bases,
+ struct commit **tips, size_t tips_nr,
+ int mark);
+
#endif
diff --git a/commit-slab-impl.h b/commit-slab-impl.h
index 557738df27..4a414ee905 100644
--- a/commit-slab-impl.h
+++ b/commit-slab-impl.h
@@ -1,8 +1,6 @@
#ifndef COMMIT_SLAB_IMPL_H
#define COMMIT_SLAB_IMPL_H
-#include "git-compat-util.h"
-
#define implement_static_commit_slab(slabname, elemtype) \
implement_commit_slab(slabname, elemtype, MAYBE_UNUSED static)
diff --git a/commit.c b/commit.c
index 89b8efc611..0fb9316931 100644
--- a/commit.c
+++ b/commit.c
@@ -1,8 +1,12 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "tag.h"
#include "commit.h"
#include "commit-graph.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
+#include "object-name.h"
#include "object-store.h"
#include "pkt-line.h"
#include "utf8.h"
@@ -20,7 +24,9 @@
#include "refs.h"
#include "commit-reach.h"
#include "run-command.h"
+#include "setup.h"
#include "shallow.h"
+#include "tree.h"
#include "hook.h"
static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
@@ -59,6 +65,14 @@ struct commit *lookup_commit_or_die(const struct object_id *oid, const char *ref
return c;
}
+struct commit *lookup_commit_object(struct repository *r,
+ const struct object_id *oid)
+{
+ struct object *obj = parse_object(r, oid);
+ return obj ? object_as_type(obj, OBJ_COMMIT, 0) : NULL;
+
+}
+
struct commit *lookup_commit(struct repository *r, const struct object_id *oid)
{
struct object *obj = lookup_object(r, oid);
@@ -72,10 +86,10 @@ struct commit *lookup_commit_reference_by_name(const char *name)
struct object_id oid;
struct commit *commit;
- if (get_oid_committish(name, &oid))
+ if (repo_get_oid_committish(the_repository, name, &oid))
return NULL;
commit = lookup_commit_reference(the_repository, &oid);
- if (parse_commit(commit))
+ if (repo_parse_commit(the_repository, commit))
return NULL;
return commit;
}
@@ -83,6 +97,7 @@ struct commit *lookup_commit_reference_by_name(const char *name)
static timestamp_t parse_commit_date(const char *buf, const char *tail)
{
const char *dateptr;
+ const char *eol;
if (buf + 6 >= tail)
return 0;
@@ -94,16 +109,56 @@ static timestamp_t parse_commit_date(const char *buf, const char *tail)
return 0;
if (memcmp(buf, "committer", 9))
return 0;
- while (buf < tail && *buf++ != '>')
- /* nada */;
- if (buf >= tail)
+
+ /*
+ * Jump to end-of-line so that we can walk backwards to find the
+ * end-of-email ">". This is more forgiving of malformed cases
+ * because unexpected characters tend to be in the name and email
+ * fields.
+ */
+ eol = memchr(buf, '\n', tail - buf);
+ if (!eol)
return 0;
- dateptr = buf;
- while (buf < tail && *buf++ != '\n')
- /* nada */;
- if (buf >= tail)
+ dateptr = eol;
+ while (dateptr > buf && dateptr[-1] != '>')
+ dateptr--;
+ if (dateptr == buf)
+ return 0;
+
+ /*
+ * Trim leading whitespace, but make sure we have at least one
+ * non-whitespace character, as parse_timestamp() will otherwise walk
+ * right past the newline we found in "eol" when skipping whitespace
+ * itself.
+ *
+ * In theory it would be sufficient to allow any character not matched
+ * by isspace(), but there's a catch: our isspace() does not
+ * necessarily match the behavior of parse_timestamp(), as the latter
+ * is implemented by system routines which match more exotic control
+ * codes, or even locale-dependent sequences.
+ *
+ * Since we expect the timestamp to be a number, we can check for that.
+ * Anything else (e.g., a non-numeric token like "foo") would just
+ * cause parse_timestamp() to return 0 anyway.
+ */
+ while (dateptr < eol && isspace(*dateptr))
+ dateptr++;
+ if (!isdigit(*dateptr) && *dateptr != '-')
return 0;
- /* dateptr < buf && buf[-1] == '\n', so parsing will stop at buf-1 */
+
+ /*
+ * We know there is at least one digit (or dash), so we'll begin
+ * parsing there and stop at worst case at eol.
+ *
+ * Note that we may feed parse_timestamp() extra characters here if the
+ * commit is malformed, and it will parse as far as it can. For
+ * example, "123foo456" would return "123". That might be questionable
+ * (versus returning "0"), but it would help in a hypothetical case
+ * like "123456+0100", where the whitespace from the timezone is
+ * missing. Since such syntactic errors may be baked into history and
+ * hard to correct now, let's err on trying to make our best guess
+ * here, rather than insist on perfect syntax.
+ */
return parse_timestamp(dateptr, NULL, 10);
}
@@ -374,7 +429,7 @@ struct tree *repo_get_commit_tree(struct repository *r,
struct object_id *get_commit_tree_oid(const struct commit *commit)
{
- struct tree *tree = get_commit_tree(commit);
+ struct tree *tree = repo_get_commit_tree(the_repository, commit);
return tree ? &tree->object.oid : NULL;
}
@@ -500,6 +555,17 @@ int repo_parse_commit_internal(struct repository *r,
enum object_type type;
void *buffer;
unsigned long size;
+ struct object_info oi = {
+ .typep = &type,
+ .sizep = &size,
+ .contentp = &buffer,
+ };
+ /*
+ * Git does not support partial clones that exclude commits, so set
+ * OBJECT_INFO_SKIP_FETCH_OBJECT to fail fast when an object is missing.
+ */
+ int flags = OBJECT_INFO_LOOKUP_REPLACE | OBJECT_INFO_SKIP_FETCH_OBJECT |
+ OBJECT_INFO_DIE_IF_CORRUPT;
int ret;
if (!item)
@@ -508,8 +574,8 @@ int repo_parse_commit_internal(struct repository *r,
return 0;
if (use_commit_graph && parse_commit_in_graph(r, item))
return 0;
- buffer = repo_read_object_file(r, &item->object.oid, &type, &size);
- if (!buffer)
+
+ if (oid_object_info_extended(r, &item->object.oid, &oi, flags) < 0)
return quiet_on_missing ? -1 :
error("Could not read %s",
oid_to_hex(&item->object.oid));
@@ -536,7 +602,7 @@ int repo_parse_commit_gently(struct repository *r,
void parse_commit_or_die(struct commit *item)
{
- if (parse_commit(item))
+ if (repo_parse_commit(the_repository, item))
die("unable to parse commit %s",
item ? oid_to_hex(&item->object.oid) : "(null)");
}
@@ -669,7 +735,7 @@ struct commit *pop_most_recent_commit(struct commit_list **list,
while (parents) {
struct commit *commit = parents->item;
- if (!parse_commit(commit) && !(commit->object.flags & mark)) {
+ if (!repo_parse_commit(the_repository, commit) && !(commit->object.flags & mark)) {
commit->object.flags |= mark;
commit_list_insert_by_date(commit, list);
}
@@ -693,8 +759,10 @@ static void clear_commit_marks_1(struct commit_list **plist,
if (!parents)
return;
- while ((parents = parents->next))
- commit_list_insert(parents->item, plist);
+ while ((parents = parents->next)) {
+ if (parents->item->object.flags & mark)
+ commit_list_insert(parents->item, plist);
+ }
commit = commit->parents->item;
}
@@ -741,7 +809,8 @@ define_commit_slab(author_date_slab, timestamp_t);
void record_author_date(struct author_date_slab *author_date,
struct commit *commit)
{
- const char *buffer = get_commit_buffer(commit, NULL);
+ const char *buffer = repo_get_commit_buffer(the_repository, commit,
+ NULL);
struct ident_split ident;
const char *ident_line;
size_t ident_len;
@@ -761,7 +830,7 @@ void record_author_date(struct author_date_slab *author_date,
*(author_date_slab_at(author_date, commit)) = date;
fail_exit:
- unuse_commit_buffer(commit, buffer);
+ repo_unuse_commit_buffer(the_repository, commit, buffer);
}
int compare_commits_by_author_date(const void *a_, const void *b_,
@@ -780,7 +849,8 @@ int compare_commits_by_author_date(const void *a_, const void *b_,
return 0;
}
-int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_, void *unused)
+int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_,
+ void *unused UNUSED)
{
const struct commit *a = a_, *b = b_;
const timestamp_t generation_a = commit_graph_generation(a),
@@ -800,7 +870,8 @@ int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_, void
return 0;
}
-int compare_commits_by_commit_date(const void *a_, const void *b_, void *unused)
+int compare_commits_by_commit_date(const void *a_, const void *b_,
+ void *unused UNUSED)
{
const struct commit *a = a_, *b = b_;
/* newer commits with larger date first */
@@ -942,7 +1013,7 @@ static void add_one_commit(struct object_id *oid, struct rev_collect *revs)
commit = lookup_commit(the_repository, oid);
if (!commit ||
(commit->object.flags & TMP_MARK) ||
- parse_commit(commit))
+ repo_parse_commit(the_repository, commit))
return;
ALLOC_GROW(revs->commit, revs->nr + 1, revs->alloc);
@@ -974,7 +1045,8 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)
struct commit *ret = NULL;
char *full_refname;
- switch (dwim_ref(refname, strlen(refname), &oid, &full_refname, 0)) {
+ switch (repo_dwim_ref(the_repository, refname, strlen(refname), &oid,
+ &full_refname, 0)) {
case 0:
die("No such ref: '%s'", refname);
case 1:
@@ -993,7 +1065,8 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)
for (i = 0; i < revs.nr; i++)
revs.commit[i]->object.flags &= ~TMP_MARK;
- bases = get_merge_bases_many(commit, revs.nr, revs.commit);
+ bases = repo_get_merge_bases_many(the_repository, commit, revs.nr,
+ revs.commit);
/*
* There should be one and only one merge base, when we found
@@ -1012,6 +1085,7 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)
ret = bases->item;
cleanup_return:
+ free(revs.commit);
free_commit_list(bases);
free(full_refname);
return ret;
@@ -1073,10 +1147,11 @@ int parse_signed_commit(const struct commit *commit,
const struct git_hash_algo *algop)
{
unsigned long size;
- const char *buffer = get_commit_buffer(commit, &size);
+ const char *buffer = repo_get_commit_buffer(the_repository, commit,
+ &size);
int ret = parse_buffer_signed_by_header(buffer, size, payload, signature, algop);
- unuse_commit_buffer(commit, buffer);
+ repo_unuse_commit_buffer(the_repository, commit, buffer);
return ret;
}
@@ -1187,7 +1262,8 @@ static void handle_signed_tag(struct commit *parent, struct commit_extra_header
desc = merge_remote_util(parent);
if (!desc || !desc->obj)
return;
- buf = read_object_file(&desc->obj->oid, &type, &size);
+ buf = repo_read_object_file(the_repository, &desc->obj->oid, &type,
+ &size);
if (!buf || type != OBJ_TAG)
goto free_return;
if (!parse_signature(buf, size, &payload, &signature))
@@ -1249,7 +1325,8 @@ void verify_merge_signature(struct commit *commit, int verbosity,
ret = check_commit_signature(commit, &signature_check);
- find_unique_abbrev_r(hex, &commit->object.oid, DEFAULT_ABBREV);
+ repo_find_unique_abbrev_r(the_repository, hex, &commit->object.oid,
+ DEFAULT_ABBREV);
switch (signature_check.result) {
case 'G':
if (ret || (check_trust && signature_check.trust_level < TRUST_MARGINAL))
@@ -1294,9 +1371,10 @@ struct commit_extra_header *read_commit_extra_headers(struct commit *commit,
{
struct commit_extra_header *extra = NULL;
unsigned long size;
- const char *buffer = get_commit_buffer(commit, &size);
+ const char *buffer = repo_get_commit_buffer(the_repository, commit,
+ &size);
extra = read_commit_extra_header_lines(buffer, size, exclude);
- unuse_commit_buffer(commit, buffer);
+ repo_unuse_commit_buffer(the_repository, commit, buffer);
return extra;
}
@@ -1610,10 +1688,11 @@ struct commit *get_merge_parent(const char *name)
struct object *obj;
struct commit *commit;
struct object_id oid;
- if (get_oid(name, &oid))
+ if (repo_get_oid(the_repository, name, &oid))
return NULL;
obj = parse_object(the_repository, &oid);
- commit = (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);
+ commit = (struct commit *)repo_peel_to_type(the_repository, name, 0,
+ obj, OBJ_COMMIT);
if (commit && !merge_remote_util(commit))
set_merge_remote_desc(commit, name, obj);
return commit;
diff --git a/commit.h b/commit.h
index 21e4d25ce7..28928833c5 100644
--- a/commit.h
+++ b/commit.h
@@ -2,13 +2,10 @@
#define COMMIT_H
#include "object.h"
-#include "tree.h"
-#include "strbuf.h"
-#include "decorate.h"
-#include "gpg-interface.h"
-#include "string-list.h"
-#include "pretty.h"
-#include "commit-slab.h"
+
+struct signature_check;
+struct strbuf;
+struct tree;
#define COMMIT_NOT_FROM_GRAPH 0xFFFFFFFF
#define GENERATION_NUMBER_INFINITY ((1ULL << 63) - 1)
@@ -64,6 +61,19 @@ enum decoration_type {
void add_name_decoration(enum decoration_type type, const char *name, struct object *obj);
const struct name_decoration *get_name_decoration(const struct object *obj);
+/*
+ * Look up commit named by "oid" respecting replacement objects.
+ * Returns NULL if "oid" is not a commit or does not exist.
+ */
+struct commit *lookup_commit_object(struct repository *r, const struct object_id *oid);
+
+/*
+ * Look up commit named by "oid" without replacement objects or
+ * checking for object existence. Returns the requested commit if it
+ * is found in the object cache, NULL if "oid" is in the object cache
+ * but is not a commit and a newly allocated unparsed commit object if
+ * "oid" is not in the object cache.
+ */
struct commit *lookup_commit(struct repository *r, const struct object_id *oid);
struct commit *lookup_commit_reference(struct repository *r,
const struct object_id *oid);
@@ -96,11 +106,6 @@ static inline int repo_parse_commit_no_graph(struct repository *r,
return repo_parse_commit_internal(r, commit, 0, 0);
}
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define parse_commit_internal(item, quiet, use) repo_parse_commit_internal(the_repository, item, quiet, use)
-#define parse_commit(item) repo_parse_commit(the_repository, item)
-#endif
-
void parse_commit_or_die(struct commit *item);
struct buffer_slab;
@@ -122,27 +127,21 @@ const void *get_cached_commit_buffer(struct repository *, const struct commit *,
/*
* Get the commit's object contents, either from cache or by reading the object
* from disk. The resulting memory should not be modified, and must be given
- * to unuse_commit_buffer when the caller is done.
+ * to repo_unuse_commit_buffer when the caller is done.
*/
const void *repo_get_commit_buffer(struct repository *r,
const struct commit *,
unsigned long *size);
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define get_commit_buffer(c, s) repo_get_commit_buffer(the_repository, c, s)
-#endif
/*
* Tell the commit subsystem that we are done with a particular commit buffer.
* The commit and buffer should be the input and return value, respectively,
- * from an earlier call to get_commit_buffer. The buffer may or may not be
+ * from an earlier call to repo_get_commit_buffer. The buffer may or may not be
* freed by this call; callers should not access the memory afterwards.
*/
void repo_unuse_commit_buffer(struct repository *r,
const struct commit *,
const void *buffer);
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define unuse_commit_buffer(c, b) repo_unuse_commit_buffer(the_repository, c, b)
-#endif
/*
* Free any cached object buffer associated with the commit.
@@ -150,7 +149,6 @@ void repo_unuse_commit_buffer(struct repository *r,
void free_commit_buffer(struct parsed_object_pool *pool, struct commit *);
struct tree *repo_get_commit_tree(struct repository *, const struct commit *);
-#define get_commit_tree(c) repo_get_commit_tree(the_repository, c)
struct object_id *get_commit_tree_oid(const struct commit *);
/*
@@ -192,17 +190,10 @@ void free_commit_list(struct commit_list *list);
struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
-int has_non_ascii(const char *text);
-const char *logmsg_reencode(const struct commit *commit,
- char **commit_encoding,
- const char *output_encoding);
const char *repo_logmsg_reencode(struct repository *r,
const struct commit *commit,
char **commit_encoding,
const char *output_encoding);
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define logmsg_reencode(c, enc, out) repo_logmsg_reencode(the_repository, c, enc, out)
-#endif
const char *skip_blank_lines(const char *msg);
@@ -261,8 +252,6 @@ struct ref;
int for_each_commit_graft(each_commit_graft_fn, void *);
int interactive_add(const char **argv, const char *prefix, int patch);
-int run_add_interactive(const char *revision, const char *patch_mode,
- const struct pathspec *pathspec);
struct commit_extra_header {
struct commit_extra_header *next;
diff --git a/common-main.c b/common-main.c
index c531372f3f..033778b3c5 100644
--- a/common-main.c
+++ b/common-main.c
@@ -1,6 +1,11 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "exec-cmd.h"
+#include "gettext.h"
#include "attr.h"
+#include "repository.h"
+#include "setup.h"
+#include "strbuf.h"
+#include "trace2.h"
/*
* Many parts of Git have subprograms communicate via pipe, expect the
@@ -40,6 +45,7 @@ int main(int argc, const char **argv)
git_resolve_executable_dir(argv[0]);
+ setlocale(LC_CTYPE, "");
git_setup_gettext();
initialize_the_repository();
diff --git a/compat/disk.h b/compat/disk.h
index 50a32e3d8a..6c979c27d8 100644
--- a/compat/disk.h
+++ b/compat/disk.h
@@ -2,6 +2,8 @@
#define COMPAT_DISK_H
#include "git-compat-util.h"
+#include "abspath.h"
+#include "gettext.h"
static int get_disk_info(struct strbuf *out)
{
diff --git a/compat/fsmonitor/fsm-darwin-gcc.h b/compat/fsmonitor/fsm-darwin-gcc.h
index 1c75c3d48e..3496e29b3a 100644
--- a/compat/fsmonitor/fsm-darwin-gcc.h
+++ b/compat/fsmonitor/fsm-darwin-gcc.h
@@ -80,9 +80,7 @@ void CFRunLoopRun(void);
void CFRunLoopStop(CFRunLoopRef run_loop);
CFRunLoopRef CFRunLoopGetCurrent(void);
extern CFStringRef kCFRunLoopDefaultMode;
-void FSEventStreamScheduleWithRunLoop(FSEventStreamRef stream,
- CFRunLoopRef run_loop,
- CFStringRef run_loop_mode);
+void FSEventStreamSetDispatchQueue(FSEventStreamRef stream, dispatch_queue_t q);
unsigned char FSEventStreamStart(FSEventStreamRef stream);
void FSEventStreamStop(FSEventStreamRef stream);
void FSEventStreamInvalidate(FSEventStreamRef stream);
diff --git a/compat/fsmonitor/fsm-health-darwin.c b/compat/fsmonitor/fsm-health-darwin.c
index b9f709e854..4c291f8a06 100644
--- a/compat/fsmonitor/fsm-health-darwin.c
+++ b/compat/fsmonitor/fsm-health-darwin.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "fsmonitor.h"
#include "fsm-health.h"
diff --git a/compat/fsmonitor/fsm-health-win32.c b/compat/fsmonitor/fsm-health-win32.c
index 2ea08c1d4e..fe11bdd9ce 100644
--- a/compat/fsmonitor/fsm-health-win32.c
+++ b/compat/fsmonitor/fsm-health-win32.c
@@ -3,6 +3,7 @@
#include "fsmonitor.h"
#include "fsm-health.h"
#include "fsmonitor--daemon.h"
+#include "gettext.h"
/*
* Every minute wake up and test our health.
diff --git a/compat/fsmonitor/fsm-ipc-darwin.c b/compat/fsmonitor/fsm-ipc-darwin.c
new file mode 100644
index 0000000000..793073aaa7
--- /dev/null
+++ b/compat/fsmonitor/fsm-ipc-darwin.c
@@ -0,0 +1,55 @@
+#include "git-compat-util.h"
+#include "config.h"
+#include "gettext.h"
+#include "hex.h"
+#include "repository.h"
+#include "strbuf.h"
+#include "fsmonitor.h"
+#include "fsmonitor-ipc.h"
+#include "fsmonitor-path-utils.h"
+
+static GIT_PATH_FUNC(fsmonitor_ipc__get_default_path, "fsmonitor--daemon.ipc")
+
+const char *fsmonitor_ipc__get_path(struct repository *r)
+{
+ static const char *ipc_path = NULL;
+ git_SHA_CTX sha1ctx;
+ char *sock_dir = NULL;
+ struct strbuf ipc_file = STRBUF_INIT;
+ unsigned char hash[GIT_MAX_RAWSZ];
+
+ if (!r)
+ BUG("No repository passed into fsmonitor_ipc__get_path");
+
+ if (ipc_path)
+ return ipc_path;
+
+
+ /* By default the socket file is created in the .git directory */
+ if (fsmonitor__is_fs_remote(r->gitdir) < 1) {
+ ipc_path = fsmonitor_ipc__get_default_path();
+ return ipc_path;
+ }
+
+ git_SHA1_Init(&sha1ctx);
+ git_SHA1_Update(&sha1ctx, r->worktree, strlen(r->worktree));
+ git_SHA1_Final(hash, &sha1ctx);
+
+ repo_config_get_string(r, "fsmonitor.socketdir", &sock_dir);
+
+ /* Create the socket file in either socketDir or $HOME */
+ if (sock_dir && *sock_dir) {
+ strbuf_addf(&ipc_file, "%s/.git-fsmonitor-%s",
+ sock_dir, hash_to_hex(hash));
+ } else {
+ strbuf_addf(&ipc_file, "~/.git-fsmonitor-%s", hash_to_hex(hash));
+ }
+ free(sock_dir);
+
+ ipc_path = interpolate_path(ipc_file.buf, 1);
+ if (!ipc_path)
+ die(_("Invalid path: %s"), ipc_file.buf);
+
+ strbuf_release(&ipc_file);
+ return ipc_path;
+}
diff --git a/compat/fsmonitor/fsm-ipc-win32.c b/compat/fsmonitor/fsm-ipc-win32.c
new file mode 100644
index 0000000000..8928fa93ce
--- /dev/null
+++ b/compat/fsmonitor/fsm-ipc-win32.c
@@ -0,0 +1,11 @@
+#include "git-compat-util.h"
+#include "config.h"
+#include "fsmonitor-ipc.h"
+#include "path.h"
+
+const char *fsmonitor_ipc__get_path(struct repository *r) {
+ static char *ret;
+ if (!ret)
+ ret = git_pathdup("fsmonitor--daemon.ipc");
+ return ret;
+}
diff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c
index 8e208e8289..23e24b4b37 100644
--- a/compat/fsmonitor/fsm-listen-darwin.c
+++ b/compat/fsmonitor/fsm-listen-darwin.c
@@ -1,4 +1,5 @@
#ifndef __clang__
+#include <dispatch/dispatch.h>
#include "fsm-darwin-gcc.h"
#else
#include <CoreFoundation/CoreFoundation.h>
@@ -22,10 +23,13 @@
#endif
#endif
-#include "cache.h"
+#include "git-compat-util.h"
#include "fsmonitor.h"
#include "fsm-listen.h"
#include "fsmonitor--daemon.h"
+#include "fsmonitor-path-utils.h"
+#include "gettext.h"
+#include "string-list.h"
struct fsm_listen_data
{
@@ -37,7 +41,9 @@ struct fsm_listen_data
FSEventStreamRef stream;
- CFRunLoopRef rl;
+ dispatch_queue_t dq;
+ pthread_cond_t dq_finished;
+ pthread_mutex_t dq_lock;
enum shutdown_style {
SHUTDOWN_EVENT = 0,
@@ -198,8 +204,9 @@ static void fsevent_callback(ConstFSEventStreamRef streamRef,
struct string_list cookie_list = STRING_LIST_INIT_DUP;
const char *path_k;
const char *slash;
- int k;
+ char *resolved = NULL;
struct strbuf tmp = STRBUF_INIT;
+ int k;
/*
* Build a list of all filesystem changes into a private/local
@@ -209,7 +216,12 @@ static void fsevent_callback(ConstFSEventStreamRef streamRef,
/*
* On Mac, we receive an array of absolute paths.
*/
- path_k = paths[k];
+ free(resolved);
+ resolved = fsmonitor__resolve_alias(paths[k], &state->alias);
+ if (resolved)
+ path_k = resolved;
+ else
+ path_k = paths[k];
/*
* If you want to debug FSEvents, log them to GIT_TRACE_FSMONITOR.
@@ -238,6 +250,7 @@ static void fsevent_callback(ConstFSEventStreamRef streamRef,
fsmonitor_force_resync(state);
fsmonitor_batch__free_list(batch);
string_list_clear(&cookie_list, 0);
+ batch = NULL;
/*
* We assume that any events that we received
@@ -328,7 +341,7 @@ static void fsevent_callback(ConstFSEventStreamRef streamRef,
* know how much to invalidate/refresh.
*/
- if (event_flags[k] & kFSEventStreamEventFlagItemIsFile) {
+ if (event_flags[k] & (kFSEventStreamEventFlagItemIsFile | kFSEventStreamEventFlagItemIsSymlink)) {
const char *rel = path_k +
state->path_worktree_watch.len + 1;
@@ -360,17 +373,22 @@ static void fsevent_callback(ConstFSEventStreamRef streamRef,
}
}
+ free(resolved);
fsmonitor_publish(state, batch, &cookie_list);
string_list_clear(&cookie_list, 0);
strbuf_release(&tmp);
return;
force_shutdown:
+ free(resolved);
fsmonitor_batch__free_list(batch);
string_list_clear(&cookie_list, 0);
+ pthread_mutex_lock(&data->dq_lock);
data->shutdown_style = FORCE_SHUTDOWN;
- CFRunLoopStop(data->rl);
+ pthread_cond_broadcast(&data->dq_finished);
+ pthread_mutex_unlock(&data->dq_lock);
+
strbuf_release(&tmp);
return;
}
@@ -431,10 +449,6 @@ int fsm_listen__ctor(struct fsmonitor_daemon_state *state)
if (!data->stream)
goto failed;
- /*
- * `data->rl` needs to be set inside the listener thread.
- */
-
return 0;
failed:
@@ -461,6 +475,11 @@ void fsm_listen__dtor(struct fsmonitor_daemon_state *state)
FSEventStreamRelease(data->stream);
}
+ if (data->dq)
+ dispatch_release(data->dq);
+ pthread_cond_destroy(&data->dq_finished);
+ pthread_mutex_destroy(&data->dq_lock);
+
FREE_AND_NULL(state->listen_data);
}
@@ -469,9 +488,11 @@ void fsm_listen__stop_async(struct fsmonitor_daemon_state *state)
struct fsm_listen_data *data;
data = state->listen_data;
- data->shutdown_style = SHUTDOWN_EVENT;
- CFRunLoopStop(data->rl);
+ pthread_mutex_lock(&data->dq_lock);
+ data->shutdown_style = SHUTDOWN_EVENT;
+ pthread_cond_broadcast(&data->dq_finished);
+ pthread_mutex_unlock(&data->dq_lock);
}
void fsm_listen__loop(struct fsmonitor_daemon_state *state)
@@ -480,9 +501,11 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
data = state->listen_data;
- data->rl = CFRunLoopGetCurrent();
+ pthread_mutex_init(&data->dq_lock, NULL);
+ pthread_cond_init(&data->dq_finished, NULL);
+ data->dq = dispatch_queue_create("FSMonitor", NULL);
- FSEventStreamScheduleWithRunLoop(data->stream, data->rl, kCFRunLoopDefaultMode);
+ FSEventStreamSetDispatchQueue(data->stream, data->dq);
data->stream_scheduled = 1;
if (!FSEventStreamStart(data->stream)) {
@@ -491,7 +514,9 @@ void fsm_listen__loop(struct fsmonitor_daemon_state *state)
}
data->stream_started = 1;
- CFRunLoopRun();
+ pthread_mutex_lock(&data->dq_lock);
+ pthread_cond_wait(&data->dq_finished, &data->dq_lock);
+ pthread_mutex_unlock(&data->dq_lock);
switch (data->shutdown_style) {
case FORCE_ERROR_STOP:
diff --git a/compat/fsmonitor/fsm-listen-win32.c b/compat/fsmonitor/fsm-listen-win32.c
index 03df8d951b..677b1bbdec 100644
--- a/compat/fsmonitor/fsm-listen-win32.c
+++ b/compat/fsmonitor/fsm-listen-win32.c
@@ -3,6 +3,8 @@
#include "fsmonitor.h"
#include "fsm-listen.h"
#include "fsmonitor--daemon.h"
+#include "gettext.h"
+#include "trace2.h"
/*
* The documentation of ReadDirectoryChangesW() states that the maximum
diff --git a/compat/fsmonitor/fsm-path-utils-darwin.c b/compat/fsmonitor/fsm-path-utils-darwin.c
new file mode 100644
index 0000000000..45eb4a9b9e
--- /dev/null
+++ b/compat/fsmonitor/fsm-path-utils-darwin.c
@@ -0,0 +1,136 @@
+#include "fsmonitor.h"
+#include "fsmonitor-path-utils.h"
+#include "gettext.h"
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/param.h>
+#include <sys/mount.h>
+
+int fsmonitor__get_fs_info(const char *path, struct fs_info *fs_info)
+{
+ struct statfs fs;
+ if (statfs(path, &fs) == -1) {
+ int saved_errno = errno;
+ trace_printf_key(&trace_fsmonitor, "statfs('%s') failed: %s",
+ path, strerror(saved_errno));
+ errno = saved_errno;
+ return -1;
+ }
+
+ trace_printf_key(&trace_fsmonitor,
+ "statfs('%s') [type 0x%08x][flags 0x%08x] '%s'",
+ path, fs.f_type, fs.f_flags, fs.f_fstypename);
+
+ if (!(fs.f_flags & MNT_LOCAL))
+ fs_info->is_remote = 1;
+ else
+ fs_info->is_remote = 0;
+
+ fs_info->typename = xstrdup(fs.f_fstypename);
+
+ trace_printf_key(&trace_fsmonitor,
+ "'%s' is_remote: %d",
+ path, fs_info->is_remote);
+ return 0;
+}
+
+int fsmonitor__is_fs_remote(const char *path)
+{
+ struct fs_info fs;
+ if (fsmonitor__get_fs_info(path, &fs))
+ return -1;
+
+ free(fs.typename);
+
+ return fs.is_remote;
+}
+
+/*
+ * Scan the root directory for synthetic firmlinks that when resolved
+ * are a prefix of the path, stopping at the first one found.
+ *
+ * Some information about firmlinks and synthetic firmlinks:
+ * https://eclecticlight.co/2020/01/23/catalina-boot-volumes/
+ *
+ * macOS no longer allows symlinks in the root directory; any link found
+ * there is therefore a synthetic firmlink.
+ *
+ * If this function gets called often, will want to cache all the firmlink
+ * information, but for now there is only one caller of this function.
+ *
+ * If there is more than one alias for the path, that is another
+ * matter altogether.
+ */
+int fsmonitor__get_alias(const char *path, struct alias_info *info)
+{
+ DIR *dir;
+ int retval = -1;
+ const char *const root = "/";
+ struct stat st;
+ struct dirent *de;
+ struct strbuf alias;
+ struct strbuf points_to = STRBUF_INIT;
+
+ dir = opendir(root);
+ if (!dir)
+ return error_errno(_("opendir('%s') failed"), root);
+
+ strbuf_init(&alias, 256);
+
+ while ((de = readdir(dir)) != NULL) {
+ strbuf_reset(&alias);
+ strbuf_addf(&alias, "%s%s", root, de->d_name);
+
+ if (lstat(alias.buf, &st) < 0) {
+ error_errno(_("lstat('%s') failed"), alias.buf);
+ goto done;
+ }
+
+ if (!S_ISLNK(st.st_mode))
+ continue;
+
+ if (strbuf_readlink(&points_to, alias.buf, st.st_size) < 0) {
+ error_errno(_("strbuf_readlink('%s') failed"), alias.buf);
+ goto done;
+ }
+
+ if (!strncmp(points_to.buf, path, points_to.len) &&
+ (path[points_to.len] == '/')) {
+ strbuf_addbuf(&info->alias, &alias);
+ strbuf_addbuf(&info->points_to, &points_to);
+ trace_printf_key(&trace_fsmonitor,
+ "Found alias for '%s' : '%s' -> '%s'",
+ path, info->alias.buf, info->points_to.buf);
+ retval = 0;
+ goto done;
+ }
+ }
+ retval = 0; /* no alias */
+
+done:
+ strbuf_release(&alias);
+ strbuf_release(&points_to);
+ if (closedir(dir) < 0)
+ return error_errno(_("closedir('%s') failed"), root);
+ return retval;
+}
+
+char *fsmonitor__resolve_alias(const char *path,
+ const struct alias_info *info)
+{
+ if (!info->alias.len)
+ return NULL;
+
+ if ((!strncmp(info->alias.buf, path, info->alias.len))
+ && path[info->alias.len] == '/') {
+ struct strbuf tmp = STRBUF_INIT;
+ const char *remainder = path + info->alias.len;
+
+ strbuf_addbuf(&tmp, &info->points_to);
+ strbuf_add(&tmp, remainder, strlen(remainder));
+ return strbuf_detach(&tmp, NULL);
+ }
+
+ return NULL;
+}
diff --git a/compat/fsmonitor/fsm-path-utils-win32.c b/compat/fsmonitor/fsm-path-utils-win32.c
new file mode 100644
index 0000000000..4024baafb9
--- /dev/null
+++ b/compat/fsmonitor/fsm-path-utils-win32.c
@@ -0,0 +1,146 @@
+#include "cache.h"
+#include "fsmonitor.h"
+#include "fsmonitor-path-utils.h"
+#include "gettext.h"
+
+/*
+ * Check remote working directory protocol.
+ *
+ * Return -1 if client machine cannot get remote protocol information.
+ */
+static int check_remote_protocol(wchar_t *wpath)
+{
+ HANDLE h;
+ FILE_REMOTE_PROTOCOL_INFO proto_info;
+
+ h = CreateFileW(wpath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS, NULL);
+
+ if (h == INVALID_HANDLE_VALUE) {
+ error(_("[GLE %ld] unable to open for read '%ls'"),
+ GetLastError(), wpath);
+ return -1;
+ }
+
+ if (!GetFileInformationByHandleEx(h, FileRemoteProtocolInfo,
+ &proto_info, sizeof(proto_info))) {
+ error(_("[GLE %ld] unable to get protocol information for '%ls'"),
+ GetLastError(), wpath);
+ CloseHandle(h);
+ return -1;
+ }
+
+ CloseHandle(h);
+
+ trace_printf_key(&trace_fsmonitor,
+ "check_remote_protocol('%ls') remote protocol %#8.8lx",
+ wpath, proto_info.Protocol);
+
+ return 0;
+}
+
+/*
+ * Notes for testing:
+ *
+ * (a) Windows allows a network share to be mapped to a drive letter.
+ * (This is the normal method to access it.)
+ *
+ * $ NET USE Z: \\server\share
+ * $ git -C Z:/repo status
+ *
+ * (b) Windows allows a network share to be referenced WITHOUT mapping
+ * it to drive letter.
+ *
+ * $ NET USE \\server\share\dir
+ * $ git -C //server/share/repo status
+ *
+ * (c) Windows allows "SUBST" to create a fake drive mapping to an
+ * arbitrary path (which may be remote)
+ *
+ * $ SUBST Q: Z:\repo
+ * $ git -C Q:/ status
+ *
+ * (d) Windows allows a directory symlink to be created on a local
+ * file system that points to a remote repo.
+ *
+ * $ mklink /d ./link //server/share/repo
+ * $ git -C ./link status
+ */
+int fsmonitor__get_fs_info(const char *path, struct fs_info *fs_info)
+{
+ wchar_t wpath[MAX_PATH];
+ wchar_t wfullpath[MAX_PATH];
+ size_t wlen;
+ UINT driveType;
+
+ /*
+ * Do everything in wide chars because the drive letter might be
+ * a multi-byte sequence. See win32_has_dos_drive_prefix().
+ */
+ if (xutftowcs_path(wpath, path) < 0) {
+ return -1;
+ }
+
+ /*
+ * GetDriveTypeW() requires a final slash. We assume that the
+ * worktree pathname points to an actual directory.
+ */
+ wlen = wcslen(wpath);
+ if (wpath[wlen - 1] != L'\\' && wpath[wlen - 1] != L'/') {
+ wpath[wlen++] = L'\\';
+ wpath[wlen] = 0;
+ }
+
+ /*
+ * Normalize the path. If nothing else, this converts forward
+ * slashes to backslashes. This is essential to get GetDriveTypeW()
+ * correctly handle some UNC "\\server\share\..." paths.
+ */
+ if (!GetFullPathNameW(wpath, MAX_PATH, wfullpath, NULL)) {
+ return -1;
+ }
+
+ driveType = GetDriveTypeW(wfullpath);
+ trace_printf_key(&trace_fsmonitor,
+ "DriveType '%s' L'%ls' (%u)",
+ path, wfullpath, driveType);
+
+ if (driveType == DRIVE_REMOTE) {
+ fs_info->is_remote = 1;
+ if (check_remote_protocol(wfullpath) < 0)
+ return -1;
+ } else {
+ fs_info->is_remote = 0;
+ }
+
+ trace_printf_key(&trace_fsmonitor,
+ "'%s' is_remote: %d",
+ path, fs_info->is_remote);
+
+ return 0;
+}
+
+int fsmonitor__is_fs_remote(const char *path)
+{
+ struct fs_info fs;
+ if (fsmonitor__get_fs_info(path, &fs))
+ return -1;
+ return fs.is_remote;
+}
+
+/*
+ * No-op for now.
+ */
+int fsmonitor__get_alias(const char *path, struct alias_info *info)
+{
+ return 0;
+}
+
+/*
+ * No-op for now.
+ */
+char *fsmonitor__resolve_alias(const char *path,
+ const struct alias_info *info)
+{
+ return NULL;
+}
diff --git a/compat/fsmonitor/fsm-settings-darwin.c b/compat/fsmonitor/fsm-settings-darwin.c
index efc732c0f3..58b623fbb9 100644
--- a/compat/fsmonitor/fsm-settings-darwin.c
+++ b/compat/fsmonitor/fsm-settings-darwin.c
@@ -1,32 +1,11 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
-#include "repository.h"
-#include "fsmonitor-settings.h"
#include "fsmonitor.h"
-#include <sys/param.h>
-#include <sys/mount.h>
+#include "fsmonitor-ipc.h"
+#include "fsmonitor-settings.h"
+#include "fsmonitor-path-utils.h"
-/*
- * [1] Remote working directories are problematic for FSMonitor.
- *
- * The underlying file system on the server machine and/or the remote
- * mount type (NFS, SAMBA, etc.) dictates whether notification events
- * are available at all to remote client machines.
- *
- * Kernel differences between the server and client machines also
- * dictate the how (buffering, frequency, de-dup) the events are
- * delivered to client machine processes.
- *
- * A client machine (such as a laptop) may choose to suspend/resume
- * and it is unclear (without lots of testing) whether the watcher can
- * resync after a resume. We might be able to treat this as a normal
- * "events were dropped by the kernel" event and do our normal "flush
- * and resync" --or-- we might need to close the existing (zombie?)
- * notification fd and create a new one.
- *
- * In theory, the above issues need to be addressed whether we are
- * using the Hook or IPC API.
- *
+ /*
* For the builtin FSMonitor, we create the Unix domain socket for the
* IPC in the .git directory. If the working directory is remote,
* then the socket will be created on the remote file system. This
@@ -38,52 +17,47 @@
* be taken to ensure that $HOME is actually local and not a managed
* file share.)
*
- * So (for now at least), mark remote working directories as
- * incompatible.
- *
- *
- * [2] FAT32 and NTFS working directories are problematic too.
+ * FAT32 and NTFS working directories are problematic too.
*
* The builtin FSMonitor uses a Unix domain socket in the .git
* directory for IPC. These Windows drive formats do not support
* Unix domain sockets, so mark them as incompatible for the daemon.
*
*/
-static enum fsmonitor_reason check_volume(struct repository *r)
+static enum fsmonitor_reason check_uds_volume(struct repository *r)
{
- struct statfs fs;
+ struct fs_info fs;
+ const char *ipc_path = fsmonitor_ipc__get_path(r);
+ struct strbuf path = STRBUF_INIT;
+ strbuf_add(&path, ipc_path, strlen(ipc_path));
- if (statfs(r->worktree, &fs) == -1) {
- int saved_errno = errno;
- trace_printf_key(&trace_fsmonitor, "statfs('%s') failed: %s",
- r->worktree, strerror(saved_errno));
- errno = saved_errno;
+ if (fsmonitor__get_fs_info(dirname(path.buf), &fs) == -1) {
+ strbuf_release(&path);
return FSMONITOR_REASON_ERROR;
}
- trace_printf_key(&trace_fsmonitor,
- "statfs('%s') [type 0x%08x][flags 0x%08x] '%s'",
- r->worktree, fs.f_type, fs.f_flags, fs.f_fstypename);
+ strbuf_release(&path);
- if (!(fs.f_flags & MNT_LOCAL))
- return FSMONITOR_REASON_REMOTE;
-
- if (!strcmp(fs.f_fstypename, "msdos")) /* aka FAT32 */
- return FSMONITOR_REASON_NOSOCKETS;
-
- if (!strcmp(fs.f_fstypename, "ntfs"))
+ if (fs.is_remote ||
+ !strcmp(fs.typename, "msdos") ||
+ !strcmp(fs.typename, "ntfs")) {
+ free(fs.typename);
return FSMONITOR_REASON_NOSOCKETS;
+ }
+ free(fs.typename);
return FSMONITOR_REASON_OK;
}
-enum fsmonitor_reason fsm_os__incompatible(struct repository *r)
+enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc)
{
enum fsmonitor_reason reason;
- reason = check_volume(r);
- if (reason != FSMONITOR_REASON_OK)
- return reason;
+ if (ipc) {
+ reason = check_uds_volume(r);
+ if (reason != FSMONITOR_REASON_OK)
+ return reason;
+ }
return FSMONITOR_REASON_OK;
}
diff --git a/compat/fsmonitor/fsm-settings-win32.c b/compat/fsmonitor/fsm-settings-win32.c
index e5ec5b0a9f..a8af31b71d 100644
--- a/compat/fsmonitor/fsm-settings-win32.c
+++ b/compat/fsmonitor/fsm-settings-win32.c
@@ -1,8 +1,9 @@
#include "cache.h"
#include "config.h"
#include "repository.h"
-#include "fsmonitor-settings.h"
#include "fsmonitor.h"
+#include "fsmonitor-settings.h"
+#include "fsmonitor-path-utils.h"
/*
* VFS for Git is incompatible with FSMonitor.
@@ -24,172 +25,7 @@ static enum fsmonitor_reason check_vfs4git(struct repository *r)
return FSMONITOR_REASON_OK;
}
-/*
- * Check if monitoring remote working directories is allowed.
- *
- * By default, monitoring remote working directories is
- * disabled. Users may override this behavior in enviroments where
- * they have proper support.
- */
-static int check_config_allowremote(struct repository *r)
-{
- int allow;
-
- if (!repo_config_get_bool(r, "fsmonitor.allowremote", &allow))
- return allow;
-
- return -1; /* fsmonitor.allowremote not set */
-}
-
-/*
- * Check remote working directory protocol.
- *
- * Error if client machine cannot get remote protocol information.
- */
-static int check_remote_protocol(wchar_t *wpath)
-{
- HANDLE h;
- FILE_REMOTE_PROTOCOL_INFO proto_info;
-
- h = CreateFileW(wpath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
- FILE_FLAG_BACKUP_SEMANTICS, NULL);
-
- if (h == INVALID_HANDLE_VALUE) {
- error(_("[GLE %ld] unable to open for read '%ls'"),
- GetLastError(), wpath);
- return -1;
- }
-
- if (!GetFileInformationByHandleEx(h, FileRemoteProtocolInfo,
- &proto_info, sizeof(proto_info))) {
- error(_("[GLE %ld] unable to get protocol information for '%ls'"),
- GetLastError(), wpath);
- CloseHandle(h);
- return -1;
- }
-
- CloseHandle(h);
-
- trace_printf_key(&trace_fsmonitor,
- "check_remote_protocol('%ls') remote protocol %#8.8lx",
- wpath, proto_info.Protocol);
-
- return 0;
-}
-
-/*
- * Remote working directories are problematic for FSMonitor.
- *
- * The underlying file system on the server machine and/or the remote
- * mount type dictates whether notification events are available at
- * all to remote client machines.
- *
- * Kernel differences between the server and client machines also
- * dictate the how (buffering, frequency, de-dup) the events are
- * delivered to client machine processes.
- *
- * A client machine (such as a laptop) may choose to suspend/resume
- * and it is unclear (without lots of testing) whether the watcher can
- * resync after a resume. We might be able to treat this as a normal
- * "events were dropped by the kernel" event and do our normal "flush
- * and resync" --or-- we might need to close the existing (zombie?)
- * notification fd and create a new one.
- *
- * In theory, the above issues need to be addressed whether we are
- * using the Hook or IPC API.
- *
- * So (for now at least), mark remote working directories as
- * incompatible.
- *
- * Notes for testing:
- *
- * (a) Windows allows a network share to be mapped to a drive letter.
- * (This is the normal method to access it.)
- *
- * $ NET USE Z: \\server\share
- * $ git -C Z:/repo status
- *
- * (b) Windows allows a network share to be referenced WITHOUT mapping
- * it to drive letter.
- *
- * $ NET USE \\server\share\dir
- * $ git -C //server/share/repo status
- *
- * (c) Windows allows "SUBST" to create a fake drive mapping to an
- * arbitrary path (which may be remote)
- *
- * $ SUBST Q: Z:\repo
- * $ git -C Q:/ status
- *
- * (d) Windows allows a directory symlink to be created on a local
- * file system that points to a remote repo.
- *
- * $ mklink /d ./link //server/share/repo
- * $ git -C ./link status
- */
-static enum fsmonitor_reason check_remote(struct repository *r)
-{
- int ret;
- wchar_t wpath[MAX_PATH];
- wchar_t wfullpath[MAX_PATH];
- size_t wlen;
- UINT driveType;
-
- /*
- * Do everything in wide chars because the drive letter might be
- * a multi-byte sequence. See win32_has_dos_drive_prefix().
- */
- if (xutftowcs_path(wpath, r->worktree) < 0)
- return FSMONITOR_REASON_ERROR;
-
- /*
- * GetDriveTypeW() requires a final slash. We assume that the
- * worktree pathname points to an actual directory.
- */
- wlen = wcslen(wpath);
- if (wpath[wlen - 1] != L'\\' && wpath[wlen - 1] != L'/') {
- wpath[wlen++] = L'\\';
- wpath[wlen] = 0;
- }
-
- /*
- * Normalize the path. If nothing else, this converts forward
- * slashes to backslashes. This is essential to get GetDriveTypeW()
- * correctly handle some UNC "\\server\share\..." paths.
- */
- if (!GetFullPathNameW(wpath, MAX_PATH, wfullpath, NULL))
- return FSMONITOR_REASON_ERROR;
-
- driveType = GetDriveTypeW(wfullpath);
- trace_printf_key(&trace_fsmonitor,
- "DriveType '%s' L'%ls' (%u)",
- r->worktree, wfullpath, driveType);
-
- if (driveType == DRIVE_REMOTE) {
- trace_printf_key(&trace_fsmonitor,
- "check_remote('%s') true",
- r->worktree);
-
- ret = check_remote_protocol(wfullpath);
- if (ret < 0)
- return FSMONITOR_REASON_ERROR;
-
- switch (check_config_allowremote(r)) {
- case 0: /* config overrides and disables */
- return FSMONITOR_REASON_REMOTE;
- case 1: /* config overrides and enables */
- return FSMONITOR_REASON_OK;
- default:
- break; /* config has no opinion */
- }
-
- return FSMONITOR_REASON_REMOTE;
- }
-
- return FSMONITOR_REASON_OK;
-}
-
-enum fsmonitor_reason fsm_os__incompatible(struct repository *r)
+enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc)
{
enum fsmonitor_reason reason;
@@ -197,9 +33,5 @@ enum fsmonitor_reason fsm_os__incompatible(struct repository *r)
if (reason != FSMONITOR_REASON_OK)
return reason;
- reason = check_remote(r);
- if (reason != FSMONITOR_REASON_OK)
- return reason;
-
return FSMONITOR_REASON_OK;
}
diff --git a/compat/linux/procinfo.c b/compat/linux/procinfo.c
index bc2f9382a1..4bb2d66227 100644
--- a/compat/linux/procinfo.c
+++ b/compat/linux/procinfo.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "strbuf.h"
#include "strvec.h"
diff --git a/compat/mingw.c b/compat/mingw.c
index 901375d584..d06cdc6254 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -7,9 +7,16 @@
#include "../strbuf.h"
#include "../run-command.h"
#include "../cache.h"
+#include "../abspath.h"
+#include "../alloc.h"
#include "win32/lazyload.h"
#include "../config.h"
+#include "../environment.h"
+#include "../trace2.h"
+#include "../symlinks.h"
+#include "../wrapper.h"
#include "dir.h"
+#include "gettext.h"
#define SECURITY_WIN32
#include <sspi.h>
@@ -196,16 +203,19 @@ static int read_yes_no_answer(void)
static int ask_yes_no_if_possible(const char *format, ...)
{
char question[4096];
- const char *retry_hook[] = { NULL, NULL, NULL };
+ const char *retry_hook;
va_list args;
va_start(args, format);
vsnprintf(question, sizeof(question), format, args);
va_end(args);
- if ((retry_hook[0] = mingw_getenv("GIT_ASK_YESNO"))) {
- retry_hook[1] = question;
- return !run_command_v_opt(retry_hook, 0);
+ retry_hook = mingw_getenv("GIT_ASK_YESNO");
+ if (retry_hook) {
+ struct child_process cmd = CHILD_PROCESS_INIT;
+
+ strvec_pushl(&cmd.args, retry_hook, question, NULL);
+ return !run_command(&cmd);
}
if (!isatty(_fileno(stdin)) || !isatty(_fileno(stderr)))
@@ -1393,8 +1403,7 @@ static wchar_t *make_environment_block(char **deltaenv)
p += s;
}
- ALLOC_ARRAY(result, size);
- COPY_ARRAY(result, wenv, size);
+ DUP_ARRAY(result, wenv, size);
FreeEnvironmentStringsW(wenv);
return result;
}
@@ -1836,16 +1845,13 @@ static int try_shell_exec(const char *cmd, char *const *argv)
if (prog) {
int exec_id;
int argc = 0;
-#ifndef _MSC_VER
- const
-#endif
char **argv2;
while (argv[argc]) argc++;
ALLOC_ARRAY(argv2, argc + 1);
argv2[0] = (char *)cmd; /* full path to the script file */
COPY_ARRAY(&argv2[1], &argv[1], argc);
- exec_id = trace2_exec(prog, argv2);
- pid = mingw_spawnv(prog, argv2, 1);
+ exec_id = trace2_exec(prog, (const char **)argv2);
+ pid = mingw_spawnv(prog, (const char **)argv2, 1);
if (pid >= 0) {
int status;
if (waitpid(pid, &status, 0) < 0)
@@ -2749,7 +2755,7 @@ int is_path_owned_by_current_sid(const char *path, struct strbuf *report)
/*
* On FAT32 volumes, ownership is not actually recorded.
*/
- strbuf_addf(report, "'%s' is on a file system that does"
+ strbuf_addf(report, "'%s' is on a file system that does "
"not record ownership\n", path);
} else if (report) {
LPSTR str1, str2, to_free1 = NULL, to_free2 = NULL;
diff --git a/compat/nonblock.c b/compat/nonblock.c
index 9694ebdb1d..5b51195c32 100644
--- a/compat/nonblock.c
+++ b/compat/nonblock.c
@@ -41,7 +41,7 @@ int enable_pipe_nonblock(int fd)
#else
-int enable_pipe_nonblock(int fd)
+int enable_pipe_nonblock(int fd UNUSED)
{
errno = ENOSYS;
return -1;
diff --git a/compat/pread.c b/compat/pread.c
index 978cac4ec9..484e6d4c71 100644
--- a/compat/pread.c
+++ b/compat/pread.c
@@ -1,4 +1,5 @@
#include "../git-compat-util.h"
+#include "../wrapper.h"
ssize_t git_pread(int fd, void *buf, size_t count, off_t offset)
{
diff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c
index cce1d57a46..a4d11376ba 100644
--- a/compat/precompose_utf8.c
+++ b/compat/precompose_utf8.c
@@ -7,6 +7,9 @@
#include "cache.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "path.h"
#include "utf8.h"
#include "precompose_utf8.h"
diff --git a/compat/regcomp_enhanced.c b/compat/regcomp_enhanced.c
new file mode 100644
index 0000000000..84193ce53b
--- /dev/null
+++ b/compat/regcomp_enhanced.c
@@ -0,0 +1,9 @@
+#include "../git-compat-util.h"
+#undef regcomp
+
+int git_regcomp(regex_t *preg, const char *pattern, int cflags)
+{
+ if (!(cflags & REG_EXTENDED))
+ cflags |= REG_ENHANCED;
+ return regcomp(preg, pattern, cflags);
+}
diff --git a/compat/simple-ipc/ipc-shared.c b/compat/simple-ipc/ipc-shared.c
index 1b9d359ab6..e5e1dda8cc 100644
--- a/compat/simple-ipc/ipc-shared.c
+++ b/compat/simple-ipc/ipc-shared.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "simple-ipc.h"
#include "strbuf.h"
#include "pkt-line.h"
diff --git a/compat/simple-ipc/ipc-unix-socket.c b/compat/simple-ipc/ipc-unix-socket.c
index 28a79289d4..b2f4f22ce4 100644
--- a/compat/simple-ipc/ipc-unix-socket.c
+++ b/compat/simple-ipc/ipc-unix-socket.c
@@ -1,8 +1,10 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
#include "simple-ipc.h"
#include "strbuf.h"
#include "pkt-line.h"
#include "thread-utils.h"
+#include "trace2.h"
#include "unix-socket.h"
#include "unix-stream-server.h"
diff --git a/compat/simple-ipc/ipc-win32.c b/compat/simple-ipc/ipc-win32.c
index 20ea7b65e0..6adce3c650 100644
--- a/compat/simple-ipc/ipc-win32.c
+++ b/compat/simple-ipc/ipc-win32.c
@@ -1,8 +1,12 @@
#include "cache.h"
+#include "abspath.h"
+#include "gettext.h"
#include "simple-ipc.h"
#include "strbuf.h"
#include "pkt-line.h"
#include "thread-utils.h"
+#include "trace.h"
+#include "trace2.h"
#include "accctrl.h"
#include "aclapi.h"
diff --git a/compat/terminal.c b/compat/terminal.c
index ea490a7ced..d87e321189 100644
--- a/compat/terminal.c
+++ b/compat/terminal.c
@@ -1,10 +1,12 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "compat/terminal.h"
+#include "gettext.h"
#include "sigchain.h"
#include "strbuf.h"
#include "run-command.h"
#include "string-list.h"
#include "hashmap.h"
+#include "wrapper.h"
#if defined(HAVE_DEV_TTY) || defined(GIT_WINDOWS_NATIVE)
diff --git a/compat/win32/pthread.c b/compat/win32/pthread.c
index 2e7eead42c..85f8f7920c 100644
--- a/compat/win32/pthread.c
+++ b/compat/win32/pthread.c
@@ -22,12 +22,12 @@ static unsigned __stdcall win32_start_routine(void *arg)
}
int pthread_create(pthread_t *thread, const void *unused,
- void *(*start_routine)(void*), void *arg)
+ void *(*start_routine)(void *), void *arg)
{
thread->arg = arg;
thread->start_routine = start_routine;
- thread->handle = (HANDLE)
- _beginthreadex(NULL, 0, win32_start_routine, thread, 0, NULL);
+ thread->handle = (HANDLE)_beginthreadex(NULL, 0, win32_start_routine,
+ thread, 0, NULL);
if (!thread->handle)
return errno;
@@ -39,14 +39,17 @@ int win32_pthread_join(pthread_t *thread, void **value_ptr)
{
DWORD result = WaitForSingleObject(thread->handle, INFINITE);
switch (result) {
- case WAIT_OBJECT_0:
- if (value_ptr)
- *value_ptr = thread->arg;
- return 0;
- case WAIT_ABANDONED:
- return EINVAL;
- default:
- return err_win_to_posix(GetLastError());
+ case WAIT_OBJECT_0:
+ if (value_ptr)
+ *value_ptr = thread->arg;
+ CloseHandle(thread->handle);
+ return 0;
+ case WAIT_ABANDONED:
+ CloseHandle(thread->handle);
+ return EINVAL;
+ default:
+ /* the wait failed, so do not detach */
+ return err_win_to_posix(GetLastError());
}
}
diff --git a/compat/win32/pthread.h b/compat/win32/pthread.h
index 737983d00b..cc3221cb2c 100644
--- a/compat/win32/pthread.h
+++ b/compat/win32/pthread.h
@@ -66,7 +66,7 @@ pthread_t pthread_self(void);
static inline void NORETURN pthread_exit(void *ret)
{
- ExitThread((DWORD)(intptr_t)ret);
+ _endthreadex((unsigned)(uintptr_t)ret);
}
typedef DWORD pthread_key_t;
diff --git a/compat/win32/trace2_win32_process_info.c b/compat/win32/trace2_win32_process_info.c
index a53fd92434..a4e33768f4 100644
--- a/compat/win32/trace2_win32_process_info.c
+++ b/compat/win32/trace2_win32_process_info.c
@@ -1,5 +1,7 @@
#include "../../cache.h"
#include "../../json-writer.h"
+#include "../../repository.h"
+#include "../../trace2.h"
#include "lazyload.h"
#include <Psapi.h>
#include <tlHelp32.h>
diff --git a/compat/winansi.c b/compat/winansi.c
index 3abe8dd5a2..f83610f684 100644
--- a/compat/winansi.c
+++ b/compat/winansi.c
@@ -644,7 +644,7 @@ void winansi_init(void)
/* start console spool thread on the pipe's read end */
hthread = CreateThread(NULL, 0, console_thread, NULL, 0, NULL);
- if (hthread == INVALID_HANDLE_VALUE)
+ if (!hthread)
die_lasterr("CreateThread(console_thread) failed");
/* schedule cleanup routine */
diff --git a/config.c b/config.c
index 9eb9ed5fa4..b79baf83e3 100644
--- a/config.c
+++ b/config.c
@@ -5,24 +5,39 @@
* Copyright (C) Johannes Schindelin, 2005
*
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "advice.h"
+#include "alloc.h"
#include "date.h"
#include "branch.h"
#include "config.h"
+#include "convert.h"
#include "environment.h"
+#include "gettext.h"
+#include "ident.h"
#include "repository.h"
#include "lockfile.h"
+#include "mailmap.h"
#include "exec-cmd.h"
#include "strbuf.h"
#include "quote.h"
#include "hashmap.h"
#include "string-list.h"
+#include "object-name.h"
#include "object-store.h"
+#include "pager.h"
#include "utf8.h"
#include "dir.h"
#include "color.h"
+#include "replace-object.h"
#include "refs.h"
+#include "setup.h"
+#include "trace2.h"
#include "worktree.h"
+#include "ws.h"
+#include "wrapper.h"
+#include "write-or-die.h"
struct config_source {
struct config_source *prev;
@@ -49,34 +64,79 @@ struct config_source {
int (*do_ungetc)(int c, struct config_source *conf);
long (*do_ftell)(struct config_source *c);
};
+#define CONFIG_SOURCE_INIT { 0 }
+struct config_reader {
+ /*
+ * These members record the "current" config source, which can be
+ * accessed by parsing callbacks.
+ *
+ * The "source" variable will be non-NULL only when we are actually
+ * parsing a real config source (file, blob, cmdline, etc).
+ *
+ * The "config_kvi" variable will be non-NULL only when we are feeding
+ * cached config from a configset into a callback.
+ *
+ * They cannot be non-NULL at the same time. If they are both NULL, then
+ * we aren't parsing anything (and depending on the function looking at
+ * the variables, it's either a bug for it to be called in the first
+ * place, or it's a function which can be reused for non-config
+ * purposes, and should fall back to some sane behavior).
+ */
+ struct config_source *source;
+ struct key_value_info *config_kvi;
+ /*
+ * The "scope" of the current config source being parsed (repo, global,
+ * etc). Like "source", this is only set when parsing a config source.
+ * It's not part of "source" because it transcends a single file (i.e.,
+ * a file included from .git/config is still in "repo" scope).
+ *
+ * When iterating through a configset, the equivalent value is
+ * "config_kvi.scope" (see above).
+ */
+ enum config_scope parsing_scope;
+};
/*
- * These variables record the "current" config source, which
- * can be accessed by parsing callbacks.
- *
- * The "cf" variable will be non-NULL only when we are actually parsing a real
- * config source (file, blob, cmdline, etc).
- *
- * The "current_config_kvi" variable will be non-NULL only when we are feeding
- * cached config from a configset into a callback.
- *
- * They should generally never be non-NULL at the same time. If they are both
- * NULL, then we aren't parsing anything (and depending on the function looking
- * at the variables, it's either a bug for it to be called in the first place,
- * or it's a function which can be reused for non-config purposes, and should
- * fall back to some sane behavior).
+ * Where possible, prefer to accept "struct config_reader" as an arg than to use
+ * "the_reader". "the_reader" should only be used if that is infeasible, e.g. in
+ * a public function.
*/
-static struct config_source *cf;
-static struct key_value_info *current_config_kvi;
+static struct config_reader the_reader;
-/*
- * Similar to the variables above, this gives access to the "scope" of the
- * current value (repo, global, etc). For cached values, it can be found via
- * the current_config_kvi as above. During parsing, the current value can be
- * found in this variable. It's not part of "cf" because it transcends a single
- * file (i.e., a file included from .git/config is still in "repo" scope).
- */
-static enum config_scope current_parsing_scope;
+static inline void config_reader_push_source(struct config_reader *reader,
+ struct config_source *top)
+{
+ if (reader->config_kvi)
+ BUG("source should not be set while iterating a config set");
+ top->prev = reader->source;
+ reader->source = top;
+}
+
+static inline struct config_source *config_reader_pop_source(struct config_reader *reader)
+{
+ struct config_source *ret;
+ if (!reader->source)
+ BUG("tried to pop config source, but we weren't reading config");
+ ret = reader->source;
+ reader->source = reader->source->prev;
+ return ret;
+}
+
+static inline void config_reader_set_kvi(struct config_reader *reader,
+ struct key_value_info *kvi)
+{
+ if (kvi && (reader->source || reader->parsing_scope))
+ BUG("kvi should not be set while parsing a config source");
+ reader->config_kvi = kvi;
+}
+
+static inline void config_reader_set_scope(struct config_reader *reader,
+ enum config_scope scope)
+{
+ if (scope && reader->config_kvi)
+ BUG("scope should only be set when iterating through a config source");
+ reader->parsing_scope = scope;
+}
static int pack_compression_seen;
static int zlib_compression_seen;
@@ -139,6 +199,7 @@ struct config_include_data {
void *data;
const struct config_options *opts;
struct git_config_source *config_source;
+ struct config_reader *config_reader;
/*
* All remote URLs discovered when reading all config files.
@@ -156,7 +217,8 @@ static const char include_depth_advice[] = N_(
"from\n"
" %s\n"
"This might be due to circular includes.");
-static int handle_path_include(const char *path, struct config_include_data *inc)
+static int handle_path_include(struct config_source *cs, const char *path,
+ struct config_include_data *inc)
{
int ret = 0;
struct strbuf buf = STRBUF_INIT;
@@ -177,14 +239,14 @@ static int handle_path_include(const char *path, struct config_include_data *inc
if (!is_absolute_path(path)) {
char *slash;
- if (!cf || !cf->path) {
+ if (!cs || !cs->path) {
ret = error(_("relative config includes must come from files"));
goto cleanup;
}
- slash = find_last_dir_sep(cf->path);
+ slash = find_last_dir_sep(cs->path);
if (slash)
- strbuf_add(&buf, cf->path, slash - cf->path + 1);
+ strbuf_add(&buf, cs->path, slash - cs->path + 1);
strbuf_addstr(&buf, path);
path = buf.buf;
}
@@ -192,8 +254,8 @@ static int handle_path_include(const char *path, struct config_include_data *inc
if (!access_or_die(path, R_OK, 0)) {
if (++inc->depth > MAX_INCLUDE_DEPTH)
die(_(include_depth_advice), MAX_INCLUDE_DEPTH, path,
- !cf ? "<unknown>" :
- cf->name ? cf->name :
+ !cs ? "<unknown>" :
+ cs->name ? cs->name :
"the command line");
ret = git_config_from_file(git_config_include, path, inc);
inc->depth--;
@@ -210,7 +272,8 @@ static void add_trailing_starstar_for_dir(struct strbuf *pat)
strbuf_addstr(pat, "**");
}
-static int prepare_include_condition_pattern(struct strbuf *pat)
+static int prepare_include_condition_pattern(struct config_source *cs,
+ struct strbuf *pat)
{
struct strbuf path = STRBUF_INIT;
char *expanded;
@@ -226,11 +289,11 @@ static int prepare_include_condition_pattern(struct strbuf *pat)
if (pat->buf[0] == '.' && is_dir_sep(pat->buf[1])) {
const char *slash;
- if (!cf || !cf->path)
+ if (!cs || !cs->path)
return error(_("relative config include "
"conditionals must come from files"));
- strbuf_realpath(&path, cf->path, 1);
+ strbuf_realpath(&path, cs->path, 1);
slash = find_last_dir_sep(path.buf);
if (!slash)
BUG("how is this possible?");
@@ -245,7 +308,8 @@ static int prepare_include_condition_pattern(struct strbuf *pat)
return prefix;
}
-static int include_by_gitdir(const struct config_options *opts,
+static int include_by_gitdir(struct config_source *cs,
+ const struct config_options *opts,
const char *cond, size_t cond_len, int icase)
{
struct strbuf text = STRBUF_INIT;
@@ -261,7 +325,7 @@ static int include_by_gitdir(const struct config_options *opts,
strbuf_realpath(&text, git_dir, 1);
strbuf_add(&pattern, cond, cond_len);
- prefix = prepare_include_condition_pattern(&pattern);
+ prefix = prepare_include_condition_pattern(cs, &pattern);
again:
if (prefix < 0)
@@ -342,24 +406,18 @@ static void populate_remote_urls(struct config_include_data *inc)
{
struct config_options opts;
- struct config_source *store_cf = cf;
- struct key_value_info *store_kvi = current_config_kvi;
- enum config_scope store_scope = current_parsing_scope;
+ enum config_scope store_scope = inc->config_reader->parsing_scope;
opts = *inc->opts;
opts.unconditional_remote_url = 1;
- cf = NULL;
- current_config_kvi = NULL;
- current_parsing_scope = 0;
+ config_reader_set_scope(inc->config_reader, 0);
inc->remote_urls = xmalloc(sizeof(*inc->remote_urls));
string_list_init_dup(inc->remote_urls);
config_with_options(add_remote_url, inc->remote_urls, inc->config_source, &opts);
- cf = store_cf;
- current_config_kvi = store_kvi;
- current_parsing_scope = store_scope;
+ config_reader_set_scope(inc->config_reader, store_scope);
}
static int forbid_remote_url(const char *var, const char *value UNUSED,
@@ -406,15 +464,16 @@ static int include_by_remote_url(struct config_include_data *inc,
inc->remote_urls);
}
-static int include_condition_is_true(struct config_include_data *inc,
+static int include_condition_is_true(struct config_source *cs,
+ struct config_include_data *inc,
const char *cond, size_t cond_len)
{
const struct config_options *opts = inc->opts;
if (skip_prefix_mem(cond, cond_len, "gitdir:", &cond, &cond_len))
- return include_by_gitdir(opts, cond, cond_len, 0);
+ return include_by_gitdir(cs, opts, cond, cond_len, 0);
else if (skip_prefix_mem(cond, cond_len, "gitdir/i:", &cond, &cond_len))
- return include_by_gitdir(opts, cond, cond_len, 1);
+ return include_by_gitdir(cs, opts, cond, cond_len, 1);
else if (skip_prefix_mem(cond, cond_len, "onbranch:", &cond, &cond_len))
return include_by_branch(cond, cond_len);
else if (skip_prefix_mem(cond, cond_len, "hasconfig:remote.*.url:", &cond,
@@ -428,6 +487,7 @@ static int include_condition_is_true(struct config_include_data *inc,
static int git_config_include(const char *var, const char *value, void *data)
{
struct config_include_data *inc = data;
+ struct config_source *cs = inc->config_reader->source;
const char *cond, *key;
size_t cond_len;
int ret;
@@ -441,16 +501,16 @@ static int git_config_include(const char *var, const char *value, void *data)
return ret;
if (!strcmp(var, "include.path"))
- ret = handle_path_include(value, inc);
+ ret = handle_path_include(cs, value, inc);
if (!parse_config_key(var, "includeif", &cond, &cond_len, &key) &&
- cond && include_condition_is_true(inc, cond, cond_len) &&
+ cond && include_condition_is_true(cs, inc, cond, cond_len) &&
!strcmp(key, "path")) {
config_fn_t old_fn = inc->fn;
if (inc->opts->unconditional_remote_url)
inc->fn = forbid_remote_url;
- ret = handle_path_include(value, inc);
+ ret = handle_path_include(cs, value, inc);
inc->fn = old_fn;
}
@@ -710,12 +770,10 @@ int git_config_from_parameters(config_fn_t fn, void *data)
struct strvec to_free = STRVEC_INIT;
int ret = 0;
char *envw = NULL;
- struct config_source source;
+ struct config_source source = CONFIG_SOURCE_INIT;
- memset(&source, 0, sizeof(source));
- source.prev = cf;
source.origin_type = CONFIG_ORIGIN_CMDLINE;
- cf = &source;
+ config_reader_push_source(&the_reader, &source);
env = getenv(CONFIG_COUNT_ENVIRONMENT);
if (env) {
@@ -773,25 +831,25 @@ out:
strbuf_release(&envvar);
strvec_clear(&to_free);
free(envw);
- cf = source.prev;
+ config_reader_pop_source(&the_reader);
return ret;
}
-static int get_next_char(void)
+static int get_next_char(struct config_source *cs)
{
- int c = cf->do_fgetc(cf);
+ int c = cs->do_fgetc(cs);
if (c == '\r') {
/* DOS like systems */
- c = cf->do_fgetc(cf);
+ c = cs->do_fgetc(cs);
if (c != '\n') {
if (c != EOF)
- cf->do_ungetc(c, cf);
+ cs->do_ungetc(c, cs);
c = '\r';
}
}
- if (c != EOF && ++cf->total_len > INT_MAX) {
+ if (c != EOF && ++cs->total_len > INT_MAX) {
/*
* This is an absurdly long config file; refuse to parse
* further in order to protect downstream code from integer
@@ -799,38 +857,38 @@ static int get_next_char(void)
* but we can mark EOF and put trash in the return value,
* which will trigger a parse error.
*/
- cf->eof = 1;
+ cs->eof = 1;
return 0;
}
if (c == '\n')
- cf->linenr++;
+ cs->linenr++;
if (c == EOF) {
- cf->eof = 1;
- cf->linenr++;
+ cs->eof = 1;
+ cs->linenr++;
c = '\n';
}
return c;
}
-static char *parse_value(void)
+static char *parse_value(struct config_source *cs)
{
int quote = 0, comment = 0, space = 0;
- strbuf_reset(&cf->value);
+ strbuf_reset(&cs->value);
for (;;) {
- int c = get_next_char();
+ int c = get_next_char(cs);
if (c == '\n') {
if (quote) {
- cf->linenr--;
+ cs->linenr--;
return NULL;
}
- return cf->value.buf;
+ return cs->value.buf;
}
if (comment)
continue;
if (isspace(c) && !quote) {
- if (cf->value.len)
+ if (cs->value.len)
space++;
continue;
}
@@ -841,9 +899,9 @@ static char *parse_value(void)
}
}
for (; space; space--)
- strbuf_addch(&cf->value, ' ');
+ strbuf_addch(&cs->value, ' ');
if (c == '\\') {
- c = get_next_char();
+ c = get_next_char(cs);
switch (c) {
case '\n':
continue;
@@ -863,18 +921,19 @@ static char *parse_value(void)
default:
return NULL;
}
- strbuf_addch(&cf->value, c);
+ strbuf_addch(&cs->value, c);
continue;
}
if (c == '"') {
quote = 1-quote;
continue;
}
- strbuf_addch(&cf->value, c);
+ strbuf_addch(&cs->value, c);
}
}
-static int get_value(config_fn_t fn, void *data, struct strbuf *name)
+static int get_value(struct config_source *cs, config_fn_t fn, void *data,
+ struct strbuf *name)
{
int c;
char *value;
@@ -882,8 +941,8 @@ static int get_value(config_fn_t fn, void *data, struct strbuf *name)
/* Get the full name */
for (;;) {
- c = get_next_char();
- if (cf->eof)
+ c = get_next_char(cs);
+ if (cs->eof)
break;
if (!iskeychar(c))
break;
@@ -891,13 +950,13 @@ static int get_value(config_fn_t fn, void *data, struct strbuf *name)
}
while (c == ' ' || c == '\t')
- c = get_next_char();
+ c = get_next_char(cs);
value = NULL;
if (c != '\n') {
if (c != '=')
return -1;
- value = parse_value();
+ value = parse_value(cs);
if (!value)
return -1;
}
@@ -906,20 +965,21 @@ static int get_value(config_fn_t fn, void *data, struct strbuf *name)
* the line we just parsed during the call to fn to get
* accurate line number in error messages.
*/
- cf->linenr--;
+ cs->linenr--;
ret = fn(name->buf, value, data);
if (ret >= 0)
- cf->linenr++;
+ cs->linenr++;
return ret;
}
-static int get_extended_base_var(struct strbuf *name, int c)
+static int get_extended_base_var(struct config_source *cs, struct strbuf *name,
+ int c)
{
- cf->subsection_case_sensitive = 0;
+ cs->subsection_case_sensitive = 0;
do {
if (c == '\n')
goto error_incomplete_line;
- c = get_next_char();
+ c = get_next_char(cs);
} while (isspace(c));
/* We require the format to be '[base "extension"]' */
@@ -928,13 +988,13 @@ static int get_extended_base_var(struct strbuf *name, int c)
strbuf_addch(name, '.');
for (;;) {
- int c = get_next_char();
+ int c = get_next_char(cs);
if (c == '\n')
goto error_incomplete_line;
if (c == '"')
break;
if (c == '\\') {
- c = get_next_char();
+ c = get_next_char(cs);
if (c == '\n')
goto error_incomplete_line;
}
@@ -942,25 +1002,25 @@ static int get_extended_base_var(struct strbuf *name, int c)
}
/* Final ']' */
- if (get_next_char() != ']')
+ if (get_next_char(cs) != ']')
return -1;
return 0;
error_incomplete_line:
- cf->linenr--;
+ cs->linenr--;
return -1;
}
-static int get_base_var(struct strbuf *name)
+static int get_base_var(struct config_source *cs, struct strbuf *name)
{
- cf->subsection_case_sensitive = 1;
+ cs->subsection_case_sensitive = 1;
for (;;) {
- int c = get_next_char();
- if (cf->eof)
+ int c = get_next_char(cs);
+ if (cs->eof)
return -1;
if (c == ']')
return 0;
if (isspace(c))
- return get_extended_base_var(name, c);
+ return get_extended_base_var(cs, name, c);
if (!iskeychar(c) && c != '.')
return -1;
strbuf_addch(name, tolower(c));
@@ -973,7 +1033,8 @@ struct parse_event_data {
const struct config_options *opts;
};
-static int do_event(enum config_event_t type, struct parse_event_data *data)
+static int do_event(struct config_source *cs, enum config_event_t type,
+ struct parse_event_data *data)
{
size_t offset;
@@ -984,7 +1045,7 @@ static int do_event(enum config_event_t type, struct parse_event_data *data)
data->previous_type == type)
return 0;
- offset = cf->do_ftell(cf);
+ offset = cs->do_ftell(cs);
/*
* At EOF, the parser always "inserts" an extra '\n', therefore
* the end offset of the event is the current file position, otherwise
@@ -1004,12 +1065,12 @@ static int do_event(enum config_event_t type, struct parse_event_data *data)
return 0;
}
-static int git_parse_source(config_fn_t fn, void *data,
- const struct config_options *opts)
+static int git_parse_source(struct config_source *cs, config_fn_t fn,
+ void *data, const struct config_options *opts)
{
int comment = 0;
size_t baselen = 0;
- struct strbuf *var = &cf->var;
+ struct strbuf *var = &cs->var;
int error_return = 0;
char *error_msg = NULL;
@@ -1024,7 +1085,7 @@ static int git_parse_source(config_fn_t fn, void *data,
for (;;) {
int c;
- c = get_next_char();
+ c = get_next_char(cs);
if (bomptr && *bomptr) {
/* We are at the file beginning; skip UTF8-encoded BOM
* if present. Sane editors won't put this in on their
@@ -1041,12 +1102,12 @@ static int git_parse_source(config_fn_t fn, void *data,
}
}
if (c == '\n') {
- if (cf->eof) {
- if (do_event(CONFIG_EVENT_EOF, &event_data) < 0)
+ if (cs->eof) {
+ if (do_event(cs, CONFIG_EVENT_EOF, &event_data) < 0)
return -1;
return 0;
}
- if (do_event(CONFIG_EVENT_WHITESPACE, &event_data) < 0)
+ if (do_event(cs, CONFIG_EVENT_WHITESPACE, &event_data) < 0)
return -1;
comment = 0;
continue;
@@ -1054,23 +1115,23 @@ static int git_parse_source(config_fn_t fn, void *data,
if (comment)
continue;
if (isspace(c)) {
- if (do_event(CONFIG_EVENT_WHITESPACE, &event_data) < 0)
+ if (do_event(cs, CONFIG_EVENT_WHITESPACE, &event_data) < 0)
return -1;
continue;
}
if (c == '#' || c == ';') {
- if (do_event(CONFIG_EVENT_COMMENT, &event_data) < 0)
+ if (do_event(cs, CONFIG_EVENT_COMMENT, &event_data) < 0)
return -1;
comment = 1;
continue;
}
if (c == '[') {
- if (do_event(CONFIG_EVENT_SECTION, &event_data) < 0)
+ if (do_event(cs, CONFIG_EVENT_SECTION, &event_data) < 0)
return -1;
/* Reset prior to determining a new stem */
strbuf_reset(var);
- if (get_base_var(var) < 0 || var->len < 1)
+ if (get_base_var(cs, var) < 0 || var->len < 1)
break;
strbuf_addch(var, '.');
baselen = var->len;
@@ -1079,7 +1140,7 @@ static int git_parse_source(config_fn_t fn, void *data,
if (!isalpha(c))
break;
- if (do_event(CONFIG_EVENT_ENTRY, &event_data) < 0)
+ if (do_event(cs, CONFIG_EVENT_ENTRY, &event_data) < 0)
return -1;
/*
@@ -1089,42 +1150,42 @@ static int git_parse_source(config_fn_t fn, void *data,
*/
strbuf_setlen(var, baselen);
strbuf_addch(var, tolower(c));
- if (get_value(fn, data, var) < 0)
+ if (get_value(cs, fn, data, var) < 0)
break;
}
- if (do_event(CONFIG_EVENT_ERROR, &event_data) < 0)
+ if (do_event(cs, CONFIG_EVENT_ERROR, &event_data) < 0)
return -1;
- switch (cf->origin_type) {
+ switch (cs->origin_type) {
case CONFIG_ORIGIN_BLOB:
error_msg = xstrfmt(_("bad config line %d in blob %s"),
- cf->linenr, cf->name);
+ cs->linenr, cs->name);
break;
case CONFIG_ORIGIN_FILE:
error_msg = xstrfmt(_("bad config line %d in file %s"),
- cf->linenr, cf->name);
+ cs->linenr, cs->name);
break;
case CONFIG_ORIGIN_STDIN:
error_msg = xstrfmt(_("bad config line %d in standard input"),
- cf->linenr);
+ cs->linenr);
break;
case CONFIG_ORIGIN_SUBMODULE_BLOB:
error_msg = xstrfmt(_("bad config line %d in submodule-blob %s"),
- cf->linenr, cf->name);
+ cs->linenr, cs->name);
break;
case CONFIG_ORIGIN_CMDLINE:
error_msg = xstrfmt(_("bad config line %d in command line %s"),
- cf->linenr, cf->name);
+ cs->linenr, cs->name);
break;
default:
error_msg = xstrfmt(_("bad config line %d in %s"),
- cf->linenr, cf->name);
+ cs->linenr, cs->name);
}
switch (opts && opts->error_action ?
opts->error_action :
- cf->default_error_action) {
+ cs->default_error_action) {
case CONFIG_ERROR_DIE:
die("%s", error_msg);
break;
@@ -1160,21 +1221,26 @@ static int git_parse_signed(const char *value, intmax_t *ret, intmax_t max)
if (value && *value) {
char *end;
intmax_t val;
- uintmax_t uval;
- uintmax_t factor;
+ intmax_t factor;
+
+ if (max < 0)
+ BUG("max must be a positive integer");
errno = 0;
val = strtoimax(value, &end, 0);
if (errno == ERANGE)
return 0;
+ if (end == value) {
+ errno = EINVAL;
+ return 0;
+ }
factor = get_unit_factor(end);
if (!factor) {
errno = EINVAL;
return 0;
}
- uval = val < 0 ? -val : val;
- if (unsigned_mult_overflows(factor, uval) ||
- factor * uval > max) {
+ if ((val < 0 && -max / factor > val) ||
+ (val > 0 && max / factor < val)) {
errno = ERANGE;
return 0;
}
@@ -1193,10 +1259,19 @@ static int git_parse_unsigned(const char *value, uintmax_t *ret, uintmax_t max)
uintmax_t val;
uintmax_t factor;
+ /* negative values would be accepted by strtoumax */
+ if (strchr(value, '-')) {
+ errno = EINVAL;
+ return 0;
+ }
errno = 0;
val = strtoumax(value, &end, 0);
if (errno == ERANGE)
return 0;
+ if (end == value) {
+ errno = EINVAL;
+ return 0;
+ }
factor = get_unit_factor(end);
if (!factor) {
errno = EINVAL;
@@ -1215,7 +1290,7 @@ static int git_parse_unsigned(const char *value, uintmax_t *ret, uintmax_t max)
return 0;
}
-static int git_parse_int(const char *value, int *ret)
+int git_parse_int(const char *value, int *ret)
{
intmax_t tmp;
if (!git_parse_signed(value, &tmp, maximum_signed_value_of_type(int)))
@@ -1251,38 +1326,48 @@ int git_parse_ssize_t(const char *value, ssize_t *ret)
return 1;
}
+static int reader_config_name(struct config_reader *reader, const char **out);
+static int reader_origin_type(struct config_reader *reader,
+ enum config_origin_type *type);
NORETURN
-static void die_bad_number(const char *name, const char *value)
+static void die_bad_number(struct config_reader *reader, const char *name,
+ const char *value)
{
const char *error_type = (errno == ERANGE) ?
N_("out of range") : N_("invalid unit");
const char *bad_numeric = N_("bad numeric config value '%s' for '%s': %s");
+ const char *config_name = NULL;
+ enum config_origin_type config_origin = CONFIG_ORIGIN_UNKNOWN;
if (!value)
value = "";
- if (!(cf && cf->name))
+ /* Ignoring the return value is okay since we handle missing values. */
+ reader_config_name(reader, &config_name);
+ reader_origin_type(reader, &config_origin);
+
+ if (!config_name)
die(_(bad_numeric), value, name, _(error_type));
- switch (cf->origin_type) {
+ switch (config_origin) {
case CONFIG_ORIGIN_BLOB:
die(_("bad numeric config value '%s' for '%s' in blob %s: %s"),
- value, name, cf->name, _(error_type));
+ value, name, config_name, _(error_type));
case CONFIG_ORIGIN_FILE:
die(_("bad numeric config value '%s' for '%s' in file %s: %s"),
- value, name, cf->name, _(error_type));
+ value, name, config_name, _(error_type));
case CONFIG_ORIGIN_STDIN:
die(_("bad numeric config value '%s' for '%s' in standard input: %s"),
value, name, _(error_type));
case CONFIG_ORIGIN_SUBMODULE_BLOB:
die(_("bad numeric config value '%s' for '%s' in submodule-blob %s: %s"),
- value, name, cf->name, _(error_type));
+ value, name, config_name, _(error_type));
case CONFIG_ORIGIN_CMDLINE:
die(_("bad numeric config value '%s' for '%s' in command line %s: %s"),
- value, name, cf->name, _(error_type));
+ value, name, config_name, _(error_type));
default:
die(_("bad numeric config value '%s' for '%s' in %s: %s"),
- value, name, cf->name, _(error_type));
+ value, name, config_name, _(error_type));
}
}
@@ -1290,7 +1375,7 @@ int git_config_int(const char *name, const char *value)
{
int ret;
if (!git_parse_int(value, &ret))
- die_bad_number(name, value);
+ die_bad_number(&the_reader, name, value);
return ret;
}
@@ -1298,7 +1383,7 @@ int64_t git_config_int64(const char *name, const char *value)
{
int64_t ret;
if (!git_parse_int64(value, &ret))
- die_bad_number(name, value);
+ die_bad_number(&the_reader, name, value);
return ret;
}
@@ -1306,7 +1391,7 @@ unsigned long git_config_ulong(const char *name, const char *value)
{
unsigned long ret;
if (!git_parse_ulong(value, &ret))
- die_bad_number(name, value);
+ die_bad_number(&the_reader, name, value);
return ret;
}
@@ -1314,7 +1399,7 @@ ssize_t git_config_ssize_t(const char *name, const char *value)
{
ssize_t ret;
if (!git_parse_ssize_t(value, &ret))
- die_bad_number(name, value);
+ die_bad_number(&the_reader, name, value);
return ret;
}
@@ -1669,7 +1754,7 @@ static int git_default_core_config(const char *var, const char *value, void *cb)
comment_line_char = value[0];
auto_comment_line_char = 0;
} else
- return error(_("core.commentChar should only be one character"));
+ return error(_("core.commentChar should only be one ASCII character"));
return 0;
}
@@ -1920,36 +2005,37 @@ int git_default_config(const char *var, const char *value, void *cb)
* fgetc, ungetc, ftell of top need to be initialized before calling
* this function.
*/
-static int do_config_from(struct config_source *top, config_fn_t fn, void *data,
+static int do_config_from(struct config_reader *reader,
+ struct config_source *top, config_fn_t fn, void *data,
const struct config_options *opts)
{
int ret;
/* push config-file parsing state stack */
- top->prev = cf;
top->linenr = 1;
top->eof = 0;
top->total_len = 0;
strbuf_init(&top->value, 1024);
strbuf_init(&top->var, 1024);
- cf = top;
+ config_reader_push_source(reader, top);
- ret = git_parse_source(fn, data, opts);
+ ret = git_parse_source(top, fn, data, opts);
/* pop config-file parsing state stack */
strbuf_release(&top->value);
strbuf_release(&top->var);
- cf = top->prev;
+ config_reader_pop_source(reader);
return ret;
}
-static int do_config_from_file(config_fn_t fn,
- const enum config_origin_type origin_type,
- const char *name, const char *path, FILE *f,
- void *data, const struct config_options *opts)
+static int do_config_from_file(struct config_reader *reader,
+ config_fn_t fn,
+ const enum config_origin_type origin_type,
+ const char *name, const char *path, FILE *f,
+ void *data, const struct config_options *opts)
{
- struct config_source top;
+ struct config_source top = CONFIG_SOURCE_INIT;
int ret;
top.u.file = f;
@@ -1962,15 +2048,15 @@ static int do_config_from_file(config_fn_t fn,
top.do_ftell = config_file_ftell;
flockfile(f);
- ret = do_config_from(&top, fn, data, opts);
+ ret = do_config_from(reader, &top, fn, data, opts);
funlockfile(f);
return ret;
}
static int git_config_from_stdin(config_fn_t fn, void *data)
{
- return do_config_from_file(fn, CONFIG_ORIGIN_STDIN, "", NULL, stdin,
- data, NULL);
+ return do_config_from_file(&the_reader, fn, CONFIG_ORIGIN_STDIN, "",
+ NULL, stdin, data, NULL);
}
int git_config_from_file_with_options(config_fn_t fn, const char *filename,
@@ -1984,8 +2070,8 @@ int git_config_from_file_with_options(config_fn_t fn, const char *filename,
BUG("filename cannot be NULL");
f = fopen_or_warn(filename, "r");
if (f) {
- ret = do_config_from_file(fn, CONFIG_ORIGIN_FILE, filename,
- filename, f, data, opts);
+ ret = do_config_from_file(&the_reader, fn, CONFIG_ORIGIN_FILE,
+ filename, filename, f, data, opts);
fclose(f);
}
return ret;
@@ -2001,7 +2087,7 @@ int git_config_from_mem(config_fn_t fn,
const char *name, const char *buf, size_t len,
void *data, const struct config_options *opts)
{
- struct config_source top;
+ struct config_source top = CONFIG_SOURCE_INIT;
top.u.buf.buf = buf;
top.u.buf.len = len;
@@ -2014,7 +2100,7 @@ int git_config_from_mem(config_fn_t fn,
top.do_ungetc = config_buf_ungetc;
top.do_ftell = config_buf_ftell;
- return do_config_from(&top, fn, data, opts);
+ return do_config_from(&the_reader, &top, fn, data, opts);
}
int git_config_from_blob_oid(config_fn_t fn,
@@ -2105,7 +2191,8 @@ int git_config_system(void)
return !git_env_bool("GIT_CONFIG_NOSYSTEM", 0);
}
-static int do_git_config_sequence(const struct config_options *opts,
+static int do_git_config_sequence(struct config_reader *reader,
+ const struct config_options *opts,
config_fn_t fn, void *data)
{
int ret = 0;
@@ -2113,7 +2200,7 @@ static int do_git_config_sequence(const struct config_options *opts,
char *xdg_config = NULL;
char *user_config = NULL;
char *repo_config;
- enum config_scope prev_parsing_scope = current_parsing_scope;
+ enum config_scope prev_parsing_scope = reader->parsing_scope;
if (opts->commondir)
repo_config = mkpathdup("%s/config", opts->commondir);
@@ -2122,13 +2209,13 @@ static int do_git_config_sequence(const struct config_options *opts,
else
repo_config = NULL;
- current_parsing_scope = CONFIG_SCOPE_SYSTEM;
+ config_reader_set_scope(reader, CONFIG_SCOPE_SYSTEM);
if (git_config_system() && system_config &&
!access_or_die(system_config, R_OK,
opts->system_gently ? ACCESS_EACCES_OK : 0))
ret += git_config_from_file(fn, system_config, data);
- current_parsing_scope = CONFIG_SCOPE_GLOBAL;
+ config_reader_set_scope(reader, CONFIG_SCOPE_GLOBAL);
git_global_config(&user_config, &xdg_config);
if (xdg_config && !access_or_die(xdg_config, R_OK, ACCESS_EACCES_OK))
@@ -2137,12 +2224,12 @@ static int do_git_config_sequence(const struct config_options *opts,
if (user_config && !access_or_die(user_config, R_OK, ACCESS_EACCES_OK))
ret += git_config_from_file(fn, user_config, data);
- current_parsing_scope = CONFIG_SCOPE_LOCAL;
+ config_reader_set_scope(reader, CONFIG_SCOPE_LOCAL);
if (!opts->ignore_repo && repo_config &&
!access_or_die(repo_config, R_OK, 0))
ret += git_config_from_file(fn, repo_config, data);
- current_parsing_scope = CONFIG_SCOPE_WORKTREE;
+ config_reader_set_scope(reader, CONFIG_SCOPE_WORKTREE);
if (!opts->ignore_worktree && repository_format_worktree_config) {
char *path = git_pathdup("config.worktree");
if (!access_or_die(path, R_OK, 0))
@@ -2150,11 +2237,11 @@ static int do_git_config_sequence(const struct config_options *opts,
free(path);
}
- current_parsing_scope = CONFIG_SCOPE_COMMAND;
+ config_reader_set_scope(reader, CONFIG_SCOPE_COMMAND);
if (!opts->ignore_cmdline && git_config_from_parameters(fn, data) < 0)
die(_("unable to parse command-line config"));
- current_parsing_scope = prev_parsing_scope;
+ config_reader_set_scope(reader, prev_parsing_scope);
free(system_config);
free(xdg_config);
free(user_config);
@@ -2167,6 +2254,7 @@ int config_with_options(config_fn_t fn, void *data,
const struct config_options *opts)
{
struct config_include_data inc = CONFIG_INCLUDE_INIT;
+ enum config_scope prev_scope = the_reader.parsing_scope;
int ret;
if (opts->respect_includes) {
@@ -2174,12 +2262,13 @@ int config_with_options(config_fn_t fn, void *data,
inc.data = data;
inc.opts = opts;
inc.config_source = config_source;
+ inc.config_reader = &the_reader;
fn = git_config_include;
data = &inc;
}
if (config_source)
- current_parsing_scope = config_source->scope;
+ config_reader_set_scope(&the_reader, config_source->scope);
/*
* If we have a specific filename, use it. Otherwise, follow the
@@ -2195,36 +2284,38 @@ int config_with_options(config_fn_t fn, void *data,
ret = git_config_from_blob_ref(fn, repo, config_source->blob,
data);
} else {
- ret = do_git_config_sequence(opts, fn, data);
+ ret = do_git_config_sequence(&the_reader, opts, fn, data);
}
if (inc.remote_urls) {
string_list_clear(inc.remote_urls, 0);
FREE_AND_NULL(inc.remote_urls);
}
+ config_reader_set_scope(&the_reader, prev_scope);
return ret;
}
-static void configset_iter(struct config_set *cs, config_fn_t fn, void *data)
+static void configset_iter(struct config_reader *reader, struct config_set *set,
+ config_fn_t fn, void *data)
{
int i, value_index;
struct string_list *values;
struct config_set_element *entry;
- struct configset_list *list = &cs->list;
+ struct configset_list *list = &set->list;
for (i = 0; i < list->nr; i++) {
entry = list->items[i].e;
value_index = list->items[i].value_index;
values = &entry->value_list;
- current_config_kvi = values->items[value_index].util;
+ config_reader_set_kvi(reader, values->items[value_index].util);
if (fn(entry->key, values->items[value_index].string, data) < 0)
git_die_config_linenr(entry->key,
- current_config_kvi->filename,
- current_config_kvi->linenr);
+ reader->config_kvi->filename,
+ reader->config_kvi->linenr);
- current_config_kvi = NULL;
+ config_reader_set_kvi(reader, NULL);
}
}
@@ -2275,33 +2366,44 @@ void read_very_early_config(config_fn_t cb, void *data)
config_with_options(cb, data, NULL, &opts);
}
-static struct config_set_element *configset_find_element(struct config_set *cs, const char *key)
+RESULT_MUST_BE_USED
+static int configset_find_element(struct config_set *set, const char *key,
+ struct config_set_element **dest)
{
struct config_set_element k;
struct config_set_element *found_entry;
char *normalized_key;
+ int ret;
+
/*
* `key` may come from the user, so normalize it before using it
* for querying entries from the hashmap.
*/
- if (git_config_parse_key(key, &normalized_key, NULL))
- return NULL;
+ ret = git_config_parse_key(key, &normalized_key, NULL);
+ if (ret)
+ return ret;
hashmap_entry_init(&k.ent, strhash(normalized_key));
k.key = normalized_key;
- found_entry = hashmap_get_entry(&cs->config_hash, &k, ent, NULL);
+ found_entry = hashmap_get_entry(&set->config_hash, &k, ent, NULL);
free(normalized_key);
- return found_entry;
+ *dest = found_entry;
+ return 0;
}
-static int configset_add_value(struct config_set *cs, const char *key, const char *value)
+static int configset_add_value(struct config_reader *reader,
+ struct config_set *set, const char *key,
+ const char *value)
{
struct config_set_element *e;
struct string_list_item *si;
struct configset_list_item *l_item;
struct key_value_info *kv_info = xmalloc(sizeof(*kv_info));
+ int ret;
- e = configset_find_element(cs, key);
+ ret = configset_find_element(set, key, &e);
+ if (ret)
+ return ret;
/*
* Since the keys are being fed by git_config*() callback mechanism, they
* are already normalized. So simply add them without any further munging.
@@ -2311,28 +2413,28 @@ static int configset_add_value(struct config_set *cs, const char *key, const cha
hashmap_entry_init(&e->ent, strhash(key));
e->key = xstrdup(key);
string_list_init_dup(&e->value_list);
- hashmap_add(&cs->config_hash, &e->ent);
+ hashmap_add(&set->config_hash, &e->ent);
}
si = string_list_append_nodup(&e->value_list, xstrdup_or_null(value));
- ALLOC_GROW(cs->list.items, cs->list.nr + 1, cs->list.alloc);
- l_item = &cs->list.items[cs->list.nr++];
+ ALLOC_GROW(set->list.items, set->list.nr + 1, set->list.alloc);
+ l_item = &set->list.items[set->list.nr++];
l_item->e = e;
l_item->value_index = e->value_list.nr - 1;
- if (!cf)
+ if (!reader->source)
BUG("configset_add_value has no source");
- if (cf->name) {
- kv_info->filename = strintern(cf->name);
- kv_info->linenr = cf->linenr;
- kv_info->origin_type = cf->origin_type;
+ if (reader->source->name) {
+ kv_info->filename = strintern(reader->source->name);
+ kv_info->linenr = reader->source->linenr;
+ kv_info->origin_type = reader->source->origin_type;
} else {
/* for values read from `git_config_from_parameters()` */
kv_info->filename = NULL;
kv_info->linenr = -1;
kv_info->origin_type = CONFIG_ORIGIN_CMDLINE;
}
- kv_info->scope = current_parsing_scope;
+ kv_info->scope = reader->parsing_scope;
si->util = kv_info;
return 0;
@@ -2351,89 +2453,134 @@ static int config_set_element_cmp(const void *cmp_data UNUSED,
return strcmp(e1->key, e2->key);
}
-void git_configset_init(struct config_set *cs)
+void git_configset_init(struct config_set *set)
{
- hashmap_init(&cs->config_hash, config_set_element_cmp, NULL, 0);
- cs->hash_initialized = 1;
- cs->list.nr = 0;
- cs->list.alloc = 0;
- cs->list.items = NULL;
+ hashmap_init(&set->config_hash, config_set_element_cmp, NULL, 0);
+ set->hash_initialized = 1;
+ set->list.nr = 0;
+ set->list.alloc = 0;
+ set->list.items = NULL;
}
-void git_configset_clear(struct config_set *cs)
+void git_configset_clear(struct config_set *set)
{
struct config_set_element *entry;
struct hashmap_iter iter;
- if (!cs->hash_initialized)
+ if (!set->hash_initialized)
return;
- hashmap_for_each_entry(&cs->config_hash, &iter, entry,
+ hashmap_for_each_entry(&set->config_hash, &iter, entry,
ent /* member name */) {
free(entry->key);
string_list_clear(&entry->value_list, 1);
}
- hashmap_clear_and_free(&cs->config_hash, struct config_set_element, ent);
- cs->hash_initialized = 0;
- free(cs->list.items);
- cs->list.nr = 0;
- cs->list.alloc = 0;
- cs->list.items = NULL;
+ hashmap_clear_and_free(&set->config_hash, struct config_set_element, ent);
+ set->hash_initialized = 0;
+ free(set->list.items);
+ set->list.nr = 0;
+ set->list.alloc = 0;
+ set->list.items = NULL;
}
+struct configset_add_data {
+ struct config_set *config_set;
+ struct config_reader *config_reader;
+};
+#define CONFIGSET_ADD_INIT { 0 }
+
static int config_set_callback(const char *key, const char *value, void *cb)
{
- struct config_set *cs = cb;
- configset_add_value(cs, key, value);
+ struct configset_add_data *data = cb;
+ configset_add_value(data->config_reader, data->config_set, key, value);
return 0;
}
-int git_configset_add_file(struct config_set *cs, const char *filename)
-{
- return git_config_from_file(config_set_callback, filename, cs);
-}
-
-int git_configset_add_parameters(struct config_set *cs)
+int git_configset_add_file(struct config_set *set, const char *filename)
{
- return git_config_from_parameters(config_set_callback, cs);
+ struct configset_add_data data = CONFIGSET_ADD_INIT;
+ data.config_reader = &the_reader;
+ data.config_set = set;
+ return git_config_from_file(config_set_callback, filename, &data);
}
-int git_configset_get_value(struct config_set *cs, const char *key, const char **value)
+int git_configset_get_value(struct config_set *set, const char *key, const char **value)
{
const struct string_list *values = NULL;
+ int ret;
+
/*
* Follows "last one wins" semantic, i.e., if there are multiple matches for the
* queried key in the files of the configset, the value returned will be the last
* value in the value list for that key.
*/
- values = git_configset_get_value_multi(cs, key);
+ if ((ret = git_configset_get_value_multi(set, key, &values)))
+ return ret;
- if (!values)
- return 1;
assert(values->nr > 0);
*value = values->items[values->nr - 1].string;
return 0;
}
-const struct string_list *git_configset_get_value_multi(struct config_set *cs, const char *key)
+int git_configset_get_value_multi(struct config_set *set, const char *key,
+ const struct string_list **dest)
+{
+ struct config_set_element *e;
+ int ret;
+
+ if ((ret = configset_find_element(set, key, &e)))
+ return ret;
+ else if (!e)
+ return 1;
+ *dest = &e->value_list;
+
+ return 0;
+}
+
+static int check_multi_string(struct string_list_item *item, void *util)
{
- struct config_set_element *e = configset_find_element(cs, key);
- return e ? &e->value_list : NULL;
+ return item->string ? 0 : config_error_nonbool(util);
+}
+
+int git_configset_get_string_multi(struct config_set *cs, const char *key,
+ const struct string_list **dest)
+{
+ int ret;
+
+ if ((ret = git_configset_get_value_multi(cs, key, dest)))
+ return ret;
+ if ((ret = for_each_string_list((struct string_list *)*dest,
+ check_multi_string, (void *)key)))
+ return ret;
+
+ return 0;
}
-int git_configset_get_string(struct config_set *cs, const char *key, char **dest)
+int git_configset_get(struct config_set *set, const char *key)
+{
+ struct config_set_element *e;
+ int ret;
+
+ if ((ret = configset_find_element(set, key, &e)))
+ return ret;
+ else if (!e)
+ return 1;
+ return 0;
+}
+
+int git_configset_get_string(struct config_set *set, const char *key, char **dest)
{
const char *value;
- if (!git_configset_get_value(cs, key, &value))
+ if (!git_configset_get_value(set, key, &value))
return git_config_string((const char **)dest, key, value);
else
return 1;
}
-static int git_configset_get_string_tmp(struct config_set *cs, const char *key,
+static int git_configset_get_string_tmp(struct config_set *set, const char *key,
const char **dest)
{
const char *value;
- if (!git_configset_get_value(cs, key, &value)) {
+ if (!git_configset_get_value(set, key, &value)) {
if (!value)
return config_error_nonbool(key);
*dest = value;
@@ -2443,51 +2590,51 @@ static int git_configset_get_string_tmp(struct config_set *cs, const char *key,
}
}
-int git_configset_get_int(struct config_set *cs, const char *key, int *dest)
+int git_configset_get_int(struct config_set *set, const char *key, int *dest)
{
const char *value;
- if (!git_configset_get_value(cs, key, &value)) {
+ if (!git_configset_get_value(set, key, &value)) {
*dest = git_config_int(key, value);
return 0;
} else
return 1;
}
-int git_configset_get_ulong(struct config_set *cs, const char *key, unsigned long *dest)
+int git_configset_get_ulong(struct config_set *set, const char *key, unsigned long *dest)
{
const char *value;
- if (!git_configset_get_value(cs, key, &value)) {
+ if (!git_configset_get_value(set, key, &value)) {
*dest = git_config_ulong(key, value);
return 0;
} else
return 1;
}
-int git_configset_get_bool(struct config_set *cs, const char *key, int *dest)
+int git_configset_get_bool(struct config_set *set, const char *key, int *dest)
{
const char *value;
- if (!git_configset_get_value(cs, key, &value)) {
+ if (!git_configset_get_value(set, key, &value)) {
*dest = git_config_bool(key, value);
return 0;
} else
return 1;
}
-int git_configset_get_bool_or_int(struct config_set *cs, const char *key,
+int git_configset_get_bool_or_int(struct config_set *set, const char *key,
int *is_bool, int *dest)
{
const char *value;
- if (!git_configset_get_value(cs, key, &value)) {
+ if (!git_configset_get_value(set, key, &value)) {
*dest = git_config_bool_or_int(key, value, is_bool);
return 0;
} else
return 1;
}
-int git_configset_get_maybe_bool(struct config_set *cs, const char *key, int *dest)
+int git_configset_get_maybe_bool(struct config_set *set, const char *key, int *dest)
{
const char *value;
- if (!git_configset_get_value(cs, key, &value)) {
+ if (!git_configset_get_value(set, key, &value)) {
*dest = git_parse_maybe_bool(value);
if (*dest == -1)
return -1;
@@ -2496,10 +2643,10 @@ int git_configset_get_maybe_bool(struct config_set *cs, const char *key, int *de
return 1;
}
-int git_configset_get_pathname(struct config_set *cs, const char *key, const char **dest)
+int git_configset_get_pathname(struct config_set *set, const char *key, const char **dest)
{
const char *value;
- if (!git_configset_get_value(cs, key, &value))
+ if (!git_configset_get_value(set, key, &value))
return git_config_pathname(dest, key, value);
else
return 1;
@@ -2509,6 +2656,7 @@ int git_configset_get_pathname(struct config_set *cs, const char *key, const cha
static void repo_read_config(struct repository *repo)
{
struct config_options opts = { 0 };
+ struct configset_add_data data = CONFIGSET_ADD_INIT;
opts.respect_includes = 1;
opts.commondir = repo->commondir;
@@ -2520,8 +2668,10 @@ static void repo_read_config(struct repository *repo)
git_configset_clear(repo->config);
git_configset_init(repo->config);
+ data.config_set = repo->config;
+ data.config_reader = &the_reader;
- if (config_with_options(config_set_callback, repo->config, NULL, &opts) < 0)
+ if (config_with_options(config_set_callback, &data, NULL, &opts) < 0)
/*
* config_with_options() normally returns only
* zero, as most errors are fatal, and
@@ -2553,7 +2703,13 @@ static void repo_config_clear(struct repository *repo)
void repo_config(struct repository *repo, config_fn_t fn, void *data)
{
git_config_check_init(repo);
- configset_iter(repo->config, fn, data);
+ configset_iter(&the_reader, repo->config, fn, data);
+}
+
+int repo_config_get(struct repository *repo, const char *key)
+{
+ git_config_check_init(repo);
+ return git_configset_get(repo->config, key);
}
int repo_config_get_value(struct repository *repo,
@@ -2563,11 +2719,18 @@ int repo_config_get_value(struct repository *repo,
return git_configset_get_value(repo->config, key, value);
}
-const struct string_list *repo_config_get_value_multi(struct repository *repo,
- const char *key)
+int repo_config_get_value_multi(struct repository *repo, const char *key,
+ const struct string_list **dest)
{
git_config_check_init(repo);
- return git_configset_get_value_multi(repo->config, key);
+ return git_configset_get_value_multi(repo->config, key, dest);
+}
+
+int repo_config_get_string_multi(struct repository *repo, const char *key,
+ const struct string_list **dest)
+{
+ git_config_check_init(repo);
+ return git_configset_get_string_multi(repo->config, key, dest);
}
int repo_config_get_string(struct repository *repo,
@@ -2641,31 +2804,25 @@ int repo_config_get_pathname(struct repository *repo,
/* Read values into protected_config. */
static void read_protected_config(void)
{
- char *xdg_config = NULL, *user_config = NULL, *system_config = NULL;
+ struct config_options opts = {
+ .respect_includes = 1,
+ .ignore_repo = 1,
+ .ignore_worktree = 1,
+ .system_gently = 1,
+ };
+ struct configset_add_data data = CONFIGSET_ADD_INIT;
git_configset_init(&protected_config);
-
- system_config = git_system_config();
- git_global_config(&user_config, &xdg_config);
-
- if (system_config)
- git_configset_add_file(&protected_config, system_config);
- if (xdg_config)
- git_configset_add_file(&protected_config, xdg_config);
- if (user_config)
- git_configset_add_file(&protected_config, user_config);
- git_configset_add_parameters(&protected_config);
-
- free(system_config);
- free(xdg_config);
- free(user_config);
+ data.config_set = &protected_config;
+ data.config_reader = &the_reader;
+ config_with_options(config_set_callback, &data, NULL, &opts);
}
void git_protected_config(config_fn_t fn, void *data)
{
if (!protected_config.hash_initialized)
read_protected_config();
- configset_iter(&protected_config, fn, data);
+ configset_iter(&the_reader, &protected_config, fn, data);
}
/* Functions used historically to read configuration from 'the_repository' */
@@ -2679,14 +2836,25 @@ void git_config_clear(void)
repo_config_clear(the_repository);
}
+int git_config_get(const char *key)
+{
+ return repo_config_get(the_repository, key);
+}
+
int git_config_get_value(const char *key, const char **value)
{
return repo_config_get_value(the_repository, key, value);
}
-const struct string_list *git_config_get_value_multi(const char *key)
+int git_config_get_value_multi(const char *key, const struct string_list **dest)
{
- return repo_config_get_value_multi(the_repository, key);
+ return repo_config_get_value_multi(the_repository, key, dest);
+}
+
+int git_config_get_string_multi(const char *key,
+ const struct string_list **dest)
+{
+ return repo_config_get_string_multi(the_repository, key, dest);
}
int git_config_get_string(const char *key, char **dest)
@@ -2833,7 +3001,8 @@ void git_die_config(const char *key, const char *err, ...)
error_fn(err, params);
va_end(params);
}
- values = git_config_get_value_multi(key);
+ if (git_config_get_value_multi(key, &values))
+ BUG("for key '%s' we must have a value to report on", key);
kv_info = values->items[values->nr - 1].util;
git_die_config_linenr(key, kv_info->filename, kv_info->linenr);
}
@@ -2843,6 +3012,7 @@ void git_die_config(const char *key, const char *err, ...)
*/
struct config_store_data {
+ struct config_reader *config_reader;
size_t baselen;
char *key;
int do_not_match;
@@ -2857,6 +3027,7 @@ struct config_store_data {
unsigned int parsed_nr, parsed_alloc, *seen, seen_nr, seen_alloc;
unsigned int key_seen:1, section_seen:1, is_keys_section:1;
};
+#define CONFIG_STORE_INIT { 0 }
static void config_store_data_clear(struct config_store_data *store)
{
@@ -2891,6 +3062,7 @@ static int store_aux_event(enum config_event_t type,
size_t begin, size_t end, void *data)
{
struct config_store_data *store = data;
+ struct config_source *cs = store->config_reader->source;
ALLOC_GROW(store->parsed, store->parsed_nr + 1, store->parsed_alloc);
store->parsed[store->parsed_nr].begin = begin;
@@ -2900,10 +3072,10 @@ static int store_aux_event(enum config_event_t type,
if (type == CONFIG_EVENT_SECTION) {
int (*cmpfn)(const char *, const char *, size_t);
- if (cf->var.len < 2 || cf->var.buf[cf->var.len - 1] != '.')
- return error(_("invalid section name '%s'"), cf->var.buf);
+ if (cs->var.len < 2 || cs->var.buf[cs->var.len - 1] != '.')
+ return error(_("invalid section name '%s'"), cs->var.buf);
- if (cf->subsection_case_sensitive)
+ if (cs->subsection_case_sensitive)
cmpfn = strncasecmp;
else
cmpfn = strncmp;
@@ -2911,8 +3083,8 @@ static int store_aux_event(enum config_event_t type,
/* Is this the section we were looking for? */
store->is_keys_section =
store->parsed[store->parsed_nr].is_keys_section =
- cf->var.len - 1 == store->baselen &&
- !cmpfn(cf->var.buf, store->key, store->baselen);
+ cs->var.len - 1 == store->baselen &&
+ !cmpfn(cs->var.buf, store->key, store->baselen);
if (store->is_keys_section) {
store->section_seen = 1;
ALLOC_GROW(store->seen, store->seen_nr + 1,
@@ -3154,7 +3326,7 @@ int git_config_set_gently(const char *key, const char *value)
int repo_config_set_worktree_gently(struct repository *r,
const char *key, const char *value)
{
- /* Only use worktree-specific config if it is is already enabled. */
+ /* Only use worktree-specific config if it is already enabled. */
if (repository_format_worktree_config) {
char *file = repo_git_path(r, "config.worktree");
int ret = git_config_set_multivar_in_file_gently(
@@ -3208,9 +3380,9 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
char *filename_buf = NULL;
char *contents = NULL;
size_t contents_sz;
- struct config_store_data store;
+ struct config_store_data store = CONFIG_STORE_INIT;
- memset(&store, 0, sizeof(store));
+ store.config_reader = &the_reader;
/* parse-key returns negative; flip the sign to feed exit(3) */
ret = 0 - git_config_parse_key(key, &store.key, &store.baselen);
@@ -3780,14 +3952,23 @@ int parse_config_key(const char *var,
return 0;
}
-const char *current_config_origin_type(void)
+static int reader_origin_type(struct config_reader *reader,
+ enum config_origin_type *type)
{
- int type;
- if (current_config_kvi)
- type = current_config_kvi->origin_type;
- else if(cf)
- type = cf->origin_type;
+ if (the_reader.config_kvi)
+ *type = reader->config_kvi->origin_type;
+ else if(the_reader.source)
+ *type = reader->source->origin_type;
else
+ return 1;
+ return 0;
+}
+
+const char *current_config_origin_type(void)
+{
+ enum config_origin_type type = CONFIG_ORIGIN_UNKNOWN;
+
+ if (reader_origin_type(&the_reader, &type))
BUG("current_config_origin_type called outside config callback");
switch (type) {
@@ -3826,32 +4007,39 @@ const char *config_scope_name(enum config_scope scope)
}
}
+static int reader_config_name(struct config_reader *reader, const char **out)
+{
+ if (the_reader.config_kvi)
+ *out = reader->config_kvi->filename;
+ else if (the_reader.source)
+ *out = reader->source->name;
+ else
+ return 1;
+ return 0;
+}
+
const char *current_config_name(void)
{
const char *name;
- if (current_config_kvi)
- name = current_config_kvi->filename;
- else if (cf)
- name = cf->name;
- else
+ if (reader_config_name(&the_reader, &name))
BUG("current_config_name called outside config callback");
return name ? name : "";
}
enum config_scope current_config_scope(void)
{
- if (current_config_kvi)
- return current_config_kvi->scope;
+ if (the_reader.config_kvi)
+ return the_reader.config_kvi->scope;
else
- return current_parsing_scope;
+ return the_reader.parsing_scope;
}
int current_config_line(void)
{
- if (current_config_kvi)
- return current_config_kvi->linenr;
+ if (the_reader.config_kvi)
+ return the_reader.config_kvi->linenr;
else
- return cf->linenr;
+ return the_reader.source->linenr;
}
int lookup_config(const char **mapping, int nr_mapping, const char *var)
diff --git a/config.h b/config.h
index ca994d7714..247b572b37 100644
--- a/config.h
+++ b/config.h
@@ -56,6 +56,7 @@ struct git_config_source {
};
enum config_origin_type {
+ CONFIG_ORIGIN_UNKNOWN = 0,
CONFIG_ORIGIN_BLOB,
CONFIG_ORIGIN_FILE,
CONFIG_ORIGIN_STDIN,
@@ -206,6 +207,7 @@ int config_with_options(config_fn_t fn, void *,
int git_parse_ssize_t(const char *, ssize_t *);
int git_parse_ulong(const char *, unsigned long *);
+int git_parse_int(const char *value, int *ret);
/**
* Same as `git_config_bool`, except that it returns -1 on error rather
@@ -447,21 +449,33 @@ void git_configset_init(struct config_set *cs);
int git_configset_add_file(struct config_set *cs, const char *filename);
/**
- * Parses command line options and environment variables, and adds the
- * variable-value pairs to the `config_set`. Returns 0 on success, or -1
- * if there is an error in parsing. The caller decides whether to free
- * the incomplete configset or continue using it when the function
- * returns -1.
+ * Finds and returns the value list, sorted in order of increasing priority
+ * for the configuration variable `key` and config set `cs`. When the
+ * configuration variable `key` is not found, returns 1 without touching
+ * `value`.
+ *
+ * The key will be parsed for validity with git_config_parse_key(), on
+ * error a negative value will be returned.
+ *
+ * The caller should not free or modify the returned pointer, as it is
+ * owned by the cache.
*/
-int git_configset_add_parameters(struct config_set *cs);
+RESULT_MUST_BE_USED
+int git_configset_get_value_multi(struct config_set *cs, const char *key,
+ const struct string_list **dest);
/**
- * Finds and returns the value list, sorted in order of increasing priority
- * for the configuration variable `key` and config set `cs`. When the
- * configuration variable `key` is not found, returns NULL. The caller
- * should not free or modify the returned pointer, as it is owned by the cache.
+ * A validation wrapper for git_configset_get_value_multi() which does
+ * for it what git_configset_get_string() does for
+ * git_configset_get_value().
+ *
+ * The configuration syntax allows for "[section] key", which will
+ * give us a NULL entry in the "struct string_list", as opposed to
+ * "[section] key =" which is the empty string. Most users of the API
+ * are not prepared to handle NULL in a "struct string_list".
*/
-const struct string_list *git_configset_get_value_multi(struct config_set *cs, const char *key);
+int git_configset_get_string_multi(struct config_set *cs, const char *key,
+ const struct string_list **dest);
/**
* Clears `config_set` structure, removes all saved variable-value pairs.
@@ -473,6 +487,13 @@ void git_configset_clear(struct config_set *cs);
* value in the 'dest' pointer.
*/
+/**
+ * git_configset_get() returns negative values on error, see
+ * repo_config_get() below.
+ */
+RESULT_MUST_BE_USED
+int git_configset_get(struct config_set *cs, const char *key);
+
/*
* Finds the highest-priority value for the configuration variable `key`
* and config set `cs`, stores the pointer to it in `value` and returns 0.
@@ -493,10 +514,22 @@ int git_configset_get_pathname(struct config_set *cs, const char *key, const cha
/* Functions for reading a repository's config */
struct repository;
void repo_config(struct repository *repo, config_fn_t fn, void *data);
+
+/**
+ * Run only the discover part of the repo_config_get_*() functions
+ * below, in addition to 1 if not found, returns negative values on
+ * error (e.g. if the key itself is invalid).
+ */
+RESULT_MUST_BE_USED
+int repo_config_get(struct repository *repo, const char *key);
int repo_config_get_value(struct repository *repo,
const char *key, const char **value);
-const struct string_list *repo_config_get_value_multi(struct repository *repo,
- const char *key);
+RESULT_MUST_BE_USED
+int repo_config_get_value_multi(struct repository *repo, const char *key,
+ const struct string_list **dest);
+RESULT_MUST_BE_USED
+int repo_config_get_string_multi(struct repository *repo, const char *key,
+ const struct string_list **dest);
int repo_config_get_string(struct repository *repo,
const char *key, char **dest);
int repo_config_get_string_tmp(struct repository *repo,
@@ -529,8 +562,15 @@ void git_protected_config(config_fn_t fn, void *data);
* manner, the config API provides two functions `git_config_get_value`
* and `git_config_get_value_multi`. They both read values from an internal
* cache generated previously from reading the config files.
+ *
+ * For those git_config_get*() functions that aren't documented,
+ * consult the corresponding repo_config_get*() function's
+ * documentation.
*/
+RESULT_MUST_BE_USED
+int git_config_get(const char *key);
+
/**
* Finds the highest-priority value for the configuration variable `key`,
* stores the pointer to it in `value` and returns 0. When the
@@ -543,10 +583,17 @@ int git_config_get_value(const char *key, const char **value);
/**
* Finds and returns the value list, sorted in order of increasing priority
* for the configuration variable `key`. When the configuration variable
- * `key` is not found, returns NULL. The caller should not free or modify
- * the returned pointer, as it is owned by the cache.
- */
-const struct string_list *git_config_get_value_multi(const char *key);
+ * `key` is not found, returns 1 without touching `value`.
+ *
+ * The caller should not free or modify the returned pointer, as it is
+ * owned by the cache.
+ */
+RESULT_MUST_BE_USED
+int git_config_get_value_multi(const char *key,
+ const struct string_list **dest);
+RESULT_MUST_BE_USED
+int git_config_get_string_multi(const char *key,
+ const struct string_list **dest);
/**
* Resets and invalidates the config cache.
diff --git a/config.mak.uname b/config.mak.uname
index d63629fe80..64c44db805 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -147,6 +147,7 @@ ifeq ($(uname_S),Darwin)
FREAD_READS_DIRECTORIES = UnfortunatelyYes
HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
CSPRNG_METHOD = arc4random
+ USE_ENHANCED_BASIC_REGULAR_EXPRESSIONS = YesPlease
# Workaround for `gettext` being keg-only and not even being linked via
# `brew link --force gettext`, should be obsolete as of
@@ -623,6 +624,9 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
SHELL_PATH = /usr/coreutils/bin/bash
endif
ifeq ($(uname_S),MINGW)
+ ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
+ $(error "Building with MSys is no longer supported")
+ endif
pathsep = ;
HAVE_ALLOCA_H = YesPlease
NO_PREAD = YesPlease
@@ -652,7 +656,6 @@ ifeq ($(uname_S),MINGW)
USE_WIN32_IPC = YesPlease
USE_WIN32_MMAP = YesPlease
MMAP_PREVENTS_DELETE = UnfortunatelyYes
- USE_NED_ALLOCATOR = YesPlease
UNRELIABLE_FSTAT = UnfortunatelyYes
OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
NO_REGEX = YesPlease
@@ -677,61 +680,43 @@ ifeq ($(uname_S),MINGW)
RC = windres -O coff
NATIVE_CRLF = YesPlease
X = .exe
-ifneq (,$(wildcard ../THIS_IS_MSYSGIT))
- htmldir = doc/git/html/
- prefix =
+ # MSys2
+ prefix = /usr/
+ # Enable DEP
+ BASIC_LDFLAGS += -Wl,--nxcompat
+ # Enable ASLR (unless debugging)
+ ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
+ BASIC_LDFLAGS += -Wl,--dynamicbase
+ endif
+ ifeq (MINGW32,$(MSYSTEM))
+ prefix = /mingw32
+ HOST_CPU = i686
+ BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
+ endif
+ ifeq (MINGW64,$(MSYSTEM))
+ prefix = /mingw64
+ HOST_CPU = x86_64
+ BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
+ else
+ COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
+ BASIC_LDFLAGS += -Wl,--large-address-aware
+ endif
+ CC = gcc
+ COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
+ -fstack-protector-strong
+ EXTLIBS += -lntdll
INSTALL = /bin/install
- EXTLIBS += /mingw/lib/libz.a
INTERNAL_QSORT = YesPlease
HAVE_LIBCHARSET_H = YesPlease
- NO_GETTEXT = YesPlease
- NO_PYTHON = YesPlease
- COMPAT_CFLAGS += -D__USE_MINGW_ACCESS
-else
- ifneq ($(shell expr "$(uname_R)" : '1\.'),2)
- # MSys2
- prefix = /usr/
- # Enable DEP
- BASIC_LDFLAGS += -Wl,--nxcompat
- # Enable ASLR (unless debugging)
- ifneq (,$(findstring -O,$(filter-out -O0 -Og,$(CFLAGS))))
- BASIC_LDFLAGS += -Wl,--dynamicbase
- endif
- ifeq (MINGW32,$(MSYSTEM))
- prefix = /mingw32
- HOST_CPU = i686
- BASIC_LDFLAGS += -Wl,--pic-executable,-e,_mainCRTStartup
- endif
- ifeq (MINGW64,$(MSYSTEM))
- prefix = /mingw64
- HOST_CPU = x86_64
- BASIC_LDFLAGS += -Wl,--pic-executable,-e,mainCRTStartup
- else
- COMPAT_CFLAGS += -D_USE_32BIT_TIME_T
- BASIC_LDFLAGS += -Wl,--large-address-aware
- endif
- CC = gcc
- COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO=0 -DDETECT_MSYS_TTY \
- -fstack-protector-strong
- EXTLIBS += -lntdll
- INSTALL = /bin/install
- INTERNAL_QSORT = YesPlease
- HAVE_LIBCHARSET_H = YesPlease
- USE_GETTEXT_SCHEME = fallthrough
- USE_LIBPCRE = YesPlease
- USE_NED_ALLOCATOR = YesPlease
- ifeq (/mingw64,$(subst 32,64,$(prefix)))
- # Move system config into top-level /etc/
- ETC_GITCONFIG = ../etc/gitconfig
- ETC_GITATTRIBUTES = ../etc/gitattributes
- endif
- else
- COMPAT_CFLAGS += -D__USE_MINGW_ANSI_STDIO
- NO_CURL = YesPlease
- NO_PYTHON = YesPlease
+ USE_GETTEXT_SCHEME = fallthrough
+ USE_LIBPCRE = YesPlease
+ USE_NED_ALLOCATOR = YesPlease
+ ifeq (/mingw64,$(subst 32,64,$(prefix)))
+ # Move system config into top-level /etc/
+ ETC_GITCONFIG = ../etc/gitconfig
+ ETC_GITATTRIBUTES = ../etc/gitattributes
endif
endif
-endif
ifeq ($(uname_S),QNX)
COMPAT_CFLAGS += -DSA_RESTART=0
EXPAT_NEEDS_XMLPARSE_H = YesPlease
diff --git a/connect.c b/connect.c
index 5ea53deda2..3a0186280c 100644
--- a/connect.c
+++ b/connect.c
@@ -1,6 +1,8 @@
#include "git-compat-util.h"
-#include "cache.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "pkt-line.h"
#include "quote.h"
#include "refs.h"
@@ -11,14 +13,16 @@
#include "string-list.h"
#include "oid-array.h"
#include "transport.h"
+#include "trace2.h"
#include "strbuf.h"
#include "version.h"
#include "protocol.h"
#include "alias.h"
+#include "bundle-uri.h"
static char *server_capabilities_v1;
static struct strvec server_capabilities_v2 = STRVEC_INIT;
-static const char *next_server_feature_value(const char *feature, int *len, int *offset);
+static const char *next_server_feature_value(const char *feature, size_t *len, size_t *offset);
static int check_ref(const char *name, unsigned int flags)
{
@@ -29,7 +33,8 @@ static int check_ref(const char *name, unsigned int flags)
return 0;
/* REF_NORMAL means that we don't want the magic fake tag refs */
- if ((flags & REF_NORMAL) && check_refname_format(name, 0))
+ if ((flags & REF_NORMAL) && check_refname_format(name,
+ REFNAME_ALLOW_ONELEVEL))
return 0;
/* REF_HEADS means that we want regular branch heads */
@@ -66,7 +71,7 @@ static NORETURN void die_initial_contact(int unexpected)
}
/* Checks if the server supports the capability 'c' */
-int server_supports_v2(const char *c, int die_on_error)
+int server_supports_v2(const char *c)
{
int i;
@@ -76,11 +81,13 @@ int server_supports_v2(const char *c, int die_on_error)
(!*out || *out == '='))
return 1;
}
+ return 0;
+}
- if (die_on_error)
+void ensure_server_supports_v2(const char *c)
+{
+ if (!server_supports_v2(c))
die(_("server doesn't support '%s'"), c);
-
- return 0;
}
int server_feature_v2(const char *c, const char **v)
@@ -198,10 +205,10 @@ reject:
static void annotate_refs_with_symref_info(struct ref *ref)
{
struct string_list symref = STRING_LIST_INIT_DUP;
- int offset = 0;
+ size_t offset = 0;
while (1) {
- int len;
+ size_t len;
const char *val;
val = next_server_feature_value("symref", &len, &offset);
@@ -224,7 +231,7 @@ static void annotate_refs_with_symref_info(struct ref *ref)
static void process_capabilities(struct packet_reader *reader, int *linelen)
{
const char *feat_val;
- int feat_len;
+ size_t feat_len;
const char *line = reader->line;
int nul_location = strlen(line);
if (nul_location == *linelen)
@@ -256,7 +263,8 @@ static int process_dummy_ref(const struct packet_reader *reader)
return 0;
name++;
- return oideq(null_oid(), &oid) && !strcmp(name, "capabilities^{}");
+ return oideq(reader->hash_algo->null_oid, &oid) &&
+ !strcmp(name, "capabilities^{}");
}
static void check_no_capabilities(const char *line, int len)
@@ -477,7 +485,7 @@ static void send_capabilities(int fd_out, struct packet_reader *reader)
{
const char *hash_name;
- if (server_supports_v2("agent", 0))
+ if (server_supports_v2("agent"))
packet_write_fmt(fd_out, "agent=%s", git_user_agent_sanitized());
if (server_feature_v2("object-format", &hash_name)) {
@@ -491,6 +499,49 @@ static void send_capabilities(int fd_out, struct packet_reader *reader)
}
}
+int get_remote_bundle_uri(int fd_out, struct packet_reader *reader,
+ struct bundle_list *bundles, int stateless_rpc)
+{
+ int line_nr = 1;
+
+ /* Assert bundle-uri support */
+ ensure_server_supports_v2("bundle-uri");
+
+ /* (Re-)send capabilities */
+ send_capabilities(fd_out, reader);
+
+ /* Send command */
+ packet_write_fmt(fd_out, "command=bundle-uri\n");
+ packet_delim(fd_out);
+
+ packet_flush(fd_out);
+
+ /* Process response from server */
+ while (packet_reader_read(reader) == PACKET_READ_NORMAL) {
+ const char *line = reader->line;
+ line_nr++;
+
+ if (!bundle_uri_parse_line(bundles, line))
+ continue;
+
+ return error(_("error on bundle-uri response line %d: %s"),
+ line_nr, line);
+ }
+
+ if (reader->status != PACKET_READ_FLUSH)
+ return error(_("expected flush after bundle-uri listing"));
+
+ /*
+ * Might die(), but obscure enough that that's OK, e.g. in
+ * serve.c we'll call BUG() on its equivalent (the
+ * PACKET_READ_RESPONSE_END check).
+ */
+ check_stateless_delimiter(stateless_rpc, reader,
+ _("expected response end packet after ref listing"));
+
+ return 0;
+}
+
struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
struct ref **list, int for_push,
struct transport_ls_refs_options *transport_options,
@@ -504,17 +555,18 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
&transport_options->unborn_head_target : NULL;
*list = NULL;
- if (server_supports_v2("ls-refs", 1))
- packet_write_fmt(fd_out, "command=ls-refs\n");
+ ensure_server_supports_v2("ls-refs");
+ packet_write_fmt(fd_out, "command=ls-refs\n");
/* Send capabilities */
send_capabilities(fd_out, reader);
- if (server_options && server_options->nr &&
- server_supports_v2("server-option", 1))
+ if (server_options && server_options->nr) {
+ ensure_server_supports_v2("server-option");
for (i = 0; i < server_options->nr; i++)
packet_write_fmt(fd_out, "server-option=%s",
server_options->items[i].string);
+ }
packet_delim(fd_out);
/* When pushing we don't want to request the peeled tags */
@@ -544,9 +596,10 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
return list;
}
-const char *parse_feature_value(const char *feature_list, const char *feature, int *lenp, int *offset)
+const char *parse_feature_value(const char *feature_list, const char *feature, size_t *lenp, size_t *offset)
{
- int len;
+ const char *orig_start = feature_list;
+ size_t len;
if (!feature_list)
return NULL;
@@ -565,19 +618,19 @@ const char *parse_feature_value(const char *feature_list, const char *feature, i
if (lenp)
*lenp = 0;
if (offset)
- *offset = found + len - feature_list;
+ *offset = found + len - orig_start;
return value;
}
/* feature with a value (e.g., "agent=git/1.2.3") */
else if (*value == '=') {
- int end;
+ size_t end;
value++;
end = strcspn(value, " \t\n");
if (lenp)
*lenp = end;
if (offset)
- *offset = value + end - feature_list;
+ *offset = value + end - orig_start;
return value;
}
/*
@@ -592,8 +645,8 @@ const char *parse_feature_value(const char *feature_list, const char *feature, i
int server_supports_hash(const char *desired, int *feature_supported)
{
- int offset = 0;
- int len;
+ size_t offset = 0;
+ size_t len;
const char *hash;
hash = next_server_feature_value("object-format", &len, &offset);
@@ -617,12 +670,12 @@ int parse_feature_request(const char *feature_list, const char *feature)
return !!parse_feature_value(feature_list, feature, NULL, NULL);
}
-static const char *next_server_feature_value(const char *feature, int *len, int *offset)
+static const char *next_server_feature_value(const char *feature, size_t *len, size_t *offset)
{
return parse_feature_value(server_capabilities_v1, feature, len, offset);
}
-const char *server_feature_value(const char *feature, int *len)
+const char *server_feature_value(const char *feature, size_t *len)
{
return parse_feature_value(server_capabilities_v1, feature, len, NULL);
}
@@ -1359,6 +1412,7 @@ static void fill_ssh_args(struct child_process *conn, const char *ssh_host,
* the connection failed).
*/
struct child_process *git_connect(int fd[2], const char *url,
+ const char *name,
const char *prog, int flags)
{
char *hostandport, *path;
@@ -1368,10 +1422,11 @@ struct child_process *git_connect(int fd[2], const char *url,
/*
* NEEDSWORK: If we are trying to use protocol v2 and we are planning
- * to perform a push, then fallback to v0 since the client doesn't know
- * how to push yet using v2.
+ * to perform any operation that doesn't involve upload-pack (i.e., a
+ * fetch, ls-remote, etc), then fallback to v0 since we don't know how
+ * to do anything else (like push or remote archive) via v2.
*/
- if (version == protocol_v2 && !strcmp("git-receive-pack", prog))
+ if (version == protocol_v2 && strcmp("git-upload-pack", name))
version = protocol_v0;
/* Without this we cannot rely on waitpid() to tell
diff --git a/connect.h b/connect.h
index c53586e929..1645126c17 100644
--- a/connect.h
+++ b/connect.h
@@ -7,20 +7,21 @@
#define CONNECT_DIAG_URL (1u << 1)
#define CONNECT_IPV4 (1u << 2)
#define CONNECT_IPV6 (1u << 3)
-struct child_process *git_connect(int fd[2], const char *url, const char *prog, int flags);
+struct child_process *git_connect(int fd[2], const char *url, const char *name, const char *prog, int flags);
int finish_connect(struct child_process *conn);
int git_connection_is_socket(struct child_process *conn);
int server_supports(const char *feature);
int parse_feature_request(const char *features, const char *feature);
-const char *server_feature_value(const char *feature, int *len_ret);
+const char *server_feature_value(const char *feature, size_t *len_ret);
int url_is_local_not_ssh(const char *url);
struct packet_reader;
enum protocol_version discover_version(struct packet_reader *reader);
int server_supports_hash(const char *desired, int *feature_supported);
-const char *parse_feature_value(const char *feature_list, const char *feature, int *lenp, int *offset);
-int server_supports_v2(const char *c, int die_on_error);
+const char *parse_feature_value(const char *feature_list, const char *feature, size_t *lenp, size_t *offset);
+int server_supports_v2(const char *c);
+void ensure_server_supports_v2(const char *c);
int server_feature_v2(const char *c, const char **v);
int server_supports_feature(const char *c, const char *feature,
int die_on_error);
diff --git a/connected.c b/connected.c
index 74a20cb32e..d672521da4 100644
--- a/connected.c
+++ b/connected.c
@@ -1,4 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
+#include "hex.h"
#include "object-store.h"
#include "run-command.h"
#include "sigchain.h"
@@ -54,7 +56,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
strbuf_release(&idx_file);
}
- if (has_promisor_remote()) {
+ if (repo_has_promisor_remote(the_repository)) {
/*
* For partial clones, we don't want to have to do a regular
* connectivity check because we have to enumerate and exclude
@@ -85,6 +87,7 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
promisor_pack_found:
;
} while ((oid = fn(cb_data)) != NULL);
+ free(new_pack);
return 0;
}
@@ -96,10 +99,13 @@ no_promisor_pack_found:
strvec_push(&rev_list.args,"rev-list");
strvec_push(&rev_list.args, "--objects");
strvec_push(&rev_list.args, "--stdin");
- if (has_promisor_remote())
+ if (repo_has_promisor_remote(the_repository))
strvec_push(&rev_list.args, "--exclude-promisor-objects");
if (!opt->is_deepening_fetch) {
strvec_push(&rev_list.args, "--not");
+ if (opt->exclude_hidden_refs_section)
+ strvec_pushf(&rev_list.args, "--exclude-hidden=%s",
+ opt->exclude_hidden_refs_section);
strvec_push(&rev_list.args, "--all");
}
strvec_push(&rev_list.args, "--quiet");
@@ -118,8 +124,10 @@ no_promisor_pack_found:
else
rev_list.no_stderr = opt->quiet;
- if (start_command(&rev_list))
+ if (start_command(&rev_list)) {
+ free(new_pack);
return error(_("Could not run 'git rev-list'"));
+ }
sigchain_push(SIGPIPE, SIG_IGN);
@@ -151,5 +159,6 @@ no_promisor_pack_found:
err = error_errno(_("failed to close rev-list's stdin"));
sigchain_pop(SIGPIPE);
+ free(new_pack);
return finish_command(&rev_list) || err;
}
diff --git a/connected.h b/connected.h
index 6e59c92aa3..16b2c84f2e 100644
--- a/connected.h
+++ b/connected.h
@@ -46,6 +46,13 @@ struct check_connected_options {
* during a fetch.
*/
unsigned is_deepening_fetch : 1;
+
+ /*
+ * If not NULL, use `--exclude-hidden=$section` to exclude all refs
+ * hidden via the `$section.hideRefs` config from the set of
+ * already-reachable refs.
+ */
+ const char *exclude_hidden_refs_section;
};
#define CHECK_CONNECTED_INIT { 0 }
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index ea2a531be8..2f6e0197ff 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -308,6 +308,8 @@ if(SUPPORTS_SIMPLE_IPC)
add_compile_definitions(HAVE_FSMONITOR_DAEMON_BACKEND)
list(APPEND compat_SOURCES compat/fsmonitor/fsm-listen-win32.c)
list(APPEND compat_SOURCES compat/fsmonitor/fsm-health-win32.c)
+ list(APPEND compat_SOURCES compat/fsmonitor/fsm-ipc-win32.c)
+ list(APPEND compat_SOURCES compat/fsmonitor/fsm-path-utils-win32.c)
add_compile_definitions(HAVE_FSMONITOR_OS_SETTINGS)
list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-win32.c)
@@ -315,6 +317,8 @@ if(SUPPORTS_SIMPLE_IPC)
add_compile_definitions(HAVE_FSMONITOR_DAEMON_BACKEND)
list(APPEND compat_SOURCES compat/fsmonitor/fsm-listen-darwin.c)
list(APPEND compat_SOURCES compat/fsmonitor/fsm-health-darwin.c)
+ list(APPEND compat_SOURCES compat/fsmonitor/fsm-ipc-darwin.c)
+ list(APPEND compat_SOURCES compat/fsmonitor/fsm-path-utils-darwin.c)
add_compile_definitions(HAVE_FSMONITOR_OS_SETTINGS)
list(APPEND compat_SOURCES compat/fsmonitor/fsm-settings-darwin.c)
@@ -1021,7 +1025,6 @@ set(NO_PERL )
set(NO_PTHREADS )
set(NO_PYTHON )
set(PAGER_ENV "LESS=FRX LV=-c")
-set(DC_SHA1 YesPlease)
set(RUNTIME_PREFIX true)
set(NO_GETTEXT )
@@ -1057,7 +1060,6 @@ 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 "DC_SHA1='${DC_SHA1}'\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")
@@ -1070,18 +1072,14 @@ endif()
#Make the tests work when building out of the source tree
get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE)
if(NOT ${CMAKE_BINARY_DIR}/CMakeCache.txt STREQUAL ${CACHE_PATH})
- file(RELATIVE_PATH BUILD_DIR_RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/CMakeCache.txt)
- string(REPLACE "/CMakeCache.txt" "" BUILD_DIR_RELATIVE ${BUILD_DIR_RELATIVE})
#Setting the build directory in test-lib.sh before running tests
file(WRITE ${CMAKE_BINARY_DIR}/CTestCustom.cmake
- "file(STRINGS ${CMAKE_SOURCE_DIR}/t/test-lib.sh GIT_BUILD_DIR_REPL REGEX \"GIT_BUILD_DIR=(.*)\")\n"
- "file(STRINGS ${CMAKE_SOURCE_DIR}/t/test-lib.sh content NEWLINE_CONSUME)\n"
- "string(REPLACE \"\${GIT_BUILD_DIR_REPL}\" \"GIT_BUILD_DIR=\\\"$TEST_DIRECTORY/../${BUILD_DIR_RELATIVE}\\\"\" content \"\${content}\")\n"
- "file(WRITE ${CMAKE_SOURCE_DIR}/t/test-lib.sh \${content})")
+ "file(WRITE ${CMAKE_SOURCE_DIR}/GIT-BUILD-DIR \"${CMAKE_BINARY_DIR}\")")
#misc copies
file(COPY ${CMAKE_SOURCE_DIR}/t/chainlint.pl DESTINATION ${CMAKE_BINARY_DIR}/t/)
file(COPY ${CMAKE_SOURCE_DIR}/po/is.po DESTINATION ${CMAKE_BINARY_DIR}/po/)
- file(COPY ${CMAKE_SOURCE_DIR}/mergetools/tkdiff DESTINATION ${CMAKE_BINARY_DIR}/mergetools/)
+ file(GLOB mergetools "${CMAKE_SOURCE_DIR}/mergetools/*")
+ file(COPY ${mergetools} DESTINATION ${CMAKE_BINARY_DIR}/mergetools/)
file(COPY ${CMAKE_SOURCE_DIR}/contrib/completion/git-prompt.sh DESTINATION ${CMAKE_BINARY_DIR}/contrib/completion/)
file(COPY ${CMAKE_SOURCE_DIR}/contrib/completion/git-completion.bash DESTINATION ${CMAKE_BINARY_DIR}/contrib/completion/)
endif()
@@ -1091,8 +1089,12 @@ file(GLOB test_scipts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh")
#test
foreach(tsh ${test_scipts})
add_test(NAME ${tsh}
- COMMAND ${SH_EXE} ${tsh}
+ COMMAND ${SH_EXE} ${tsh} --no-bin-wrappers --no-chain-lint -vx
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t)
endforeach()
+# This test script takes an extremely long time and is known to time out even
+# on fast machines because it requires in excess of one hour to run
+set_tests_properties("${CMAKE_SOURCE_DIR}/t/t7112-reset-submodule.sh" PROPERTIES TIMEOUT 4000)
+
endif()#BUILD_TESTING
diff --git a/contrib/coccinelle/.gitignore b/contrib/coccinelle/.gitignore
index d3f29646dc..1d45c0a40c 100644
--- a/contrib/coccinelle/.gitignore
+++ b/contrib/coccinelle/.gitignore
@@ -1 +1 @@
-*.patch*
+*.patch
diff --git a/contrib/coccinelle/README b/contrib/coccinelle/README
index f0e80bd7f0..d1daa1f626 100644
--- a/contrib/coccinelle/README
+++ b/contrib/coccinelle/README
@@ -41,3 +41,52 @@ There are two types of semantic patches:
This allows to expose plans of pending large scale refactorings without
impacting the bad pattern checks.
+
+Git-specific tips & things to know about how we run "spatch":
+
+ * The "make coccicheck" will piggy-back on
+ "COMPUTE_HEADER_DEPENDENCIES". If you've built a given object file
+ the "coccicheck" target will consider its depednency to decide if
+ it needs to re-run on the corresponding source file.
+
+ This means that a "make coccicheck" will re-compile object files
+ before running. This might be unexpected, but speeds up the run in
+ the common case, as e.g. a change to "column.h" won't require all
+ coccinelle rules to be re-run against "grep.c" (or another file
+ that happens not to use "column.h").
+
+ To disable this behavior use the "SPATCH_USE_O_DEPENDENCIES=NoThanks"
+ flag.
+
+ * To speed up our rules the "make coccicheck" target will by default
+ concatenate all of the *.cocci files here into an "ALL.cocci", and
+ apply it to each source file.
+
+ This makes the run faster, as we don't need to run each rule
+ against each source file. See the Makefile for further discussion,
+ this behavior can be disabled with "SPATCH_CONCAT_COCCI=".
+
+ But since they're concatenated any <id> in the <rulname> (e.g. "@
+ my_name", v.s. anonymous "@@") needs to be unique across all our
+ *.cocci files. You should only need to name rules if other rules
+ depend on them (currently only one rule is named).
+
+ * To speed up incremental runs even more use the "spatchcache" tool
+ in this directory as your "SPATCH". It aimns to be a "ccache" for
+ coccinelle, and piggy-backs on "COMPUTE_HEADER_DEPENDENCIES".
+
+ It caches in Redis by default, see it source for a how-to.
+
+ In one setup with a primed cache "make coccicheck" followed by a
+ "make clean && make" takes around 10s to run, but 2m30s with the
+ default of "SPATCH_CONCAT_COCCI=Y".
+
+ With "SPATCH_CONCAT_COCCI=" the total runtime is around ~6m, sped
+ up to ~1m with "spatchcache".
+
+ Most of the 10s (or ~1m) being spent on re-running "spatch" on
+ files we couldn't cache, as we didn't compile them (in contrib/*
+ and compat/* mostly).
+
+ The absolute times will differ for you, but the relative speedup
+ from caching should be on that order.
diff --git a/contrib/coccinelle/array.cocci b/contrib/coccinelle/array.cocci
index aa75937950..27a3b479c9 100644
--- a/contrib/coccinelle/array.cocci
+++ b/contrib/coccinelle/array.cocci
@@ -94,3 +94,10 @@ expression n != 1;
@@
- ptr = xcalloc(n, \( sizeof(*ptr) \| sizeof(T) \) )
+ CALLOC_ARRAY(ptr, n)
+
+@@
+expression dst, src, n;
+@@
+-ALLOC_ARRAY(dst, n);
+-COPY_ARRAY(dst, src, n);
++DUP_ARRAY(dst, src, n);
diff --git a/contrib/coccinelle/hashmap.cocci b/contrib/coccinelle/hashmap.cocci
index d69e120ccf..c5dbb4557b 100644
--- a/contrib/coccinelle/hashmap.cocci
+++ b/contrib/coccinelle/hashmap.cocci
@@ -1,4 +1,4 @@
-@ hashmap_entry_init_usage @
+@@
expression E;
struct hashmap_entry HME;
@@
diff --git a/contrib/coccinelle/index-compatibility.cocci b/contrib/coccinelle/index-compatibility.cocci
new file mode 100644
index 0000000000..31e36cf3c4
--- /dev/null
+++ b/contrib/coccinelle/index-compatibility.cocci
@@ -0,0 +1,157 @@
+// the_index.* variables
+@@
+identifier AC = active_cache;
+identifier AN = active_nr;
+identifier ACC = active_cache_changed;
+identifier ACT = active_cache_tree;
+@@
+(
+- AC
++ the_index.cache
+|
+- AN
++ the_index.cache_nr
+|
+- ACC
++ the_index.cache_changed
+|
+- ACT
++ the_index.cache_tree
+)
+
+// "the_repository" simple cases
+@@
+@@
+(
+- read_cache
++ repo_read_index
+|
+- read_cache_unmerged
++ repo_read_index_unmerged
+|
+- hold_locked_index
++ repo_hold_locked_index
+)
+ (
++ the_repository,
+ ...)
+
+// "the_repository" special-cases
+@@
+@@
+(
+- read_cache_preload
++ repo_read_index_preload
+)
+ (
++ the_repository,
+ ...
++ , 0
+ )
+
+// "the_index" simple cases
+@@
+@@
+(
+- is_cache_unborn
++ is_index_unborn
+|
+- unmerged_cache
++ unmerged_index
+|
+- rename_cache_entry_at
++ rename_index_entry_at
+|
+- chmod_cache_entry
++ chmod_index_entry
+|
+- cache_file_exists
++ index_file_exists
+|
+- cache_name_is_other
++ index_name_is_other
+|
+- unmerge_cache_entry_at
++ unmerge_index_entry_at
+|
+- add_to_cache
++ add_to_index
+|
+- add_file_to_cache
++ add_file_to_index
+|
+- add_cache_entry
++ add_index_entry
+|
+- remove_file_from_cache
++ remove_file_from_index
+|
+- ce_match_stat
++ ie_match_stat
+|
+- ce_modified
++ ie_modified
+|
+- resolve_undo_clear
++ resolve_undo_clear_index
+|
+- cache_name_pos
++ index_name_pos
+|
+- update_main_cache_tree
++ cache_tree_update
+|
+- discard_cache
++ discard_index
+)
+ (
++ &the_index,
+ ...)
+
+@@
+@@
+(
+- refresh_and_write_cache
++ repo_refresh_and_write_index
+)
+ (
++ the_repository,
+ ...
++ , NULL, NULL, NULL
+ )
+
+// "the_index" special-cases
+@@
+@@
+(
+- read_cache_from
++ read_index_from
+)
+ (
++ &the_index,
+ ...
++ , get_git_dir()
+ )
+
+@@
+@@
+(
+- refresh_cache
++ refresh_index
+)
+ (
++ &the_index,
+ ...
++ , NULL, NULL, NULL
+ )
+
+@@
+expression O;
+@@
+- write_cache_as_tree
++ write_index_as_tree
+ (
+- O,
++ O, &the_index, get_index_file(),
+ ...
+ )
diff --git a/contrib/coccinelle/preincr.cocci b/contrib/coccinelle/preincr.cocci
index 7fe1e8d2d9..ae42cb0730 100644
--- a/contrib/coccinelle/preincr.cocci
+++ b/contrib/coccinelle/preincr.cocci
@@ -1,4 +1,4 @@
-@ preincrement @
+@@
identifier i;
@@
- ++i > 1
diff --git a/contrib/coccinelle/spatchcache b/contrib/coccinelle/spatchcache
new file mode 100755
index 0000000000..29e9352d8a
--- /dev/null
+++ b/contrib/coccinelle/spatchcache
@@ -0,0 +1,304 @@
+#!/bin/sh
+#
+# spatchcache: a poor-man's "ccache"-alike for "spatch" in git.git
+#
+# This caching command relies on the peculiarities of the Makefile
+# driving "spatch" in git.git, in particular if we invoke:
+#
+# make
+# # See "spatchCache.cacheWhenStderr" for why "--very-quiet" is
+# # used
+# make coccicheck SPATCH_FLAGS=--very-quiet
+#
+# We can with COMPUTE_HEADER_DEPENDENCIES (auto-detected as true with
+# "gcc" and "clang") write e.g. a .depend/grep.o.d for grep.c, when we
+# compile grep.o.
+#
+# The .depend/grep.o.d will have the full header dependency tree of
+# grep.c, and we can thus cache the output of "spatch" by:
+#
+# 1. Hashing all of those files
+# 2. Hashing our source file, and the *.cocci rule we're
+# applying
+# 3. Running spatch, if suggests no changes (by far the common
+# case) we invoke "spatchCache.getCmd" and
+# "spatchCache.setCmd" with a hash SHA-256 to ask "does this
+# ID have no changes" or "say that ID had no changes>
+# 4. If no "spatchCache.{set,get}Cmd" is specified we'll use
+# "redis-cli" and maintain a SET called "spatch-cache". Set
+# appropriate redis memory policies to keep it from growing
+# out of control.
+#
+# This along with the general incremental "make" support for
+# "contrib/coccinelle" makes it viable to (re-)run coccicheck
+# e.g. when merging integration branches.
+#
+# Note that the "--very-quiet" flag is currently critical. The cache
+# will refuse to cache anything that has output on STDERR (which might
+# be errors from spatch), but see spatchCache.cacheWhenStderr below.
+#
+# The STDERR (and exit code) could in principle be cached (as with
+# ccache), but then the simple structure in the Redis cache would need
+# to change, so just supply "--very-quiet" for now.
+#
+# To use this, simply set SPATCH to
+# contrib/coccinelle/spatchcache. Then optionally set:
+#
+# [spatchCache]
+# # Optional: path to a custom spatch
+# spatch = ~/g/coccicheck/spatch.opt
+#
+# As well as this trace config (debug implies trace):
+#
+# cacheWhenStderr = true
+# trace = false
+# debug = false
+#
+# The ".depend/grep.o.d" can also be customized, as a string that will
+# be eval'd, it has access to a "$dirname" and "$basename":
+#
+# [spatchCache]
+# dependFormat = "$dirname/.depend/${basename%.c}.o.d"
+#
+# Setting "trace" to "true" allows for seeing when we have a cache HIT
+# or MISS. To debug whether the cache is working do that, and run e.g.:
+#
+# redis-cli FLUSHALL
+# <make && make coccicheck, as above>
+# grep -hore HIT -e MISS -e SET -e NOCACHE -e CANTCACHE .build/contrib/coccinelle | sort | uniq -c
+# 600 CANTCACHE
+# 7365 MISS
+# 7365 SET
+#
+# A subsequent "make cocciclean && make coccicheck" should then have
+# all "HIT"'s and "CANTCACHE"'s.
+#
+# The "spatchCache.cacheWhenStderr" option is critical when using
+# spatchCache.{trace,debug} to debug whether something is set in the
+# cache, as we'll write to the spatch logs in .build/* we'd otherwise
+# always emit a NOCACHE.
+#
+# Reading the config can make the command much slower, to work around
+# this the config can be set in the environment, with environment
+# variable name corresponding to the config key. "default" can be used
+# to use whatever's the script default, e.g. setting
+# spatchCache.cacheWhenStderr=true and deferring to the defaults for
+# the rest is:
+#
+# export GIT_CONTRIB_SPATCHCACHE_DEBUG=default
+# export GIT_CONTRIB_SPATCHCACHE_TRACE=default
+# export GIT_CONTRIB_SPATCHCACHE_CACHEWHENSTDERR=true
+# export GIT_CONTRIB_SPATCHCACHE_SPATCH=default
+# export GIT_CONTRIB_SPATCHCACHE_DEPENDFORMAT=default
+# export GIT_CONTRIB_SPATCHCACHE_SETCMD=default
+# export GIT_CONTRIB_SPATCHCACHE_GETCMD=default
+
+set -e
+
+env_or_config () {
+ env="$1"
+ shift
+ if test "$env" = "default"
+ then
+ # Avoid expensive "git config" invocation
+ return
+ elif test -n "$env"
+ then
+ echo "$env"
+ else
+ git config $@ || :
+ fi
+}
+
+## Our own configuration & options
+debug=$(env_or_config "$GIT_CONTRIB_SPATCHCACHE_DEBUG" --bool "spatchCache.debug")
+if test "$debug" != "true"
+then
+ debug=
+fi
+if test -n "$debug"
+then
+ set -x
+fi
+
+trace=$(env_or_config "$GIT_CONTRIB_SPATCHCACHE_TRACE" --bool "spatchCache.trace")
+if test "$trace" != "true"
+then
+ trace=
+fi
+if test -n "$debug"
+then
+ # debug implies trace
+ trace=true
+fi
+
+cacheWhenStderr=$(env_or_config "$GIT_CONTRIB_SPATCHCACHE_CACHEWHENSTDERR" --bool "spatchCache.cacheWhenStderr")
+if test "$cacheWhenStderr" != "true"
+then
+ cacheWhenStderr=
+fi
+
+trace_it () {
+ if test -z "$trace"
+ then
+ return
+ fi
+ echo "$@" >&2
+}
+
+spatch=$(env_or_config "$GIT_CONTRIB_SPATCHCACHE_SPATCH" --path "spatchCache.spatch")
+if test -n "$spatch"
+then
+ if test -n "$debug"
+ then
+ trace_it "custom spatchCache.spatch='$spatch'"
+ fi
+else
+ spatch=spatch
+fi
+
+dependFormat='$dirname/.depend/${basename%.c}.o.d'
+dependFormatCfg=$(env_or_config "$GIT_CONTRIB_SPATCHCACHE_DEPENDFORMAT" "spatchCache.dependFormat")
+if test -n "$dependFormatCfg"
+then
+ dependFormat="$dependFormatCfg"
+fi
+
+set=$(env_or_config "$GIT_CONTRIB_SPATCHCACHE_SETCMD" "spatchCache.setCmd")
+get=$(env_or_config "$GIT_CONTRIB_SPATCHCACHE_GETCMD" "spatchCache.getCmd")
+
+## Parse spatch()-like command-line for caching info
+arg_sp=
+arg_file=
+args="$@"
+spatch_opts() {
+ while test $# != 0
+ do
+ arg_file="$1"
+ case "$1" in
+ --sp-file)
+ arg_sp="$2"
+ ;;
+ esac
+ shift
+ done
+}
+spatch_opts "$@"
+if ! test -f "$arg_file"
+then
+ arg_file=
+fi
+
+hash_for_cache() {
+ # Parameters that should affect the cache
+ echo "args=$args"
+ echo "config spatchCache.spatch=$spatch"
+ echo "config spatchCache.debug=$debug"
+ echo "config spatchCache.trace=$trace"
+ echo "config spatchCache.cacheWhenStderr=$cacheWhenStderr"
+ echo
+
+ # Our target file and its dependencies
+ git hash-object "$1" "$2" $(grep -E -o '^[^:]+:$' "$3" | tr -d ':')
+}
+
+# Sanity checks
+if ! test -f "$arg_sp" && ! test -f "$arg_file"
+then
+ echo $0: no idea how to cache "$@" >&2
+ exit 128
+fi
+
+# Main logic
+dirname=$(dirname "$arg_file")
+basename=$(basename "$arg_file")
+eval "dep=$dependFormat"
+
+if ! test -f "$dep"
+then
+ trace_it "$0: CANTCACHE have no '$dep' for '$arg_file'!"
+ exec "$spatch" "$@"
+fi
+
+if test -n "$debug"
+then
+ trace_it "$0: The full cache input for '$arg_sp' '$arg_file' '$dep'"
+ hash_for_cache "$arg_sp" "$arg_file" "$dep" >&2
+fi
+sum=$(hash_for_cache "$arg_sp" "$arg_file" "$dep" | git hash-object --stdin)
+
+trace_it "$0: processing '$arg_file' with '$arg_sp' rule, and got hash '$sum' for it + '$dep'"
+
+getret=
+if test -z "$get"
+then
+ if test $(redis-cli SISMEMBER spatch-cache "$sum") = 1
+ then
+ getret=0
+ else
+ getret=1
+ fi
+else
+ $set "$sum"
+ getret=$?
+fi
+
+if test "$getret" = 0
+then
+ trace_it "$0: HIT for '$arg_file' with '$arg_sp'"
+ exit 0
+else
+ trace_it "$0: MISS: for '$arg_file' with '$arg_sp'"
+fi
+
+out="$(mktemp)"
+err="$(mktemp)"
+
+set +e
+"$spatch" "$@" >"$out" 2>>"$err"
+ret=$?
+cat "$out"
+cat "$err" >&2
+set -e
+
+nocache=
+if test $ret != 0
+then
+ nocache="exited non-zero: $ret"
+elif test -s "$out"
+then
+ nocache="had patch output"
+elif test -z "$cacheWhenStderr" && test -s "$err"
+then
+ nocache="had stderr (use --very-quiet or spatchCache.cacheWhenStderr=true?)"
+fi
+
+if test -n "$nocache"
+then
+ trace_it "$0: NOCACHE ($nocache): for '$arg_file' with '$arg_sp'"
+ exit "$ret"
+fi
+
+trace_it "$0: SET: for '$arg_file' with '$arg_sp'"
+
+setret=
+if test -z "$set"
+then
+ if test $(redis-cli SADD spatch-cache "$sum") = 1
+ then
+ setret=0
+ else
+ setret=1
+ fi
+else
+ "$set" "$sum"
+ setret=$?
+fi
+
+if test "$setret" != 0
+then
+ echo "FAILED to set '$sum' in cache!" >&2
+ exit 128
+fi
+
+exit "$ret"
diff --git a/contrib/coccinelle/strbuf.cocci b/contrib/coccinelle/strbuf.cocci
index 0970d98ad7..5f06105df6 100644
--- a/contrib/coccinelle/strbuf.cocci
+++ b/contrib/coccinelle/strbuf.cocci
@@ -1,4 +1,4 @@
-@ strbuf_addf_with_format_only @
+@@
expression E;
constant fmt !~ "%";
@@
diff --git a/contrib/coccinelle/swap.cocci b/contrib/coccinelle/swap.cocci
index a0934d1fda..522177afb6 100644
--- a/contrib/coccinelle/swap.cocci
+++ b/contrib/coccinelle/swap.cocci
@@ -1,4 +1,4 @@
-@ swap_with_declaration @
+@@
type T;
identifier tmp;
T a, b;
diff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci
new file mode 100644
index 0000000000..765ad68967
--- /dev/null
+++ b/contrib/coccinelle/the_repository.cocci
@@ -0,0 +1,123 @@
+// Fully migrated "the_repository" additions
+@@
+@@
+(
+// cache.h
+- get_oid
++ repo_get_oid
+|
+- get_oid_commit
++ repo_get_oid_commit
+|
+- get_oid_committish
++ repo_get_oid_committish
+|
+- get_oid_tree
++ repo_get_oid_tree
+|
+- get_oid_treeish
++ repo_get_oid_treeish
+|
+- get_oid_blob
++ repo_get_oid_blob
+|
+- get_oid_mb
++ repo_get_oid_mb
+|
+- find_unique_abbrev
++ repo_find_unique_abbrev
+|
+- find_unique_abbrev_r
++ repo_find_unique_abbrev_r
+|
+- for_each_abbrev
++ repo_for_each_abbrev
+|
+- interpret_branch_name
++ repo_interpret_branch_name
+|
+- peel_to_type
++ repo_peel_to_type
+// commit-reach.h
+|
+- get_merge_bases
++ repo_get_merge_bases
+|
+- get_merge_bases_many
++ repo_get_merge_bases_many
+|
+- get_merge_bases_many_dirty
++ repo_get_merge_bases_many_dirty
+|
+- in_merge_bases
++ repo_in_merge_bases
+|
+- in_merge_bases_many
++ repo_in_merge_bases_many
+// commit.h
+|
+- parse_commit_internal
++ repo_parse_commit_internal
+|
+- parse_commit
++ repo_parse_commit
+|
+- get_commit_buffer
++ repo_get_commit_buffer
+|
+- unuse_commit_buffer
++ repo_unuse_commit_buffer
+|
+- logmsg_reencode
++ repo_logmsg_reencode
+|
+- get_commit_tree
++ repo_get_commit_tree
+// diff.h
+|
+- diff_setup
++ repo_diff_setup
+// object-store.h
+|
+- read_object_file
++ repo_read_object_file
+|
+- has_object_file
++ repo_has_object_file
+|
+- has_object_file_with_flags
++ repo_has_object_file_with_flags
+// pretty.h
+|
+- format_commit_message
++ repo_format_commit_message
+// packfile.h
+|
+- approximate_object_count
++ repo_approximate_object_count
+// promisor-remote.h
+|
+- promisor_remote_reinit
++ repo_promisor_remote_reinit
+|
+- promisor_remote_find
++ repo_promisor_remote_find
+|
+- has_promisor_remote
++ repo_has_promisor_remote
+// refs.h
+|
+- dwim_ref
++ repo_dwim_ref
+// rerere.h
+|
+- rerere
++ repo_rerere
+// revision.h
+|
+- init_revisions
++ repo_init_revisions
+)
+ (
++ the_repository,
+ ...)
diff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci
deleted file mode 100644
index 072ea0d922..0000000000
--- a/contrib/coccinelle/the_repository.pending.cocci
+++ /dev/null
@@ -1,129 +0,0 @@
-// This file is used for the ongoing refactoring of
-// bringing the index or repository struct in all of
-// our code base.
-
-@@
-expression E;
-expression F;
-expression G;
-@@
-- read_object_file(
-+ repo_read_object_file(the_repository,
- E, F, G)
-
-@@
-expression E;
-@@
-- has_object_file(
-+ repo_has_object_file(the_repository,
- E)
-
-@@
-expression E;
-expression F;
-@@
-- has_object_file_with_flags(
-+ repo_has_object_file_with_flags(the_repository,
- E)
-
-@@
-expression E;
-expression F;
-expression G;
-@@
-- parse_commit_internal(
-+ repo_parse_commit_internal(the_repository,
- E, F, G)
-
-@@
-expression E;
-expression F;
-@@
-- parse_commit_gently(
-+ repo_parse_commit_gently(the_repository,
- E, F)
-
-@@
-expression E;
-@@
-- parse_commit(
-+ repo_parse_commit(the_repository,
- E)
-
-@@
-expression E;
-expression F;
-@@
-- get_merge_bases(
-+ repo_get_merge_bases(the_repository,
- E, F);
-
-@@
-expression E;
-expression F;
-expression G;
-@@
-- get_merge_bases_many(
-+ repo_get_merge_bases_many(the_repository,
- E, F, G);
-
-@@
-expression E;
-expression F;
-expression G;
-@@
-- get_merge_bases_many_dirty(
-+ repo_get_merge_bases_many_dirty(the_repository,
- E, F, G);
-
-@@
-expression E;
-expression F;
-@@
-- in_merge_bases(
-+ repo_in_merge_bases(the_repository,
- E, F);
-
-@@
-expression E;
-expression F;
-expression G;
-@@
-- in_merge_bases_many(
-+ repo_in_merge_bases_many(the_repository,
- E, F, G);
-
-@@
-expression E;
-expression F;
-@@
-- get_commit_buffer(
-+ repo_get_commit_buffer(the_repository,
- E, F);
-
-@@
-expression E;
-expression F;
-@@
-- unuse_commit_buffer(
-+ repo_unuse_commit_buffer(the_repository,
- E, F);
-
-@@
-expression E;
-expression F;
-expression G;
-@@
-- logmsg_reencode(
-+ repo_logmsg_reencode(the_repository,
- E, F, G);
-
-@@
-expression E;
-expression F;
-expression G;
-expression H;
-@@
-- format_commit_message(
-+ repo_format_commit_message(the_repository,
- E, F, G, H);
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index ba5c395d2d..dc95c34cc8 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -58,6 +58,12 @@
#
# When set to "1" suggest all options, including options which are
# typically hidden (e.g. '--allow-empty' for 'git commit').
+#
+# GIT_COMPLETION_IGNORE_CASE
+#
+# When set, uses for-each-ref '--ignore-case' to find refs that match
+# case insensitively, even on systems with case sensitive file systems
+# (e.g., completing tag name "FOO" on "git checkout f<TAB>").
case "$COMP_WORDBREAKS" in
*:*) : great ;;
@@ -646,6 +652,7 @@ __git_heads ()
local pfx="${1-}" cur_="${2-}" sfx="${3-}"
__git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
+ ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/heads/$cur_*" "refs/heads/$cur_*/**"
}
@@ -659,6 +666,7 @@ __git_remote_heads ()
local pfx="${1-}" cur_="${2-}" sfx="${3-}"
__git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
+ ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/remotes/$cur_*" "refs/remotes/$cur_*/**"
}
@@ -669,6 +677,7 @@ __git_tags ()
local pfx="${1-}" cur_="${2-}" sfx="${3-}"
__git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
+ ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/tags/$cur_*" "refs/tags/$cur_*/**"
}
@@ -688,6 +697,7 @@ __git_dwim_remote_heads ()
# but only output if the branch name is unique
__git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
--sort="refname:strip=3" \
+ ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/remotes/*/$cur_*" "refs/remotes/*/$cur_*/**" | \
uniq -u
}
@@ -712,6 +722,7 @@ __git_refs ()
local format refs
local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}"
local match="${4-}"
+ local umatch="${4-}"
local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers
__git_find_repo_path
@@ -735,12 +746,19 @@ __git_refs ()
fi
fi
+ if test "${GIT_COMPLETION_IGNORE_CASE:+1}" = "1"
+ then
+ # uppercase with tr instead of ${match,^^} for bash 3.2 compatibility
+ umatch=$(echo "$match" | tr a-z A-Z 2>/dev/null || echo "$match")
+ fi
+
if [ "$list_refs_from" = path ]; then
if [[ "$cur_" == ^* ]]; then
pfx="$pfx^"
fer_pfx="$fer_pfx^"
cur_=${cur_#^}
match=${match#^}
+ umatch=${umatch#^}
fi
case "$cur_" in
refs|refs/*)
@@ -751,7 +769,7 @@ __git_refs ()
*)
for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD; do
case "$i" in
- $match*)
+ $match*|$umatch*)
if [ -e "$dir/$i" ]; then
echo "$pfx$i$sfx"
fi
@@ -765,6 +783,7 @@ __git_refs ()
;;
esac
__git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \
+ ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"${refs[@]}"
if [ -n "$track" ]; then
__git_dwim_remote_heads "$pfx" "$match" "$sfx"
@@ -784,15 +803,16 @@ __git_refs ()
*)
if [ "$list_refs_from" = remote ]; then
case "HEAD" in
- $match*) echo "${pfx}HEAD$sfx" ;;
+ $match*|$umatch*) echo "${pfx}HEAD$sfx" ;;
esac
__git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
+ ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/remotes/$remote/$match*" \
"refs/remotes/$remote/$match*/**"
else
local query_symref
case "HEAD" in
- $match*) query_symref="HEAD" ;;
+ $match*|$umatch*) query_symref="HEAD" ;;
esac
__git ls-remote "$remote" $query_symref \
"refs/tags/$match*" "refs/heads/$match*" \
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 57972c2845..2c030050ae 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -100,9 +100,7 @@
#
# If you would like a colored hint about the current dirty state, set
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
-# the colored output of "git status -sb" and are available only when
-# using __git_ps1 for PROMPT_COMMAND or precmd in Bash,
-# but always available in Zsh.
+# the colored output of "git status -sb".
#
# If you would like __git_ps1 to do nothing in the case when the current
# directory is set up to be ignored by git, then set
@@ -259,12 +257,12 @@ __git_ps1_colorize_gitstring ()
local c_lblue='%F{blue}'
local c_clear='%f'
else
- # Using \[ and \] around colors is necessary to prevent
+ # Using \001 and \002 around colors is necessary to prevent
# issues with command line editing/browsing/completion!
- local c_red='\[\e[31m\]'
- local c_green='\[\e[32m\]'
- local c_lblue='\[\e[1;34m\]'
- local c_clear='\[\e[0m\]'
+ local c_red=$'\001\e[31m\002'
+ local c_green=$'\001\e[32m\002'
+ local c_lblue=$'\001\e[1;34m\002'
+ local c_clear=$'\001\e[0m\002'
fi
local bad_color=$c_red
local ok_color=$c_green
@@ -300,7 +298,7 @@ __git_ps1_colorize_gitstring ()
# variable, in that order.
__git_eread ()
{
- test -r "$1" && IFS=$'\r\n' read "$2" <"$1"
+ test -r "$1" && IFS=$'\r\n' read -r "$2" <"$1"
}
# see if a cherry-pick or revert is in progress, if the user has committed a
@@ -574,11 +572,8 @@ __git_ps1 ()
b="\${__git_ps1_branch_name}"
fi
- # NO color option unless in PROMPT_COMMAND mode or it's Zsh
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
- if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
- __git_ps1_colorize_gitstring
- fi
+ __git_ps1_colorize_gitstring
fi
local f="$h$w$i$s$u$p"
diff --git a/contrib/credential/gnome-keyring/.gitignore b/contrib/credential/gnome-keyring/.gitignore
deleted file mode 100644
index 88d8fcdbce..0000000000
--- a/contrib/credential/gnome-keyring/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-git-credential-gnome-keyring
diff --git a/contrib/credential/gnome-keyring/Makefile b/contrib/credential/gnome-keyring/Makefile
deleted file mode 100644
index 22c19df94b..0000000000
--- a/contrib/credential/gnome-keyring/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-MAIN:=git-credential-gnome-keyring
-all:: $(MAIN)
-
-CC = gcc
-RM = rm -f
-CFLAGS = -g -O2 -Wall
-PKG_CONFIG = pkg-config
-
--include ../../../config.mak.autogen
--include ../../../config.mak
-
-INCS:=$(shell $(PKG_CONFIG) --cflags gnome-keyring-1 glib-2.0)
-LIBS:=$(shell $(PKG_CONFIG) --libs gnome-keyring-1 glib-2.0)
-
-SRCS:=$(MAIN).c
-OBJS:=$(SRCS:.c=.o)
-
-%.o: %.c
- $(CC) $(CFLAGS) $(CPPFLAGS) $(INCS) -o $@ -c $<
-
-$(MAIN): $(OBJS)
- $(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
-
-clean:
- @$(RM) $(MAIN) $(OBJS)
diff --git a/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c b/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
deleted file mode 100644
index 5927e27ae6..0000000000
--- a/contrib/credential/gnome-keyring/git-credential-gnome-keyring.c
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * Copyright (C) 2011 John Szakmeister <john@szakmeister.net>
- * 2012 Philipp A. Hartmann <pah@qo.cx>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * Credits:
- * - GNOME Keyring API handling originally written by John Szakmeister
- * - ported to credential helper API by Philipp A. Hartmann
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <gnome-keyring.h>
-
-#ifdef GNOME_KEYRING_DEFAULT
-
- /* Modern gnome-keyring */
-
-#include <gnome-keyring-memory.h>
-
-#else
-
- /*
- * Support ancient gnome-keyring, circ. RHEL 5.X.
- * GNOME_KEYRING_DEFAULT seems to have been introduced with Gnome 2.22,
- * and the other features roughly around Gnome 2.20, 6 months before.
- * Ubuntu 8.04 used Gnome 2.22 (I think). Not sure any distro used 2.20.
- * So the existence/non-existence of GNOME_KEYRING_DEFAULT seems like
- * a decent thing to use as an indicator.
- */
-
-#define GNOME_KEYRING_DEFAULT NULL
-
-/*
- * ancient gnome-keyring returns DENIED when an entry is not found.
- * Setting NO_MATCH to DENIED will prevent us from reporting DENIED
- * errors during get and erase operations, but we will still report
- * DENIED errors during a store.
- */
-#define GNOME_KEYRING_RESULT_NO_MATCH GNOME_KEYRING_RESULT_DENIED
-
-#define gnome_keyring_memory_alloc g_malloc
-#define gnome_keyring_memory_free gnome_keyring_free_password
-#define gnome_keyring_memory_strdup g_strdup
-
-static const char *gnome_keyring_result_to_message(GnomeKeyringResult result)
-{
- switch (result) {
- case GNOME_KEYRING_RESULT_OK:
- return "OK";
- case GNOME_KEYRING_RESULT_DENIED:
- return "Denied";
- case GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON:
- return "No Keyring Daemon";
- case GNOME_KEYRING_RESULT_ALREADY_UNLOCKED:
- return "Already UnLocked";
- case GNOME_KEYRING_RESULT_NO_SUCH_KEYRING:
- return "No Such Keyring";
- case GNOME_KEYRING_RESULT_BAD_ARGUMENTS:
- return "Bad Arguments";
- case GNOME_KEYRING_RESULT_IO_ERROR:
- return "IO Error";
- case GNOME_KEYRING_RESULT_CANCELLED:
- return "Cancelled";
- case GNOME_KEYRING_RESULT_ALREADY_EXISTS:
- return "Already Exists";
- default:
- return "Unknown Error";
- }
-}
-
-/*
- * Support really ancient gnome-keyring, circ. RHEL 4.X.
- * Just a guess for the Glib version. Glib 2.8 was roughly Gnome 2.12 ?
- * Which was released with gnome-keyring 0.4.3 ??
- */
-#if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 8
-
-static void gnome_keyring_done_cb(GnomeKeyringResult result, gpointer user_data)
-{
- gpointer *data = (gpointer *)user_data;
- int *done = (int *)data[0];
- GnomeKeyringResult *r = (GnomeKeyringResult *)data[1];
-
- *r = result;
- *done = 1;
-}
-
-static void wait_for_request_completion(int *done)
-{
- GMainContext *mc = g_main_context_default();
- while (!*done)
- g_main_context_iteration(mc, TRUE);
-}
-
-static GnomeKeyringResult gnome_keyring_item_delete_sync(const char *keyring, guint32 id)
-{
- int done = 0;
- GnomeKeyringResult result;
- gpointer data[] = { &done, &result };
-
- gnome_keyring_item_delete(keyring, id, gnome_keyring_done_cb, data,
- NULL);
-
- wait_for_request_completion(&done);
-
- return result;
-}
-
-#endif
-#endif
-
-/*
- * This credential struct and API is simplified from git's credential.{h,c}
- */
-struct credential {
- char *protocol;
- char *host;
- unsigned short port;
- char *path;
- char *username;
- char *password;
-};
-
-#define CREDENTIAL_INIT { 0 }
-
-typedef int (*credential_op_cb)(struct credential *);
-
-struct credential_operation {
- char *name;
- credential_op_cb op;
-};
-
-#define CREDENTIAL_OP_END { NULL, NULL }
-
-/* ----------------- GNOME Keyring functions ----------------- */
-
-/* create a special keyring option string, if path is given */
-static char *keyring_object(struct credential *c)
-{
- if (!c->path)
- return NULL;
-
- if (c->port)
- return g_strdup_printf("%s:%hd/%s", c->host, c->port, c->path);
-
- return g_strdup_printf("%s/%s", c->host, c->path);
-}
-
-static int keyring_get(struct credential *c)
-{
- char *object = NULL;
- GList *entries;
- GnomeKeyringNetworkPasswordData *password_data;
- GnomeKeyringResult result;
-
- if (!c->protocol || !(c->host || c->path))
- return EXIT_FAILURE;
-
- object = keyring_object(c);
-
- result = gnome_keyring_find_network_password_sync(
- c->username,
- NULL /* domain */,
- c->host,
- object,
- c->protocol,
- NULL /* authtype */,
- c->port,
- &entries);
-
- g_free(object);
-
- if (result == GNOME_KEYRING_RESULT_NO_MATCH)
- return EXIT_SUCCESS;
-
- if (result == GNOME_KEYRING_RESULT_CANCELLED)
- return EXIT_SUCCESS;
-
- if (result != GNOME_KEYRING_RESULT_OK) {
- g_critical("%s", gnome_keyring_result_to_message(result));
- return EXIT_FAILURE;
- }
-
- /* pick the first one from the list */
- password_data = (GnomeKeyringNetworkPasswordData *)entries->data;
-
- gnome_keyring_memory_free(c->password);
- c->password = gnome_keyring_memory_strdup(password_data->password);
-
- if (!c->username)
- c->username = g_strdup(password_data->user);
-
- gnome_keyring_network_password_list_free(entries);
-
- return EXIT_SUCCESS;
-}
-
-
-static int keyring_store(struct credential *c)
-{
- guint32 item_id;
- char *object = NULL;
- GnomeKeyringResult result;
-
- /*
- * Sanity check that what we are storing is actually sensible.
- * In particular, we can't make a URL without a protocol field.
- * Without either a host or pathname (depending on the scheme),
- * we have no primary key. And without a username and password,
- * we are not actually storing a credential.
- */
- if (!c->protocol || !(c->host || c->path) ||
- !c->username || !c->password)
- return EXIT_FAILURE;
-
- object = keyring_object(c);
-
- result = gnome_keyring_set_network_password_sync(
- GNOME_KEYRING_DEFAULT,
- c->username,
- NULL /* domain */,
- c->host,
- object,
- c->protocol,
- NULL /* authtype */,
- c->port,
- c->password,
- &item_id);
-
- g_free(object);
-
- if (result != GNOME_KEYRING_RESULT_OK &&
- result != GNOME_KEYRING_RESULT_CANCELLED) {
- g_critical("%s", gnome_keyring_result_to_message(result));
- return EXIT_FAILURE;
- }
-
- return EXIT_SUCCESS;
-}
-
-static int keyring_erase(struct credential *c)
-{
- char *object = NULL;
- GList *entries;
- GnomeKeyringNetworkPasswordData *password_data;
- GnomeKeyringResult result;
-
- /*
- * Sanity check that we actually have something to match
- * against. The input we get is a restrictive pattern,
- * so technically a blank credential means "erase everything".
- * But it is too easy to accidentally send this, since it is equivalent
- * to empty input. So explicitly disallow it, and require that the
- * pattern have some actual content to match.
- */
- if (!c->protocol && !c->host && !c->path && !c->username)
- return EXIT_FAILURE;
-
- object = keyring_object(c);
-
- result = gnome_keyring_find_network_password_sync(
- c->username,
- NULL /* domain */,
- c->host,
- object,
- c->protocol,
- NULL /* authtype */,
- c->port,
- &entries);
-
- g_free(object);
-
- if (result == GNOME_KEYRING_RESULT_NO_MATCH)
- return EXIT_SUCCESS;
-
- if (result == GNOME_KEYRING_RESULT_CANCELLED)
- return EXIT_SUCCESS;
-
- if (result != GNOME_KEYRING_RESULT_OK) {
- g_critical("%s", gnome_keyring_result_to_message(result));
- return EXIT_FAILURE;
- }
-
- /* pick the first one from the list (delete all matches?) */
- password_data = (GnomeKeyringNetworkPasswordData *)entries->data;
-
- result = gnome_keyring_item_delete_sync(
- password_data->keyring, password_data->item_id);
-
- gnome_keyring_network_password_list_free(entries);
-
- if (result != GNOME_KEYRING_RESULT_OK) {
- g_critical("%s", gnome_keyring_result_to_message(result));
- return EXIT_FAILURE;
- }
-
- return EXIT_SUCCESS;
-}
-
-/*
- * Table with helper operation callbacks, used by generic
- * credential helper main function.
- */
-static struct credential_operation const credential_helper_ops[] = {
- { "get", keyring_get },
- { "store", keyring_store },
- { "erase", keyring_erase },
- CREDENTIAL_OP_END
-};
-
-/* ------------------ credential functions ------------------ */
-
-static void credential_init(struct credential *c)
-{
- memset(c, 0, sizeof(*c));
-}
-
-static void credential_clear(struct credential *c)
-{
- g_free(c->protocol);
- g_free(c->host);
- g_free(c->path);
- g_free(c->username);
- gnome_keyring_memory_free(c->password);
-
- credential_init(c);
-}
-
-static int credential_read(struct credential *c)
-{
- char *buf;
- size_t line_len;
- char *key;
- char *value;
-
- key = buf = gnome_keyring_memory_alloc(1024);
-
- while (fgets(buf, 1024, stdin)) {
- line_len = strlen(buf);
-
- if (line_len && buf[line_len-1] == '\n')
- buf[--line_len] = '\0';
-
- if (!line_len)
- break;
-
- value = strchr(buf, '=');
- if (!value) {
- g_warning("invalid credential line: %s", key);
- gnome_keyring_memory_free(buf);
- return -1;
- }
- *value++ = '\0';
-
- if (!strcmp(key, "protocol")) {
- g_free(c->protocol);
- c->protocol = g_strdup(value);
- } else if (!strcmp(key, "host")) {
- g_free(c->host);
- c->host = g_strdup(value);
- value = strrchr(c->host, ':');
- if (value) {
- *value++ = '\0';
- c->port = atoi(value);
- }
- } else if (!strcmp(key, "path")) {
- g_free(c->path);
- c->path = g_strdup(value);
- } else if (!strcmp(key, "username")) {
- g_free(c->username);
- c->username = g_strdup(value);
- } else if (!strcmp(key, "password")) {
- gnome_keyring_memory_free(c->password);
- c->password = gnome_keyring_memory_strdup(value);
- while (*value)
- *value++ = '\0';
- }
- /*
- * Ignore other lines; we don't know what they mean, but
- * this future-proofs us when later versions of git do
- * learn new lines, and the helpers are updated to match.
- */
- }
-
- gnome_keyring_memory_free(buf);
-
- return 0;
-}
-
-static void credential_write_item(FILE *fp, const char *key, const char *value)
-{
- if (!value)
- return;
- fprintf(fp, "%s=%s\n", key, value);
-}
-
-static void credential_write(const struct credential *c)
-{
- /* only write username/password, if set */
- credential_write_item(stdout, "username", c->username);
- credential_write_item(stdout, "password", c->password);
-}
-
-static void usage(const char *name)
-{
- struct credential_operation const *try_op = credential_helper_ops;
- const char *basename = strrchr(name, '/');
-
- basename = (basename) ? basename + 1 : name;
- fprintf(stderr, "usage: %s <", basename);
- while (try_op->name) {
- fprintf(stderr, "%s", (try_op++)->name);
- if (try_op->name)
- fprintf(stderr, "%s", "|");
- }
- fprintf(stderr, "%s", ">\n");
-}
-
-int main(int argc, char *argv[])
-{
- int ret = EXIT_SUCCESS;
-
- struct credential_operation const *try_op = credential_helper_ops;
- struct credential cred = CREDENTIAL_INIT;
-
- if (!argv[1]) {
- usage(argv[0]);
- exit(EXIT_FAILURE);
- }
-
- g_set_application_name("Git Credential Helper");
-
- /* lookup operation callback */
- while (try_op->name && strcmp(argv[1], try_op->name))
- try_op++;
-
- /* unsupported operation given -- ignore silently */
- if (!try_op->name || !try_op->op)
- goto out;
-
- ret = credential_read(&cred);
- if (ret)
- goto out;
-
- /* perform credential operation */
- ret = (*try_op->op)(&cred);
-
- credential_write(&cred);
-
-out:
- credential_clear(&cred);
- return ret;
-}
diff --git a/contrib/credential/libsecret/.gitignore b/contrib/credential/libsecret/.gitignore
new file mode 100644
index 0000000000..4fa22359e2
--- /dev/null
+++ b/contrib/credential/libsecret/.gitignore
@@ -0,0 +1 @@
+git-credential-libsecret
diff --git a/contrib/credential/libsecret/git-credential-libsecret.c b/contrib/credential/libsecret/git-credential-libsecret.c
index 2c5d76d789..ef681f29d5 100644
--- a/contrib/credential/libsecret/git-credential-libsecret.c
+++ b/contrib/credential/libsecret/git-credential-libsecret.c
@@ -244,17 +244,16 @@ static void credential_clear(struct credential *c)
static int credential_read(struct credential *c)
{
- char *buf;
- size_t line_len;
+ char *buf = NULL;
+ size_t alloc;
+ ssize_t line_len;
char *key;
char *value;
- key = buf = g_malloc(1024);
+ while ((line_len = getline(&buf, &alloc, stdin)) > 0) {
+ key = buf;
- while (fgets(buf, 1024, stdin)) {
- line_len = strlen(buf);
-
- if (line_len && buf[line_len-1] == '\n')
+ if (buf[line_len-1] == '\n')
buf[--line_len] = '\0';
if (!line_len)
@@ -298,7 +297,7 @@ static int credential_read(struct credential *c)
*/
}
- g_free(buf);
+ free(buf);
return 0;
}
diff --git a/contrib/credential/netrc/git-credential-netrc.perl b/contrib/credential/netrc/git-credential-netrc.perl
index bc57cc6588..9fb998ae09 100755
--- a/contrib/credential/netrc/git-credential-netrc.perl
+++ b/contrib/credential/netrc/git-credential-netrc.perl
@@ -356,7 +356,10 @@ sub read_credential_data_from_stdin {
next unless m/^([^=]+)=(.+)/;
my ($token, $value) = ($1, $2);
- die "Unknown search token $token" unless exists $q{$token};
+
+ # skip any unknown tokens
+ next unless exists $q{$token};
+
$q{$token} = $value;
log_debug("We were given search token $token and value $value");
}
diff --git a/contrib/credential/osxkeychain/git-credential-osxkeychain.c b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
index bf77748d60..5f2e5f16c8 100644
--- a/contrib/credential/osxkeychain/git-credential-osxkeychain.c
+++ b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
@@ -113,14 +113,16 @@ static void add_internet_password(void)
static void read_credential(void)
{
- char buf[1024];
+ char *buf = NULL;
+ size_t alloc;
+ ssize_t line_len;
- while (fgets(buf, sizeof(buf), stdin)) {
+ while ((line_len = getline(&buf, &alloc, stdin)) > 0) {
char *v;
if (!strcmp(buf, "\n"))
break;
- buf[strlen(buf)-1] = '\0';
+ buf[line_len-1] = '\0';
v = strchr(buf, '=');
if (!v)
@@ -159,7 +161,14 @@ static void read_credential(void)
username = xstrdup(v);
else if (!strcmp(buf, "password"))
password = xstrdup(v);
+ /*
+ * Ignore other lines; we don't know what they mean, but
+ * this future-proofs us when later versions of git do
+ * learn new lines, and the helpers are updated to match.
+ */
}
+
+ free(buf);
}
int main(int argc, const char **argv)
diff --git a/contrib/credential/wincred/git-credential-wincred.c b/contrib/credential/wincred/git-credential-wincred.c
index 5091048f9c..96f10613ae 100644
--- a/contrib/credential/wincred/git-credential-wincred.c
+++ b/contrib/credential/wincred/git-credential-wincred.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
+#include <wincred.h>
/* common helpers */
@@ -33,65 +34,8 @@ static void *xmalloc(size_t size)
return ret;
}
-/* MinGW doesn't have wincred.h, so we need to define stuff */
-
-typedef struct _CREDENTIAL_ATTRIBUTEW {
- LPWSTR Keyword;
- DWORD Flags;
- DWORD ValueSize;
- LPBYTE Value;
-} CREDENTIAL_ATTRIBUTEW, *PCREDENTIAL_ATTRIBUTEW;
-
-typedef struct _CREDENTIALW {
- DWORD Flags;
- DWORD Type;
- LPWSTR TargetName;
- LPWSTR Comment;
- FILETIME LastWritten;
- DWORD CredentialBlobSize;
- LPBYTE CredentialBlob;
- DWORD Persist;
- DWORD AttributeCount;
- PCREDENTIAL_ATTRIBUTEW Attributes;
- LPWSTR TargetAlias;
- LPWSTR UserName;
-} CREDENTIALW, *PCREDENTIALW;
-
-#define CRED_TYPE_GENERIC 1
-#define CRED_PERSIST_LOCAL_MACHINE 2
-#define CRED_MAX_ATTRIBUTES 64
-
-typedef BOOL (WINAPI *CredWriteWT)(PCREDENTIALW, DWORD);
-typedef BOOL (WINAPI *CredEnumerateWT)(LPCWSTR, DWORD, DWORD *,
- PCREDENTIALW **);
-typedef VOID (WINAPI *CredFreeT)(PVOID);
-typedef BOOL (WINAPI *CredDeleteWT)(LPCWSTR, DWORD, DWORD);
-
-static HMODULE advapi;
-static CredWriteWT CredWriteW;
-static CredEnumerateWT CredEnumerateW;
-static CredFreeT CredFree;
-static CredDeleteWT CredDeleteW;
-
-static void load_cred_funcs(void)
-{
- /* load DLLs */
- advapi = LoadLibraryExA("advapi32.dll", NULL,
- LOAD_LIBRARY_SEARCH_SYSTEM32);
- if (!advapi)
- die("failed to load advapi32.dll");
-
- /* get function pointers */
- CredWriteW = (CredWriteWT)GetProcAddress(advapi, "CredWriteW");
- CredEnumerateW = (CredEnumerateWT)GetProcAddress(advapi,
- "CredEnumerateW");
- CredFree = (CredFreeT)GetProcAddress(advapi, "CredFree");
- CredDeleteW = (CredDeleteWT)GetProcAddress(advapi, "CredDeleteW");
- if (!CredWriteW || !CredEnumerateW || !CredFree || !CredDeleteW)
- die("failed to load functions");
-}
-
-static WCHAR *wusername, *password, *protocol, *host, *path, target[1024];
+static WCHAR *wusername, *password, *protocol, *host, *path, target[1024],
+ *password_expiry_utc;
static void write_item(const char *what, LPCWSTR wbuf, int wlen)
{
@@ -183,6 +127,7 @@ static void get_credential(void)
CREDENTIALW **creds;
DWORD num_creds;
int i;
+ CREDENTIAL_ATTRIBUTEW *attr;
if (!CredEnumerateW(L"git:*", 0, &num_creds, &creds))
return;
@@ -195,6 +140,14 @@ static void get_credential(void)
write_item("password",
(LPCWSTR)creds[i]->CredentialBlob,
creds[i]->CredentialBlobSize / sizeof(WCHAR));
+ for (int j = 0; j < creds[i]->AttributeCount; j++) {
+ attr = creds[i]->Attributes + j;
+ if (!wcscmp(attr->Keyword, L"git_password_expiry_utc")) {
+ write_item("password_expiry_utc", (LPCWSTR)attr->Value,
+ attr->ValueSize / sizeof(WCHAR));
+ break;
+ }
+ }
break;
}
@@ -204,6 +157,7 @@ static void get_credential(void)
static void store_credential(void)
{
CREDENTIALW cred;
+ CREDENTIAL_ATTRIBUTEW expiry_attr;
if (!wusername || !password)
return;
@@ -217,6 +171,14 @@ static void store_credential(void)
cred.Persist = CRED_PERSIST_LOCAL_MACHINE;
cred.AttributeCount = 0;
cred.Attributes = NULL;
+ if (password_expiry_utc != NULL) {
+ expiry_attr.Keyword = L"git_password_expiry_utc";
+ expiry_attr.Value = (LPVOID)password_expiry_utc;
+ expiry_attr.ValueSize = (wcslen(password_expiry_utc)) * sizeof(WCHAR);
+ expiry_attr.Flags = 0;
+ cred.Attributes = &expiry_attr;
+ cred.AttributeCount = 1;
+ }
cred.TargetAlias = NULL;
cred.UserName = wusername;
@@ -249,17 +211,28 @@ static WCHAR *utf8_to_utf16_dup(const char *str)
return wstr;
}
+#define KB (1024)
+
static void read_credential(void)
{
- char buf[1024];
+ size_t alloc = 100 * KB;
+ char *buf = calloc(alloc, sizeof(*buf));
- while (fgets(buf, sizeof(buf), stdin)) {
+ while (fgets(buf, alloc, stdin)) {
char *v;
- int len = strlen(buf);
+ size_t len = strlen(buf);
+ int ends_in_newline = 0;
/* strip trailing CR / LF */
- while (len && strchr("\r\n", buf[len - 1]))
+ if (len && buf[len - 1] == '\n') {
+ buf[--len] = 0;
+ ends_in_newline = 1;
+ }
+ if (len && buf[len - 1] == '\r')
buf[--len] = 0;
+ if (!ends_in_newline)
+ die("bad input: %s", buf);
+
if (!*buf)
break;
@@ -278,9 +251,16 @@ static void read_credential(void)
wusername = utf8_to_utf16_dup(v);
} else if (!strcmp(buf, "password"))
password = utf8_to_utf16_dup(v);
- else
- die("unrecognized input");
+ else if (!strcmp(buf, "password_expiry_utc"))
+ password_expiry_utc = utf8_to_utf16_dup(v);
+ /*
+ * Ignore other lines; we don't know what they mean, but
+ * this future-proofs us when later versions of git do
+ * learn new lines, and the helpers are updated to match.
+ */
}
+
+ free(buf);
}
int main(int argc, char *argv[])
@@ -289,7 +269,7 @@ int main(int argc, char *argv[])
"usage: git credential-wincred <get|store|erase>\n";
if (!argv[1])
- die(usage);
+ die("%s", usage);
/* git use binary pipes to avoid CRLF-issues */
_setmode(_fileno(stdin), _O_BINARY);
@@ -297,8 +277,6 @@ int main(int argc, char *argv[])
read_credential();
- load_cred_funcs();
-
if (!protocol || !(host || path))
return 0;
diff --git a/contrib/git-jump/README b/contrib/git-jump/README
index 8bcace29d2..3211841305 100644
--- a/contrib/git-jump/README
+++ b/contrib/git-jump/README
@@ -79,6 +79,14 @@ git jump grep -i foo_bar
git config jump.grepCmd "ag --column"
--------------------------------------------------
+You can use the optional argument '--stdout' to print the listing to
+standard output instead of feeding it to the editor. You can use the
+argument with M-x grep on Emacs:
+
+--------------------------------------------------
+# In Emacs, M-x grep and invoke "git jump --stdout <mode>"
+M-x grep<RET>git jump --stdout diff<RET>
+--------------------------------------------------
Related Programs
----------------
@@ -100,7 +108,7 @@ Limitations
-----------
This script was written and tested with vim. Given that the quickfix
-format is the same as what gcc produces, I expect emacs users have a
+format is the same as what gcc produces, I expect other tools have a
similar feature for iterating through the list, but I know nothing about
how to activate it.
diff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump
index 92dbd4cde1..40c4b0d111 100755
--- a/contrib/git-jump/git-jump
+++ b/contrib/git-jump/git-jump
@@ -2,7 +2,7 @@
usage() {
cat <<\EOF
-usage: git jump <mode> [<args>]
+usage: git jump [--stdout] <mode> [<args>]
Jump to interesting elements in an editor.
The <mode> parameter is one of:
@@ -15,12 +15,30 @@ grep: elements are grep hits. Arguments are given to git grep or, if
configured, to the command in `jump.grepCmd`.
ws: elements are whitespace errors. Arguments are given to diff --check.
+
+If the optional argument `--stdout` is given, print the quickfix
+lines to standard output instead of feeding it to the editor.
EOF
}
open_editor() {
editor=`git var GIT_EDITOR`
- eval "$editor -q \$1"
+ case "$editor" in
+ *emacs*)
+ # Supported editor values are:
+ # - emacs
+ # - emacsclient
+ # - emacsclient -t
+ #
+ # Wait for completion of the asynchronously executed process
+ # to avoid race conditions in case of "emacsclient".
+ eval "$editor --eval \"(let ((buf (grep \\\"cat \$1\\\"))) (pop-to-buffer buf) (select-frame-set-input-focus (selected-frame)) (while (get-buffer-process buf) (sleep-for 0.1)))\""
+ ;;
+ *)
+ # assume anything else is vi-compatible
+ eval "$editor -q \$1"
+ ;;
+ esac
}
mode_diff() {
@@ -64,15 +82,36 @@ mode_ws() {
git diff --check "$@"
}
+use_stdout=
+while test $# -gt 0; do
+ case "$1" in
+ --stdout)
+ use_stdout=t
+ ;;
+ --*)
+ usage >&2
+ exit 1
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+done
if test $# -lt 1; then
usage >&2
exit 1
fi
mode=$1; shift
+type "mode_$mode" >/dev/null 2>&1 || { usage >&2; exit 1; }
+
+if test "$use_stdout" = "t"; then
+ "mode_$mode" "$@"
+ exit 0
+fi
trap 'rm -f "$tmp"' 0 1 2 3 15
tmp=`mktemp -t git-jump.XXXXXX` || exit 1
-type "mode_$mode" >/dev/null 2>&1 || { usage >&2; exit 1; }
"mode_$mode" "$@" >"$tmp"
test -s "$tmp" || exit 0
open_editor "$tmp"
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 7562a395c2..10c9c87839 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -98,10 +98,18 @@ progress () {
assert () {
if ! "$@"
then
- die "assertion failed: $*"
+ die "fatal: assertion failed: $*"
fi
}
+# Usage: die_incompatible_opt OPTION COMMAND
+die_incompatible_opt () {
+ assert test "$#" = 2
+ opt="$1"
+ arg_command="$2"
+ die "fatal: the '$opt' flag does not make sense with 'git subtree $arg_command'."
+}
+
main () {
if test $# -eq 0
then
@@ -147,7 +155,7 @@ main () {
allow_addmerge=$arg_split_rejoin
;;
*)
- die "Unknown command '$arg_command'"
+ die "fatal: unknown command '$arg_command'"
;;
esac
# Reset the arguments array for "real" flag parsing.
@@ -176,16 +184,16 @@ main () {
arg_debug=1
;;
--annotate)
- test -n "$allow_split" || die "The '$opt' flag does not make sense with 'git subtree $arg_command'."
+ test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
arg_split_annotate="$1"
shift
;;
--no-annotate)
- test -n "$allow_split" || die "The '$opt' flag does not make sense with 'git subtree $arg_command'."
+ test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
arg_split_annotate=
;;
-b)
- test -n "$allow_split" || die "The '$opt' flag does not make sense with 'git subtree $arg_command'."
+ test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
arg_split_branch="$1"
shift
;;
@@ -194,7 +202,7 @@ main () {
shift
;;
-m)
- test -n "$allow_addmerge" || die "The '$opt' flag does not make sense with 'git subtree $arg_command'."
+ test -n "$allow_addmerge" || die_incompatible_opt "$opt" "$arg_command"
arg_addmerge_message="$1"
shift
;;
@@ -202,41 +210,41 @@ main () {
arg_prefix=
;;
--onto)
- test -n "$allow_split" || die "The '$opt' flag does not make sense with 'git subtree $arg_command'."
+ test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
arg_split_onto="$1"
shift
;;
--no-onto)
- test -n "$allow_split" || die "The '$opt' flag does not make sense with 'git subtree $arg_command'."
+ test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
arg_split_onto=
;;
--rejoin)
- test -n "$allow_split" || die "The '$opt' flag does not make sense with 'git subtree $arg_command'."
+ test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
;;
--no-rejoin)
- test -n "$allow_split" || die "The '$opt' flag does not make sense with 'git subtree $arg_command'."
+ test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
;;
--ignore-joins)
- test -n "$allow_split" || die "The '$opt' flag does not make sense with 'git subtree $arg_command'."
+ test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
arg_split_ignore_joins=1
;;
--no-ignore-joins)
- test -n "$allow_split" || die "The '$opt' flag does not make sense with 'git subtree $arg_command'."
+ test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
arg_split_ignore_joins=
;;
--squash)
- test -n "$allow_addmerge" || die "The '$opt' flag does not make sense with 'git subtree $arg_command'."
+ test -n "$allow_addmerge" || die_incompatible_opt "$opt" "$arg_command"
arg_addmerge_squash=1
;;
--no-squash)
- test -n "$allow_addmerge" || die "The '$opt' flag does not make sense with 'git subtree $arg_command'."
+ test -n "$allow_addmerge" || die_incompatible_opt "$opt" "$arg_command"
arg_addmerge_squash=
;;
--)
break
;;
*)
- die "Unexpected option: $opt"
+ die "fatal: unexpected option: $opt"
;;
esac
done
@@ -244,17 +252,17 @@ main () {
if test -z "$arg_prefix"
then
- die "You must provide the --prefix option."
+ die "fatal: you must provide the --prefix option."
fi
case "$arg_command" in
add)
test -e "$arg_prefix" &&
- die "prefix '$arg_prefix' already exists."
+ die "fatal: prefix '$arg_prefix' already exists."
;;
*)
test -e "$arg_prefix" ||
- die "'$arg_prefix' does not exist; use 'git subtree add'"
+ die "fatal: '$arg_prefix' does not exist; use 'git subtree add'"
;;
esac
@@ -274,11 +282,11 @@ cache_setup () {
assert test $# = 0
cachedir="$GIT_DIR/subtree-cache/$$"
rm -rf "$cachedir" ||
- die "Can't delete old cachedir: $cachedir"
+ die "fatal: can't delete old cachedir: $cachedir"
mkdir -p "$cachedir" ||
- die "Can't create new cachedir: $cachedir"
+ die "fatal: can't create new cachedir: $cachedir"
mkdir -p "$cachedir/notree" ||
- die "Can't create new cachedir: $cachedir/notree"
+ die "fatal: can't create new cachedir: $cachedir/notree"
debug "Using cachedir: $cachedir" >&2
}
@@ -334,7 +342,7 @@ cache_set () {
test "$oldrev" != "latest_new" &&
test -e "$cachedir/$oldrev"
then
- die "cache for $oldrev already exists!"
+ die "fatal: cache for $oldrev already exists!"
fi
echo "$newrev" >"$cachedir/$oldrev"
}
@@ -363,13 +371,47 @@ try_remove_previous () {
fi
}
-# Usage: find_latest_squash DIR
+# Usage: process_subtree_split_trailer SPLIT_HASH MAIN_HASH [REPOSITORY]
+process_subtree_split_trailer () {
+ assert test $# = 2 -o $# = 3
+ b="$1"
+ sq="$2"
+ repository=""
+ if test "$#" = 3
+ then
+ repository="$3"
+ fi
+ fail_msg="fatal: could not rev-parse split hash $b from commit $sq"
+ if ! sub="$(git rev-parse --verify --quiet "$b^{commit}")"
+ then
+ # if 'repository' was given, try to fetch the 'git-subtree-split' hash
+ # before 'rev-parse'-ing it again, as it might be a tag that we do not have locally
+ if test -n "${repository}"
+ then
+ git fetch "$repository" "$b"
+ sub="$(git rev-parse --verify --quiet "$b^{commit}")" ||
+ die "$fail_msg"
+ else
+ hint1=$(printf "hint: hash might be a tag, try fetching it from the subtree repository:")
+ hint2=$(printf "hint: git fetch <subtree-repository> $b")
+ fail_msg=$(printf "$fail_msg\n$hint1\n$hint2")
+ die "$fail_msg"
+ fi
+ fi
+}
+
+# Usage: find_latest_squash DIR [REPOSITORY]
find_latest_squash () {
- assert test $# = 1
- debug "Looking for latest squash ($dir)..."
+ assert test $# = 1 -o $# = 2
+ dir="$1"
+ repository=""
+ if test "$#" = 2
+ then
+ repository="$2"
+ fi
+ debug "Looking for latest squash (dir=$dir, repository=$repository)..."
local indent=$(($indent + 1))
- dir="$1"
sq=
main=
sub=
@@ -387,8 +429,7 @@ find_latest_squash () {
main="$b"
;;
git-subtree-split:)
- sub="$(git rev-parse "$b^{commit}")" ||
- die "could not rev-parse split hash $b from commit $sq"
+ process_subtree_split_trailer "$b" "$sq" "$repository"
;;
END)
if test -n "$sub"
@@ -412,14 +453,19 @@ find_latest_squash () {
done || exit $?
}
-# Usage: find_existing_splits DIR REV
+# Usage: find_existing_splits DIR REV [REPOSITORY]
find_existing_splits () {
- assert test $# = 2
+ assert test $# = 2 -o $# = 3
debug "Looking for prior splits..."
local indent=$(($indent + 1))
dir="$1"
rev="$2"
+ repository=""
+ if test "$#" = 3
+ then
+ repository="$3"
+ fi
main=
sub=
local grep_format="^git-subtree-dir: $dir/*\$"
@@ -439,8 +485,7 @@ find_existing_splits () {
main="$b"
;;
git-subtree-split:)
- sub="$(git rev-parse "$b^{commit}")" ||
- die "could not rev-parse split hash $b from commit $sq"
+ process_subtree_split_trailer "$b" "$sq" "$repository"
;;
END)
debug "Main is: '$main'"
@@ -490,7 +535,7 @@ copy_commit () {
cat
) |
git commit-tree "$2" $3 # reads the rest of stdin
- ) || die "Can't copy commit $1"
+ ) || die "fatal: can't copy commit $1"
}
# Usage: add_msg DIR LATEST_OLD LATEST_NEW
@@ -718,11 +763,11 @@ ensure_clean () {
assert test $# = 0
if ! git diff-index HEAD --exit-code --quiet 2>&1
then
- die "Working tree has modifications. Cannot add."
+ die "fatal: working tree has modifications. Cannot add."
fi
if ! git diff-index --cached HEAD --exit-code --quiet 2>&1
then
- die "Index has modifications. Cannot add."
+ die "fatal: index has modifications. Cannot add."
fi
}
@@ -730,7 +775,7 @@ ensure_clean () {
ensure_valid_ref_format () {
assert test $# = 1
git check-ref-format "refs/heads/$1" ||
- die "'$1' does not look like a ref"
+ die "fatal: '$1' does not look like a ref"
}
# Usage: process_split_commit REV PARENTS
@@ -796,7 +841,7 @@ cmd_add () {
if test $# -eq 1
then
git rev-parse -q --verify "$1^{commit}" >/dev/null ||
- die "'$1' does not refer to a commit"
+ die "fatal: '$1' does not refer to a commit"
cmd_add_commit "$@"
@@ -811,7 +856,7 @@ cmd_add () {
cmd_add_repository "$@"
else
- say >&2 "error: parameters were '$*'"
+ say >&2 "fatal: parameters were '$*'"
die "Provide either a commit or a repository and commit."
fi
}
@@ -843,7 +888,7 @@ cmd_add_commit () {
git checkout -- "$dir" || exit $?
tree=$(git write-tree) || exit $?
- headrev=$(git rev-parse HEAD) || exit $?
+ headrev=$(git rev-parse --verify HEAD) || exit $?
if test -n "$headrev" && test "$headrev" != "$rev"
then
headp="-p $headrev"
@@ -866,17 +911,22 @@ cmd_add_commit () {
say >&2 "Added dir '$dir'"
}
-# Usage: cmd_split [REV]
+# Usage: cmd_split [REV] [REPOSITORY]
cmd_split () {
if test $# -eq 0
then
rev=$(git rev-parse HEAD)
- elif test $# -eq 1
+ elif test $# -eq 1 -o $# -eq 2
then
rev=$(git rev-parse -q --verify "$1^{commit}") ||
- die "'$1' does not refer to a commit"
+ die "fatal: '$1' does not refer to a commit"
else
- die "You must provide exactly one revision. Got: '$*'"
+ die "fatal: you must provide exactly one revision, and optionnally a repository. Got: '$*'"
+ fi
+ repository=""
+ if test "$#" = 2
+ then
+ repository="$2"
fi
if test -n "$arg_split_rejoin"
@@ -900,7 +950,7 @@ cmd_split () {
done || exit $?
fi
- unrevs="$(find_existing_splits "$dir" "$rev")" || exit $?
+ unrevs="$(find_existing_splits "$dir" "$rev" "$repository")" || exit $?
# We can't restrict rev-list to only $dir here, because some of our
# parents have the $dir contents the root, and those won't match.
@@ -919,7 +969,7 @@ cmd_split () {
latest_new=$(cache_get latest_new) || exit $?
if test -z "$latest_new"
then
- die "No new revisions were found"
+ die "fatal: no new revisions were found"
fi
if test -n "$arg_split_rejoin"
@@ -940,7 +990,7 @@ cmd_split () {
then
if ! git merge-base --is-ancestor "$arg_split_branch" "$latest_new"
then
- die "Branch '$arg_split_branch' is not an ancestor of commit '$latest_new'."
+ die "fatal: branch '$arg_split_branch' is not an ancestor of commit '$latest_new'."
fi
action='Updated'
else
@@ -954,20 +1004,25 @@ cmd_split () {
exit 0
}
-# Usage: cmd_merge REV
+# Usage: cmd_merge REV [REPOSITORY]
cmd_merge () {
- test $# -eq 1 ||
- die "You must provide exactly one revision. Got: '$*'"
+ test $# -eq 1 -o $# -eq 2 ||
+ die "fatal: you must provide exactly one revision, and optionally a repository. Got: '$*'"
rev=$(git rev-parse -q --verify "$1^{commit}") ||
- die "'$1' does not refer to a commit"
+ die "fatal: '$1' does not refer to a commit"
+ repository=""
+ if test "$#" = 2
+ then
+ repository="$2"
+ fi
ensure_clean
if test -n "$arg_addmerge_squash"
then
- first_split="$(find_latest_squash "$dir")" || exit $?
+ first_split="$(find_latest_squash "$dir" "$repository")" || exit $?
if test -z "$first_split"
then
- die "Can't squash-merge: '$dir' was never added."
+ die "fatal: can't squash-merge: '$dir' was never added."
fi
set $first_split
old=$1
@@ -995,19 +1050,21 @@ cmd_merge () {
cmd_pull () {
if test $# -ne 2
then
- die "You must provide <repository> <ref>"
+ die "fatal: you must provide <repository> <ref>"
fi
+ repository="$1"
+ ref="$2"
ensure_clean
- ensure_valid_ref_format "$2"
- git fetch "$@" || exit $?
- cmd_merge FETCH_HEAD
+ ensure_valid_ref_format "$ref"
+ git fetch "$repository" "$ref" || exit $?
+ cmd_merge FETCH_HEAD "$repository"
}
# Usage: cmd_push REPOSITORY [+][LOCALREV:]REMOTEREF
cmd_push () {
if test $# -ne 2
then
- die "You must provide <repository> <refspec>"
+ die "fatal: you must provide <repository> <refspec>"
fi
if test -e "$dir"
then
@@ -1022,13 +1079,13 @@ cmd_push () {
fi
ensure_valid_ref_format "$remoteref"
localrev_presplit=$(git rev-parse -q --verify "$localrevname_presplit^{commit}") ||
- die "'$localrevname_presplit' does not refer to a commit"
+ die "fatal: '$localrevname_presplit' does not refer to a commit"
echo "git push using: " "$repository" "$refspec"
- localrev=$(cmd_split "$localrev_presplit") || die
+ localrev=$(cmd_split "$localrev_presplit" "$repository") || die
git push "$repository" "$localrev":"refs/heads/$remoteref"
else
- die "'$dir' must already exist. Try 'git subtree add'."
+ die "fatal: '$dir' must already exist. Try 'git subtree add'."
fi
}
diff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt
index 9cddfa2654..004abf415b 100644
--- a/contrib/subtree/git-subtree.txt
+++ b/contrib/subtree/git-subtree.txt
@@ -11,7 +11,7 @@ SYNOPSIS
[verse]
'git subtree' [<options>] -P <prefix> add <local-commit>
'git subtree' [<options>] -P <prefix> add <repository> <remote-ref>
-'git subtree' [<options>] -P <prefix> merge <local-commit>
+'git subtree' [<options>] -P <prefix> merge <local-commit> [<repository>]
'git subtree' [<options>] -P <prefix> split [<local-commit>]
[verse]
@@ -76,7 +76,7 @@ add <repository> <remote-ref>::
only a single commit from the subproject, rather than its
entire history.
-merge <local-commit>::
+merge <local-commit> [<repository>]::
Merge recent changes up to <local-commit> into the <prefix>
subtree. As with normal 'git merge', this doesn't
remove your own local changes; it just merges those
@@ -88,8 +88,13 @@ If you use '--squash', the merge direction doesn't always have to be
forward; you can use this command to go back in time from v2.5 to v2.4,
for example. If your merge introduces a conflict, you can resolve it in
the usual ways.
++
+When using '--squash', and the previous merge with '--squash' merged an
+annotated tag of the subtree repository, that tag needs to be available locally.
+If <repository> is given, a missing tag will automatically be fetched from that
+repository.
-split [<local-commit>]::
+split [<local-commit>] [<repository>]::
Extract a new, synthetic project history from the
history of the <prefix> subtree of <local-commit>, or of
HEAD if no <local-commit> is given. The new history
@@ -109,6 +114,11 @@ settings passed to 'split' (such as '--annotate') are the same.
Because of this, if you add new commits and then re-split, the new
commits will be attached as commits on top of the history you
generated last time, so 'git merge' and friends will work as expected.
++
+When a previous merge with '--squash' merged an annotated tag of the
+subtree repository, that tag needs to be available locally.
+If <repository> is given, a missing tag will automatically be fetched from that
+repository.
pull <repository> <remote-ref>::
Exactly like 'merge', but parallels 'git pull' in that
diff --git a/contrib/subtree/t/Makefile b/contrib/subtree/t/Makefile
index 4655e0987b..093399c788 100644
--- a/contrib/subtree/t/Makefile
+++ b/contrib/subtree/t/Makefile
@@ -74,9 +74,7 @@ aggregate-results-and-cleanup: $(T)
$(MAKE) clean
aggregate-results:
- for f in '$(TEST_RESULTS_DIRECTORY_SQ)'/t*-*.counts; do \
- echo "$$f"; \
- done | '$(SHELL_PATH_SQ)' ../../../t/aggregate-results.sh
+ @'$(SHELL_PATH_SQ)' ../../../t/aggregate-results.sh '$(TEST_RESULTS_DIRECTORY_SQ)'
valgrind:
$(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh
index 1c1f76f04a..341c169eca 100755
--- a/contrib/subtree/t/t7900-subtree.sh
+++ b/contrib/subtree/t/t7900-subtree.sh
@@ -43,6 +43,30 @@ last_commit_subject () {
git log --pretty=format:%s -1
}
+# Upon 'git subtree add|merge --squash' of an annotated tag,
+# pre-2.32.0 versions of 'git subtree' would write the hash of the tag
+# (sub1 below), instead of the commit (sub1^{commit}) in the
+# "git-subtree-split" trailer.
+# We immitate this behaviour below using a replace ref.
+# This function creates 3 repositories:
+# - $1
+# - $1-sub (added as subtree "sub" in $1)
+# - $1-clone (clone of $1)
+test_create_pre2_32_repo () {
+ subtree_test_create_repo "$1" &&
+ subtree_test_create_repo "$1-sub" &&
+ test_commit -C "$1" main1 &&
+ test_commit -C "$1-sub" --annotate sub1 &&
+ git -C "$1" subtree add --prefix="sub" --squash "../$1-sub" sub1 &&
+ tag=$(git -C "$1" rev-parse FETCH_HEAD) &&
+ commit=$(git -C "$1" rev-parse FETCH_HEAD^{commit}) &&
+ git -C "$1" log -1 --format=%B HEAD^2 >msg &&
+ test_commit -C "$1-sub" --annotate sub2 &&
+ git clone --no-local "$1" "$1-clone" &&
+ new_commit=$(cat msg | sed -e "s/$commit/$tag/" | git -C "$1-clone" commit-tree HEAD^2^{tree}) &&
+ git -C "$1-clone" replace HEAD^2 $new_commit
+}
+
test_expect_success 'shows short help text for -h' '
test_expect_code 129 git subtree -h >out 2>err &&
test_must_be_empty err &&
@@ -264,6 +288,13 @@ test_expect_success 'merge new subproj history into subdir/ with a slash appende
)
'
+test_expect_success 'merge with --squash after annotated tag was added/merged with --squash pre-v2.32.0 ' '
+ test_create_pre2_32_repo "$test_count" &&
+ git -C "$test_count-clone" fetch "../$test_count-sub" sub2 &&
+ test_must_fail git -C "$test_count-clone" subtree merge --prefix="sub" --squash FETCH_HEAD &&
+ git -C "$test_count-clone" subtree merge --prefix="sub" --squash FETCH_HEAD "../$test_count-sub"
+'
+
#
# Tests for 'git subtree split'
#
@@ -277,7 +308,7 @@ test_expect_success 'split requires option --prefix' '
cd "$test_count" &&
git fetch ./"sub proj" HEAD &&
git subtree add --prefix="sub dir" FETCH_HEAD &&
- echo "You must provide the --prefix option." >expected &&
+ echo "fatal: you must provide the --prefix option." >expected &&
test_must_fail git subtree split >actual 2>&1 &&
test_debug "printf '"expected: "'" &&
test_debug "cat expected" &&
@@ -296,7 +327,7 @@ test_expect_success 'split requires path given by option --prefix must exist' '
cd "$test_count" &&
git fetch ./"sub proj" HEAD &&
git subtree add --prefix="sub dir" FETCH_HEAD &&
- echo "'\''non-existent-directory'\'' does not exist; use '\''git subtree add'\''" >expected &&
+ echo "fatal: '\''non-existent-directory'\'' does not exist; use '\''git subtree add'\''" >expected &&
test_must_fail git subtree split --prefix=non-existent-directory >actual 2>&1 &&
test_debug "printf '"expected: "'" &&
test_debug "cat expected" &&
@@ -551,6 +582,12 @@ test_expect_success 'split "sub dir"/ with --branch for an incompatible branch'
)
'
+test_expect_success 'split after annotated tag was added/merged with --squash pre-v2.32.0' '
+ test_create_pre2_32_repo "$test_count" &&
+ test_must_fail git -C "$test_count-clone" subtree split --prefix="sub" HEAD &&
+ git -C "$test_count-clone" subtree split --prefix="sub" HEAD "../$test_count-sub"
+'
+
#
# Tests for 'git subtree pull'
#
@@ -570,7 +607,7 @@ test_expect_success 'pull requires option --prefix' '
cd "$test_count" &&
test_must_fail git subtree pull ./"sub proj" HEAD >out 2>err &&
- echo "You must provide the --prefix option." >expected &&
+ echo "fatal: you must provide the --prefix option." >expected &&
test_must_be_empty out &&
test_cmp expected err
)
@@ -584,7 +621,7 @@ test_expect_success 'pull requires path given by option --prefix must exist' '
(
test_must_fail git subtree pull --prefix="sub dir" ./"sub proj" HEAD >out 2>err &&
- echo "'\''sub dir'\'' does not exist; use '\''git subtree add'\''" >expected &&
+ echo "fatal: '\''sub dir'\'' does not exist; use '\''git subtree add'\''" >expected &&
test_must_be_empty out &&
test_cmp expected err
)
@@ -630,6 +667,11 @@ test_expect_success 'pull rejects flags for split' '
)
'
+test_expect_success 'pull with --squash after annotated tag was added/merged with --squash pre-v2.32.0 ' '
+ test_create_pre2_32_repo "$test_count" &&
+ git -C "$test_count-clone" subtree -d pull --prefix="sub" --squash "../$test_count-sub" sub2
+'
+
#
# Tests for 'git subtree push'
#
@@ -643,7 +685,7 @@ test_expect_success 'push requires option --prefix' '
cd "$test_count" &&
git fetch ./"sub proj" HEAD &&
git subtree add --prefix="sub dir" FETCH_HEAD &&
- echo "You must provide the --prefix option." >expected &&
+ echo "fatal: you must provide the --prefix option." >expected &&
test_must_fail git subtree push "./sub proj" from-mainline >actual 2>&1 &&
test_debug "printf '"expected: "'" &&
test_debug "cat expected" &&
@@ -662,7 +704,7 @@ test_expect_success 'push requires path given by option --prefix must exist' '
cd "$test_count" &&
git fetch ./"sub proj" HEAD &&
git subtree add --prefix="sub dir" FETCH_HEAD &&
- echo "'\''non-existent-directory'\'' does not exist; use '\''git subtree add'\''" >expected &&
+ echo "fatal: '\''non-existent-directory'\'' does not exist; use '\''git subtree add'\''" >expected &&
test_must_fail git subtree push --prefix=non-existent-directory "./sub proj" from-mainline >actual 2>&1 &&
test_debug "printf '"expected: "'" &&
test_debug "cat expected" &&
@@ -953,6 +995,12 @@ test_expect_success 'push "sub dir"/ with a local rev' '
)
'
+test_expect_success 'push after annotated tag was added/merged with --squash pre-v2.32.0' '
+ test_create_pre2_32_repo "$test_count" &&
+ test_create_commit "$test_count-clone" sub/main-sub1 &&
+ git -C "$test_count-clone" subtree push --prefix="sub" "../$test_count-sub" from-mainline
+'
+
#
# Validity checking
#
diff --git a/convert.c b/convert.c
index 95e6a5244f..7cf7bd0c88 100644
--- a/convert.c
+++ b/convert.c
@@ -1,5 +1,10 @@
#include "cache.h"
+#include "advice.h"
#include "config.h"
+#include "convert.h"
+#include "copy.h"
+#include "gettext.h"
+#include "hex.h"
#include "object-store.h"
#include "attr.h"
#include "run-command.h"
@@ -7,8 +12,10 @@
#include "sigchain.h"
#include "pkt-line.h"
#include "sub-process.h"
+#include "trace.h"
#include "utf8.h"
#include "ll-merge.h"
+#include "wrapper.h"
/*
* convert.c - convert a file when checking it out and checking it in.
@@ -1308,7 +1315,7 @@ void convert_attrs(struct index_state *istate,
git_config(read_convert_config, NULL);
}
- git_check_attr(istate, path, check);
+ git_check_attr(istate, NULL, path, check);
ccheck = check->items;
ca->crlf_action = git_path_check_crlf(ccheck + 4);
if (ca->crlf_action == CRLF_UNDEFINED)
@@ -1549,7 +1556,7 @@ struct stream_filter {
struct stream_filter_vtbl *vtbl;
};
-static int null_filter_fn(struct stream_filter *filter,
+static int null_filter_fn(struct stream_filter *filter UNUSED,
const char *input, size_t *isize_p,
char *output, size_t *osize_p)
{
@@ -1568,7 +1575,7 @@ static int null_filter_fn(struct stream_filter *filter,
return 0;
}
-static void null_free_fn(struct stream_filter *filter)
+static void null_free_fn(struct stream_filter *filter UNUSED)
{
; /* nothing -- null instances are shared */
}
diff --git a/convert.h b/convert.h
index 0a6e4086b8..d925589444 100644
--- a/convert.h
+++ b/convert.h
@@ -4,7 +4,7 @@
#ifndef CONVERT_H
#define CONVERT_H
-#include "hash.h"
+#include "hash-ll.h"
#include "string-list.h"
struct index_state;
diff --git a/copy.c b/copy.c
index 4de6a110f0..882c79cffb 100644
--- a/copy.c
+++ b/copy.c
@@ -1,4 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "copy.h"
+#include "path.h"
+#include "wrapper.h"
int copy_fd(int ifd, int ofd)
{
diff --git a/copy.h b/copy.h
new file mode 100644
index 0000000000..2af77cba86
--- /dev/null
+++ b/copy.h
@@ -0,0 +1,10 @@
+#ifndef COPY_H
+#define COPY_H
+
+#define COPY_READ_ERROR (-2)
+#define COPY_WRITE_ERROR (-3)
+int copy_fd(int ifd, int ofd);
+int copy_file(const char *dst, const char *src, int mode);
+int copy_file_with_time(const char *dst, const char *src, int mode);
+
+#endif /* COPY_H */
diff --git a/credential.c b/credential.c
index f6389a5068..023b59d571 100644
--- a/credential.c
+++ b/credential.c
@@ -1,12 +1,16 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
#include "config.h"
#include "credential.h"
+#include "gettext.h"
#include "string-list.h"
#include "run-command.h"
#include "url.h"
#include "prompt.h"
#include "sigchain.h"
+#include "strbuf.h"
#include "urlmatch.h"
+#include "git-compat-util.h"
void credential_init(struct credential *c)
{
@@ -21,7 +25,9 @@ void credential_clear(struct credential *c)
free(c->path);
free(c->username);
free(c->password);
+ free(c->oauth_refresh_token);
string_list_clear(&c->helpers, 0);
+ strvec_clear(&c->wwwauth_headers);
credential_init(c);
}
@@ -234,6 +240,16 @@ int credential_read(struct credential *c, FILE *fp)
} else if (!strcmp(key, "path")) {
free(c->path);
c->path = xstrdup(value);
+ } else if (!strcmp(key, "wwwauth[]")) {
+ strvec_push(&c->wwwauth_headers, value);
+ } else if (!strcmp(key, "password_expiry_utc")) {
+ errno = 0;
+ c->password_expiry_utc = parse_timestamp(value, NULL, 10);
+ if (c->password_expiry_utc == 0 || errno == ERANGE)
+ c->password_expiry_utc = TIME_MAX;
+ } else if (!strcmp(key, "oauth_refresh_token")) {
+ free(c->oauth_refresh_token);
+ c->oauth_refresh_token = xstrdup(value);
} else if (!strcmp(key, "url")) {
credential_from_url(c, value);
} else if (!strcmp(key, "quit")) {
@@ -269,6 +285,14 @@ void credential_write(const struct credential *c, FILE *fp)
credential_write_item(fp, "path", c->path, 0);
credential_write_item(fp, "username", c->username, 0);
credential_write_item(fp, "password", c->password, 0);
+ credential_write_item(fp, "oauth_refresh_token", c->oauth_refresh_token, 0);
+ if (c->password_expiry_utc != TIME_MAX) {
+ char *s = xstrfmt("%"PRItime, c->password_expiry_utc);
+ credential_write_item(fp, "password_expiry_utc", s, 0);
+ free(s);
+ }
+ for (size_t i = 0; i < c->wwwauth_headers.nr; i++)
+ credential_write_item(fp, "wwwauth[]", c->wwwauth_headers.v[i], 0);
}
static int run_credential_helper(struct credential *c,
@@ -342,6 +366,12 @@ void credential_fill(struct credential *c)
for (i = 0; i < c->helpers.nr; i++) {
credential_do(c, c->helpers.items[i].string, "get");
+ if (c->password_expiry_utc < time(NULL)) {
+ /* Discard expired password */
+ FREE_AND_NULL(c->password);
+ /* Reset expiry to maintain consistency */
+ c->password_expiry_utc = TIME_MAX;
+ }
if (c->username && c->password)
return;
if (c->quit)
@@ -360,7 +390,7 @@ void credential_approve(struct credential *c)
if (c->approved)
return;
- if (!c->username || !c->password)
+ if (!c->username || !c->password || c->password_expiry_utc < time(NULL))
return;
credential_apply_config(c);
@@ -381,6 +411,8 @@ void credential_reject(struct credential *c)
FREE_AND_NULL(c->username);
FREE_AND_NULL(c->password);
+ FREE_AND_NULL(c->oauth_refresh_token);
+ c->password_expiry_utc = TIME_MAX;
c->approved = 0;
}
diff --git a/credential.h b/credential.h
index f430e77fea..b8e2936d1d 100644
--- a/credential.h
+++ b/credential.h
@@ -2,6 +2,7 @@
#define CREDENTIAL_H
#include "string-list.h"
+#include "strvec.h"
/**
* The credentials API provides an abstracted way of gathering username and
@@ -115,6 +116,20 @@ struct credential {
*/
struct string_list helpers;
+ /**
+ * A `strvec` of WWW-Authenticate header values. Each string
+ * is the value of a WWW-Authenticate header in an HTTP response,
+ * in the order they were received in the response.
+ */
+ struct strvec wwwauth_headers;
+
+ /**
+ * Internal use only. Keeps track of if we previously matched against a
+ * WWW-Authenticate header line in order to re-fold future continuation
+ * lines into one value.
+ */
+ unsigned header_is_last_match:1;
+
unsigned approved:1,
configured:1,
quit:1,
@@ -126,10 +141,14 @@ struct credential {
char *protocol;
char *host;
char *path;
+ char *oauth_refresh_token;
+ timestamp_t password_expiry_utc;
};
#define CREDENTIAL_INIT { \
.helpers = STRING_LIST_INIT_DUP, \
+ .password_expiry_utc = TIME_MAX, \
+ .wwwauth_headers = STRVEC_INIT, \
}
/* Initialize a credential structure, setting all fields to empty. */
diff --git a/csum-file.c b/csum-file.c
index 59ef3398ca..daf9b06dff 100644
--- a/csum-file.c
+++ b/csum-file.c
@@ -7,9 +7,11 @@
* files. Useful when you write a file that you want to be
* able to verify hasn't been messed with afterwards.
*/
-#include "cache.h"
+#include "git-compat-util.h"
#include "progress.h"
#include "csum-file.h"
+#include "hash.h"
+#include "wrapper.h"
static void verify_buffer_or_die(struct hashfile *f,
const void *buf,
@@ -45,7 +47,8 @@ void hashflush(struct hashfile *f)
unsigned offset = f->offset;
if (offset) {
- the_hash_algo->update_fn(&f->ctx, f->buffer, offset);
+ if (!f->skip_hash)
+ the_hash_algo->update_fn(&f->ctx, f->buffer, offset);
flush(f, f->buffer, offset);
f->offset = 0;
}
@@ -64,7 +67,12 @@ int finalize_hashfile(struct hashfile *f, unsigned char *result,
int fd;
hashflush(f);
- the_hash_algo->final_fn(f->buffer, &f->ctx);
+
+ if (f->skip_hash)
+ hashclr(f->buffer);
+ else
+ the_hash_algo->final_fn(f->buffer, &f->ctx);
+
if (result)
hashcpy(result, f->buffer);
if (flags & CSUM_HASH_IN_STREAM)
@@ -108,7 +116,8 @@ void hashwrite(struct hashfile *f, const void *buf, unsigned int count)
* the hashfile's buffer. In this block,
* f->offset is necessarily zero.
*/
- the_hash_algo->update_fn(&f->ctx, buf, nr);
+ if (!f->skip_hash)
+ the_hash_algo->update_fn(&f->ctx, buf, nr);
flush(f, buf, nr);
} else {
/*
@@ -153,6 +162,7 @@ static struct hashfile *hashfd_internal(int fd, const char *name,
f->tp = tp;
f->name = name;
f->do_crc = 0;
+ f->skip_hash = 0;
the_hash_algo->init_fn(&f->ctx);
f->buffer_len = buffer_len;
diff --git a/csum-file.h b/csum-file.h
index 0d29f528fb..bc5bec27ac 100644
--- a/csum-file.h
+++ b/csum-file.h
@@ -1,8 +1,8 @@
#ifndef CSUM_FILE_H
#define CSUM_FILE_H
-#include "cache.h"
-#include "hash.h"
+#include "hash-ll.h"
+#include "write-or-die.h"
struct progress;
@@ -20,6 +20,13 @@ struct hashfile {
size_t buffer_len;
unsigned char *buffer;
unsigned char *check_buffer;
+
+ /**
+ * If non-zero, skip_hash indicates that we should
+ * not actually compute the hash for this hashfile and
+ * instead only use it as a buffered write.
+ */
+ int skip_hash;
};
/* Checkpoint */
diff --git a/daemon.c b/daemon.c
index 0ae7d12b5c..7139cc201d 100644
--- a/daemon.c
+++ b/daemon.c
@@ -1,9 +1,16 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
+#include "path.h"
#include "pkt-line.h"
+#include "protocol.h"
#include "run-command.h"
+#include "setup.h"
#include "strbuf.h"
#include "string-list.h"
+#include "wrapper.h"
#ifdef NO_INITGROUPS
#define initgroups(x, y) (0) /* nothing */
@@ -928,7 +935,7 @@ static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)
add_child(&cld, addr, addrlen);
}
-static void child_handler(int signo)
+static void child_handler(int signo UNUSED)
{
/*
* Otherwise empty handler because systemcalls will get interrupted
diff --git a/date.c b/date.c
index 68a260c214..619ada5b20 100644
--- a/date.c
+++ b/date.c
@@ -4,8 +4,11 @@
* Copyright (C) Linus Torvalds, 2005
*/
-#include "cache.h"
+#include "git-compat-util.h"
#include "date.h"
+#include "gettext.h"
+#include "pager.h"
+#include "strbuf.h"
/*
* This is like mktime, but without normalization of tm_wday and tm_yday.
@@ -493,6 +496,12 @@ static int match_alpha(const char *date, struct tm *tm, int *offset)
return 2;
}
+ /* ISO-8601 allows yyyymmDD'T'HHMMSS, with less precision */
+ if (*date == 'T' && isdigit(date[1]) && tm->tm_hour == -1) {
+ tm->tm_min = tm->tm_sec = 0;
+ return 1;
+ }
+
/* BAD CRAP */
return skip_alpha(date);
}
@@ -639,6 +648,18 @@ static inline int nodate(struct tm *tm)
}
/*
+ * Have we seen an ISO-8601-alike date, i.e. 20220101T0,
+ * In which, hour is still unset,
+ * and minutes and second has been set to 0.
+ */
+static inline int maybeiso8601(struct tm *tm)
+{
+ return tm->tm_hour == -1 &&
+ tm->tm_min == 0 &&
+ tm->tm_sec == 0;
+}
+
+/*
* We've seen a digit. Time? Year? Date?
*/
static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt)
@@ -701,6 +722,25 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
return end - date;
}
+ /* reduced precision of ISO-8601's time: HHMM or HH */
+ if (maybeiso8601(tm)) {
+ unsigned int num1 = num;
+ unsigned int num2 = 0;
+ if (n == 4) {
+ num1 = num / 100;
+ num2 = num % 100;
+ }
+ if ((n == 4 || n == 2) && !nodate(tm) &&
+ set_time(num1, num2, 0, tm) == 0)
+ return n;
+ /*
+ * We thought this is an ISO-8601 time string,
+ * we set minutes and seconds to 0,
+ * turn out it isn't, rollback the change.
+ */
+ tm->tm_min = tm->tm_sec = -1;
+ }
+
/* Four-digit year or a timezone? */
if (n == 4) {
if (num <= 1400 && *offset == -1) {
@@ -1101,7 +1141,7 @@ static void date_tea(struct tm *tm, struct tm *now, int *num)
date_time(tm, now, 17);
}
-static void date_pm(struct tm *tm, struct tm *now, int *num)
+static void date_pm(struct tm *tm, struct tm *now UNUSED, int *num)
{
int hour, n = *num;
*num = 0;
@@ -1115,7 +1155,7 @@ static void date_pm(struct tm *tm, struct tm *now, int *num)
tm->tm_hour = (hour % 12) + 12;
}
-static void date_am(struct tm *tm, struct tm *now, int *num)
+static void date_am(struct tm *tm, struct tm *now UNUSED, int *num)
{
int hour, n = *num;
*num = 0;
@@ -1129,7 +1169,7 @@ static void date_am(struct tm *tm, struct tm *now, int *num)
tm->tm_hour = (hour % 12);
}
-static void date_never(struct tm *tm, struct tm *now, int *num)
+static void date_never(struct tm *tm, struct tm *now UNUSED, int *num)
{
time_t n = 0;
localtime_r(&n, tm);
@@ -1328,20 +1368,6 @@ static timestamp_t approxidate_str(const char *date,
return (timestamp_t)update_tm(&tm, &now, 0);
}
-timestamp_t approxidate_relative(const char *date)
-{
- struct timeval tv;
- timestamp_t timestamp;
- int offset;
- int errors = 0;
-
- if (!parse_date_basic(date, &timestamp, &offset))
- return timestamp;
-
- get_time(&tv);
- return approxidate_str(date, (const struct timeval *) &tv, &errors);
-}
-
timestamp_t approxidate_careful(const char *date, int *error_ret)
{
struct timeval tv;
diff --git a/date.h b/date.h
index 5d4eaba0a9..6136212a19 100644
--- a/date.h
+++ b/date.h
@@ -68,7 +68,6 @@ int parse_expiry_date(const char *date, timestamp_t *timestamp);
void datestamp(struct strbuf *out);
#define approxidate(s) approxidate_careful((s), NULL)
timestamp_t approxidate_careful(const char *, int *);
-timestamp_t approxidate_relative(const char *date);
int date_overflows(timestamp_t date);
time_t tm_to_time_t(const struct tm *tm);
#endif
diff --git a/decorate.c b/decorate.c
index 2036d15967..71e79daa82 100644
--- a/decorate.c
+++ b/decorate.c
@@ -2,7 +2,8 @@
* decorate.c - decorate a git object with some arbitrary
* data.
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "hashmap.h"
#include "object.h"
#include "decorate.h"
diff --git a/delta-islands.c b/delta-islands.c
index 26f9e99e1a..c824a5f6a4 100644
--- a/delta-islands.c
+++ b/delta-islands.c
@@ -1,8 +1,11 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "attr.h"
#include "object.h"
#include "blob.h"
#include "commit.h"
+#include "gettext.h"
+#include "hex.h"
#include "tag.h"
#include "tree.h"
#include "delta.h"
@@ -26,8 +29,6 @@ static kh_oid_map_t *island_marks;
static unsigned island_counter;
static unsigned island_counter_core;
-static kh_str_t *remote_islands;
-
struct remote_island {
uint64_t hash;
struct oid_array oids;
@@ -312,29 +313,55 @@ void resolve_tree_islands(struct repository *r,
free(todo);
}
-static regex_t *island_regexes;
-static unsigned int island_regexes_alloc, island_regexes_nr;
+struct island_load_data {
+ kh_str_t *remote_islands;
+ regex_t *rx;
+ size_t nr;
+ size_t alloc;
+};
static const char *core_island_name;
-static int island_config_callback(const char *k, const char *v, void *cb UNUSED)
+static void free_config_regexes(struct island_load_data *ild)
+{
+ for (size_t i = 0; i < ild->nr; i++)
+ regfree(&ild->rx[i]);
+ free(ild->rx);
+}
+
+static void free_remote_islands(kh_str_t *remote_islands)
+{
+ const char *island_name;
+ struct remote_island *rl;
+
+ kh_foreach(remote_islands, island_name, rl, {
+ free((void *)island_name);
+ oid_array_clear(&rl->oids);
+ free(rl);
+ });
+ kh_destroy_str(remote_islands);
+}
+
+static int island_config_callback(const char *k, const char *v, void *cb)
{
+ struct island_load_data *ild = cb;
+
if (!strcmp(k, "pack.island")) {
struct strbuf re = STRBUF_INIT;
if (!v)
return config_error_nonbool(k);
- ALLOC_GROW(island_regexes, island_regexes_nr + 1, island_regexes_alloc);
+ ALLOC_GROW(ild->rx, ild->nr + 1, ild->alloc);
if (*v != '^')
strbuf_addch(&re, '^');
strbuf_addstr(&re, v);
- if (regcomp(&island_regexes[island_regexes_nr], re.buf, REG_EXTENDED))
+ if (regcomp(&ild->rx[ild->nr], re.buf, REG_EXTENDED))
die(_("failed to load island regex for '%s': %s"), k, re.buf);
strbuf_release(&re);
- island_regexes_nr++;
+ ild->nr++;
return 0;
}
@@ -344,7 +371,8 @@ static int island_config_callback(const char *k, const char *v, void *cb UNUSED)
return 0;
}
-static void add_ref_to_island(const char *island_name, const struct object_id *oid)
+static void add_ref_to_island(kh_str_t *remote_islands, const char *island_name,
+ const struct object_id *oid)
{
uint64_t sha_core;
struct remote_island *rl = NULL;
@@ -365,8 +393,10 @@ static void add_ref_to_island(const char *island_name, const struct object_id *o
}
static int find_island_for_ref(const char *refname, const struct object_id *oid,
- int flags UNUSED, void *data UNUSED)
+ int flags UNUSED, void *cb)
{
+ struct island_load_data *ild = cb;
+
/*
* We should advertise 'ARRAY_SIZE(matches) - 2' as the max,
* so we can diagnose below a config with more capture groups
@@ -377,8 +407,8 @@ static int find_island_for_ref(const char *refname, const struct object_id *oid,
struct strbuf island_name = STRBUF_INIT;
/* walk backwards to get last-one-wins ordering */
- for (i = island_regexes_nr - 1; i >= 0; i--) {
- if (!regexec(&island_regexes[i], refname,
+ for (i = ild->nr - 1; i >= 0; i--) {
+ if (!regexec(&ild->rx[i], refname,
ARRAY_SIZE(matches), matches, 0))
break;
}
@@ -403,12 +433,12 @@ static int find_island_for_ref(const char *refname, const struct object_id *oid,
strbuf_add(&island_name, refname + match->rm_so, match->rm_eo - match->rm_so);
}
- add_ref_to_island(island_name.buf, oid);
+ add_ref_to_island(ild->remote_islands, island_name.buf, oid);
strbuf_release(&island_name);
return 0;
}
-static struct remote_island *get_core_island(void)
+static struct remote_island *get_core_island(kh_str_t *remote_islands)
{
if (core_island_name) {
khiter_t pos = kh_get_str(remote_islands, core_island_name);
@@ -419,7 +449,7 @@ static struct remote_island *get_core_island(void)
return NULL;
}
-static void deduplicate_islands(struct repository *r)
+static void deduplicate_islands(kh_str_t *remote_islands, struct repository *r)
{
struct remote_island *island, *core = NULL, **list;
unsigned int island_count, dst, src, ref, i = 0;
@@ -445,7 +475,7 @@ static void deduplicate_islands(struct repository *r)
}
island_bitmap_size = (island_count / 32) + 1;
- core = get_core_island();
+ core = get_core_island(remote_islands);
for (i = 0; i < island_count; ++i) {
mark_remote_island_1(r, list[i], core && list[i]->hash == core->hash);
@@ -456,12 +486,16 @@ static void deduplicate_islands(struct repository *r)
void load_delta_islands(struct repository *r, int progress)
{
+ struct island_load_data ild = { 0 };
+
island_marks = kh_init_oid_map();
- remote_islands = kh_init_str();
- git_config(island_config_callback, NULL);
- for_each_ref(find_island_for_ref, NULL);
- deduplicate_islands(r);
+ git_config(island_config_callback, &ild);
+ ild.remote_islands = kh_init_str();
+ for_each_ref(find_island_for_ref, &ild);
+ free_config_regexes(&ild);
+ deduplicate_islands(ild.remote_islands, r);
+ free_remote_islands(ild.remote_islands);
if (progress)
fprintf(stderr, _("Marked %d islands, done.\n"), island_counter);
@@ -475,13 +509,30 @@ void propagate_island_marks(struct commit *commit)
struct commit_list *p;
struct island_bitmap *root_marks = kh_value(island_marks, pos);
- parse_commit(commit);
- set_island_marks(&get_commit_tree(commit)->object, root_marks);
+ repo_parse_commit(the_repository, commit);
+ set_island_marks(&repo_get_commit_tree(the_repository, commit)->object,
+ root_marks);
for (p = commit->parents; p; p = p->next)
set_island_marks(&p->item->object, root_marks);
}
}
+void free_island_marks(void)
+{
+ struct island_bitmap *bitmap;
+
+ if (island_marks) {
+ kh_foreach_value(island_marks, bitmap, {
+ if (!--bitmap->refcount)
+ free(bitmap);
+ });
+ kh_destroy_oid_map(island_marks);
+ }
+
+ /* detect use-after-free with a an address which is never valid: */
+ island_marks = (void *)-1;
+}
+
int compute_pack_layers(struct packing_data *to_pack)
{
uint32_t i;
diff --git a/delta-islands.h b/delta-islands.h
index eb0f952629..8d1591ae28 100644
--- a/delta-islands.h
+++ b/delta-islands.h
@@ -14,5 +14,6 @@ void resolve_tree_islands(struct repository *r,
void load_delta_islands(struct repository *r, int progress);
void propagate_island_marks(struct commit *commit);
int compute_pack_layers(struct packing_data *to_pack);
+void free_island_marks(void);
#endif /* DELTA_ISLANDS_H */
diff --git a/detect-compiler b/detect-compiler
index 50087f5670..a87650b71b 100755
--- a/detect-compiler
+++ b/detect-compiler
@@ -17,7 +17,15 @@ get_family() {
}
get_version() {
- get_version_line | sed 's/^.* version \([0-9][^ ]*\).*/\1/'
+ # A string that begins with a digit up to the next SP
+ ver=$(get_version_line | sed 's/^.* version \([0-9][^ ]*\).*/\1/')
+
+ # There are known -variant suffixes that do not affect the
+ # meaning of the main version number. Strip them.
+ ver=${ver%-win32}
+ ver=${ver%-posix}
+
+ echo "$ver"
}
print_flags() {
diff --git a/diagnose.c b/diagnose.c
index 8f26569896..c8c7ebcfa3 100644
--- a/diagnose.c
+++ b/diagnose.c
@@ -1,12 +1,16 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "diagnose.h"
#include "compat/disk.h"
#include "archive.h"
#include "dir.h"
#include "help.h"
+#include "gettext.h"
+#include "hex.h"
#include "strvec.h"
#include "object-store.h"
#include "packfile.h"
+#include "parse-options.h"
+#include "write-or-die.h"
struct archive_dir {
const char *path;
@@ -43,7 +47,8 @@ int option_parse_diagnose(const struct option *opt, const char *arg, int unset)
return error(_("invalid --%s value '%s'"), opt->long_name, arg);
}
-static void dir_file_stats_objects(const char *full_path, size_t full_path_len,
+static void dir_file_stats_objects(const char *full_path,
+ size_t full_path_len UNUSED,
const char *file_name, void *data)
{
struct strbuf *buf = data;
diff --git a/diagnose.h b/diagnose.h
index 7a4951a786..f525219ab0 100644
--- a/diagnose.h
+++ b/diagnose.h
@@ -2,7 +2,8 @@
#define DIAGNOSE_H
#include "strbuf.h"
-#include "parse-options.h"
+
+struct option;
enum diagnose_mode {
DIAGNOSE_NONE,
diff --git a/diff-lib.c b/diff-lib.c
index 2edea41a23..60e979dc1b 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -6,11 +6,16 @@
#include "commit.h"
#include "diff.h"
#include "diffcore.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-name.h"
#include "revision.h"
#include "cache-tree.h"
#include "unpack-trees.h"
#include "refs.h"
#include "submodule.h"
+#include "symlinks.h"
+#include "trace.h"
#include "dir.h"
#include "fsmonitor.h"
#include "commit-reach.h"
@@ -581,7 +586,7 @@ void diff_get_merge_base(const struct rev_info *revs, struct object_id *mb)
if (revs->pending.nr == 1) {
struct object_id oid;
- if (get_oid("HEAD", &oid))
+ if (repo_get_oid(the_repository, "HEAD", &oid))
die(_("unable to get HEAD"));
mb_child[1] = lookup_commit_reference(the_repository, &oid);
@@ -673,7 +678,7 @@ int index_differs_from(struct repository *r,
return (has_changes != 0);
}
-static struct strbuf *idiff_prefix_cb(struct diff_options *opt, void *data)
+static struct strbuf *idiff_prefix_cb(struct diff_options *opt UNUSED, void *data)
{
return data;
}
diff --git a/diff-merges.c b/diff-merges.c
index 85cbefa5af..ec97616db1 100644
--- a/diff-merges.c
+++ b/diff-merges.c
@@ -1,5 +1,7 @@
+#include "git-compat-util.h"
#include "diff-merges.h"
+#include "gettext.h"
#include "revision.h"
typedef void (*diff_merges_setup_func_t)(struct rev_info *);
diff --git a/diff-no-index.c b/diff-no-index.c
index 18edbdf4b5..4296940f90 100644
--- a/diff-no-index.c
+++ b/diff-no-index.c
@@ -4,16 +4,17 @@
* Copyright (c) 2008 by Junio C Hamano
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
#include "color.h"
#include "commit.h"
#include "blob.h"
#include "tag.h"
#include "diff.h"
#include "diffcore.h"
+#include "gettext.h"
#include "revision.h"
#include "log-tree.h"
-#include "builtin.h"
#include "parse-options.h"
#include "string-list.h"
#include "dir.h"
@@ -255,8 +256,7 @@ int diff_no_index(struct rev_info *revs,
};
struct option *options;
- options = parse_options_concat(no_index_options,
- revs->diffopt.parseopts);
+ options = add_diff_options(no_index_options, &revs->diffopt);
argc = parse_options(argc, argv, revs->prefix, options,
diff_no_index_usage, 0);
if (argc != 2) {
diff --git a/diff.c b/diff.c
index d52db685f7..3c88c37908 100644
--- a/diff.c
+++ b/diff.c
@@ -2,12 +2,19 @@
* Copyright (C) 2005 Junio C Hamano
*/
#include "cache.h"
+#include "abspath.h"
+#include "alloc.h"
+#include "base85.h"
#include "config.h"
+#include "convert.h"
+#include "environment.h"
+#include "gettext.h"
#include "tempfile.h"
#include "quote.h"
#include "diff.h"
#include "diffcore.h"
#include "delta.h"
+#include "hex.h"
#include "xdiff-interface.h"
#include "color.h"
#include "attr.h"
@@ -23,12 +30,19 @@
#include "string-list.h"
#include "strvec.h"
#include "graph.h"
+#include "oid-array.h"
#include "packfile.h"
+#include "pager.h"
#include "parse-options.h"
#include "help.h"
#include "promisor-remote.h"
#include "dir.h"
+#include "object-file.h"
+#include "object-name.h"
+#include "setup.h"
#include "strmap.h"
+#include "ws.h"
+#include "wrapper.h"
#ifdef NO_FAST_WORKING_DIRECTORY
#define FAST_WORKING_DIRECTORY 0
@@ -127,7 +141,7 @@ static int parse_dirstat_params(struct diff_options *options, const char *params
int i;
if (*params_copy)
- string_list_split_in_place(&params, params_copy, ',', -1);
+ string_list_split_in_place(&params, params_copy, ",", -1);
for (i = 0; i < params.nr; i++) {
const char *p = params.items[i].string;
if (!strcmp(p, "changes")) {
@@ -604,7 +618,7 @@ static unsigned long diff_filespec_size(struct repository *r,
return one->size;
}
-static int count_trailing_blank(mmfile_t *mf, unsigned ws_rule)
+static int count_trailing_blank(mmfile_t *mf)
{
char *ptr = mf->ptr;
long size = mf->size;
@@ -622,7 +636,7 @@ static int count_trailing_blank(mmfile_t *mf, unsigned ws_rule)
for (prev_eol = ptr; mf->ptr <= prev_eol; prev_eol--)
if (*prev_eol == '\n')
break;
- if (!ws_blank_line(prev_eol + 1, ptr - prev_eol, ws_rule))
+ if (!ws_blank_line(prev_eol + 1, ptr - prev_eol))
break;
cnt++;
ptr = prev_eol - 1;
@@ -634,9 +648,8 @@ static void check_blank_at_eof(mmfile_t *mf1, mmfile_t *mf2,
struct emit_callback *ecbdata)
{
int l1, l2, at;
- unsigned ws_rule = ecbdata->ws_rule;
- l1 = count_trailing_blank(mf1, ws_rule);
- l2 = count_trailing_blank(mf2, ws_rule);
+ l1 = count_trailing_blank(mf1);
+ l2 = count_trailing_blank(mf2);
if (l2 <= l1) {
ecbdata->blank_at_eof_in_preimage = 0;
ecbdata->blank_at_eof_in_postimage = 0;
@@ -1583,7 +1596,7 @@ static int new_blank_line_at_eof(struct emit_callback *ecbdata, const char *line
ecbdata->blank_at_eof_in_preimage <= ecbdata->lno_in_preimage &&
ecbdata->blank_at_eof_in_postimage <= ecbdata->lno_in_postimage))
return 0;
- return ws_blank_line(line, len, ecbdata->ws_rule);
+ return ws_blank_line(line, len);
}
static void emit_add_line(struct emit_callback *ecbdata,
@@ -1955,7 +1968,7 @@ static int color_words_output_graph_prefix(struct diff_words_data *diff_words)
static void fn_out_diff_words_aux(void *priv,
long minus_first, long minus_len,
long plus_first, long plus_len,
- const char *func, long funclen)
+ const char *func UNUSED, long funclen UNUSED)
{
struct diff_words_data *diff_words = priv;
struct diff_words_style *style = diff_words->style;
@@ -2488,6 +2501,9 @@ static int diffstat_consume(void *priv, char *line, unsigned long len)
struct diffstat_t *diffstat = priv;
struct diffstat_file *x = diffstat->files[diffstat->nr - 1];
+ if (!len)
+ BUG("xdiff fed us an empty line");
+
if (line[0] == '+')
x->added++;
else if (line[0] == '-')
@@ -2621,7 +2637,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
continue;
}
fill_print_name(file);
- len = strlen(file->print_name);
+ len = utf8_strwidth(file->print_name);
if (max_len < len)
max_len = len;
@@ -2674,6 +2690,11 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
* making the line longer than the maximum width.
*/
+ /*
+ * NEEDSWORK: line_prefix is often used for "log --graph" output
+ * and contains ANSI-colored string. utf8_strnwidth() should be
+ * used to correctly count the display width instead of strlen().
+ */
if (options->stat_width == -1)
width = term_columns() - strlen(line_prefix);
else
@@ -2735,7 +2756,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
char *name = file->print_name;
uintmax_t added = file->added;
uintmax_t deleted = file->deleted;
- int name_len;
+ int name_len, padding;
if (!file->is_interesting && (added + deleted == 0))
continue;
@@ -2744,20 +2765,34 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
* "scale" the filename
*/
len = name_width;
- name_len = strlen(name);
+ name_len = utf8_strwidth(name);
if (name_width < name_len) {
char *slash;
prefix = "...";
len -= 3;
+ /*
+ * NEEDSWORK: (name_len - len) counts the display
+ * width, which would be shorter than the byte
+ * length of the corresponding substring.
+ * Advancing "name" by that number of bytes does
+ * *NOT* skip over that many columns, so it is
+ * very likely that chomping the pathname at the
+ * slash we will find starting from "name" will
+ * leave the resulting string still too long.
+ */
name += name_len - len;
slash = strchr(name, '/');
if (slash)
name = slash;
}
+ padding = len - utf8_strwidth(name);
+ if (padding < 0)
+ padding = 0;
if (file->is_binary) {
- strbuf_addf(&out, " %s%-*s |", prefix, len, name);
- strbuf_addf(&out, " %*s", number_width, "Bin");
+ strbuf_addf(&out, " %s%s%*s | %*s",
+ prefix, name, padding, "",
+ number_width, "Bin");
if (!added && !deleted) {
strbuf_addch(&out, '\n');
emit_diff_symbol(options, DIFF_SYMBOL_STATS_LINE,
@@ -2777,8 +2812,9 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
continue;
}
else if (file->is_unmerged) {
- strbuf_addf(&out, " %s%-*s |", prefix, len, name);
- strbuf_addstr(&out, " Unmerged\n");
+ strbuf_addf(&out, " %s%s%*s | %*s",
+ prefix, name, padding, "",
+ number_width, "Unmerged\n");
emit_diff_symbol(options, DIFF_SYMBOL_STATS_LINE,
out.buf, out.len, 0);
strbuf_reset(&out);
@@ -2804,10 +2840,10 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
add = total - del;
}
}
- strbuf_addf(&out, " %s%-*s |", prefix, len, name);
- strbuf_addf(&out, " %*"PRIuMAX"%s",
- number_width, added + deleted,
- added + deleted ? " " : "");
+ strbuf_addf(&out, " %s%s%*s | %*"PRIuMAX"%s",
+ prefix, name, padding, "",
+ number_width, added + deleted,
+ added + deleted ? " " : "");
show_graph(&out, '+', add, add_c, reset);
show_graph(&out, '-', del, del_c, reset);
strbuf_addch(&out, '\n');
@@ -3168,8 +3204,9 @@ static int is_conflict_marker(const char *line, int marker_size, unsigned long l
}
static void checkdiff_consume_hunk(void *priv,
- long ob, long on, long nb, long nn,
- const char *func, long funclen)
+ long ob UNUSED, long on UNUSED,
+ long nb, long nn UNUSED,
+ const char *func UNUSED, long funclen UNUSED)
{
struct checkdiff_t *data = priv;
@@ -3357,6 +3394,17 @@ void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const
options->b_prefix = b;
}
+void diff_set_noprefix(struct diff_options *options)
+{
+ options->a_prefix = options->b_prefix = "";
+}
+
+void diff_set_default_prefix(struct diff_options *options)
+{
+ options->a_prefix = "a/";
+ options->b_prefix = "b/";
+}
+
struct userdiff_driver *get_textconv(struct repository *r,
struct diff_filespec *one)
{
@@ -3420,6 +3468,22 @@ static int diff_filepair_is_phoney(struct diff_filespec *one,
return !DIFF_FILE_VALID(one) && !DIFF_FILE_VALID(two);
}
+static int set_diff_algorithm(struct diff_options *opts,
+ const char *alg)
+{
+ long value = parse_algorithm_value(alg);
+
+ if (value < 0)
+ return -1;
+
+ /* clear out previous settings */
+ DIFF_XDL_CLR(opts, NEED_MINIMAL);
+ opts->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
+ opts->xdl_opts |= value;
+
+ return 0;
+}
+
static void builtin_diff(const char *name_a,
const char *name_b,
struct diff_filespec *one,
@@ -4196,7 +4260,6 @@ static void prep_temp_blob(struct index_state *istate,
}
static struct diff_tempfile *prepare_temp_file(struct repository *r,
- const char *name,
struct diff_filespec *one)
{
struct diff_tempfile *temp = claim_diff_tempfile();
@@ -4214,18 +4277,18 @@ static struct diff_tempfile *prepare_temp_file(struct repository *r,
if (!S_ISGITLINK(one->mode) &&
(!one->oid_valid ||
- reuse_worktree_file(r->index, name, &one->oid, 1))) {
+ reuse_worktree_file(r->index, one->path, &one->oid, 1))) {
struct stat st;
- if (lstat(name, &st) < 0) {
+ if (lstat(one->path, &st) < 0) {
if (errno == ENOENT)
goto not_a_valid_file;
- die_errno("stat(%s)", name);
+ die_errno("stat(%s)", one->path);
}
if (S_ISLNK(st.st_mode)) {
struct strbuf sb = STRBUF_INIT;
- if (strbuf_readlink(&sb, name, st.st_size) < 0)
- die_errno("readlink(%s)", name);
- prep_temp_blob(r->index, name, temp, sb.buf, sb.len,
+ if (strbuf_readlink(&sb, one->path, st.st_size) < 0)
+ die_errno("readlink(%s)", one->path);
+ prep_temp_blob(r->index, one->path, temp, sb.buf, sb.len,
(one->oid_valid ?
&one->oid : null_oid()),
(one->oid_valid ?
@@ -4234,7 +4297,7 @@ static struct diff_tempfile *prepare_temp_file(struct repository *r,
}
else {
/* we can borrow from the file in the work tree */
- temp->name = name;
+ temp->name = one->path;
if (!one->oid_valid)
oid_to_hex_r(temp->hex, null_oid());
else
@@ -4252,7 +4315,7 @@ static struct diff_tempfile *prepare_temp_file(struct repository *r,
else {
if (diff_populate_filespec(r, one, NULL))
die("cannot read data blob for %s", one->path);
- prep_temp_blob(r->index, name, temp,
+ prep_temp_blob(r->index, one->path, temp,
one->data, one->size,
&one->oid, one->mode);
}
@@ -4261,10 +4324,9 @@ static struct diff_tempfile *prepare_temp_file(struct repository *r,
static void add_external_diff_name(struct repository *r,
struct strvec *argv,
- const char *name,
struct diff_filespec *df)
{
- struct diff_tempfile *temp = prepare_temp_file(r, name, df);
+ struct diff_tempfile *temp = prepare_temp_file(r, df);
strvec_push(argv, temp->name);
strvec_push(argv, temp->hex);
strvec_push(argv, temp->mode);
@@ -4284,35 +4346,32 @@ static void run_external_diff(const char *pgm,
const char *xfrm_msg,
struct diff_options *o)
{
- struct strvec argv = STRVEC_INIT;
- struct strvec env = STRVEC_INIT;
+ struct child_process cmd = CHILD_PROCESS_INIT;
struct diff_queue_struct *q = &diff_queued_diff;
- strvec_push(&argv, pgm);
- strvec_push(&argv, name);
+ strvec_push(&cmd.args, pgm);
+ strvec_push(&cmd.args, name);
if (one && two) {
- add_external_diff_name(o->repo, &argv, name, one);
- if (!other)
- add_external_diff_name(o->repo, &argv, name, two);
- else {
- add_external_diff_name(o->repo, &argv, other, two);
- strvec_push(&argv, other);
- strvec_push(&argv, xfrm_msg);
+ add_external_diff_name(o->repo, &cmd.args, one);
+ add_external_diff_name(o->repo, &cmd.args, two);
+ if (other) {
+ strvec_push(&cmd.args, other);
+ strvec_push(&cmd.args, xfrm_msg);
}
}
- strvec_pushf(&env, "GIT_DIFF_PATH_COUNTER=%d", ++o->diff_path_counter);
- strvec_pushf(&env, "GIT_DIFF_PATH_TOTAL=%d", q->nr);
+ strvec_pushf(&cmd.env, "GIT_DIFF_PATH_COUNTER=%d",
+ ++o->diff_path_counter);
+ strvec_pushf(&cmd.env, "GIT_DIFF_PATH_TOTAL=%d", q->nr);
diff_free_filespec_data(one);
diff_free_filespec_data(two);
- if (run_command_v_opt_cd_env(argv.v, RUN_USING_SHELL, NULL, env.v))
+ cmd.use_shell = 1;
+ if (run_command(&cmd))
die(_("external diff died, stopping at %s"), name);
remove_tempfile();
- strvec_clear(&argv);
- strvec_clear(&env);
}
static int similarity_index(struct diff_filepair *p)
@@ -4323,7 +4382,7 @@ static int similarity_index(struct diff_filepair *p)
static const char *diff_abbrev_oid(const struct object_id *oid, int abbrev)
{
if (startup_info->have_repository)
- return find_unique_abbrev(oid, abbrev);
+ return repo_find_unique_abbrev(the_repository, oid, abbrev);
else {
char *hex = oid_to_hex(oid);
if (abbrev < 0)
@@ -4428,15 +4487,13 @@ static void run_diff_cmd(const char *pgm,
const char *xfrm_msg = NULL;
int complete_rewrite = (p->status == DIFF_STATUS_MODIFIED) && p->score;
int must_show_header = 0;
+ struct userdiff_driver *drv = NULL;
-
- if (o->flags.allow_external) {
- struct userdiff_driver *drv;
-
+ if (o->flags.allow_external || !o->ignore_driver_algorithm)
drv = userdiff_find_by_path(o->repo->index, attr_path);
- if (drv && drv->external)
- pgm = drv->external;
- }
+
+ if (o->flags.allow_external && drv && drv->external)
+ pgm = drv->external;
if (msg) {
/*
@@ -4453,12 +4510,16 @@ static void run_diff_cmd(const char *pgm,
run_external_diff(pgm, name, other, one, two, xfrm_msg, o);
return;
}
- if (one && two)
+ if (one && two) {
+ if (!o->ignore_driver_algorithm && drv && drv->algorithm)
+ set_diff_algorithm(o, drv->algorithm);
+
builtin_diff(name, other ? other : name,
one, two, xfrm_msg, must_show_header,
o, complete_rewrite);
- else
+ } else {
fprintf(o->file, "* Unmerged path %s\n", name);
+ }
}
static void diff_fill_oid_info(struct diff_filespec *one, struct index_state *istate)
@@ -4555,6 +4616,14 @@ static void run_diffstat(struct diff_filepair *p, struct diff_options *o,
const char *name;
const char *other;
+ if (!o->ignore_driver_algorithm) {
+ struct userdiff_driver *drv = userdiff_find_by_path(o->repo->index,
+ p->one->path);
+
+ if (drv && drv->algorithm)
+ set_diff_algorithm(o, drv->algorithm);
+ }
+
if (DIFF_PAIR_UNMERGED(p)) {
/* unmerged */
builtin_diffstat(p->one->path, NULL, NULL, NULL,
@@ -4599,8 +4668,6 @@ static void run_checkdiff(struct diff_filepair *p, struct diff_options *o)
builtin_checkdiff(name, other, attr_path, p->one, p->two, o);
}
-static void prep_parse_options(struct diff_options *options);
-
void repo_diff_setup(struct repository *r, struct diff_options *options)
{
memcpy(options, &default_diff_options, sizeof(*options));
@@ -4638,16 +4705,13 @@ void repo_diff_setup(struct repository *r, struct diff_options *options)
options->flags.ignore_untracked_in_submodules = 1;
if (diff_no_prefix) {
- options->a_prefix = options->b_prefix = "";
+ diff_set_noprefix(options);
} else if (!diff_mnemonic_prefix) {
- options->a_prefix = "a/";
- options->b_prefix = "b/";
+ diff_set_default_prefix(options);
}
options->color_moved = diff_color_moved_default;
options->color_moved_ws_handling = diff_color_moved_ws_default;
-
- prep_parse_options(options);
}
static const char diff_status_letters[] = {
@@ -4805,8 +4869,6 @@ void diff_setup_done(struct diff_options *options)
options->filter = ~filter_bit[DIFF_STATUS_FILTER_AON];
options->filter &= ~options->filter_not;
}
-
- FREE_AND_NULL(options->parseopts);
}
int parse_long_opt(const char *opt, const char **argv,
@@ -4956,7 +5018,7 @@ static int diff_opt_find_object(const struct option *option,
struct object_id oid;
BUG_ON_OPT_NEG(unset);
- if (get_oid(arg, &oid))
+ if (repo_get_oid(the_repository, arg, &oid))
return error(_("unable to resolve '%s'"), arg);
if (!opt->objfind)
@@ -5101,17 +5163,32 @@ static int diff_opt_diff_algorithm(const struct option *opt,
const char *arg, int unset)
{
struct diff_options *options = opt->value;
- long value = parse_algorithm_value(arg);
BUG_ON_OPT_NEG(unset);
- if (value < 0)
+
+ if (set_diff_algorithm(options, arg))
return error(_("option diff-algorithm accepts \"myers\", "
"\"minimal\", \"patience\" and \"histogram\""));
- /* clear out previous settings */
- DIFF_XDL_CLR(options, NEED_MINIMAL);
- options->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
- options->xdl_opts |= value;
+ options->ignore_driver_algorithm = 1;
+
+ return 0;
+}
+
+static int diff_opt_diff_algorithm_no_arg(const struct option *opt,
+ const char *arg, int unset)
+{
+ struct diff_options *options = opt->value;
+
+ BUG_ON_OPT_NEG(unset);
+ BUG_ON_OPT_ARG(arg);
+
+ if (set_diff_algorithm(options, opt->long_name))
+ BUG("available diff algorithms include \"myers\", "
+ "\"minimal\", \"patience\" and \"histogram\"");
+
+ options->ignore_driver_algorithm = 1;
+
return 0;
}
@@ -5214,8 +5291,18 @@ static int diff_opt_no_prefix(const struct option *opt,
BUG_ON_OPT_NEG(unset);
BUG_ON_OPT_ARG(optarg);
- options->a_prefix = "";
- options->b_prefix = "";
+ diff_set_noprefix(options);
+ return 0;
+}
+
+static int diff_opt_default_prefix(const struct option *opt,
+ const char *optarg, int unset)
+{
+ struct diff_options *options = opt->value;
+
+ BUG_ON_OPT_NEG(unset);
+ BUG_ON_OPT_ARG(optarg);
+ diff_set_default_prefix(options);
return 0;
}
@@ -5244,7 +5331,6 @@ static int diff_opt_patience(const struct option *opt,
BUG_ON_OPT_NEG(unset);
BUG_ON_OPT_ARG(arg);
- options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF);
/*
* Both --patience and --anchored use PATIENCE_DIFF
* internally, so remove any anchors previously
@@ -5253,7 +5339,9 @@ static int diff_opt_patience(const struct option *opt,
for (i = 0; i < options->anchors_nr; i++)
free(options->anchors[i]);
options->anchors_nr = 0;
- return 0;
+ options->ignore_driver_algorithm = 1;
+
+ return set_diff_algorithm(options, "patience");
}
static int diff_opt_ignore_regex(const struct option *opt,
@@ -5403,7 +5491,8 @@ static int diff_opt_rotate_to(const struct option *opt, const char *arg, int uns
return 0;
}
-static void prep_parse_options(struct diff_options *options)
+struct option *add_diff_options(const struct option *opts,
+ struct diff_options *options)
{
struct option parseopts[] = {
OPT_GROUP(N_("Diff output format options")),
@@ -5506,6 +5595,9 @@ static void prep_parse_options(struct diff_options *options)
OPT_CALLBACK_F(0, "no-prefix", options, NULL,
N_("do not show any source or destination prefix"),
PARSE_OPT_NONEG | PARSE_OPT_NOARG, diff_opt_no_prefix),
+ OPT_CALLBACK_F(0, "default-prefix", options, NULL,
+ N_("use default prefixes a/ and b/"),
+ PARSE_OPT_NONEG | PARSE_OPT_NOARG, diff_opt_default_prefix),
OPT_INTEGER_F(0, "inter-hunk-context", &options->interhunkcontext,
N_("show context between diff hunks up to the specified number of lines"),
PARSE_OPT_NONEG),
@@ -5555,9 +5647,10 @@ static void prep_parse_options(struct diff_options *options)
N_("prevent rename/copy detection if the number of rename/copy targets exceeds given limit")),
OPT_GROUP(N_("Diff algorithm options")),
- OPT_BIT(0, "minimal", &options->xdl_opts,
- N_("produce the smallest possible diff"),
- XDF_NEED_MINIMAL),
+ OPT_CALLBACK_F(0, "minimal", options, NULL,
+ N_("produce the smallest possible diff"),
+ PARSE_OPT_NONEG | PARSE_OPT_NOARG,
+ diff_opt_diff_algorithm_no_arg),
OPT_BIT_F('w', "ignore-all-space", &options->xdl_opts,
N_("ignore whitespace when comparing lines"),
XDF_IGNORE_WHITESPACE, PARSE_OPT_NONEG),
@@ -5583,9 +5676,10 @@ static void prep_parse_options(struct diff_options *options)
N_("generate diff using the \"patience diff\" algorithm"),
PARSE_OPT_NONEG | PARSE_OPT_NOARG,
diff_opt_patience),
- OPT_BITOP(0, "histogram", &options->xdl_opts,
- N_("generate diff using the \"histogram diff\" algorithm"),
- XDF_HISTOGRAM_DIFF, XDF_DIFF_ALGORITHM_MASK),
+ OPT_CALLBACK_F(0, "histogram", options, NULL,
+ N_("generate diff using the \"histogram diff\" algorithm"),
+ PARSE_OPT_NONEG | PARSE_OPT_NOARG,
+ diff_opt_diff_algorithm_no_arg),
OPT_CALLBACK_F(0, "diff-algorithm", options, N_("<algorithm>"),
N_("choose a diff algorithm"),
PARSE_OPT_NONEG, diff_opt_diff_algorithm),
@@ -5673,22 +5767,25 @@ static void prep_parse_options(struct diff_options *options)
OPT_END()
};
- ALLOC_ARRAY(options->parseopts, ARRAY_SIZE(parseopts));
- memcpy(options->parseopts, parseopts, sizeof(parseopts));
+ return parse_options_concat(opts, parseopts);
}
int diff_opt_parse(struct diff_options *options,
const char **av, int ac, const char *prefix)
{
+ struct option no_options[] = { OPT_END() };
+ struct option *parseopts = add_diff_options(no_options, options);
+
if (!prefix)
prefix = "";
- ac = parse_options(ac, av, prefix, options->parseopts, NULL,
+ ac = parse_options(ac, av, prefix, parseopts, NULL,
PARSE_OPT_KEEP_DASHDASH |
PARSE_OPT_KEEP_UNKNOWN_OPT |
PARSE_OPT_NO_INTERNAL_HELP |
PARSE_OPT_ONE_SHOT |
PARSE_OPT_STOP_AT_NON_OPTION);
+ free(parseopts);
return ac;
}
@@ -5756,6 +5853,13 @@ void diff_free_filepair(struct diff_filepair *p)
free(p);
}
+void diff_free_queue(struct diff_queue_struct *q)
+{
+ for (int i = 0; i < q->nr; i++)
+ diff_free_filepair(q->queue[i]);
+ free(q->queue);
+}
+
const char *diff_aligned_abbrev(const struct object_id *oid, int len)
{
int abblen;
@@ -6212,7 +6316,7 @@ static void patch_id_add_mode(git_hash_ctx *ctx, unsigned mode)
}
/* returns 0 upon success, and writes result into oid */
-static int diff_get_patch_id(struct diff_options *options, struct object_id *oid, int diff_header_only, int stable)
+static int diff_get_patch_id(struct diff_options *options, struct object_id *oid, int diff_header_only)
{
struct diff_queue_struct *q = &diff_queued_diff;
int i;
@@ -6259,66 +6363,63 @@ static int diff_get_patch_id(struct diff_options *options, struct object_id *oid
if (p->one->mode == 0) {
patch_id_add_string(&ctx, "newfilemode");
patch_id_add_mode(&ctx, p->two->mode);
- patch_id_add_string(&ctx, "---/dev/null");
- patch_id_add_string(&ctx, "+++b/");
- the_hash_algo->update_fn(&ctx, p->two->path, len2);
} else if (p->two->mode == 0) {
patch_id_add_string(&ctx, "deletedfilemode");
patch_id_add_mode(&ctx, p->one->mode);
- patch_id_add_string(&ctx, "---a/");
- the_hash_algo->update_fn(&ctx, p->one->path, len1);
- patch_id_add_string(&ctx, "+++/dev/null");
- } else {
- patch_id_add_string(&ctx, "---a/");
- the_hash_algo->update_fn(&ctx, p->one->path, len1);
- patch_id_add_string(&ctx, "+++b/");
- the_hash_algo->update_fn(&ctx, p->two->path, len2);
+ } else if (p->one->mode != p->two->mode) {
+ patch_id_add_string(&ctx, "oldmode");
+ patch_id_add_mode(&ctx, p->one->mode);
+ patch_id_add_string(&ctx, "newmode");
+ patch_id_add_mode(&ctx, p->two->mode);
}
- if (diff_header_only)
- continue;
-
- if (fill_mmfile(options->repo, &mf1, p->one) < 0 ||
- fill_mmfile(options->repo, &mf2, p->two) < 0)
- return error("unable to read files to diff");
-
- if (diff_filespec_is_binary(options->repo, p->one) ||
+ if (diff_header_only) {
+ /* don't do anything since we're only populating header info */
+ } else if (diff_filespec_is_binary(options->repo, p->one) ||
diff_filespec_is_binary(options->repo, p->two)) {
the_hash_algo->update_fn(&ctx, oid_to_hex(&p->one->oid),
the_hash_algo->hexsz);
the_hash_algo->update_fn(&ctx, oid_to_hex(&p->two->oid),
the_hash_algo->hexsz);
- continue;
- }
-
- xpp.flags = 0;
- xecfg.ctxlen = 3;
- xecfg.flags = XDL_EMIT_NO_HUNK_HDR;
- if (xdi_diff_outf(&mf1, &mf2, NULL,
- patch_id_consume, &data, &xpp, &xecfg))
- return error("unable to generate patch-id diff for %s",
- p->one->path);
+ } else {
+ if (p->one->mode == 0) {
+ patch_id_add_string(&ctx, "---/dev/null");
+ patch_id_add_string(&ctx, "+++b/");
+ the_hash_algo->update_fn(&ctx, p->two->path, len2);
+ } else if (p->two->mode == 0) {
+ patch_id_add_string(&ctx, "---a/");
+ the_hash_algo->update_fn(&ctx, p->one->path, len1);
+ patch_id_add_string(&ctx, "+++/dev/null");
+ } else {
+ patch_id_add_string(&ctx, "---a/");
+ the_hash_algo->update_fn(&ctx, p->one->path, len1);
+ patch_id_add_string(&ctx, "+++b/");
+ the_hash_algo->update_fn(&ctx, p->two->path, len2);
+ }
- if (stable)
- flush_one_hunk(oid, &ctx);
+ if (fill_mmfile(options->repo, &mf1, p->one) < 0 ||
+ fill_mmfile(options->repo, &mf2, p->two) < 0)
+ return error("unable to read files to diff");
+ xpp.flags = 0;
+ xecfg.ctxlen = 3;
+ xecfg.flags = XDL_EMIT_NO_HUNK_HDR;
+ if (xdi_diff_outf(&mf1, &mf2, NULL,
+ patch_id_consume, &data, &xpp, &xecfg))
+ return error("unable to generate patch-id diff for %s",
+ p->one->path);
+ }
+ flush_one_hunk(oid, &ctx);
}
- if (!stable)
- the_hash_algo->final_oid_fn(oid, &ctx);
-
return 0;
}
-int diff_flush_patch_id(struct diff_options *options, struct object_id *oid, int diff_header_only, int stable)
+int diff_flush_patch_id(struct diff_options *options, struct object_id *oid, int diff_header_only)
{
struct diff_queue_struct *q = &diff_queued_diff;
- int i;
- int result = diff_get_patch_id(options, oid, diff_header_only, stable);
-
- for (i = 0; i < q->nr; i++)
- diff_free_filepair(q->queue[i]);
+ int result = diff_get_patch_id(options, oid, diff_header_only);
- free(q->queue);
+ diff_free_queue(q);
DIFF_QUEUE_CLEAR(q);
return result;
@@ -6493,7 +6594,6 @@ void diff_free(struct diff_options *options)
diff_free_file(options);
diff_free_ignore_regex(options);
clear_pathspec(&options->pathspec);
- FREE_AND_NULL(options->parseopts);
}
void diff_flush(struct diff_options *options)
@@ -6587,10 +6687,8 @@ void diff_flush(struct diff_options *options)
if (output_format & DIFF_FORMAT_CALLBACK)
options->format_callback(q, options, options->format_callback_data);
- for (i = 0; i < q->nr; i++)
- diff_free_filepair(q->queue[i]);
free_queue:
- free(q->queue);
+ diff_free_queue(q);
DIFF_QUEUE_CLEAR(q);
diff_free(options);
@@ -6805,7 +6903,7 @@ void diffcore_std(struct diff_options *options)
* If no prefetching occurs, diffcore_rename() will prefetch if it
* decides that it needs inexact rename detection.
*/
- if (options->repo == the_repository && has_promisor_remote() &&
+ if (options->repo == the_repository && repo_has_promisor_remote(the_repository) &&
(options->output_format & output_formats_to_prefetch ||
options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK))
diff_queued_diff_prefetch(options->repo);
@@ -7019,7 +7117,7 @@ static char *run_textconv(struct repository *r,
struct strbuf buf = STRBUF_INIT;
int err = 0;
- temp = prepare_temp_file(r, spec->path, spec);
+ temp = prepare_temp_file(r, spec);
strvec_push(&child.args, pgm);
strvec_push(&child.args, temp->name);
diff --git a/diff.h b/diff.h
index 8ae18e5ab1..3a7a9e8b88 100644
--- a/diff.h
+++ b/diff.h
@@ -4,10 +4,9 @@
#ifndef DIFF_H
#define DIFF_H
-#include "tree-walk.h"
#include "pathspec.h"
-#include "object.h"
#include "oidset.h"
+#include "strbuf.h"
/**
* The diff API is for programs that compare two sets of files (e.g. two trees,
@@ -71,7 +70,6 @@ struct oid_array;
struct option;
struct repository;
struct rev_info;
-struct strbuf;
struct userdiff_driver;
typedef int (*pathchange_fn_t)(struct diff_options *options,
@@ -333,6 +331,7 @@ struct diff_options {
int prefix_length;
const char *stat_sep;
int xdl_opts;
+ int ignore_driver_algorithm;
/* see Documentation/diff-options.txt */
char **anchors;
@@ -394,7 +393,6 @@ struct diff_options {
unsigned color_moved_ws_handling;
struct repository *repo;
- struct option *parseopts;
struct strmap *additional_path_headers;
int no_free;
@@ -497,6 +495,8 @@ void diff_tree_combined(const struct object_id *oid, const struct oid_array *par
void diff_tree_combined_merge(const struct commit *commit, struct rev_info *rev);
void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const char *b);
+void diff_set_noprefix(struct diff_options *options);
+void diff_set_default_prefix(struct diff_options *options);
int diff_can_quit_early(struct diff_options *);
@@ -535,10 +535,8 @@ int git_diff_basic_config(const char *var, const char *value, void *cb);
int git_diff_heuristic_config(const char *var, const char *value, void *cb);
void init_diff_ui_defaults(void);
int git_diff_ui_config(const char *var, const char *value, void *cb);
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define diff_setup(diffopts) repo_diff_setup(the_repository, diffopts)
-#endif
void repo_diff_setup(struct repository *, struct diff_options *);
+struct option *add_diff_options(const struct option *, struct diff_options *);
int diff_opt_parse(struct diff_options *, const char **, int, const char *);
void diff_setup_done(struct diff_options *);
int git_config_rename(const char *var, const char *value);
@@ -616,7 +614,7 @@ void diff_warn_rename_limit(const char *varname, int needed, int degraded_cc);
#define DIFF_STATUS_FILTER_BROKEN 'B'
/*
- * This is different from find_unique_abbrev() in that
+ * This is different from repo_find_unique_abbrev() in that
* it stuffs the result with dots for alignment.
*/
const char *diff_aligned_abbrev(const struct object_id *sha1, int);
@@ -634,7 +632,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option);
int run_diff_index(struct rev_info *revs, unsigned int option);
int do_diff_cache(const struct object_id *, struct diff_options *);
-int diff_flush_patch_id(struct diff_options *, struct object_id *, int, int);
+int diff_flush_patch_id(struct diff_options *, struct object_id *, int);
void flush_one_hunk(struct object_id *result, git_hash_ctx *ctx);
int diff_result_code(struct diff_options *, int);
diff --git a/diffcore-break.c b/diffcore-break.c
index 0d4a14964d..5462420bbb 100644
--- a/diffcore-break.c
+++ b/diffcore-break.c
@@ -65,7 +65,7 @@ static int should_break(struct repository *r,
oideq(&src->oid, &dst->oid))
return 0; /* they are the same */
- if (r == the_repository && has_promisor_remote()) {
+ if (r == the_repository && repo_has_promisor_remote(the_repository)) {
options.missing_object_cb = diff_queued_diff_prefetch;
options.missing_object_data = r;
}
diff --git a/diffcore-delta.c b/diffcore-delta.c
index 18d8f766d7..c30b56e983 100644
--- a/diffcore-delta.c
+++ b/diffcore-delta.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "diff.h"
#include "diffcore.h"
diff --git a/diffcore-order.c b/diffcore-order.c
index 19e73311f9..57ccab2846 100644
--- a/diffcore-order.c
+++ b/diffcore-order.c
@@ -1,7 +1,8 @@
/*
* Copyright (C) 2005 Junio C Hamano
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
#include "diff.h"
#include "diffcore.h"
diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index c88e50c632..13c98a7b5e 100644
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
@@ -2,12 +2,12 @@
* Copyright (C) 2005 Junio C Hamano
* Copyright (C) 2010 Google Inc.
*/
-#include "cache.h"
+#include "git-compat-util.h"
#include "diff.h"
#include "diffcore.h"
#include "xdiff-interface.h"
#include "kwset.h"
-#include "commit.h"
+#include "pretty.h"
#include "quote.h"
typedef int (*pickaxe_fn)(mmfile_t *one, mmfile_t *two,
@@ -38,7 +38,7 @@ static int diffgrep_consume(void *priv, char *line, unsigned long len)
static int diff_grep(mmfile_t *one, mmfile_t *two,
struct diff_options *o,
- regex_t *regexp, kwset_t kws)
+ regex_t *regexp, kwset_t kws UNUSED)
{
struct diffgrep_cb ecbdata;
xpparam_t xpp;
@@ -114,7 +114,7 @@ static unsigned int contains(mmfile_t *mf, regex_t *regexp, kwset_t kws,
}
static int has_changes(mmfile_t *one, mmfile_t *two,
- struct diff_options *o,
+ struct diff_options *o UNUSED,
regex_t *regexp, kwset_t kws)
{
unsigned int c1 = one ? contains(one, regexp, kws, 0) : 0;
diff --git a/diffcore-rename.c b/diffcore-rename.c
index c0422d9e70..8e2e7a3ad7 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -2,14 +2,19 @@
*
* Copyright (C) 2005 Junio C Hamano
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "diff.h"
#include "diffcore.h"
#include "object-store.h"
#include "hashmap.h"
+#include "mem-pool.h"
+#include "oid-array.h"
#include "progress.h"
#include "promisor-remote.h"
+#include "string-list.h"
#include "strmap.h"
+#include "trace2.h"
/* Table of rename/copy destinations */
@@ -981,7 +986,7 @@ static int find_basename_matches(struct diff_options *options,
strintmap_set(&dests, base, i);
}
- if (options->repo == the_repository && has_promisor_remote()) {
+ if (options->repo == the_repository && repo_has_promisor_remote(the_repository)) {
dpf_options.missing_object_cb = basename_prefetch;
dpf_options.missing_object_data = &prefetch_options;
}
@@ -1567,7 +1572,7 @@ void diffcore_rename_extended(struct diff_options *options,
/* Finish setting up dpf_options */
prefetch_options.skip_unmodified = skip_unmodified;
- if (options->repo == the_repository && has_promisor_remote()) {
+ if (options->repo == the_repository && repo_has_promisor_remote(the_repository)) {
dpf_options.missing_object_cb = inexact_prefetch;
dpf_options.missing_object_data = &prefetch_options;
}
diff --git a/diffcore-rotate.c b/diffcore-rotate.c
index 445f060ab0..533986cf63 100644
--- a/diffcore-rotate.c
+++ b/diffcore-rotate.c
@@ -2,7 +2,8 @@
* Copyright (C) 2021, Google LLC.
* Based on diffcore-order.c, which is Copyright (C) 2005, Junio C Hamano
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
#include "diff.h"
#include "diffcore.h"
diff --git a/diffcore.h b/diffcore.h
index badc2261c2..5ffe4ec788 100644
--- a/diffcore.h
+++ b/diffcore.h
@@ -4,9 +4,11 @@
#ifndef DIFFCORE_H
#define DIFFCORE_H
-#include "cache.h"
+#include "hash-ll.h"
struct diff_options;
+struct mem_pool;
+struct oid_array;
struct repository;
struct strintmap;
struct strmap;
@@ -162,6 +164,7 @@ struct diff_filepair *diff_queue(struct diff_queue_struct *,
struct diff_filespec *,
struct diff_filespec *);
void diff_q(struct diff_queue_struct *, struct diff_filepair *);
+void diff_free_queue(struct diff_queue_struct *q);
/* dir_rename_relevance: the reason we want rename information for a dir */
enum dir_rename_relevance {
diff --git a/dir-iterator.c b/dir-iterator.c
index 3764dd81a1..fb7c47f0e8 100644
--- a/dir-iterator.c
+++ b/dir-iterator.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "dir.h"
#include "iterator.h"
#include "dir-iterator.h"
@@ -112,10 +113,7 @@ static int prepare_next_entry_data(struct dir_iterator_int *iter,
iter->base.basename = iter->base.path.buf +
iter->levels[iter->levels_nr - 1].prefix_len;
- if (iter->flags & DIR_ITERATOR_FOLLOW_SYMLINKS)
- err = stat(iter->base.path.buf, &iter->base.st);
- else
- err = lstat(iter->base.path.buf, &iter->base.st);
+ err = lstat(iter->base.path.buf, &iter->base.st);
saved_errno = errno;
if (err && errno != ENOENT)
@@ -213,13 +211,10 @@ struct dir_iterator *dir_iterator_begin(const char *path, unsigned int flags)
iter->flags = flags;
/*
- * Note: stat/lstat already checks for NULL or empty strings and
+ * Note: lstat already checks for NULL or empty strings and
* nonexistent paths.
*/
- if (iter->flags & DIR_ITERATOR_FOLLOW_SYMLINKS)
- err = stat(iter->base.path.buf, &iter->base.st);
- else
- err = lstat(iter->base.path.buf, &iter->base.st);
+ err = lstat(iter->base.path.buf, &iter->base.st);
if (err < 0) {
saved_errno = errno;
diff --git a/dir-iterator.h b/dir-iterator.h
index e3b6ff2800..479e1ec784 100644
--- a/dir-iterator.h
+++ b/dir-iterator.h
@@ -54,24 +54,8 @@
* and ITER_ERROR is returned immediately. In both cases, a meaningful
* warning is emitted. Note: ENOENT errors are always ignored so that
* the API users may remove files during iteration.
- *
- * - DIR_ITERATOR_FOLLOW_SYMLINKS: make dir-iterator follow symlinks.
- * i.e., linked directories' contents will be iterated over and
- * iter->base.st will contain information on the referred files,
- * not the symlinks themselves, which is the default behavior. Broken
- * symlinks are ignored.
- *
- * Note: setting DIR_ITERATOR_FOLLOW_SYMLINKS affects resolving the
- * starting path as well (e.g., attempting to iterate starting at a
- * symbolic link pointing to a directory without FOLLOW_SYMLINKS will
- * result in an error).
- *
- * Warning: circular symlinks are also followed when
- * DIR_ITERATOR_FOLLOW_SYMLINKS is set. The iteration may end up with
- * an ELOOP if they happen and DIR_ITERATOR_PEDANTIC is set.
*/
#define DIR_ITERATOR_PEDANTIC (1 << 0)
-#define DIR_ITERATOR_FOLLOW_SYMLINKS (1 << 1)
struct dir_iterator {
/* The current path: */
@@ -88,9 +72,7 @@ struct dir_iterator {
const char *basename;
/*
- * The result of calling lstat() on path; or stat(), if the
- * DIR_ITERATOR_FOLLOW_SYMLINKS flag was set at
- * dir_iterator's initialization.
+ * The result of calling lstat() on path.
*/
struct stat st;
};
diff --git a/dir.c b/dir.c
index d604d1bab9..a7469df3ac 100644
--- a/dir.c
+++ b/dir.c
@@ -5,9 +5,15 @@
* Copyright (C) Linus Torvalds, 2005-2006
* Junio Hamano, 2005-2006
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
+#include "convert.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "object-file.h"
#include "object-store.h"
#include "attr.h"
#include "refs.h"
@@ -17,7 +23,12 @@
#include "varint.h"
#include "ewah/ewok.h"
#include "fsmonitor.h"
+#include "setup.h"
#include "submodule-config.h"
+#include "symlinks.h"
+#include "trace2.h"
+#include "tree.h"
+#include "wrapper.h"
/*
* Tells read_directory_recursive how a file or directory should be treated.
@@ -267,7 +278,7 @@ static int do_read_blob(const struct object_id *oid, struct oid_stat *oid_stat,
*size_out = 0;
*data_out = NULL;
- data = read_object_file(oid, &type, &sz);
+ data = repo_read_object_file(the_repository, oid, &type, &sz);
if (!data || type != OBJ_BLOB) {
free(data);
return -1;
@@ -732,6 +743,13 @@ static void add_pattern_to_hashsets(struct pattern_list *pl, struct path_pattern
goto clear_hashmaps;
}
+ if (!(given->flags & PATTERN_FLAG_MUSTBEDIR) &&
+ strcmp(given->pattern, "/*")) {
+ /* Not a cone pattern. */
+ warning(_("unrecognized pattern: '%s'"), given->pattern);
+ goto clear_hashmaps;
+ }
+
prev = given->pattern;
cur = given->pattern + 1;
next = given->pattern + 2;
@@ -1183,7 +1201,7 @@ struct pattern_list *add_pattern_list(struct dir_struct *dir,
struct pattern_list *pl;
struct exclude_list_group *group;
- group = &dir->exclude_list_group[group_type];
+ group = &dir->internal.exclude_list_group[group_type];
ALLOC_GROW(group->pl, group->nr + 1, group->alloc);
pl = &group->pl[group->nr++];
memset(pl, 0, sizeof(*pl));
@@ -1204,7 +1222,7 @@ static void add_patterns_from_file_1(struct dir_struct *dir, const char *fname,
* differently when dir->untracked is non-NULL.
*/
if (!dir->untracked)
- dir->unmanaged_exclude_files++;
+ dir->internal.unmanaged_exclude_files++;
pl = add_pattern_list(dir, EXC_FILE, fname);
if (add_patterns(fname, "", 0, pl, NULL, 0, oid_stat) < 0)
die(_("cannot use %s as an exclude file"), fname);
@@ -1212,7 +1230,7 @@ static void add_patterns_from_file_1(struct dir_struct *dir, const char *fname,
void add_patterns_from_file(struct dir_struct *dir, const char *fname)
{
- dir->unmanaged_exclude_files++; /* see validate_untracked_cache() */
+ dir->internal.unmanaged_exclude_files++; /* see validate_untracked_cache() */
add_patterns_from_file_1(dir, fname, NULL);
}
@@ -1512,7 +1530,7 @@ static struct path_pattern *last_matching_pattern_from_lists(
struct exclude_list_group *group;
struct path_pattern *pattern;
for (i = EXC_CMDL; i <= EXC_FILE; i++) {
- group = &dir->exclude_list_group[i];
+ group = &dir->internal.exclude_list_group[i];
for (j = group->nr - 1; j >= 0; j--) {
pattern = last_matching_pattern_from_list(
pathname, pathlen, basename, dtype_p,
@@ -1538,20 +1556,20 @@ static void prep_exclude(struct dir_struct *dir,
struct untracked_cache_dir *untracked;
int current;
- group = &dir->exclude_list_group[EXC_DIRS];
+ group = &dir->internal.exclude_list_group[EXC_DIRS];
/*
* Pop the exclude lists from the EXCL_DIRS exclude_list_group
* which originate from directories not in the prefix of the
* path being checked.
*/
- while ((stk = dir->exclude_stack) != NULL) {
+ while ((stk = dir->internal.exclude_stack) != NULL) {
if (stk->baselen <= baselen &&
- !strncmp(dir->basebuf.buf, base, stk->baselen))
+ !strncmp(dir->internal.basebuf.buf, base, stk->baselen))
break;
- pl = &group->pl[dir->exclude_stack->exclude_ix];
- dir->exclude_stack = stk->prev;
- dir->pattern = NULL;
+ pl = &group->pl[dir->internal.exclude_stack->exclude_ix];
+ dir->internal.exclude_stack = stk->prev;
+ dir->internal.pattern = NULL;
free((char *)pl->src); /* see strbuf_detach() below */
clear_pattern_list(pl);
free(stk);
@@ -1559,7 +1577,7 @@ static void prep_exclude(struct dir_struct *dir,
}
/* Skip traversing into sub directories if the parent is excluded */
- if (dir->pattern)
+ if (dir->internal.pattern)
return;
/*
@@ -1567,12 +1585,12 @@ static void prep_exclude(struct dir_struct *dir,
* memset(dir, 0, sizeof(*dir)) before use. Changing all of
* them seems lots of work for little benefit.
*/
- if (!dir->basebuf.buf)
- strbuf_init(&dir->basebuf, PATH_MAX);
+ if (!dir->internal.basebuf.buf)
+ strbuf_init(&dir->internal.basebuf, PATH_MAX);
/* Read from the parent directories and push them down. */
current = stk ? stk->baselen : -1;
- strbuf_setlen(&dir->basebuf, current < 0 ? 0 : current);
+ strbuf_setlen(&dir->internal.basebuf, current < 0 ? 0 : current);
if (dir->untracked)
untracked = stk ? stk->ucd : dir->untracked->root;
else
@@ -1592,32 +1610,33 @@ static void prep_exclude(struct dir_struct *dir,
die("oops in prep_exclude");
cp++;
untracked =
- lookup_untracked(dir->untracked, untracked,
+ lookup_untracked(dir->untracked,
+ untracked,
base + current,
cp - base - current);
}
- stk->prev = dir->exclude_stack;
+ stk->prev = dir->internal.exclude_stack;
stk->baselen = cp - base;
stk->exclude_ix = group->nr;
stk->ucd = untracked;
pl = add_pattern_list(dir, EXC_DIRS, NULL);
- strbuf_add(&dir->basebuf, base + current, stk->baselen - current);
- assert(stk->baselen == dir->basebuf.len);
+ strbuf_add(&dir->internal.basebuf, base + current, stk->baselen - current);
+ assert(stk->baselen == dir->internal.basebuf.len);
/* Abort if the directory is excluded */
if (stk->baselen) {
int dt = DT_DIR;
- dir->basebuf.buf[stk->baselen - 1] = 0;
- dir->pattern = last_matching_pattern_from_lists(dir,
+ dir->internal.basebuf.buf[stk->baselen - 1] = 0;
+ dir->internal.pattern = last_matching_pattern_from_lists(dir,
istate,
- dir->basebuf.buf, stk->baselen - 1,
- dir->basebuf.buf + current, &dt);
- dir->basebuf.buf[stk->baselen - 1] = '/';
- if (dir->pattern &&
- dir->pattern->flags & PATTERN_FLAG_NEGATIVE)
- dir->pattern = NULL;
- if (dir->pattern) {
- dir->exclude_stack = stk;
+ dir->internal.basebuf.buf, stk->baselen - 1,
+ dir->internal.basebuf.buf + current, &dt);
+ dir->internal.basebuf.buf[stk->baselen - 1] = '/';
+ if (dir->internal.pattern &&
+ dir->internal.pattern->flags & PATTERN_FLAG_NEGATIVE)
+ dir->internal.pattern = NULL;
+ if (dir->internal.pattern) {
+ dir->internal.exclude_stack = stk;
return;
}
}
@@ -1640,15 +1659,15 @@ static void prep_exclude(struct dir_struct *dir,
*/
!is_null_oid(&untracked->exclude_oid))) {
/*
- * dir->basebuf gets reused by the traversal, but we
- * need fname to remain unchanged to ensure the src
- * member of each struct path_pattern correctly
+ * dir->internal.basebuf gets reused by the traversal,
+ * but we need fname to remain unchanged to ensure the
+ * src member of each struct path_pattern correctly
* back-references its source file. Other invocations
* of add_pattern_list provide stable strings, so we
* strbuf_detach() and free() here in the caller.
*/
struct strbuf sb = STRBUF_INIT;
- strbuf_addbuf(&sb, &dir->basebuf);
+ strbuf_addbuf(&sb, &dir->internal.basebuf);
strbuf_addstr(&sb, dir->exclude_per_dir);
pl->src = strbuf_detach(&sb, NULL);
add_patterns(pl->src, pl->src, stk->baselen, pl, istate,
@@ -1674,10 +1693,10 @@ static void prep_exclude(struct dir_struct *dir,
invalidate_gitignore(dir->untracked, untracked);
oidcpy(&untracked->exclude_oid, &oid_stat.oid);
}
- dir->exclude_stack = stk;
+ dir->internal.exclude_stack = stk;
current = stk->baselen;
}
- strbuf_setlen(&dir->basebuf, baselen);
+ strbuf_setlen(&dir->internal.basebuf, baselen);
}
/*
@@ -1697,8 +1716,8 @@ struct path_pattern *last_matching_pattern(struct dir_struct *dir,
prep_exclude(dir, istate, pathname, basename-pathname);
- if (dir->pattern)
- return dir->pattern;
+ if (dir->internal.pattern)
+ return dir->internal.pattern;
return last_matching_pattern_from_lists(dir, istate, pathname, pathlen,
basename, dtype_p);
@@ -1735,7 +1754,7 @@ static struct dir_entry *dir_add_name(struct dir_struct *dir,
if (index_file_exists(istate, pathname, len, ignore_case))
return NULL;
- ALLOC_GROW(dir->entries, dir->nr+1, dir->alloc);
+ ALLOC_GROW(dir->entries, dir->nr+1, dir->internal.alloc);
return dir->entries[dir->nr++] = dir_entry_new(pathname, len);
}
@@ -1746,7 +1765,7 @@ struct dir_entry *dir_add_ignored(struct dir_struct *dir,
if (!index_name_is_other(istate, pathname, len))
return NULL;
- ALLOC_GROW(dir->ignored, dir->ignored_nr+1, dir->ignored_alloc);
+ ALLOC_GROW(dir->ignored, dir->ignored_nr+1, dir->internal.ignored_alloc);
return dir->ignored[dir->ignored_nr++] = dir_entry_new(pathname, len);
}
@@ -2562,7 +2581,7 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
if (open_cached_dir(&cdir, dir, untracked, istate, &path, check_only))
goto out;
- dir->visited_directories++;
+ dir->internal.visited_directories++;
if (untracked)
untracked->check_only = !!check_only;
@@ -2571,7 +2590,7 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
/* check how the file or directory should be treated */
state = treat_path(dir, untracked, &cdir, istate, &path,
baselen, pathspec);
- dir->visited_paths++;
+ dir->internal.visited_paths++;
if (state > dir_state)
dir_state = state;
@@ -2579,7 +2598,8 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
/* recurse into subdir if instructed by treat_path */
if (state == path_recurse) {
struct untracked_cache_dir *ud;
- ud = lookup_untracked(dir->untracked, untracked,
+ ud = lookup_untracked(dir->untracked,
+ untracked,
path.buf + baselen,
path.len - baselen);
subdir_state =
@@ -2839,7 +2859,7 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
* condition also catches running setup_standard_excludes()
* before setting dir->untracked!
*/
- if (dir->unmanaged_exclude_files)
+ if (dir->internal.unmanaged_exclude_files)
return NULL;
/*
@@ -2868,7 +2888,7 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
* EXC_CMDL is not considered in the cache. If people set it,
* skip the cache.
*/
- if (dir->exclude_list_group[EXC_CMDL].nr)
+ if (dir->internal.exclude_list_group[EXC_CMDL].nr)
return NULL;
if (!ident_in_untracked(dir->untracked)) {
@@ -2928,15 +2948,15 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *d
/* Validate $GIT_DIR/info/exclude and core.excludesfile */
root = dir->untracked->root;
- if (!oideq(&dir->ss_info_exclude.oid,
+ if (!oideq(&dir->internal.ss_info_exclude.oid,
&dir->untracked->ss_info_exclude.oid)) {
invalidate_gitignore(dir->untracked, root);
- dir->untracked->ss_info_exclude = dir->ss_info_exclude;
+ dir->untracked->ss_info_exclude = dir->internal.ss_info_exclude;
}
- if (!oideq(&dir->ss_excludes_file.oid,
+ if (!oideq(&dir->internal.ss_excludes_file.oid,
&dir->untracked->ss_excludes_file.oid)) {
invalidate_gitignore(dir->untracked, root);
- dir->untracked->ss_excludes_file = dir->ss_excludes_file;
+ dir->untracked->ss_excludes_file = dir->internal.ss_excludes_file;
}
/* Make sure this directory is not dropped out at saving phase */
@@ -2962,9 +2982,9 @@ static void emit_traversal_statistics(struct dir_struct *dir,
}
trace2_data_intmax("read_directory", repo,
- "directories-visited", dir->visited_directories);
+ "directories-visited", dir->internal.visited_directories);
trace2_data_intmax("read_directory", repo,
- "paths-visited", dir->visited_paths);
+ "paths-visited", dir->internal.visited_paths);
if (!dir->untracked)
return;
@@ -2986,8 +3006,8 @@ int read_directory(struct dir_struct *dir, struct index_state *istate,
struct untracked_cache_dir *untracked;
trace2_region_enter("dir", "read_directory", istate->repo);
- dir->visited_paths = 0;
- dir->visited_directories = 0;
+ dir->internal.visited_paths = 0;
+ dir->internal.visited_directories = 0;
if (has_symlink_leading_path(path, len)) {
trace2_region_leave("dir", "read_directory", istate->repo);
@@ -3335,14 +3355,14 @@ void setup_standard_excludes(struct dir_struct *dir)
excludes_file = xdg_config_home("ignore");
if (excludes_file && !access_or_warn(excludes_file, R_OK, 0))
add_patterns_from_file_1(dir, excludes_file,
- dir->untracked ? &dir->ss_excludes_file : NULL);
+ dir->untracked ? &dir->internal.ss_excludes_file : NULL);
/* per repository user preference */
if (startup_info->have_repository) {
const char *path = git_path_info_exclude();
if (!access_or_warn(path, R_OK, 0))
add_patterns_from_file_1(dir, path,
- dir->untracked ? &dir->ss_info_exclude : NULL);
+ dir->untracked ? &dir->internal.ss_info_exclude : NULL);
}
}
@@ -3398,7 +3418,7 @@ void dir_clear(struct dir_struct *dir)
struct dir_struct new = DIR_INIT;
for (i = EXC_CMDL; i <= EXC_FILE; i++) {
- group = &dir->exclude_list_group[i];
+ group = &dir->internal.exclude_list_group[i];
for (j = 0; j < group->nr; j++) {
pl = &group->pl[j];
if (i == EXC_DIRS)
@@ -3415,13 +3435,13 @@ void dir_clear(struct dir_struct *dir)
free(dir->ignored);
free(dir->entries);
- stk = dir->exclude_stack;
+ stk = dir->internal.exclude_stack;
while (stk) {
struct exclude_stack *prev = stk->prev;
free(stk);
stk = prev;
}
- strbuf_release(&dir->basebuf);
+ strbuf_release(&dir->internal.basebuf);
memcpy(dir, &new, sizeof(*dir));
}
@@ -3581,8 +3601,12 @@ static void free_untracked(struct untracked_cache_dir *ucd)
void free_untracked_cache(struct untracked_cache *uc)
{
- if (uc)
- free_untracked(uc->root);
+ if (!uc)
+ return;
+
+ free(uc->exclude_per_dir_to_free);
+ strbuf_release(&uc->ident);
+ free_untracked(uc->root);
free(uc);
}
@@ -3739,7 +3763,7 @@ struct untracked_cache *read_untracked_extension(const void *data, unsigned long
next + offset + hashsz);
uc->dir_flags = get_be32(next + ouc_offset(dir_flags));
exclude_per_dir = (const char *)next + exclude_per_dir_offset;
- uc->exclude_per_dir = xstrdup(exclude_per_dir);
+ uc->exclude_per_dir = uc->exclude_per_dir_to_free = xstrdup(exclude_per_dir);
/* NUL after exclude_per_dir is covered by sizeof(*ouc) */
next += exclude_per_dir_offset + strlen(exclude_per_dir) + 1;
if (next >= end)
diff --git a/dir.h b/dir.h
index 674747d93a..79b85a01ee 100644
--- a/dir.h
+++ b/dir.h
@@ -1,8 +1,9 @@
#ifndef DIR_H
#define DIR_H
-#include "cache.h"
#include "hashmap.h"
+#include "pathspec.h"
+#include "statinfo.h"
#include "strbuf.h"
/**
@@ -188,6 +189,7 @@ struct untracked_cache {
struct oid_stat ss_info_exclude;
struct oid_stat ss_excludes_file;
const char *exclude_per_dir;
+ char *exclude_per_dir_to_free;
struct strbuf ident;
/*
* dir_struct#flags must match dir_flags or the untracked
@@ -211,17 +213,6 @@ struct untracked_cache {
*/
struct dir_struct {
- /* The number of members in `entries[]` array. */
- int nr;
-
- /* Internal use; keeps track of allocation of `entries[]` array.*/
- int alloc;
-
- /* The number of members in `ignored[]` array. */
- int ignored_nr;
-
- int ignored_alloc;
-
/* bit-field of options */
enum {
@@ -286,60 +277,81 @@ struct dir_struct {
DIR_SKIP_NESTED_GIT = 1<<9
} flags;
+ /* The number of members in `entries[]` array. */
+ int nr; /* output only */
+
+ /* The number of members in `ignored[]` array. */
+ int ignored_nr; /* output only */
+
/* An array of `struct dir_entry`, each element of which describes a path. */
- struct dir_entry **entries;
+ struct dir_entry **entries; /* output only */
/**
* used for ignored paths with the `DIR_SHOW_IGNORED_TOO` and
* `DIR_COLLECT_IGNORED` flags.
*/
- struct dir_entry **ignored;
+ struct dir_entry **ignored; /* output only */
+
+ /* Enable/update untracked file cache if set */
+ struct untracked_cache *untracked;
/**
- * The name of the file to be read in each directory for excluded files
- * (typically `.gitignore`).
+ * Deprecated: ls-files is the only allowed caller; all other callers
+ * should leave this as NULL; it pre-dated the
+ * setup_standard_excludes() mechanism that replaces this.
+ *
+ * This field tracks the name of the file to be read in each directory
+ * for excluded files (typically `.gitignore`).
*/
const char *exclude_per_dir;
- /*
- * We maintain three groups of exclude pattern lists:
- *
- * EXC_CMDL lists patterns explicitly given on the command line.
- * EXC_DIRS lists patterns obtained from per-directory ignore files.
- * EXC_FILE lists patterns from fallback ignore files, e.g.
- * - .git/info/exclude
- * - core.excludesfile
- *
- * Each group contains multiple exclude lists, a single list
- * per source.
- */
+ struct dir_struct_internal {
+ /* Keeps track of allocation of `entries[]` array.*/
+ int alloc;
+
+ /* Keeps track of allocation of `ignored[]` array. */
+ int ignored_alloc;
+
+ /*
+ * We maintain three groups of exclude pattern lists:
+ *
+ * EXC_CMDL lists patterns explicitly given on the command line.
+ * EXC_DIRS lists patterns obtained from per-directory ignore
+ * files.
+ * EXC_FILE lists patterns from fallback ignore files, e.g.
+ * - .git/info/exclude
+ * - core.excludesfile
+ *
+ * Each group contains multiple exclude lists, a single list
+ * per source.
+ */
#define EXC_CMDL 0
#define EXC_DIRS 1
#define EXC_FILE 2
- struct exclude_list_group exclude_list_group[3];
-
- /*
- * Temporary variables which are used during loading of the
- * per-directory exclude lists.
- *
- * exclude_stack points to the top of the exclude_stack, and
- * basebuf contains the full path to the current
- * (sub)directory in the traversal. Exclude points to the
- * matching exclude struct if the directory is excluded.
- */
- struct exclude_stack *exclude_stack;
- struct path_pattern *pattern;
- struct strbuf basebuf;
-
- /* Enable untracked file cache if set */
- struct untracked_cache *untracked;
- struct oid_stat ss_info_exclude;
- struct oid_stat ss_excludes_file;
- unsigned unmanaged_exclude_files;
+ struct exclude_list_group exclude_list_group[3];
- /* Stats about the traversal */
- unsigned visited_paths;
- unsigned visited_directories;
+ /*
+ * Temporary variables which are used during loading of the
+ * per-directory exclude lists.
+ *
+ * exclude_stack points to the top of the exclude_stack, and
+ * basebuf contains the full path to the current
+ * (sub)directory in the traversal. Exclude points to the
+ * matching exclude struct if the directory is excluded.
+ */
+ struct exclude_stack *exclude_stack;
+ struct path_pattern *pattern;
+ struct strbuf basebuf;
+
+ /* Additional metadata related to 'untracked' */
+ struct oid_stat ss_info_exclude;
+ struct oid_stat ss_excludes_file;
+ unsigned unmanaged_exclude_files;
+
+ /* Stats about the traversal */
+ unsigned visited_paths;
+ unsigned visited_directories;
+ } internal;
};
#define DIR_INIT { 0 }
@@ -362,10 +374,6 @@ int count_slashes(const char *s);
int simple_length(const char *match);
int no_wildcard(const char *string);
char *common_prefix(const struct pathspec *pathspec);
-int match_pathspec(struct index_state *istate,
- const struct pathspec *pathspec,
- const char *name, int namelen,
- int prefix, char *seen, int is_dir);
int report_path_error(const char *ps_matched, const struct pathspec *pathspec);
int within_depth(const char *name, int namelen, int depth, int max_depth);
@@ -532,15 +540,6 @@ int submodule_path_match(struct index_state *istate,
const char *submodule_name,
char *seen);
-static inline int ce_path_match(struct index_state *istate,
- const struct cache_entry *ce,
- const struct pathspec *pathspec,
- char *seen)
-{
- return match_pathspec(istate, pathspec, ce->name, ce_namelen(ce), 0, seen,
- S_ISDIR(ce->ce_mode) || S_ISGITLINK(ce->ce_mode));
-}
-
static inline int dir_path_match(struct index_state *istate,
const struct dir_entry *ent,
const struct pathspec *pathspec,
@@ -641,4 +640,19 @@ static inline int starts_with_dot_dot_slash_native(const char *const path)
return path_match_flags(path, what | PATH_MATCH_NATIVE);
}
+
+#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)
+#define DTYPE(de) ((de)->d_type)
+#else
+#undef DT_UNKNOWN
+#undef DT_DIR
+#undef DT_REG
+#undef DT_LNK
+#define DT_UNKNOWN 0
+#define DT_DIR 1
+#define DT_REG 2
+#define DT_LNK 3
+#define DTYPE(de) DT_UNKNOWN
+#endif
+
#endif
diff --git a/editor.c b/editor.c
index 008c04fe2f..38c5dbbb79 100644
--- a/editor.c
+++ b/editor.c
@@ -1,9 +1,17 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "advice.h"
#include "config.h"
+#include "editor.h"
+#include "environment.h"
+#include "gettext.h"
+#include "pager.h"
+#include "path.h"
#include "strbuf.h"
#include "strvec.h"
#include "run-command.h"
#include "sigchain.h"
+#include "wrapper.h"
#ifndef DEFAULT_EDITOR
#define DEFAULT_EDITOR "vi"
@@ -126,3 +134,31 @@ int launch_sequence_editor(const char *path, struct strbuf *buffer,
{
return launch_specified_editor(git_sequence_editor(), path, buffer, env);
}
+
+int strbuf_edit_interactively(struct strbuf *buffer, const char *path,
+ const char *const *env)
+{
+ char *path2 = NULL;
+ int fd, res = 0;
+
+ if (!is_absolute_path(path))
+ path = path2 = xstrdup(git_path("%s", path));
+
+ fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ if (fd < 0)
+ res = error_errno(_("could not open '%s' for writing"), path);
+ else if (write_in_full(fd, buffer->buf, buffer->len) < 0) {
+ res = error_errno(_("could not write to '%s'"), path);
+ close(fd);
+ } else if (close(fd) < 0)
+ res = error_errno(_("could not close '%s'"), path);
+ else {
+ strbuf_reset(buffer);
+ if (launch_editor(path, buffer, env) < 0)
+ res = error_errno(_("could not edit '%s'"), path);
+ unlink(path);
+ }
+
+ free(path2);
+ return res;
+}
diff --git a/editor.h b/editor.h
new file mode 100644
index 0000000000..8016bb5e00
--- /dev/null
+++ b/editor.h
@@ -0,0 +1,34 @@
+#ifndef EDITOR_H
+#define EDITOR_H
+
+struct strbuf;
+
+const char *git_editor(void);
+const char *git_sequence_editor(void);
+int is_terminal_dumb(void);
+
+/**
+ * Launch the user preferred editor to edit a file and fill the buffer
+ * with the file's contents upon the user completing their editing. The
+ * third argument can be used to set the environment which the editor is
+ * run in. If the buffer is NULL the editor is launched as usual but the
+ * file's contents are not read into the buffer upon completion.
+ */
+int launch_editor(const char *path, struct strbuf *buffer,
+ const char *const *env);
+
+int launch_sequence_editor(const char *path, struct strbuf *buffer,
+ const char *const *env);
+
+/*
+ * In contrast to `launch_editor()`, this function writes out the contents
+ * of the specified file first, then clears the `buffer`, then launches
+ * the editor and reads back in the file contents into the `buffer`.
+ * Finally, it deletes the temporary file.
+ *
+ * If `path` is relative, it refers to a file in the `.git` directory.
+ */
+int strbuf_edit_interactively(struct strbuf *buffer, const char *path,
+ const char *const *env);
+
+#endif
diff --git a/entry.c b/entry.c
index 616e4f073c..91a540bd29 100644
--- a/entry.c
+++ b/entry.c
@@ -2,12 +2,17 @@
#include "blob.h"
#include "object-store.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "streaming.h"
#include "submodule.h"
+#include "symlinks.h"
#include "progress.h"
#include "fsmonitor.h"
#include "entry.h"
#include "parallel-checkout.h"
+#include "wrapper.h"
static void create_directories(const char *path, int path_len,
const struct checkout *state)
@@ -86,7 +91,8 @@ void *read_blob_entry(const struct cache_entry *ce, size_t *size)
{
enum object_type type;
unsigned long ul;
- void *blob_data = read_object_file(&ce->oid, &type, &ul);
+ void *blob_data = repo_read_object_file(the_repository, &ce->oid,
+ &type, &ul);
*size = ul;
if (blob_data) {
@@ -383,7 +389,7 @@ static int write_entry(struct cache_entry *ce, char *path, struct conv_attrs *ca
return error("cannot create submodule directory %s", path);
sub = submodule_from_ce(ce);
if (sub)
- return submodule_move_head(ce->name,
+ return submodule_move_head(ce->name, state->super_prefix,
NULL, oid_to_hex(&ce->oid),
state->force ? SUBMODULE_MOVE_HEAD_FORCE : 0);
break;
@@ -476,7 +482,7 @@ int checkout_entry_ca(struct cache_entry *ce, struct conv_attrs *ca,
* no pathname to return.
*/
BUG("Can't remove entry to a path");
- unlink_entry(ce);
+ unlink_entry(ce, state->super_prefix);
return 0;
}
@@ -510,10 +516,10 @@ int checkout_entry_ca(struct cache_entry *ce, struct conv_attrs *ca,
if (!(st.st_mode & S_IFDIR))
unlink_or_warn(ce->name);
- return submodule_move_head(ce->name,
+ return submodule_move_head(ce->name, state->super_prefix,
NULL, oid_to_hex(&ce->oid), 0);
} else
- return submodule_move_head(ce->name,
+ return submodule_move_head(ce->name, state->super_prefix,
"HEAD", oid_to_hex(&ce->oid),
state->force ? SUBMODULE_MOVE_HEAD_FORCE : 0);
}
@@ -560,12 +566,12 @@ int checkout_entry_ca(struct cache_entry *ce, struct conv_attrs *ca,
return write_entry(ce, path.buf, ca, state, 0, nr_checkouts);
}
-void unlink_entry(const struct cache_entry *ce)
+void unlink_entry(const struct cache_entry *ce, const char *super_prefix)
{
const struct submodule *sub = submodule_from_ce(ce);
if (sub) {
/* state.force is set at the caller. */
- submodule_move_head(ce->name, "HEAD", NULL,
+ submodule_move_head(ce->name, super_prefix, "HEAD", NULL,
SUBMODULE_MOVE_HEAD_FORCE);
}
if (check_leading_path(ce->name, ce_namelen(ce), 1) >= 0)
diff --git a/entry.h b/entry.h
index 9be4659881..7329f918a9 100644
--- a/entry.h
+++ b/entry.h
@@ -1,13 +1,16 @@
#ifndef ENTRY_H
#define ENTRY_H
-#include "cache.h"
#include "convert.h"
+struct cache_entry;
+struct index_state;
+
struct checkout {
struct index_state *istate;
const char *base_dir;
int base_dir_len;
+ const char *super_prefix;
struct delayed_checkout *delayed_checkout;
struct checkout_metadata meta;
unsigned force:1,
@@ -48,8 +51,11 @@ int finish_delayed_checkout(struct checkout *state, int show_progress);
/*
* Unlink the last component and schedule the leading directories for
* removal, such that empty directories get removed.
+ *
+ * The "super_prefix" is either NULL, or the "--super-prefix" passed
+ * down from "read-tree" et al.
*/
-void unlink_entry(const struct cache_entry *ce);
+void unlink_entry(const struct cache_entry *ce, const char *super_prefix);
void *read_blob_entry(const struct cache_entry *ce, size_t *size);
int fstat_checkout_output(int fd, const struct checkout *state, struct stat *st);
diff --git a/environment.c b/environment.c
index 18d042b467..28d18eaca8 100644
--- a/environment.c
+++ b/environment.c
@@ -7,19 +7,28 @@
* even if you might want to know where the git directory etc
* are.
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
#include "branch.h"
+#include "convert.h"
#include "environment.h"
+#include "gettext.h"
#include "repository.h"
#include "config.h"
#include "refs.h"
#include "fmt-merge-msg.h"
#include "commit.h"
#include "strvec.h"
+#include "object-file.h"
#include "object-store.h"
+#include "replace-object.h"
#include "tmp-objdir.h"
#include "chdir-notify.h"
+#include "setup.h"
#include "shallow.h"
+#include "trace.h"
+#include "wrapper.h"
+#include "write-or-die.h"
int trust_executable_bit = 1;
int trust_ctime = 1;
@@ -50,7 +59,6 @@ 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;
-int pager_use_color = 1;
const char *editor_program;
const char *askpass_program;
const char *excludes_file;
@@ -59,7 +67,6 @@ int read_replace_refs = 1;
enum eol core_eol = EOL_UNSET;
int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
char *check_roundtrip_encoding = "SHIFT-JIS";
-unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
@@ -102,8 +109,6 @@ char *git_work_tree_cfg;
static char *git_namespace;
-static char *super_prefix;
-
/*
* Repository-local GIT_* environment variables; see cache.h for details.
*/
@@ -121,7 +126,6 @@ const char * const local_repo_env[] = {
NO_REPLACE_OBJECTS_ENVIRONMENT,
GIT_REPLACE_REF_BASE_ENVIRONMENT,
GIT_PREFIX_ENVIRONMENT,
- GIT_SUPER_PREFIX_ENVIRONMENT,
GIT_SHALLOW_FILE_ENVIRONMENT,
GIT_COMMON_DIR_ENVIRONMENT,
NULL
@@ -234,16 +238,6 @@ const char *strip_namespace(const char *namespaced_ref)
return NULL;
}
-const char *get_super_prefix(void)
-{
- static int initialized;
- if (!initialized) {
- super_prefix = xstrdup_or_null(getenv(GIT_SUPER_PREFIX_ENVIRONMENT));
- initialized = 1;
- }
- return super_prefix;
-}
-
static int git_work_tree_initialized;
/*
diff --git a/environment.h b/environment.h
index d438b5c8f3..a63f0c6a24 100644
--- a/environment.h
+++ b/environment.h
@@ -3,10 +3,230 @@
#include "strvec.h"
+struct repository;
+
+/*
+ * The character that begins a commented line in user-editable file
+ * that is subject to stripspace.
+ */
+extern char comment_line_char;
+extern int auto_comment_line_char;
+
/*
* Wrapper of getenv() that returns a strdup value. This value is kept
* in argv to be freed later.
*/
const char *getenv_safe(struct strvec *argv, const char *name);
+/* Double-check local_repo_env below if you add to this list. */
+#define GIT_DIR_ENVIRONMENT "GIT_DIR"
+#define GIT_COMMON_DIR_ENVIRONMENT "GIT_COMMON_DIR"
+#define GIT_NAMESPACE_ENVIRONMENT "GIT_NAMESPACE"
+#define GIT_WORK_TREE_ENVIRONMENT "GIT_WORK_TREE"
+#define GIT_PREFIX_ENVIRONMENT "GIT_PREFIX"
+#define DEFAULT_GIT_DIR_ENVIRONMENT ".git"
+#define DB_ENVIRONMENT "GIT_OBJECT_DIRECTORY"
+#define INDEX_ENVIRONMENT "GIT_INDEX_FILE"
+#define GRAFT_ENVIRONMENT "GIT_GRAFT_FILE"
+#define GIT_SHALLOW_FILE_ENVIRONMENT "GIT_SHALLOW_FILE"
+#define TEMPLATE_DIR_ENVIRONMENT "GIT_TEMPLATE_DIR"
+#define CONFIG_ENVIRONMENT "GIT_CONFIG"
+#define CONFIG_DATA_ENVIRONMENT "GIT_CONFIG_PARAMETERS"
+#define CONFIG_COUNT_ENVIRONMENT "GIT_CONFIG_COUNT"
+#define EXEC_PATH_ENVIRONMENT "GIT_EXEC_PATH"
+#define CEILING_DIRECTORIES_ENVIRONMENT "GIT_CEILING_DIRECTORIES"
+#define NO_REPLACE_OBJECTS_ENVIRONMENT "GIT_NO_REPLACE_OBJECTS"
+#define GIT_REPLACE_REF_BASE_ENVIRONMENT "GIT_REPLACE_REF_BASE"
+#define GITATTRIBUTES_FILE ".gitattributes"
+#define INFOATTRIBUTES_FILE "info/attributes"
+#define ATTRIBUTE_MACRO_PREFIX "[attr]"
+#define GITMODULES_FILE ".gitmodules"
+#define GITMODULES_INDEX ":.gitmodules"
+#define GITMODULES_HEAD "HEAD:.gitmodules"
+#define GIT_NOTES_REF_ENVIRONMENT "GIT_NOTES_REF"
+#define GIT_NOTES_DEFAULT_REF "refs/notes/commits"
+#define GIT_NOTES_DISPLAY_REF_ENVIRONMENT "GIT_NOTES_DISPLAY_REF"
+#define GIT_NOTES_REWRITE_REF_ENVIRONMENT "GIT_NOTES_REWRITE_REF"
+#define GIT_NOTES_REWRITE_MODE_ENVIRONMENT "GIT_NOTES_REWRITE_MODE"
+#define GIT_LITERAL_PATHSPECS_ENVIRONMENT "GIT_LITERAL_PATHSPECS"
+#define GIT_GLOB_PATHSPECS_ENVIRONMENT "GIT_GLOB_PATHSPECS"
+#define GIT_NOGLOB_PATHSPECS_ENVIRONMENT "GIT_NOGLOB_PATHSPECS"
+#define GIT_ICASE_PATHSPECS_ENVIRONMENT "GIT_ICASE_PATHSPECS"
+#define GIT_QUARANTINE_ENVIRONMENT "GIT_QUARANTINE_PATH"
+#define GIT_OPTIONAL_LOCKS_ENVIRONMENT "GIT_OPTIONAL_LOCKS"
+#define GIT_TEXT_DOMAIN_DIR_ENVIRONMENT "GIT_TEXTDOMAINDIR"
+
+/*
+ * Environment variable used in handshaking the wire protocol.
+ * Contains a colon ':' separated list of keys with optional values
+ * 'key[=value]'. Presence of unknown keys and values must be
+ * ignored.
+ */
+#define GIT_PROTOCOL_ENVIRONMENT "GIT_PROTOCOL"
+/* HTTP header used to handshake the wire protocol */
+#define GIT_PROTOCOL_HEADER "Git-Protocol"
+
+/*
+ * This environment variable is expected to contain a boolean indicating
+ * whether we should or should not treat:
+ *
+ * GIT_DIR=foo.git git ...
+ *
+ * as if GIT_WORK_TREE=. was given. It's not expected that users will make use
+ * of this, but we use it internally to communicate to sub-processes that we
+ * are in a bare repo. If not set, defaults to true.
+ */
+#define GIT_IMPLICIT_WORK_TREE_ENVIRONMENT "GIT_IMPLICIT_WORK_TREE"
+
+/*
+ * Repository-local GIT_* environment variables; these will be cleared
+ * when git spawns a sub-process that runs inside another repository.
+ * The array is NULL-terminated, which makes it easy to pass in the "env"
+ * parameter of a run-command invocation, or to do a simple walk.
+ */
+extern const char * const local_repo_env[];
+
+void setup_git_env(const char *git_dir);
+
+/*
+ * Returns true iff we have a configured git repository (either via
+ * setup_git_directory, or in the environment via $GIT_DIR).
+ */
+int have_git_dir(void);
+
+extern int is_bare_repository_cfg;
+int is_bare_repository(void);
+extern char *git_work_tree_cfg;
+const char *get_git_dir(void);
+const char *get_git_common_dir(void);
+const char *get_object_directory(void);
+char *get_index_file(void);
+char *get_graft_file(struct repository *r);
+void set_git_dir(const char *path, int make_realpath);
+const char *get_git_namespace(void);
+const char *strip_namespace(const char *namespaced_ref);
+const char *get_git_work_tree(void);
+void set_git_work_tree(const char *tree);
+
+#define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"
+
+/* Environment bits from configuration mechanism */
+extern int trust_executable_bit;
+extern int trust_ctime;
+extern int check_stat;
+extern int has_symlinks;
+extern int minimum_abbrev, default_abbrev;
+extern int ignore_case;
+extern int assume_unchanged;
+extern int prefer_symlink_refs;
+extern int warn_ambiguous_refs;
+extern int warn_on_object_refname_ambiguity;
+extern char *apply_default_whitespace;
+extern char *apply_default_ignorewhitespace;
+extern const char *git_attributes_file;
+extern const char *git_hooks_path;
+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;
+
+/*
+ * Accessors for the core.sharedrepository config which lazy-load the value
+ * from the config (if not already set). The "reset" function can be
+ * used to unset "set" or cached value, meaning that the value will be loaded
+ * fresh from the config file on the next call to get_shared_repository().
+ */
+void set_shared_repository(int value);
+int get_shared_repository(void);
+void reset_shared_repository(void);
+
+extern int core_preload_index;
+extern int precomposed_unicode;
+extern int protect_hfs;
+extern int protect_ntfs;
+
+extern int core_apply_sparse_checkout;
+extern int core_sparse_checkout_cone;
+extern int sparse_expect_files_outside_of_patterns;
+
+/*
+ * Returns the boolean value of $GIT_OPTIONAL_LOCKS (or the default value).
+ */
+int use_optional_locks(void);
+
+enum log_refs_config {
+ LOG_REFS_UNSET = -1,
+ LOG_REFS_NONE = 0,
+ LOG_REFS_NORMAL,
+ LOG_REFS_ALWAYS
+};
+extern enum log_refs_config log_all_ref_updates;
+
+enum rebase_setup_type {
+ AUTOREBASE_NEVER = 0,
+ AUTOREBASE_LOCAL,
+ AUTOREBASE_REMOTE,
+ AUTOREBASE_ALWAYS
+};
+
+enum push_default_type {
+ PUSH_DEFAULT_NOTHING = 0,
+ PUSH_DEFAULT_MATCHING,
+ PUSH_DEFAULT_SIMPLE,
+ PUSH_DEFAULT_UPSTREAM,
+ PUSH_DEFAULT_CURRENT,
+ PUSH_DEFAULT_UNSPECIFIED
+};
+
+extern enum rebase_setup_type autorebase;
+extern enum push_default_type push_default;
+
+enum object_creation_mode {
+ OBJECT_CREATION_USES_HARDLINKS = 0,
+ OBJECT_CREATION_USES_RENAMES = 1
+};
+
+extern enum object_creation_mode object_creation_mode;
+
+extern char *notes_ref_name;
+
+extern int grafts_replace_parents;
+
+extern int repository_format_precious_objects;
+extern int repository_format_worktree_config;
+
+/*
+ * Create a temporary file rooted in the object database directory, or
+ * die on failure. The filename is taken from "pattern", which should have the
+ * usual "XXXXXX" trailer, and the resulting filename is written into the
+ * "template" buffer. Returns the open descriptor.
+ */
+int odb_mkstemp(struct strbuf *temp_filename, const char *pattern);
+
+/*
+ * Create a pack .keep file named "name" (which should generally be the output
+ * of odb_pack_name). Returns a file descriptor opened for writing, or -1 on
+ * error.
+ */
+int odb_pack_keep(const char *name);
+
+const char *get_log_output_encoding(void);
+const char *get_commit_output_encoding(void);
+
+extern const char *git_commit_encoding;
+extern const char *git_log_output_encoding;
+
+extern const char *editor_program;
+extern const char *askpass_program;
+extern const char *excludes_file;
+
+/*
+ * Should we print an ellipsis after an abbreviated SHA-1 value
+ * when doing diff-raw output or indicating a detached HEAD?
+ */
+int print_sha1_ellipsis(void);
+
#endif
diff --git a/ewah/bitmap.c b/ewah/bitmap.c
index ac61864163..12d6aa398e 100644
--- a/ewah/bitmap.c
+++ b/ewah/bitmap.c
@@ -16,7 +16,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "ewok.h"
#define EWAH_MASK(x) ((eword_t)1 << (x % BITS_IN_EWORD))
diff --git a/ewah/ewah_bitmap.c b/ewah/ewah_bitmap.c
index 6fe48d3ae0..c6d4ffc87c 100644
--- a/ewah/ewah_bitmap.c
+++ b/ewah/ewah_bitmap.c
@@ -17,9 +17,9 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "git-compat-util.h"
+#include "alloc.h"
#include "ewok.h"
#include "ewok_rlw.h"
-#include "cache.h"
static inline size_t min_size(size_t a, size_t b)
{
diff --git a/exec-cmd.c b/exec-cmd.c
index eeb2ee52b8..1e34e48c0e 100644
--- a/exec-cmd.c
+++ b/exec-cmd.c
@@ -1,7 +1,13 @@
#include "cache.h"
+#include "abspath.h"
+#include "environment.h"
#include "exec-cmd.h"
+#include "gettext.h"
+#include "path.h"
#include "quote.h"
#include "strvec.h"
+#include "trace.h"
+#include "trace2.h"
#if defined(RUNTIME_PREFIX)
@@ -252,7 +258,7 @@ static const char *system_prefix(void)
* This is called during initialization, but No work needs to be done here when
* runtime prefix is not being used.
*/
-void git_resolve_executable_dir(const char *argv0)
+void git_resolve_executable_dir(const char *argv0 UNUSED)
{
}
diff --git a/fetch-pack.c b/fetch-pack.c
index 998fc2fa1e..0f71054fba 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1,6 +1,11 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "repository.h"
#include "config.h"
+#include "date.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "refs.h"
#include "pkt-line.h"
@@ -13,6 +18,7 @@
#include "remote.h"
#include "run-command.h"
#include "connect.h"
+#include "trace2.h"
#include "transport.h"
#include "version.h"
#include "oid-array.h"
@@ -27,6 +33,7 @@
#include "commit-graph.h"
#include "sigchain.h"
#include "mergesort.h"
+#include "wrapper.h"
static int transfer_unpack_limit = -1;
static int fetch_unpack_limit = -1;
@@ -722,7 +729,7 @@ static void filter_refs(struct fetch_pack_args *args,
*refs = newlist;
}
-static void mark_alternate_complete(struct fetch_negotiator *unused,
+static void mark_alternate_complete(struct fetch_negotiator *negotiator UNUSED,
struct object *obj)
{
mark_complete(&obj->oid);
@@ -762,9 +769,9 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator,
if (!commit) {
struct object *o;
- if (!has_object_file_with_flags(&ref->old_oid,
- OBJECT_INFO_QUICK |
- OBJECT_INFO_SKIP_FETCH_OBJECT))
+ if (!repo_has_object_file_with_flags(the_repository, &ref->old_oid,
+ OBJECT_INFO_QUICK |
+ OBJECT_INFO_SKIP_FETCH_OBJECT))
continue;
o = parse_object(the_repository, &ref->old_oid);
if (!o || o->type != OBJ_COMMIT)
@@ -1094,7 +1101,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
struct ref *ref = copy_ref_list(orig_ref);
struct object_id oid;
const char *agent_feature;
- int agent_len;
+ size_t agent_len;
struct fetch_negotiator negotiator_alloc;
struct fetch_negotiator *negotiator;
@@ -1112,7 +1119,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
agent_supported = 1;
if (agent_len)
print_verbose(args, _("Server version is %.*s"),
- agent_len, agent_feature);
+ (int)agent_len, agent_feature);
}
if (!server_supports("session-id"))
@@ -1317,15 +1324,15 @@ static void write_fetch_command_and_capabilities(struct strbuf *req_buf,
{
const char *hash_name;
- if (server_supports_v2("fetch", 1))
- packet_buf_write(req_buf, "command=fetch");
- if (server_supports_v2("agent", 0))
+ ensure_server_supports_v2("fetch");
+ packet_buf_write(req_buf, "command=fetch");
+ if (server_supports_v2("agent"))
packet_buf_write(req_buf, "agent=%s", git_user_agent_sanitized());
- if (advertise_sid && server_supports_v2("session-id", 0))
+ if (advertise_sid && server_supports_v2("session-id"))
packet_buf_write(req_buf, "session-id=%s", trace2_session_id());
- if (server_options && server_options->nr &&
- server_supports_v2("server-option", 1)) {
+ if (server_options && server_options->nr) {
int i;
+ ensure_server_supports_v2("server-option");
for (i = 0; i < server_options->nr; i++)
packet_buf_write(req_buf, "server-option=%s",
server_options->items[i].string);
@@ -1963,7 +1970,7 @@ static void update_shallow(struct fetch_pack_args *args,
struct oid_array extra = OID_ARRAY_INIT;
struct object_id *oid = si->shallow->oid;
for (i = 0; i < si->shallow->nr; i++)
- if (has_object_file(&oid[i]))
+ if (repo_has_object_file(the_repository, &oid[i]))
oid_array_append(&extra, &oid[i]);
if (extra.nr) {
setup_alternate_shallow(&shallow_lock,
diff --git a/fmt-merge-msg.c b/fmt-merge-msg.c
index f48f44f9cd..5af0d4715b 100644
--- a/fmt-merge-msg.c
+++ b/fmt-merge-msg.c
@@ -1,8 +1,13 @@
+#include "git-compat-util.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
#include "refs.h"
+#include "object-name.h"
#include "object-store.h"
#include "diff.h"
#include "diff-merges.h"
+#include "hex.h"
#include "revision.h"
#include "tag.h"
#include "string-list.h"
@@ -17,8 +22,6 @@ static struct string_list suppress_dest_patterns = STRING_LIST_INIT_DUP;
int fmt_merge_msg_config(const char *key, const char *value, void *cb)
{
- int status = 0;
-
if (!strcmp(key, "merge.log") || !strcmp(key, "merge.summary")) {
int is_bool;
merge_log_config = git_config_bool_or_int(key, value, &is_bool);
@@ -37,9 +40,6 @@ int fmt_merge_msg_config(const char *key, const char *value, void *cb)
string_list_append(&suppress_dest_patterns, value);
suppress_dest_pattern_seen = 1;
} else {
- status = git_gpg_config(key, value, NULL);
- if (status)
- return status;
return git_default_config(key, value, cb);
}
return 0;
@@ -271,9 +271,10 @@ static void record_person_from_buf(int which, struct string_list *people,
static void record_person(int which, struct string_list *people,
struct commit *commit)
{
- const char *buffer = get_commit_buffer(commit, NULL);
+ const char *buffer = repo_get_commit_buffer(the_repository, commit,
+ NULL);
record_person_from_buf(which, people, buffer);
- unuse_commit_buffer(commit, buffer);
+ repo_unuse_commit_buffer(the_repository, commit, buffer);
}
static int cmp_string_list_util_as_integral(const void *a_, const void *b_)
@@ -384,7 +385,8 @@ static void shortlog(const char *name,
if (subjects.nr > limit)
continue;
- format_commit_message(commit, "%s", &sb, &ctx);
+ repo_format_commit_message(the_repository, commit, "%s", &sb,
+ &ctx);
strbuf_ltrim(&sb);
if (!sb.len)
@@ -519,7 +521,8 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
struct object_id *oid = origins.items[i].util;
enum object_type type;
unsigned long size;
- char *buf = read_object_file(oid, &type, &size);
+ char *buf = repo_read_object_file(the_repository, oid, &type,
+ &size);
char *origbuf = buf;
unsigned long len = size;
struct signature_check sigc = { NULL };
@@ -605,7 +608,9 @@ static void find_merge_parents(struct merge_parents *result,
* util field yet.
*/
obj = parse_object(the_repository, &oid);
- parent = (struct commit *)peel_to_type(NULL, 0, obj, OBJ_COMMIT);
+ parent = (struct commit *)repo_peel_to_type(the_repository,
+ NULL, 0, obj,
+ OBJ_COMMIT);
if (!parent)
continue;
commit_list_insert(parent, &parents);
diff --git a/fsck.c b/fsck.c
index 47eaeedd70..3261ef9ec2 100644
--- a/fsck.c
+++ b/fsck.c
@@ -1,4 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
+#include "date.h"
+#include "hex.h"
#include "object-store.h"
#include "repository.h"
#include "object.h"
@@ -353,7 +356,7 @@ static int fsck_walk_commit(struct commit *commit, void *data, struct fsck_optio
int result;
const char *name;
- if (parse_commit(commit))
+ if (repo_parse_commit(the_repository, commit))
return -1;
name = fsck_get_object_name(options, &commit->object.oid);
@@ -361,7 +364,7 @@ static int fsck_walk_commit(struct commit *commit, void *data, struct fsck_optio
fsck_put_object_name(options, get_commit_tree_oid(commit),
"%s:", name);
- result = options->walk((struct object *)get_commit_tree(commit),
+ result = options->walk((struct object *) repo_get_commit_tree(the_repository, commit),
OBJ_TREE, data, options);
if (result < 0)
return result;
@@ -748,6 +751,23 @@ static int fsck_tree(const struct object_id *tree_oid,
return retval;
}
+/*
+ * Confirm that the headers of a commit or tag object end in a reasonable way,
+ * either with the usual "\n\n" separator, or at least with a trailing newline
+ * on the final header line.
+ *
+ * This property is important for the memory safety of our callers. It allows
+ * them to scan the buffer linewise without constantly checking the remaining
+ * size as long as:
+ *
+ * - they check that there are bytes left in the buffer at the start of any
+ * line (i.e., that the last newline they saw was not the final one we
+ * found here)
+ *
+ * - any intra-line scanning they do will stop at a newline, which will worst
+ * case hit the newline we found here as the end-of-header. This makes it
+ * OK for them to use helpers like parse_oid_hex(), or even skip_prefix().
+ */
static int verify_headers(const void *data, unsigned long size,
const struct object_id *oid, enum object_type type,
struct fsck_options *options)
@@ -808,6 +828,20 @@ static int fsck_ident(const char **ident,
if (*p != ' ')
return report(options, oid, type, FSCK_MSG_MISSING_SPACE_BEFORE_DATE, "invalid author/committer line - missing space before date");
p++;
+ /*
+ * Our timestamp parser is based on the C strto*() functions, which
+ * will happily eat whitespace, including the newline that is supposed
+ * to prevent us walking past the end of the buffer. So do our own
+ * scan, skipping linear whitespace but not newlines, and then
+ * confirming we found a digit. We _could_ be even more strict here,
+ * as we really expect only a single space, but since we have
+ * traditionally allowed extra whitespace, we'll continue to do so.
+ */
+ while (*p == ' ' || *p == '\t')
+ p++;
+ if (!isdigit(*p))
+ return report(options, oid, type, FSCK_MSG_BAD_DATE,
+ "invalid author/committer line - bad date");
if (*p == '0' && p[1] != ' ')
return report(options, oid, type, FSCK_MSG_ZERO_PADDED_DATE, "invalid author/committer line - zero-padded date");
if (date_overflows(parse_timestamp(p, &end, 10)))
@@ -834,12 +868,18 @@ static int fsck_commit(const struct object_id *oid,
unsigned author_count;
int err;
const char *buffer_begin = buffer;
+ const char *buffer_end = buffer + size;
const char *p;
+ /*
+ * We _must_ stop parsing immediately if this reports failure, as the
+ * memory safety of the rest of the function depends on it. See the
+ * comment above the definition of verify_headers() for more details.
+ */
if (verify_headers(buffer, size, oid, OBJ_COMMIT, options))
return -1;
- if (!skip_prefix(buffer, "tree ", &buffer))
+ if (buffer >= buffer_end || !skip_prefix(buffer, "tree ", &buffer))
return report(options, oid, OBJ_COMMIT, FSCK_MSG_MISSING_TREE, "invalid format - expected 'tree' line");
if (parse_oid_hex(buffer, &tree_oid, &p) || *p != '\n') {
err = report(options, oid, OBJ_COMMIT, FSCK_MSG_BAD_TREE_SHA1, "invalid 'tree' line format - bad sha1");
@@ -847,7 +887,7 @@ static int fsck_commit(const struct object_id *oid,
return err;
}
buffer = p + 1;
- while (skip_prefix(buffer, "parent ", &buffer)) {
+ while (buffer < buffer_end && skip_prefix(buffer, "parent ", &buffer)) {
if (parse_oid_hex(buffer, &parent_oid, &p) || *p != '\n') {
err = report(options, oid, OBJ_COMMIT, FSCK_MSG_BAD_PARENT_SHA1, "invalid 'parent' line format - bad sha1");
if (err)
@@ -856,7 +896,7 @@ static int fsck_commit(const struct object_id *oid,
buffer = p + 1;
}
author_count = 0;
- while (skip_prefix(buffer, "author ", &buffer)) {
+ while (buffer < buffer_end && skip_prefix(buffer, "author ", &buffer)) {
author_count++;
err = fsck_ident(&buffer, oid, OBJ_COMMIT, options);
if (err)
@@ -868,7 +908,7 @@ static int fsck_commit(const struct object_id *oid,
err = report(options, oid, OBJ_COMMIT, FSCK_MSG_MULTIPLE_AUTHORS, "invalid format - multiple 'author' lines");
if (err)
return err;
- if (!skip_prefix(buffer, "committer ", &buffer))
+ if (buffer >= buffer_end || !skip_prefix(buffer, "committer ", &buffer))
return report(options, oid, OBJ_COMMIT, FSCK_MSG_MISSING_COMMITTER, "invalid format - expected 'committer' line");
err = fsck_ident(&buffer, oid, OBJ_COMMIT, options);
if (err)
@@ -899,13 +939,19 @@ int fsck_tag_standalone(const struct object_id *oid, const char *buffer,
int ret = 0;
char *eol;
struct strbuf sb = STRBUF_INIT;
+ const char *buffer_end = buffer + size;
const char *p;
+ /*
+ * We _must_ stop parsing immediately if this reports failure, as the
+ * memory safety of the rest of the function depends on it. See the
+ * comment above the definition of verify_headers() for more details.
+ */
ret = verify_headers(buffer, size, oid, OBJ_TAG, options);
if (ret)
goto done;
- if (!skip_prefix(buffer, "object ", &buffer)) {
+ if (buffer >= buffer_end || !skip_prefix(buffer, "object ", &buffer)) {
ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_OBJECT, "invalid format - expected 'object' line");
goto done;
}
@@ -916,11 +962,11 @@ int fsck_tag_standalone(const struct object_id *oid, const char *buffer,
}
buffer = p + 1;
- if (!skip_prefix(buffer, "type ", &buffer)) {
+ if (buffer >= buffer_end || !skip_prefix(buffer, "type ", &buffer)) {
ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_TYPE_ENTRY, "invalid format - expected 'type' line");
goto done;
}
- eol = strchr(buffer, '\n');
+ eol = memchr(buffer, '\n', buffer_end - buffer);
if (!eol) {
ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_TYPE, "invalid format - unexpected end after 'type' line");
goto done;
@@ -932,11 +978,11 @@ int fsck_tag_standalone(const struct object_id *oid, const char *buffer,
goto done;
buffer = eol + 1;
- if (!skip_prefix(buffer, "tag ", &buffer)) {
+ if (buffer >= buffer_end || !skip_prefix(buffer, "tag ", &buffer)) {
ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_TAG_ENTRY, "invalid format - expected 'tag' line");
goto done;
}
- eol = strchr(buffer, '\n');
+ eol = memchr(buffer, '\n', buffer_end - buffer);
if (!eol) {
ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_TAG, "invalid format - unexpected end after 'type' line");
goto done;
@@ -952,7 +998,7 @@ int fsck_tag_standalone(const struct object_id *oid, const char *buffer,
}
buffer = eol + 1;
- if (!skip_prefix(buffer, "tagger ", &buffer)) {
+ if (buffer >= buffer_end || !skip_prefix(buffer, "tagger ", &buffer)) {
/* early tags do not contain 'tagger' lines; warn only */
ret = report(options, oid, OBJ_TAG, FSCK_MSG_MISSING_TAGGER_ENTRY, "invalid format - expected 'tagger' line");
if (ret)
@@ -960,10 +1006,8 @@ int fsck_tag_standalone(const struct object_id *oid, const char *buffer,
}
else
ret = fsck_ident(&buffer, oid, OBJ_TAG, options);
- if (!*buffer)
- goto done;
- if (!starts_with(buffer, "\n")) {
+ if (buffer < buffer_end && !starts_with(buffer, "\n")) {
/*
* The verify_headers() check will allow
* e.g. "[...]tagger <tagger>\nsome
@@ -1237,19 +1281,26 @@ int fsck_object(struct object *obj, void *data, unsigned long size,
if (!obj)
return report(options, NULL, OBJ_NONE, FSCK_MSG_BAD_OBJECT_SHA1, "no valid object to fsck");
- if (obj->type == OBJ_BLOB)
- return fsck_blob(&obj->oid, data, size, options);
- if (obj->type == OBJ_TREE)
- return fsck_tree(&obj->oid, data, size, options);
- if (obj->type == OBJ_COMMIT)
- return fsck_commit(&obj->oid, data, size, options);
- if (obj->type == OBJ_TAG)
- return fsck_tag(&obj->oid, data, size, options);
+ return fsck_buffer(&obj->oid, obj->type, data, size, options);
+}
+
+int fsck_buffer(const struct object_id *oid, enum object_type type,
+ void *data, unsigned long size,
+ struct fsck_options *options)
+{
+ if (type == OBJ_BLOB)
+ return fsck_blob(oid, data, size, options);
+ if (type == OBJ_TREE)
+ return fsck_tree(oid, data, size, options);
+ if (type == OBJ_COMMIT)
+ return fsck_commit(oid, data, size, options);
+ if (type == OBJ_TAG)
+ return fsck_tag(oid, data, size, options);
- return report(options, &obj->oid, obj->type,
+ return report(options, oid, type,
FSCK_MSG_UNKNOWN_TYPE,
"unknown type '%d' (internal fsck error)",
- obj->type);
+ type);
}
int fsck_error_function(struct fsck_options *o,
@@ -1284,7 +1335,7 @@ static int fsck_blobs(struct oidset *blobs_found, struct oidset *blobs_done,
if (oidset_contains(blobs_done, oid))
continue;
- buf = read_object_file(oid, &type, &size);
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
if (!buf) {
if (is_promisor_object(oid))
continue;
diff --git a/fsck.h b/fsck.h
index 121b831985..e17730e9da 100644
--- a/fsck.h
+++ b/fsck.h
@@ -1,6 +1,7 @@
#ifndef GIT_FSCK_H
#define GIT_FSCK_H
+#include "object.h"
#include "oidset.h"
enum fsck_msg_type {
@@ -13,6 +14,12 @@ enum fsck_msg_type {
FSCK_WARN,
};
+/*
+ * Documentation/fsck-msgids.txt documents these; when
+ * modifying this list in any way, make sure to keep the
+ * two in sync.
+ */
+
#define FOREACH_FSCK_MSG_ID(FUNC) \
/* fatal errors */ \
FUNC(NUL_IN_HEADER, FATAL) \
@@ -24,7 +31,6 @@ enum fsck_msg_type {
FUNC(BAD_NAME, ERROR) \
FUNC(BAD_OBJECT_SHA1, ERROR) \
FUNC(BAD_PARENT_SHA1, ERROR) \
- FUNC(BAD_TAG_OBJECT, ERROR) \
FUNC(BAD_TIMEZONE, ERROR) \
FUNC(BAD_TREE, ERROR) \
FUNC(BAD_TREE_SHA1, ERROR) \
@@ -40,7 +46,6 @@ enum fsck_msg_type {
FUNC(MISSING_TAG, ERROR) \
FUNC(MISSING_TAG_ENTRY, ERROR) \
FUNC(MISSING_TREE, ERROR) \
- FUNC(MISSING_TREE_OBJECT, ERROR) \
FUNC(MISSING_TYPE, ERROR) \
FUNC(MISSING_TYPE_ENTRY, ERROR) \
FUNC(MULTIPLE_AUTHORS, ERROR) \
@@ -180,6 +185,14 @@ int fsck_object(struct object *obj, void *data, unsigned long size,
struct fsck_options *options);
/*
+ * Same as fsck_object(), but for when the caller doesn't have an object
+ * struct.
+ */
+int fsck_buffer(const struct object_id *oid, enum object_type,
+ void *data, unsigned long size,
+ struct fsck_options *options);
+
+/*
* fsck a tag, and pass info about it back to the caller. This is
* exposed fsck_object() internals for git-mktag(1).
*/
diff --git a/fsmonitor--daemon.h b/fsmonitor--daemon.h
index 2102a5c9ff..70d776c54f 100644
--- a/fsmonitor--daemon.h
+++ b/fsmonitor--daemon.h
@@ -3,11 +3,11 @@
#ifdef HAVE_FSMONITOR_DAEMON_BACKEND
-#include "cache.h"
#include "dir.h"
#include "run-command.h"
#include "simple-ipc.h"
#include "thread-utils.h"
+#include "fsmonitor-path-utils.h"
struct fsmonitor_batch;
struct fsmonitor_token_data;
@@ -43,6 +43,7 @@ struct fsmonitor_daemon_state {
struct strbuf path_worktree_watch;
struct strbuf path_gitdir_watch;
+ struct alias_info alias;
int nr_paths_watching;
struct fsmonitor_token_data *current_token_data;
@@ -59,6 +60,7 @@ struct fsmonitor_daemon_state {
struct ipc_server_data *ipc_server_data;
struct strbuf path_ipc;
+
};
/*
diff --git a/fsmonitor-ipc.c b/fsmonitor-ipc.c
index 789e7397ba..6a6a89764a 100644
--- a/fsmonitor-ipc.c
+++ b/fsmonitor-ipc.c
@@ -1,7 +1,9 @@
#include "cache.h"
#include "fsmonitor.h"
+#include "gettext.h"
#include "simple-ipc.h"
#include "fsmonitor-ipc.h"
+#include "repository.h"
#include "run-command.h"
#include "strbuf.h"
#include "trace2.h"
@@ -18,7 +20,7 @@ int fsmonitor_ipc__is_supported(void)
return 0;
}
-const char *fsmonitor_ipc__get_path(void)
+const char *fsmonitor_ipc__get_path(struct repository *r)
{
return NULL;
}
@@ -47,19 +49,21 @@ int fsmonitor_ipc__is_supported(void)
return 1;
}
-GIT_PATH_FUNC(fsmonitor_ipc__get_path, "fsmonitor--daemon.ipc")
-
enum ipc_active_state fsmonitor_ipc__get_state(void)
{
- return ipc_get_active_state(fsmonitor_ipc__get_path());
+ return ipc_get_active_state(fsmonitor_ipc__get_path(the_repository));
}
static int spawn_daemon(void)
{
- const char *args[] = { "fsmonitor--daemon", "start", NULL };
+ struct child_process cmd = CHILD_PROCESS_INIT;
+
+ cmd.git_cmd = 1;
+ cmd.no_stdin = 1;
+ cmd.trace2_child_class = "fsmonitor";
+ strvec_pushl(&cmd.args, "fsmonitor--daemon", "start", NULL);
- return run_command_v_opt_tr2(args, RUN_COMMAND_NO_STDIN | RUN_GIT_CMD,
- "fsmonitor");
+ return run_command(&cmd);
}
int fsmonitor_ipc__send_query(const char *since_token,
@@ -81,8 +85,8 @@ int fsmonitor_ipc__send_query(const char *since_token,
trace2_data_string("fsm_client", NULL, "query/command", tok);
try_again:
- state = ipc_client_try_connect(fsmonitor_ipc__get_path(), &options,
- &connection);
+ state = ipc_client_try_connect(fsmonitor_ipc__get_path(the_repository),
+ &options, &connection);
switch (state) {
case IPC_STATE__LISTENING:
@@ -117,13 +121,13 @@ try_again:
case IPC_STATE__INVALID_PATH:
ret = error(_("fsmonitor_ipc__send_query: invalid path '%s'"),
- fsmonitor_ipc__get_path());
+ fsmonitor_ipc__get_path(the_repository));
goto done;
case IPC_STATE__OTHER_ERROR:
default:
ret = error(_("fsmonitor_ipc__send_query: unspecified error on '%s'"),
- fsmonitor_ipc__get_path());
+ fsmonitor_ipc__get_path(the_repository));
goto done;
}
@@ -149,8 +153,8 @@ int fsmonitor_ipc__send_command(const char *command,
options.wait_if_busy = 1;
options.wait_if_not_found = 0;
- state = ipc_client_try_connect(fsmonitor_ipc__get_path(), &options,
- &connection);
+ state = ipc_client_try_connect(fsmonitor_ipc__get_path(the_repository),
+ &options, &connection);
if (state != IPC_STATE__LISTENING) {
die(_("fsmonitor--daemon is not running"));
return -1;
diff --git a/fsmonitor-ipc.h b/fsmonitor-ipc.h
index b6a7067c3a..8b489da762 100644
--- a/fsmonitor-ipc.h
+++ b/fsmonitor-ipc.h
@@ -3,6 +3,8 @@
#include "simple-ipc.h"
+struct repository;
+
/*
* Returns true if built-in file system monitor daemon is defined
* for this platform.
@@ -16,7 +18,7 @@ int fsmonitor_ipc__is_supported(void);
*
* Returns NULL if the daemon is not supported on this platform.
*/
-const char *fsmonitor_ipc__get_path(void);
+const char *fsmonitor_ipc__get_path(struct repository *r);
/*
* Try to determine whether there is a `git-fsmonitor--daemon` process
diff --git a/fsmonitor-path-utils.h b/fsmonitor-path-utils.h
new file mode 100644
index 0000000000..5bfdfb81c1
--- /dev/null
+++ b/fsmonitor-path-utils.h
@@ -0,0 +1,60 @@
+#ifndef FSM_PATH_UTILS_H
+#define FSM_PATH_UTILS_H
+
+#include "strbuf.h"
+
+struct alias_info
+{
+ struct strbuf alias;
+ struct strbuf points_to;
+};
+
+struct fs_info {
+ int is_remote;
+ char *typename;
+};
+
+/*
+ * Get some basic filesystem information for the given path
+ *
+ * The caller owns the storage that is occupied by fs_info and
+ * is responsible for releasing it.
+ *
+ * Returns -1 on error, zero otherwise.
+ */
+int fsmonitor__get_fs_info(const char *path, struct fs_info *fs_info);
+
+/*
+ * Determines if the filesystem that path resides on is remote.
+ *
+ * Returns -1 on error, 0 if not remote, 1 if remote.
+ */
+int fsmonitor__is_fs_remote(const char *path);
+
+/*
+ * Get the alias in given path, if any.
+ *
+ * Sets alias to the first alias that matches any part of the path.
+ *
+ * If an alias is found, info.alias and info.points_to are set to the
+ * found mapping.
+ *
+ * Returns -1 on error, 0 otherwise.
+ *
+ * The caller owns the storage that is occupied by info.alias and
+ * info.points_to and is responsible for releasing it.
+ */
+int fsmonitor__get_alias(const char *path, struct alias_info *info);
+
+/*
+ * Resolve the path against the given alias.
+ *
+ * Returns the resolved path if there is one, NULL otherwise.
+ *
+ * The caller owns the storage that the returned string occupies and
+ * is responsible for releasing it.
+ */
+char *fsmonitor__resolve_alias(const char *path,
+ const struct alias_info *info);
+
+#endif
diff --git a/fsmonitor-settings.c b/fsmonitor-settings.c
index 464424a1e9..b62acf44ae 100644
--- a/fsmonitor-settings.c
+++ b/fsmonitor-settings.c
@@ -1,7 +1,10 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
+#include "gettext.h"
#include "repository.h"
+#include "fsmonitor-ipc.h"
#include "fsmonitor-settings.h"
+#include "fsmonitor-path-utils.h"
/*
* We keep this structure defintion private and have getters
@@ -13,7 +16,53 @@ struct fsmonitor_settings {
char *hook_path;
};
-static enum fsmonitor_reason check_for_incompatible(struct repository *r)
+/*
+ * Remote working directories are problematic for FSMonitor.
+ *
+ * The underlying file system on the server machine and/or the remote
+ * mount type dictates whether notification events are available at
+ * all to remote client machines.
+ *
+ * Kernel differences between the server and client machines also
+ * dictate the how (buffering, frequency, de-dup) the events are
+ * delivered to client machine processes.
+ *
+ * A client machine (such as a laptop) may choose to suspend/resume
+ * and it is unclear (without lots of testing) whether the watcher can
+ * resync after a resume. We might be able to treat this as a normal
+ * "events were dropped by the kernel" event and do our normal "flush
+ * and resync" --or-- we might need to close the existing (zombie?)
+ * notification fd and create a new one.
+ *
+ * In theory, the above issues need to be addressed whether we are
+ * using the Hook or IPC API.
+ *
+ * So (for now at least), mark remote working directories as
+ * incompatible unless 'fsmonitor.allowRemote' is true.
+ *
+ */
+#ifdef HAVE_FSMONITOR_OS_SETTINGS
+static enum fsmonitor_reason check_remote(struct repository *r)
+{
+ int allow_remote = -1; /* -1 unset, 0 not allowed, 1 allowed */
+ int is_remote = fsmonitor__is_fs_remote(r->worktree);
+
+ switch (is_remote) {
+ case 0:
+ return FSMONITOR_REASON_OK;
+ case 1:
+ repo_config_get_bool(r, "fsmonitor.allowremote", &allow_remote);
+ if (allow_remote < 1)
+ return FSMONITOR_REASON_REMOTE;
+ else
+ return FSMONITOR_REASON_OK;
+ default:
+ return FSMONITOR_REASON_ERROR;
+ }
+}
+#endif
+
+static enum fsmonitor_reason check_for_incompatible(struct repository *r, int ipc)
{
if (!r->worktree) {
/*
@@ -27,7 +76,10 @@ static enum fsmonitor_reason check_for_incompatible(struct repository *r)
{
enum fsmonitor_reason reason;
- reason = fsm_os__incompatible(r);
+ reason = check_remote(r);
+ if (reason != FSMONITOR_REASON_OK)
+ return reason;
+ reason = fsm_os__incompatible(r, ipc);
if (reason != FSMONITOR_REASON_OK)
return reason;
}
@@ -92,8 +144,6 @@ static void lookup_fsmonitor_settings(struct repository *r)
enum fsmonitor_mode fsm_settings__get_mode(struct repository *r)
{
- if (!r)
- r = the_repository;
if (!r->settings.fsmonitor)
lookup_fsmonitor_settings(r);
@@ -102,8 +152,6 @@ enum fsmonitor_mode fsm_settings__get_mode(struct repository *r)
const char *fsm_settings__get_hook_path(struct repository *r)
{
- if (!r)
- r = the_repository;
if (!r->settings.fsmonitor)
lookup_fsmonitor_settings(r);
@@ -112,7 +160,7 @@ const char *fsm_settings__get_hook_path(struct repository *r)
void fsm_settings__set_ipc(struct repository *r)
{
- enum fsmonitor_reason reason = check_for_incompatible(r);
+ enum fsmonitor_reason reason = check_for_incompatible(r, 1);
if (reason != FSMONITOR_REASON_OK) {
fsm_settings__set_incompatible(r, reason);
@@ -123,8 +171,6 @@ void fsm_settings__set_ipc(struct repository *r)
* Caller requested IPC explicitly, so avoid (possibly
* recursive) config lookup.
*/
- if (!r)
- r = the_repository;
if (!r->settings.fsmonitor)
r->settings.fsmonitor = alloc_settings();
@@ -135,7 +181,7 @@ void fsm_settings__set_ipc(struct repository *r)
void fsm_settings__set_hook(struct repository *r, const char *path)
{
- enum fsmonitor_reason reason = check_for_incompatible(r);
+ enum fsmonitor_reason reason = check_for_incompatible(r, 0);
if (reason != FSMONITOR_REASON_OK) {
fsm_settings__set_incompatible(r, reason);
@@ -146,8 +192,6 @@ void fsm_settings__set_hook(struct repository *r, const char *path)
* Caller requested hook explicitly, so avoid (possibly
* recursive) config lookup.
*/
- if (!r)
- r = the_repository;
if (!r->settings.fsmonitor)
r->settings.fsmonitor = alloc_settings();
@@ -159,8 +203,6 @@ void fsm_settings__set_hook(struct repository *r, const char *path)
void fsm_settings__set_disabled(struct repository *r)
{
- if (!r)
- r = the_repository;
if (!r->settings.fsmonitor)
r->settings.fsmonitor = alloc_settings();
@@ -172,8 +214,6 @@ void fsm_settings__set_disabled(struct repository *r)
void fsm_settings__set_incompatible(struct repository *r,
enum fsmonitor_reason reason)
{
- if (!r)
- r = the_repository;
if (!r->settings.fsmonitor)
r->settings.fsmonitor = alloc_settings();
@@ -184,18 +224,17 @@ void fsm_settings__set_incompatible(struct repository *r,
enum fsmonitor_reason fsm_settings__get_reason(struct repository *r)
{
- if (!r)
- r = the_repository;
if (!r->settings.fsmonitor)
lookup_fsmonitor_settings(r);
return r->settings.fsmonitor->reason;
}
-char *fsm_settings__get_incompatible_msg(const struct repository *r,
+char *fsm_settings__get_incompatible_msg(struct repository *r,
enum fsmonitor_reason reason)
{
struct strbuf msg = STRBUF_INIT;
+ const char *socket_dir;
switch (reason) {
case FSMONITOR_REASON_UNTESTED:
@@ -231,9 +270,11 @@ char *fsm_settings__get_incompatible_msg(const struct repository *r,
goto done;
case FSMONITOR_REASON_NOSOCKETS:
+ socket_dir = dirname((char *)fsmonitor_ipc__get_path(r));
strbuf_addf(&msg,
- _("repository '%s' is incompatible with fsmonitor due to lack of Unix sockets"),
- r->worktree);
+ _("socket directory '%s' is incompatible with fsmonitor due"
+ " to lack of Unix sockets support"),
+ socket_dir);
goto done;
}
diff --git a/fsmonitor-settings.h b/fsmonitor-settings.h
index d9c2605197..ab02e3995e 100644
--- a/fsmonitor-settings.h
+++ b/fsmonitor-settings.h
@@ -33,7 +33,7 @@ enum fsmonitor_mode fsm_settings__get_mode(struct repository *r);
const char *fsm_settings__get_hook_path(struct repository *r);
enum fsmonitor_reason fsm_settings__get_reason(struct repository *r);
-char *fsm_settings__get_incompatible_msg(const struct repository *r,
+char *fsm_settings__get_incompatible_msg(struct repository *r,
enum fsmonitor_reason reason);
struct fsmonitor_settings;
@@ -48,7 +48,7 @@ struct fsmonitor_settings;
* fsm_os__* routines should considered private to fsm_settings__
* routines.
*/
-enum fsmonitor_reason fsm_os__incompatible(struct repository *r);
+enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc);
#endif /* HAVE_FSMONITOR_OS_SETTINGS */
#endif /* FSMONITOR_SETTINGS_H */
diff --git a/fsmonitor.c b/fsmonitor.c
index 57d6a483be..28c083d4d8 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -1,11 +1,13 @@
#include "cache.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
#include "ewah/ewok.h"
#include "fsmonitor.h"
#include "fsmonitor-ipc.h"
#include "run-command.h"
#include "strbuf.h"
+#include "trace2.h"
#define INDEX_EXTENSION_VERSION1 (1)
#define INDEX_EXTENSION_VERSION2 (2)
@@ -295,6 +297,7 @@ static int fsmonitor_force_update_threshold = 100;
void refresh_fsmonitor(struct index_state *istate)
{
+ static int warn_once = 0;
struct strbuf query_result = STRBUF_INIT;
int query_success = 0, hook_version = -1;
size_t bol = 0; /* beginning of line */
@@ -303,8 +306,16 @@ void refresh_fsmonitor(struct index_state *istate)
char *buf;
unsigned int i;
int is_trivial = 0;
- struct repository *r = istate->repo ? istate->repo : the_repository;
+ struct repository *r = istate->repo;
enum fsmonitor_mode fsm_mode = fsm_settings__get_mode(r);
+ enum fsmonitor_reason reason = fsm_settings__get_reason(r);
+
+ if (!warn_once && reason > FSMONITOR_REASON_OK) {
+ char *msg = fsm_settings__get_incompatible_msg(r, reason);
+ warn_once = 1;
+ warning("%s", msg);
+ free(msg);
+ }
if (fsm_mode <= FSMONITOR_MODE_DISABLED ||
istate->fsmonitor_has_run_once)
diff --git a/fsmonitor.h b/fsmonitor.h
index edf7ce5203..c67e0ebc09 100644
--- a/fsmonitor.h
+++ b/fsmonitor.h
@@ -4,6 +4,7 @@
#include "cache.h"
#include "dir.h"
#include "fsmonitor-settings.h"
+#include "trace.h"
extern struct trace_key trace_fsmonitor;
@@ -86,7 +87,7 @@ static inline void mark_fsmonitor_valid(struct index_state *istate, struct cache
!(ce->ce_flags & CE_FSMONITOR_VALID)) {
if (S_ISGITLINK(ce->ce_mode))
return;
- istate->cache_changed = 1;
+ istate->cache_changed |= FSMONITOR_CHANGED;
ce->ce_flags |= CE_FSMONITOR_VALID;
trace_printf_key(&trace_fsmonitor, "mark_fsmonitor_clean '%s'", ce->name);
}
diff --git a/gettext.c b/gettext.c
index 7fff88c8da..f27e94407b 100644
--- a/gettext.c
+++ b/gettext.c
@@ -2,7 +2,9 @@
* Copyright (c) 2010 Ævar Arnfjörð Bjarmason
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "environment.h"
#include "exec-cmd.h"
#include "gettext.h"
#include "strbuf.h"
@@ -10,7 +12,6 @@
#include "config.h"
#ifndef NO_GETTEXT
-# include <locale.h>
# include <libintl.h>
# ifdef GIT_WINDOWS_NATIVE
@@ -80,7 +81,6 @@ static int test_vsnprintf(const char *fmt, ...)
static void init_gettext_charset(const char *domain)
{
- setlocale(LC_CTYPE, "");
charset = locale_charset();
bind_textdomain_codeset(domain, charset);
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
deleted file mode 100755
index 95887fd8e5..0000000000
--- a/git-add--interactive.perl
+++ /dev/null
@@ -1,1920 +0,0 @@
-#!/usr/bin/perl
-
-use 5.008;
-use strict;
-use warnings;
-use Git qw(unquote_path);
-use Git::I18N;
-
-binmode(STDOUT, ":raw");
-
-my $repo = Git->repository();
-
-my $menu_use_color = $repo->get_colorbool('color.interactive');
-my ($prompt_color, $header_color, $help_color) =
- $menu_use_color ? (
- $repo->get_color('color.interactive.prompt', 'bold blue'),
- $repo->get_color('color.interactive.header', 'bold'),
- $repo->get_color('color.interactive.help', 'red bold'),
- ) : ();
-my $error_color = ();
-if ($menu_use_color) {
- my $help_color_spec = ($repo->config('color.interactive.help') or
- 'red bold');
- $error_color = $repo->get_color('color.interactive.error',
- $help_color_spec);
-}
-
-my $diff_use_color = $repo->get_colorbool('color.diff');
-my ($fraginfo_color) =
- $diff_use_color ? (
- $repo->get_color('color.diff.frag', 'cyan'),
- ) : ();
-my ($diff_context_color) =
- $diff_use_color ? (
- $repo->get_color($repo->config('color.diff.context') ? 'color.diff.context' : 'color.diff.plain', ''),
- ) : ();
-my ($diff_old_color) =
- $diff_use_color ? (
- $repo->get_color('color.diff.old', 'red'),
- ) : ();
-my ($diff_new_color) =
- $diff_use_color ? (
- $repo->get_color('color.diff.new', 'green'),
- ) : ();
-
-my $normal_color = $repo->get_color("", "reset");
-
-my $diff_algorithm = $repo->config('diff.algorithm');
-my $diff_filter = $repo->config('interactive.difffilter');
-
-my $use_readkey = 0;
-my $use_termcap = 0;
-my %term_escapes;
-
-sub ReadMode;
-sub ReadKey;
-if ($repo->config_bool("interactive.singlekey")) {
- eval {
- require Term::ReadKey;
- Term::ReadKey->import;
- $use_readkey = 1;
- };
- if (!$use_readkey) {
- print STDERR "missing Term::ReadKey, disabling interactive.singlekey\n";
- }
- eval {
- require Term::Cap;
- my $termcap = Term::Cap->Tgetent;
- foreach (values %$termcap) {
- $term_escapes{$_} = 1 if /^\e/;
- }
- $use_termcap = 1;
- };
-}
-
-sub colored {
- my $color = shift;
- my $string = join("", @_);
-
- if (defined $color) {
- # Put a color code at the beginning of each line, a reset at the end
- # color after newlines that are not at the end of the string
- $string =~ s/(\n+)(.)/$1$color$2/g;
- # reset before newlines
- $string =~ s/(\n+)/$normal_color$1/g;
- # codes at beginning and end (if necessary):
- $string =~ s/^/$color/;
- $string =~ s/$/$normal_color/ unless $string =~ /\n$/;
- }
- return $string;
-}
-
-# command line options
-my $patch_mode_only;
-my $patch_mode;
-my $patch_mode_revision;
-
-sub apply_patch;
-sub apply_patch_for_checkout_commit;
-sub apply_patch_for_stash;
-
-my %patch_modes = (
- 'stage' => {
- DIFF => 'diff-files -p',
- APPLY => sub { apply_patch 'apply --cached', @_; },
- APPLY_CHECK => 'apply --cached',
- FILTER => 'file-only',
- IS_REVERSE => 0,
- },
- 'stash' => {
- DIFF => 'diff-index -p HEAD',
- APPLY => sub { apply_patch 'apply --cached', @_; },
- APPLY_CHECK => 'apply --cached',
- FILTER => undef,
- IS_REVERSE => 0,
- },
- 'reset_head' => {
- DIFF => 'diff-index -p --cached',
- APPLY => sub { apply_patch 'apply -R --cached', @_; },
- APPLY_CHECK => 'apply -R --cached',
- FILTER => 'index-only',
- IS_REVERSE => 1,
- },
- 'reset_nothead' => {
- DIFF => 'diff-index -R -p --cached',
- APPLY => sub { apply_patch 'apply --cached', @_; },
- APPLY_CHECK => 'apply --cached',
- FILTER => 'index-only',
- IS_REVERSE => 0,
- },
- 'checkout_index' => {
- DIFF => 'diff-files -p',
- APPLY => sub { apply_patch 'apply -R', @_; },
- APPLY_CHECK => 'apply -R',
- FILTER => 'file-only',
- IS_REVERSE => 1,
- },
- 'checkout_head' => {
- DIFF => 'diff-index -p',
- APPLY => sub { apply_patch_for_checkout_commit '-R', @_ },
- APPLY_CHECK => 'apply -R',
- FILTER => undef,
- IS_REVERSE => 1,
- },
- 'checkout_nothead' => {
- DIFF => 'diff-index -R -p',
- APPLY => sub { apply_patch_for_checkout_commit '', @_ },
- APPLY_CHECK => 'apply',
- FILTER => undef,
- IS_REVERSE => 0,
- },
- 'worktree_head' => {
- DIFF => 'diff-index -p',
- APPLY => sub { apply_patch 'apply -R', @_ },
- APPLY_CHECK => 'apply -R',
- FILTER => undef,
- IS_REVERSE => 1,
- },
- 'worktree_nothead' => {
- DIFF => 'diff-index -R -p',
- APPLY => sub { apply_patch 'apply', @_ },
- APPLY_CHECK => 'apply',
- FILTER => undef,
- IS_REVERSE => 0,
- },
-);
-
-$patch_mode = 'stage';
-my %patch_mode_flavour = %{$patch_modes{$patch_mode}};
-
-sub run_cmd_pipe {
- if ($^O eq 'MSWin32') {
- my @invalid = grep {m/[":*]/} @_;
- die "$^O does not support: @invalid\n" if @invalid;
- my @args = map { m/ /o ? "\"$_\"": $_ } @_;
- return qx{@args};
- } else {
- my $fh = undef;
- open($fh, '-|', @_) or die;
- my @out = <$fh>;
- close $fh || die "Cannot close @_ ($!)";
- return @out;
- }
-}
-
-my ($GIT_DIR) = run_cmd_pipe(qw(git rev-parse --git-dir));
-
-if (!defined $GIT_DIR) {
- exit(1); # rev-parse would have already said "not a git repo"
-}
-chomp($GIT_DIR);
-
-sub refresh {
- my $fh;
- open $fh, 'git update-index --refresh |'
- or die;
- while (<$fh>) {
- ;# ignore 'needs update'
- }
- close $fh;
-}
-
-sub list_untracked {
- map {
- chomp $_;
- unquote_path($_);
- }
- run_cmd_pipe(qw(git ls-files --others --exclude-standard --), @ARGV);
-}
-
-# TRANSLATORS: you can adjust this to align "git add -i" status menu
-my $status_fmt = __('%12s %12s %s');
-my $status_head = sprintf($status_fmt, __('staged'), __('unstaged'), __('path'));
-
-{
- my $initial;
- sub is_initial_commit {
- $initial = system('git rev-parse HEAD -- >/dev/null 2>&1') != 0
- unless defined $initial;
- return $initial;
- }
-}
-
-{
- my $empty_tree;
- sub get_empty_tree {
- return $empty_tree if defined $empty_tree;
-
- ($empty_tree) = run_cmd_pipe(qw(git hash-object -t tree /dev/null));
- chomp $empty_tree;
- return $empty_tree;
- }
-}
-
-sub get_diff_reference {
- my $ref = shift;
- if (defined $ref and $ref ne 'HEAD') {
- return $ref;
- } elsif (is_initial_commit()) {
- return get_empty_tree();
- } else {
- return 'HEAD';
- }
-}
-
-# Returns list of hashes, contents of each of which are:
-# VALUE: pathname
-# BINARY: is a binary path
-# INDEX: is index different from HEAD?
-# FILE: is file different from index?
-# INDEX_ADDDEL: is it add/delete between HEAD and index?
-# FILE_ADDDEL: is it add/delete between index and file?
-# UNMERGED: is the path unmerged
-
-sub list_modified {
- my ($only) = @_;
- my (%data, @return);
- my ($add, $del, $adddel, $file);
-
- my $reference = get_diff_reference($patch_mode_revision);
- for (run_cmd_pipe(qw(git diff-index --cached
- --numstat --summary), $reference,
- '--', @ARGV)) {
- if (($add, $del, $file) =
- /^([-\d]+) ([-\d]+) (.*)/) {
- my ($change, $bin);
- $file = unquote_path($file);
- if ($add eq '-' && $del eq '-') {
- $change = __('binary');
- $bin = 1;
- }
- else {
- $change = "+$add/-$del";
- }
- $data{$file} = {
- INDEX => $change,
- BINARY => $bin,
- FILE => __('nothing'),
- }
- }
- elsif (($adddel, $file) =
- /^ (create|delete) mode [0-7]+ (.*)$/) {
- $file = unquote_path($file);
- $data{$file}{INDEX_ADDDEL} = $adddel;
- }
- }
-
- for (run_cmd_pipe(qw(git diff-files --ignore-submodules=dirty --numstat --summary --raw --), @ARGV)) {
- if (($add, $del, $file) =
- /^([-\d]+) ([-\d]+) (.*)/) {
- $file = unquote_path($file);
- my ($change, $bin);
- if ($add eq '-' && $del eq '-') {
- $change = __('binary');
- $bin = 1;
- }
- else {
- $change = "+$add/-$del";
- }
- $data{$file}{FILE} = $change;
- if ($bin) {
- $data{$file}{BINARY} = 1;
- }
- }
- elsif (($adddel, $file) =
- /^ (create|delete) mode [0-7]+ (.*)$/) {
- $file = unquote_path($file);
- $data{$file}{FILE_ADDDEL} = $adddel;
- }
- elsif (/^:[0-7]+ [0-7]+ [0-9a-f]+ [0-9a-f]+ (.) (.*)$/) {
- $file = unquote_path($2);
- if (!exists $data{$file}) {
- $data{$file} = +{
- INDEX => __('unchanged'),
- BINARY => 0,
- };
- }
- if ($1 eq 'U') {
- $data{$file}{UNMERGED} = 1;
- }
- }
- }
-
- for (sort keys %data) {
- my $it = $data{$_};
-
- if ($only) {
- if ($only eq 'index-only') {
- next if ($it->{INDEX} eq __('unchanged'));
- }
- if ($only eq 'file-only') {
- next if ($it->{FILE} eq __('nothing'));
- }
- }
- push @return, +{
- VALUE => $_,
- %$it,
- };
- }
- return @return;
-}
-
-sub find_unique {
- my ($string, @stuff) = @_;
- my $found = undef;
- for (my $i = 0; $i < @stuff; $i++) {
- my $it = $stuff[$i];
- my $hit = undef;
- if (ref $it) {
- if ((ref $it) eq 'ARRAY') {
- $it = $it->[0];
- }
- else {
- $it = $it->{VALUE};
- }
- }
- eval {
- if ($it =~ /^$string/) {
- $hit = 1;
- };
- };
- if (defined $hit && defined $found) {
- return undef;
- }
- if ($hit) {
- $found = $i + 1;
- }
- }
- return $found;
-}
-
-# inserts string into trie and updates count for each character
-sub update_trie {
- my ($trie, $string) = @_;
- foreach (split //, $string) {
- $trie = $trie->{$_} ||= {COUNT => 0};
- $trie->{COUNT}++;
- }
-}
-
-# returns an array of tuples (prefix, remainder)
-sub find_unique_prefixes {
- my @stuff = @_;
- my @return = ();
-
- # any single prefix exceeding the soft limit is omitted
- # if any prefix exceeds the hard limit all are omitted
- # 0 indicates no limit
- my $soft_limit = 0;
- my $hard_limit = 3;
-
- # build a trie modelling all possible options
- my %trie;
- foreach my $print (@stuff) {
- if ((ref $print) eq 'ARRAY') {
- $print = $print->[0];
- }
- elsif ((ref $print) eq 'HASH') {
- $print = $print->{VALUE};
- }
- update_trie(\%trie, $print);
- push @return, $print;
- }
-
- # use the trie to find the unique prefixes
- for (my $i = 0; $i < @return; $i++) {
- my $ret = $return[$i];
- my @letters = split //, $ret;
- my %search = %trie;
- my ($prefix, $remainder);
- my $j;
- for ($j = 0; $j < @letters; $j++) {
- my $letter = $letters[$j];
- if ($search{$letter}{COUNT} == 1) {
- $prefix = substr $ret, 0, $j + 1;
- $remainder = substr $ret, $j + 1;
- last;
- }
- else {
- my $prefix = substr $ret, 0, $j;
- return ()
- if ($hard_limit && $j + 1 > $hard_limit);
- }
- %search = %{$search{$letter}};
- }
- if (ord($letters[0]) > 127 ||
- ($soft_limit && $j + 1 > $soft_limit)) {
- $prefix = undef;
- $remainder = $ret;
- }
- $return[$i] = [$prefix, $remainder];
- }
- return @return;
-}
-
-# filters out prefixes which have special meaning to list_and_choose()
-sub is_valid_prefix {
- my $prefix = shift;
- return (defined $prefix) &&
- !($prefix =~ /[\s,]/) && # separators
- !($prefix =~ /^-/) && # deselection
- !($prefix =~ /^\d+/) && # selection
- ($prefix ne '*') && # "all" wildcard
- ($prefix ne '?'); # prompt help
-}
-
-# given a prefix/remainder tuple return a string with the prefix highlighted
-# for now use square brackets; later might use ANSI colors (underline, bold)
-sub highlight_prefix {
- my $prefix = shift;
- my $remainder = shift;
-
- if (!defined $prefix) {
- return $remainder;
- }
-
- if (!is_valid_prefix($prefix)) {
- return "$prefix$remainder";
- }
-
- if (!$menu_use_color) {
- return "[$prefix]$remainder";
- }
-
- return "$prompt_color$prefix$normal_color$remainder";
-}
-
-sub error_msg {
- print STDERR colored $error_color, @_;
-}
-
-sub list_and_choose {
- my ($opts, @stuff) = @_;
- my (@chosen, @return);
- if (!@stuff) {
- return @return;
- }
- my $i;
- my @prefixes = find_unique_prefixes(@stuff) unless $opts->{LIST_ONLY};
-
- TOPLOOP:
- while (1) {
- my $last_lf = 0;
-
- if ($opts->{HEADER}) {
- my $indent = $opts->{LIST_FLAT} ? "" : " ";
- print colored $header_color, "$indent$opts->{HEADER}\n";
- }
- for ($i = 0; $i < @stuff; $i++) {
- my $chosen = $chosen[$i] ? '*' : ' ';
- my $print = $stuff[$i];
- my $ref = ref $print;
- my $highlighted = highlight_prefix(@{$prefixes[$i]})
- if @prefixes;
- if ($ref eq 'ARRAY') {
- $print = $highlighted || $print->[0];
- }
- elsif ($ref eq 'HASH') {
- my $value = $highlighted || $print->{VALUE};
- $print = sprintf($status_fmt,
- $print->{INDEX},
- $print->{FILE},
- $value);
- }
- else {
- $print = $highlighted || $print;
- }
- printf("%s%2d: %s", $chosen, $i+1, $print);
- if (($opts->{LIST_FLAT}) &&
- (($i + 1) % ($opts->{LIST_FLAT}))) {
- print "\t";
- $last_lf = 0;
- }
- else {
- print "\n";
- $last_lf = 1;
- }
- }
- if (!$last_lf) {
- print "\n";
- }
-
- return if ($opts->{LIST_ONLY});
-
- print colored $prompt_color, $opts->{PROMPT};
- if ($opts->{SINGLETON}) {
- print "> ";
- }
- else {
- print ">> ";
- }
- my $line = <STDIN>;
- if (!$line) {
- print "\n";
- $opts->{ON_EOF}->() if $opts->{ON_EOF};
- last;
- }
- chomp $line;
- last if $line eq '';
- if ($line eq '?') {
- $opts->{SINGLETON} ?
- singleton_prompt_help_cmd() :
- prompt_help_cmd();
- next TOPLOOP;
- }
- for my $choice (split(/[\s,]+/, $line)) {
- my $choose = 1;
- my ($bottom, $top);
-
- # Input that begins with '-'; unchoose
- if ($choice =~ s/^-//) {
- $choose = 0;
- }
- # A range can be specified like 5-7 or 5-.
- if ($choice =~ /^(\d+)-(\d*)$/) {
- ($bottom, $top) = ($1, length($2) ? $2 : 1 + @stuff);
- }
- elsif ($choice =~ /^\d+$/) {
- $bottom = $top = $choice;
- }
- elsif ($choice eq '*') {
- $bottom = 1;
- $top = 1 + @stuff;
- }
- else {
- $bottom = $top = find_unique($choice, @stuff);
- if (!defined $bottom) {
- error_msg sprintf(__("Huh (%s)?\n"), $choice);
- next TOPLOOP;
- }
- }
- if ($opts->{SINGLETON} && $bottom != $top) {
- error_msg sprintf(__("Huh (%s)?\n"), $choice);
- next TOPLOOP;
- }
- for ($i = $bottom-1; $i <= $top-1; $i++) {
- next if (@stuff <= $i || $i < 0);
- $chosen[$i] = $choose;
- }
- }
- last if ($opts->{IMMEDIATE} || $line eq '*');
- }
- for ($i = 0; $i < @stuff; $i++) {
- if ($chosen[$i]) {
- push @return, $stuff[$i];
- }
- }
- return @return;
-}
-
-sub singleton_prompt_help_cmd {
- print colored $help_color, __ <<'EOF' ;
-Prompt help:
-1 - select a numbered item
-foo - select item based on unique prefix
- - (empty) select nothing
-EOF
-}
-
-sub prompt_help_cmd {
- print colored $help_color, __ <<'EOF' ;
-Prompt help:
-1 - select a single item
-3-5 - select a range of items
-2-3,6-9 - select multiple ranges
-foo - select item based on unique prefix
--... - unselect specified items
-* - choose all items
- - (empty) finish selecting
-EOF
-}
-
-sub status_cmd {
- list_and_choose({ LIST_ONLY => 1, HEADER => $status_head },
- list_modified());
- print "\n";
-}
-
-sub say_n_paths {
- my $did = shift @_;
- my $cnt = scalar @_;
- if ($did eq 'added') {
- printf(__n("added %d path\n", "added %d paths\n",
- $cnt), $cnt);
- } elsif ($did eq 'updated') {
- printf(__n("updated %d path\n", "updated %d paths\n",
- $cnt), $cnt);
- } elsif ($did eq 'reverted') {
- printf(__n("reverted %d path\n", "reverted %d paths\n",
- $cnt), $cnt);
- } else {
- printf(__n("touched %d path\n", "touched %d paths\n",
- $cnt), $cnt);
- }
-}
-
-sub update_cmd {
- my @mods = list_modified('file-only');
- return if (!@mods);
-
- my @update = list_and_choose({ PROMPT => __('Update'),
- HEADER => $status_head, },
- @mods);
- if (@update) {
- system(qw(git update-index --add --remove --),
- map { $_->{VALUE} } @update);
- say_n_paths('updated', @update);
- }
- print "\n";
-}
-
-sub revert_cmd {
- my @update = list_and_choose({ PROMPT => __('Revert'),
- HEADER => $status_head, },
- list_modified());
- if (@update) {
- if (is_initial_commit()) {
- system(qw(git rm --cached),
- map { $_->{VALUE} } @update);
- }
- else {
- my @lines = run_cmd_pipe(qw(git ls-tree HEAD --),
- map { $_->{VALUE} } @update);
- my $fh;
- open $fh, '| git update-index --index-info'
- or die;
- for (@lines) {
- print $fh $_;
- }
- close($fh);
- for (@update) {
- if ($_->{INDEX_ADDDEL} &&
- $_->{INDEX_ADDDEL} eq 'create') {
- system(qw(git update-index --force-remove --),
- $_->{VALUE});
- printf(__("note: %s is untracked now.\n"), $_->{VALUE});
- }
- }
- }
- refresh();
- say_n_paths('reverted', @update);
- }
- print "\n";
-}
-
-sub add_untracked_cmd {
- my @add = list_and_choose({ PROMPT => __('Add untracked') },
- list_untracked());
- if (@add) {
- system(qw(git update-index --add --), @add);
- say_n_paths('added', @add);
- } else {
- print __("No untracked files.\n");
- }
- print "\n";
-}
-
-sub run_git_apply {
- my $cmd = shift;
- my $fh;
- open $fh, '| git ' . $cmd . " --allow-overlap";
- print $fh @_;
- return close $fh;
-}
-
-sub parse_diff {
- my ($path) = @_;
- my @diff_cmd = split(" ", $patch_mode_flavour{DIFF});
- if (defined $diff_algorithm) {
- splice @diff_cmd, 1, 0, "--diff-algorithm=${diff_algorithm}";
- }
- if (defined $patch_mode_revision) {
- push @diff_cmd, get_diff_reference($patch_mode_revision);
- }
- my @diff = run_cmd_pipe("git", @diff_cmd, qw(--no-color --), $path);
- my @colored = ();
- if ($diff_use_color) {
- my @display_cmd = ("git", @diff_cmd, qw(--color --), $path);
- if (defined $diff_filter) {
- # quotemeta is overkill, but sufficient for shell-quoting
- my $diff = join(' ', map { quotemeta } @display_cmd);
- @display_cmd = ("$diff | $diff_filter");
- }
-
- @colored = run_cmd_pipe(@display_cmd);
- }
- my (@hunk) = { TEXT => [], DISPLAY => [], TYPE => 'header' };
-
- if (@colored && @colored != @diff) {
- print STDERR
- "fatal: mismatched output from interactive.diffFilter\n",
- "hint: Your filter must maintain a one-to-one correspondence\n",
- "hint: between its input and output lines.\n";
- exit 1;
- }
-
- for (my $i = 0; $i < @diff; $i++) {
- if ($diff[$i] =~ /^@@ /) {
- push @hunk, { TEXT => [], DISPLAY => [],
- TYPE => 'hunk' };
- }
- push @{$hunk[-1]{TEXT}}, $diff[$i];
- push @{$hunk[-1]{DISPLAY}},
- (@colored ? $colored[$i] : $diff[$i]);
- }
- return @hunk;
-}
-
-sub parse_diff_header {
- my $src = shift;
-
- my $head = { TEXT => [], DISPLAY => [], TYPE => 'header' };
- my $mode = { TEXT => [], DISPLAY => [], TYPE => 'mode' };
- my $deletion = { TEXT => [], DISPLAY => [], TYPE => 'deletion' };
- my $addition;
-
- for (my $i = 0; $i < @{$src->{TEXT}}; $i++) {
- if ($src->{TEXT}->[$i] =~ /^new file/) {
- $addition = 1;
- $head->{TYPE} = 'addition';
- }
- my $dest =
- $src->{TEXT}->[$i] =~ /^(old|new) mode (\d+)$/ ? $mode :
- $src->{TEXT}->[$i] =~ /^deleted file/ ? $deletion :
- $head;
- push @{$dest->{TEXT}}, $src->{TEXT}->[$i];
- push @{$dest->{DISPLAY}}, $src->{DISPLAY}->[$i];
- }
- return ($head, $mode, $deletion, $addition);
-}
-
-sub hunk_splittable {
- my ($text) = @_;
-
- my @s = split_hunk($text);
- return (1 < @s);
-}
-
-sub parse_hunk_header {
- my ($line) = @_;
- my ($o_ofs, $o_cnt, $n_ofs, $n_cnt) =
- $line =~ /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;
- $o_cnt = 1 unless defined $o_cnt;
- $n_cnt = 1 unless defined $n_cnt;
- return ($o_ofs, $o_cnt, $n_ofs, $n_cnt);
-}
-
-sub format_hunk_header {
- my ($o_ofs, $o_cnt, $n_ofs, $n_cnt) = @_;
- return ("@@ -$o_ofs" .
- (($o_cnt != 1) ? ",$o_cnt" : '') .
- " +$n_ofs" .
- (($n_cnt != 1) ? ",$n_cnt" : '') .
- " @@\n");
-}
-
-sub split_hunk {
- my ($text, $display) = @_;
- my @split = ();
- if (!defined $display) {
- $display = $text;
- }
- # If there are context lines in the middle of a hunk,
- # it can be split, but we would need to take care of
- # overlaps later.
-
- my ($o_ofs, undef, $n_ofs) = parse_hunk_header($text->[0]);
- my $hunk_start = 1;
-
- OUTER:
- while (1) {
- my $next_hunk_start = undef;
- my $i = $hunk_start - 1;
- my $this = +{
- TEXT => [],
- DISPLAY => [],
- TYPE => 'hunk',
- OLD => $o_ofs,
- NEW => $n_ofs,
- OCNT => 0,
- NCNT => 0,
- ADDDEL => 0,
- POSTCTX => 0,
- USE => undef,
- };
-
- while (++$i < @$text) {
- my $line = $text->[$i];
- my $display = $display->[$i];
- if ($line =~ /^\\/) {
- push @{$this->{TEXT}}, $line;
- push @{$this->{DISPLAY}}, $display;
- next;
- }
- if ($line =~ /^ /) {
- if ($this->{ADDDEL} &&
- !defined $next_hunk_start) {
- # We have seen leading context and
- # adds/dels and then here is another
- # context, which is trailing for this
- # split hunk and leading for the next
- # one.
- $next_hunk_start = $i;
- }
- push @{$this->{TEXT}}, $line;
- push @{$this->{DISPLAY}}, $display;
- $this->{OCNT}++;
- $this->{NCNT}++;
- if (defined $next_hunk_start) {
- $this->{POSTCTX}++;
- }
- next;
- }
-
- # add/del
- if (defined $next_hunk_start) {
- # We are done with the current hunk and
- # this is the first real change for the
- # next split one.
- $hunk_start = $next_hunk_start;
- $o_ofs = $this->{OLD} + $this->{OCNT};
- $n_ofs = $this->{NEW} + $this->{NCNT};
- $o_ofs -= $this->{POSTCTX};
- $n_ofs -= $this->{POSTCTX};
- push @split, $this;
- redo OUTER;
- }
- push @{$this->{TEXT}}, $line;
- push @{$this->{DISPLAY}}, $display;
- $this->{ADDDEL}++;
- if ($line =~ /^-/) {
- $this->{OCNT}++;
- }
- else {
- $this->{NCNT}++;
- }
- }
-
- push @split, $this;
- last;
- }
-
- for my $hunk (@split) {
- $o_ofs = $hunk->{OLD};
- $n_ofs = $hunk->{NEW};
- my $o_cnt = $hunk->{OCNT};
- my $n_cnt = $hunk->{NCNT};
-
- my $head = format_hunk_header($o_ofs, $o_cnt, $n_ofs, $n_cnt);
- my $display_head = $head;
- unshift @{$hunk->{TEXT}}, $head;
- if ($diff_use_color) {
- $display_head = colored($fraginfo_color, $head);
- }
- unshift @{$hunk->{DISPLAY}}, $display_head;
- }
- return @split;
-}
-
-sub find_last_o_ctx {
- my ($it) = @_;
- my $text = $it->{TEXT};
- my ($o_ofs, $o_cnt) = parse_hunk_header($text->[0]);
- my $i = @{$text};
- my $last_o_ctx = $o_ofs + $o_cnt;
- while (0 < --$i) {
- my $line = $text->[$i];
- if ($line =~ /^ /) {
- $last_o_ctx--;
- next;
- }
- last;
- }
- return $last_o_ctx;
-}
-
-sub merge_hunk {
- my ($prev, $this) = @_;
- my ($o0_ofs, $o0_cnt, $n0_ofs, $n0_cnt) =
- parse_hunk_header($prev->{TEXT}[0]);
- my ($o1_ofs, $o1_cnt, $n1_ofs, $n1_cnt) =
- parse_hunk_header($this->{TEXT}[0]);
-
- my (@line, $i, $ofs, $o_cnt, $n_cnt);
- $ofs = $o0_ofs;
- $o_cnt = $n_cnt = 0;
- for ($i = 1; $i < @{$prev->{TEXT}}; $i++) {
- my $line = $prev->{TEXT}[$i];
- if ($line =~ /^\+/) {
- $n_cnt++;
- push @line, $line;
- next;
- } elsif ($line =~ /^\\/) {
- push @line, $line;
- next;
- }
-
- last if ($o1_ofs <= $ofs);
-
- $o_cnt++;
- $ofs++;
- if ($line =~ /^ /) {
- $n_cnt++;
- }
- push @line, $line;
- }
-
- for ($i = 1; $i < @{$this->{TEXT}}; $i++) {
- my $line = $this->{TEXT}[$i];
- if ($line =~ /^\+/) {
- $n_cnt++;
- push @line, $line;
- next;
- } elsif ($line =~ /^\\/) {
- push @line, $line;
- next;
- }
- $ofs++;
- $o_cnt++;
- if ($line =~ /^ /) {
- $n_cnt++;
- }
- push @line, $line;
- }
- my $head = format_hunk_header($o0_ofs, $o_cnt, $n0_ofs, $n_cnt);
- @{$prev->{TEXT}} = ($head, @line);
-}
-
-sub coalesce_overlapping_hunks {
- my (@in) = @_;
- my @out = ();
-
- my ($last_o_ctx, $last_was_dirty);
- my $ofs_delta = 0;
-
- for (@in) {
- if ($_->{TYPE} ne 'hunk') {
- push @out, $_;
- next;
- }
- my $text = $_->{TEXT};
- my ($o_ofs, $o_cnt, $n_ofs, $n_cnt) =
- parse_hunk_header($text->[0]);
- unless ($_->{USE}) {
- $ofs_delta += $o_cnt - $n_cnt;
- # If this hunk has been edited then subtract
- # the delta that is due to the edit.
- if ($_->{OFS_DELTA}) {
- $ofs_delta -= $_->{OFS_DELTA};
- }
- next;
- }
- if ($ofs_delta) {
- if ($patch_mode_flavour{IS_REVERSE}) {
- $o_ofs -= $ofs_delta;
- } else {
- $n_ofs += $ofs_delta;
- }
- $_->{TEXT}->[0] = format_hunk_header($o_ofs, $o_cnt,
- $n_ofs, $n_cnt);
- }
- # If this hunk was edited then adjust the offset delta
- # to reflect the edit.
- if ($_->{OFS_DELTA}) {
- $ofs_delta += $_->{OFS_DELTA};
- }
- if (defined $last_o_ctx &&
- $o_ofs <= $last_o_ctx &&
- !$_->{DIRTY} &&
- !$last_was_dirty) {
- merge_hunk($out[-1], $_);
- }
- else {
- push @out, $_;
- }
- $last_o_ctx = find_last_o_ctx($out[-1]);
- $last_was_dirty = $_->{DIRTY};
- }
- return @out;
-}
-
-sub reassemble_patch {
- my $head = shift;
- my @patch;
-
- # Include everything in the header except the beginning of the diff.
- push @patch, (grep { !/^[-+]{3}/ } @$head);
-
- # Then include any headers from the hunk lines, which must
- # come before any actual hunk.
- while (@_ && $_[0] !~ /^@/) {
- push @patch, shift;
- }
-
- # Then begin the diff.
- push @patch, grep { /^[-+]{3}/ } @$head;
-
- # And then the actual hunks.
- push @patch, @_;
-
- return @patch;
-}
-
-sub color_diff {
- return map {
- colored((/^@/ ? $fraginfo_color :
- /^\+/ ? $diff_new_color :
- /^-/ ? $diff_old_color :
- $diff_context_color),
- $_);
- } @_;
-}
-
-my %edit_hunk_manually_modes = (
- stage => N__(
-"If the patch applies cleanly, the edited hunk will immediately be
-marked for staging."),
- stash => N__(
-"If the patch applies cleanly, the edited hunk will immediately be
-marked for stashing."),
- reset_head => N__(
-"If the patch applies cleanly, the edited hunk will immediately be
-marked for unstaging."),
- reset_nothead => N__(
-"If the patch applies cleanly, the edited hunk will immediately be
-marked for applying."),
- checkout_index => N__(
-"If the patch applies cleanly, the edited hunk will immediately be
-marked for discarding."),
- checkout_head => N__(
-"If the patch applies cleanly, the edited hunk will immediately be
-marked for discarding."),
- checkout_nothead => N__(
-"If the patch applies cleanly, the edited hunk will immediately be
-marked for applying."),
- worktree_head => N__(
-"If the patch applies cleanly, the edited hunk will immediately be
-marked for discarding."),
- worktree_nothead => N__(
-"If the patch applies cleanly, the edited hunk will immediately be
-marked for applying."),
-);
-
-sub recount_edited_hunk {
- local $_;
- my ($oldtext, $newtext) = @_;
- my ($o_cnt, $n_cnt) = (0, 0);
- for (@{$newtext}[1..$#{$newtext}]) {
- my $mode = substr($_, 0, 1);
- if ($mode eq '-') {
- $o_cnt++;
- } elsif ($mode eq '+') {
- $n_cnt++;
- } elsif ($mode eq ' ' or $mode eq "\n") {
- $o_cnt++;
- $n_cnt++;
- }
- }
- my ($o_ofs, undef, $n_ofs, undef) =
- parse_hunk_header($newtext->[0]);
- $newtext->[0] = format_hunk_header($o_ofs, $o_cnt, $n_ofs, $n_cnt);
- my (undef, $orig_o_cnt, undef, $orig_n_cnt) =
- parse_hunk_header($oldtext->[0]);
- # Return the change in the number of lines inserted by this hunk
- return $orig_o_cnt - $orig_n_cnt - $o_cnt + $n_cnt;
-}
-
-sub edit_hunk_manually {
- my ($oldtext) = @_;
-
- my $hunkfile = $repo->repo_path . "/addp-hunk-edit.diff";
- my $fh;
- open $fh, '>', $hunkfile
- or die sprintf(__("failed to open hunk edit file for writing: %s"), $!);
- print $fh Git::comment_lines __("Manual hunk edit mode -- see bottom for a quick guide.\n");
- print $fh @$oldtext;
- my $is_reverse = $patch_mode_flavour{IS_REVERSE};
- my ($remove_plus, $remove_minus) = $is_reverse ? ('-', '+') : ('+', '-');
- my $comment_line_char = Git::get_comment_line_char;
- print $fh Git::comment_lines sprintf(__ <<EOF, $remove_minus, $remove_plus, $comment_line_char),
----
-To remove '%s' lines, make them ' ' lines (context).
-To remove '%s' lines, delete them.
-Lines starting with %s will be removed.
-EOF
-__($edit_hunk_manually_modes{$patch_mode}),
-# TRANSLATORS: 'it' refers to the patch mentioned in the previous messages.
-__ <<EOF2 ;
-If it does not apply cleanly, you will be given an opportunity to
-edit again. If all lines of the hunk are removed, then the edit is
-aborted and the hunk is left unchanged.
-EOF2
- close $fh;
-
- chomp(my ($editor) = run_cmd_pipe(qw(git var GIT_EDITOR)));
- system('sh', '-c', $editor.' "$@"', $editor, $hunkfile);
-
- if ($? != 0) {
- return undef;
- }
-
- open $fh, '<', $hunkfile
- or die sprintf(__("failed to open hunk edit file for reading: %s"), $!);
- my @newtext = grep { !/^\Q$comment_line_char\E/ } <$fh>;
- close $fh;
- unlink $hunkfile;
-
- # Abort if nothing remains
- if (!grep { /\S/ } @newtext) {
- return undef;
- }
-
- # Reinsert the first hunk header if the user accidentally deleted it
- if ($newtext[0] !~ /^@/) {
- unshift @newtext, $oldtext->[0];
- }
- return \@newtext;
-}
-
-sub diff_applies {
- return run_git_apply($patch_mode_flavour{APPLY_CHECK} . ' --check',
- map { @{$_->{TEXT}} } @_);
-}
-
-sub _restore_terminal_and_die {
- ReadMode 'restore';
- print "\n";
- exit 1;
-}
-
-sub prompt_single_character {
- if ($use_readkey) {
- local $SIG{TERM} = \&_restore_terminal_and_die;
- local $SIG{INT} = \&_restore_terminal_and_die;
- ReadMode 'cbreak';
- my $key = ReadKey 0;
- ReadMode 'restore';
- if (defined $key) {
- if ($use_termcap and $key eq "\e") {
- while (!defined $term_escapes{$key}) {
- my $next = ReadKey 0.5;
- last if (!defined $next);
- $key .= $next;
- }
- $key =~ s/\e/^[/;
- }
- print "$key";
- }
- print "\n";
- return $key;
- } else {
- return <STDIN>;
- }
-}
-
-sub prompt_yesno {
- my ($prompt) = @_;
- while (1) {
- print colored $prompt_color, $prompt;
- my $line = prompt_single_character;
- return undef unless defined $line;
- return 0 if $line =~ /^n/i;
- return 1 if $line =~ /^y/i;
- }
-}
-
-sub edit_hunk_loop {
- my ($head, $hunks, $ix) = @_;
- my $hunk = $hunks->[$ix];
- my $text = $hunk->{TEXT};
-
- while (1) {
- my $newtext = edit_hunk_manually($text);
- if (!defined $newtext) {
- return undef;
- }
- my $newhunk = {
- TEXT => $newtext,
- TYPE => $hunk->{TYPE},
- USE => 1,
- DIRTY => 1,
- };
- $newhunk->{OFS_DELTA} = recount_edited_hunk($text, $newtext);
- # If this hunk has already been edited then add the
- # offset delta of the previous edit to get the real
- # delta from the original unedited hunk.
- $hunk->{OFS_DELTA} and
- $newhunk->{OFS_DELTA} += $hunk->{OFS_DELTA};
- if (diff_applies($head,
- @{$hunks}[0..$ix-1],
- $newhunk,
- @{$hunks}[$ix+1..$#{$hunks}])) {
- $newhunk->{DISPLAY} = [color_diff(@{$newtext})];
- return $newhunk;
- }
- else {
- prompt_yesno(
- # TRANSLATORS: do not translate [y/n]
- # The program will only accept that input
- # at this point.
- # Consider translating (saying "no" discards!) as
- # (saying "n" for "no" discards!) if the translation
- # of the word "no" does not start with n.
- __('Your edited hunk does not apply. Edit again '
- . '(saying "no" discards!) [y/n]? ')
- ) or return undef;
- }
- }
-}
-
-my %help_patch_modes = (
- stage => N__(
-"y - stage this hunk
-n - do not stage this hunk
-q - quit; do not stage this hunk or any of the remaining ones
-a - stage this hunk and all later hunks in the file
-d - do not stage this hunk or any of the later hunks in the file"),
- stash => N__(
-"y - stash this hunk
-n - do not stash this hunk
-q - quit; do not stash this hunk or any of the remaining ones
-a - stash this hunk and all later hunks in the file
-d - do not stash this hunk or any of the later hunks in the file"),
- reset_head => N__(
-"y - unstage this hunk
-n - do not unstage this hunk
-q - quit; do not unstage this hunk or any of the remaining ones
-a - unstage this hunk and all later hunks in the file
-d - do not unstage this hunk or any of the later hunks in the file"),
- reset_nothead => N__(
-"y - apply this hunk to index
-n - do not apply this hunk to index
-q - quit; do not apply this hunk or any of the remaining ones
-a - apply this hunk and all later hunks in the file
-d - do not apply this hunk or any of the later hunks in the file"),
- checkout_index => N__(
-"y - discard this hunk from worktree
-n - do not discard this hunk from worktree
-q - quit; do not discard this hunk or any of the remaining ones
-a - discard this hunk and all later hunks in the file
-d - do not discard this hunk or any of the later hunks in the file"),
- checkout_head => N__(
-"y - discard this hunk from index and worktree
-n - do not discard this hunk from index and worktree
-q - quit; do not discard this hunk or any of the remaining ones
-a - discard this hunk and all later hunks in the file
-d - do not discard this hunk or any of the later hunks in the file"),
- checkout_nothead => N__(
-"y - apply this hunk to index and worktree
-n - do not apply this hunk to index and worktree
-q - quit; do not apply this hunk or any of the remaining ones
-a - apply this hunk and all later hunks in the file
-d - do not apply this hunk or any of the later hunks in the file"),
- worktree_head => N__(
-"y - discard this hunk from worktree
-n - do not discard this hunk from worktree
-q - quit; do not discard this hunk or any of the remaining ones
-a - discard this hunk and all later hunks in the file
-d - do not discard this hunk or any of the later hunks in the file"),
- worktree_nothead => N__(
-"y - apply this hunk to worktree
-n - do not apply this hunk to worktree
-q - quit; do not apply this hunk or any of the remaining ones
-a - apply this hunk and all later hunks in the file
-d - do not apply this hunk or any of the later hunks in the file"),
-);
-
-sub help_patch_cmd {
- local $_;
- my $other = $_[0] . ",?";
- print colored $help_color, __($help_patch_modes{$patch_mode}), "\n",
- map { "$_\n" } grep {
- my $c = quotemeta(substr($_, 0, 1));
- $other =~ /,$c/
- } split "\n", __ <<EOF ;
-g - select a hunk to go to
-/ - search for a hunk matching the given regex
-j - leave this hunk undecided, see next undecided hunk
-J - leave this hunk undecided, see next hunk
-k - leave this hunk undecided, see previous undecided hunk
-K - leave this hunk undecided, see previous hunk
-s - split the current hunk into smaller hunks
-e - manually edit the current hunk
-? - print help
-EOF
-}
-
-sub apply_patch {
- my $cmd = shift;
- my $ret = run_git_apply $cmd, @_;
- if (!$ret) {
- print STDERR @_;
- }
- return $ret;
-}
-
-sub apply_patch_for_checkout_commit {
- my $reverse = shift;
- my $applies_index = run_git_apply 'apply '.$reverse.' --cached --check', @_;
- my $applies_worktree = run_git_apply 'apply '.$reverse.' --check', @_;
-
- if ($applies_worktree && $applies_index) {
- run_git_apply 'apply '.$reverse.' --cached', @_;
- run_git_apply 'apply '.$reverse, @_;
- return 1;
- } elsif (!$applies_index) {
- print colored $error_color, __("The selected hunks do not apply to the index!\n");
- if (prompt_yesno __("Apply them to the worktree anyway? ")) {
- return run_git_apply 'apply '.$reverse, @_;
- } else {
- print colored $error_color, __("Nothing was applied.\n");
- return 0;
- }
- } else {
- print STDERR @_;
- return 0;
- }
-}
-
-sub patch_update_cmd {
- my @all_mods = list_modified($patch_mode_flavour{FILTER});
- error_msg sprintf(__("ignoring unmerged: %s\n"), $_->{VALUE})
- for grep { $_->{UNMERGED} } @all_mods;
- @all_mods = grep { !$_->{UNMERGED} } @all_mods;
-
- my @mods = grep { !($_->{BINARY}) } @all_mods;
- my @them;
-
- if (!@mods) {
- if (@all_mods) {
- print STDERR __("Only binary files changed.\n");
- } else {
- print STDERR __("No changes.\n");
- }
- return 0;
- }
- if ($patch_mode_only) {
- @them = @mods;
- }
- else {
- @them = list_and_choose({ PROMPT => __('Patch update'),
- HEADER => $status_head, },
- @mods);
- }
- for (@them) {
- return 0 if patch_update_file($_->{VALUE});
- }
-}
-
-# Generate a one line summary of a hunk.
-sub summarize_hunk {
- my $rhunk = shift;
- my $summary = $rhunk->{TEXT}[0];
-
- # Keep the line numbers, discard extra context.
- $summary =~ s/@@(.*?)@@.*/$1 /s;
- $summary .= " " x (20 - length $summary);
-
- # Add some user context.
- for my $line (@{$rhunk->{TEXT}}) {
- if ($line =~ m/^[+-].*\w/) {
- $summary .= $line;
- last;
- }
- }
-
- chomp $summary;
- return substr($summary, 0, 80) . "\n";
-}
-
-
-# Print a one-line summary of each hunk in the array ref in
-# the first argument, starting with the index in the 2nd.
-sub display_hunks {
- my ($hunks, $i) = @_;
- my $ctr = 0;
- $i ||= 0;
- for (; $i < @$hunks && $ctr < 20; $i++, $ctr++) {
- my $status = " ";
- if (defined $hunks->[$i]{USE}) {
- $status = $hunks->[$i]{USE} ? "+" : "-";
- }
- printf "%s%2d: %s",
- $status,
- $i + 1,
- summarize_hunk($hunks->[$i]);
- }
- return $i;
-}
-
-my %patch_update_prompt_modes = (
- stage => {
- mode => N__("Stage mode change [y,n,q,a,d%s,?]? "),
- deletion => N__("Stage deletion [y,n,q,a,d%s,?]? "),
- addition => N__("Stage addition [y,n,q,a,d%s,?]? "),
- hunk => N__("Stage this hunk [y,n,q,a,d%s,?]? "),
- },
- stash => {
- mode => N__("Stash mode change [y,n,q,a,d%s,?]? "),
- deletion => N__("Stash deletion [y,n,q,a,d%s,?]? "),
- addition => N__("Stash addition [y,n,q,a,d%s,?]? "),
- hunk => N__("Stash this hunk [y,n,q,a,d%s,?]? "),
- },
- reset_head => {
- mode => N__("Unstage mode change [y,n,q,a,d%s,?]? "),
- deletion => N__("Unstage deletion [y,n,q,a,d%s,?]? "),
- addition => N__("Unstage addition [y,n,q,a,d%s,?]? "),
- hunk => N__("Unstage this hunk [y,n,q,a,d%s,?]? "),
- },
- reset_nothead => {
- mode => N__("Apply mode change to index [y,n,q,a,d%s,?]? "),
- deletion => N__("Apply deletion to index [y,n,q,a,d%s,?]? "),
- addition => N__("Apply addition to index [y,n,q,a,d%s,?]? "),
- hunk => N__("Apply this hunk to index [y,n,q,a,d%s,?]? "),
- },
- checkout_index => {
- mode => N__("Discard mode change from worktree [y,n,q,a,d%s,?]? "),
- deletion => N__("Discard deletion from worktree [y,n,q,a,d%s,?]? "),
- addition => N__("Discard addition from worktree [y,n,q,a,d%s,?]? "),
- hunk => N__("Discard this hunk from worktree [y,n,q,a,d%s,?]? "),
- },
- checkout_head => {
- mode => N__("Discard mode change from index and worktree [y,n,q,a,d%s,?]? "),
- deletion => N__("Discard deletion from index and worktree [y,n,q,a,d%s,?]? "),
- addition => N__("Discard addition from index and worktree [y,n,q,a,d%s,?]? "),
- hunk => N__("Discard this hunk from index and worktree [y,n,q,a,d%s,?]? "),
- },
- checkout_nothead => {
- mode => N__("Apply mode change to index and worktree [y,n,q,a,d%s,?]? "),
- deletion => N__("Apply deletion to index and worktree [y,n,q,a,d%s,?]? "),
- addition => N__("Apply addition to index and worktree [y,n,q,a,d%s,?]? "),
- hunk => N__("Apply this hunk to index and worktree [y,n,q,a,d%s,?]? "),
- },
- worktree_head => {
- mode => N__("Discard mode change from worktree [y,n,q,a,d%s,?]? "),
- deletion => N__("Discard deletion from worktree [y,n,q,a,d%s,?]? "),
- addition => N__("Discard addition from worktree [y,n,q,a,d%s,?]? "),
- hunk => N__("Discard this hunk from worktree [y,n,q,a,d%s,?]? "),
- },
- worktree_nothead => {
- mode => N__("Apply mode change to worktree [y,n,q,a,d%s,?]? "),
- deletion => N__("Apply deletion to worktree [y,n,q,a,d%s,?]? "),
- addition => N__("Apply addition to worktree [y,n,q,a,d%s,?]? "),
- hunk => N__("Apply this hunk to worktree [y,n,q,a,d%s,?]? "),
- },
-);
-
-sub patch_update_file {
- my $quit = 0;
- my ($ix, $num);
- my $path = shift;
- my ($head, @hunk) = parse_diff($path);
- ($head, my $mode, my $deletion, my $addition) = parse_diff_header($head);
- for (@{$head->{DISPLAY}}) {
- print;
- }
-
- if (@{$mode->{TEXT}}) {
- unshift @hunk, $mode;
- }
- if (@{$deletion->{TEXT}}) {
- foreach my $hunk (@hunk) {
- push @{$deletion->{TEXT}}, @{$hunk->{TEXT}};
- push @{$deletion->{DISPLAY}}, @{$hunk->{DISPLAY}};
- }
- @hunk = ($deletion);
- }
-
- $num = scalar @hunk;
- $ix = 0;
-
- while (1) {
- my ($prev, $next, $other, $undecided, $i);
- $other = '';
-
- last if ($ix and !$num);
- if ($num <= $ix) {
- $ix = 0;
- }
- for ($i = 0; $i < $ix; $i++) {
- if (!defined $hunk[$i]{USE}) {
- $prev = 1;
- $other .= ',k';
- last;
- }
- }
- if ($ix) {
- $other .= ',K';
- }
- for ($i = $ix + 1; $i < $num; $i++) {
- if (!defined $hunk[$i]{USE}) {
- $next = 1;
- $other .= ',j';
- last;
- }
- }
- if ($ix < $num - 1) {
- $other .= ',J';
- }
- if ($num > 1) {
- $other .= ',g,/';
- }
- for ($i = 0; $i < $num; $i++) {
- if (!defined $hunk[$i]{USE}) {
- $undecided = 1;
- last;
- }
- }
- last if (!$undecided && ($num || !$addition));
-
- if ($num) {
- if ($hunk[$ix]{TYPE} eq 'hunk' &&
- hunk_splittable($hunk[$ix]{TEXT})) {
- $other .= ',s';
- }
- if ($hunk[$ix]{TYPE} eq 'hunk') {
- $other .= ',e';
- }
- for (@{$hunk[$ix]{DISPLAY}}) {
- print;
- }
- }
- my $type = $num ? $hunk[$ix]{TYPE} : $head->{TYPE};
- print colored $prompt_color, "(", ($ix+1), "/", ($num ? $num : 1), ") ",
- sprintf(__($patch_update_prompt_modes{$patch_mode}{$type}), $other);
-
- my $line = prompt_single_character;
- last unless defined $line;
- if ($line) {
- if ($line =~ /^y/i) {
- if ($num) {
- $hunk[$ix]{USE} = 1;
- } else {
- $head->{USE} = 1;
- }
- }
- elsif ($line =~ /^n/i) {
- if ($num) {
- $hunk[$ix]{USE} = 0;
- } else {
- $head->{USE} = 0;
- }
- }
- elsif ($line =~ /^a/i) {
- if ($num) {
- while ($ix < $num) {
- if (!defined $hunk[$ix]{USE}) {
- $hunk[$ix]{USE} = 1;
- }
- $ix++;
- }
- } else {
- $head->{USE} = 1;
- $ix++;
- }
- next;
- }
- elsif ($line =~ /^g(.*)/) {
- my $response = $1;
- unless ($other =~ /g/) {
- error_msg __("No other hunks to goto\n");
- next;
- }
- my $no = $ix > 10 ? $ix - 10 : 0;
- while ($response eq '') {
- $no = display_hunks(\@hunk, $no);
- if ($no < $num) {
- print __("go to which hunk (<ret> to see more)? ");
- } else {
- print __("go to which hunk? ");
- }
- $response = <STDIN>;
- if (!defined $response) {
- $response = '';
- }
- chomp $response;
- }
- if ($response !~ /^\s*\d+\s*$/) {
- error_msg sprintf(__("Invalid number: '%s'\n"),
- $response);
- } elsif (0 < $response && $response <= $num) {
- $ix = $response - 1;
- } else {
- error_msg sprintf(__n("Sorry, only %d hunk available.\n",
- "Sorry, only %d hunks available.\n", $num), $num);
- }
- next;
- }
- elsif ($line =~ /^d/i) {
- if ($num) {
- while ($ix < $num) {
- if (!defined $hunk[$ix]{USE}) {
- $hunk[$ix]{USE} = 0;
- }
- $ix++;
- }
- } else {
- $head->{USE} = 0;
- $ix++;
- }
- next;
- }
- elsif ($line =~ /^q/i) {
- if ($num) {
- for ($i = 0; $i < $num; $i++) {
- if (!defined $hunk[$i]{USE}) {
- $hunk[$i]{USE} = 0;
- }
- }
- } elsif (!defined $head->{USE}) {
- $head->{USE} = 0;
- }
- $quit = 1;
- last;
- }
- elsif ($line =~ m|^/(.*)|) {
- my $regex = $1;
- unless ($other =~ m|/|) {
- error_msg __("No other hunks to search\n");
- next;
- }
- if ($regex eq "") {
- print colored $prompt_color, __("search for regex? ");
- $regex = <STDIN>;
- if (defined $regex) {
- chomp $regex;
- }
- }
- my $search_string;
- eval {
- $search_string = qr{$regex}m;
- };
- if ($@) {
- my ($err,$exp) = ($@, $1);
- $err =~ s/ at .*git-add--interactive line \d+, <STDIN> line \d+.*$//;
- error_msg sprintf(__("Malformed search regexp %s: %s\n"), $exp, $err);
- next;
- }
- my $iy = $ix;
- while (1) {
- my $text = join ("", @{$hunk[$iy]{TEXT}});
- last if ($text =~ $search_string);
- $iy++;
- $iy = 0 if ($iy >= $num);
- if ($ix == $iy) {
- error_msg __("No hunk matches the given pattern\n");
- last;
- }
- }
- $ix = $iy;
- next;
- }
- elsif ($line =~ /^K/) {
- if ($other =~ /K/) {
- $ix--;
- }
- else {
- error_msg __("No previous hunk\n");
- }
- next;
- }
- elsif ($line =~ /^J/) {
- if ($other =~ /J/) {
- $ix++;
- }
- else {
- error_msg __("No next hunk\n");
- }
- next;
- }
- elsif ($line =~ /^k/) {
- if ($other =~ /k/) {
- while (1) {
- $ix--;
- last if (!$ix ||
- !defined $hunk[$ix]{USE});
- }
- }
- else {
- error_msg __("No previous hunk\n");
- }
- next;
- }
- elsif ($line =~ /^j/) {
- if ($other !~ /j/) {
- error_msg __("No next hunk\n");
- next;
- }
- }
- elsif ($line =~ /^s/) {
- unless ($other =~ /s/) {
- error_msg __("Sorry, cannot split this hunk\n");
- next;
- }
- my @split = split_hunk($hunk[$ix]{TEXT}, $hunk[$ix]{DISPLAY});
- if (1 < @split) {
- print colored $header_color, sprintf(
- __n("Split into %d hunk.\n",
- "Split into %d hunks.\n",
- scalar(@split)), scalar(@split));
- }
- splice (@hunk, $ix, 1, @split);
- $num = scalar @hunk;
- next;
- }
- elsif ($line =~ /^e/) {
- unless ($other =~ /e/) {
- error_msg __("Sorry, cannot edit this hunk\n");
- next;
- }
- my $newhunk = edit_hunk_loop($head, \@hunk, $ix);
- if (defined $newhunk) {
- splice @hunk, $ix, 1, $newhunk;
- }
- }
- else {
- help_patch_cmd($other);
- next;
- }
- # soft increment
- while (1) {
- $ix++;
- last if ($ix >= $num ||
- !defined $hunk[$ix]{USE});
- }
- }
- }
-
- @hunk = coalesce_overlapping_hunks(@hunk) if ($num);
-
- my $n_lofs = 0;
- my @result = ();
- for (@hunk) {
- if ($_->{USE}) {
- push @result, @{$_->{TEXT}};
- }
- }
-
- if (@result or $head->{USE}) {
- my @patch = reassemble_patch($head->{TEXT}, @result);
- my $apply_routine = $patch_mode_flavour{APPLY};
- &$apply_routine(@patch);
- refresh();
- }
-
- print "\n";
- return $quit;
-}
-
-sub diff_cmd {
- my @mods = list_modified('index-only');
- @mods = grep { !($_->{BINARY}) } @mods;
- return if (!@mods);
- my (@them) = list_and_choose({ PROMPT => __('Review diff'),
- IMMEDIATE => 1,
- HEADER => $status_head, },
- @mods);
- return if (!@them);
- my $reference = (is_initial_commit()) ? get_empty_tree() : 'HEAD';
- system(qw(git diff -p --cached), $reference, '--',
- map { $_->{VALUE} } @them);
-}
-
-sub quit_cmd {
- print __("Bye.\n");
- exit(0);
-}
-
-sub help_cmd {
-# TRANSLATORS: please do not translate the command names
-# 'status', 'update', 'revert', etc.
- print colored $help_color, __ <<'EOF' ;
-status - show paths with changes
-update - add working tree state to the staged set of changes
-revert - revert staged set of changes back to the HEAD version
-patch - pick hunks and update selectively
-diff - view diff between HEAD and index
-add untracked - add contents of untracked files to the staged set of changes
-EOF
-}
-
-sub process_args {
- return unless @ARGV;
- my $arg = shift @ARGV;
- if ($arg =~ /--patch(?:=(.*))?/) {
- if (defined $1) {
- if ($1 eq 'reset') {
- $patch_mode = 'reset_head';
- $patch_mode_revision = 'HEAD';
- $arg = shift @ARGV or die __("missing --");
- if ($arg ne '--') {
- $patch_mode_revision = $arg;
-
- # NEEDSWORK: Instead of comparing to the literal "HEAD",
- # compare the commit objects instead so that other ways of
- # saying the same thing (such as "@") are also handled
- # appropriately.
- #
- # This applies to the cases below too.
- $patch_mode = ($arg eq 'HEAD' ?
- 'reset_head' : 'reset_nothead');
- $arg = shift @ARGV or die __("missing --");
- }
- } elsif ($1 eq 'checkout') {
- $arg = shift @ARGV or die __("missing --");
- if ($arg eq '--') {
- $patch_mode = 'checkout_index';
- } else {
- $patch_mode_revision = $arg;
- $patch_mode = ($arg eq 'HEAD' ?
- 'checkout_head' : 'checkout_nothead');
- $arg = shift @ARGV or die __("missing --");
- }
- } elsif ($1 eq 'worktree') {
- $arg = shift @ARGV or die __("missing --");
- if ($arg eq '--') {
- $patch_mode = 'checkout_index';
- } else {
- $patch_mode_revision = $arg;
- $patch_mode = ($arg eq 'HEAD' ?
- 'worktree_head' : 'worktree_nothead');
- $arg = shift @ARGV or die __("missing --");
- }
- } elsif ($1 eq 'stage' or $1 eq 'stash') {
- $patch_mode = $1;
- $arg = shift @ARGV or die __("missing --");
- } else {
- die sprintf(__("unknown --patch mode: %s"), $1);
- }
- } else {
- $patch_mode = 'stage';
- $arg = shift @ARGV or die __("missing --");
- }
- die sprintf(__("invalid argument %s, expecting --"),
- $arg) unless $arg eq "--";
- %patch_mode_flavour = %{$patch_modes{$patch_mode}};
- $patch_mode_only = 1;
- }
- elsif ($arg ne "--") {
- die sprintf(__("invalid argument %s, expecting --"), $arg);
- }
-}
-
-sub main_loop {
- my @cmd = ([ 'status', \&status_cmd, ],
- [ 'update', \&update_cmd, ],
- [ 'revert', \&revert_cmd, ],
- [ 'add untracked', \&add_untracked_cmd, ],
- [ 'patch', \&patch_update_cmd, ],
- [ 'diff', \&diff_cmd, ],
- [ 'quit', \&quit_cmd, ],
- [ 'help', \&help_cmd, ],
- );
- while (1) {
- my ($it) = list_and_choose({ PROMPT => __('What now'),
- SINGLETON => 1,
- LIST_FLAT => 4,
- HEADER => __('*** Commands ***'),
- ON_EOF => \&quit_cmd,
- IMMEDIATE => 1 }, @cmd);
- if ($it) {
- eval {
- $it->[1]->();
- };
- if ($@) {
- print "$@";
- }
- }
- }
-}
-
-process_args();
-refresh();
-if ($patch_mode_only) {
- patch_update_cmd();
-}
-else {
- status_cmd();
- main_loop();
-}
diff --git a/git-bisect.sh b/git-bisect.sh
deleted file mode 100755
index 405cf76f2a..0000000000
--- a/git-bisect.sh
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/bin/sh
-
-USAGE='[help|start|bad|good|new|old|terms|skip|next|reset|visualize|view|replay|log|run]'
-LONG_USAGE='git bisect help
- print this long help message.
-git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]
- [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]
- reset bisect state and start bisection.
-git bisect (bad|new) [<rev>]
- mark <rev> a known-bad revision/
- a revision after change in a given property.
-git bisect (good|old) [<rev>...]
- mark <rev>... known-good revisions/
- revisions before change in a given property.
-git bisect terms [--term-good | --term-bad]
- show the terms used for old and new commits (default: bad, good)
-git bisect skip [(<rev>|<range>)...]
- mark <rev>... untestable revisions.
-git bisect next
- find next bisection to test and check it out.
-git bisect reset [<commit>]
- finish bisection search and go back to commit.
-git bisect (visualize|view)
- show bisect status in gitk.
-git bisect replay <logfile>
- replay bisection log.
-git bisect log
- show bisect log.
-git bisect run <cmd>...
- use <cmd>... to automatically bisect.
-
-Please use "git help bisect" to get the full man page.'
-
-OPTIONS_SPEC=
-. git-sh-setup
-
-TERM_BAD=bad
-TERM_GOOD=good
-
-get_terms () {
- if test -s "$GIT_DIR/BISECT_TERMS"
- then
- {
- read TERM_BAD
- read TERM_GOOD
- } <"$GIT_DIR/BISECT_TERMS"
- fi
-}
-
-case "$#" in
-0)
- usage ;;
-*)
- cmd="$1"
- get_terms
- shift
- case "$cmd" in
- help)
- git bisect -h ;;
- start)
- git bisect--helper --bisect-start "$@" ;;
- bad|good|new|old|"$TERM_BAD"|"$TERM_GOOD")
- git bisect--helper --bisect-state "$cmd" "$@" ;;
- skip)
- git bisect--helper --bisect-skip "$@" || exit;;
- next)
- # Not sure we want "next" at the UI level anymore.
- git bisect--helper --bisect-next "$@" || exit ;;
- visualize|view)
- git bisect--helper --bisect-visualize "$@" || exit;;
- reset)
- git bisect--helper --bisect-reset "$@" ;;
- replay)
- git bisect--helper --bisect-replay "$@" || exit;;
- log)
- git bisect--helper --bisect-log || exit ;;
- run)
- git bisect--helper --bisect-run "$@" || exit;;
- terms)
- git bisect--helper --bisect-terms "$@" || exit;;
- *)
- usage ;;
- esac
-esac
diff --git a/git-compat-util.h b/git-compat-util.h
index 9bfd7ce76d..5b2b99c17c 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -97,8 +97,14 @@ struct strbuf;
# define BARF_UNLESS_AN_ARRAY(arr) \
BUILD_ASSERT_OR_ZERO(!__builtin_types_compatible_p(__typeof__(arr), \
__typeof__(&(arr)[0])))
+# define BARF_UNLESS_COPYABLE(dst, src) \
+ BUILD_ASSERT_OR_ZERO(__builtin_types_compatible_p(__typeof__(*(dst)), \
+ __typeof__(*(src))))
#else
# define BARF_UNLESS_AN_ARRAY(arr) 0
+# define BARF_UNLESS_COPYABLE(dst, src) \
+ BUILD_ASSERT_OR_ZERO(0 ? ((*(dst) = *(src)), 0) : \
+ sizeof(*(dst)) == sizeof(*(src)))
#endif
/*
* ARRAY_SIZE - get the number of elements in a visible array
@@ -225,6 +231,7 @@ struct strbuf;
#endif
#include <errno.h>
#include <limits.h>
+#include <locale.h>
#ifdef NEEDS_SYS_PARAM_H
#include <sys/param.h>
#endif
@@ -313,7 +320,9 @@ typedef unsigned long uintptr_t;
#ifdef PRECOMPOSE_UNICODE
#include "compat/precompose_utf8.h"
#else
-static inline const char *precompose_argv_prefix(int argc, const char **argv, const char *prefix)
+static inline const char *precompose_argv_prefix(int argc UNUSED,
+ const char **argv UNUSED,
+ const char *prefix)
{
return prefix;
}
@@ -330,6 +339,25 @@ static inline const char *precompose_string_if_needed(const char *in)
int compat_mkdir_wo_trailing_slash(const char*, mode_t);
#endif
+#ifdef time
+#undef time
+#endif
+static inline time_t git_time(time_t *tloc)
+{
+ struct timeval tv;
+
+ /*
+ * Avoid time(NULL), which can disagree with gettimeofday(2)
+ * and filesystem timestamps.
+ */
+ gettimeofday(&tv, NULL);
+
+ if (tloc)
+ *tloc = tv.tv_sec;
+ return tv.tv_sec;
+}
+#define time git_time
+
#ifdef NO_STRUCT_ITIMERVAL
struct itimerval {
struct timeval it_interval;
@@ -338,9 +366,13 @@ struct itimerval {
#endif
#ifdef NO_SETITIMER
-static inline int setitimer(int which, const struct itimerval *value, struct itimerval *newvalue) {
+static inline int git_setitimer(int which UNUSED,
+ const struct itimerval *value UNUSED,
+ struct itimerval *newvalue UNUSED) {
return 0; /* pretend success */
}
+#undef setitimer
+#define setitimer(which,value,ovalue) git_setitimer(which,value,ovalue)
#endif
#ifndef NO_LIBGEN_H
@@ -423,7 +455,7 @@ int lstat_cache_aware_rmdir(const char *path);
#endif
#ifndef has_dos_drive_prefix
-static inline int git_has_dos_drive_prefix(const char *path)
+static inline int git_has_dos_drive_prefix(const char *path UNUSED)
{
return 0;
}
@@ -431,7 +463,7 @@ static inline int git_has_dos_drive_prefix(const char *path)
#endif
#ifndef skip_dos_drive_prefix
-static inline int git_skip_dos_drive_prefix(char **path)
+static inline int git_skip_dos_drive_prefix(char **path UNUSED)
{
return 0;
}
@@ -846,12 +878,6 @@ int git_lstat(const char *, struct stat *);
#define pread git_pread
ssize_t git_pread(int fd, void *buf, size_t count, off_t offset);
#endif
-/*
- * Forward decl that will remind us if its twin in cache.h changes.
- * This function is used in compat/pread.c. But we can't include
- * cache.h there.
- */
-ssize_t read_in_full(int fd, void *buf, size_t count);
#ifdef NO_SETENV
#define setenv gitsetenv
@@ -1095,7 +1121,7 @@ int xstrncmpz(const char *s, const char *t, size_t len);
#define REALLOC_ARRAY(x, alloc) (x) = xrealloc((x), st_mult(sizeof(*(x)), (alloc)))
#define COPY_ARRAY(dst, src, n) copy_array((dst), (src), (n), sizeof(*(dst)) + \
- BUILD_ASSERT_OR_ZERO(sizeof(*(dst)) == sizeof(*(src))))
+ BARF_UNLESS_COPYABLE((dst), (src)))
static inline void copy_array(void *dst, const void *src, size_t n, size_t size)
{
if (n)
@@ -1103,13 +1129,18 @@ static inline void copy_array(void *dst, const void *src, size_t n, size_t size)
}
#define MOVE_ARRAY(dst, src, n) move_array((dst), (src), (n), sizeof(*(dst)) + \
- BUILD_ASSERT_OR_ZERO(sizeof(*(dst)) == sizeof(*(src))))
+ BARF_UNLESS_COPYABLE((dst), (src)))
static inline void move_array(void *dst, const void *src, size_t n, size_t size)
{
if (n)
memmove(dst, src, st_mult(size, n));
}
+#define DUP_ARRAY(dst, src, n) do { \
+ size_t dup_array_n_ = (n); \
+ COPY_ARRAY(ALLOC_ARRAY((dst), dup_array_n_), (src), dup_array_n_); \
+} while (0)
+
/*
* These functions help you allocate structs with flex arrays, and copy
* the data directly into the array. For example, if you had:
@@ -1207,6 +1238,7 @@ extern const unsigned char tolower_trans_tbl[256];
#undef isxdigit
extern const unsigned char sane_ctype[256];
+extern const signed char hexval_table[256];
#define GIT_SPACE 0x01
#define GIT_DIGIT 0x02
#define GIT_ALPHA 0x04
@@ -1269,6 +1301,25 @@ static inline int skip_iprefix(const char *str, const char *prefix,
return 0;
}
+/*
+ * Like skip_prefix_mem, but compare case-insensitively. Note that the
+ * comparison is done via tolower(), so it is strictly ASCII (no multi-byte
+ * characters or locale-specific conversions).
+ */
+static inline int skip_iprefix_mem(const char *buf, size_t len,
+ const char *prefix,
+ const char **out, size_t *outlen)
+{
+ do {
+ if (!*prefix) {
+ *out = buf;
+ *outlen = len;
+ return 1;
+ }
+ } while (len-- > 0 && tolower(*buf++) == tolower(*prefix++));
+ return 0;
+}
+
static inline int strtoul_ui(char const *s, int base, unsigned int *result)
{
unsigned long ul;
@@ -1339,6 +1390,11 @@ static inline int regexec_buf(const regex_t *preg, const char *buf, size_t size,
return regexec(preg, buf, nmatch, pmatch, eflags | REG_STARTEND);
}
+#ifdef USE_ENHANCED_BASIC_REGULAR_EXPRESSIONS
+int git_regcomp(regex_t *preg, const char *pattern, int cflags);
+#define regcomp git_regcomp
+#endif
+
#ifndef DIR_HAS_BSD_GROUP_SEMANTICS
# define FORCE_DIR_SET_GID S_ISGID
#else
@@ -1474,14 +1530,19 @@ int open_nofollow(const char *path, int flags);
#endif
#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
-static inline void flockfile(FILE *fh)
+static inline void git_flockfile(FILE *fh UNUSED)
{
; /* nothing */
}
-static inline void funlockfile(FILE *fh)
+static inline void git_funlockfile(FILE *fh UNUSED)
{
; /* nothing */
}
+#undef flockfile
+#undef funlockfile
+#undef getc_unlocked
+#define flockfile(fh) git_flockfile(fh)
+#define funlockfile(fh) git_funlockfile(fh)
#define getc_unlocked(fh) getc(fh)
#endif
diff --git a/git-difftool--helper.sh b/git-difftool--helper.sh
index 992124cc67..e4e820e680 100755
--- a/git-difftool--helper.sh
+++ b/git-difftool--helper.sh
@@ -75,6 +75,11 @@ then
merge_tool="$GIT_DIFF_TOOL"
else
merge_tool="$(get_merge_tool)"
+ subshell_exit_status=$?
+ if test $subshell_exit_status -gt 1
+ then
+ exit $subshell_exit_status
+ fi
fi
fi
diff --git a/git-gui/Makefile b/git-gui/Makefile
index 56c85a85c1..a0d5a4b28e 100644
--- a/git-gui/Makefile
+++ b/git-gui/Makefile
@@ -116,7 +116,7 @@ ifeq ($(uname_S),Darwin)
TKEXECUTABLE = $(shell basename "$(TKFRAMEWORK)" .app)
endif
-ifeq ($(findstring $(MAKEFLAGS),s),s)
+ifeq ($(findstring $(firstword -$(MAKEFLAGS)),s),s)
QUIET_GEN =
endif
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 9f99201bcc..1ff26170ff 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -97,7 +97,42 @@ merge_mode () {
test "$TOOL_MODE" = merge
}
+get_gui_default () {
+ if diff_mode
+ then
+ GUI_DEFAULT_KEY="difftool.guiDefault"
+ else
+ GUI_DEFAULT_KEY="mergetool.guiDefault"
+ fi
+ GUI_DEFAULT_CONFIG_LCASE=$(git config --default false --get "$GUI_DEFAULT_KEY" | tr 'A-Z' 'a-z')
+ if test "$GUI_DEFAULT_CONFIG_LCASE" = "auto"
+ then
+ if test -n "$DISPLAY"
+ then
+ GUI_DEFAULT=true
+ else
+ GUI_DEFAULT=false
+ fi
+ else
+ GUI_DEFAULT=$(git config --default false --bool --get "$GUI_DEFAULT_KEY")
+ subshell_exit_status=$?
+ if test $subshell_exit_status -ne 0
+ then
+ exit $subshell_exit_status
+ fi
+ fi
+ echo $GUI_DEFAULT
+}
+
gui_mode () {
+ if test -z "$GIT_MERGETOOL_GUI"
+ then
+ GIT_MERGETOOL_GUI=$(get_gui_default)
+ if test $? -ne 0
+ then
+ exit 2
+ fi
+ fi
test "$GIT_MERGETOOL_GUI" = true
}
@@ -467,6 +502,11 @@ get_merge_tool () {
is_guessed=false
# Check if a merge tool has been configured
merge_tool=$(get_configured_merge_tool)
+ subshell_exit_status=$?
+ if test $subshell_exit_status -gt "1"
+ then
+ exit $subshell_exit_status
+ fi
# Try to guess an appropriate merge tool if no tool has been set.
if test -z "$merge_tool"
then
diff --git a/git-mergetool.sh b/git-mergetool.sh
index f751d9cfe2..8a922893f7 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -451,7 +451,7 @@ print_noop_and_exit () {
main () {
prompt=$(git config --bool mergetool.prompt)
- GIT_MERGETOOL_GUI=false
+ GIT_MERGETOOL_GUI=
guessed_merge_tool=false
orderfile=
@@ -511,9 +511,14 @@ main () {
if test -z "$merge_tool"
then
- if ! merge_tool=$(get_merge_tool)
+ merge_tool=$(get_merge_tool)
+ subshell_exit_status=$?
+ if test $subshell_exit_status = 1
then
guessed_merge_tool=true
+ elif test $subshell_exit_status -gt 1
+ then
+ exit $subshell_exit_status
fi
fi
merge_keep_backup="$(git config --bool mergetool.keepBackup || echo true)"
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 2d0e44656c..01640a044b 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -153,7 +153,7 @@ for you to fetch changes up to %H:
if test $(git cat-file -t "$head") = tag
then
git cat-file tag "$head" |
- sed -n -e '1,/^$/d' -e '/^-----BEGIN PGP /q' -e p
+ sed -n -e '1,/^$/d' -e '/^-----BEGIN \(PGP\|SSH\|SIGNED\) /q' -e p
echo
echo "----------------------------------------------------------------"
fi &&
diff --git a/git-send-email.perl b/git-send-email.perl
index 5861e99a6e..89d8237e89 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -87,8 +87,10 @@ git send-email --dump-aliases
Automating:
--identity <str> * Use the sendemail.<id> options.
- --to-cmd <str> * Email To: via `<str> \$patch_path`
- --cc-cmd <str> * Email Cc: via `<str> \$patch_path`
+ --to-cmd <str> * Email To: via `<str> \$patch_path`.
+ --cc-cmd <str> * Email Cc: via `<str> \$patch_path`.
+ --header-cmd <str> * Add headers via `<str> \$patch_path`.
+ --no-header-cmd * Disable any header command in use.
--suppress-cc <str> * author, self, sob, cc, cccmd, body, bodycc, misc-by, all.
--[no-]cc-cover * Email Cc: addresses in the cover letter.
--[no-]to-cover * Email To: addresses in the cover letter.
@@ -202,7 +204,7 @@ my (@to,@cc,@xh,$envelope_sender,
$author,$sender,$smtp_authpass,$annotate,$compose,$time);
# Things we either get from config, *or* are overridden on the
# command-line.
-my ($no_cc, $no_to, $no_bcc, $no_identity);
+my ($no_cc, $no_to, $no_bcc, $no_identity, $no_header_cmd);
my (@config_to, @getopt_to);
my (@config_cc, @getopt_cc);
my (@config_bcc, @getopt_bcc);
@@ -220,6 +222,10 @@ my $compose_filename;
my $force = 0;
my $dump_aliases = 0;
+# Variables to prevent short format-patch options from being captured
+# as abbreviated send-email options
+my $reroll_count;
+
# Handle interactive edition of files.
my $multiedit;
my $editor;
@@ -265,7 +271,7 @@ sub do_edit {
# Variables with corresponding config settings
my ($suppress_from, $signed_off_by_cc);
my ($cover_cc, $cover_to);
-my ($to_cmd, $cc_cmd);
+my ($to_cmd, $cc_cmd, $header_cmd);
my ($smtp_server, $smtp_server_port, @smtp_server_options);
my ($smtp_authuser, $smtp_encryption, $smtp_ssl_cert_path);
my ($batch_size, $relogin_delay);
@@ -314,6 +320,7 @@ my %config_settings = (
"tocmd" => \$to_cmd,
"cc" => \@config_cc,
"cccmd" => \$cc_cmd,
+ "headercmd" => \$header_cmd,
"aliasfiletype" => \$aliasfiletype,
"bcc" => \@config_bcc,
"suppresscc" => \@suppress_cc,
@@ -515,6 +522,8 @@ my %options = (
"compose" => \$compose,
"quiet" => \$quiet,
"cc-cmd=s" => \$cc_cmd,
+ "header-cmd=s" => \$header_cmd,
+ "no-header-cmd" => \$no_header_cmd,
"suppress-from!" => \$suppress_from,
"no-suppress-from" => sub {$suppress_from = 0},
"suppress-cc=s" => \@suppress_cc,
@@ -542,6 +551,7 @@ my %options = (
"batch-size=i" => \$batch_size,
"relogin-delay=i" => \$relogin_delay,
"git-completion-helper" => \$git_completion_helper,
+ "v=s" => \$reroll_count,
);
$rc = GetOptions(%options);
@@ -782,19 +792,51 @@ if (@rev_list_opts) {
die __("Cannot run git format-patch from outside a repository\n")
unless $repo;
require File::Temp;
- push @files, $repo->command('format-patch', '-o', File::Temp::tempdir(CLEANUP => 1), @rev_list_opts);
+ push @files, $repo->command('format-patch', '-o', File::Temp::tempdir(CLEANUP => 1),
+ defined $reroll_count ? ('-v', $reroll_count) : (),
+ @rev_list_opts);
}
-@files = handle_backup_files(@files);
+if (defined $sender) {
+ $sender =~ s/^\s+|\s+$//g;
+ ($sender) = expand_aliases($sender);
+} else {
+ $sender = $repoauthor->() || $repocommitter->() || '';
+}
+
+# $sender could be an already sanitized address
+# (e.g. sendemail.from could be manually sanitized by user).
+# But it's a no-op to run sanitize_address on an already sanitized address.
+$sender = sanitize_address($sender);
+
+$time = time - scalar $#files;
if ($validate) {
+ # FIFOs can only be read once, exclude them from validation.
+ my @real_files = ();
foreach my $f (@files) {
unless (-p $f) {
- validate_patch($f, $target_xfer_encoding);
+ push(@real_files, $f);
}
}
+
+ # Run the loop once again to avoid gaps in the counter due to FIFO
+ # arguments provided by the user.
+ my $num = 1;
+ my $num_files = scalar @real_files;
+ $ENV{GIT_SENDEMAIL_FILE_TOTAL} = "$num_files";
+ foreach my $r (@real_files) {
+ $ENV{GIT_SENDEMAIL_FILE_COUNTER} = "$num";
+ pre_process_file($r, 1);
+ validate_patch($r, $target_xfer_encoding);
+ $num += 1;
+ }
+ delete $ENV{GIT_SENDEMAIL_FILE_COUNTER};
+ delete $ENV{GIT_SENDEMAIL_FILE_TOTAL};
}
+@files = handle_backup_files(@files);
+
if (@files) {
unless ($quiet) {
print $_,"\n" for (@files);
@@ -1043,18 +1085,6 @@ if (!$force) {
}
}
-if (defined $sender) {
- $sender =~ s/^\s+|\s+$//g;
- ($sender) = expand_aliases($sender);
-} else {
- $sender = $repoauthor->() || $repocommitter->() || '';
-}
-
-# $sender could be an already sanitized address
-# (e.g. sendemail.from could be manually sanitized by user).
-# But it's a no-op to run sanitize_address on an already sanitized address.
-$sender = sanitize_address($sender);
-
my $to_whom = __("To whom should the emails be sent (if anyone)?");
my $prompting = 0;
if (!@initial_to && !defined $to_cmd) {
@@ -1214,10 +1244,6 @@ sub make_message_id {
#print "new message id = $message_id\n"; # Was useful for debugging
}
-
-
-$time = time - scalar $#files;
-
sub unquote_rfc2047 {
local ($_) = @_;
my $charset;
@@ -1495,16 +1521,7 @@ sub file_name_is_absolute {
return File::Spec::Functions::file_name_is_absolute($path);
}
-# Prepares the email, then asks the user what to do.
-#
-# If the user chooses to send the email, it's sent and 1 is returned.
-# If the user chooses not to send the email, 0 is returned.
-# If the user decides they want to make further edits, -1 is returned and the
-# caller is expected to call send_message again after the edits are performed.
-#
-# If an error occurs sending the email, this just dies.
-
-sub send_message {
+sub gen_header {
my @recipients = unique_email_list(@to);
@cc = (grep { my $cc = extract_valid_address_or_die($_);
not grep { $cc eq $_ || $_ =~ /<\Q${cc}\E>$/ } @recipients
@@ -1530,7 +1547,7 @@ sub send_message {
To: $to${ccline}
Subject: $subject
Date: $date
-Message-Id: $message_id
+Message-ID: $message_id
";
if ($use_xmailer) {
$header .= "X-Mailer: git-send-email $gitversion\n";
@@ -1546,6 +1563,22 @@ Message-Id: $message_id
if (@xh) {
$header .= join("\n", @xh) . "\n";
}
+ my $recipients_ref = \@recipients;
+ return ($recipients_ref, $to, $date, $gitversion, $cc, $ccline, $header);
+}
+
+# Prepares the email, then asks the user what to do.
+#
+# If the user chooses to send the email, it's sent and 1 is returned.
+# If the user chooses not to send the email, 0 is returned.
+# If the user decides they want to make further edits, -1 is returned and the
+# caller is expected to call send_message again after the edits are performed.
+#
+# If an error occurs sending the email, this just dies.
+
+sub send_message {
+ my ($recipients_ref, $to, $date, $gitversion, $cc, $ccline, $header) = gen_header();
+ my @recipients = @$recipients_ref;
my @sendmail_parameters = ('-i', @recipients);
my $raw_from = $sender;
@@ -1735,11 +1768,8 @@ $in_reply_to = $initial_in_reply_to;
$references = $initial_in_reply_to || '';
$message_num = 0;
-# Prepares the email, prompts the user, sends it out
-# Returns 0 if an edit was done and the function should be called again, or 1
-# otherwise.
-sub process_file {
- my ($t) = @_;
+sub pre_process_file {
+ my ($t, $quiet) = @_;
open my $fh, "<", $t or die sprintf(__("can't open file %s"), $t);
@@ -1758,16 +1788,16 @@ sub process_file {
$subject = $initial_subject;
$message = "";
$message_num++;
- # First unfold multiline header fields
+ # Retrieve and unfold header fields.
+ my @header_lines = ();
while(<$fh>) {
last if /^\s*$/;
- if (/^\s+\S/ and @header) {
- chomp($header[$#header]);
- s/^\s+/ /;
- $header[$#header] .= $_;
- } else {
- push(@header, $_);
- }
+ push(@header_lines, $_);
+ }
+ @header = unfold_headers(@header_lines);
+ # Add computed headers, if applicable.
+ unless ($no_header_cmd || ! $header_cmd) {
+ push @header, invoke_header_cmd($header_cmd, $t);
}
# Now parse the header
foreach(@header) {
@@ -1825,7 +1855,7 @@ sub process_file {
$has_mime_version = 1;
push @xh, $_;
}
- elsif (/^Message-Id: (.*)/i) {
+ elsif (/^Message-ID: (.*)/i) {
$message_id = $1;
}
elsif (/^Content-Transfer-Encoding: (.*)/i) {
@@ -1893,9 +1923,9 @@ sub process_file {
}
close $fh;
- push @to, recipients_cmd("to-cmd", "to", $to_cmd, $t)
+ push @to, recipients_cmd("to-cmd", "to", $to_cmd, $t, $quiet)
if defined $to_cmd;
- push @cc, recipients_cmd("cc-cmd", "cc", $cc_cmd, $t)
+ push @cc, recipients_cmd("cc-cmd", "cc", $cc_cmd, $t, $quiet)
if defined $cc_cmd && !$suppress_cc{'cccmd'};
if ($broken_encoding{$t} && !$has_content_type) {
@@ -1954,6 +1984,15 @@ sub process_file {
@initial_to = @to;
}
}
+}
+
+# Prepares the email, prompts the user, and sends it out
+# Returns 0 if an edit was done and the function should be called again, or 1
+# on the email being successfully sent out.
+sub process_file {
+ my ($t) = @_;
+
+ pre_process_file($t, $quiet);
my $message_was_sent = send_message();
if ($message_was_sent == -1) {
@@ -1999,15 +2038,64 @@ foreach my $t (@files) {
}
}
+# Execute a command and return its output lines as an array. Blank
+# lines which do not appear at the end of the output are reported as
+# errors.
+sub execute_cmd {
+ my ($prefix, $cmd, $file) = @_;
+ my @lines = ();
+ my $seen_blank_line = 0;
+ open my $fh, "-|", "$cmd \Q$file\E"
+ or die sprintf(__("(%s) Could not execute '%s'"), $prefix, $cmd);
+ while (my $line = <$fh>) {
+ die sprintf(__("(%s) Malformed output from '%s'"), $prefix, $cmd)
+ if $seen_blank_line;
+ if ($line =~ /^$/) {
+ $seen_blank_line = $line =~ /^$/;
+ next;
+ }
+ push @lines, $line;
+ }
+ close $fh
+ or die sprintf(__("(%s) failed to close pipe to '%s'"), $prefix, $cmd);
+ return @lines;
+}
+
+# Process headers lines, unfolding multiline headers as defined by RFC
+# 2822.
+sub unfold_headers {
+ my @headers;
+ foreach(@_) {
+ last if /^\s*$/;
+ if (/^\s+\S/ and @headers) {
+ chomp($headers[$#headers]);
+ s/^\s+/ /;
+ $headers[$#headers] .= $_;
+ } else {
+ push(@headers, $_);
+ }
+ }
+ return @headers;
+}
+
+# Invoke the provided CMD with FILE as an argument, which should
+# output RFC 2822 email headers. Fold multiline headers and return the
+# headers as an array.
+sub invoke_header_cmd {
+ my ($cmd, $file) = @_;
+ my @lines = execute_cmd("header-cmd", $header_cmd, $file);
+ return unfold_headers(@lines);
+}
+
# Execute a command (e.g. $to_cmd) to get a list of email addresses
# and return a results array
sub recipients_cmd {
- my ($prefix, $what, $cmd, $file) = @_;
-
+ my ($prefix, $what, $cmd, $file, $quiet) = @_;
+ my @lines = ();
my @addresses = ();
- open my $fh, "-|", "$cmd \Q$file\E"
- or die sprintf(__("(%s) Could not execute '%s'"), $prefix, $cmd);
- while (my $address = <$fh>) {
+
+ @lines = execute_cmd($prefix, $cmd, $file);
+ for my $address (@lines) {
$address =~ s/^\s*//g;
$address =~ s/\s*$//g;
$address = sanitize_address($address);
@@ -2016,8 +2104,6 @@ sub recipients_cmd {
printf(__("(%s) Adding %s: %s from: '%s'\n"),
$prefix, $what, $address, $cmd) unless $quiet;
}
- close $fh
- or die sprintf(__("(%s) failed to close pipe to '%s'"), $prefix, $cmd);
return @addresses;
}
@@ -2088,10 +2174,21 @@ sub validate_patch {
chdir($repo->wc_path() or $repo->repo_path())
or die("chdir: $!");
local $ENV{"GIT_DIR"} = $repo->repo_path();
+
+ my ($recipients_ref, $to, $date, $gitversion, $cc, $ccline, $header) = gen_header();
+
+ require File::Temp;
+ my ($header_filehandle, $header_filename) = File::Temp::tempfile(
+ TEMPLATE => ".gitsendemail.header.XXXXXX",
+ DIR => $repo->repo_path(),
+ UNLINK => 1,
+ );
+ print $header_filehandle $header;
+
my @cmd = ("git", "hook", "run", "--ignore-missing",
$hook_name, "--");
- my @cmd_msg = (@cmd, "<patch>");
- my @cmd_run = (@cmd, $target);
+ my @cmd_msg = (@cmd, "<patch>", "<header>");
+ my @cmd_run = (@cmd, $target, $header_filename);
$hook_error = system_or_msg(\@cmd_run, undef, "@cmd_msg");
chdir($cwd_save) or die("chdir: $!");
}
diff --git a/git-submodule.sh b/git-submodule.sh
index 5e5d21c010..7f9582d923 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -244,6 +244,9 @@ cmd_update()
-q|--quiet)
quiet=1
;;
+ -v|--verbose)
+ quiet=0
+ ;;
--progress)
progress=1
;;
@@ -343,7 +346,6 @@ cmd_update()
${recursive:+--recursive} \
${init:+--init} \
${nofetch:+--no-fetch} \
- ${wt_prefix:+--prefix "$wt_prefix"} \
${rebase:+--rebase} \
${merge:+--merge} \
${checkout:+--checkout} \
@@ -557,7 +559,7 @@ cmd_sync()
cmd_absorbgitdirs()
{
- git submodule--helper absorbgitdirs --prefix "$wt_prefix" "$@"
+ git ${wt_prefix:+-C "$wt_prefix"} submodule--helper absorbgitdirs "$@"
}
# This loop parses the command line arguments to find the
diff --git a/zlib.c b/git-zlib.c
index d594cba3fc..d43bbeb6da 100644
--- a/zlib.c
+++ b/git-zlib.c
@@ -2,7 +2,8 @@
* zlib wrappers to make sure we don't silently miss errors
* at init time.
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "git-zlib.h"
static const char *zerr_to_string(int status)
{
diff --git a/git-zlib.h b/git-zlib.h
new file mode 100644
index 0000000000..d8a670aff9
--- /dev/null
+++ b/git-zlib.h
@@ -0,0 +1,28 @@
+#ifndef GIT_ZLIB_H
+#define GIT_ZLIB_H
+
+typedef struct git_zstream {
+ z_stream z;
+ unsigned long avail_in;
+ unsigned long avail_out;
+ unsigned long total_in;
+ unsigned long total_out;
+ unsigned char *next_in;
+ unsigned char *next_out;
+} git_zstream;
+
+void git_inflate_init(git_zstream *);
+void git_inflate_init_gzip_only(git_zstream *);
+void git_inflate_end(git_zstream *);
+int git_inflate(git_zstream *, int flush);
+
+void git_deflate_init(git_zstream *, int level);
+void git_deflate_init_gzip(git_zstream *, int level);
+void git_deflate_init_raw(git_zstream *, int level);
+void git_deflate_end(git_zstream *);
+int git_deflate_abort(git_zstream *);
+int git_deflate_end_gently(git_zstream *);
+int git_deflate(git_zstream *, int flush);
+unsigned long git_deflate_bound(git_zstream *, unsigned long);
+
+#endif /* GIT_ZLIB_H */
diff --git a/git.c b/git.c
index da411c5382..45899be826 100644
--- a/git.c
+++ b/git.c
@@ -1,10 +1,17 @@
#include "builtin.h"
#include "config.h"
+#include "environment.h"
#include "exec-cmd.h"
+#include "gettext.h"
#include "help.h"
+#include "pager.h"
#include "run-command.h"
#include "alias.h"
+#include "replace-object.h"
+#include "setup.h"
#include "shallow.h"
+#include "trace.h"
+#include "trace2.h"
#define RUN_SETUP (1<<0)
#define RUN_SETUP_GENTLY (1<<1)
@@ -14,9 +21,8 @@
* RUN_SETUP for reading from the configuration file.
*/
#define NEED_WORK_TREE (1<<3)
-#define SUPPORT_SUPER_PREFIX (1<<4)
-#define DELAY_PAGER_CONFIG (1<<5)
-#define NO_PARSEOPT (1<<6) /* parse-options is not used */
+#define DELAY_PAGER_CONFIG (1<<4)
+#define NO_PARSEOPT (1<<5) /* parse-options is not used */
struct cmd_struct {
const char *cmd;
@@ -29,8 +35,7 @@ const char git_usage_string[] =
" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]\n"
" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
- " [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n"
- " <command> [<args>]");
+ " [--config-env=<name>=<envvar>] <command> [<args>]");
const char git_more_info_string[] =
N_("'git help -a' and 'git help -g' list available subcommands and some\n"
@@ -226,20 +231,6 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
setenv(GIT_WORK_TREE_ENVIRONMENT, cmd, 1);
if (envchanged)
*envchanged = 1;
- } else if (!strcmp(cmd, "--super-prefix")) {
- if (*argc < 2) {
- fprintf(stderr, _("no prefix given for --super-prefix\n" ));
- usage(git_usage_string);
- }
- setenv(GIT_SUPER_PREFIX_ENVIRONMENT, (*argv)[1], 1);
- if (envchanged)
- *envchanged = 1;
- (*argv)++;
- (*argc)--;
- } else if (skip_prefix(cmd, "--super-prefix=", &cmd)) {
- setenv(GIT_SUPER_PREFIX_ENVIRONMENT, cmd, 1);
- if (envchanged)
- *envchanged = 1;
} else if (!strcmp(cmd, "--bare")) {
char *cwd = xgetcwd();
is_bare_repository_cfg = 1;
@@ -446,14 +437,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
use_pager = 1;
if (run_setup && startup_info->have_repository)
/* get_git_dir() may set up repo, avoid that */
- trace_repo_setup(prefix);
+ trace_repo_setup();
commit_pager_choice();
- if (!help && get_super_prefix()) {
- if (!(p->option & SUPPORT_SUPER_PREFIX))
- die(_("%s doesn't support --super-prefix"), p->cmd);
- }
-
if (!help && p->option & NEED_WORK_TREE)
setup_work_tree();
@@ -492,7 +478,7 @@ static struct cmd_struct commands[] = {
{ "annotate", cmd_annotate, RUN_SETUP },
{ "apply", cmd_apply, RUN_SETUP_GENTLY },
{ "archive", cmd_archive, RUN_SETUP_GENTLY },
- { "bisect--helper", cmd_bisect__helper, RUN_SETUP },
+ { "bisect", cmd_bisect, RUN_SETUP },
{ "blame", cmd_blame, RUN_SETUP },
{ "branch", cmd_branch, RUN_SETUP | DELAY_PAGER_CONFIG },
{ "bugreport", cmd_bugreport, RUN_SETUP_GENTLY },
@@ -504,7 +490,7 @@ static struct cmd_struct commands[] = {
{ "check-ref-format", cmd_check_ref_format, NO_PARSEOPT },
{ "checkout", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },
{ "checkout--worker", cmd_checkout__worker,
- RUN_SETUP | NEED_WORK_TREE | SUPPORT_SUPER_PREFIX },
+ RUN_SETUP | NEED_WORK_TREE },
{ "checkout-index", cmd_checkout_index,
RUN_SETUP | NEED_WORK_TREE},
{ "cherry", cmd_cherry, RUN_SETUP },
@@ -528,7 +514,6 @@ static struct cmd_struct commands[] = {
{ "diff-index", cmd_diff_index, RUN_SETUP | NO_PARSEOPT },
{ "diff-tree", cmd_diff_tree, RUN_SETUP | NO_PARSEOPT },
{ "difftool", cmd_difftool, RUN_SETUP_GENTLY },
- { "env--helper", cmd_env__helper },
{ "fast-export", cmd_fast_export, RUN_SETUP },
{ "fast-import", cmd_fast_import, RUN_SETUP | NO_PARSEOPT },
{ "fetch", cmd_fetch, RUN_SETUP },
@@ -539,7 +524,7 @@ static struct cmd_struct commands[] = {
{ "format-patch", cmd_format_patch, RUN_SETUP },
{ "fsck", cmd_fsck, RUN_SETUP },
{ "fsck-objects", cmd_fsck, RUN_SETUP },
- { "fsmonitor--daemon", cmd_fsmonitor__daemon, SUPPORT_SUPER_PREFIX | RUN_SETUP },
+ { "fsmonitor--daemon", cmd_fsmonitor__daemon, RUN_SETUP },
{ "gc", cmd_gc, RUN_SETUP },
{ "get-tar-commit-id", cmd_get_tar_commit_id, NO_PARSEOPT },
{ "grep", cmd_grep, RUN_SETUP_GENTLY },
@@ -583,7 +568,7 @@ static struct cmd_struct commands[] = {
{ "pull", cmd_pull, RUN_SETUP | NEED_WORK_TREE },
{ "push", cmd_push, RUN_SETUP },
{ "range-diff", cmd_range_diff, RUN_SETUP | USE_PAGER },
- { "read-tree", cmd_read_tree, RUN_SETUP | SUPPORT_SUPER_PREFIX},
+ { "read-tree", cmd_read_tree, RUN_SETUP },
{ "rebase", cmd_rebase, RUN_SETUP | NEED_WORK_TREE },
{ "receive-pack", cmd_receive_pack },
{ "reflog", cmd_reflog, RUN_SETUP },
@@ -605,12 +590,12 @@ static struct cmd_struct commands[] = {
{ "show-branch", cmd_show_branch, RUN_SETUP },
{ "show-index", cmd_show_index, RUN_SETUP_GENTLY },
{ "show-ref", cmd_show_ref, RUN_SETUP },
- { "sparse-checkout", cmd_sparse_checkout, RUN_SETUP | NEED_WORK_TREE },
+ { "sparse-checkout", cmd_sparse_checkout, RUN_SETUP },
{ "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
{ "stash", cmd_stash, RUN_SETUP | NEED_WORK_TREE },
{ "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
{ "stripspace", cmd_stripspace },
- { "submodule--helper", cmd_submodule__helper, RUN_SETUP | SUPPORT_SUPER_PREFIX | NO_PARSEOPT },
+ { "submodule--helper", cmd_submodule__helper, RUN_SETUP },
{ "switch", cmd_switch, RUN_SETUP | NEED_WORK_TREE },
{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
{ "tag", cmd_tag, RUN_SETUP | DELAY_PAGER_CONFIG },
@@ -727,9 +712,6 @@ static void execv_dashed_external(const char **argv)
struct child_process cmd = CHILD_PROCESS_INIT;
int status;
- if (get_super_prefix())
- die(_("%s doesn't support --super-prefix"), argv[0]);
-
if (use_pager == -1 && !is_builtin(argv[0]))
use_pager = check_pager_config(argv[0]);
commit_pager_choice();
@@ -787,7 +769,7 @@ static int run_argv(int *argcp, const char ***argv)
if (!done_alias)
handle_builtin(*argcp, *argv);
else if (get_builtin(**argv)) {
- struct strvec args = STRVEC_INIT;
+ struct child_process cmd = CHILD_PROCESS_INIT;
int i;
/*
@@ -799,23 +781,23 @@ static int run_argv(int *argcp, const char ***argv)
*/
trace2_cmd_name("_run_git_alias_");
- if (get_super_prefix())
- die("%s doesn't support --super-prefix", **argv);
-
commit_pager_choice();
- strvec_push(&args, "git");
+ strvec_push(&cmd.args, "git");
for (i = 0; i < *argcp; i++)
- strvec_push(&args, (*argv)[i]);
+ strvec_push(&cmd.args, (*argv)[i]);
- trace_argv_printf(args.v, "trace: exec:");
+ trace_argv_printf(cmd.args.v, "trace: exec:");
/*
* if we fail because the command is not found, it is
* OK to return. Otherwise, we just pass along the status code.
*/
- i = run_command_v_opt_tr2(args.v, RUN_SILENT_EXEC_FAILURE |
- RUN_CLEAN_ON_EXIT | RUN_WAIT_AFTER_CLEAN, "git_alias");
+ cmd.silent_exec_failure = 1;
+ cmd.clean_on_exit = 1;
+ cmd.wait_after_clean = 1;
+ cmd.trace2_child_class = "git_alias";
+ i = run_command(&cmd);
if (i >= 0 || errno != ENOENT)
exit(i);
die("could not execute builtin %s", **argv);
@@ -894,12 +876,8 @@ int cmd_main(int argc, const char **argv)
argv++;
argc--;
handle_options(&argv, &argc, NULL);
- if (argc > 0) {
- if (!strcmp("--version", argv[0]) || !strcmp("-v", argv[0]))
- argv[0] = "version";
- else if (!strcmp("--help", argv[0]) || !strcmp("-h", argv[0]))
- argv[0] = "help";
- } else {
+
+ if (!argc) {
/* The user didn't specify a command; give them help */
commit_pager_choice();
printf(_("usage: %s\n\n"), git_usage_string);
@@ -907,6 +885,12 @@ int cmd_main(int argc, const char **argv)
printf("\n%s\n", _(git_more_info_string));
exit(1);
}
+
+ if (!strcmp("--version", argv[0]) || !strcmp("-v", argv[0]))
+ argv[0] = "version";
+ else if (!strcmp("--help", argv[0]) || !strcmp("-h", argv[0]))
+ argv[0] = "help";
+
cmd = argv[0];
/*
diff --git a/gitk-git/gitk b/gitk-git/gitk
index 0ae7d68590..df3ba2ea99 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -353,6 +353,16 @@ proc parseviewrevs {view revs} {
return $ret
}
+# Escapes a list of filter paths to be passed to git log via stdin. Note that
+# paths must not be quoted.
+proc escape_filter_paths {paths} {
+ set escaped [list]
+ foreach path $paths {
+ lappend escaped [string map {\\ \\\\ "\ " "\\\ "} $path]
+ }
+ return $escaped
+}
+
# Start off a git log process and arrange to read its output
proc start_rev_list {view} {
global startmsecs commitidx viewcomplete curview
@@ -405,14 +415,17 @@ proc start_rev_list {view} {
if {$revs eq {}} {
return 0
}
- set args [concat $vflags($view) $revs]
+ set args $vflags($view)
} else {
+ set revs {}
set args $vorigargs($view)
}
if {[catch {
set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
- --parents --boundary $args "--" $files] r]
+ --parents --boundary $args --stdin \
+ "<<[join [concat $revs "--" \
+ [escape_filter_paths $files]] "\\n"]"] r]
} err]} {
error_popup "[mc "Error executing git log:"] $err"
return 0
@@ -554,13 +567,20 @@ proc updatecommits {} {
set revs $newrevs
set vposids($view) [lsort -unique [concat $oldpos $vposids($view)]]
}
- set args [concat $vflags($view) $revs --not $oldpos]
+ set args $vflags($view)
+ foreach r $oldpos {
+ lappend revs "^$r"
+ }
} else {
+ set revs {}
set args $vorigargs($view)
}
if {[catch {
set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
- --parents --boundary $args "--" $vfilelimit($view)] r]
+ --parents --boundary $args --stdin \
+ "<<[join [concat $revs "--" \
+ [escape_filter_paths \
+ $vfilelimit($view)]] "\\n"]"] r]
} err]} {
error_popup "[mc "Error executing git log:"] $err"
return
@@ -10231,10 +10251,16 @@ proc getallcommits {} {
foreach id $seeds {
lappend ids "^$id"
}
+ lappend ids "--"
}
}
if {$ids ne {}} {
- set fd [open [concat $cmd $ids] r]
+ if {$ids eq "--all"} {
+ set cmd [concat $cmd "--all"]
+ } else {
+ set cmd [concat $cmd --stdin "<<[join $ids "\\n"]"]
+ }
+ set fd [open $cmd r]
fconfigure $fd -blocking 0
incr allcommits
nowbusy allcommits
diff --git a/gpg-interface.c b/gpg-interface.c
index f877a1ea56..19a3471a0b 100644
--- a/gpg-interface.c
+++ b/gpg-interface.c
@@ -1,13 +1,30 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "commit.h"
#include "config.h"
+#include "date.h"
+#include "gettext.h"
#include "run-command.h"
#include "strbuf.h"
#include "dir.h"
+#include "ident.h"
#include "gpg-interface.h"
+#include "path.h"
#include "sigchain.h"
#include "tempfile.h"
#include "alias.h"
+#include "wrapper.h"
+
+static int git_gpg_config(const char *, const char *, void *);
+
+static void gpg_interface_lazy_init(void)
+{
+ static int done;
+
+ if (done)
+ return;
+ done = 1;
+ git_config(git_gpg_config, NULL);
+}
static char *configured_signing_key;
static const char *ssh_default_key_command, *ssh_allowed_signers, *ssh_revocation_file;
@@ -632,8 +649,10 @@ int check_signature(struct signature_check *sigc,
struct gpg_format *fmt;
int status;
+ gpg_interface_lazy_init();
+
sigc->result = 'N';
- sigc->trust_level = -1;
+ sigc->trust_level = TRUST_UNDEFINED;
fmt = get_format_by_sig(signature);
if (!fmt)
@@ -695,11 +714,13 @@ int parse_signature(const char *buf, size_t size, struct strbuf *payload, struct
void set_signing_key(const char *key)
{
+ gpg_interface_lazy_init();
+
free(configured_signing_key);
configured_signing_key = xstrdup(key);
}
-int git_gpg_config(const char *var, const char *value, void *cb UNUSED)
+static int git_gpg_config(const char *var, const char *value, void *cb UNUSED)
{
struct gpg_format *fmt = NULL;
char *fmtname = NULL;
@@ -888,6 +909,8 @@ static const char *get_ssh_key_id(void) {
/* Returns a textual but unique representation of the signing key */
const char *get_signing_key_id(void)
{
+ gpg_interface_lazy_init();
+
if (use_format->get_key_id) {
return use_format->get_key_id();
}
@@ -898,6 +921,8 @@ const char *get_signing_key_id(void)
const char *get_signing_key(void)
{
+ gpg_interface_lazy_init();
+
if (configured_signing_key)
return configured_signing_key;
if (use_format->get_default_key) {
@@ -923,6 +948,8 @@ const char *gpg_trust_level_to_str(enum signature_trust_level level)
int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *signing_key)
{
+ gpg_interface_lazy_init();
+
return use_format->sign_buffer(buffer, signature, signing_key);
}
@@ -977,9 +1004,13 @@ static int sign_buffer_gpg(struct strbuf *buffer, struct strbuf *signature,
break; /* found */
}
ret |= !cp;
+ if (ret) {
+ error(_("gpg failed to sign the data:\n%s"),
+ gpg_status.len ? gpg_status.buf : "(no gpg output)");
+ strbuf_release(&gpg_status);
+ return -1;
+ }
strbuf_release(&gpg_status);
- if (ret)
- return error(_("gpg failed to sign the data"));
/* Strip CR from the line endings, in case we are on Windows. */
remove_cr_after(signature, bottom);
@@ -998,6 +1029,7 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature,
char *ssh_signing_key_file = NULL;
struct strbuf ssh_signature_filename = STRBUF_INIT;
const char *literal_key = NULL;
+ int literal_ssh_key = 0;
if (!signing_key || signing_key[0] == '\0')
return error(
@@ -1005,6 +1037,7 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature,
if (is_literal_ssh_key(signing_key, &literal_key)) {
/* A literal ssh key */
+ literal_ssh_key = 1;
key_file = mks_tempfile_t(".git_signing_key_tmpXXXXXX");
if (!key_file)
return error_errno(
@@ -1019,7 +1052,7 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature,
ssh_signing_key_file = strbuf_detach(&key_file->filename, NULL);
} else {
/* We assume a file */
- ssh_signing_key_file = expand_user_path(signing_key, 1);
+ ssh_signing_key_file = interpolate_path(signing_key, 1);
}
buffer_file = mks_tempfile_t(".git_signing_buffer_tmpXXXXXX");
@@ -1039,8 +1072,10 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature,
"-Y", "sign",
"-n", "git",
"-f", ssh_signing_key_file,
- buffer_file->filename.buf,
NULL);
+ if (literal_ssh_key)
+ strvec_push(&signer.args, "-U");
+ strvec_push(&signer.args, buffer_file->filename.buf);
sigchain_push(SIGPIPE, SIG_IGN);
ret = pipe_command(&signer, NULL, 0, NULL, 0, &signer_stderr, 0);
diff --git a/gpg-interface.h b/gpg-interface.h
index 8a9ef41779..143cdc1c02 100644
--- a/gpg-interface.h
+++ b/gpg-interface.h
@@ -79,7 +79,6 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature,
*/
const char *gpg_trust_level_to_str(enum signature_trust_level level);
-int git_gpg_config(const char *, const char *, void *);
void set_signing_key(const char *);
const char *get_signing_key(void);
diff --git a/graph.c b/graph.c
index 568b6e7cd4..2a9dc430fa 100644
--- a/graph.c
+++ b/graph.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
#include "config.h"
#include "commit.h"
#include "color.h"
diff --git a/grep.c b/grep.c
index 52a894c989..f00986c451 100644
--- a/grep.c
+++ b/grep.c
@@ -1,7 +1,10 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
+#include "gettext.h"
#include "grep.h"
+#include "hex.h"
#include "object-store.h"
+#include "pretty.h"
#include "userdiff.h"
#include "xdiff-interface.h"
#include "diff.h"
@@ -9,6 +12,7 @@
#include "commit.h"
#include "quote.h"
#include "help.h"
+#include "wrapper.h"
static int grep_source_load(struct grep_source *gs);
static int grep_source_is_binary(struct grep_source *gs,
@@ -262,6 +266,31 @@ static void pcre2_free(void *pointer, MAYBE_UNUSED void *memory_data)
free(pointer);
}
+static int pcre2_jit_functional(void)
+{
+ static int jit_working = -1;
+ pcre2_code *code;
+ size_t off;
+ int err;
+
+ if (jit_working != -1)
+ return jit_working;
+
+ /*
+ * Try to JIT compile a simple pattern to probe if the JIT is
+ * working in general. It might fail for systems where creating
+ * memory mappings for runtime code generation is restricted.
+ */
+ code = pcre2_compile((PCRE2_SPTR)".", 1, 0, &err, &off, NULL);
+ if (!code)
+ return 0;
+
+ jit_working = pcre2_jit_compile(code, PCRE2_JIT_COMPLETE) == 0;
+ pcre2_code_free(code);
+
+ return jit_working;
+}
+
static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt)
{
int error;
@@ -293,7 +322,16 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
options |= PCRE2_CASELESS;
}
if (!opt->ignore_locale && is_utf8_locale() && !literal)
- options |= (PCRE2_UTF | PCRE2_MATCH_INVALID_UTF);
+ options |= (PCRE2_UTF | PCRE2_UCP | PCRE2_MATCH_INVALID_UTF);
+
+#ifndef GIT_PCRE2_VERSION_10_35_OR_HIGHER
+ /*
+ * Work around a JIT bug related to invalid Unicode character handling
+ * fixed in 10.35:
+ * https://github.com/PCRE2Project/pcre2/commit/c21bd977547d
+ */
+ options &= ~PCRE2_UCP;
+#endif
#ifndef GIT_PCRE2_VERSION_10_36_OR_HIGHER
/* Work around https://bugs.exim.org/show_bug.cgi?id=2642 fixed in 10.36 */
@@ -317,8 +355,29 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
pcre2_config(PCRE2_CONFIG_JIT, &p->pcre2_jit_on);
if (p->pcre2_jit_on) {
jitret = pcre2_jit_compile(p->pcre2_pattern, PCRE2_JIT_COMPLETE);
- if (jitret)
- die("Couldn't JIT the PCRE2 pattern '%s', got '%d'\n", p->pattern, jitret);
+ if (jitret == PCRE2_ERROR_NOMEMORY && !pcre2_jit_functional()) {
+ /*
+ * Even though pcre2_config(PCRE2_CONFIG_JIT, ...)
+ * indicated JIT support, the library might still
+ * fail to generate JIT code for various reasons,
+ * e.g. when SELinux's 'deny_execmem' or PaX's
+ * MPROTECT prevent creating W|X memory mappings.
+ *
+ * Instead of faling hard, fall back to interpreter
+ * mode, just as if the pattern was prefixed with
+ * '(*NO_JIT)'.
+ */
+ p->pcre2_jit_on = 0;
+ return;
+ } else if (jitret) {
+ int need_clip = p->patternlen > 64;
+ int clip_len = need_clip ? 64 : p->patternlen;
+ die("Couldn't JIT the PCRE2 pattern '%.*s'%s, got '%d'%s",
+ clip_len, p->pattern, need_clip ? "..." : "", jitret,
+ pcre2_jit_functional()
+ ? "\nPerhaps prefix (*NO_JIT) to your pattern?"
+ : "");
+ }
/*
* The pcre2_config(PCRE2_CONFIG_JIT, ...) call just
@@ -708,6 +767,7 @@ void compile_grep_patterns(struct grep_opt *opt)
{
struct grep_pat *p;
struct grep_expr *header_expr = prep_header_patterns(opt);
+ int extended = 0;
for (p = opt->pattern_list; p; p = p->next) {
switch (p->token) {
@@ -717,14 +777,14 @@ void compile_grep_patterns(struct grep_opt *opt)
compile_regexp(p, opt);
break;
default:
- opt->extended = 1;
+ extended = 1;
break;
}
}
if (opt->all_match || opt->no_body_match || header_expr)
- opt->extended = 1;
- else if (!opt->extended)
+ extended = 1;
+ else if (!extended)
return;
p = opt->pattern_list;
@@ -768,11 +828,11 @@ static void free_pattern_expr(struct grep_expr *x)
free(x);
}
-void free_grep_patterns(struct grep_opt *opt)
+static void free_grep_pat(struct grep_pat *pattern)
{
struct grep_pat *p, *n;
- for (p = opt->pattern_list; p; p = n) {
+ for (p = pattern; p; p = n) {
n = p->next;
switch (p->token) {
case GREP_PATTERN: /* atom */
@@ -789,10 +849,15 @@ void free_grep_patterns(struct grep_opt *opt)
}
free(p);
}
+}
- if (!opt->extended)
- return;
- free_pattern_expr(opt->pattern_expression);
+void free_grep_patterns(struct grep_opt *opt)
+{
+ free_grep_pat(opt->pattern_list);
+ free_grep_pat(opt->header_list);
+
+ if (opt->pattern_expression)
+ free_pattern_expr(opt->pattern_expression);
}
static const char *end_of_line(const char *cp, unsigned long *left)
@@ -971,8 +1036,6 @@ static int match_expr_eval(struct grep_opt *opt, struct grep_expr *x,
{
int h = 0;
- if (!x)
- die("Not a valid grep expression");
switch (x->node) {
case GREP_NODE_TRUE:
h = 1;
@@ -1052,7 +1115,7 @@ static int match_line(struct grep_opt *opt,
struct grep_pat *p;
int hit = 0;
- if (opt->extended)
+ if (opt->pattern_expression)
return match_expr(opt, bol, eol, ctx, col, icol,
collect_hits);
@@ -1370,7 +1433,7 @@ static int should_lookahead(struct grep_opt *opt)
{
struct grep_pat *p;
- if (opt->extended)
+ if (opt->pattern_expression)
return 0; /* punt for too complex stuff */
if (opt->invert)
return 0;
diff --git a/grep.h b/grep.h
index bdcadce61b..c59592e3bd 100644
--- a/grep.h
+++ b/grep.h
@@ -7,6 +7,9 @@
#if (PCRE2_MAJOR >= 10 && PCRE2_MINOR >= 36) || PCRE2_MAJOR >= 11
#define GIT_PCRE2_VERSION_10_36_OR_HIGHER
#endif
+#if (PCRE2_MAJOR >= 10 && PCRE2_MINOR >= 35) || PCRE2_MAJOR >= 11
+#define GIT_PCRE2_VERSION_10_35_OR_HIGHER
+#endif
#if (PCRE2_MAJOR >= 10 && PCRE2_MINOR >= 34) || PCRE2_MAJOR >= 11
#define GIT_PCRE2_VERSION_10_34_OR_HIGHER
#endif
@@ -151,7 +154,6 @@ struct grep_opt {
#define GREP_BINARY_TEXT 2
int binary;
int allow_textconv;
- int extended;
int use_reflog_filter;
int relative;
int pathname;
diff --git a/hash-ll.h b/hash-ll.h
new file mode 100644
index 0000000000..8050925137
--- /dev/null
+++ b/hash-ll.h
@@ -0,0 +1,276 @@
+#ifndef HASH_LL_H
+#define HASH_LL_H
+
+#if defined(SHA1_APPLE)
+#include <CommonCrypto/CommonDigest.h>
+#elif defined(SHA1_OPENSSL)
+#include <openssl/sha.h>
+#elif defined(SHA1_DC)
+#include "sha1dc_git.h"
+#else /* SHA1_BLK */
+#include "block-sha1/sha1.h"
+#endif
+
+#if defined(SHA256_NETTLE)
+#include "sha256/nettle.h"
+#elif defined(SHA256_GCRYPT)
+#define SHA256_NEEDS_CLONE_HELPER
+#include "sha256/gcrypt.h"
+#elif defined(SHA256_OPENSSL)
+#include <openssl/sha.h>
+#else
+#include "sha256/block/sha256.h"
+#endif
+
+#ifndef platform_SHA_CTX
+/*
+ * platform's underlying implementation of SHA-1; could be OpenSSL,
+ * blk_SHA, Apple CommonCrypto, etc... Note that the relevant
+ * SHA-1 header may have already defined platform_SHA_CTX for our
+ * own implementations like block-sha1, so we list
+ * the default for OpenSSL compatible SHA-1 implementations here.
+ */
+#define platform_SHA_CTX SHA_CTX
+#define platform_SHA1_Init SHA1_Init
+#define platform_SHA1_Update SHA1_Update
+#define platform_SHA1_Final SHA1_Final
+#endif
+
+#define git_SHA_CTX platform_SHA_CTX
+#define git_SHA1_Init platform_SHA1_Init
+#define git_SHA1_Update platform_SHA1_Update
+#define git_SHA1_Final platform_SHA1_Final
+
+#ifndef platform_SHA256_CTX
+#define platform_SHA256_CTX SHA256_CTX
+#define platform_SHA256_Init SHA256_Init
+#define platform_SHA256_Update SHA256_Update
+#define platform_SHA256_Final SHA256_Final
+#endif
+
+#define git_SHA256_CTX platform_SHA256_CTX
+#define git_SHA256_Init platform_SHA256_Init
+#define git_SHA256_Update platform_SHA256_Update
+#define git_SHA256_Final platform_SHA256_Final
+
+#ifdef platform_SHA256_Clone
+#define git_SHA256_Clone platform_SHA256_Clone
+#endif
+
+#ifdef SHA1_MAX_BLOCK_SIZE
+#include "compat/sha1-chunked.h"
+#undef git_SHA1_Update
+#define git_SHA1_Update git_SHA1_Update_Chunked
+#endif
+
+static inline void git_SHA1_Clone(git_SHA_CTX *dst, const git_SHA_CTX *src)
+{
+ memcpy(dst, src, sizeof(*dst));
+}
+
+#ifndef SHA256_NEEDS_CLONE_HELPER
+static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *src)
+{
+ memcpy(dst, src, sizeof(*dst));
+}
+#endif
+
+/*
+ * Note that these constants are suitable for indexing the hash_algos array and
+ * comparing against each other, but are otherwise arbitrary, so they should not
+ * be exposed to the user or serialized to disk. To know whether a
+ * git_hash_algo struct points to some usable hash function, test the format_id
+ * field for being non-zero. Use the name field for user-visible situations and
+ * the format_id field for fixed-length fields on disk.
+ */
+/* An unknown hash function. */
+#define GIT_HASH_UNKNOWN 0
+/* SHA-1 */
+#define GIT_HASH_SHA1 1
+/* SHA-256 */
+#define GIT_HASH_SHA256 2
+/* Number of algorithms supported (including unknown). */
+#define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1)
+
+/* "sha1", big-endian */
+#define GIT_SHA1_FORMAT_ID 0x73686131
+
+/* The length in bytes and in hex digits of an object name (SHA-1 value). */
+#define GIT_SHA1_RAWSZ 20
+#define GIT_SHA1_HEXSZ (2 * GIT_SHA1_RAWSZ)
+/* The block size of SHA-1. */
+#define GIT_SHA1_BLKSZ 64
+
+/* "s256", big-endian */
+#define GIT_SHA256_FORMAT_ID 0x73323536
+
+/* The length in bytes and in hex digits of an object name (SHA-256 value). */
+#define GIT_SHA256_RAWSZ 32
+#define GIT_SHA256_HEXSZ (2 * GIT_SHA256_RAWSZ)
+/* The block size of SHA-256. */
+#define GIT_SHA256_BLKSZ 64
+
+/* The length in byte and in hex digits of the largest possible hash value. */
+#define GIT_MAX_RAWSZ GIT_SHA256_RAWSZ
+#define GIT_MAX_HEXSZ GIT_SHA256_HEXSZ
+/* The largest possible block size for any supported hash. */
+#define GIT_MAX_BLKSZ GIT_SHA256_BLKSZ
+
+struct object_id {
+ unsigned char hash[GIT_MAX_RAWSZ];
+ int algo; /* XXX requires 4-byte alignment */
+};
+
+#define GET_OID_QUIETLY 01
+#define GET_OID_COMMIT 02
+#define GET_OID_COMMITTISH 04
+#define GET_OID_TREE 010
+#define GET_OID_TREEISH 020
+#define GET_OID_BLOB 040
+#define GET_OID_FOLLOW_SYMLINKS 0100
+#define GET_OID_RECORD_PATH 0200
+#define GET_OID_ONLY_TO_DIE 04000
+#define GET_OID_REQUIRE_PATH 010000
+
+#define GET_OID_DISAMBIGUATORS \
+ (GET_OID_COMMIT | GET_OID_COMMITTISH | \
+ GET_OID_TREE | GET_OID_TREEISH | \
+ GET_OID_BLOB)
+
+enum get_oid_result {
+ FOUND = 0,
+ MISSING_OBJECT = -1, /* The requested object is missing */
+ SHORT_NAME_AMBIGUOUS = -2,
+ /* The following only apply when symlinks are followed */
+ DANGLING_SYMLINK = -4, /*
+ * The initial symlink is there, but
+ * (transitively) points to a missing
+ * in-tree file
+ */
+ SYMLINK_LOOP = -5,
+ NOT_DIR = -6, /*
+ * Somewhere along the symlink chain, a path is
+ * requested which contains a file as a
+ * non-final element.
+ */
+};
+
+/* A suitably aligned type for stack allocations of hash contexts. */
+union git_hash_ctx {
+ git_SHA_CTX sha1;
+ git_SHA256_CTX sha256;
+};
+typedef union git_hash_ctx git_hash_ctx;
+
+typedef void (*git_hash_init_fn)(git_hash_ctx *ctx);
+typedef void (*git_hash_clone_fn)(git_hash_ctx *dst, const git_hash_ctx *src);
+typedef void (*git_hash_update_fn)(git_hash_ctx *ctx, const void *in, size_t len);
+typedef void (*git_hash_final_fn)(unsigned char *hash, git_hash_ctx *ctx);
+typedef void (*git_hash_final_oid_fn)(struct object_id *oid, git_hash_ctx *ctx);
+
+struct git_hash_algo {
+ /*
+ * The name of the algorithm, as appears in the config file and in
+ * messages.
+ */
+ const char *name;
+
+ /* A four-byte version identifier, used in pack indices. */
+ uint32_t format_id;
+
+ /* The length of the hash in binary. */
+ size_t rawsz;
+
+ /* The length of the hash in hex characters. */
+ size_t hexsz;
+
+ /* The block size of the hash. */
+ size_t blksz;
+
+ /* The hash initialization function. */
+ git_hash_init_fn init_fn;
+
+ /* The hash context cloning function. */
+ git_hash_clone_fn clone_fn;
+
+ /* The hash update function. */
+ git_hash_update_fn update_fn;
+
+ /* The hash finalization function. */
+ git_hash_final_fn final_fn;
+
+ /* The hash finalization function for object IDs. */
+ git_hash_final_oid_fn final_oid_fn;
+
+ /* The OID of the empty tree. */
+ const struct object_id *empty_tree;
+
+ /* The OID of the empty blob. */
+ const struct object_id *empty_blob;
+
+ /* The all-zeros OID. */
+ const struct object_id *null_oid;
+};
+extern const struct git_hash_algo hash_algos[GIT_HASH_NALGOS];
+
+/*
+ * Return a GIT_HASH_* constant based on the name. Returns GIT_HASH_UNKNOWN if
+ * the name doesn't match a known algorithm.
+ */
+int hash_algo_by_name(const char *name);
+/* Identical, except based on the format ID. */
+int hash_algo_by_id(uint32_t format_id);
+/* Identical, except based on the length. */
+int hash_algo_by_length(int len);
+/* Identical, except for a pointer to struct git_hash_algo. */
+static inline int hash_algo_by_ptr(const struct git_hash_algo *p)
+{
+ return p - hash_algos;
+}
+
+const struct object_id *null_oid(void);
+
+static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)
+{
+ /*
+ * Teach the compiler that there are only two possibilities of hash size
+ * here, so that it can optimize for this case as much as possible.
+ */
+ if (algop->rawsz == GIT_MAX_RAWSZ)
+ return memcmp(sha1, sha2, GIT_MAX_RAWSZ);
+ return memcmp(sha1, sha2, GIT_SHA1_RAWSZ);
+}
+
+static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)
+{
+ /*
+ * We write this here instead of deferring to hashcmp so that the
+ * compiler can properly inline it and avoid calling memcmp.
+ */
+ if (algop->rawsz == GIT_MAX_RAWSZ)
+ return !memcmp(sha1, sha2, GIT_MAX_RAWSZ);
+ return !memcmp(sha1, sha2, GIT_SHA1_RAWSZ);
+}
+
+static inline void oidcpy(struct object_id *dst, const struct object_id *src)
+{
+ memcpy(dst->hash, src->hash, GIT_MAX_RAWSZ);
+ dst->algo = src->algo;
+}
+
+static inline struct object_id *oiddup(const struct object_id *src)
+{
+ struct object_id *dst = xmalloc(sizeof(struct object_id));
+ oidcpy(dst, src);
+ return dst;
+}
+
+static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop)
+{
+ oid->algo = hash_algo_by_ptr(algop);
+}
+
+const char *empty_tree_oid_hex(void);
+const char *empty_blob_oid_hex(void);
+
+#endif
diff --git a/hash-lookup.c b/hash-lookup.c
index b98ed5e11e..bb54dfde9c 100644
--- a/hash-lookup.c
+++ b/hash-lookup.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "hash.h"
#include "hash-lookup.h"
static uint32_t take2(const struct object_id *oid, size_t ofs)
diff --git a/hash.h b/hash.h
index 36b64165fc..615ae0691d 100644
--- a/hash.h
+++ b/hash.h
@@ -1,217 +1,11 @@
#ifndef HASH_H
#define HASH_H
-#include "git-compat-util.h"
+#include "hash-ll.h"
#include "repository.h"
-#if defined(SHA1_APPLE)
-#include <CommonCrypto/CommonDigest.h>
-#elif defined(SHA1_OPENSSL)
-#include <openssl/sha.h>
-#elif defined(SHA1_DC)
-#include "sha1dc_git.h"
-#else /* SHA1_BLK */
-#include "block-sha1/sha1.h"
-#endif
-
-#if defined(SHA256_NETTLE)
-#include "sha256/nettle.h"
-#elif defined(SHA256_GCRYPT)
-#define SHA256_NEEDS_CLONE_HELPER
-#include "sha256/gcrypt.h"
-#elif defined(SHA256_OPENSSL)
-#include <openssl/sha.h>
-#else
-#include "sha256/block/sha256.h"
-#endif
-
-#ifndef platform_SHA_CTX
-/*
- * platform's underlying implementation of SHA-1; could be OpenSSL,
- * blk_SHA, Apple CommonCrypto, etc... Note that the relevant
- * SHA-1 header may have already defined platform_SHA_CTX for our
- * own implementations like block-sha1, so we list
- * the default for OpenSSL compatible SHA-1 implementations here.
- */
-#define platform_SHA_CTX SHA_CTX
-#define platform_SHA1_Init SHA1_Init
-#define platform_SHA1_Update SHA1_Update
-#define platform_SHA1_Final SHA1_Final
-#endif
-
-#define git_SHA_CTX platform_SHA_CTX
-#define git_SHA1_Init platform_SHA1_Init
-#define git_SHA1_Update platform_SHA1_Update
-#define git_SHA1_Final platform_SHA1_Final
-
-#ifndef platform_SHA256_CTX
-#define platform_SHA256_CTX SHA256_CTX
-#define platform_SHA256_Init SHA256_Init
-#define platform_SHA256_Update SHA256_Update
-#define platform_SHA256_Final SHA256_Final
-#endif
-
-#define git_SHA256_CTX platform_SHA256_CTX
-#define git_SHA256_Init platform_SHA256_Init
-#define git_SHA256_Update platform_SHA256_Update
-#define git_SHA256_Final platform_SHA256_Final
-
-#ifdef platform_SHA256_Clone
-#define git_SHA256_Clone platform_SHA256_Clone
-#endif
-
-#ifdef SHA1_MAX_BLOCK_SIZE
-#include "compat/sha1-chunked.h"
-#undef git_SHA1_Update
-#define git_SHA1_Update git_SHA1_Update_Chunked
-#endif
-
-static inline void git_SHA1_Clone(git_SHA_CTX *dst, const git_SHA_CTX *src)
-{
- memcpy(dst, src, sizeof(*dst));
-}
-
-#ifndef SHA256_NEEDS_CLONE_HELPER
-static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *src)
-{
- memcpy(dst, src, sizeof(*dst));
-}
-#endif
-
-/*
- * Note that these constants are suitable for indexing the hash_algos array and
- * comparing against each other, but are otherwise arbitrary, so they should not
- * be exposed to the user or serialized to disk. To know whether a
- * git_hash_algo struct points to some usable hash function, test the format_id
- * field for being non-zero. Use the name field for user-visible situations and
- * the format_id field for fixed-length fields on disk.
- */
-/* An unknown hash function. */
-#define GIT_HASH_UNKNOWN 0
-/* SHA-1 */
-#define GIT_HASH_SHA1 1
-/* SHA-256 */
-#define GIT_HASH_SHA256 2
-/* Number of algorithms supported (including unknown). */
-#define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1)
-
-/* "sha1", big-endian */
-#define GIT_SHA1_FORMAT_ID 0x73686131
-
-/* The length in bytes and in hex digits of an object name (SHA-1 value). */
-#define GIT_SHA1_RAWSZ 20
-#define GIT_SHA1_HEXSZ (2 * GIT_SHA1_RAWSZ)
-/* The block size of SHA-1. */
-#define GIT_SHA1_BLKSZ 64
-
-/* "s256", big-endian */
-#define GIT_SHA256_FORMAT_ID 0x73323536
-
-/* The length in bytes and in hex digits of an object name (SHA-256 value). */
-#define GIT_SHA256_RAWSZ 32
-#define GIT_SHA256_HEXSZ (2 * GIT_SHA256_RAWSZ)
-/* The block size of SHA-256. */
-#define GIT_SHA256_BLKSZ 64
-
-/* The length in byte and in hex digits of the largest possible hash value. */
-#define GIT_MAX_RAWSZ GIT_SHA256_RAWSZ
-#define GIT_MAX_HEXSZ GIT_SHA256_HEXSZ
-/* The largest possible block size for any supported hash. */
-#define GIT_MAX_BLKSZ GIT_SHA256_BLKSZ
-
-struct object_id {
- unsigned char hash[GIT_MAX_RAWSZ];
- int algo; /* XXX requires 4-byte alignment */
-};
-
-/* A suitably aligned type for stack allocations of hash contexts. */
-union git_hash_ctx {
- git_SHA_CTX sha1;
- git_SHA256_CTX sha256;
-};
-typedef union git_hash_ctx git_hash_ctx;
-
-typedef void (*git_hash_init_fn)(git_hash_ctx *ctx);
-typedef void (*git_hash_clone_fn)(git_hash_ctx *dst, const git_hash_ctx *src);
-typedef void (*git_hash_update_fn)(git_hash_ctx *ctx, const void *in, size_t len);
-typedef void (*git_hash_final_fn)(unsigned char *hash, git_hash_ctx *ctx);
-typedef void (*git_hash_final_oid_fn)(struct object_id *oid, git_hash_ctx *ctx);
-
-struct git_hash_algo {
- /*
- * The name of the algorithm, as appears in the config file and in
- * messages.
- */
- const char *name;
-
- /* A four-byte version identifier, used in pack indices. */
- uint32_t format_id;
-
- /* The length of the hash in binary. */
- size_t rawsz;
-
- /* The length of the hash in hex characters. */
- size_t hexsz;
-
- /* The block size of the hash. */
- size_t blksz;
-
- /* The hash initialization function. */
- git_hash_init_fn init_fn;
-
- /* The hash context cloning function. */
- git_hash_clone_fn clone_fn;
-
- /* The hash update function. */
- git_hash_update_fn update_fn;
-
- /* The hash finalization function. */
- git_hash_final_fn final_fn;
-
- /* The hash finalization function for object IDs. */
- git_hash_final_oid_fn final_oid_fn;
-
- /* The OID of the empty tree. */
- const struct object_id *empty_tree;
-
- /* The OID of the empty blob. */
- const struct object_id *empty_blob;
-
- /* The all-zeros OID. */
- const struct object_id *null_oid;
-};
-extern const struct git_hash_algo hash_algos[GIT_HASH_NALGOS];
-
-/*
- * Return a GIT_HASH_* constant based on the name. Returns GIT_HASH_UNKNOWN if
- * the name doesn't match a known algorithm.
- */
-int hash_algo_by_name(const char *name);
-/* Identical, except based on the format ID. */
-int hash_algo_by_id(uint32_t format_id);
-/* Identical, except based on the length. */
-int hash_algo_by_length(int len);
-/* Identical, except for a pointer to struct git_hash_algo. */
-static inline int hash_algo_by_ptr(const struct git_hash_algo *p)
-{
- return p - hash_algos;
-}
-
#define the_hash_algo the_repository->hash_algo
-const struct object_id *null_oid(void);
-
-static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)
-{
- /*
- * Teach the compiler that there are only two possibilities of hash size
- * here, so that it can optimize for this case as much as possible.
- */
- if (algop->rawsz == GIT_MAX_RAWSZ)
- return memcmp(sha1, sha2, GIT_MAX_RAWSZ);
- return memcmp(sha1, sha2, GIT_SHA1_RAWSZ);
-}
-
static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)
{
return hashcmp_algop(sha1, sha2, the_hash_algo);
@@ -227,17 +21,6 @@ static inline int oidcmp(const struct object_id *oid1, const struct object_id *o
return hashcmp_algop(oid1->hash, oid2->hash, algop);
}
-static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop)
-{
- /*
- * We write this here instead of deferring to hashcmp so that the
- * compiler can properly inline it and avoid calling memcmp.
- */
- if (algop->rawsz == GIT_MAX_RAWSZ)
- return !memcmp(sha1, sha2, GIT_MAX_RAWSZ);
- return !memcmp(sha1, sha2, GIT_SHA1_RAWSZ);
-}
-
static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2)
{
return hasheq_algop(sha1, sha2, the_hash_algo);
@@ -263,12 +46,6 @@ static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)
memcpy(sha_dst, sha_src, the_hash_algo->rawsz);
}
-static inline void oidcpy(struct object_id *dst, const struct object_id *src)
-{
- memcpy(dst->hash, src->hash, GIT_MAX_RAWSZ);
- dst->algo = src->algo;
-}
-
/* Like oidcpy() but zero-pads the unused bytes in dst's hash array. */
static inline void oidcpy_with_padding(struct object_id *dst,
const struct object_id *src)
@@ -285,13 +62,6 @@ static inline void oidcpy_with_padding(struct object_id *dst,
dst->algo = src->algo;
}
-static inline struct object_id *oiddup(const struct object_id *src)
-{
- struct object_id *dst = xmalloc(sizeof(struct object_id));
- oidcpy(dst, src);
- return dst;
-}
-
static inline void hashclr(unsigned char *hash)
{
memset(hash, 0, the_hash_algo->rawsz);
@@ -329,12 +99,4 @@ static inline int is_empty_tree_oid(const struct object_id *oid)
return oideq(oid, the_hash_algo->empty_tree);
}
-static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop)
-{
- oid->algo = hash_algo_by_ptr(algop);
-}
-
-const char *empty_tree_oid_hex(void);
-const char *empty_blob_oid_hex(void);
-
#endif
diff --git a/hashmap.c b/hashmap.c
index cf5fea87eb..ee45ef0085 100644
--- a/hashmap.c
+++ b/hashmap.c
@@ -1,7 +1,7 @@
/*
* Generic implementation of hash-based key value mappings.
*/
-#include "cache.h"
+#include "git-compat-util.h"
#include "hashmap.h"
#define FNV32_BASE ((unsigned int) 0x811c9dc5)
diff --git a/hashmap.h b/hashmap.h
index 7251687d73..2695f3d3a6 100644
--- a/hashmap.h
+++ b/hashmap.h
@@ -1,7 +1,7 @@
#ifndef HASHMAP_H
#define HASHMAP_H
-#include "hash.h"
+#include "hash-ll.h"
/*
* Generic implementation of hash-based key-value mappings.
@@ -270,7 +270,7 @@ void hashmap_clear_(struct hashmap *map, ssize_t offset);
#define hashmap_clear(map) hashmap_clear_(map, -1)
/*
- * Similar to hashmap_clear(), except that the table is no deallocated; it
+ * Similar to hashmap_clear(), except that the table is not deallocated; it
* is merely zeroed out but left the same size as before. If the hashmap
* will be reused, this avoids the overhead of deallocating and
* reallocating map->table. As with hashmap_clear(), you may need to free
diff --git a/help.c b/help.c
index d04542d826..5d7637dce9 100644
--- a/help.c
+++ b/help.c
@@ -1,9 +1,11 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "config.h"
#include "builtin.h"
#include "exec-cmd.h"
#include "run-command.h"
#include "levenshtein.h"
+#include "gettext.h"
#include "help.h"
#include "command-list.h"
#include "string-list.h"
@@ -540,7 +542,8 @@ static struct cmdnames aliases;
#define AUTOCORRECT_NEVER (-2)
#define AUTOCORRECT_IMMEDIATELY (-1)
-static int git_unknown_cmd_config(const char *var, const char *value, void *cb)
+static int git_unknown_cmd_config(const char *var, const char *value,
+ void *cb UNUSED)
{
const char *p;
@@ -563,7 +566,7 @@ static int git_unknown_cmd_config(const char *var, const char *value, void *cb)
if (skip_prefix(var, "alias.", &p))
add_cmdname(&aliases, p, strlen(p));
- return git_default_config(var, value, cb);
+ return 0;
}
static int levenshtein_compare(const void *p1, const void *p2)
@@ -757,7 +760,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)
struct strbuf buf = STRBUF_INIT;
int build_options = 0;
const char * const usage[] = {
- N_("git version [<options>]"),
+ N_("git version [--build-options]"),
NULL
};
struct option options[] = {
diff --git a/hex.c b/hex.c
index 4f64d34696..7bb440e794 100644
--- a/hex.c
+++ b/hex.c
@@ -1,4 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "hash.h"
+#include "hex.h"
const signed char hexval_table[256] = {
-1, -1, -1, -1, -1, -1, -1, -1, /* 00-07 */
diff --git a/hex.h b/hex.h
new file mode 100644
index 0000000000..7df4b3c460
--- /dev/null
+++ b/hex.h
@@ -0,0 +1,84 @@
+#ifndef HEX_H
+#define HEX_H
+
+#include "hash-ll.h"
+
+extern const signed char hexval_table[256];
+static inline unsigned int hexval(unsigned char c)
+{
+ return hexval_table[c];
+}
+
+/*
+ * Convert two consecutive hexadecimal digits into a char. Return a
+ * negative value on error. Don't run over the end of short strings.
+ */
+static inline int hex2chr(const char *s)
+{
+ unsigned int val = hexval(s[0]);
+ return (val & ~0xf) ? val : (val << 4) | hexval(s[1]);
+}
+
+/*
+ * Try to read a SHA1 in hexadecimal format from the 40 characters
+ * starting at hex. Write the 20-byte result to sha1 in binary form.
+ * Return 0 on success. Reading stops if a NUL is encountered in the
+ * input, so it is safe to pass this function an arbitrary
+ * null-terminated string.
+ */
+int get_sha1_hex(const char *hex, unsigned char *sha1);
+int get_oid_hex(const char *hex, struct object_id *sha1);
+
+/* Like get_oid_hex, but for an arbitrary hash algorithm. */
+int get_oid_hex_algop(const char *hex, struct object_id *oid, const struct git_hash_algo *algop);
+
+/*
+ * Read `len` pairs of hexadecimal digits from `hex` and write the
+ * values to `binary` as `len` bytes. Return 0 on success, or -1 if
+ * the input does not consist of hex digits).
+ */
+int hex_to_bytes(unsigned char *binary, const char *hex, size_t len);
+
+/*
+ * Convert a binary hash in "unsigned char []" or an object name in
+ * "struct object_id *" to its hex equivalent. The `_r` variant is reentrant,
+ * and writes the NUL-terminated output to the buffer `out`, which must be at
+ * least `GIT_MAX_HEXSZ + 1` bytes, and returns a pointer to out for
+ * convenience.
+ *
+ * The non-`_r` variant returns a static buffer, but uses a ring of 4
+ * buffers, making it safe to make multiple calls for a single statement, like:
+ *
+ * printf("%s -> %s", hash_to_hex(one), hash_to_hex(two));
+ * printf("%s -> %s", oid_to_hex(one), oid_to_hex(two));
+ */
+char *hash_to_hex_algop_r(char *buffer, const unsigned char *hash, const struct git_hash_algo *);
+char *oid_to_hex_r(char *out, const struct object_id *oid);
+char *hash_to_hex_algop(const unsigned char *hash, const struct git_hash_algo *); /* static buffer result! */
+char *hash_to_hex(const unsigned char *hash); /* same static buffer */
+char *oid_to_hex(const struct object_id *oid); /* same static buffer */
+
+/*
+ * Parse a 40-character hexadecimal object ID starting from hex, updating the
+ * pointer specified by end when parsing stops. The resulting object ID is
+ * stored in oid. Returns 0 on success. Parsing will stop on the first NUL or
+ * other invalid character. end is only updated on success; otherwise, it is
+ * unmodified.
+ */
+int parse_oid_hex(const char *hex, struct object_id *oid, const char **end);
+
+/* Like parse_oid_hex, but for an arbitrary hash algorithm. */
+int parse_oid_hex_algop(const char *hex, struct object_id *oid, const char **end,
+ const struct git_hash_algo *algo);
+
+
+/*
+ * These functions work like get_oid_hex and parse_oid_hex, but they will parse
+ * a hex value for any algorithm. The algorithm is detected based on the length
+ * and the algorithm in use is returned. If this is not a hex object ID in any
+ * algorithm, returns GIT_HASH_UNKNOWN.
+ */
+int get_oid_hex_any(const char *hex, struct object_id *oid);
+int parse_oid_hex_any(const char *hex, struct object_id *oid, const char **end);
+
+#endif
diff --git a/hook.c b/hook.c
index a493939a4f..3ca5e60895 100644
--- a/hook.c
+++ b/hook.c
@@ -1,7 +1,11 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "advice.h"
+#include "gettext.h"
#include "hook.h"
+#include "path.h"
#include "run-command.h"
#include "config.h"
+#include "strbuf.h"
const char *find_hook(const char *name)
{
@@ -43,9 +47,9 @@ int hook_exists(const char *name)
}
static int pick_next_hook(struct child_process *cp,
- struct strbuf *out,
+ struct strbuf *out UNUSED,
void *pp_cb,
- void **pp_task_cb)
+ void **pp_task_cb UNUSED)
{
struct hook_cb_data *hook_cb = pp_cb;
const char *hook_path = hook_cb->hook_path;
@@ -55,6 +59,11 @@ static int pick_next_hook(struct child_process *cp,
cp->no_stdin = 1;
strvec_pushv(&cp->env, hook_cb->options->env.v);
+ /* reopen the file for stdin; run_command closes it. */
+ if (hook_cb->options->path_to_stdin) {
+ cp->no_stdin = 0;
+ cp->in = xopen(hook_cb->options->path_to_stdin, O_RDONLY);
+ }
cp->stdout_to_stderr = 1;
cp->trace2_hook_name = hook_cb->hook_name;
cp->dir = hook_cb->options->dir;
@@ -72,9 +81,9 @@ static int pick_next_hook(struct child_process *cp,
return 1;
}
-static int notify_start_failure(struct strbuf *out,
+static int notify_start_failure(struct strbuf *out UNUSED,
void *pp_cb,
- void *pp_task_cp)
+ void *pp_task_cp UNUSED)
{
struct hook_cb_data *hook_cb = pp_cb;
@@ -84,9 +93,9 @@ static int notify_start_failure(struct strbuf *out,
}
static int notify_hook_finished(int result,
- struct strbuf *out,
+ struct strbuf *out UNUSED,
void *pp_cb,
- void *pp_task_cb)
+ void *pp_task_cb UNUSED)
{
struct hook_cb_data *hook_cb = pp_cb;
struct run_hooks_opt *opt = hook_cb->options;
@@ -114,8 +123,20 @@ int run_hooks_opt(const char *hook_name, struct run_hooks_opt *options)
.options = options,
};
const char *const hook_path = find_hook(hook_name);
- int jobs = 1;
int ret = 0;
+ const struct run_process_parallel_opts opts = {
+ .tr2_category = "hook",
+ .tr2_label = hook_name,
+
+ .processes = 1,
+ .ungroup = 1,
+
+ .get_next_task = pick_next_hook,
+ .start_failure = notify_start_failure,
+ .task_finished = notify_hook_finished,
+
+ .data = &cb_data,
+ };
if (!options)
BUG("a struct run_hooks_opt must be provided to run_hooks");
@@ -137,14 +158,7 @@ int run_hooks_opt(const char *hook_name, struct run_hooks_opt *options)
cb_data.hook_path = abs_path.buf;
}
- run_processes_parallel_ungroup = 1;
- run_processes_parallel_tr2(jobs,
- pick_next_hook,
- notify_start_failure,
- notify_hook_finished,
- &cb_data,
- "hook",
- hook_name);
+ run_processes_parallel(&opts);
ret = cb_data.rc;
cleanup:
strbuf_release(&abs_path);
diff --git a/hook.h b/hook.h
index 4258b13da0..19ab9a5806 100644
--- a/hook.h
+++ b/hook.h
@@ -30,6 +30,11 @@ struct run_hooks_opt
* was invoked.
*/
int *invoked_hook;
+
+ /**
+ * Path to file which should be piped to stdin for each hook.
+ */
+ const char *path_to_stdin;
};
#define RUN_HOOKS_OPT_INIT { \
diff --git a/http-backend.c b/http-backend.c
index 6eb3b2fe51..ac146d85c5 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -1,5 +1,9 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
+#include "git-zlib.h"
+#include "hex.h"
#include "repository.h"
#include "refs.h"
#include "pkt-line.h"
@@ -14,6 +18,8 @@
#include "object-store.h"
#include "protocol.h"
#include "date.h"
+#include "wrapper.h"
+#include "write-or-die.h"
static const char content_type[] = "Content-Type";
static const char content_length[] = "Content-Length";
@@ -524,7 +530,7 @@ static int show_text_ref(const char *name, const struct object_id *oid,
return 0;
}
-static void get_info_refs(struct strbuf *hdr, char *arg)
+static void get_info_refs(struct strbuf *hdr, char *arg UNUSED)
{
const char *service_name = get_parameter("service");
struct strbuf buf = STRBUF_INIT;
@@ -578,7 +584,7 @@ static int show_head_ref(const char *refname, const struct object_id *oid,
return 0;
}
-static void get_head(struct strbuf *hdr, char *arg)
+static void get_head(struct strbuf *hdr, char *arg UNUSED)
{
struct strbuf buf = STRBUF_INIT;
@@ -588,7 +594,7 @@ static void get_head(struct strbuf *hdr, char *arg)
strbuf_release(&buf);
}
-static void get_info_packs(struct strbuf *hdr, char *arg)
+static void get_info_packs(struct strbuf *hdr, char *arg UNUSED)
{
size_t objdirlen = strlen(get_object_directory());
struct strbuf buf = STRBUF_INIT;
@@ -736,7 +742,7 @@ static int bad_request(struct strbuf *hdr, const struct service_cmd *c)
return 0;
}
-int cmd_main(int argc, const char **argv)
+int cmd_main(int argc UNUSED, const char **argv UNUSED)
{
char *method = getenv("REQUEST_METHOD");
const char *proto_header;
@@ -759,10 +765,14 @@ int cmd_main(int argc, const char **argv)
struct service_cmd *c = &services[i];
regex_t re;
regmatch_t out[1];
+ int ret;
if (regcomp(&re, c->pattern, REG_EXTENDED))
die("Bogus regex in service table: %s", c->pattern);
- if (!regexec(&re, dir, 1, out, 0)) {
+ ret = regexec(&re, dir, 1, out, 0);
+ regfree(&re);
+
+ if (!ret) {
size_t n;
if (strcmp(method, c->method))
@@ -774,7 +784,6 @@ int cmd_main(int argc, const char **argv)
dir[out[0].rm_so] = 0;
break;
}
- regfree(&re);
}
if (!cmd)
@@ -786,6 +795,7 @@ int cmd_main(int argc, const char **argv)
if (!getenv("GIT_HTTP_EXPORT_ALL") &&
access("git-daemon-export-ok", F_OK) )
not_found(&hdr, "Repository not exported: '%s'", dir);
+ free(dir);
http_config();
max_request_buffer = git_env_ulong("GIT_HTTP_MAX_REQUEST_BUFFER",
@@ -795,5 +805,6 @@ int cmd_main(int argc, const char **argv)
setenv(GIT_PROTOCOL_ENVIRONMENT, proto_header, 0);
cmd->imp(&hdr, cmd_arg);
+ free(cmd_arg);
return 0;
}
diff --git a/http-fetch.c b/http-fetch.c
index 31bc5c7767..fffda59267 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -1,10 +1,14 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "exec-cmd.h"
+#include "gettext.h"
+#include "hex.h"
#include "http.h"
#include "walker.h"
+#include "setup.h"
#include "strvec.h"
#include "urlmatch.h"
+#include "trace2.h"
static const char http_fetch_usage[] = "git http-fetch "
"[-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin | --packfile=hash | commit-id] url";
@@ -137,6 +141,8 @@ int cmd_main(int argc, const char **argv)
if (nongit)
die(_("not a git repository"));
+ trace2_cmd_name("http-fetch");
+
git_config(git_default_config, NULL);
if (packfile) {
diff --git a/http-push.c b/http-push.c
index 7f71316456..29cf9db34e 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1,4 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "environment.h"
+#include "hex.h"
#include "repository.h"
#include "commit.h"
#include "tag.h"
@@ -10,8 +12,11 @@
#include "exec-cmd.h"
#include "remote.h"
#include "list-objects.h"
+#include "setup.h"
#include "sigchain.h"
#include "strvec.h"
+#include "tree.h"
+#include "tree-walk.h"
#include "packfile.h"
#include "object-store.h"
#include "commit-reach.h"
@@ -362,7 +367,8 @@ static void start_put(struct transfer_request *request)
ssize_t size;
git_zstream stream;
- unpacked = read_object_file(&request->obj->oid, &type, &len);
+ unpacked = repo_read_object_file(the_repository, &request->obj->oid,
+ &type, &len);
hdrlen = format_object_header(hdr, sizeof(hdr), type, len);
/* Set it up */
@@ -601,7 +607,7 @@ static void finish_request(struct transfer_request *request)
}
static int is_running_queue;
-static int fill_active_slot(void *unused)
+static int fill_active_slot(void *data UNUSED)
{
struct transfer_request *request;
@@ -1331,7 +1337,8 @@ static int get_delta(struct rev_info *revs, struct remote_lock *lock)
int count = 0;
while ((commit = get_revision(revs)) != NULL) {
- p = process_tree(get_commit_tree(commit), p);
+ p = process_tree(repo_get_commit_tree(the_repository, commit),
+ p);
commit->object.flags |= LOCAL;
if (!(commit->object.flags & UNINTERESTING))
count += add_send_request(&commit->object, lock);
@@ -1426,7 +1433,7 @@ static void one_remote_ref(const char *refname)
* Fetch a copy of the object if it doesn't exist locally - it
* may be required for updating server info later.
*/
- if (repo->can_update_info_refs && !has_object_file(&ref->old_oid)) {
+ if (repo->can_update_info_refs && !repo_has_object_file(the_repository, &ref->old_oid)) {
obj = lookup_unknown_object(the_repository, &ref->old_oid);
fprintf(stderr, " fetch %s for %s\n",
oid_to_hex(&ref->old_oid), refname);
@@ -1570,7 +1577,7 @@ static int verify_merge_base(struct object_id *head_oid, struct ref *remote)
struct commit *branch = lookup_commit_or_die(&remote->old_oid,
remote->name);
- return in_merge_bases(branch, head);
+ return repo_in_merge_bases(the_repository, branch, head);
}
static int delete_remote_branch(const char *pattern, int force)
@@ -1627,14 +1634,14 @@ static int delete_remote_branch(const char *pattern, int force)
return error("Remote HEAD symrefs too deep");
if (is_null_oid(&head_oid))
return error("Unable to resolve remote HEAD");
- if (!has_object_file(&head_oid))
+ if (!repo_has_object_file(the_repository, &head_oid))
return error("Remote HEAD resolves to object %s\nwhich does not exist locally, perhaps you need to fetch?", oid_to_hex(&head_oid));
/* Remote branch must resolve to a known object */
if (is_null_oid(&remote_ref->old_oid))
return error("Unable to resolve remote branch %s",
remote_ref->name);
- if (!has_object_file(&remote_ref->old_oid))
+ if (!repo_has_object_file(the_repository, &remote_ref->old_oid))
return error("Remote branch %s resolves to object %s\nwhich does not exist locally, perhaps you need to fetch?", remote_ref->name, oid_to_hex(&remote_ref->old_oid));
/* Remote branch must be an ancestor of remote HEAD */
@@ -1854,7 +1861,7 @@ int cmd_main(int argc, const char **argv)
if (!force_all &&
!is_null_oid(&ref->old_oid) &&
!ref->force) {
- if (!has_object_file(&ref->old_oid) ||
+ if (!repo_has_object_file(the_repository, &ref->old_oid) ||
!ref_newer(&ref->peer_ref->new_oid,
&ref->old_oid)) {
/*
diff --git a/http-walker.c b/http-walker.c
index b8f0f98ae1..bba306b2d5 100644
--- a/http-walker.c
+++ b/http-walker.c
@@ -1,6 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "repository.h"
#include "commit.h"
+#include "hex.h"
#include "walker.h"
#include "http.h"
#include "list.h"
@@ -52,8 +53,7 @@ static void fetch_alternates(struct walker *walker, const char *base);
static void process_object_response(void *callback_data);
-static void start_object_request(struct walker *walker,
- struct object_request *obj_req)
+static void start_object_request(struct object_request *obj_req)
{
struct active_request_slot *slot;
struct http_object_request *req;
@@ -110,7 +110,7 @@ static void process_object_response(void *callback_data)
obj_req->repo =
obj_req->repo->next;
release_http_object_request(obj_req->req);
- start_object_request(walker, obj_req);
+ start_object_request(obj_req);
return;
}
}
@@ -127,7 +127,7 @@ static void release_object_request(struct object_request *obj_req)
free(obj_req);
}
-static int fill_active_slot(struct walker *walker)
+static int fill_active_slot(void *data UNUSED)
{
struct object_request *obj_req;
struct list_head *pos, *tmp, *head = &object_queue_head;
@@ -135,10 +135,10 @@ static int fill_active_slot(struct walker *walker)
list_for_each_safe(pos, tmp, head) {
obj_req = list_entry(pos, struct object_request, node);
if (obj_req->state == WAITING) {
- if (has_object_file(&obj_req->oid))
+ if (repo_has_object_file(the_repository, &obj_req->oid))
obj_req->state = COMPLETE;
else {
- start_object_request(walker, obj_req);
+ start_object_request(obj_req);
return 1;
}
}
@@ -492,7 +492,7 @@ static int fetch_object(struct walker *walker, unsigned char *hash)
if (!obj_req)
return error("Couldn't find request for %s in the queue", hex);
- if (has_object_file(&obj_req->oid)) {
+ if (repo_has_object_file(the_repository, &obj_req->oid)) {
if (obj_req->req)
abort_http_object_request(obj_req->req);
abort_object_request(obj_req);
@@ -613,7 +613,7 @@ struct walker *get_http_walker(const char *url)
walker->cleanup = cleanup;
walker->data = data;
- add_fill_function(walker, (int (*)(void *)) fill_active_slot);
+ add_fill_function(NULL, fill_active_slot);
return walker;
}
diff --git a/http.c b/http.c
index 06de051c53..bb58bb3e6a 100644
--- a/http.c
+++ b/http.c
@@ -1,5 +1,6 @@
#include "git-compat-util.h"
#include "git-curl-compat.h"
+#include "hex.h"
#include "http.h"
#include "config.h"
#include "pack.h"
@@ -11,10 +12,12 @@
#include "version.h"
#include "pkt-line.h"
#include "gettext.h"
+#include "trace.h"
#include "transport.h"
#include "packfile.h"
#include "protocol.h"
#include "string-list.h"
+#include "object-file.h"
#include "object-store.h"
static struct trace_key trace_curl = TRACE_KEY_INIT(CURL);
@@ -39,6 +42,7 @@ static int curl_ssl_verify = -1;
static int curl_ssl_try;
static const char *curl_http_version = NULL;
static const char *ssl_cert;
+static const char *ssl_cert_type;
static const char *ssl_cipherlist;
static const char *ssl_version;
static struct {
@@ -58,6 +62,7 @@ static struct {
#endif
};
static const char *ssl_key;
+static const char *ssl_key_type;
static const char *ssl_capath;
static const char *curl_no_proxy;
#ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
@@ -181,6 +186,115 @@ size_t fwrite_buffer(char *ptr, size_t eltsize, size_t nmemb, void *buffer_)
return nmemb;
}
+/*
+ * A folded header continuation line starts with any number of spaces or
+ * horizontal tab characters (SP or HTAB) as per RFC 7230 section 3.2.
+ * It is not a continuation line if the line starts with any other character.
+ */
+static inline int is_hdr_continuation(const char *ptr, const size_t size)
+{
+ return size && (*ptr == ' ' || *ptr == '\t');
+}
+
+static size_t fwrite_wwwauth(char *ptr, size_t eltsize, size_t nmemb, void *p)
+{
+ size_t size = eltsize * nmemb;
+ struct strvec *values = &http_auth.wwwauth_headers;
+ struct strbuf buf = STRBUF_INIT;
+ const char *val;
+ size_t val_len;
+
+ /*
+ * Header lines may not come NULL-terminated from libcurl so we must
+ * limit all scans to the maximum length of the header line, or leverage
+ * strbufs for all operations.
+ *
+ * In addition, it is possible that header values can be split over
+ * multiple lines as per RFC 7230. 'Line folding' has been deprecated
+ * but older servers may still emit them. A continuation header field
+ * value is identified as starting with a space or horizontal tab.
+ *
+ * The formal definition of a header field as given in RFC 7230 is:
+ *
+ * header-field = field-name ":" OWS field-value OWS
+ *
+ * field-name = token
+ * field-value = *( field-content / obs-fold )
+ * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
+ * field-vchar = VCHAR / obs-text
+ *
+ * obs-fold = CRLF 1*( SP / HTAB )
+ * ; obsolete line folding
+ * ; see Section 3.2.4
+ */
+
+ /* Start of a new WWW-Authenticate header */
+ if (skip_iprefix_mem(ptr, size, "www-authenticate:", &val, &val_len)) {
+ strbuf_add(&buf, val, val_len);
+
+ /*
+ * Strip the CRLF that should be present at the end of each
+ * field as well as any trailing or leading whitespace from the
+ * value.
+ */
+ strbuf_trim(&buf);
+
+ strvec_push(values, buf.buf);
+ http_auth.header_is_last_match = 1;
+ goto exit;
+ }
+
+ /*
+ * This line could be a continuation of the previously matched header
+ * field. If this is the case then we should append this value to the
+ * end of the previously consumed value.
+ */
+ if (http_auth.header_is_last_match && is_hdr_continuation(ptr, size)) {
+ /*
+ * Trim the CRLF and any leading or trailing from this line.
+ */
+ strbuf_add(&buf, ptr, size);
+ strbuf_trim(&buf);
+
+ /*
+ * At this point we should always have at least one existing
+ * value, even if it is empty. Do not bother appending the new
+ * value if this continuation header is itself empty.
+ */
+ if (!values->nr) {
+ BUG("should have at least one existing header value");
+ } else if (buf.len) {
+ char *prev = xstrdup(values->v[values->nr - 1]);
+
+ /* Join two non-empty values with a single space. */
+ const char *const sp = *prev ? " " : "";
+
+ strvec_pop(values);
+ strvec_pushf(values, "%s%s%s", prev, sp, buf.buf);
+ free(prev);
+ }
+
+ goto exit;
+ }
+
+ /* Not a continuation of a previously matched auth header line. */
+ http_auth.header_is_last_match = 0;
+
+ /*
+ * If this is a HTTP status line and not a header field, this signals
+ * a different HTTP response. libcurl writes all the output of all
+ * response headers of all responses, including redirects.
+ * We only care about the last HTTP request response's headers so clear
+ * the existing array.
+ */
+ if (skip_iprefix_mem(ptr, size, "http/", &val, &val_len))
+ strvec_clear(values);
+
+exit:
+ strbuf_release(&buf);
+ return size;
+}
+
size_t fwrite_null(char *ptr, size_t eltsize, size_t nmemb, void *strbuf)
{
return nmemb;
@@ -264,8 +378,12 @@ static int http_options(const char *var, const char *value, void *cb)
return git_config_string(&ssl_version, var, value);
if (!strcmp("http.sslcert", var))
return git_config_pathname(&ssl_cert, var, value);
+ if (!strcmp("http.sslcerttype", var))
+ return git_config_string(&ssl_cert_type, var, value);
if (!strcmp("http.sslkey", var))
return git_config_pathname(&ssl_key, var, value);
+ if (!strcmp("http.sslkeytype", var))
+ return git_config_string(&ssl_key_type, var, value);
if (!strcmp("http.sslcapath", var))
return git_config_pathname(&ssl_capath, var, value);
if (!strcmp("http.sslcainfo", var))
@@ -558,13 +676,15 @@ static void set_curl_keepalive(CURL *c)
}
#endif
-static void redact_sensitive_header(struct strbuf *header)
+/* Return 1 if redactions have been made, 0 otherwise. */
+static int redact_sensitive_header(struct strbuf *header, size_t offset)
{
+ int ret = 0;
const char *sensitive_header;
if (trace_curl_redact &&
- (skip_iprefix(header->buf, "Authorization:", &sensitive_header) ||
- skip_iprefix(header->buf, "Proxy-Authorization:", &sensitive_header))) {
+ (skip_iprefix(header->buf + offset, "Authorization:", &sensitive_header) ||
+ skip_iprefix(header->buf + offset, "Proxy-Authorization:", &sensitive_header))) {
/* The first token is the type, which is OK to log */
while (isspace(*sensitive_header))
sensitive_header++;
@@ -573,8 +693,9 @@ static void redact_sensitive_header(struct strbuf *header)
/* Everything else is opaque and possibly sensitive */
strbuf_setlen(header, sensitive_header - header->buf);
strbuf_addstr(header, " <redacted>");
+ ret = 1;
} else if (trace_curl_redact &&
- skip_iprefix(header->buf, "Cookie:", &sensitive_header)) {
+ skip_iprefix(header->buf + offset, "Cookie:", &sensitive_header)) {
struct strbuf redacted_header = STRBUF_INIT;
const char *cookie;
@@ -610,6 +731,26 @@ static void redact_sensitive_header(struct strbuf *header)
strbuf_setlen(header, sensitive_header - header->buf);
strbuf_addbuf(header, &redacted_header);
+ ret = 1;
+ }
+ return ret;
+}
+
+/* Redact headers in info */
+static void redact_sensitive_info_header(struct strbuf *header)
+{
+ const char *sensitive_header;
+
+ /*
+ * curl's h2h3 prints headers in info, e.g.:
+ * h2h3 [<header-name>: <header-val>]
+ */
+ if (trace_curl_redact &&
+ skip_iprefix(header->buf, "h2h3 [", &sensitive_header)) {
+ if (redact_sensitive_header(header, sensitive_header - header->buf)) {
+ /* redaction ate our closing bracket */
+ strbuf_addch(header, ']');
+ }
}
}
@@ -627,7 +768,7 @@ static void curl_dump_header(const char *text, unsigned char *ptr, size_t size,
for (header = headers; *header; header++) {
if (hide_sensitive_header)
- redact_sensitive_header(*header);
+ redact_sensitive_header(*header, 0);
strbuf_insertstr((*header), 0, text);
strbuf_insertstr((*header), strlen(text), ": ");
strbuf_rtrim((*header));
@@ -666,6 +807,18 @@ static void curl_dump_data(const char *text, unsigned char *ptr, size_t size)
strbuf_release(&out);
}
+static void curl_dump_info(char *data, size_t size)
+{
+ struct strbuf buf = STRBUF_INIT;
+
+ strbuf_add(&buf, data, size);
+
+ redact_sensitive_info_header(&buf);
+ trace_printf_key(&trace_curl, "== Info: %s", buf.buf);
+
+ strbuf_release(&buf);
+}
+
static int curl_trace(CURL *handle, curl_infotype type, char *data, size_t size, void *userp)
{
const char *text;
@@ -673,7 +826,7 @@ static int curl_trace(CURL *handle, curl_infotype type, char *data, size_t size,
switch (type) {
case CURLINFO_TEXT:
- trace_printf_key(&trace_curl, "== Info: %s", data);
+ curl_dump_info(data, size);
break;
case CURLINFO_HEADER_OUT:
text = "=> Send header";
@@ -869,10 +1022,14 @@ static CURL *get_curl_handle(void)
if (ssl_cert)
curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
+ if (ssl_cert_type)
+ curl_easy_setopt(result, CURLOPT_SSLCERTTYPE, ssl_cert_type);
if (has_cert_password())
curl_easy_setopt(result, CURLOPT_KEYPASSWD, cert_auth.password);
if (ssl_key)
curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key);
+ if (ssl_key_type)
+ 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
@@ -1107,7 +1264,9 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
curl_ssl_verify = 0;
set_from_env(&ssl_cert, "GIT_SSL_CERT");
+ set_from_env(&ssl_cert_type, "GIT_SSL_CERT_TYPE");
set_from_env(&ssl_key, "GIT_SSL_KEY");
+ set_from_env(&ssl_key_type, "GIT_SSL_KEY_TYPE");
set_from_env(&ssl_capath, "GIT_SSL_CAPATH");
set_from_env(&ssl_cainfo, "GIT_SSL_CAINFO");
@@ -1860,6 +2019,8 @@ static int http_request(const char *url,
fwrite_buffer);
}
+ curl_easy_setopt(slot->curl, CURLOPT_HEADERFUNCTION, fwrite_wwwauth);
+
accept_language = http_get_accept_language_header();
if (accept_language)
diff --git a/http.h b/http.h
index 77c042706c..3a409bccd4 100644
--- a/http.h
+++ b/http.h
@@ -1,7 +1,9 @@
#ifndef HTTP_H
#define HTTP_H
-#include "cache.h"
+struct packed_git;
+
+#include "git-zlib.h"
#include <curl/curl.h>
#include <curl/easy.h>
diff --git a/ident.c b/ident.c
index 6de76f9421..8fad92d700 100644
--- a/ident.c
+++ b/ident.c
@@ -5,10 +5,13 @@
*
* Copyright (C) 2005 Linus Torvalds
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "ident.h"
#include "config.h"
#include "date.h"
+#include "gettext.h"
#include "mailmap.h"
+#include "strbuf.h"
static struct strbuf git_default_name = STRBUF_INIT;
static struct strbuf git_default_email = STRBUF_INIT;
diff --git a/ident.h b/ident.h
new file mode 100644
index 0000000000..96a64896a0
--- /dev/null
+++ b/ident.h
@@ -0,0 +1,67 @@
+#ifndef IDENT_H
+#define IDENT_H
+
+#include "string-list.h"
+
+struct ident_split {
+ const char *name_begin;
+ const char *name_end;
+ const char *mail_begin;
+ const char *mail_end;
+ const char *date_begin;
+ const char *date_end;
+ const char *tz_begin;
+ const char *tz_end;
+};
+
+#define IDENT_STRICT 1
+#define IDENT_NO_DATE 2
+#define IDENT_NO_NAME 4
+
+enum want_ident {
+ WANT_BLANK_IDENT,
+ WANT_AUTHOR_IDENT,
+ WANT_COMMITTER_IDENT
+};
+
+const char *ident_default_name(void);
+const char *ident_default_email(void);
+/*
+ * Prepare an ident to fall back on if the user didn't configure it.
+ */
+void prepare_fallback_ident(const char *name, const char *email);
+void reset_ident_date(void);
+/*
+ * Signals an success with 0, but time part of the result may be NULL
+ * if the input lacks timestamp and zone
+ */
+int split_ident_line(struct ident_split *, const char *, int);
+
+/*
+ * Given a commit or tag object buffer and the commit or tag headers, replaces
+ * the idents in the headers with their canonical versions using the mailmap mechanism.
+ */
+void apply_mailmap_to_header(struct strbuf *, const char **, struct string_list *);
+
+/*
+ * Compare split idents for equality or strict ordering. Note that we
+ * compare only the ident part of the line, ignoring any timestamp.
+ *
+ * Because there are two fields, we must choose one as the primary key; we
+ * currently arbitrarily pick the email.
+ */
+int ident_cmp(const struct ident_split *, const struct ident_split *);
+
+const char *git_author_info(int);
+const char *git_committer_info(int);
+const char *fmt_ident(const char *name, const char *email,
+ enum want_ident whose_ident,
+ const char *date_str, int);
+const char *fmt_name(enum want_ident);
+
+int committer_ident_sufficiently_given(void);
+int author_ident_sufficiently_given(void);
+
+int git_ident_config(const char *, const char *, void *);
+
+#endif
diff --git a/imap-send.c b/imap-send.c
index a50af56b82..a62424e90a 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -21,12 +21,15 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "credential.h"
#include "exec-cmd.h"
+#include "gettext.h"
#include "run-command.h"
#include "parse-options.h"
+#include "setup.h"
+#include "wrapper.h"
#if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG)
typedef void *SSL;
#endif
diff --git a/json-writer.c b/json-writer.c
index f1cfd8fa8c..005c820aa4 100644
--- a/json-writer.c
+++ b/json-writer.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "json-writer.h"
void jw_init(struct json_writer *jw)
diff --git a/khash.h b/khash.h
index cb79bf8856..56241e6a5c 100644
--- a/khash.h
+++ b/khash.h
@@ -26,8 +26,8 @@
#ifndef __AC_KHASH_H
#define __AC_KHASH_H
-#include "cache.h"
#include "hashmap.h"
+#include "hash.h"
#define AC_VERSION_KHASH_H "0.2.8"
diff --git a/kwset.c b/kwset.c
index 08aadf0311..4b14d4f86b 100644
--- a/kwset.c
+++ b/kwset.c
@@ -32,7 +32,7 @@
String Matching: An Aid to Bibliographic Search," CACM June 1975,
Vol. 18, No. 6, which describes the failure function used below. */
-#include "cache.h"
+#include "git-compat-util.h"
#include "kwset.h"
#include "compat/obstack.h"
diff --git a/levenshtein.c b/levenshtein.c
index d2632690d5..fd8026fe20 100644
--- a/levenshtein.c
+++ b/levenshtein.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "levenshtein.h"
/*
diff --git a/line-log.c b/line-log.c
index 51d93310a4..6a7ac312a4 100644
--- a/line-log.c
+++ b/line-log.c
@@ -1,6 +1,7 @@
#include "git-compat-util.h"
+#include "alloc.h"
#include "line-range.h"
-#include "cache.h"
+#include "hex.h"
#include "tag.h"
#include "blob.h"
#include "tree.h"
@@ -14,8 +15,10 @@
#include "graph.h"
#include "userdiff.h"
#include "line-log.h"
+#include "setup.h"
#include "strvec.h"
#include "bloom.h"
+#include "tree-walk.h"
static void range_set_grow(struct range_set *rs, size_t extra)
{
@@ -1089,10 +1092,8 @@ static struct diff_filepair *diff_filepair_dup(struct diff_filepair *pair)
static void free_diffqueues(int n, struct diff_queue_struct *dq)
{
- int i, j;
- for (i = 0; i < n; i++)
- for (j = 0; j < dq[i].nr; j++)
- diff_free_filepair(dq[i].queue[j]);
+ for (int i = 0; i < n; i++)
+ diff_free_queue(&dq[i]);
free(dq);
}
@@ -1195,6 +1196,7 @@ static int process_ranges_ordinary_commit(struct rev_info *rev, struct commit *c
if (parent)
add_line_range(rev, parent, parent_range);
free_line_log_data(parent_range);
+ diff_free_queue(&queue);
return changed;
}
@@ -1282,7 +1284,8 @@ int line_log_process_ranges_arbitrary_commit(struct rev_info *rev, struct commit
return changed;
}
-static enum rewrite_result line_log_rewrite_one(struct rev_info *rev, struct commit **pp)
+static enum rewrite_result line_log_rewrite_one(struct rev_info *rev UNUSED,
+ struct commit **pp)
{
for (;;) {
struct commit *p = *pp;
diff --git a/line-log.h b/line-log.h
index 82ae8d98a4..adff361b1b 100644
--- a/line-log.h
+++ b/line-log.h
@@ -5,6 +5,7 @@
struct rev_info;
struct commit;
+struct string_list;
/* A range [start,end]. Lines are numbered starting at 0, and the
* ranges include start but exclude end. */
diff --git a/line-range.c b/line-range.c
index 955a8a9535..47bf0d6f1a 100644
--- a/line-range.c
+++ b/line-range.c
@@ -135,7 +135,7 @@ static const char *find_funcname_matching_regexp(xdemitconf_t *xecfg, const char
{
int reg_error;
regmatch_t match[1];
- while (1) {
+ while (*start) {
const char *bol, *eol;
reg_error = regexec(regexp, start, 1, match, 0);
if (reg_error == REG_NOMATCH)
@@ -148,8 +148,8 @@ static const char *find_funcname_matching_regexp(xdemitconf_t *xecfg, const char
/* determine extent of line matched */
bol = start+match[0].rm_so;
eol = start+match[0].rm_eo;
- while (bol > start && *bol != '\n')
- bol--;
+ while (bol > start && *--bol != '\n')
+ ; /* nothing */
if (*bol == '\n')
bol++;
while (*eol && *eol != '\n')
@@ -161,6 +161,7 @@ static const char *find_funcname_matching_regexp(xdemitconf_t *xecfg, const char
return bol;
start = eol;
}
+ return NULL;
}
static const char *parse_range_funcname(
diff --git a/linear-assignment.c b/linear-assignment.c
index ecffc09be6..5416cbcf40 100644
--- a/linear-assignment.c
+++ b/linear-assignment.c
@@ -3,7 +3,7 @@
* algorithm for dense and sparse linear assignment problems</i>. Computing,
* 38(4), 325-340.
*/
-#include "cache.h"
+#include "git-compat-util.h"
#include "linear-assignment.h"
#define COST(column, row) cost[(column) + column_count * (row)]
diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c
index 5339660238..2a3b7881af 100644
--- a/list-objects-filter-options.c
+++ b/list-objects-filter-options.c
@@ -1,6 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "commit.h"
#include "config.h"
+#include "gettext.h"
#include "revision.h"
#include "strvec.h"
#include "list-objects.h"
@@ -9,6 +11,7 @@
#include "promisor-remote.h"
#include "trace.h"
#include "url.h"
+#include "parse-options.h"
static int parse_combine_filter(
struct list_objects_filter_options *filter_options,
@@ -290,10 +293,6 @@ int opt_parse_list_objects_filter(const struct option *opt,
const char *arg, int unset)
{
struct list_objects_filter_options *filter_options = opt->value;
- opt_lof_init init = (opt_lof_init)opt->defval;
-
- if (init)
- filter_options = init(opt->value);
if (unset || !arg)
list_objects_filter_set_no_filter(filter_options);
@@ -345,7 +344,7 @@ void partial_clone_register(
char *filter_name;
/* Check if it is already registered */
- if ((promisor_remote = promisor_remote_find(remote))) {
+ if ((promisor_remote = repo_promisor_remote_find(the_repository, remote))) {
if (promisor_remote->partial_clone_filter)
/*
* Remote is already registered and a filter is already
@@ -373,14 +372,15 @@ void partial_clone_register(
free(filter_name);
/* Make sure the config info are reset */
- promisor_remote_reinit();
+ repo_promisor_remote_reinit(the_repository);
}
void partial_clone_get_default_filter_spec(
struct list_objects_filter_options *filter_options,
const char *remote)
{
- struct promisor_remote *promisor = promisor_remote_find(remote);
+ struct promisor_remote *promisor = repo_promisor_remote_find(the_repository,
+ remote);
struct strbuf errbuf = STRBUF_INIT;
/*
diff --git a/list-objects-filter-options.h b/list-objects-filter-options.h
index 7eeadab2dd..f620612586 100644
--- a/list-objects-filter-options.h
+++ b/list-objects-filter-options.h
@@ -1,9 +1,12 @@
#ifndef LIST_OBJECTS_FILTER_OPTIONS_H
#define LIST_OBJECTS_FILTER_OPTIONS_H
-#include "cache.h"
-#include "parse-options.h"
+#include "gettext.h"
+#include "object.h"
#include "string-list.h"
+#include "strbuf.h"
+
+struct option;
/*
* The list of defined filters for list-objects.
@@ -111,27 +114,13 @@ void parse_list_objects_filter(
* The opt->value to opt_parse_list_objects_filter() is either a
* "struct list_objects_filter_option *" when using
* OPT_PARSE_LIST_OBJECTS_FILTER().
- *
- * Or, if using no "struct option" field is used by the callback,
- * except the "defval" which is expected to be an "opt_lof_init"
- * function, which is called with the "opt->value" and must return a
- * pointer to the ""struct list_objects_filter_option *" to be used.
- *
- * The OPT_PARSE_LIST_OBJECTS_FILTER_INIT() can be used e.g. the
- * "struct list_objects_filter_option" is embedded in a "struct
- * rev_info", which the "defval" could be tasked with lazily
- * initializing. See cmd_pack_objects() for an example.
*/
int opt_parse_list_objects_filter(const struct option *opt,
const char *arg, int unset);
-typedef struct list_objects_filter_options *(*opt_lof_init)(void *);
-#define OPT_PARSE_LIST_OBJECTS_FILTER_INIT(fo, init) \
- { OPTION_CALLBACK, 0, "filter", (fo), N_("args"), \
- N_("object filtering"), 0, opt_parse_list_objects_filter, \
- (intptr_t)(init) }
#define OPT_PARSE_LIST_OBJECTS_FILTER(fo) \
- OPT_PARSE_LIST_OBJECTS_FILTER_INIT((fo), NULL)
+ OPT_CALLBACK(0, "filter", (fo), N_("args"), \
+ N_("object filtering"), opt_parse_list_objects_filter)
/*
* Translates abbreviated numbers in the filter's filter_spec into their
diff --git a/list-objects-filter.c b/list-objects-filter.c
index 1c1ee3d1bb..5d270ce598 100644
--- a/list-objects-filter.c
+++ b/list-objects-filter.c
@@ -1,5 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "dir.h"
+#include "gettext.h"
+#include "hex.h"
#include "tag.h"
#include "commit.h"
#include "tree.h"
@@ -12,6 +15,7 @@
#include "list-objects-filter-options.h"
#include "oidmap.h"
#include "oidset.h"
+#include "object-name.h"
#include "object-store.h"
/* Remember to update object flag allocation in object.h */
@@ -70,13 +74,13 @@ struct filter {
};
static enum list_objects_filter_result filter_blobs_none(
- struct repository *r,
+ struct repository *r UNUSED,
enum list_objects_filter_situation filter_situation,
struct object *obj,
- const char *pathname,
- const char *filename,
+ const char *pathname UNUSED,
+ const char *filename UNUSED,
struct oidset *omits,
- void *filter_data_)
+ void *filter_data_ UNUSED)
{
switch (filter_situation) {
default:
@@ -112,7 +116,7 @@ static enum list_objects_filter_result filter_blobs_none(
}
static void filter_blobs_none__init(
- struct list_objects_filter_options *filter_options,
+ struct list_objects_filter_options *filter_options UNUSED,
struct filter *filter)
{
filter->filter_object_fn = filter_blobs_none;
@@ -159,11 +163,11 @@ static int filter_trees_update_omits(
}
static enum list_objects_filter_result filter_trees_depth(
- struct repository *r,
+ struct repository *r UNUSED,
enum list_objects_filter_situation filter_situation,
struct object *obj,
- const char *pathname,
- const char *filename,
+ const char *pathname UNUSED,
+ const char *filename UNUSED,
struct oidset *omits,
void *filter_data_)
{
@@ -274,8 +278,8 @@ static enum list_objects_filter_result filter_blobs_limit(
struct repository *r,
enum list_objects_filter_situation filter_situation,
struct object *obj,
- const char *pathname,
- const char *filename,
+ const char *pathname UNUSED,
+ const char *filename UNUSED,
struct oidset *omits,
void *filter_data_)
{
@@ -514,6 +518,7 @@ static enum list_objects_filter_result filter_sparse(
static void filter_sparse_free(void *filter_data)
{
struct filter_sparse_data *d = filter_data;
+ clear_pattern_list(&d->pl);
free(d->array_frame);
free(d);
}
@@ -554,12 +559,12 @@ struct filter_object_type_data {
};
static enum list_objects_filter_result filter_object_type(
- struct repository *r,
+ struct repository *r UNUSED,
enum list_objects_filter_situation filter_situation,
struct object *obj,
- const char *pathname,
- const char *filename,
- struct oidset *omits,
+ const char *pathname UNUSED,
+ const char *filename UNUSED,
+ struct oidset *omits UNUSED,
void *filter_data_)
{
struct filter_object_type_data *filter_data = filter_data_;
@@ -675,7 +680,7 @@ static enum list_objects_filter_result filter_combine(
struct object *obj,
const char *pathname,
const char *filename,
- struct oidset *omits,
+ struct oidset *omits UNUSED,
void *filter_data)
{
struct combine_filter_data *d = filter_data;
@@ -709,6 +714,7 @@ static void filter_combine__free(void *filter_data)
BUG("expected oidset to be cleared already");
}
free(d->sub);
+ free(d);
}
static void add_all(struct oidset *dest, struct oidset *src) {
diff --git a/list-objects.c b/list-objects.c
index 250d9de41c..eecca721ac 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -1,6 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "tag.h"
#include "commit.h"
+#include "gettext.h"
+#include "hex.h"
#include "tree.h"
#include "blob.h"
#include "diff.h"
@@ -64,7 +66,7 @@ static void process_blob(struct traversal_context *ctx,
* of missing objects.
*/
if (ctx->revs->exclude_promisor_objects &&
- !has_object_file(&obj->oid) &&
+ !repo_has_object_file(the_repository, &obj->oid) &&
is_promisor_object(&obj->oid))
return;
@@ -81,36 +83,6 @@ static void process_blob(struct traversal_context *ctx,
strbuf_setlen(path, pathlen);
}
-/*
- * Processing a gitlink entry currently does nothing, since
- * we do not recurse into the subproject.
- *
- * We *could* eventually add a flag that actually does that,
- * which would involve:
- * - is the subproject actually checked out?
- * - if so, see if the subproject has already been added
- * to the alternates list, and add it if not.
- * - process the commit (or tag) the gitlink points to
- * recursively.
- *
- * However, it's unclear whether there is really ever any
- * reason to see superprojects and subprojects as such a
- * "unified" object pool (potentially resulting in a totally
- * humongous pack - avoiding which was the whole point of
- * having gitlinks in the first place!).
- *
- * So for now, there is just a note that we *could* follow
- * the link, and how to do it. Whether it necessarily makes
- * any sense what-so-ever to ever do that is another issue.
- */
-static void process_gitlink(struct traversal_context *ctx,
- const unsigned char *sha1,
- struct strbuf *path,
- const char *name)
-{
- /* Nothing to do */
-}
-
static void process_tree(struct traversal_context *ctx,
struct tree *tree,
struct strbuf *base,
@@ -149,8 +121,7 @@ static void process_tree_contents(struct traversal_context *ctx,
process_tree(ctx, t, base, entry.path);
}
else if (S_ISGITLINK(entry.mode))
- process_gitlink(ctx, entry.oid.hash,
- base, entry.path);
+ ; /* ignore gitlink */
else {
struct blob *b = lookup_blob(ctx->revs->repo, &entry.oid);
if (!b) {
@@ -258,7 +229,8 @@ static void mark_edge_parents_uninteresting(struct commit *commit,
struct commit *parent = parents->item;
if (!(parent->object.flags & UNINTERESTING))
continue;
- mark_tree_uninteresting(revs->repo, get_commit_tree(parent));
+ mark_tree_uninteresting(revs->repo,
+ repo_get_commit_tree(the_repository, parent));
if (revs->edge_hint && !(parent->object.flags & SHOWN)) {
parent->object.flags |= SHOWN;
show_edge(parent);
@@ -275,7 +247,8 @@ static void add_edge_parents(struct commit *commit,
for (parents = commit->parents; parents; parents = parents->next) {
struct commit *parent = parents->item;
- struct tree *tree = get_commit_tree(parent);
+ struct tree *tree = repo_get_commit_tree(the_repository,
+ parent);
if (!tree)
continue;
@@ -306,7 +279,8 @@ void mark_edges_uninteresting(struct rev_info *revs,
for (list = revs->commits; list; list = list->next) {
struct commit *commit = list->item;
- struct tree *tree = get_commit_tree(commit);
+ struct tree *tree = repo_get_commit_tree(the_repository,
+ commit);
if (commit->object.flags & UNINTERESTING)
tree->object.flags |= UNINTERESTING;
@@ -322,7 +296,7 @@ void mark_edges_uninteresting(struct rev_info *revs,
struct commit *commit = list->item;
if (commit->object.flags & UNINTERESTING) {
mark_tree_uninteresting(revs->repo,
- get_commit_tree(commit));
+ repo_get_commit_tree(the_repository, commit));
if (revs->edge_hint_aggressive && !(commit->object.flags & SHOWN)) {
commit->object.flags |= SHOWN;
show_edge(commit);
@@ -340,7 +314,7 @@ void mark_edges_uninteresting(struct rev_info *revs,
if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
continue;
mark_tree_uninteresting(revs->repo,
- get_commit_tree(commit));
+ repo_get_commit_tree(the_repository, commit));
if (!(obj->flags & SHOWN)) {
obj->flags |= SHOWN;
show_edge(commit);
@@ -407,8 +381,9 @@ static void do_traverse(struct traversal_context *ctx)
*/
if (!ctx->revs->tree_objects)
; /* do not bother loading tree */
- else if (get_commit_tree(commit)) {
- struct tree *tree = get_commit_tree(commit);
+ else if (repo_get_commit_tree(the_repository, commit)) {
+ struct tree *tree = repo_get_commit_tree(the_repository,
+ commit);
tree->object.flags |= NOT_USER_GIVEN;
add_pending_tree(ctx->revs, tree);
} else if (commit->object.parsed) {
diff --git a/ll-merge.c b/ll-merge.c
index 8955d7e1f6..1993530688 100644
--- a/ll-merge.c
+++ b/ll-merge.c
@@ -4,13 +4,16 @@
* Copyright (c) 2007 Junio C Hamano
*/
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
+#include "convert.h"
#include "attr.h"
#include "xdiff-interface.h"
#include "run-command.h"
#include "ll-merge.h"
#include "quote.h"
+#include "strbuf.h"
+#include "wrapper.h"
struct ll_merge_driver;
@@ -49,14 +52,14 @@ void reset_merge_attributes(void)
/*
* Built-in low-levels
*/
-static enum ll_merge_result ll_binary_merge(const struct ll_merge_driver *drv_unused,
+static enum ll_merge_result ll_binary_merge(const struct ll_merge_driver *drv UNUSED,
mmbuffer_t *result,
- const char *path,
- mmfile_t *orig, const char *orig_name,
- mmfile_t *src1, const char *name1,
- mmfile_t *src2, const char *name2,
+ const char *path UNUSED,
+ mmfile_t *orig, const char *orig_name UNUSED,
+ mmfile_t *src1, const char *name1 UNUSED,
+ mmfile_t *src2, const char *name2 UNUSED,
const struct ll_merge_options *opts,
- int marker_size)
+ int marker_size UNUSED)
{
enum ll_merge_result ret;
mmfile_t *stolen;
@@ -183,9 +186,9 @@ static void create_temp(mmfile_t *src, char *path, size_t len)
static enum ll_merge_result ll_ext_merge(const struct ll_merge_driver *fn,
mmbuffer_t *result,
const char *path,
- mmfile_t *orig, const char *orig_name,
- mmfile_t *src1, const char *name1,
- mmfile_t *src2, const char *name2,
+ mmfile_t *orig, const char *orig_name UNUSED,
+ mmfile_t *src1, const char *name1 UNUSED,
+ mmfile_t *src2, const char *name2 UNUSED,
const struct ll_merge_options *opts,
int marker_size)
{
@@ -193,7 +196,7 @@ static enum ll_merge_result ll_ext_merge(const struct ll_merge_driver *fn,
struct strbuf cmd = STRBUF_INIT;
struct strbuf_expand_dict_entry dict[6];
struct strbuf path_sq = STRBUF_INIT;
- const char *args[] = { NULL, NULL };
+ struct child_process child = CHILD_PROCESS_INIT;
int status, fd, i;
struct stat st;
enum ll_merge_result ret;
@@ -219,8 +222,9 @@ static enum ll_merge_result ll_ext_merge(const struct ll_merge_driver *fn,
strbuf_expand(&cmd, fn->cmdline, strbuf_expand_dict_cb, &dict);
- args[0] = cmd.buf;
- status = run_command_v_opt(args, RUN_USING_SHELL);
+ child.use_shell = 1;
+ strvec_push(&child.args, cmd.buf);
+ status = run_command(&child);
fd = open(temp[1], O_RDONLY);
if (fd < 0)
goto bad;
@@ -390,7 +394,7 @@ enum ll_merge_result ll_merge(mmbuffer_t *result_buf,
normalize_file(theirs, path, istate);
}
- git_check_attr(istate, path, check);
+ git_check_attr(istate, NULL, path, check);
ll_driver_name = check->items[0].value;
if (check->items[1].value) {
marker_size = atoi(check->items[1].value);
@@ -418,7 +422,7 @@ int ll_merge_marker_size(struct index_state *istate, const char *path)
if (!check)
check = attr_check_initl("conflict-marker-size", NULL);
- git_check_attr(istate, path, check);
+ git_check_attr(istate, NULL, path, check);
if (check->items[0].value) {
marker_size = atoi(check->items[0].value);
if (marker_size <= 0)
diff --git a/lockfile.c b/lockfile.c
index cc9a4b8428..1d5ed01682 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -2,7 +2,9 @@
* Copyright (c) 2005, Junio C Hamano
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "gettext.h"
#include "lockfile.h"
/*
diff --git a/log-tree.c b/log-tree.c
index 1dd5fcbf7b..f4b22a60cc 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -1,7 +1,10 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "commit-reach.h"
#include "config.h"
#include "diff.h"
+#include "environment.h"
+#include "hex.h"
+#include "object-name.h"
#include "object-store.h"
#include "repository.h"
#include "tmp-objdir.h"
@@ -12,6 +15,7 @@
#include "merge-ort.h"
#include "reflog-walk.h"
#include "refs.h"
+#include "replace-object.h"
#include "string-list.h"
#include "color.h"
#include "gpg-interface.h"
@@ -20,6 +24,8 @@
#include "help.h"
#include "range-diff.h"
#include "strmap.h"
+#include "tree.h"
+#include "write-or-die.h"
static struct decoration name_decoration = { "object names" };
static int decoration_loaded;
@@ -196,7 +202,8 @@ static int add_ref_decoration(const char *refname, const struct object_id *oid,
return 0;
}
-static int add_graft_decoration(const struct commit_graft *graft, void *cb_data)
+static int add_graft_decoration(const struct commit_graft *graft,
+ void *cb_data UNUSED)
{
struct commit *commit = lookup_commit(the_repository, &graft->oid);
if (!commit)
@@ -233,7 +240,8 @@ static void show_parents(struct commit *commit, int abbrev, FILE *file)
struct commit_list *p;
for (p = commit->parents; p ; p = p->next) {
struct commit *parent = p->item;
- fprintf(file, " %s", find_unique_abbrev(&parent->object.oid, abbrev));
+ fprintf(file, " %s",
+ repo_find_unique_abbrev(the_repository, &parent->object.oid, abbrev));
}
}
@@ -241,7 +249,8 @@ static void show_children(struct rev_info *opt, struct commit *commit, int abbre
{
struct commit_list *p = lookup_decoration(&opt->children, &commit->object);
for ( ; p; p = p->next) {
- fprintf(opt->diffopt.file, " %s", find_unique_abbrev(&p->item->object.oid, abbrev));
+ fprintf(opt->diffopt.file, " %s",
+ repo_find_unique_abbrev(the_repository, &p->item->object.oid, abbrev));
}
}
@@ -405,7 +414,8 @@ void fmt_output_commit(struct strbuf *filename,
struct pretty_print_context ctx = {0};
struct strbuf subject = STRBUF_INIT;
- format_commit_message(commit, "%f", &subject, &ctx);
+ repo_format_commit_message(the_repository, commit, "%f", &subject,
+ &ctx);
fmt_output_subject(filename, subject.buf, info);
strbuf_release(&subject);
}
@@ -440,7 +450,7 @@ void log_write_email_headers(struct rev_info *opt, struct commit *commit,
fprintf(opt->diffopt.file, "From %s Mon Sep 17 00:00:00 2001\n", name);
graph_show_oneline(opt->graph);
if (opt->message_id) {
- fprintf(opt->diffopt.file, "Message-Id: <%s>\n", opt->message_id);
+ fprintf(opt->diffopt.file, "Message-ID: <%s>\n", opt->message_id);
graph_show_oneline(opt->graph);
}
if (opt->ref_message_ids && opt->ref_message_ids->nr > 0) {
@@ -644,7 +654,8 @@ void show_log(struct rev_info *opt)
if (!opt->graph)
put_revision_mark(opt, commit);
- fputs(find_unique_abbrev(&commit->object.oid, abbrev_commit), opt->diffopt.file);
+ fputs(repo_find_unique_abbrev(the_repository, &commit->object.oid, abbrev_commit),
+ opt->diffopt.file);
if (opt->print_parents)
show_parents(commit, abbrev_commit, opt->diffopt.file);
if (opt->children.name)
@@ -706,8 +717,8 @@ void show_log(struct rev_info *opt)
if (!opt->graph)
put_revision_mark(opt, commit);
- fputs(find_unique_abbrev(&commit->object.oid,
- abbrev_commit),
+ fputs(repo_find_unique_abbrev(the_repository, &commit->object.oid,
+ abbrev_commit),
opt->diffopt.file);
if (opt->print_parents)
show_parents(commit, abbrev_commit, opt->diffopt.file);
@@ -715,7 +726,7 @@ void show_log(struct rev_info *opt)
show_children(opt, commit, abbrev_commit);
if (parent)
fprintf(opt->diffopt.file, " (from %s)",
- find_unique_abbrev(&parent->object.oid, abbrev_commit));
+ repo_find_unique_abbrev(the_repository, &parent->object.oid, abbrev_commit));
fputs(diff_get_color_opt(&opt->diffopt, DIFF_RESET), opt->diffopt.file);
show_decorations(opt, commit);
if (opt->commit_format == CMIT_FMT_ONELINE) {
@@ -846,7 +857,7 @@ void show_log(struct rev_info *opt)
* Pass minimum required diff-options to range-diff; others
* can be added later if deemed desirable.
*/
- diff_setup(&opts);
+ repo_diff_setup(the_repository, &opts);
opts.file = opt->diffopt.file;
opts.use_color = opt->diffopt.use_color;
diff_setup_done(&opts);
@@ -982,15 +993,17 @@ static int do_remerge_diff(struct rev_info *opt,
o.msg_header_prefix = "remerge";
ctx.abbrev = DEFAULT_ABBREV;
- format_commit_message(parent1, "%h (%s)", &parent1_desc, &ctx);
- format_commit_message(parent2, "%h (%s)", &parent2_desc, &ctx);
+ repo_format_commit_message(the_repository, parent1, "%h (%s)",
+ &parent1_desc, &ctx);
+ repo_format_commit_message(the_repository, parent2, "%h (%s)",
+ &parent2_desc, &ctx);
o.branch1 = parent1_desc.buf;
o.branch2 = parent2_desc.buf;
/* Parse the relevant commits and get the merge bases */
parse_commit_or_die(parent1);
parse_commit_or_die(parent2);
- bases = get_merge_bases(parent1, parent2);
+ bases = repo_get_merge_bases(the_repository, parent1, parent2);
/* Re-merge the parents */
merge_incore_recursive(&o, bases, parent1, parent2, &res);
diff --git a/ls-refs.c b/ls-refs.c
index fa0d01b47c..f385938b64 100644
--- a/ls-refs.c
+++ b/ls-refs.c
@@ -1,4 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hash.h"
+#include "hex.h"
#include "repository.h"
#include "refs.h"
#include "remote.h"
@@ -6,39 +10,34 @@
#include "ls-refs.h"
#include "pkt-line.h"
#include "config.h"
+#include "string-list.h"
-static int config_read;
-static int advertise_unborn;
-static int allow_unborn;
-
-static void ensure_config_read(void)
+static enum {
+ UNBORN_IGNORE = 0,
+ UNBORN_ALLOW,
+ UNBORN_ADVERTISE /* implies ALLOW */
+} unborn_config(struct repository *r)
{
const char *str = NULL;
- if (config_read)
- return;
-
- if (repo_config_get_string_tmp(the_repository, "lsrefs.unborn", &str)) {
+ if (repo_config_get_string_tmp(r, "lsrefs.unborn", &str)) {
/*
* If there is no such config, advertise and allow it by
* default.
*/
- advertise_unborn = 1;
- allow_unborn = 1;
+ return UNBORN_ADVERTISE;
} else {
if (!strcmp(str, "advertise")) {
- advertise_unborn = 1;
- allow_unborn = 1;
+ return UNBORN_ADVERTISE;
} else if (!strcmp(str, "allow")) {
- allow_unborn = 1;
+ return UNBORN_ALLOW;
} else if (!strcmp(str, "ignore")) {
- /* do nothing */
+ return UNBORN_IGNORE;
} else {
die(_("invalid value for '%s': '%s'"),
"lsrefs.unborn", str);
}
}
- config_read = 1;
}
/*
@@ -73,6 +72,7 @@ struct ls_refs_data {
unsigned symrefs;
struct strvec prefixes;
struct strbuf buf;
+ struct string_list hidden_refs;
unsigned unborn : 1;
};
@@ -84,7 +84,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
strbuf_reset(&data->buf);
- if (ref_is_hidden(refname_nons, refname))
+ if (ref_is_hidden(refname_nons, refname, &data->hidden_refs))
return 0;
if (!ref_match(&data->prefixes, refname_nons))
@@ -137,14 +137,15 @@ static void send_possibly_unborn_head(struct ls_refs_data *data)
}
static int ls_refs_config(const char *var, const char *value,
- void *data UNUSED)
+ void *cb_data)
{
+ struct ls_refs_data *data = cb_data;
/*
* We only serve fetches over v2 for now, so respect only "uploadpack"
* config. This may need to eventually be expanded to "receive", but we
* don't yet know how that information will be passed to ls-refs.
*/
- return parse_hide_refs_config(var, value, "uploadpack");
+ return parse_hide_refs_config(var, value, "uploadpack", &data->hidden_refs);
}
int ls_refs(struct repository *r, struct packet_reader *request)
@@ -154,9 +155,9 @@ int ls_refs(struct repository *r, struct packet_reader *request)
memset(&data, 0, sizeof(data));
strvec_init(&data.prefixes);
strbuf_init(&data.buf, 0);
+ string_list_init_dup(&data.hidden_refs);
- ensure_config_read();
- git_config(ls_refs_config, NULL);
+ git_config(ls_refs_config, &data);
while (packet_reader_read(request) == PACKET_READ_NORMAL) {
const char *arg = request->line;
@@ -171,7 +172,7 @@ int ls_refs(struct repository *r, struct packet_reader *request)
strvec_push(&data.prefixes, out);
}
else if (!strcmp("unborn", arg))
- data.unborn = allow_unborn;
+ data.unborn = !!unborn_config(r);
else
die(_("unexpected line: '%s'"), arg);
}
@@ -190,21 +191,20 @@ int ls_refs(struct repository *r, struct packet_reader *request)
send_possibly_unborn_head(&data);
if (!data.prefixes.nr)
strvec_push(&data.prefixes, "");
- for_each_fullref_in_prefixes(get_git_namespace(), data.prefixes.v,
- send_ref, &data);
+ refs_for_each_fullref_in_prefixes(get_main_ref_store(r),
+ get_git_namespace(), data.prefixes.v,
+ send_ref, &data);
packet_fflush(stdout);
strvec_clear(&data.prefixes);
strbuf_release(&data.buf);
+ string_list_clear(&data.hidden_refs, 0);
return 0;
}
int ls_refs_advertise(struct repository *r, struct strbuf *value)
{
- if (value) {
- ensure_config_read();
- if (advertise_unborn)
- strbuf_addstr(value, "unborn");
- }
+ if (value && unborn_config(r) == UNBORN_ADVERTISE)
+ strbuf_addstr(value, "unborn");
return 1;
}
diff --git a/mailinfo.c b/mailinfo.c
index 833d28612f..2aeb20e5e6 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -1,5 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
#include "utf8.h"
#include "strbuf.h"
#include "mailinfo.h"
@@ -597,7 +599,7 @@ static int check_header(struct mailinfo *mi,
ret = 1;
goto check_header_out;
}
- if (parse_header(line, "Message-Id", mi, &sb)) {
+ if (parse_header(line, "Message-ID", mi, &sb)) {
if (mi->add_message_id)
mi->message_id = strbuf_detach(&sb, NULL);
ret = 1;
@@ -829,7 +831,7 @@ static int handle_commit_msg(struct mailinfo *mi, struct strbuf *line)
if (patchbreak(line)) {
if (mi->message_id)
strbuf_addf(&mi->log_message,
- "Message-Id: %s\n", mi->message_id);
+ "Message-ID: %s\n", mi->message_id);
return 1;
}
diff --git a/mailmap.c b/mailmap.c
index da2589b082..5dc5223c43 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -1,17 +1,10 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "environment.h"
#include "string-list.h"
#include "mailmap.h"
+#include "object-name.h"
#include "object-store.h"
-
-#define DEBUG_MAILMAP 0
-#if DEBUG_MAILMAP
-#define debug_mm(...) fprintf(stderr, __VA_ARGS__)
-#define debug_str(X) ((X) ? (X) : "(none)")
-#else
-__attribute__((format (printf, 1, 2)))
-static inline void debug_mm(const char *format, ...) {}
-static inline const char *debug_str(const char *s) { return s; }
-#endif
+#include "setup.h"
const char *git_mailmap_file;
const char *git_mailmap_blob;
@@ -30,23 +23,17 @@ struct mailmap_entry {
struct string_list namemap;
};
-static void free_mailmap_info(void *p, const char *s)
+static void free_mailmap_info(void *p, const char *s UNUSED)
{
struct mailmap_info *mi = (struct mailmap_info *)p;
- debug_mm("mailmap: -- complex: '%s' -> '%s' <%s>\n",
- s, debug_str(mi->name), debug_str(mi->email));
free(mi->name);
free(mi->email);
free(mi);
}
-static void free_mailmap_entry(void *p, const char *s)
+static void free_mailmap_entry(void *p, const char *s UNUSED)
{
struct mailmap_entry *me = (struct mailmap_entry *)p;
- debug_mm("mailmap: removing entries for <%s>, with %"PRIuMAX" sub-entries\n",
- s, (uintmax_t)me->namemap.nr);
- debug_mm("mailmap: - simple: '%s' <%s>\n",
- debug_str(me->name), debug_str(me->email));
free(me->name);
free(me->email);
@@ -93,8 +80,6 @@ static void add_mapping(struct string_list *map,
}
if (!old_name) {
- debug_mm("mailmap: adding (simple) entry for '%s'\n", old_email);
-
/* Replace current name and new email for simple entry */
if (new_name) {
free(me->name);
@@ -106,15 +91,10 @@ static void add_mapping(struct string_list *map,
}
} else {
struct mailmap_info *mi = xcalloc(1, sizeof(struct mailmap_info));
- debug_mm("mailmap: adding (complex) entry for '%s'\n", old_email);
mi->name = xstrdup_or_null(new_name);
mi->email = xstrdup_or_null(new_email);
string_list_insert(&me->namemap, old_name)->util = mi;
}
-
- debug_mm("mailmap: '%s' <%s> -> '%s' <%s>\n",
- debug_str(old_name), old_email,
- debug_str(new_name), debug_str(new_email));
}
static char *parse_name_and_email(char *buffer, char **name,
@@ -213,10 +193,10 @@ static int read_mailmap_blob(struct string_list *map, const char *name)
if (!name)
return 0;
- if (get_oid(name, &oid) < 0)
+ if (repo_get_oid(the_repository, name, &oid) < 0)
return 0;
- buf = read_object_file(&oid, &type, &size);
+ buf = repo_read_object_file(the_repository, &oid, &type, &size);
if (!buf)
return error("unable to read mailmap object at %s", name);
if (type != OBJ_BLOB)
@@ -250,11 +230,8 @@ int read_mailmap(struct string_list *map)
void clear_mailmap(struct string_list *map)
{
- debug_mm("mailmap: clearing %"PRIuMAX" entries...\n",
- (uintmax_t)map->nr);
map->strdup_strings = 1;
string_list_clear_func(map, free_mailmap_entry);
- debug_mm("mailmap: cleared\n");
}
/*
@@ -315,10 +292,6 @@ int map_user(struct string_list *map,
struct string_list_item *item;
struct mailmap_entry *me;
- debug_mm("map_user: map '%.*s' <%.*s>\n",
- (int)*namelen, debug_str(*name),
- (int)*emaillen, debug_str(*email));
-
item = lookup_prefix(map, *email, *emaillen);
if (item) {
me = (struct mailmap_entry *)item->util;
@@ -336,10 +309,8 @@ int map_user(struct string_list *map,
}
if (item) {
struct mailmap_info *mi = (struct mailmap_info *)item->util;
- if (mi->name == NULL && mi->email == NULL) {
- debug_mm("map_user: -- (no simple mapping)\n");
+ if (mi->name == NULL && mi->email == NULL)
return 0;
- }
if (mi->email) {
*email = mi->email;
*emaillen = strlen(*email);
@@ -348,11 +319,7 @@ int map_user(struct string_list *map,
*name = mi->name;
*namelen = strlen(*name);
}
- debug_mm("map_user: to '%.*s' <%.*s>\n",
- (int)*namelen, debug_str(*name),
- (int)*emaillen, debug_str(*email));
return 1;
}
- debug_mm("map_user: --\n");
return 0;
}
diff --git a/mailmap.h b/mailmap.h
index 7e99fccb46..0f8fd2c586 100644
--- a/mailmap.h
+++ b/mailmap.h
@@ -3,6 +3,9 @@
struct string_list;
+extern const char *git_mailmap_file;
+extern const char *git_mailmap_blob;
+
int read_mailmap(struct string_list *map);
void clear_mailmap(struct string_list *map);
diff --git a/match-trees.c b/match-trees.c
index 49398e599f..6bc8eb7647 100644
--- a/match-trees.c
+++ b/match-trees.c
@@ -1,4 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "hex.h"
+#include "match-trees.h"
#include "tree.h"
#include "tree-walk.h"
#include "object-store.h"
@@ -55,7 +57,7 @@ static void *fill_tree_desc_strict(struct tree_desc *desc,
enum object_type type;
unsigned long size;
- buffer = read_object_file(hash, &type, &size);
+ buffer = repo_read_object_file(the_repository, hash, &type, &size);
if (!buffer)
die("unable to read tree (%s)", oid_to_hex(hash));
if (type != OBJ_TREE)
@@ -188,7 +190,7 @@ static int splice_tree(const struct object_id *oid1, const char *prefix,
if (*subpath)
subpath++;
- buf = read_object_file(oid1, &type, &sz);
+ buf = repo_read_object_file(the_repository, oid1, &type, &sz);
if (!buf)
die("cannot read tree %s", oid_to_hex(oid1));
init_tree_desc(&desc, buf, sz);
diff --git a/match-trees.h b/match-trees.h
new file mode 100644
index 0000000000..e3877acd58
--- /dev/null
+++ b/match-trees.h
@@ -0,0 +1,10 @@
+#ifndef MATCH_TREES_H
+#define MATCH_TREES_H
+
+struct object_id;
+struct repository;
+
+void shift_tree(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, int);
+void shift_tree_by(struct repository *, const struct object_id *, const struct object_id *, struct object_id *, const char *);
+
+#endif /* MATCH_TREES_H */
diff --git a/mem-pool.c b/mem-pool.c
index 599d8e895f..c34846d176 100644
--- a/mem-pool.c
+++ b/mem-pool.c
@@ -2,7 +2,7 @@
* Memory Pool implementation logic.
*/
-#include "cache.h"
+#include "git-compat-util.h"
#include "mem-pool.h"
#define BLOCK_GROWTH_SIZE (1024 * 1024 - sizeof(struct mp_block))
diff --git a/merge-blobs.c b/merge-blobs.c
index 8138090f81..5632ff6abb 100644
--- a/merge-blobs.c
+++ b/merge-blobs.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "run-command.h"
#include "xdiff-interface.h"
#include "ll-merge.h"
@@ -12,7 +12,8 @@ static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
unsigned long size;
enum object_type type;
- buf = read_object_file(&obj->object.oid, &type, &size);
+ buf = repo_read_object_file(the_repository, &obj->object.oid, &type,
+ &size);
if (!buf)
return -1;
if (type != OBJ_BLOB) {
@@ -78,7 +79,8 @@ void *merge_blobs(struct index_state *istate, const char *path,
return NULL;
if (!our)
our = their;
- return read_object_file(&our->object.oid, &type, size);
+ return repo_read_object_file(the_repository, &our->object.oid,
+ &type, size);
}
if (fill_mmfile_blob(&f1, our) < 0)
diff --git a/merge-ort-wrappers.c b/merge-ort-wrappers.c
index 748924a69b..a550753300 100644
--- a/merge-ort-wrappers.c
+++ b/merge-ort-wrappers.c
@@ -1,6 +1,9 @@
#include "cache.h"
+#include "gettext.h"
+#include "hash.h"
#include "merge-ort.h"
#include "merge-ort-wrappers.h"
+#include "tree.h"
#include "commit.h"
diff --git a/merge-ort.c b/merge-ort.c
index e5f41cce48..a50b095c47 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -26,14 +26,22 @@
#include "diff.h"
#include "diffcore.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "entry.h"
#include "ll-merge.h"
+#include "match-trees.h"
+#include "mem-pool.h"
+#include "object-name.h"
#include "object-store.h"
+#include "oid-array.h"
#include "promisor-remote.h"
#include "revision.h"
#include "strmap.h"
#include "submodule-config.h"
#include "submodule.h"
+#include "trace2.h"
#include "tree.h"
#include "unpack-trees.h"
#include "xdiff-interface.h"
@@ -397,7 +405,7 @@ struct conflicted_submodule_item {
int flag;
};
-static void conflicted_submodule_item_free(void *util, const char *str)
+static void conflicted_submodule_item_free(void *util, const char *str UNUSED)
{
struct conflicted_submodule_item *item = util;
@@ -2619,8 +2627,40 @@ static void apply_directory_rename_modifications(struct merge_options *opt,
}
assert(ci->filemask == 2 || ci->filemask == 4);
- assert(ci->dirmask == 0);
- strmap_remove(&opt->priv->paths, old_path, 0);
+ assert(ci->dirmask == 0 || ci->dirmask == 1);
+ if (ci->dirmask == 0)
+ strmap_remove(&opt->priv->paths, old_path, 0);
+ else {
+ /*
+ * This file exists on one side, but we still had a directory
+ * at the old location that we can't remove until after
+ * processing all paths below it. So, make a copy of ci in
+ * new_ci and only put the file information into it.
+ */
+ new_ci = mem_pool_calloc(&opt->priv->pool, 1, sizeof(*new_ci));
+ memcpy(new_ci, ci, sizeof(*ci));
+ assert(!new_ci->match_mask);
+ new_ci->dirmask = 0;
+ new_ci->stages[1].mode = 0;
+ oidcpy(&new_ci->stages[1].oid, null_oid());
+
+ /*
+ * Now that we have the file information in new_ci, make sure
+ * ci only has the directory information.
+ */
+ ci->filemask = 0;
+ ci->merged.clean = 1;
+ for (i = MERGE_BASE; i <= MERGE_SIDE2; i++) {
+ if (ci->dirmask & (1 << i))
+ continue;
+ /* zero out any entries related to files */
+ ci->stages[i].mode = 0;
+ oidcpy(&ci->stages[i].oid, null_oid());
+ }
+
+ // Now we want to focus on new_ci, so reassign ci to it
+ ci = new_ci;
+ }
branch_with_new_path = (ci->filemask == 2) ? opt->branch1 : opt->branch2;
branch_with_dir_rename = (ci->filemask == 2) ? opt->branch2 : opt->branch1;
@@ -3473,7 +3513,7 @@ static int read_oid_strbuf(struct merge_options *opt,
void *buf;
enum object_type type;
unsigned long size;
- buf = read_object_file(oid, &type, &size);
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
if (!buf)
return err(opt, _("cannot read object %s"), oid_to_hex(oid));
if (type != OBJ_BLOB) {
@@ -4184,7 +4224,7 @@ static void prefetch_for_content_merges(struct merge_options *opt,
struct string_list_item *e;
struct oid_array to_fetch = OID_ARRAY_INIT;
- if (opt->repo != the_repository || !has_promisor_remote())
+ if (opt->repo != the_repository || !repo_has_promisor_remote(the_repository))
return;
for (e = &plist->items[plist->nr-1]; e >= plist->items; --e) {
@@ -4683,14 +4723,14 @@ void merge_switch_to_result(struct merge_options *opt,
void merge_finalize(struct merge_options *opt,
struct merge_result *result)
{
- struct merge_options_internal *opti = result->priv;
-
if (opt->renormalize)
git_attr_set_direction(GIT_ATTR_CHECKIN);
assert(opt->priv == NULL);
- clear_or_reinit_internal_opts(opti, 0);
- FREE_AND_NULL(opti);
+ if (result->priv) {
+ clear_or_reinit_internal_opts(result->priv, 0);
+ FREE_AND_NULL(result->priv);
+ }
}
/*** Function Grouping: helper functions for merge_incore_*() ***/
@@ -4985,7 +5025,7 @@ static void merge_ort_internal(struct merge_options *opt,
struct strbuf merge_base_abbrev = STRBUF_INIT;
if (!merge_bases) {
- merge_bases = get_merge_bases(h1, h2);
+ merge_bases = repo_get_merge_bases(the_repository, h1, h2);
/* See merge-ort.h:merge_incore_recursive() declaration NOTE */
merge_bases = reverse_commit_list(merge_bases);
}
diff --git a/merge-ort.h b/merge-ort.h
index a994c9a5fc..ce56ec1a78 100644
--- a/merge-ort.h
+++ b/merge-ort.h
@@ -2,7 +2,7 @@
#define MERGE_ORT_H
#include "merge-recursive.h"
-#include "hash.h"
+#include "hash-ll.h"
struct commit;
struct tree;
diff --git a/merge-recursive.c b/merge-recursive.c
index 4ddd3adea0..8e87b6386d 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -10,7 +10,6 @@
#include "alloc.h"
#include "attr.h"
#include "blob.h"
-#include "builtin.h"
#include "cache-tree.h"
#include "commit.h"
#include "commit-reach.h"
@@ -18,17 +17,25 @@
#include "diff.h"
#include "diffcore.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "ll-merge.h"
#include "lockfile.h"
+#include "match-trees.h"
+#include "object-file.h"
+#include "object-name.h"
#include "object-store.h"
#include "repository.h"
#include "revision.h"
#include "string-list.h"
#include "submodule-config.h"
#include "submodule.h"
+#include "symlinks.h"
#include "tag.h"
#include "tree-walk.h"
#include "unpack-trees.h"
+#include "wrapper.h"
#include "xdiff-interface.h"
struct merge_options_internal {
@@ -412,7 +419,7 @@ static int unpack_trees_start(struct merge_options *opt,
{
int rc;
struct tree_desc t[3];
- struct index_state tmp_index = { NULL };
+ struct index_state tmp_index = INDEX_STATE_INIT(opt->repo);
memset(&opt->priv->unpack_opts, 0, sizeof(opt->priv->unpack_opts));
if (opt->priv->call_depth)
@@ -951,7 +958,8 @@ static int update_file_flags(struct merge_options *opt,
goto update_index;
}
- buf = read_object_file(&contents->oid, &type, &size);
+ buf = repo_read_object_file(the_repository, &contents->oid,
+ &type, &size);
if (!buf) {
ret = err(opt, _("cannot read object %s '%s'"),
oid_to_hex(&contents->oid), path);
@@ -2100,7 +2108,7 @@ static char *handle_path_level_conflicts(struct merge_options *opt,
if (!new_path) {
/* This should only happen when entry->non_unique_new_dir set */
if (!entry->non_unique_new_dir)
- BUG("entry->non_unqiue_dir not set and !new_path");
+ BUG("entry->non_unique_new_dir not set and !new_path");
output(opt, 1, _("CONFLICT (directory rename split): "
"Unclear where to place %s because directory "
"%s was renamed to multiple other directories, "
@@ -3021,7 +3029,7 @@ static int read_oid_strbuf(struct merge_options *opt,
void *buf;
enum object_type type;
unsigned long size;
- buf = read_object_file(oid, &type, &size);
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
if (!buf)
return err(opt, _("cannot read object %s"), oid_to_hex(oid));
if (type != OBJ_BLOB) {
@@ -3592,7 +3600,7 @@ static int merge_recursive_internal(struct merge_options *opt,
}
if (!merge_bases) {
- merge_bases = get_merge_bases(h1, h2);
+ merge_bases = repo_get_merge_bases(the_repository, h1, h2);
merge_bases = reverse_commit_list(merge_bases);
}
@@ -3797,7 +3805,7 @@ static struct commit *get_ref(struct repository *repo,
return make_virtual_commit(repo, (struct tree*)object, name);
if (object->type != OBJ_COMMIT)
return NULL;
- if (parse_commit((struct commit *)object))
+ if (repo_parse_commit(repo, (struct commit *)object))
return NULL;
return (struct commit *)object;
}
diff --git a/merge.c b/merge.c
index 2382ff66d3..10aaec3a6c 100644
--- a/merge.c
+++ b/merge.c
@@ -1,10 +1,13 @@
#include "cache.h"
#include "diff.h"
#include "diffcore.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "commit.h"
#include "run-command.h"
#include "resolve-undo.h"
+#include "tree.h"
#include "tree-walk.h"
#include "unpack-trees.h"
#include "dir.h"
@@ -19,22 +22,22 @@ int try_merge_command(struct repository *r,
const char **xopts, struct commit_list *common,
const char *head_arg, struct commit_list *remotes)
{
- struct strvec args = STRVEC_INIT;
+ struct child_process cmd = CHILD_PROCESS_INIT;
int i, ret;
struct commit_list *j;
- strvec_pushf(&args, "merge-%s", strategy);
+ strvec_pushf(&cmd.args, "merge-%s", strategy);
for (i = 0; i < xopts_nr; i++)
- strvec_pushf(&args, "--%s", xopts[i]);
+ strvec_pushf(&cmd.args, "--%s", xopts[i]);
for (j = common; j; j = j->next)
- strvec_push(&args, merge_argument(j->item));
- strvec_push(&args, "--");
- strvec_push(&args, head_arg);
+ strvec_push(&cmd.args, merge_argument(j->item));
+ strvec_push(&cmd.args, "--");
+ strvec_push(&cmd.args, head_arg);
for (j = remotes; j; j = j->next)
- strvec_push(&args, merge_argument(j->item));
+ strvec_push(&cmd.args, merge_argument(j->item));
- ret = run_command_v_opt(args.v, RUN_GIT_CMD);
- strvec_clear(&args);
+ cmd.git_cmd = 1;
+ ret = run_command(&cmd);
discard_index(r->index);
if (repo_read_index(r) < 0)
diff --git a/midx.c b/midx.c
index 3a8dcfe98e..b500174d1f 100644
--- a/midx.c
+++ b/midx.c
@@ -1,9 +1,14 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
#include "csum-file.h"
#include "dir.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "packfile.h"
+#include "object-file.h"
#include "object-store.h"
#include "hash-lookup.h"
#include "midx.h"
@@ -278,7 +283,7 @@ uint32_t nth_midxed_pack_int_id(struct multi_pack_index *m, uint32_t pos)
(off_t)pos * MIDX_CHUNK_OFFSET_WIDTH);
}
-int fill_midx_entry(struct repository * r,
+int fill_midx_entry(struct repository *r,
const struct object_id *oid,
struct pack_entry *e,
struct multi_pack_index *m)
@@ -913,6 +918,8 @@ static uint32_t *midx_pack_order(struct write_midx_context *ctx)
uint32_t *pack_order;
uint32_t i;
+ trace2_region_enter("midx", "midx_pack_order", the_repository);
+
ALLOC_ARRAY(data, ctx->entries_nr);
for (i = 0; i < ctx->entries_nr; i++) {
struct pack_midx_entry *e = &ctx->entries[i];
@@ -930,6 +937,8 @@ static uint32_t *midx_pack_order(struct write_midx_context *ctx)
pack_order[i] = data[i].nr;
free(data);
+ trace2_region_leave("midx", "midx_pack_order", the_repository);
+
return pack_order;
}
@@ -939,6 +948,8 @@ static void write_midx_reverse_index(char *midx_name, unsigned char *midx_hash,
struct strbuf buf = STRBUF_INIT;
const char *tmp_file;
+ trace2_region_enter("midx", "write_midx_reverse_index", the_repository);
+
strbuf_addf(&buf, "%s-%s.rev", midx_name, hash_to_hex(midx_hash));
tmp_file = write_rev_file_order(NULL, ctx->pack_order, ctx->entries_nr,
@@ -948,6 +959,8 @@ static void write_midx_reverse_index(char *midx_name, unsigned char *midx_hash,
die(_("cannot store reverse index file"));
strbuf_release(&buf);
+
+ trace2_region_leave("midx", "write_midx_reverse_index", the_repository);
}
static void clear_midx_files_ext(const char *object_dir, const char *ext,
@@ -963,6 +976,8 @@ static void prepare_midx_packing_data(struct packing_data *pdata,
{
uint32_t i;
+ trace2_region_enter("midx", "prepare_midx_packing_data", the_repository);
+
memset(pdata, 0, sizeof(struct packing_data));
prepare_packing_data(the_repository, pdata);
@@ -973,6 +988,8 @@ static void prepare_midx_packing_data(struct packing_data *pdata,
oe_set_in_pack(pdata, to,
ctx->info[ctx->pack_perm[from->pack_int_id]].p);
}
+
+ trace2_region_leave("midx", "prepare_midx_packing_data", the_repository);
}
static int add_ref_to_pending(const char *refname,
@@ -980,6 +997,7 @@ static int add_ref_to_pending(const char *refname,
int flag, void *cb_data)
{
struct rev_info *revs = (struct rev_info*)cb_data;
+ struct object_id peeled;
struct object *object;
if ((flag & REF_ISSYMREF) && (flag & REF_ISBROKEN)) {
@@ -987,6 +1005,9 @@ static int add_ref_to_pending(const char *refname,
return 0;
}
+ if (!peel_iterated_oid(oid, &peeled))
+ oid = &peeled;
+
object = parse_object_or_die(oid, refname);
if (object->type != OBJ_COMMIT)
return 0;
@@ -1066,6 +1087,9 @@ 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);
+
cb.ctx = ctx;
repo_init_revisions(the_repository, &revs, NULL);
@@ -1099,6 +1123,10 @@ static struct commit **find_commits_for_midx_bitmap(uint32_t *indexed_commits_nr
*indexed_commits_nr_p = cb.commits_nr;
release_revisions(&revs);
+
+ trace2_region_leave("midx", "find_commits_for_midx_bitmap",
+ the_repository);
+
return cb.commits;
}
@@ -1116,6 +1144,8 @@ static int write_midx_bitmap(const char *midx_name,
char *bitmap_name = xstrfmt("%s-%s.bitmap", midx_name,
hash_to_hex(midx_hash));
+ trace2_region_enter("midx", "write_midx_bitmap", the_repository);
+
if (flags & MIDX_WRITE_BITMAP_HASH_CACHE)
options |= BITMAP_OPT_HASH_CACHE;
@@ -1161,6 +1191,9 @@ static int write_midx_bitmap(const char *midx_name,
cleanup:
free(index);
free(bitmap_name);
+
+ trace2_region_leave("midx", "write_midx_bitmap", the_repository);
+
return ret;
}
@@ -1207,6 +1240,8 @@ static int write_midx_internal(const char *object_dir,
int result = 0;
struct chunkfile *cf;
+ trace2_region_enter("midx", "write_midx_internal", the_repository);
+
get_midx_filename(&midx_name, object_dir);
if (safe_create_leading_directories(midx_name.buf))
die_errno(_("unable to create leading directories of %s"),
@@ -1296,17 +1331,17 @@ static int write_midx_internal(const char *object_dir,
}
if (preferred_pack_name) {
- int found = 0;
+ ctx.preferred_pack_idx = -1;
+
for (i = 0; i < ctx.nr; i++) {
if (!cmp_idx_or_pack_name(preferred_pack_name,
ctx.info[i].pack_name)) {
ctx.preferred_pack_idx = i;
- found = 1;
break;
}
}
- if (!found)
+ if (ctx.preferred_pack_idx == -1)
warning(_("unknown preferred pack: '%s'"),
preferred_pack_name);
} else if (ctx.nr &&
@@ -1548,6 +1583,8 @@ cleanup:
free(ctx.pack_order);
strbuf_release(&midx_name);
+ trace2_region_leave("midx", "write_midx_internal", the_repository);
+
return result;
}
@@ -1575,7 +1612,7 @@ struct clear_midx_data {
const char *ext;
};
-static void clear_midx_file_ext(const char *full_path, size_t full_path_len,
+static void clear_midx_file_ext(const char *full_path, size_t full_path_len UNUSED,
const char *file_name, void *_data)
{
struct clear_midx_data *data = _data;
diff --git a/name-hash.c b/name-hash.c
index cd009c7c8a..fb13716e43 100644
--- a/name-hash.c
+++ b/name-hash.c
@@ -6,7 +6,10 @@
* Copyright (C) 2008 Linus Torvalds
*/
#include "cache.h"
+#include "environment.h"
+#include "gettext.h"
#include "thread-utils.h"
+#include "trace.h"
#include "trace2.h"
#include "sparse-index.h"
diff --git a/negotiator/default.c b/negotiator/default.c
index b7e79feaf0..9a5b696327 100644
--- a/negotiator/default.c
+++ b/negotiator/default.c
@@ -1,9 +1,10 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "default.h"
#include "../commit.h"
#include "../fetch-negotiator.h"
#include "../prio-queue.h"
#include "../refs.h"
+#include "../repository.h"
#include "../tag.h"
/* Remember to update object flag allocation in object.h */
@@ -25,7 +26,7 @@ static void rev_list_push(struct negotiation_state *ns,
if (!(commit->object.flags & mark)) {
commit->object.flags |= mark;
- if (parse_commit(commit))
+ if (repo_parse_commit(the_repository, commit))
return;
prio_queue_put(&ns->rev_list, commit);
@@ -55,30 +56,49 @@ static int clear_marks(const char *refname, const struct object_id *oid,
static void mark_common(struct negotiation_state *ns, struct commit *commit,
int ancestors_only, int dont_parse)
{
- if (commit != NULL && !(commit->object.flags & COMMON)) {
- struct object *o = (struct object *)commit;
+ struct prio_queue queue = { NULL };
+
+ if (!commit || (commit->object.flags & COMMON))
+ return;
+
+ prio_queue_put(&queue, commit);
+ if (!ancestors_only) {
+ commit->object.flags |= COMMON;
- if (!ancestors_only)
- o->flags |= COMMON;
+ if ((commit->object.flags & SEEN) && !(commit->object.flags & POPPED))
+ ns->non_common_revs--;
+ }
+ while ((commit = prio_queue_get(&queue))) {
+ struct object *o = (struct object *)commit;
if (!(o->flags & SEEN))
rev_list_push(ns, commit, SEEN);
else {
struct commit_list *parents;
- if (!ancestors_only && !(o->flags & POPPED))
- ns->non_common_revs--;
if (!o->parsed && !dont_parse)
- if (parse_commit(commit))
- return;
+ if (repo_parse_commit(the_repository, commit))
+ continue;
for (parents = commit->parents;
parents;
- parents = parents->next)
- mark_common(ns, parents->item, 0,
- dont_parse);
+ parents = parents->next) {
+ struct commit *p = parents->item;
+
+ if (p->object.flags & COMMON)
+ continue;
+
+ p->object.flags |= COMMON;
+
+ if ((p->object.flags & SEEN) && !(p->object.flags & POPPED))
+ ns->non_common_revs--;
+
+ prio_queue_put(&queue, parents->item);
+ }
}
}
+
+ clear_prio_queue(&queue);
}
/*
@@ -96,7 +116,7 @@ static const struct object_id *get_rev(struct negotiation_state *ns)
return NULL;
commit = prio_queue_get(&ns->rev_list);
- parse_commit(commit);
+ repo_parse_commit(the_repository, commit);
parents = commit->parents;
commit->object.flags |= POPPED;
diff --git a/negotiator/noop.c b/negotiator/noop.c
index 60569b8350..7b72937686 100644
--- a/negotiator/noop.c
+++ b/negotiator/noop.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "noop.h"
#include "../commit.h"
#include "../fetch-negotiator.h"
diff --git a/negotiator/skipping.c b/negotiator/skipping.c
index c4398f5ae1..5b91520430 100644
--- a/negotiator/skipping.c
+++ b/negotiator/skipping.c
@@ -1,9 +1,11 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "skipping.h"
#include "../commit.h"
#include "../fetch-negotiator.h"
+#include "../hex.h"
#include "../prio-queue.h"
#include "../refs.h"
+#include "../repository.h"
#include "../tag.h"
/* Remember to update object flag allocation in object.h */
@@ -50,7 +52,7 @@ struct data {
int non_common_revs;
};
-static int compare(const void *a_, const void *b_, void *unused)
+static int compare(const void *a_, const void *b_, void *data UNUSED)
{
const struct entry *a = a_;
const struct entry *b = b_;
@@ -84,24 +86,37 @@ static int clear_marks(const char *refname, const struct object_id *oid,
}
/*
- * Mark this SEEN commit and all its SEEN ancestors as COMMON.
+ * Mark this SEEN commit and all its parsed SEEN ancestors as COMMON.
*/
-static void mark_common(struct data *data, struct commit *c)
+static void mark_common(struct data *data, struct commit *seen_commit)
{
- struct commit_list *p;
+ struct prio_queue queue = { NULL };
+ struct commit *c;
- if (c->object.flags & COMMON)
+ if (seen_commit->object.flags & COMMON)
return;
- c->object.flags |= COMMON;
- if (!(c->object.flags & POPPED))
- data->non_common_revs--;
- if (!c->object.parsed)
- return;
- for (p = c->parents; p; p = p->next) {
- if (p->item->object.flags & SEEN)
- mark_common(data, p->item);
+ prio_queue_put(&queue, seen_commit);
+ seen_commit->object.flags |= COMMON;
+ while ((c = prio_queue_get(&queue))) {
+ struct commit_list *p;
+
+ if (!(c->object.flags & POPPED))
+ data->non_common_revs--;
+
+ if (!c->object.parsed)
+ continue;
+ for (p = c->parents; p; p = p->next) {
+ if (!(p->item->object.flags & SEEN) ||
+ (p->item->object.flags & COMMON))
+ continue;
+
+ p->item->object.flags |= COMMON;
+ prio_queue_put(&queue, p->item);
+ }
}
+
+ clear_prio_queue(&queue);
}
/*
@@ -178,7 +193,7 @@ static const struct object_id *get_rev(struct data *data)
if (!(commit->object.flags & COMMON) && !entry->ttl)
to_send = commit;
- parse_commit(commit);
+ repo_parse_commit(the_repository, commit);
for (p = commit->parents; p; p = p->next)
parent_pushed |= push_parent(data, entry, p->item);
diff --git a/notes-cache.c b/notes-cache.c
index 9dfd251a81..14288caf98 100644
--- a/notes-cache.c
+++ b/notes-cache.c
@@ -1,6 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "notes-cache.h"
#include "object-store.h"
+#include "pretty.h"
#include "repository.h"
#include "commit.h"
#include "refs.h"
@@ -23,7 +24,8 @@ static int notes_cache_match_validity(struct repository *r,
return 0;
memset(&pretty_ctx, 0, sizeof(pretty_ctx));
- format_commit_message(commit, "%s", &msg, &pretty_ctx);
+ repo_format_commit_message(r, commit, "%s", &msg,
+ &pretty_ctx);
strbuf_trim(&msg);
ret = !strcmp(msg.buf, validity);
@@ -81,7 +83,7 @@ char *notes_cache_get(struct notes_cache *c, struct object_id *key_oid,
value_oid = get_note(&c->tree, key_oid);
if (!value_oid)
return NULL;
- value = read_object_file(value_oid, &type, &size);
+ value = repo_read_object_file(the_repository, value_oid, &type, &size);
*outsize = size;
return value;
diff --git a/notes-merge.c b/notes-merge.c
index b4cc594a79..233e49e319 100644
--- a/notes-merge.c
+++ b/notes-merge.c
@@ -1,18 +1,25 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "advice.h"
#include "commit.h"
+#include "gettext.h"
#include "refs.h"
+#include "object-file.h"
+#include "object-name.h"
#include "object-store.h"
#include "repository.h"
#include "diff.h"
#include "diffcore.h"
+#include "hex.h"
#include "xdiff-interface.h"
#include "ll-merge.h"
#include "dir.h"
#include "notes.h"
#include "notes-merge.h"
#include "strbuf.h"
+#include "trace.h"
#include "notes-utils.h"
#include "commit-reach.h"
+#include "wrapper.h"
struct notes_merge_pair {
struct object_id obj, base, local, remote;
@@ -326,7 +333,7 @@ static void write_note_to_worktree(const struct object_id *obj,
{
enum object_type type;
unsigned long size;
- void *buf = read_object_file(note, &type, &size);
+ void *buf = repo_read_object_file(the_repository, note, &type, &size);
if (!buf)
die("cannot read note %s for object %s",
@@ -566,7 +573,7 @@ int notes_merge(struct notes_merge_options *o,
trace_printf("\tlocal commit: %.7s\n", oid_to_hex(&local_oid));
/* Dereference o->remote_ref into remote_oid */
- if (get_oid(o->remote_ref, &remote_oid)) {
+ if (repo_get_oid(the_repository, o->remote_ref, &remote_oid)) {
/*
* Failed to get remote_oid. If o->remote_ref looks like an
* unborn ref, perform the merge using an empty notes tree.
@@ -600,7 +607,7 @@ int notes_merge(struct notes_merge_options *o,
assert(local && remote);
/* Find merge bases */
- bases = get_merge_bases(local, remote);
+ bases = repo_get_merge_bases(the_repository, local, remote);
if (!bases) {
base_oid = null_oid();
base_tree_oid = the_hash_algo->empty_tree;
@@ -678,7 +685,8 @@ int notes_merge_commit(struct notes_merge_options *o,
DIR *dir;
struct dirent *e;
struct strbuf path = STRBUF_INIT;
- const char *buffer = get_commit_buffer(partial_commit, NULL);
+ const char *buffer = repo_get_commit_buffer(the_repository,
+ partial_commit, NULL);
const char *msg = strstr(buffer, "\n\n");
int baselen;
@@ -725,7 +733,7 @@ int notes_merge_commit(struct notes_merge_options *o,
create_notes_commit(o->repo, partial_tree, partial_commit->parents, msg,
strlen(msg), result_oid);
- unuse_commit_buffer(partial_commit, buffer);
+ repo_unuse_commit_buffer(the_repository, partial_commit, buffer);
if (o->verbosity >= 4)
printf("Finalized notes merge commit: %s\n",
oid_to_hex(result_oid));
diff --git a/notes-utils.c b/notes-utils.c
index d7d18e30f5..4a793eb347 100644
--- a/notes-utils.c
+++ b/notes-utils.c
@@ -1,9 +1,12 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "commit.h"
+#include "environment.h"
+#include "gettext.h"
#include "refs.h"
#include "notes-utils.h"
#include "repository.h"
+#include "strbuf.h"
void create_notes_commit(struct repository *r,
struct notes_tree *t,
@@ -23,7 +26,7 @@ void create_notes_commit(struct repository *r,
struct object_id parent_oid;
if (!read_ref(t->ref, &parent_oid)) {
struct commit *parent = lookup_commit(r, &parent_oid);
- if (parse_commit(parent))
+ if (repo_parse_commit(r, parent))
die("Failed to find/parse commit %s", t->ref);
commit_list_insert(parent, &parents);
}
diff --git a/notes.c b/notes.c
index f2805d51bb..f51a2d3630 100644
--- a/notes.c
+++ b/notes.c
@@ -1,6 +1,9 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
+#include "environment.h"
+#include "hex.h"
#include "notes.h"
+#include "object-name.h"
#include "object-store.h"
#include "blob.h"
#include "tree.h"
@@ -752,7 +755,7 @@ static int write_each_non_note_until(const char *note_path,
return 0;
}
-static int write_each_note(const struct object_id *object_oid,
+static int write_each_note(const struct object_id *object_oid UNUSED,
const struct object_id *note_oid, char *note_path,
void *cb_data)
{
@@ -780,13 +783,14 @@ struct note_delete_list {
};
static int prune_notes_helper(const struct object_id *object_oid,
- const struct object_id *note_oid, char *note_path,
- void *cb_data)
+ const struct object_id *note_oid UNUSED,
+ char *note_path UNUSED,
+ void *cb_data)
{
struct note_delete_list **l = (struct note_delete_list **) cb_data;
struct note_delete_list *n;
- if (has_object_file(object_oid))
+ if (repo_has_object_file(the_repository, object_oid))
return 0; /* nothing to do for this note */
/* failed to find object => prune this note */
@@ -807,13 +811,15 @@ int combine_notes_concatenate(struct object_id *cur_oid,
/* read in both note blob objects */
if (!is_null_oid(new_oid))
- new_msg = read_object_file(new_oid, &new_type, &new_len);
+ new_msg = repo_read_object_file(the_repository, new_oid,
+ &new_type, &new_len);
if (!new_msg || !new_len || new_type != OBJ_BLOB) {
free(new_msg);
return 0;
}
if (!is_null_oid(cur_oid))
- cur_msg = read_object_file(cur_oid, &cur_type, &cur_len);
+ cur_msg = repo_read_object_file(the_repository, cur_oid,
+ &cur_type, &cur_len);
if (!cur_msg || !cur_len || cur_type != OBJ_BLOB) {
free(cur_msg);
free(new_msg);
@@ -848,8 +854,8 @@ int combine_notes_overwrite(struct object_id *cur_oid,
return 0;
}
-int combine_notes_ignore(struct object_id *cur_oid,
- const struct object_id *new_oid)
+int combine_notes_ignore(struct object_id *cur_oid UNUSED,
+ const struct object_id *new_oid UNUSED)
{
return 0;
}
@@ -869,7 +875,7 @@ static int string_list_add_note_lines(struct string_list *list,
return 0;
/* read_sha1_file NUL-terminates */
- data = read_object_file(oid, &t, &len);
+ data = repo_read_object_file(the_repository, oid, &t, &len);
if (t != OBJ_BLOB || !data || !len) {
free(data);
return t != OBJ_BLOB || !data;
@@ -944,7 +950,7 @@ void string_list_add_refs_by_glob(struct string_list *list, const char *glob)
for_each_glob_ref(string_list_add_one_ref, glob, list);
} else {
struct object_id oid;
- if (get_oid(glob, &oid))
+ if (repo_get_oid(the_repository, glob, &oid))
warning("notes ref %s is invalid", glob);
if (!unsorted_string_list_has_string(list, glob))
string_list_append(list, glob);
@@ -958,7 +964,7 @@ void string_list_add_refs_from_colon_sep(struct string_list *list,
char *globs_copy = xstrdup(globs);
int i;
- string_list_split_in_place(&split, globs_copy, ':', -1);
+ string_list_split_in_place(&split, globs_copy, ":", -1);
string_list_remove_empty_items(&split, 0);
for (i = 0; i < split.nr; i++)
@@ -1014,14 +1020,14 @@ void init_notes(struct notes_tree *t, const char *notes_ref,
t->root = (struct int_node *) xcalloc(1, sizeof(struct int_node));
t->first_non_note = NULL;
t->prev_non_note = NULL;
- t->ref = xstrdup_or_null(notes_ref);
+ t->ref = xstrdup(notes_ref);
t->update_ref = (flags & NOTES_INIT_WRITABLE) ? t->ref : NULL;
t->combine_notes = combine_notes;
t->initialized = 1;
t->dirty = 0;
- if (flags & NOTES_INIT_EMPTY || !notes_ref ||
- get_oid_treeish(notes_ref, &object_oid))
+ if (flags & NOTES_INIT_EMPTY ||
+ repo_get_oid_treeish(the_repository, notes_ref, &object_oid))
return;
if (flags & NOTES_INIT_WRITABLE && read_ref(notes_ref, &object_oid))
die("Cannot use notes ref %s", notes_ref);
@@ -1264,7 +1270,7 @@ static void format_note(struct notes_tree *t, const struct object_id *object_oid
if (!oid)
return;
- if (!(msg = read_object_file(oid, &type, &msglen)) || type != OBJ_BLOB) {
+ if (!(msg = repo_read_object_file(the_repository, oid, &type, &msglen)) || type != OBJ_BLOB) {
free(msg);
return;
}
@@ -1348,7 +1354,7 @@ void expand_loose_notes_ref(struct strbuf *sb)
{
struct object_id object;
- if (get_oid(sb->buf, &object)) {
+ if (repo_get_oid(the_repository, sb->buf, &object)) {
/* fallback to expand_notes_ref */
expand_notes_ref(sb);
}
diff --git a/object-file.c b/object-file.c
index 5b270f046d..7c1af5c8db 100644
--- a/object-file.c
+++ b/object-file.c
@@ -6,8 +6,14 @@
* This handles basic git object files - packing, unpacking,
* creation etc.
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
+#include "convert.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "string-list.h"
#include "lockfile.h"
#include "delta.h"
@@ -30,9 +36,14 @@
#include "mergesort.h"
#include "quote.h"
#include "packfile.h"
+#include "object-file.h"
#include "object-store.h"
+#include "oidtree.h"
#include "promisor-remote.h"
+#include "setup.h"
#include "submodule.h"
+#include "fsck.h"
+#include "wrapper.h"
/* The maximum size for an object header. */
#define MAX_HEADER_LEN 32
@@ -140,27 +151,32 @@ static void git_hash_sha256_final_oid(struct object_id *oid, git_hash_ctx *ctx)
oid->algo = GIT_HASH_SHA256;
}
-static void git_hash_unknown_init(git_hash_ctx *ctx)
+static void git_hash_unknown_init(git_hash_ctx *ctx UNUSED)
{
BUG("trying to init unknown hash");
}
-static void git_hash_unknown_clone(git_hash_ctx *dst, const git_hash_ctx *src)
+static void git_hash_unknown_clone(git_hash_ctx *dst UNUSED,
+ const git_hash_ctx *src UNUSED)
{
BUG("trying to clone unknown hash");
}
-static void git_hash_unknown_update(git_hash_ctx *ctx, const void *data, size_t len)
+static void git_hash_unknown_update(git_hash_ctx *ctx UNUSED,
+ const void *data UNUSED,
+ size_t len UNUSED)
{
BUG("trying to update unknown hash");
}
-static void git_hash_unknown_final(unsigned char *hash, git_hash_ctx *ctx)
+static void git_hash_unknown_final(unsigned char *hash UNUSED,
+ git_hash_ctx *ctx UNUSED)
{
BUG("trying to finalize unknown hash");
}
-static void git_hash_unknown_final_oid(struct object_id *oid, git_hash_ctx *ctx)
+static void git_hash_unknown_final_oid(struct object_id *oid UNUSED,
+ git_hash_ctx *ctx UNUSED)
{
BUG("trying to finalize unknown hash");
}
@@ -261,7 +277,7 @@ int hash_algo_by_length(int len)
/*
* This is meant to hold a *small* number of objects that you would
- * want read_object_file() to be able to return, but yet you do not want
+ * want repo_read_object_file() to be able to return, but yet you do not want
* to write them into the object store (e.g. a browse-only
* application).
*/
@@ -503,7 +519,9 @@ static int link_alt_odb_entry(struct repository *r, const struct strbuf *entry,
{
struct object_directory *ent;
struct strbuf pathbuf = STRBUF_INIT;
+ struct strbuf tmp = STRBUF_INIT;
khiter_t pos;
+ int ret = -1;
if (!is_absolute_path(entry->buf) && relative_base) {
strbuf_realpath(&pathbuf, relative_base, 1);
@@ -511,12 +529,12 @@ static int link_alt_odb_entry(struct repository *r, const struct strbuf *entry,
}
strbuf_addbuf(&pathbuf, entry);
- if (strbuf_normalize_path(&pathbuf) < 0 && relative_base) {
+ if (!strbuf_realpath(&tmp, pathbuf.buf, 0)) {
error(_("unable to normalize alternate object path: %s"),
pathbuf.buf);
- strbuf_release(&pathbuf);
- return -1;
+ goto error;
}
+ strbuf_swap(&pathbuf, &tmp);
/*
* The trailing slash after the directory name is given by
@@ -525,10 +543,8 @@ static int link_alt_odb_entry(struct repository *r, const struct strbuf *entry,
while (pathbuf.len && pathbuf.buf[pathbuf.len - 1] == '/')
strbuf_setlen(&pathbuf, pathbuf.len - 1);
- if (!alt_odb_usable(r->objects, &pathbuf, normalized_objdir, &pos)) {
- strbuf_release(&pathbuf);
- return -1;
- }
+ if (!alt_odb_usable(r->objects, &pathbuf, normalized_objdir, &pos))
+ goto error;
CALLOC_ARRAY(ent, 1);
/* pathbuf.buf is already in r->objects->odb_by_path */
@@ -543,8 +559,11 @@ static int link_alt_odb_entry(struct repository *r, const struct strbuf *entry,
/* recursively add alternates */
read_info_alternates(r, ent->path, depth + 1);
-
- return 0;
+ ret = 0;
+ error:
+ strbuf_release(&tmp);
+ strbuf_release(&pathbuf);
+ return ret;
}
static const char *parse_alt_odb_entry(const char *string,
@@ -591,10 +610,7 @@ static void link_alt_odb_entries(struct repository *r, const char *alt,
return;
}
- strbuf_add_absolute_path(&objdirbuf, r->objects->odb->path);
- if (strbuf_normalize_path(&objdirbuf) < 0)
- die(_("unable to normalize object directory: %s"),
- objdirbuf.buf);
+ strbuf_realpath(&objdirbuf, r->objects->odb->path, 1);
while (*alt) {
alt = parse_alt_odb_entry(alt, sep, &entry);
@@ -938,6 +954,12 @@ void prepare_alt_odb(struct repository *r)
r->objects->loaded_alternates = 1;
}
+int has_alt_odb(struct repository *r)
+{
+ prepare_alt_odb(r);
+ return !!r->objects->odb->next;
+}
+
/* Returns 1 if we have successfully freshened the file, 0 otherwise. */
static int freshen_file(const char *fn)
{
@@ -1206,35 +1228,25 @@ static int quick_has_loose(struct repository *r,
}
/*
- * Map the loose object at "path" if it is not NULL, or the path found by
- * searching for a loose object named "oid".
+ * Map and close the given loose object fd. The path argument is used for
+ * error reporting.
*/
-static void *map_loose_object_1(struct repository *r, const char *path,
- const struct object_id *oid, unsigned long *size)
+static void *map_fd(int fd, const char *path, unsigned long *size)
{
- void *map;
- int fd;
-
- if (path)
- fd = git_open(path);
- else
- fd = open_loose_object(r, oid, &path);
- map = NULL;
- if (fd >= 0) {
- struct stat st;
+ void *map = NULL;
+ struct stat st;
- if (!fstat(fd, &st)) {
- *size = xsize_t(st.st_size);
- if (!*size) {
- /* mmap() is forbidden on empty files */
- error(_("object file %s is empty"), path);
- close(fd);
- return NULL;
- }
- map = xmmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);
+ if (!fstat(fd, &st)) {
+ *size = xsize_t(st.st_size);
+ if (!*size) {
+ /* mmap() is forbidden on empty files */
+ error(_("object file %s is empty"), path);
+ close(fd);
+ return NULL;
}
- close(fd);
+ map = xmmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);
}
+ close(fd);
return map;
}
@@ -1242,7 +1254,12 @@ void *map_loose_object(struct repository *r,
const struct object_id *oid,
unsigned long *size)
{
- return map_loose_object_1(r, NULL, oid, size);
+ const char *p;
+ int fd = open_loose_object(r, oid, &p);
+
+ if (fd < 0)
+ return NULL;
+ return map_fd(fd, p, size);
}
enum unpack_loose_header_result unpack_loose_header(git_zstream *stream,
@@ -1422,7 +1439,9 @@ static int loose_object_info(struct repository *r,
struct object_info *oi, int flags)
{
int status = 0;
+ int fd;
unsigned long mapsize;
+ const char *path;
void *map;
git_zstream stream;
char hdr[MAX_HEADER_LEN];
@@ -1443,7 +1462,6 @@ static int loose_object_info(struct repository *r,
* object even exists.
*/
if (!oi->typep && !oi->type_name && !oi->sizep && !oi->contentp) {
- const char *path;
struct stat st;
if (!oi->disk_sizep && (flags & OBJECT_INFO_QUICK))
return quick_has_loose(r, oid) ? 0 : -1;
@@ -1454,7 +1472,13 @@ static int loose_object_info(struct repository *r,
return 0;
}
- map = map_loose_object(r, oid, &mapsize);
+ fd = open_loose_object(r, oid, &path);
+ if (fd < 0) {
+ if (errno != ENOENT)
+ error_errno(_("unable to open loose object %s"), oid_to_hex(oid));
+ return -1;
+ }
+ map = map_fd(fd, path, &mapsize);
if (!map)
return -1;
@@ -1492,6 +1516,10 @@ static int loose_object_info(struct repository *r,
break;
}
+ if (status && (flags & OBJECT_INFO_DIE_IF_CORRUPT))
+ die(_("loose object %s (stored in %s) is corrupt"),
+ oid_to_hex(oid), path);
+
git_inflate_end(&stream);
cleanup:
munmap(map, mapsize);
@@ -1570,9 +1598,6 @@ static int do_oid_object_info_extended(struct repository *r,
if (find_pack_entry(r, real, &e))
break;
- if (flags & OBJECT_INFO_IGNORE_LOOSE)
- return -1;
-
/* Most likely it's a loose object. */
if (!loose_object_info(r, real, oi, flags))
return 0;
@@ -1599,15 +1624,20 @@ static int do_oid_object_info_extended(struct repository *r,
if (fetch_if_missing && repo_has_promisor_remote(r) &&
!already_retried &&
!(flags & OBJECT_INFO_SKIP_FETCH_OBJECT)) {
- /*
- * TODO Investigate checking promisor_remote_get_direct()
- * TODO return value and stopping on error here.
- */
promisor_remote_get_direct(r, real, 1);
already_retried = 1;
continue;
}
+ if (flags & OBJECT_INFO_DIE_IF_CORRUPT) {
+ const struct packed_git *p;
+ if ((flags & OBJECT_INFO_LOOKUP_REPLACE) && !oideq(real, oid))
+ die(_("replacement %s not found for %s"),
+ oid_to_hex(real), oid_to_hex(oid));
+ if ((p = has_packed_and_bad(r, real)))
+ die(_("packed object %s (stored in %s) is corrupt"),
+ oid_to_hex(real), p->pack_name);
+ }
return -1;
}
@@ -1658,28 +1688,13 @@ int oid_object_info(struct repository *r,
return type;
}
-static void *read_object(struct repository *r,
- const struct object_id *oid, enum object_type *type,
- unsigned long *size)
-{
- struct object_info oi = OBJECT_INFO_INIT;
- void *content;
- oi.typep = type;
- oi.sizep = size;
- oi.contentp = &content;
-
- if (oid_object_info_extended(r, oid, &oi, 0) < 0)
- return NULL;
- return content;
-}
-
int pretend_object_file(void *buf, unsigned long len, enum object_type type,
struct object_id *oid)
{
struct cached_object *co;
hash_object_file(the_hash_algo, buf, len, type, oid);
- if (has_object_file_with_flags(oid, OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT) ||
+ if (repo_has_object_file_with_flags(the_repository, oid, OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT) ||
find_cached_object(oid))
return 0;
ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);
@@ -1694,46 +1709,25 @@ int pretend_object_file(void *buf, unsigned long len, enum object_type type,
/*
* This function dies on corrupt objects; the callers who want to
- * deal with them should arrange to call read_object() and give error
- * messages themselves.
+ * deal with them should arrange to call oid_object_info_extended() and give
+ * error messages themselves.
*/
-void *read_object_file_extended(struct repository *r,
- const struct object_id *oid,
- enum object_type *type,
- unsigned long *size,
- int lookup_replace)
+void *repo_read_object_file(struct repository *r,
+ const struct object_id *oid,
+ enum object_type *type,
+ unsigned long *size)
{
+ struct object_info oi = OBJECT_INFO_INIT;
+ unsigned flags = OBJECT_INFO_DIE_IF_CORRUPT | OBJECT_INFO_LOOKUP_REPLACE;
void *data;
- const struct packed_git *p;
- const char *path;
- struct stat st;
- const struct object_id *repl = lookup_replace ?
- lookup_replace_object(r, oid) : oid;
- errno = 0;
- data = read_object(r, repl, type, size);
- if (data)
- return data;
-
- obj_read_lock();
- if (errno && errno != ENOENT)
- die_errno(_("failed to read object %s"), oid_to_hex(oid));
-
- /* die if we replaced an object with one that does not exist */
- if (repl != oid)
- die(_("replacement %s not found for %s"),
- oid_to_hex(repl), oid_to_hex(oid));
-
- if (!stat_loose_object(r, repl, &st, &path))
- die(_("loose object %s (stored in %s) is corrupt"),
- oid_to_hex(repl), path);
-
- if ((p = has_packed_and_bad(r, repl)))
- die(_("packed object %s (stored in %s) is corrupt"),
- oid_to_hex(repl), p->pack_name);
- obj_read_unlock();
+ oi.typep = type;
+ oi.sizep = size;
+ oi.contentp = &data;
+ if (oid_object_info_extended(r, oid, &oi, flags))
+ return NULL;
- return NULL;
+ return data;
}
void *read_object_with_reference(struct repository *r,
@@ -1863,13 +1857,6 @@ out:
return 0;
}
-static int write_buffer(int fd, const void *buf, size_t len)
-{
- if (write_in_full(fd, buf, len) < 0)
- return error_errno(_("file write error"));
- return 0;
-}
-
static void hash_object_file_literally(const struct git_hash_algo *algo,
const void *buf, unsigned long len,
const char *type, struct object_id *oid)
@@ -2014,8 +2001,8 @@ static int write_loose_object_common(git_hash_ctx *c,
ret = git_deflate(stream, flush ? Z_FINISH : 0);
the_hash_algo->update_fn(c, in0, stream->next_in - in0);
- if (write_buffer(fd, compressed, stream->next_out - compressed) < 0)
- die(_("unable to write loose object file"));
+ if (write_in_full(fd, compressed, stream->next_out - compressed) < 0)
+ die_errno(_("unable to write loose object file"));
stream->next_out = compressed;
stream->avail_out = compressed_len;
@@ -2268,6 +2255,7 @@ int force_object_loose(const struct object_id *oid, time_t mtime)
{
void *buf;
unsigned long len;
+ struct object_info oi = OBJECT_INFO_INIT;
enum object_type type;
char hdr[MAX_HEADER_LEN];
int hdrlen;
@@ -2275,8 +2263,10 @@ int force_object_loose(const struct object_id *oid, time_t mtime)
if (has_loose_object(oid))
return 0;
- buf = read_object(the_repository, oid, &type, &len);
- if (!buf)
+ oi.typep = &type;
+ oi.sizep = &len;
+ oi.contentp = &buf;
+ if (oid_object_info_extended(the_repository, oid, &oi, 0))
return error(_("cannot read object for %s"), oid_to_hex(oid));
hdrlen = format_object_header(hdr, sizeof(hdr), type, len);
ret = write_loose_object(oid, hdr, hdrlen, buf, len, mtime, 0);
@@ -2311,32 +2301,21 @@ int repo_has_object_file(struct repository *r,
return repo_has_object_file_with_flags(r, oid, 0);
}
-static void check_tree(const void *buf, size_t size)
-{
- struct tree_desc desc;
- struct name_entry entry;
-
- init_tree_desc(&desc, buf, size);
- while (tree_entry(&desc, &entry))
- /* do nothing
- * tree_entry() will die() on malformed entries */
- ;
-}
-
-static void check_commit(const void *buf, size_t size)
-{
- struct commit c;
- memset(&c, 0, sizeof(c));
- if (parse_commit_buffer(the_repository, &c, buf, size, 0))
- die(_("corrupt commit"));
-}
-
-static void check_tag(const void *buf, size_t size)
-{
- struct tag t;
- memset(&t, 0, sizeof(t));
- if (parse_tag_buffer(the_repository, &t, buf, size))
- die(_("corrupt tag"));
+/*
+ * We can't use the normal fsck_error_function() for index_mem(),
+ * because we don't yet have a valid oid for it to report. Instead,
+ * report the minimal fsck error here, and rely on the caller to
+ * give more context.
+ */
+static int hash_format_check_report(struct fsck_options *opts,
+ const struct object_id *oid,
+ enum object_type object_type,
+ enum fsck_msg_type msg_type,
+ enum fsck_msg_id msg_id,
+ const char *message)
+{
+ error(_("object fails fsck: %s"), message);
+ return 1;
}
static int index_mem(struct index_state *istate,
@@ -2363,12 +2342,13 @@ static int index_mem(struct index_state *istate,
}
}
if (flags & HASH_FORMAT_CHECK) {
- if (type == OBJ_TREE)
- check_tree(buf, size);
- if (type == OBJ_COMMIT)
- check_commit(buf, size);
- if (type == OBJ_TAG)
- check_tag(buf, size);
+ struct fsck_options opts = FSCK_OPTIONS_DEFAULT;
+
+ opts.strict = 1;
+ opts.error_func = hash_format_check_report;
+ if (fsck_buffer(null_oid(), type, buf, size, &opts))
+ die(_("refusing to create malformed object"));
+ fsck_finish(&opts);
}
if (write_object)
@@ -2680,7 +2660,8 @@ int for_each_loose_object(each_loose_object_fn cb, void *data,
return 0;
}
-static int append_loose_object(const struct object_id *oid, const char *path,
+static int append_loose_object(const struct object_id *oid,
+ const char *path UNUSED,
void *data)
{
oidtree_insert(data, oid);
@@ -2791,13 +2772,16 @@ int read_loose_object(const char *path,
struct object_info *oi)
{
int ret = -1;
+ int fd;
void *map = NULL;
unsigned long mapsize;
git_zstream stream;
char hdr[MAX_HEADER_LEN];
unsigned long *size = oi->sizep;
- map = map_loose_object_1(the_repository, path, NULL, &mapsize);
+ fd = git_open(path);
+ if (fd >= 0)
+ map = map_fd(fd, path, &mapsize);
if (!map) {
error_errno(_("unable to mmap %s"), path);
goto out;
diff --git a/object-file.h b/object-file.h
new file mode 100644
index 0000000000..d6414610f8
--- /dev/null
+++ b/object-file.h
@@ -0,0 +1,131 @@
+#ifndef OBJECT_FILE_H
+#define OBJECT_FILE_H
+
+#include "git-zlib.h"
+#include "object.h"
+
+struct index_state;
+
+/*
+ * Set this to 0 to prevent oid_object_info_extended() from fetching missing
+ * blobs. This has a difference only if extensions.partialClone is set.
+ *
+ * Its default value is 1.
+ */
+extern int fetch_if_missing;
+
+#define HASH_WRITE_OBJECT 1
+#define HASH_FORMAT_CHECK 2
+#define HASH_RENORMALIZE 4
+#define HASH_SILENT 8
+int index_fd(struct index_state *istate, struct object_id *oid, int fd, struct stat *st, enum object_type type, const char *path, unsigned flags);
+int index_path(struct index_state *istate, struct object_id *oid, const char *path, struct stat *st, unsigned flags);
+
+/*
+ * Create the directory containing the named path, using care to be
+ * somewhat safe against races. Return one of the scld_error values to
+ * indicate success/failure. On error, set errno to describe the
+ * problem.
+ *
+ * SCLD_VANISHED indicates that one of the ancestor directories of the
+ * path existed at one point during the function call and then
+ * suddenly vanished, probably because another process pruned the
+ * directory while we were working. To be robust against this kind of
+ * race, callers might want to try invoking the function again when it
+ * returns SCLD_VANISHED.
+ *
+ * safe_create_leading_directories() temporarily changes path while it
+ * is working but restores it before returning.
+ * safe_create_leading_directories_const() doesn't modify path, even
+ * temporarily. Both these variants adjust the permissions of the
+ * created directories to honor core.sharedRepository, so they are best
+ * suited for files inside the git dir. For working tree files, use
+ * safe_create_leading_directories_no_share() instead, as it ignores
+ * the core.sharedRepository setting.
+ */
+enum scld_error {
+ SCLD_OK = 0,
+ SCLD_FAILED = -1,
+ SCLD_PERMS = -2,
+ SCLD_EXISTS = -3,
+ SCLD_VANISHED = -4
+};
+enum scld_error safe_create_leading_directories(char *path);
+enum scld_error safe_create_leading_directories_const(const char *path);
+enum scld_error safe_create_leading_directories_no_share(char *path);
+
+int mkdir_in_gitdir(const char *path);
+
+int git_open_cloexec(const char *name, int flags);
+#define git_open(name) git_open_cloexec(name, O_RDONLY)
+
+/**
+ * unpack_loose_header() initializes the data stream needed to unpack
+ * a loose object header.
+ *
+ * Returns:
+ *
+ * - ULHR_OK on success
+ * - ULHR_BAD on error
+ * - ULHR_TOO_LONG if the header was too long
+ *
+ * It will only parse up to MAX_HEADER_LEN bytes unless an optional
+ * "hdrbuf" argument is non-NULL. This is intended for use with
+ * OBJECT_INFO_ALLOW_UNKNOWN_TYPE to extract the bad type for (error)
+ * reporting. The full header will be extracted to "hdrbuf" for use
+ * with parse_loose_header(), ULHR_TOO_LONG will still be returned
+ * from this function to indicate that the header was too long.
+ */
+enum unpack_loose_header_result {
+ ULHR_OK,
+ ULHR_BAD,
+ ULHR_TOO_LONG,
+};
+enum unpack_loose_header_result unpack_loose_header(git_zstream *stream,
+ unsigned char *map,
+ unsigned long mapsize,
+ void *buffer,
+ unsigned long bufsiz,
+ struct strbuf *hdrbuf);
+
+/**
+ * parse_loose_header() parses the starting "<type> <len>\0" of an
+ * object. If it doesn't follow that format -1 is returned. To check
+ * the validity of the <type> populate the "typep" in the "struct
+ * object_info". It will be OBJ_BAD if the object type is unknown. The
+ * parsed <len> can be retrieved via "oi->sizep", and from there
+ * passed to unpack_loose_rest().
+ */
+struct object_info;
+int parse_loose_header(const char *hdr, struct object_info *oi);
+
+/**
+ * With in-core object data in "buf", rehash it to make sure the
+ * object name actually matches "oid" to detect object corruption.
+ *
+ * A negative value indicates an error, usually that the OID is not
+ * what we expected, but it might also indicate another error.
+ */
+int check_object_signature(struct repository *r, const struct object_id *oid,
+ void *map, unsigned long size,
+ enum object_type type);
+
+/**
+ * A streaming version of check_object_signature().
+ * Try reading the object named with "oid" using
+ * the streaming interface and rehash it to do the same.
+ */
+int stream_object_signature(struct repository *r, const struct object_id *oid);
+
+int finalize_object_file(const char *tmpfile, const char *filename);
+
+/* Helper to check and "touch" a file */
+int check_and_freshen_file(const char *fn, int freshen);
+
+void *read_object_with_reference(struct repository *r,
+ const struct object_id *oid,
+ enum object_type required_type,
+ unsigned long *size,
+ struct object_id *oid_ret);
+
+#endif /* OBJECT_FILE_H */
diff --git a/object-name.c b/object-name.c
index 2dd1a0f56e..6fc3fa595b 100644
--- a/object-name.c
+++ b/object-name.c
@@ -1,5 +1,10 @@
#include "cache.h"
+#include "object-name.h"
+#include "advice.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "tag.h"
#include "commit.h"
#include "tree.h"
@@ -9,9 +14,12 @@
#include "remote.h"
#include "dir.h"
#include "oid-array.h"
+#include "oidtree.h"
#include "packfile.h"
+#include "pretty.h"
#include "object-store.h"
#include "repository.h"
+#include "setup.h"
#include "submodule.h"
#include "midx.h"
#include "commit-reach.h"
@@ -223,7 +231,7 @@ static int finish_object_disambiguation(struct disambiguate_state *ds,
static int disambiguate_commit_only(struct repository *r,
const struct object_id *oid,
- void *cb_data_unused)
+ void *cb_data UNUSED)
{
int kind = oid_object_info(r, oid, NULL);
return kind == OBJ_COMMIT;
@@ -231,7 +239,7 @@ static int disambiguate_commit_only(struct repository *r,
static int disambiguate_committish_only(struct repository *r,
const struct object_id *oid,
- void *cb_data_unused)
+ void *cb_data UNUSED)
{
struct object *obj;
int kind;
@@ -251,7 +259,7 @@ static int disambiguate_committish_only(struct repository *r,
static int disambiguate_tree_only(struct repository *r,
const struct object_id *oid,
- void *cb_data_unused)
+ void *cb_data UNUSED)
{
int kind = oid_object_info(r, oid, NULL);
return kind == OBJ_TREE;
@@ -259,7 +267,7 @@ static int disambiguate_tree_only(struct repository *r,
static int disambiguate_treeish_only(struct repository *r,
const struct object_id *oid,
- void *cb_data_unused)
+ void *cb_data UNUSED)
{
struct object *obj;
int kind;
@@ -279,7 +287,7 @@ static int disambiguate_treeish_only(struct repository *r,
static int disambiguate_blob_only(struct repository *r,
const struct object_id *oid,
- void *cb_data_unused)
+ void *cb_data UNUSED)
{
int kind = oid_object_info(r, oid, NULL);
return kind == OBJ_BLOB;
@@ -394,8 +402,10 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
if (commit) {
struct pretty_print_context pp = {0};
pp.date_mode.type = DATE_SHORT;
- format_commit_message(commit, "%ad", &date, &pp);
- format_commit_message(commit, "%s", &msg, &pp);
+ repo_format_commit_message(the_repository, commit,
+ "%ad", &date, &pp);
+ repo_format_commit_message(the_repository, commit,
+ "%s", &msg, &pp);
}
/*
@@ -473,7 +483,7 @@ static int collect_ambiguous(const struct object_id *oid, void *data)
return 0;
}
-static int repo_collect_ambiguous(struct repository *r,
+static int repo_collect_ambiguous(struct repository *r UNUSED,
const struct object_id *oid,
void *data)
{
@@ -665,7 +675,7 @@ static int extend_abbrev_len(const struct object_id *oid, void *cb_data)
return 0;
}
-static int repo_extend_abbrev_len(struct repository *r,
+static int repo_extend_abbrev_len(struct repository *r UNUSED,
const struct object_id *oid,
void *cb_data)
{
@@ -898,6 +908,7 @@ static int get_oid_basic(struct repository *r, const char *str, int len,
char *real_ref = NULL;
int refs_found = 0;
int at, reflog_len, nth_prior = 0;
+ int fatal = !(flags & GET_OID_QUIETLY);
if (len == r->hash_algo->hexsz && !get_oid_hex(str, oid)) {
if (warn_ambiguous_refs && warn_on_object_refname_ambiguity) {
@@ -952,11 +963,11 @@ static int get_oid_basic(struct repository *r, const char *str, int len,
if (!len && reflog_len)
/* allow "@{...}" to mean the current branch reflog */
- refs_found = repo_dwim_ref(r, "HEAD", 4, oid, &real_ref, 0);
+ refs_found = repo_dwim_ref(r, "HEAD", 4, oid, &real_ref, !fatal);
else if (reflog_len)
refs_found = repo_dwim_log(r, str, len, oid, &real_ref);
else
- refs_found = repo_dwim_ref(r, str, len, oid, &real_ref, 0);
+ refs_found = repo_dwim_ref(r, str, len, oid, &real_ref, !fatal);
if (!refs_found)
return -1;
@@ -1036,7 +1047,7 @@ static enum get_oid_result get_parent(struct repository *r,
if (ret)
return ret;
commit = lookup_commit_reference(r, &oid);
- if (parse_commit(commit))
+ if (repo_parse_commit(r, commit))
return MISSING_OBJECT;
if (!idx) {
oidcpy(result, &commit->object.oid);
@@ -1070,7 +1081,7 @@ static enum get_oid_result get_nth_ancestor(struct repository *r,
return MISSING_OBJECT;
while (generation--) {
- if (parse_commit(commit) || !commit->parents)
+ if (repo_parse_commit(r, commit) || !commit->parents)
return MISSING_OBJECT;
commit = commit->parents->item;
}
@@ -1361,10 +1372,10 @@ static int get_oid_oneline(struct repository *r,
commit = pop_most_recent_commit(&list, ONELINE_SEEN);
if (!parse_object(r, &commit->object.oid))
continue;
- buf = get_commit_buffer(commit, NULL);
+ buf = repo_get_commit_buffer(r, commit, NULL);
p = strstr(buf, "\n\n");
matches = negative ^ (p && !regexec(&regex, p + 2, 0, NULL, 0));
- unuse_commit_buffer(commit, buf);
+ repo_unuse_commit_buffer(r, commit, buf);
if (matches) {
oidcpy(oid, &commit->object.oid);
@@ -1666,7 +1677,8 @@ void strbuf_branchname(struct strbuf *sb, const char *name, unsigned allowed)
struct interpret_branch_name_options options = {
.allowed = allowed
};
- int used = interpret_branch_name(name, len, sb, &options);
+ int used = repo_interpret_branch_name(the_repository, name, len, sb,
+ &options);
if (used < 0)
used = 0;
@@ -1719,7 +1731,7 @@ int get_oidf(struct object_id *oid, const char *fmt, ...)
strbuf_vaddf(&sb, fmt, ap);
va_end(ap);
- ret = get_oid(sb.buf, oid);
+ ret = repo_get_oid(the_repository, sb.buf, oid);
strbuf_release(&sb);
return ret;
diff --git a/object-name.h b/object-name.h
new file mode 100644
index 0000000000..1d63698f42
--- /dev/null
+++ b/object-name.h
@@ -0,0 +1,121 @@
+#ifndef OBJECT_NAME_H
+#define OBJECT_NAME_H
+
+#include "object.h"
+#include "strbuf.h"
+
+struct object_id;
+struct repository;
+
+struct object_context {
+ unsigned short mode;
+ /*
+ * symlink_path is only used by get_tree_entry_follow_symlinks,
+ * and only for symlinks that point outside the repository.
+ */
+ struct strbuf symlink_path;
+ /*
+ * If GET_OID_RECORD_PATH is set, this will record path (if any)
+ * found when resolving the name. The caller is responsible for
+ * releasing the memory.
+ */
+ char *path;
+};
+
+/*
+ * Return an abbreviated sha1 unique within this repository's object database.
+ * The result will be at least `len` characters long, and will be NUL
+ * terminated.
+ *
+ * The non-`_r` version returns a static buffer which remains valid until 4
+ * more calls to repo_find_unique_abbrev are made.
+ *
+ * The `_r` variant writes to a buffer supplied by the caller, which must be at
+ * least `GIT_MAX_HEXSZ + 1` bytes. The return value is the number of bytes
+ * written (excluding the NUL terminator).
+ *
+ * Note that while this version avoids the static buffer, it is not fully
+ * reentrant, as it calls into other non-reentrant git code.
+ */
+const char *repo_find_unique_abbrev(struct repository *r, const struct object_id *oid, int len);
+int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len);
+
+int repo_get_oid(struct repository *r, const char *str, struct object_id *oid);
+__attribute__((format (printf, 2, 3)))
+int get_oidf(struct object_id *oid, const char *fmt, ...);
+int repo_get_oid_commit(struct repository *r, const char *str, struct object_id *oid);
+int repo_get_oid_committish(struct repository *r, const char *str, struct object_id *oid);
+int repo_get_oid_tree(struct repository *r, const char *str, struct object_id *oid);
+int repo_get_oid_treeish(struct repository *r, const char *str, struct object_id *oid);
+int repo_get_oid_blob(struct repository *r, const char *str, struct object_id *oid);
+int repo_get_oid_mb(struct repository *r, const char *str, struct object_id *oid);
+void maybe_die_on_misspelt_object_name(struct repository *repo,
+ const char *name,
+ const char *prefix);
+enum get_oid_result get_oid_with_context(struct repository *repo, const char *str,
+ unsigned flags, struct object_id *oid,
+ struct object_context *oc);
+
+
+typedef int each_abbrev_fn(const struct object_id *oid, void *);
+int repo_for_each_abbrev(struct repository *r, const char *prefix, each_abbrev_fn, void *);
+
+int set_disambiguate_hint_config(const char *var, const char *value);
+
+/*
+ * This reads short-hand syntax that not only evaluates to a commit
+ * object name, but also can act as if the end user spelled the name
+ * of the branch from the command line.
+ *
+ * - "@{-N}" finds the name of the Nth previous branch we were on, and
+ * places the name of the branch in the given buf and returns the
+ * number of characters parsed if successful.
+ *
+ * - "<branch>@{upstream}" finds the name of the other ref that
+ * <branch> is configured to merge with (missing <branch> defaults
+ * to the current branch), and places the name of the branch in the
+ * given buf and returns the number of characters parsed if
+ * successful.
+ *
+ * If the input is not of the accepted format, it returns a negative
+ * number to signal an error.
+ *
+ * If the input was ok but there are not N branch switches in the
+ * reflog, it returns 0.
+ */
+#define INTERPRET_BRANCH_LOCAL (1<<0)
+#define INTERPRET_BRANCH_REMOTE (1<<1)
+#define INTERPRET_BRANCH_HEAD (1<<2)
+struct interpret_branch_name_options {
+ /*
+ * If "allowed" is non-zero, it is a treated as a bitfield of allowable
+ * expansions: local branches ("refs/heads/"), remote branches
+ * ("refs/remotes/"), or "HEAD". If no "allowed" bits are set, any expansion is
+ * allowed, even ones to refs outside of those namespaces.
+ */
+ unsigned allowed;
+
+ /*
+ * If ^{upstream} or ^{push} (or equivalent) is requested, and the
+ * branch in question does not have such a reference, return -1 instead
+ * of die()-ing.
+ */
+ unsigned nonfatal_dangling_mark : 1;
+};
+int repo_interpret_branch_name(struct repository *r,
+ const char *str, int len,
+ struct strbuf *buf,
+ const struct interpret_branch_name_options *options);
+
+struct object *repo_peel_to_type(struct repository *r,
+ const char *name, int namelen,
+ struct object *o, enum object_type);
+
+/* Convert to/from hex/sha1 representation */
+#define MINIMUM_ABBREV minimum_abbrev
+#define DEFAULT_ABBREV default_abbrev
+
+/* used when the code does not know or care what the default abbrev is */
+#define FALLBACK_DEFAULT_ABBREV 7
+
+#endif /* OBJECT_NAME_H */
diff --git a/object-store.h b/object-store.h
index 1be57abaf1..12415e5ea7 100644
--- a/object-store.h
+++ b/object-store.h
@@ -1,17 +1,17 @@
#ifndef OBJECT_STORE_H
#define OBJECT_STORE_H
-#include "cache.h"
-#include "oidmap.h"
+#include "object.h"
#include "list.h"
-#include "oid-array.h"
-#include "strbuf.h"
#include "thread-utils.h"
#include "khash.h"
#include "dir.h"
-#include "oidtree.h"
#include "oidset.h"
+struct oidmap;
+struct oidtree;
+struct strbuf;
+
struct object_directory {
struct object_directory *next;
@@ -56,6 +56,7 @@ KHASH_INIT(odb_path_map, const char * /* key: odb_path */,
struct object_directory *, 1, fspathhash, fspatheq)
void prepare_alt_odb(struct repository *r);
+int has_alt_odb(struct repository *r);
char *compute_alternate_path(const char *path, struct strbuf *err);
struct object_directory *find_odb(struct repository *r, const char *obj_dir);
typedef int alt_odb_fn(struct object_directory *, void *);
@@ -216,7 +217,7 @@ struct raw_object_store {
/*
* A fast, rough count of the number of objects in the repository.
* These two fields are not meant for direct access. Use
- * approximate_object_count() instead.
+ * repo_approximate_object_count() instead.
*/
unsigned long approximate_object_count;
unsigned approximate_object_count_valid : 1;
@@ -241,20 +242,10 @@ const char *loose_object_path(struct repository *r, struct strbuf *buf,
void *map_loose_object(struct repository *r, const struct object_id *oid,
unsigned long *size);
-void *read_object_file_extended(struct repository *r,
- const struct object_id *oid,
- enum object_type *type,
- unsigned long *size, int lookup_replace);
-static inline void *repo_read_object_file(struct repository *r,
- const struct object_id *oid,
- enum object_type *type,
- unsigned long *size)
-{
- return read_object_file_extended(r, oid, type, size, 1);
-}
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define read_object_file(oid, type, size) repo_read_object_file(the_repository, oid, type, size)
-#endif
+void *repo_read_object_file(struct repository *r,
+ const struct object_id *oid,
+ enum object_type *type,
+ unsigned long *size);
/* Read and unpack an object file into memory, write memory to an object file */
int oid_object_info(struct repository *r, const struct object_id *, unsigned long *);
@@ -291,6 +282,69 @@ int pretend_object_file(void *, unsigned long, enum object_type,
int force_object_loose(const struct object_id *oid, time_t mtime);
+struct object_info {
+ /* Request */
+ enum object_type *typep;
+ unsigned long *sizep;
+ off_t *disk_sizep;
+ struct object_id *delta_base_oid;
+ struct strbuf *type_name;
+ void **contentp;
+
+ /* Response */
+ enum {
+ OI_CACHED,
+ OI_LOOSE,
+ OI_PACKED,
+ OI_DBCACHED
+ } whence;
+ union {
+ /*
+ * struct {
+ * ... Nothing to expose in this case
+ * } cached;
+ * struct {
+ * ... Nothing to expose in this case
+ * } loose;
+ */
+ struct {
+ struct packed_git *pack;
+ off_t offset;
+ unsigned int is_delta;
+ } packed;
+ } u;
+};
+
+/*
+ * Initializer for a "struct object_info" that wants no items. You may
+ * also memset() the memory to all-zeroes.
+ */
+#define OBJECT_INFO_INIT { 0 }
+
+/* Invoke lookup_replace_object() on the given hash */
+#define OBJECT_INFO_LOOKUP_REPLACE 1
+/* Allow reading from a loose object file of unknown/bogus type */
+#define OBJECT_INFO_ALLOW_UNKNOWN_TYPE 2
+/* Do not retry packed storage after checking packed and loose storage */
+#define OBJECT_INFO_QUICK 8
+/*
+ * Do not attempt to fetch the object if missing (even if fetch_is_missing is
+ * nonzero).
+ */
+#define OBJECT_INFO_SKIP_FETCH_OBJECT 16
+/*
+ * This is meant for bulk prefetching of missing blobs in a partial
+ * clone. Implies OBJECT_INFO_SKIP_FETCH_OBJECT and OBJECT_INFO_QUICK
+ */
+#define OBJECT_INFO_FOR_PREFETCH (OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_QUICK)
+
+/* Die if object corruption (not just an object being missing) was detected. */
+#define OBJECT_INFO_DIE_IF_CORRUPT 32
+
+int oid_object_info_extended(struct repository *r,
+ const struct object_id *,
+ struct object_info *, unsigned flags);
+
/*
* Open the loose object at path, check its hash, and return the contents,
* use the "oi" argument to assert things about the object, or e.g. populate its
@@ -331,10 +385,6 @@ int has_object(struct repository *r, const struct object_id *oid,
int repo_has_object_file(struct repository *r, const struct object_id *oid);
int repo_has_object_file_with_flags(struct repository *r,
const struct object_id *oid, int flags);
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define has_object_file(oid) repo_has_object_file(the_repository, oid)
-#define has_object_file_with_flags(oid, flags) repo_has_object_file_with_flags(the_repository, oid, flags)
-#endif
/*
* Return true iff an alternate object database has a loose object
@@ -357,9 +407,8 @@ void assert_oid_type(const struct object_id *oid, enum object_type expect);
/*
* Enabling the object read lock allows multiple threads to safely call the
- * following functions in parallel: repo_read_object_file(), read_object_file(),
- * read_object_file_extended(), read_object_with_reference(), read_object(),
- * oid_object_info() and oid_object_info_extended().
+ * following functions in parallel: repo_read_object_file(),
+ * read_object_with_reference(), oid_object_info() and oid_object_info_extended().
*
* obj_read_lock() and obj_read_unlock() may also be used to protect other
* section which cannot execute in parallel with object reading. Since the used
@@ -389,68 +438,6 @@ static inline void obj_read_unlock(void)
pthread_mutex_unlock(&obj_read_mutex);
}
-struct object_info {
- /* Request */
- enum object_type *typep;
- unsigned long *sizep;
- off_t *disk_sizep;
- struct object_id *delta_base_oid;
- struct strbuf *type_name;
- void **contentp;
-
- /* Response */
- enum {
- OI_CACHED,
- OI_LOOSE,
- OI_PACKED,
- OI_DBCACHED
- } whence;
- union {
- /*
- * struct {
- * ... Nothing to expose in this case
- * } cached;
- * struct {
- * ... Nothing to expose in this case
- * } loose;
- */
- struct {
- struct packed_git *pack;
- off_t offset;
- unsigned int is_delta;
- } packed;
- } u;
-};
-
-/*
- * Initializer for a "struct object_info" that wants no items. You may
- * also memset() the memory to all-zeroes.
- */
-#define OBJECT_INFO_INIT { 0 }
-
-/* Invoke lookup_replace_object() on the given hash */
-#define OBJECT_INFO_LOOKUP_REPLACE 1
-/* Allow reading from a loose object file of unknown/bogus type */
-#define OBJECT_INFO_ALLOW_UNKNOWN_TYPE 2
-/* Do not retry packed storage after checking packed and loose storage */
-#define OBJECT_INFO_QUICK 8
-/* Do not check loose object */
-#define OBJECT_INFO_IGNORE_LOOSE 16
-/*
- * Do not attempt to fetch the object if missing (even if fetch_is_missing is
- * nonzero).
- */
-#define OBJECT_INFO_SKIP_FETCH_OBJECT 32
-/*
- * This is meant for bulk prefetching of missing blobs in a partial
- * clone. Implies OBJECT_INFO_SKIP_FETCH_OBJECT and OBJECT_INFO_QUICK
- */
-#define OBJECT_INFO_FOR_PREFETCH (OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_QUICK)
-
-int oid_object_info_extended(struct repository *r,
- const struct object_id *,
- struct object_info *, unsigned flags);
-
/*
* Iterate over the files in the loose-object parts of the object
* directory "path", triggering the following callbacks:
diff --git a/object.c b/object.c
index 8a74eb85e9..6d4ef1524d 100644
--- a/object.c
+++ b/object.c
@@ -1,6 +1,9 @@
#include "cache.h"
+#include "gettext.h"
+#include "hex.h"
#include "object.h"
#include "replace-object.h"
+#include "object-file.h"
#include "object-store.h"
#include "blob.h"
#include "tree.h"
@@ -212,8 +215,7 @@ struct object *parse_object_buffer(struct repository *r, const struct object_id
if (type == OBJ_BLOB) {
struct blob *blob = lookup_blob(r, oid);
if (blob) {
- if (parse_blob_buffer(blob, buffer, size))
- return NULL;
+ parse_blob_buffer(blob);
obj = &blob->object;
}
} else if (type == OBJ_TREE) {
@@ -286,14 +288,13 @@ struct object *parse_object_with_flags(struct repository *r,
return &commit->object;
}
- if ((obj && obj->type == OBJ_BLOB && repo_has_object_file(r, oid)) ||
- (!obj && repo_has_object_file(r, oid) &&
- oid_object_info(r, oid, NULL) == OBJ_BLOB)) {
+ if ((!obj || obj->type == OBJ_BLOB) &&
+ oid_object_info(r, oid, NULL) == OBJ_BLOB) {
if (!skip_hash && stream_object_signature(r, repl) < 0) {
error(_("hash mismatch %s"), oid_to_hex(oid));
return NULL;
}
- parse_blob_buffer(lookup_blob(r, oid), NULL, 0);
+ parse_blob_buffer(lookup_blob(r, oid));
return lookup_object(r, oid);
}
diff --git a/object.h b/object.h
index 31ebe11458..5871615fee 100644
--- a/object.h
+++ b/object.h
@@ -1,9 +1,10 @@
#ifndef OBJECT_H
#define OBJECT_H
-#include "cache.h"
+#include "hash-ll.h"
struct buffer_slab;
+struct repository;
struct parsed_object_pool {
struct object **obj_hash;
@@ -81,6 +82,70 @@ struct object_array {
*/
#define FLAG_BITS 28
+#define TYPE_BITS 3
+
+/*
+ * Values in this enum (except those outside the 3 bit range) are part
+ * of pack file format. See gitformat-pack(5) for more information.
+ */
+enum object_type {
+ OBJ_BAD = -1,
+ OBJ_NONE = 0,
+ OBJ_COMMIT = 1,
+ OBJ_TREE = 2,
+ OBJ_BLOB = 3,
+ OBJ_TAG = 4,
+ /* 5 for future expansion */
+ OBJ_OFS_DELTA = 6,
+ OBJ_REF_DELTA = 7,
+ OBJ_ANY,
+ OBJ_MAX
+};
+
+/* unknown mode (impossible combination S_IFIFO|S_IFCHR) */
+#define S_IFINVALID 0030000
+
+/*
+ * A "directory link" is a link to another git directory.
+ *
+ * The value 0160000 is not normally a valid mode, and
+ * also just happens to be S_IFDIR + S_IFLNK
+ */
+#define S_IFGITLINK 0160000
+#define S_ISGITLINK(m) (((m) & S_IFMT) == S_IFGITLINK)
+
+#define S_ISSPARSEDIR(m) ((m) == S_IFDIR)
+
+static inline enum object_type object_type(unsigned int mode)
+{
+ return S_ISDIR(mode) ? OBJ_TREE :
+ S_ISGITLINK(mode) ? OBJ_COMMIT :
+ OBJ_BLOB;
+}
+
+#define ce_permissions(mode) (((mode) & 0100) ? 0755 : 0644)
+static inline unsigned int create_ce_mode(unsigned int mode)
+{
+ if (S_ISLNK(mode))
+ return S_IFLNK;
+ if (S_ISSPARSEDIR(mode))
+ return S_IFDIR;
+ if (S_ISDIR(mode) || S_ISGITLINK(mode))
+ return S_IFGITLINK;
+ return S_IFREG | ce_permissions(mode);
+}
+
+static inline unsigned int canon_mode(unsigned int mode)
+{
+ if (S_ISREG(mode))
+ return S_IFREG | ce_permissions(mode);
+ if (S_ISLNK(mode))
+ return S_IFLNK;
+ if (S_ISDIR(mode))
+ return S_IFDIR;
+ return S_IFGITLINK;
+}
+
/*
* The object type is stored in 3 bits.
*/
diff --git a/oid-array.c b/oid-array.c
index 73ba76e9e9..e8228c777b 100644
--- a/oid-array.c
+++ b/oid-array.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "oid-array.h"
#include "hash-lookup.h"
diff --git a/oidmap.c b/oidmap.c
index 49965fe856..8b1bc4dec9 100644
--- a/oidmap.c
+++ b/oidmap.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "hash.h"
#include "oidmap.h"
static int oidmap_neq(const void *hashmap_cmp_fn_data UNUSED,
diff --git a/oidmap.h b/oidmap.h
index c66a83ab1d..c1642927fa 100644
--- a/oidmap.h
+++ b/oidmap.h
@@ -1,7 +1,6 @@
#ifndef OIDMAP_H
#define OIDMAP_H
-#include "cache.h"
#include "hashmap.h"
/*
diff --git a/oidset.c b/oidset.c
index b36a2bae86..d1e5376316 100644
--- a/oidset.c
+++ b/oidset.c
@@ -1,5 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "oidset.h"
+#include "hex.h"
+#include "strbuf.h"
void oidset_init(struct oidset *set, size_t initial_size)
{
diff --git a/oidtree.c b/oidtree.c
index 0d39389bee..7d57b7b19e 100644
--- a/oidtree.c
+++ b/oidtree.c
@@ -2,6 +2,7 @@
* A wrapper around cbtree which stores oids
* May be used to replace oid-array for prefix (abbreviation) matches
*/
+#include "git-compat-util.h"
#include "oidtree.h"
#include "alloc.h"
#include "hash.h"
diff --git a/oidtree.h b/oidtree.h
index 77898f510a..55c83513fd 100644
--- a/oidtree.h
+++ b/oidtree.h
@@ -2,7 +2,7 @@
#define OIDTREE_H
#include "cbtree.h"
-#include "hash.h"
+#include "hash-ll.h"
#include "mem-pool.h"
struct oidtree {
diff --git a/oss-fuzz/.gitignore b/oss-fuzz/.gitignore
new file mode 100644
index 0000000000..9acb74412e
--- /dev/null
+++ b/oss-fuzz/.gitignore
@@ -0,0 +1,3 @@
+fuzz-commit-graph
+fuzz-pack-headers
+fuzz-pack-idx
diff --git a/fuzz-commit-graph.c b/oss-fuzz/fuzz-commit-graph.c
index 914026f5d8..2992079dd9 100644
--- a/fuzz-commit-graph.c
+++ b/oss-fuzz/fuzz-commit-graph.c
@@ -1,3 +1,4 @@
+#include "git-compat-util.h"
#include "commit-graph.h"
#include "repository.h"
diff --git a/fuzz-pack-headers.c b/oss-fuzz/fuzz-pack-headers.c
index 99da1d0fd3..150c0f5fa2 100644
--- a/fuzz-pack-headers.c
+++ b/oss-fuzz/fuzz-pack-headers.c
@@ -1,3 +1,4 @@
+#include "git-compat-util.h"
#include "packfile.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
diff --git a/fuzz-pack-idx.c b/oss-fuzz/fuzz-pack-idx.c
index 0c3d777aac..609a343ee3 100644
--- a/fuzz-pack-idx.c
+++ b/oss-fuzz/fuzz-pack-idx.c
@@ -1,3 +1,4 @@
+#include "git-compat-util.h"
#include "object-store.h"
#include "packfile.h"
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index a213f5eddc..cdffe2ce47 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -1,4 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "object-store.h"
#include "commit.h"
#include "tag.h"
@@ -13,6 +17,9 @@
#include "pack-objects.h"
#include "commit-reach.h"
#include "prio-queue.h"
+#include "trace2.h"
+#include "tree.h"
+#include "tree-walk.h"
struct bitmapped_commit {
struct commit *commit;
@@ -384,6 +391,8 @@ static int fill_bitmap_tree(struct bitmap *bitmap,
return 0;
}
+static int reused_bitmaps_nr;
+
static int fill_bitmap_commit(struct bb_commit *ent,
struct commit *commit,
struct prio_queue *queue,
@@ -409,8 +418,10 @@ static int fill_bitmap_commit(struct bb_commit *ent,
* bitmap and add its bits to this one. No need to walk
* parents or the tree for this commit.
*/
- if (old && !rebuild_bitmap(mapping, old, ent->bitmap))
+ if (old && !rebuild_bitmap(mapping, old, ent->bitmap)) {
+ reused_bitmaps_nr++;
continue;
+ }
}
/*
@@ -421,7 +432,8 @@ static int fill_bitmap_commit(struct bb_commit *ent,
if (!found)
return -1;
bitmap_set(ent->bitmap, pos);
- prio_queue_put(tree_queue, get_commit_tree(c));
+ prio_queue_put(tree_queue,
+ repo_get_commit_tree(the_repository, c));
for (p = c->parents; p; p = p->next) {
pos = find_object_pos(&p->item->object.oid, &found);
@@ -526,6 +538,8 @@ int bitmap_writer_build(struct packing_data *to_pack)
trace2_region_leave("pack-bitmap-write", "building_bitmaps_total",
the_repository);
+ trace2_data_intmax("pack-bitmap-write", the_repository,
+ "building_bitmaps_reused", reused_bitmaps_nr);
stop_progress(&writer.progress);
diff --git a/pack-bitmap.c b/pack-bitmap.c
index 440407f1be..999f962602 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -1,5 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "commit.h"
+#include "gettext.h"
+#include "hex.h"
#include "strbuf.h"
#include "tag.h"
#include "diff.h"
@@ -12,6 +15,8 @@
#include "pack-objects.h"
#include "packfile.h"
#include "repository.h"
+#include "trace2.h"
+#include "object-file.h"
#include "object-store.h"
#include "list-objects-filter-options.h"
#include "midx.h"
@@ -354,8 +359,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);
- /* ignore extra bitmap file; we can only handle one */
- warning(_("ignoring extra bitmap file: '%s'"), buf.buf);
+ trace2_data_string("bitmap", the_repository,
+ "ignoring extra midx bitmap file", buf.buf);
close(fd);
strbuf_release(&buf);
return -1;
@@ -376,7 +381,7 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
goto cleanup;
}
- if (load_midx_revindex(bitmap_git->midx) < 0) {
+ if (load_midx_revindex(bitmap_git->midx)) {
warning(_("multi-pack bitmap is missing required reverse index"));
goto cleanup;
}
@@ -411,9 +416,6 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
struct stat st;
char *bitmap_name;
- if (open_pack_index(packfile))
- return -1;
-
bitmap_name = pack_bitmap_filename(packfile);
fd = git_open(bitmap_name);
@@ -432,8 +434,8 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
}
if (bitmap_git->pack || bitmap_git->midx) {
- /* ignore extra bitmap file; we can only handle one */
- warning(_("ignoring extra bitmap file: '%s'"), packfile->pack_name);
+ trace2_data_string("bitmap", the_repository,
+ "ignoring extra bitmap file", packfile->pack_name);
close(fd);
return -1;
}
@@ -458,10 +460,12 @@ 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);
return 0;
}
-static int load_reverse_index(struct bitmap_index *bitmap_git)
+static int load_reverse_index(struct repository *r, struct bitmap_index *bitmap_git)
{
if (bitmap_is_midx(bitmap_git)) {
uint32_t i;
@@ -475,23 +479,23 @@ static int load_reverse_index(struct bitmap_index *bitmap_git)
* since we will need to make use of them in pack-objects.
*/
for (i = 0; i < bitmap_git->midx->num_packs; i++) {
- ret = load_pack_revindex(bitmap_git->midx->packs[i]);
+ ret = load_pack_revindex(r, bitmap_git->midx->packs[i]);
if (ret)
return ret;
}
return 0;
}
- return load_pack_revindex(bitmap_git->pack);
+ return load_pack_revindex(r, bitmap_git->pack);
}
-static int load_bitmap(struct bitmap_index *bitmap_git)
+static int load_bitmap(struct repository *r, struct bitmap_index *bitmap_git)
{
assert(bitmap_git->map);
bitmap_git->bitmaps = kh_init_oid_map();
bitmap_git->ext_index.positions = kh_init_oid_pos();
- if (load_reverse_index(bitmap_git))
+ if (load_reverse_index(r, bitmap_git))
goto failed;
if (!(bitmap_git->commits = read_bitmap_1(bitmap_git)) ||
@@ -525,11 +529,16 @@ static int open_pack_bitmap(struct repository *r,
struct packed_git *p;
int ret = -1;
- assert(!bitmap_git->map);
-
for (p = get_all_packs(r); p; p = p->next) {
- if (open_pack_bitmap_1(bitmap_git, p) == 0)
+ if (open_pack_bitmap_1(bitmap_git, p) == 0) {
ret = 0;
+ /*
+ * The only reason to keep looking is to report
+ * duplicates.
+ */
+ if (!trace2_is_enabled())
+ break;
+ }
}
return ret;
@@ -553,18 +562,27 @@ static int open_midx_bitmap(struct repository *r,
static int open_bitmap(struct repository *r,
struct bitmap_index *bitmap_git)
{
+ int found;
+
assert(!bitmap_git->map);
- if (!open_midx_bitmap(r, bitmap_git))
- return 0;
- return open_pack_bitmap(r, bitmap_git);
+ found = !open_midx_bitmap(r, bitmap_git);
+
+ /*
+ * these will all be skipped if we opened a midx bitmap; but run it
+ * anyway if tracing is enabled to report the duplicates
+ */
+ if (!found || trace2_is_enabled())
+ found |= !open_pack_bitmap(r, bitmap_git);
+
+ return found ? 0 : -1;
}
struct bitmap_index *prepare_bitmap_git(struct repository *r)
{
struct bitmap_index *bitmap_git = xcalloc(1, sizeof(*bitmap_git));
- if (!open_bitmap(r, bitmap_git) && !load_bitmap(bitmap_git))
+ if (!open_bitmap(r, bitmap_git) && !load_bitmap(r, bitmap_git))
return bitmap_git;
free_bitmap_index(bitmap_git);
@@ -573,9 +591,10 @@ 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 bitmap_index *bitmap_git = xcalloc(1, sizeof(*bitmap_git));
- if (!open_midx_bitmap_1(bitmap_git, midx) && !load_bitmap(bitmap_git))
+ if (!open_midx_bitmap_1(bitmap_git, midx) && !load_bitmap(r, bitmap_git))
return bitmap_git;
free_bitmap_index(bitmap_git);
@@ -938,7 +957,8 @@ static void show_object(struct object *object, const char *name, void *data_)
bitmap_set(data->base, bitmap_pos);
}
-static void show_commit(struct commit *commit, void *data)
+static void show_commit(struct commit *commit UNUSED,
+ void *data UNUSED)
{
}
@@ -1575,7 +1595,7 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs,
* from disk. this is the point of no return; after this the rev_list
* becomes invalidated and we must perform the revwalk through bitmaps
*/
- if (load_bitmap(bitmap_git) < 0)
+ if (load_bitmap(revs->repo, bitmap_git) < 0)
goto cleanup;
object_array_clear(&revs->pending);
@@ -1725,6 +1745,7 @@ int reuse_partial_packfile_from_bitmap(struct bitmap_index *bitmap_git,
uint32_t *entries,
struct bitmap **reuse_out)
{
+ struct repository *r = the_repository;
struct packed_git *pack;
struct bitmap *result = bitmap_git->result;
struct bitmap *reuse;
@@ -1735,7 +1756,7 @@ int reuse_partial_packfile_from_bitmap(struct bitmap_index *bitmap_git,
assert(result);
- load_reverse_index(bitmap_git);
+ load_reverse_index(r, bitmap_git);
if (bitmap_is_midx(bitmap_git))
pack = bitmap_git->midx->packs[midx_preferred_pack(bitmap_git)];
@@ -1927,7 +1948,8 @@ static void test_bitmap_type(struct bitmap_test_data *tdata,
type_name(bitmap_type));
}
-static void test_show_object(struct object *object, const char *name,
+static void test_show_object(struct object *object,
+ const char *name UNUSED,
void *data)
{
struct bitmap_test_data *tdata = data;
@@ -2114,12 +2136,13 @@ 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;
uint32_t i, num_objects;
uint32_t *reposition;
if (!bitmap_is_midx(bitmap_git))
- load_reverse_index(bitmap_git);
- else if (load_midx_revindex(bitmap_git->midx) < 0)
+ load_reverse_index(r, bitmap_git);
+ else if (load_midx_revindex(bitmap_git->midx))
BUG("rebuild_existing_bitmaps: missing required rev-cache "
"extension");
@@ -2301,7 +2324,11 @@ int bitmap_is_midx(struct bitmap_index *bitmap_git)
const struct string_list *bitmap_preferred_tips(struct repository *r)
{
- return repo_config_get_value_multi(r, "pack.preferbitmaptips");
+ const struct string_list *dest;
+
+ if (!repo_config_get_string_multi(r, "pack.preferbitmaptips", &dest))
+ return dest;
+ return NULL;
}
int bitmap_is_preferred_refname(struct repository *r, const char *refname)
@@ -2319,3 +2346,48 @@ int bitmap_is_preferred_refname(struct repository *r, const char *refname)
return 0;
}
+
+static int verify_bitmap_file(const char *name)
+{
+ struct stat st;
+ unsigned char *data;
+ int fd = git_open(name);
+ int res = 0;
+
+ /* It is OK to not have the file. */
+ if (fd < 0 || fstat(fd, &st)) {
+ if (fd >= 0)
+ close(fd);
+ return 0;
+ }
+
+ data = xmmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+ close(fd);
+ if (!hashfile_checksum_valid(data, st.st_size))
+ res = error(_("bitmap file '%s' has invalid checksum"),
+ name);
+
+ munmap(data, st.st_size);
+ return res;
+}
+
+int verify_bitmap_files(struct repository *r)
+{
+ int res = 0;
+
+ for (struct multi_pack_index *m = get_multi_pack_index(r);
+ m; m = m->next) {
+ char *midx_bitmap_name = midx_bitmap_filename(m);
+ res |= verify_bitmap_file(midx_bitmap_name);
+ free(midx_bitmap_name);
+ }
+
+ for (struct packed_git *p = get_all_packs(r);
+ p; p = p->next) {
+ char *pack_bitmap_name = pack_bitmap_filename(p);
+ res |= verify_bitmap_file(pack_bitmap_name);
+ free(pack_bitmap_name);
+ }
+
+ return res;
+}
diff --git a/pack-bitmap.h b/pack-bitmap.h
index f0180b5276..84591f041b 100644
--- a/pack-bitmap.h
+++ b/pack-bitmap.h
@@ -111,4 +111,6 @@ int bitmap_is_midx(struct bitmap_index *bitmap_git);
const struct string_list *bitmap_preferred_tips(struct repository *r);
int bitmap_is_preferred_refname(struct repository *r, const char *refname);
+int verify_bitmap_files(struct repository *r);
+
#endif
diff --git a/pack-check.c b/pack-check.c
index bfb593ba72..049f2f0bfc 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -1,9 +1,12 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "environment.h"
+#include "hex.h"
#include "repository.h"
#include "pack.h"
#include "pack-revindex.h"
#include "progress.h"
#include "packfile.h"
+#include "object-file.h"
#include "object-store.h"
struct idx_entry {
diff --git a/pack-mtimes.c b/pack-mtimes.c
index 0f9785fc5e..020a37f8fe 100644
--- a/pack-mtimes.c
+++ b/pack-mtimes.c
@@ -1,5 +1,7 @@
#include "git-compat-util.h"
+#include "gettext.h"
#include "pack-mtimes.h"
+#include "object-file.h"
#include "object-store.h"
#include "packfile.h"
diff --git a/pack-mtimes.h b/pack-mtimes.h
index cc957b3e85..107327cec0 100644
--- a/pack-mtimes.h
+++ b/pack-mtimes.h
@@ -1,8 +1,6 @@
#ifndef PACK_MTIMES_H
#define PACK_MTIMES_H
-#include "git-compat-util.h"
-
#define MTIMES_SIGNATURE 0x4d544d45 /* "MTME" */
#define MTIMES_VERSION 1
diff --git a/pack-objects.c b/pack-objects.c
index 272e8d4517..ccab09fe65 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "object.h"
#include "pack.h"
#include "pack-objects.h"
diff --git a/pack-revindex.c b/pack-revindex.c
index 08dc160167..1f51b712e8 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -1,9 +1,13 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
#include "pack-revindex.h"
+#include "object-file.h"
#include "object-store.h"
#include "packfile.h"
+#include "trace2.h"
#include "config.h"
#include "midx.h"
+#include "csum-file.h"
struct revindex_entry {
off_t offset;
@@ -204,10 +208,14 @@ static int load_revindex_from_disk(char *revindex_name,
size_t revindex_size;
struct revindex_header *hdr;
+ if (git_env_bool(GIT_TEST_REV_INDEX_DIE_ON_DISK, 0))
+ die("dying as requested by '%s'", GIT_TEST_REV_INDEX_DIE_ON_DISK);
+
fd = git_open(revindex_name);
if (fd < 0) {
- ret = -1;
+ /* "No file" means return 1. */
+ ret = 1;
goto cleanup;
}
if (fstat(fd, &st)) {
@@ -259,7 +267,7 @@ cleanup:
return ret;
}
-static int load_pack_revindex_from_disk(struct packed_git *p)
+int load_pack_revindex_from_disk(struct packed_git *p)
{
char *revindex_name;
int ret;
@@ -282,18 +290,58 @@ cleanup:
return ret;
}
-int load_pack_revindex(struct packed_git *p)
+int load_pack_revindex(struct repository *r, struct packed_git *p)
{
if (p->revindex || p->revindex_data)
return 0;
- if (!load_pack_revindex_from_disk(p))
+ prepare_repo_settings(r);
+
+ if (r->settings.pack_read_reverse_index &&
+ !load_pack_revindex_from_disk(p))
return 0;
else if (!create_pack_revindex_in_memory(p))
return 0;
return -1;
}
+/*
+ * verify_pack_revindex verifies that the on-disk rev-index for the given
+ * pack-file is the same that would be created if written from scratch.
+ *
+ * A negative number is returned on error.
+ */
+int verify_pack_revindex(struct packed_git *p)
+{
+ int res = 0;
+
+ /* Do not bother checking if not initialized. */
+ if (!p->revindex_map || !p->revindex_data)
+ return res;
+
+ if (!hashfile_checksum_valid((const unsigned char *)p->revindex_map, p->revindex_size)) {
+ error(_("invalid checksum"));
+ res = -1;
+ }
+
+ /* This may fail due to a broken .idx. */
+ if (create_pack_revindex_in_memory(p))
+ return res;
+
+ for (size_t i = 0; i < p->num_objects; i++) {
+ uint32_t nr = p->revindex[i].nr;
+ uint32_t rev_val = get_be32(p->revindex_data + i);
+
+ if (nr != rev_val) {
+ error(_("invalid rev-index position at %"PRIu64": %"PRIu32" != %"PRIu32""),
+ (uint64_t)i, nr, rev_val);
+ res = -1;
+ }
+ }
+
+ return res;
+}
+
int load_midx_revindex(struct multi_pack_index *m)
{
struct strbuf revindex_name = STRBUF_INIT;
@@ -355,7 +403,7 @@ int offset_to_pack_pos(struct packed_git *p, off_t ofs, uint32_t *pos)
{
unsigned lo, hi;
- if (load_pack_revindex(p) < 0)
+ if (load_pack_revindex(the_repository, p) < 0)
return -1;
lo = 0;
diff --git a/pack-revindex.h b/pack-revindex.h
index 4974e75eb4..6dd47efea1 100644
--- a/pack-revindex.h
+++ b/pack-revindex.h
@@ -34,11 +34,13 @@
#define RIDX_SIGNATURE 0x52494458 /* "RIDX" */
#define RIDX_VERSION 1
-#define GIT_TEST_WRITE_REV_INDEX "GIT_TEST_WRITE_REV_INDEX"
+#define GIT_TEST_NO_WRITE_REV_INDEX "GIT_TEST_NO_WRITE_REV_INDEX"
#define GIT_TEST_REV_INDEX_DIE_IN_MEMORY "GIT_TEST_REV_INDEX_DIE_IN_MEMORY"
+#define GIT_TEST_REV_INDEX_DIE_ON_DISK "GIT_TEST_REV_INDEX_DIE_ON_DISK"
struct packed_git;
struct multi_pack_index;
+struct repository;
/*
* load_pack_revindex populates the revindex's internal data-structures for the
@@ -47,7 +49,23 @@ struct multi_pack_index;
* If a '.rev' file is present it is mmap'd, and pointers are assigned into it
* (instead of using the in-memory variant).
*/
-int load_pack_revindex(struct packed_git *p);
+int load_pack_revindex(struct repository *r, struct packed_git *p);
+
+/*
+ * Specifically load a pack revindex from disk.
+ *
+ * Returns 0 on success, 1 on "no .rev file", and -1 when there is an
+ * error parsing the .rev file.
+ */
+int load_pack_revindex_from_disk(struct packed_git *p);
+
+/*
+ * verify_pack_revindex verifies that the on-disk rev-index for the given
+ * pack-file is the same that would be created if written from scratch.
+ *
+ * A negative number is returned on error.
+ */
+int verify_pack_revindex(struct packed_git *p);
/*
* load_midx_revindex loads the '.rev' file corresponding to the given
diff --git a/pack-write.c b/pack-write.c
index 00787e306d..3b3ce89de6 100644
--- a/pack-write.c
+++ b/pack-write.c
@@ -1,12 +1,16 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "pack.h"
#include "csum-file.h"
#include "remote.h"
#include "chunk-format.h"
#include "pack-mtimes.h"
#include "oidmap.h"
-#include "chunk-format.h"
#include "pack-objects.h"
+#include "pack-revindex.h"
+#include "wrapper.h"
void reset_pack_idx_option(struct pack_idx_option *opts)
{
@@ -310,13 +314,13 @@ static void write_mtimes_trailer(struct hashfile *f, const unsigned char *hash)
hashwrite(f, hash, the_hash_algo->rawsz);
}
-static const char *write_mtimes_file(struct packing_data *to_pack,
- struct pack_idx_entry **objects,
- uint32_t nr_objects,
- const unsigned char *hash)
+static char *write_mtimes_file(struct packing_data *to_pack,
+ struct pack_idx_entry **objects,
+ uint32_t nr_objects,
+ const unsigned char *hash)
{
struct strbuf tmp_file = STRBUF_INIT;
- const char *mtimes_name;
+ char *mtimes_name;
struct hashfile *f;
int fd;
@@ -542,7 +546,7 @@ void stage_tmp_packfiles(struct strbuf *name_buffer,
char **idx_tmp_name)
{
const char *rev_tmp_name = NULL;
- const char *mtimes_tmp_name = NULL;
+ char *mtimes_tmp_name = NULL;
if (adjust_shared_perm(pack_tmp_name))
die_errno("unable to make temporary pack file readable");
@@ -566,6 +570,9 @@ void stage_tmp_packfiles(struct strbuf *name_buffer,
rename_tmp_packfile(name_buffer, rev_tmp_name, "rev");
if (mtimes_tmp_name)
rename_tmp_packfile(name_buffer, mtimes_tmp_name, "mtimes");
+
+ free((char *)rev_tmp_name);
+ free(mtimes_tmp_name);
}
void write_promisor_file(const char *promisor_name, struct ref **sought, int nr_sought)
diff --git a/pack.h b/pack.h
index 01d385903a..3ab9e3f60c 100644
--- a/pack.h
+++ b/pack.h
@@ -4,6 +4,8 @@
#include "object.h"
#include "csum-file.h"
+struct packed_git;
+struct pack_window;
struct repository;
/*
diff --git a/packfile.c b/packfile.c
index c0d7dd93f4..fd083c86e0 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1,4 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "list.h"
#include "pack.h"
#include "repository.h"
@@ -11,12 +15,16 @@
#include "commit.h"
#include "object.h"
#include "tag.h"
+#include "trace.h"
#include "tree-walk.h"
#include "tree.h"
+#include "object-file.h"
#include "object-store.h"
#include "midx.h"
#include "commit-graph.h"
+#include "pack-revindex.h"
#include "promisor-remote.h"
+#include "wrapper.h"
char *odb_pack_name(struct strbuf *buf,
const unsigned char *hash,
@@ -1008,6 +1016,16 @@ void reprepare_packed_git(struct repository *r)
struct object_directory *odb;
obj_read_lock();
+
+ /*
+ * Reprepare alt odbs, in case the alternates file was modified
+ * during the course of this process. This only _adds_ odbs to
+ * the linked list, so existing odbs will continue to exist for
+ * the lifetime of the process.
+ */
+ r->objects->loaded_alternates = 0;
+ prepare_alt_odb(r);
+
for (odb = r->objects->odb; odb; odb = odb->next)
odb_clear_loose_cache(odb);
@@ -1650,22 +1668,6 @@ struct unpack_entry_stack_ent {
unsigned long size;
};
-static void *read_object(struct repository *r,
- const struct object_id *oid,
- enum object_type *type,
- unsigned long *size)
-{
- struct object_info oi = OBJECT_INFO_INIT;
- void *content;
- oi.typep = type;
- oi.sizep = size;
- oi.contentp = &content;
-
- if (oid_object_info_extended(r, oid, &oi, 0) < 0)
- return NULL;
- return content;
-}
-
void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
enum object_type *final_type, unsigned long *final_size)
{
@@ -1798,6 +1800,8 @@ void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
uint32_t pos;
struct object_id base_oid;
if (!(offset_to_pack_pos(p, obj_offset, &pos))) {
+ struct object_info oi = OBJECT_INFO_INIT;
+
nth_packed_object_id(&base_oid, p,
pack_pos_to_index(p, pos));
error("failed to read delta base object %s"
@@ -1805,7 +1809,13 @@ void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset,
oid_to_hex(&base_oid), (uintmax_t)obj_offset,
p->pack_name);
mark_bad_packed_object(p, &base_oid);
- base = read_object(r, &base_oid, &type, &base_size);
+
+ oi.typep = &type;
+ oi.sizep = &base_size;
+ oi.contentp = &base;
+ if (oid_object_info_extended(r, &base_oid, &oi, 0) < 0)
+ base = NULL;
+
external_base = base;
}
}
@@ -2144,7 +2154,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(p))
+ if (load_pack_revindex(the_repository, p))
return -1;
}
@@ -2212,8 +2222,8 @@ 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,
- uint32_t pos,
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED,
void *set_)
{
struct oidset *set = set_;
@@ -2271,7 +2281,7 @@ int is_promisor_object(const struct object_id *oid)
static int promisor_objects_prepared;
if (!promisor_objects_prepared) {
- if (has_promisor_remote()) {
+ if (repo_has_promisor_remote(the_repository)) {
for_each_packed_object(add_promisor_object,
&promisor_objects,
FOR_EACH_OBJECT_PROMISOR_ONLY |
diff --git a/packfile.h b/packfile.h
index a3f6723857..c3692308b8 100644
--- a/packfile.h
+++ b/packfile.h
@@ -1,13 +1,27 @@
#ifndef PACKFILE_H
#define PACKFILE_H
-#include "cache.h"
+#include "object.h"
#include "oidset.h"
/* in object-store.h */
struct packed_git;
struct object_info;
+struct pack_window {
+ struct pack_window *next;
+ unsigned char *base;
+ off_t offset;
+ size_t len;
+ unsigned int last_used;
+ unsigned int inuse_cnt;
+};
+
+struct pack_entry {
+ off_t offset;
+ struct packed_git *p;
+};
+
/*
* Generate the filename to be used for a pack file with checksum "sha1" and
* extension "ext". The result is written into the strbuf "buf", overwriting
@@ -65,7 +79,6 @@ struct packed_git *get_all_packs(struct repository *r);
* for speed.
*/
unsigned long repo_approximate_object_count(struct repository *r);
-#define approximate_object_count() repo_approximate_object_count(the_repository)
struct packed_git *find_sha1_pack(const unsigned char *sha1,
struct packed_git *packs);
diff --git a/pager.c b/pager.c
index b66bbff278..63055d0873 100644
--- a/pager.c
+++ b/pager.c
@@ -1,9 +1,13 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
+#include "editor.h"
+#include "pager.h"
#include "run-command.h"
#include "sigchain.h"
#include "alias.h"
+int pager_use_color = 1;
+
#ifndef DEFAULT_PAGER
#define DEFAULT_PAGER "less"
#endif
diff --git a/pager.h b/pager.h
new file mode 100644
index 0000000000..b77433026d
--- /dev/null
+++ b/pager.h
@@ -0,0 +1,17 @@
+#ifndef PAGER_H
+#define PAGER_H
+
+struct child_process;
+
+const char *git_pager(int stdout_is_tty);
+void setup_pager(void);
+int pager_in_use(void);
+int term_columns(void);
+void term_clear_line(void);
+int decimal_width(uintmax_t);
+int check_pager_config(const char *cmd);
+void prepare_pager_args(struct child_process *, const char *pager);
+
+extern int pager_use_color;
+
+#endif /* PAGER_H */
diff --git a/parallel-checkout.c b/parallel-checkout.c
index 4f6819f240..69d569f352 100644
--- a/parallel-checkout.c
+++ b/parallel-checkout.c
@@ -1,14 +1,20 @@
#include "cache.h"
+#include "alloc.h"
#include "config.h"
#include "entry.h"
+#include "gettext.h"
+#include "hash.h"
+#include "hex.h"
#include "parallel-checkout.h"
#include "pkt-line.h"
#include "progress.h"
#include "run-command.h"
#include "sigchain.h"
#include "streaming.h"
+#include "symlinks.h"
#include "thread-utils.h"
#include "trace2.h"
+#include "wrapper.h"
struct pc_worker {
struct child_process cp;
diff --git a/parse-options-cb.c b/parse-options-cb.c
index d346dbe210..a24521dee0 100644
--- a/parse-options-cb.c
+++ b/parse-options-cb.c
@@ -1,9 +1,12 @@
#include "git-compat-util.h"
#include "parse-options.h"
#include "branch.h"
-#include "cache.h"
#include "commit.h"
#include "color.h"
+#include "date.h"
+#include "environment.h"
+#include "gettext.h"
+#include "object-name.h"
#include "string-list.h"
#include "strvec.h"
#include "oid-array.h"
@@ -91,7 +94,7 @@ int parse_opt_commits(const struct option *opt, const char *arg, int unset)
if (!arg)
return -1;
- if (get_oid(arg, &oid))
+ if (repo_get_oid(the_repository, arg, &oid))
return error("malformed object name %s", arg);
commit = lookup_commit_reference(the_repository, &oid);
if (!commit)
@@ -110,7 +113,7 @@ int parse_opt_commit(const struct option *opt, const char *arg, int unset)
if (!arg)
return -1;
- if (get_oid(arg, &oid))
+ if (repo_get_oid(the_repository, arg, &oid))
return error("malformed object name %s", arg);
commit = lookup_commit_reference(the_repository, &oid);
if (!commit)
@@ -129,7 +132,7 @@ int parse_opt_object_name(const struct option *opt, const char *arg, int unset)
}
if (!arg)
return -1;
- if (get_oid(arg, &oid))
+ if (repo_get_oid(the_repository, arg, &oid))
return error(_("malformed object name '%s'"), arg);
oid_array_append(opt->value, &oid);
return 0;
@@ -146,7 +149,7 @@ int parse_opt_object_id(const struct option *opt, const char *arg, int unset)
}
if (!arg)
return -1;
- if (get_oid(arg, &oid))
+ if (repo_get_oid(the_repository, arg, &oid))
return error(_("malformed object name '%s'"), arg);
*target = oid;
return 0;
@@ -208,24 +211,25 @@ int parse_opt_string_list(const struct option *opt, const char *arg, int unset)
return 0;
}
-int parse_opt_noop_cb(const struct option *opt, const char *arg, int unset)
+int parse_opt_strvec(const struct option *opt, const char *arg, int unset)
{
+ struct strvec *v = opt->value;
+
+ if (unset) {
+ strvec_clear(v);
+ return 0;
+ }
+
+ if (!arg)
+ return -1;
+
+ strvec_push(v, arg);
return 0;
}
-/**
- * Report that the option is unknown, so that other code can handle
- * it. This can be used as a callback together with
- * OPTION_LOWLEVEL_CALLBACK to allow an option to be documented in the
- * "-h" output even if it's not being handled directly by
- * parse_options().
- */
-enum parse_opt_result parse_opt_unknown_cb(struct parse_opt_ctx_t *ctx,
- const struct option *opt,
- const char *arg, int unset)
+int parse_opt_noop_cb(const struct option *opt, const char *arg, int unset)
{
- BUG_ON_OPT_ARG(arg);
- return PARSE_OPT_UNKNOWN;
+ return 0;
}
/**
diff --git a/parse-options.c b/parse-options.c
index a1ec932f0f..f8a155ee13 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -1,9 +1,11 @@
#include "git-compat-util.h"
#include "parse-options.h"
-#include "cache.h"
+#include "abspath.h"
#include "config.h"
#include "commit.h"
#include "color.h"
+#include "gettext.h"
+#include "strbuf.h"
#include "utf8.h"
static int disallow_abbreviated_options;
@@ -59,12 +61,12 @@ static enum parse_opt_result get_arg(struct parse_opt_ctx_t *p,
return 0;
}
-static void fix_filename(const char *prefix, const char **file)
+static void fix_filename(const char *prefix, char **file)
{
- if (!file || !*file || !prefix || is_absolute_path(*file)
- || !strcmp("-", *file))
- return;
- *file = prefix_filename(prefix, *file);
+ if (!file || !*file)
+ ; /* leave as NULL */
+ else
+ *file = prefix_filename_except_for_dash(prefix, *file);
}
static enum parse_opt_result opt_command_mode_error(
@@ -177,7 +179,7 @@ static enum parse_opt_result get_value(struct parse_opt_ctx_t *p,
err = get_arg(p, opt, flags, (const char **)opt->value);
if (!err)
- fix_filename(p->prefix, (const char **)opt->value);
+ fix_filename(p->prefix, (char **)opt->value);
return err;
case OPTION_CALLBACK:
@@ -702,8 +704,7 @@ static struct option *preprocess_options(struct parse_opt_ctx_t *ctx,
if (!nr_aliases)
return NULL;
- ALLOC_ARRAY(newopt, nr + 1);
- COPY_ARRAY(newopt, options, nr + 1);
+ DUP_ARRAY(newopt, options, nr + 1);
/* each alias has two string pointers and NULL */
CALLOC_ARRAY(ctx->alias_groups, 3 * (nr_aliases + 1));
diff --git a/parse-options.h b/parse-options.h
index b6ef86e0d1..8e48efe524 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -1,6 +1,8 @@
#ifndef PARSE_OPTIONS_H
#define PARSE_OPTIONS_H
+#include "gettext.h"
+
/**
* Refer to Documentation/technical/api-parse-options.txt for the API doc.
*/
@@ -158,71 +160,211 @@ struct option {
parse_opt_subcommand_fn *subcommand_fn;
};
-#define OPT_BIT_F(s, l, v, h, b, f) { OPTION_BIT, (s), (l), (v), NULL, (h), \
- PARSE_OPT_NOARG|(f), NULL, (b) }
-#define OPT_COUNTUP_F(s, l, v, h, f) { OPTION_COUNTUP, (s), (l), (v), NULL, \
- (h), PARSE_OPT_NOARG|(f) }
-#define OPT_SET_INT_F(s, l, v, h, i, f) { OPTION_SET_INT, (s), (l), (v), NULL, \
- (h), PARSE_OPT_NOARG | (f), NULL, (i) }
+#define OPT_BIT_F(s, l, v, h, b, f) { \
+ .type = OPTION_BIT, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .help = (h), \
+ .flags = PARSE_OPT_NOARG|(f), \
+ .callback = NULL, \
+ .defval = (b), \
+}
+#define OPT_COUNTUP_F(s, l, v, h, f) { \
+ .type = OPTION_COUNTUP, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .help = (h), \
+ .flags = PARSE_OPT_NOARG|(f), \
+}
+#define OPT_SET_INT_F(s, l, v, h, i, f) { \
+ .type = OPTION_SET_INT, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .help = (h), \
+ .flags = PARSE_OPT_NOARG | (f), \
+ .defval = (i), \
+}
#define OPT_BOOL_F(s, l, v, h, f) OPT_SET_INT_F(s, l, v, h, 1, f)
-#define OPT_CALLBACK_F(s, l, v, a, h, f, cb) \
- { OPTION_CALLBACK, (s), (l), (v), (a), (h), (f), (cb) }
-#define OPT_STRING_F(s, l, v, a, h, f) { OPTION_STRING, (s), (l), (v), (a), (h), (f) }
-#define OPT_INTEGER_F(s, l, v, h, f) { OPTION_INTEGER, (s), (l), (v), N_("n"), (h), (f) }
+#define OPT_CALLBACK_F(s, l, v, a, h, f, cb) { \
+ .type = OPTION_CALLBACK, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .argh = (a), \
+ .help = (h), \
+ .flags = (f), \
+ .callback = (cb), \
+}
+#define OPT_STRING_F(s, l, v, a, h, f) { \
+ .type = OPTION_STRING, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .argh = (a), \
+ .help = (h), \
+ .flags = (f), \
+}
+#define OPT_INTEGER_F(s, l, v, h, f) { \
+ .type = OPTION_INTEGER, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .argh = N_("n"), \
+ .help = (h), \
+ .flags = (f), \
+}
-#define OPT_END() { OPTION_END }
-#define OPT_GROUP(h) { OPTION_GROUP, 0, NULL, NULL, NULL, (h) }
+#define OPT_END() { \
+ .type = OPTION_END, \
+}
+#define OPT_GROUP(h) { \
+ .type = OPTION_GROUP, \
+ .help = (h), \
+}
#define OPT_BIT(s, l, v, h, b) OPT_BIT_F(s, l, v, h, b, 0)
-#define OPT_BITOP(s, l, v, h, set, clear) { OPTION_BITOP, (s), (l), (v), NULL, (h), \
- PARSE_OPT_NOARG|PARSE_OPT_NONEG, NULL, \
- (set), NULL, (clear) }
-#define OPT_NEGBIT(s, l, v, h, b) { OPTION_NEGBIT, (s), (l), (v), NULL, \
- (h), PARSE_OPT_NOARG, NULL, (b) }
+#define OPT_BITOP(s, l, v, h, set, clear) { \
+ .type = OPTION_BITOP, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .help = (h), \
+ .flags = PARSE_OPT_NOARG|PARSE_OPT_NONEG, \
+ .defval = (set), \
+ .extra = (clear), \
+}
+#define OPT_NEGBIT(s, l, v, h, b) { \
+ .type = OPTION_NEGBIT, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .help = (h), \
+ .flags = PARSE_OPT_NOARG, \
+ .defval = (b), \
+}
#define OPT_COUNTUP(s, l, v, h) OPT_COUNTUP_F(s, l, v, h, 0)
#define OPT_SET_INT(s, l, v, h, i) OPT_SET_INT_F(s, l, v, h, i, 0)
#define OPT_BOOL(s, l, v, h) OPT_BOOL_F(s, l, v, h, 0)
-#define OPT_HIDDEN_BOOL(s, l, v, h) { OPTION_SET_INT, (s), (l), (v), NULL, \
- (h), PARSE_OPT_NOARG | PARSE_OPT_HIDDEN, NULL, 1}
-#define OPT_CMDMODE_F(s, l, v, h, i, f) { OPTION_SET_INT, (s), (l), (v), NULL, \
- (h), PARSE_OPT_CMDMODE|PARSE_OPT_NOARG|PARSE_OPT_NONEG | (f), NULL, (i) }
+#define OPT_HIDDEN_BOOL(s, l, v, h) { \
+ .type = OPTION_SET_INT, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .help = (h), \
+ .flags = PARSE_OPT_NOARG | PARSE_OPT_HIDDEN, \
+ .defval = 1, \
+}
+#define OPT_CMDMODE_F(s, l, v, h, i, f) { \
+ .type = OPTION_SET_INT, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .help = (h), \
+ .flags = PARSE_OPT_CMDMODE|PARSE_OPT_NOARG|PARSE_OPT_NONEG | (f), \
+ .defval = (i), \
+}
#define OPT_CMDMODE(s, l, v, h, i) OPT_CMDMODE_F(s, l, v, h, i, 0)
#define OPT_INTEGER(s, l, v, h) OPT_INTEGER_F(s, l, v, h, 0)
-#define OPT_MAGNITUDE(s, l, v, h) { OPTION_MAGNITUDE, (s), (l), (v), \
- N_("n"), (h), PARSE_OPT_NONEG }
+#define OPT_MAGNITUDE(s, l, v, h) { \
+ .type = OPTION_MAGNITUDE, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .argh = N_("n"), \
+ .help = (h), \
+ .flags = PARSE_OPT_NONEG, \
+}
#define OPT_STRING(s, l, v, a, h) OPT_STRING_F(s, l, v, a, h, 0)
-#define OPT_STRING_LIST(s, l, v, a, h) \
- { OPTION_CALLBACK, (s), (l), (v), (a), \
- (h), 0, &parse_opt_string_list }
-#define OPT_UYN(s, l, v, h) { OPTION_CALLBACK, (s), (l), (v), NULL, \
- (h), PARSE_OPT_NOARG, &parse_opt_tertiary }
-#define OPT_EXPIRY_DATE(s, l, v, h) \
- { OPTION_CALLBACK, (s), (l), (v), N_("expiry-date"),(h), 0, \
- parse_opt_expiry_date_cb }
-#define OPT_CALLBACK(s, l, v, a, h, f) OPT_CALLBACK_F(s, l, v, a, h, 0, f)
-#define OPT_NUMBER_CALLBACK(v, h, f) \
- { OPTION_NUMBER, 0, NULL, (v), NULL, (h), \
- PARSE_OPT_NOARG | PARSE_OPT_NONEG, (f) }
-#define OPT_FILENAME(s, l, v, h) { OPTION_FILENAME, (s), (l), (v), \
- N_("file"), (h) }
-#define OPT_COLOR_FLAG(s, l, v, h) \
- { OPTION_CALLBACK, (s), (l), (v), N_("when"), (h), PARSE_OPT_OPTARG, \
- parse_opt_color_flag_cb, (intptr_t)"always" }
-
-#define OPT_NOOP_NOARG(s, l) \
- { OPTION_CALLBACK, (s), (l), NULL, NULL, \
- N_("no-op (backward compatibility)"), \
- PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, parse_opt_noop_cb }
-
-#define OPT_ALIAS(s, l, source_long_name) \
- { OPTION_ALIAS, (s), (l), (source_long_name) }
+#define OPT_STRING_LIST(s, l, v, a, h) { \
+ .type = OPTION_CALLBACK, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .argh = (a), \
+ .help = (h), \
+ .callback = &parse_opt_string_list, \
+}
+#define OPT_STRVEC(s, l, v, a, h) { \
+ .type = OPTION_CALLBACK, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .argh = (a), \
+ .help = (h), \
+ .callback = &parse_opt_strvec, \
+}
+#define OPT_UYN(s, l, v, h) { \
+ .type = OPTION_CALLBACK, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .help = (h), \
+ .flags = PARSE_OPT_NOARG, \
+ .callback = &parse_opt_tertiary, \
+}
+#define OPT_EXPIRY_DATE(s, l, v, h) { \
+ .type = OPTION_CALLBACK, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .argh = N_("expiry-date"), \
+ .help = (h), \
+ .callback = parse_opt_expiry_date_cb, \
+}
+#define OPT_CALLBACK(s, l, v, a, h, cb) OPT_CALLBACK_F(s, l, v, a, h, 0, cb)
+#define OPT_NUMBER_CALLBACK(v, h, cb) { \
+ .type = OPTION_NUMBER, \
+ .value = (v), \
+ .help = (h), \
+ .flags = PARSE_OPT_NOARG | PARSE_OPT_NONEG, \
+ .callback = (cb), \
+}
+#define OPT_FILENAME(s, l, v, h) { \
+ .type = OPTION_FILENAME, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .argh = N_("file"), \
+ .help = (h), \
+}
+#define OPT_COLOR_FLAG(s, l, v, h) { \
+ .type = OPTION_CALLBACK, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .argh = N_("when"), \
+ .help = (h), \
+ .flags = PARSE_OPT_OPTARG, \
+ .callback = parse_opt_color_flag_cb, \
+ .defval = (intptr_t)"always", \
+}
+
+#define OPT_NOOP_NOARG(s, l) { \
+ .type = OPTION_CALLBACK, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .help = N_("no-op (backward compatibility)"), \
+ .flags = PARSE_OPT_HIDDEN | PARSE_OPT_NOARG, \
+ .callback = parse_opt_noop_cb, \
+}
+
+#define OPT_ALIAS(s, l, source_long_name) { \
+ .type = OPTION_ALIAS, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (source_long_name), \
+}
#define OPT_SUBCOMMAND_F(l, v, fn, f) { \
.type = OPTION_SUBCOMMAND, \
.long_name = (l), \
.value = (v), \
.flags = (f), \
- .subcommand_fn = (fn) }
+ .subcommand_fn = (fn), \
+}
#define OPT_SUBCOMMAND(l, v, fn) OPT_SUBCOMMAND_F((l), (v), (fn), 0)
/*
@@ -347,10 +489,8 @@ int parse_opt_commits(const struct option *, const char *, int);
int parse_opt_commit(const struct option *, const char *, int);
int parse_opt_tertiary(const struct option *, const char *, int);
int parse_opt_string_list(const struct option *, const char *, int);
+int parse_opt_strvec(const struct option *, const char *, int);
int parse_opt_noop_cb(const struct option *, const char *, int);
-enum parse_opt_result parse_opt_unknown_cb(struct parse_opt_ctx_t *ctx,
- const struct option *,
- const char *, int);
int parse_opt_passthru(const struct option *, const char *, int);
int parse_opt_passthru_argv(const struct option *, const char *, int);
/* value is enum branch_track* */
@@ -358,30 +498,80 @@ int parse_opt_tracking_mode(const struct option *, const char *, int);
#define OPT__VERBOSE(var, h) OPT_COUNTUP('v', "verbose", (var), (h))
#define OPT__QUIET(var, h) OPT_COUNTUP('q', "quiet", (var), (h))
-#define OPT__VERBOSITY(var) \
- { OPTION_CALLBACK, 'v', "verbose", (var), NULL, N_("be more verbose"), \
- PARSE_OPT_NOARG, &parse_opt_verbosity_cb, 0 }, \
- { OPTION_CALLBACK, 'q', "quiet", (var), NULL, N_("be more quiet"), \
- PARSE_OPT_NOARG, &parse_opt_verbosity_cb, 0 }
+#define OPT__VERBOSITY(var) { \
+ .type = OPTION_CALLBACK, \
+ .short_name = 'v', \
+ .long_name = "verbose", \
+ .value = (var), \
+ .help = N_("be more verbose"), \
+ .flags = PARSE_OPT_NOARG, \
+ .callback = &parse_opt_verbosity_cb, \
+}, { \
+ .type = OPTION_CALLBACK, \
+ .short_name = 'q', \
+ .long_name = "quiet", \
+ .value = (var), \
+ .help = N_("be more quiet"), \
+ .flags = PARSE_OPT_NOARG, \
+ .callback = &parse_opt_verbosity_cb, \
+}
#define OPT__DRY_RUN(var, h) OPT_BOOL('n', "dry-run", (var), (h))
#define OPT__FORCE(var, h, f) OPT_COUNTUP_F('f', "force", (var), (h), (f))
-#define OPT__ABBREV(var) \
- { OPTION_CALLBACK, 0, "abbrev", (var), N_("n"), \
- N_("use <n> digits to display object names"), \
- PARSE_OPT_OPTARG, &parse_opt_abbrev_cb, 0 }
+#define OPT__ABBREV(var) { \
+ .type = OPTION_CALLBACK, \
+ .long_name = "abbrev", \
+ .value = (var), \
+ .argh = N_("n"), \
+ .help = N_("use <n> digits to display object names"), \
+ .flags = PARSE_OPT_OPTARG, \
+ .callback = &parse_opt_abbrev_cb, \
+}
+#define OPT__SUPER_PREFIX(var) \
+ OPT_STRING_F(0, "super-prefix", (var), N_("prefix"), \
+ N_("prefixed path to initial superproject"), PARSE_OPT_HIDDEN)
+
#define OPT__COLOR(var, h) \
OPT_COLOR_FLAG(0, "color", (var), (h))
-#define OPT_COLUMN(s, l, v, h) \
- { OPTION_CALLBACK, (s), (l), (v), N_("style"), (h), PARSE_OPT_OPTARG, parseopt_column_callback }
-#define OPT_PASSTHRU(s, l, v, a, h, f) \
- { OPTION_CALLBACK, (s), (l), (v), (a), (h), (f), parse_opt_passthru }
-#define OPT_PASSTHRU_ARGV(s, l, v, a, h, f) \
- { OPTION_CALLBACK, (s), (l), (v), (a), (h), (f), parse_opt_passthru_argv }
-#define _OPT_CONTAINS_OR_WITH(name, variable, help, flag) \
- { OPTION_CALLBACK, 0, name, (variable), N_("commit"), (help), \
- PARSE_OPT_LASTARG_DEFAULT | flag, \
- parse_opt_commits, (intptr_t) "HEAD" \
- }
+#define OPT_COLUMN(s, l, v, h) { \
+ .type = OPTION_CALLBACK, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .argh = N_("style"), \
+ .help = (h), \
+ .flags = PARSE_OPT_OPTARG, \
+ .callback = parseopt_column_callback, \
+}
+#define OPT_PASSTHRU(s, l, v, a, h, f) { \
+ .type = OPTION_CALLBACK, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .argh = (a), \
+ .help = (h), \
+ .flags = (f), \
+ .callback = parse_opt_passthru, \
+}
+#define OPT_PASSTHRU_ARGV(s, l, v, a, h, f) { \
+ .type = OPTION_CALLBACK, \
+ .short_name = (s), \
+ .long_name = (l), \
+ .value = (v), \
+ .argh = (a), \
+ .help = (h), \
+ .flags = (f), \
+ .callback = parse_opt_passthru_argv, \
+}
+#define _OPT_CONTAINS_OR_WITH(l, v, h, f) { \
+ .type = OPTION_CALLBACK, \
+ .long_name = (l), \
+ .value = (v), \
+ .argh = N_("commit"), \
+ .help = (h), \
+ .flags = PARSE_OPT_LASTARG_DEFAULT | (f), \
+ .callback = parse_opt_commits, \
+ .defval = (intptr_t) "HEAD", \
+}
#define OPT_CONTAINS(v, h) _OPT_CONTAINS_OR_WITH("contains", v, h, PARSE_OPT_NONEG)
#define OPT_NO_CONTAINS(v, h) _OPT_CONTAINS_OR_WITH("no-contains", v, h, PARSE_OPT_NONEG)
#define OPT_WITH(v, h) _OPT_CONTAINS_OR_WITH("with", v, h, PARSE_OPT_HIDDEN | PARSE_OPT_NONEG)
diff --git a/patch-ids.c b/patch-ids.c
index 46c6a8f3ea..19af7bee98 100644
--- a/patch-ids.c
+++ b/patch-ids.c
@@ -1,7 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "diff.h"
#include "commit.h"
#include "hash-lookup.h"
+#include "hex.h"
#include "patch-ids.h"
static int patch_id_defined(struct commit *commit)
@@ -11,7 +12,7 @@ static int patch_id_defined(struct commit *commit)
}
int commit_patch_id(struct commit *commit, struct diff_options *options,
- struct object_id *oid, int diff_header_only, int stable)
+ struct object_id *oid, int diff_header_only)
{
if (!patch_id_defined(commit))
return -1;
@@ -22,7 +23,7 @@ int commit_patch_id(struct commit *commit, struct diff_options *options,
else
diff_root_tree_oid(&commit->object.oid, "", options);
diffcore_std(options);
- return diff_flush_patch_id(options, oid, diff_header_only, stable);
+ return diff_flush_patch_id(options, oid, diff_header_only);
}
/*
@@ -48,11 +49,11 @@ static int patch_id_neq(const void *cmpfn_data,
b = container_of(entry_or_key, struct patch_id, ent);
if (is_null_oid(&a->patch_id) &&
- commit_patch_id(a->commit, opt, &a->patch_id, 0, 0))
+ commit_patch_id(a->commit, opt, &a->patch_id, 0))
return error("Could not get patch ID for %s",
oid_to_hex(&a->commit->object.oid));
if (is_null_oid(&b->patch_id) &&
- commit_patch_id(b->commit, opt, &b->patch_id, 0, 0))
+ commit_patch_id(b->commit, opt, &b->patch_id, 0))
return error("Could not get patch ID for %s",
oid_to_hex(&b->commit->object.oid));
return !oideq(&a->patch_id, &b->patch_id);
@@ -82,7 +83,7 @@ static int init_patch_id_entry(struct patch_id *patch,
struct object_id header_only_patch_id;
patch->commit = commit;
- if (commit_patch_id(commit, &ids->diffopts, &header_only_patch_id, 1, 0))
+ if (commit_patch_id(commit, &ids->diffopts, &header_only_patch_id, 1))
return -1;
hashmap_entry_init(&patch->ent, oidhash(&header_only_patch_id));
diff --git a/patch-ids.h b/patch-ids.h
index ab6c6a6804..490d739371 100644
--- a/patch-ids.h
+++ b/patch-ids.h
@@ -20,7 +20,7 @@ struct patch_ids {
};
int commit_patch_id(struct commit *commit, struct diff_options *options,
- struct object_id *oid, int, int);
+ struct object_id *oid, int);
int init_patch_ids(struct repository *, struct patch_ids *);
int free_patch_ids(struct patch_ids *);
diff --git a/path.c b/path.c
index a3cfcd8a6e..7c1cd8182a 100644
--- a/path.c
+++ b/path.c
@@ -1,18 +1,24 @@
/*
* Utilities for paths and pathnames
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "strbuf.h"
#include "string-list.h"
#include "dir.h"
#include "worktree.h"
+#include "setup.h"
#include "submodule-config.h"
#include "path.h"
#include "packfile.h"
#include "object-store.h"
#include "lockfile.h"
#include "exec-cmd.h"
+#include "wrapper.h"
static int get_st_mode_bits(const char *path, int *mode)
{
@@ -347,7 +353,8 @@ static void init_common_trie(void)
* Helper function for update_common_dir: returns 1 if the dir
* prefix is common.
*/
-static int check_common(const char *unmatched, void *value, void *baton)
+static int check_common(const char *unmatched, void *value,
+ void *baton UNUSED)
{
struct common_dir *dir = value;
@@ -901,7 +908,13 @@ int adjust_shared_perm(const char *path)
if (S_ISDIR(old_mode)) {
/* Copy read bits to execute bits */
new_mode |= (new_mode & 0444) >> 2;
- new_mode |= FORCE_DIR_SET_GID;
+
+ /*
+ * g+s matters only if any extra access is granted
+ * based on group membership.
+ */
+ if (FORCE_DIR_SET_GID && (new_mode & 060))
+ new_mode |= FORCE_DIR_SET_GID;
}
if (((old_mode ^ new_mode) & ~S_IFMT) &&
diff --git a/path.h b/path.h
index 0a59c85a62..60e83a49a9 100644
--- a/path.h
+++ b/path.h
@@ -3,6 +3,7 @@
struct repository;
struct strbuf;
+struct string_list;
/*
* The result to all functions which return statically allocated memory may be
@@ -179,7 +180,66 @@ const char *git_path_auto_merge(struct repository *r);
const char *git_path_fetch_head(struct repository *r);
const char *git_path_shallow(struct repository *r);
-
int ends_with_path_components(const char *path, const char *components);
+int validate_headref(const char *ref);
+
+int adjust_shared_perm(const char *path);
+
+char *interpolate_path(const char *path, int real_home);
+const char *enter_repo(const char *path, int strict);
+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);
+int normalize_path_copy(char *dst, const char *src);
+int longest_ancestor_length(const char *path, struct string_list *prefixes);
+char *strip_path_suffix(const char *path, const char *suffix);
+int daemon_avoid_alias(const char *path);
+
+/*
+ * These functions match their is_hfs_dotgit() counterparts; see utf8.h for
+ * details.
+ */
+int is_ntfs_dotgit(const char *name);
+int is_ntfs_dotgitmodules(const char *name);
+int is_ntfs_dotgitignore(const char *name);
+int is_ntfs_dotgitattributes(const char *name);
+int is_ntfs_dotmailmap(const char *name);
+
+/*
+ * Returns true iff "str" could be confused as a command-line option when
+ * passed to a sub-program like "ssh". Note that this has nothing to do with
+ * shell-quoting, which should be handled separately; we're assuming here that
+ * the string makes it verbatim to the sub-program.
+ */
+int looks_like_command_line_option(const char *str);
+
+/**
+ * Return a newly allocated string with the evaluation of
+ * "$XDG_CONFIG_HOME/$subdir/$filename" if $XDG_CONFIG_HOME is non-empty, otherwise
+ * "$HOME/.config/$subdir/$filename". Return NULL upon error.
+ */
+char *xdg_config_home_for(const char *subdir, const char *filename);
+
+/**
+ * Return a newly allocated string with the evaluation of
+ * "$XDG_CONFIG_HOME/git/$filename" if $XDG_CONFIG_HOME is non-empty, otherwise
+ * "$HOME/.config/git/$filename". Return NULL upon error.
+ */
+char *xdg_config_home(const char *filename);
+
+/**
+ * Return a newly allocated string with the evaluation of
+ * "$XDG_CACHE_HOME/git/$filename" if $XDG_CACHE_HOME is non-empty, otherwise
+ * "$HOME/.cache/git/$filename". Return NULL upon error.
+ */
+char *xdg_cache_home(const char *filename);
+
+/*
+ * Create a directory and (if share is nonzero) adjust its permissions
+ * according to the shared_repository setting. Only use this for
+ * directories under $GIT_DIR. Don't use it for working tree
+ * directories.
+ */
+void safe_create_dir(const char *dir, int share);
#endif /* PATH_H */
diff --git a/pathspec.c b/pathspec.c
index 46e77a85fe..1e57b6c667 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -1,9 +1,15 @@
#include "cache.h"
+#include "abspath.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
#include "pathspec.h"
#include "attr.h"
+#include "repository.h"
+#include "setup.h"
#include "strvec.h"
+#include "symlinks.h"
#include "quote.h"
/*
@@ -545,7 +551,7 @@ static void NORETURN unsupported_magic(const char *pattern,
}
/*
* We may want to substitute "this command" with a command
- * name. E.g. when add--interactive dies when running
+ * name. E.g. when "git add -p" or "git add -i" dies when running
* "checkout -p"
*/
die(_("%s: pathspec magic not supported by this command: %s"),
@@ -681,8 +687,7 @@ void copy_pathspec(struct pathspec *dst, const struct pathspec *src)
int i, j;
*dst = *src;
- ALLOC_ARRAY(dst->items, dst->nr);
- COPY_ARRAY(dst->items, src->items, dst->nr);
+ DUP_ARRAY(dst->items, src->items, dst->nr);
for (i = 0; i < dst->nr; i++) {
struct pathspec_item *d = &dst->items[i];
@@ -691,8 +696,7 @@ void copy_pathspec(struct pathspec *dst, const struct pathspec *src)
d->match = xstrdup(s->match);
d->original = xstrdup(s->original);
- ALLOC_ARRAY(d->attr_match, d->attr_match_nr);
- COPY_ARRAY(d->attr_match, s->attr_match, d->attr_match_nr);
+ DUP_ARRAY(d->attr_match, s->attr_match, d->attr_match_nr);
for (j = 0; j < d->attr_match_nr; j++) {
const char *value = s->attr_match[j].value;
d->attr_match[j].value = xstrdup_or_null(value);
@@ -732,7 +736,7 @@ int match_pathspec_attrs(struct index_state *istate,
if (name[namelen])
name = to_free = xmemdupz(name, namelen);
- git_check_attr(istate, name, item->attr_check);
+ git_check_attr(istate, NULL, name, item->attr_check);
free(to_free);
diff --git a/pathspec.h b/pathspec.h
index 41f6adfbb4..a5b38e0907 100644
--- a/pathspec.h
+++ b/pathspec.h
@@ -171,6 +171,11 @@ int match_pathspec_attrs(struct index_state *istate,
const char *name, int namelen,
const struct pathspec_item *item);
+int match_pathspec(struct index_state *istate,
+ const struct pathspec *pathspec,
+ const char *name, int namelen,
+ int prefix, char *seen, int is_dir);
+
/*
* Determine whether a pathspec will match only entire index entries (non-sparse
* files and/or entire sparse directories). If the pathspec has the potential to
diff --git a/perl/Git.pm b/perl/Git.pm
index 080cdc2a21..117765dc73 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -177,16 +177,27 @@ sub repository {
-d $opts{Directory} or throw Error::Simple("Directory not found: $opts{Directory} $!");
my $search = Git->repository(WorkingCopy => $opts{Directory});
- my $dir;
+
+ # This rev-parse will throw an exception if we're not in a
+ # repository, which is what we want, but it's kind of noisy.
+ # Ideally we'd capture stderr and relay it, but doing so is
+ # awkward without depending on it fitting in a pipe buffer. So
+ # we just reproduce a plausible error message ourselves.
+ my $out;
try {
- $dir = $search->command_oneline(['rev-parse', '--git-dir'],
- STDERR => 0);
+ # Note that "--is-bare-repository" must come first, as
+ # --git-dir output could contain newlines.
+ $out = $search->command([qw(rev-parse --is-bare-repository --git-dir)],
+ STDERR => 0);
} catch Git::Error::Command with {
- $dir = undef;
+ throw Error::Simple("fatal: not a git repository: $opts{Directory}");
};
+ chomp $out;
+ my ($bare, $dir) = split /\n/, $out, 2;
+
require Cwd;
- if ($dir) {
+ if ($bare ne 'true') {
require File::Spec;
File::Spec->file_name_is_absolute($dir) or $dir = $opts{Directory} . '/' . $dir;
$opts{Repository} = Cwd::abs_path($dir);
@@ -204,21 +215,6 @@ sub repository {
$opts{WorkingSubdir} = $prefix;
} else {
- # A bare repository? Let's see...
- $dir = $opts{Directory};
-
- unless (-d "$dir/refs" and -d "$dir/objects" and -e "$dir/HEAD") {
- # Mimic git-rev-parse --git-dir error message:
- throw Error::Simple("fatal: Not a git repository: $dir");
- }
- my $search = Git->repository(Repository => $dir);
- try {
- $search->command('symbolic-ref', 'HEAD');
- } catch Git::Error::Command with {
- # Mimic git-rev-parse --git-dir error message:
- throw Error::Simple("fatal: Not a git repository: $dir");
- }
-
$opts{Repository} = Cwd::abs_path($dir);
}
diff --git a/pkt-line.c b/pkt-line.c
index ce4e73b683..62b4208b66 100644
--- a/pkt-line.c
+++ b/pkt-line.c
@@ -1,6 +1,12 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "copy.h"
#include "pkt-line.h"
+#include "gettext.h"
+#include "hex.h"
#include "run-command.h"
+#include "trace.h"
+#include "wrapper.h"
+#include "write-or-die.h"
char packet_buffer[LARGE_PACKET_MAX];
static const char *packet_trace_prefix = "git";
diff --git a/pkt-line.h b/pkt-line.h
index 79c538b99e..7c23a4bfaf 100644
--- a/pkt-line.h
+++ b/pkt-line.h
@@ -1,7 +1,6 @@
#ifndef PKTLINE_H
#define PKTLINE_H
-#include "git-compat-util.h"
#include "strbuf.h"
#include "sideband.h"
@@ -247,4 +246,6 @@ void packet_writer_error(struct packet_writer *writer, const char *fmt, ...);
void packet_writer_delim(struct packet_writer *writer);
void packet_writer_flush(struct packet_writer *writer);
+void packet_trace_identity(const char *prog);
+
#endif
diff --git a/po/bg.po b/po/bg.po
index 8b2a936ba0..daec1326c0 100644
--- a/po/bg.po
+++ b/po/bg.po
@@ -1,7 +1,7 @@
# Bulgarian translation of git po-file.
-# Copyright (C) 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Alexander Shopov <ash@kambanaria.org>.
+# Copyright (C) 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Alexander Shopov <ash@kambanaria.org>.
# This file is distributed under the same license as the git package.
-# Alexander Shopov <ash@kambanaria.org>, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022.
+# Alexander Shopov <ash@kambanaria.org>, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023.
# ========================
# DICTIONARY TO MERGE IN GIT GUI
# ------------------------
@@ -193,6 +193,13 @@
# out of range извън диапазона
# checksum Ñума за проверка
# superproject обхващащ проект
+# scalar repo Ñкаларно хранилище
+# unclean завършвам работа/задача Ñ Ð³Ñ€ÐµÑˆÐºÐ°
+# cache tree кеш за обекти-дървета
+# gitattributes file файл Ñ Ð°Ñ‚Ñ€Ð¸Ð±ÑƒÑ‚Ð¸ на git
+# advertised обÑвен за наличен
+# superproject Ñвръхпроект
+#
# ------------------------
# „$var“ - може да не Ñработва за shell има gettext и eval_gettext - проверка - намират Ñе леÑно по „$
# ------------------------
@@ -209,10 +216,10 @@
# for i in `sort -u FILES`; do cnt=`grep $i FILES | wc -l`; echo $cnt $i ;done | sort -n
msgid ""
msgstr ""
-"Project-Id-Version: git 2.38\n"
+"Project-Id-Version: git 2.40\n"
"Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2022-09-28 10:59+0200\n"
-"PO-Revision-Date: 2022-09-28 10:59+0200\n"
+"POT-Creation-Date: 2023-03-01 01:20+0000\n"
+"PO-Revision-Date: 2023-03-02 08:54+0200\n"
"Last-Translator: Alexander Shopov <ash@kambanaria.org>\n"
"Language-Team: Bulgarian <dict@fsa-bg.org>\n"
"Language: bg\n"
@@ -247,13 +254,13 @@ msgstr "неуÑпешно добавÑне в индекÑа на „%s“"
msgid "could not write index"
msgstr "индекÑÑŠÑ‚ не може да бъде запиÑан"
-#, c-format, perl-format
+#, c-format
msgid "updated %d path\n"
msgid_plural "updated %d paths\n"
msgstr[0] "%d файл обновен\n"
msgstr[1] "%d файла обновени\n"
-#, c-format, perl-format
+#, c-format
msgid "note: %s is untracked now.\n"
msgstr "БЕЛЕЖКÐ: „%s“ вече не Ñе Ñледи.\n"
@@ -267,7 +274,7 @@ msgstr "ОтмÑна"
msgid "Could not parse HEAD^{tree}"
msgstr "УказателÑÑ‚ „HEAD^{tree}“ не може да бъде анализиран"
-#, c-format, perl-format
+#, c-format
msgid "reverted %d path\n"
msgid_plural "reverted %d paths\n"
msgstr[0] "%d файл Ñ Ð¾Ñ‚Ð¼ÐµÐ½ÐµÐ½Ð¸ промѐни\n"
@@ -280,7 +287,7 @@ msgstr "ÐÑма неÑледени файлове.\n"
msgid "Add untracked"
msgstr "ДобавÑне на неÑледени"
-#, c-format, perl-format
+#, c-format
msgid "added %d path\n"
msgid_plural "added %d paths\n"
msgstr[0] "%d файл добавен\n"
@@ -374,19 +381,19 @@ msgstr "индекÑÑŠÑ‚ не може да бъде обновен"
msgid "Bye.\n"
msgstr "Изход.\n"
-#, c-format, perl-format
+#, c-format
msgid "Stage mode change [y,n,q,a,d%s,?]? "
-msgstr "ДобавÑне на промÑната на правата за доÑтъп [y,n,q,a,d%s,?]? "
+msgstr "ДобавÑне на промÑната на права̀та за доÑтъп [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage deletion [y,n,q,a,d%s,?]? "
msgstr "ДобавÑне на изтриването [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage addition [y,n,q,a,d%s,?]? "
msgstr "ДобавÑне на добавÑнето [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage this hunk [y,n,q,a,d%s,?]? "
msgstr "ДобавÑне на това парче [y,n,q,a,d%s,?]? "
@@ -410,19 +417,19 @@ msgstr ""
"a — добавÑне на това и вÑички Ñледващи парчета от файла в индекÑа\n"
"d — без добавÑне на това и вÑички Ñледващи парчета от файла в индекÑа\n"
-#, c-format, perl-format
+#, c-format
msgid "Stash mode change [y,n,q,a,d%s,?]? "
-msgstr "Скатаване на промÑната на правата за доÑтъп [y,n,q,a,d%s,?]? "
+msgstr "Скатаване на промÑната на права̀та за доÑтъп [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash deletion [y,n,q,a,d%s,?]? "
msgstr "Скатаване на изтриването [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash addition [y,n,q,a,d%s,?]? "
msgstr "Скатаване на добавÑнето [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash this hunk [y,n,q,a,d%s,?]? "
msgstr "Скатаване на това парче [y,n,q,a,d%s,?]? "
@@ -446,19 +453,19 @@ msgstr ""
"a — Ñкатаване на това и вÑички Ñледващи парчета от файла\n"
"d — без Ñкатаване на това и вÑички Ñледващи парчета от файла\n"
-#, c-format, perl-format
+#, c-format
msgid "Unstage mode change [y,n,q,a,d%s,?]? "
-msgstr "Изваждане на промÑната на правата за доÑтъп [y,n,q,a,d%s,?]? "
+msgstr "Изваждане на промÑната на права̀та за доÑтъп [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage deletion [y,n,q,a,d%s,?]? "
msgstr "Изваждане на изтриването [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage addition [y,n,q,a,d%s,?]? "
msgstr "Изваждане на добавÑнето [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage this hunk [y,n,q,a,d%s,?]? "
msgstr "Изваждане на това парче [y,n,q,a,d%s,?]? "
@@ -482,20 +489,20 @@ msgstr ""
"a — изваждане на това и вÑички Ñледващи парчета от файла от индекÑа\n"
"d — без изваждане на това и вÑички Ñледващи парчета от файла от индекÑа\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to index [y,n,q,a,d%s,?]? "
msgstr ""
-"Прилагане на промÑната на правата за доÑтъп към индекÑа [y,n,q,a,d%s,?]? "
+"Прилагане на промÑната на права̀та за доÑтъп към индекÑа [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to index [y,n,q,a,d%s,?]? "
msgstr "Прилагане на изтриването към индекÑа [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to index [y,n,q,a,d%s,?]? "
msgstr "Прилагане на добавÑнето към индекÑа [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to index [y,n,q,a,d%s,?]? "
msgstr "Прилагане на това парче към индекÑа [y,n,q,a,d%s,?]? "
@@ -519,21 +526,21 @@ msgstr ""
"a — прилагане на това и вÑички Ñледващи парчета от файла към индекÑа\n"
"d — без прилагане на това и вÑички Ñледващи парчета от файла към индекÑа\n"
-#, c-format, perl-format
+#, c-format
msgid "Discard mode change from worktree [y,n,q,a,d%s,?]? "
msgstr ""
-"Премахване на промÑната в правата за доÑтъп от работното дърво [y,n,q,a,d"
-"%s,?]? "
+"Премахване на промÑната в права̀та за доÑтъп от работното дърво [y,n,q,a,"
+"d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard deletion from worktree [y,n,q,a,d%s,?]? "
msgstr "Премахване на изтриването от работното дърво [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard addition from worktree [y,n,q,a,d%s,?]? "
msgstr "Премахване на добавÑнето от работното дърво [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard this hunk from worktree [y,n,q,a,d%s,?]? "
msgstr "Премахване на парчето от работното дърво [y,n,q,a,d%s,?]? "
@@ -560,23 +567,23 @@ msgstr ""
"d — без премахване на това и вÑички Ñледващи парчета от файла от работното "
"дърво\n"
-#, c-format, perl-format
+#, c-format
msgid "Discard mode change from index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
-"Премахване на промÑната в правата за доÑтъп от индекÑа и работното дърво [y,"
+"Премахване на промÑната в права̀та за доÑтъп от индекÑа и работното дърво [y,"
"n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard deletion from index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Премахване на изтриването от индекÑа и работното дърво [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard addition from index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Премахване на добавÑнето от индекÑа и работното дърво [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard this hunk from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Премахване на парчето от индекÑа и работното дърво [y,n,q,a,d%s,?]? "
@@ -596,22 +603,22 @@ msgstr ""
"d — без премахване на това и вÑички Ñледващи парчета от файла от индекÑа и "
"работното дърво\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
-"Прилагане на промÑната в правата за доÑтъп от индекÑа и работното дърво [y,n,"
+"Прилагане на промÑната в права̀та за доÑтъп от индекÑа и работното дърво [y,n,"
"q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Прилагане на изтриването от индекÑа и работното дърво [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Прилагане на добавÑнето от индекÑа и работното дърво [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Прилагане на парчето от индекÑа и работното дърво [y,n,q,a,d%s,?]? "
@@ -631,21 +638,21 @@ msgstr ""
"d — без прилагане на това и вÑички Ñледващи парчета от файла от индекÑа и "
"работното дърво\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to worktree [y,n,q,a,d%s,?]? "
msgstr ""
-"Прилагане на промÑната в правата за доÑтъп към работното дърво [y,n,q,a,d"
-"%s,?]? "
+"Прилагане на промÑната в права̀та за доÑтъп към работното дърво [y,n,q,a,"
+"d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to worktree [y,n,q,a,d%s,?]? "
msgstr "Прилагане на изтриването към работното дърво [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to worktree [y,n,q,a,d%s,?]? "
msgstr "Прилагане на добавÑнето към работното дърво [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to worktree [y,n,q,a,d%s,?]? "
msgstr "Прилагане на парчето към работното дърво [y,n,q,a,d%s,?]? "
@@ -722,8 +729,6 @@ msgstr ""
"За да пропуÑнете редовете, започващи Ñ â€ž%c“: изтрийте ги.\n"
"Редовете, които започват Ñ â€ž%c“ ще бъдат пропуÑнати.\n"
-#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
-#. TRANSLATORS: 'it' refers to the patch mentioned in the previous messages.
msgid ""
"If it does not apply cleanly, you will be given an opportunity to\n"
"edit again. If all lines of the hunk are removed, then the edit is\n"
@@ -739,20 +744,12 @@ msgstr "заглавната чаÑÑ‚ парчето не може да Ñе аÐ
msgid "'git apply --cached' failed"
msgstr "неуÑпешно изпълнение на „git apply --cached“"
-#. #-#-#-#-# add-patch.c.po #-#-#-#-#
#. TRANSLATORS: do not translate [y/n]
#. The program will only accept that input at this point.
#. Consider translating (saying "no" discards!) as
#. (saying "n" for "no" discards!) if the translation
#. of the word "no" does not start with n.
#.
-#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
-#. TRANSLATORS: do not translate [y/n]
-#. The program will only accept that input
-#. at this point.
-#. Consider translating (saying "no" discards!) as
-#. (saying "n" for "no" discards!) if the translation
-#. of the word "no" does not start with n.
msgid ""
"Your edited hunk does not apply. Edit again (saying \"no\" discards!) [y/n]? "
msgstr ""
@@ -985,6 +982,9 @@ msgstr "командниÑÑ‚ ред завършва Ñ â€ž/“"
msgid "unclosed quote"
msgstr "кавичка без еш"
+msgid "too many arguments"
+msgstr "прекалено много аргументи"
+
#, c-format
msgid "unrecognized whitespace option '%s'"
msgstr "непозната Ð¾Ð¿Ñ†Ð¸Ñ Ð·Ð° знаците за интервали „%s“"
@@ -1258,12 +1258,12 @@ msgstr "„%s“: вече ÑъщеÑтвува в работното дърво
#, c-format
msgid "new mode (%o) of %s does not match old mode (%o)"
-msgstr "новите права за доÑтъп (%o) на „%s“ не Ñъвпадат ÑÑŠÑ Ñтарите (%o)"
+msgstr "новите права̀ за доÑтъп (%o) на „%s“ не Ñъвпадат ÑÑŠÑ Ñтарите (%o)"
#, c-format
msgid "new mode (%o) of %s does not match old mode (%o) of %s"
msgstr ""
-"новите права за доÑтъп (%o) на „%s“ не Ñъвпадат ÑÑŠÑ Ñтарите (%o) на „%s“"
+"новите права̀ за доÑтъп (%o) на „%s“ не Ñъвпадат ÑÑŠÑ Ñтарите (%o) на „%s“"
#, c-format
msgid "affected file '%s' is beyond a symbolic link"
@@ -1501,7 +1501,7 @@ msgstr "обектът-BLOB „%s“ не може да бъде обработÐ
#, c-format
msgid "unsupported file mode: 0%o (SHA1: %s)"
-msgstr "неподдържани права за доÑтъп до файл: 0%o (SHA1: %s)"
+msgstr "неподдържани права̀ за доÑтъп до файл: 0%o (SHA1: %s)"
#, c-format
msgid "deflate error (%d)"
@@ -1615,6 +1615,12 @@ msgstr "изчитане на „.gitattributes“ в работната дирÐ
msgid "report archived files on stderr"
msgstr "извеждане на архивираните файлове на Ñтандартната грешка"
+msgid "time"
+msgstr "ВРЕМЕ"
+
+msgid "set modification time of archive entries"
+msgstr "задаване на ВРЕМЕ на промÑна на елементите в архива"
+
msgid "set compression level"
msgstr "задаване на нивото на компреÑиране"
@@ -1655,6 +1661,13 @@ msgstr "Ðргументът не Ñе поддържа за форма̀та â€
msgid "%.*s is not a valid attribute name"
msgstr "„%.*s“ е неправилно име за атрибут"
+msgid "unable to add additional attribute"
+msgstr "не може да Ñе добави нов атрибут"
+
+#, c-format
+msgid "ignoring overly long attributes line %d"
+msgstr "преÑкачане на прекалено дълъг ред за атрибути: %d"
+
#, c-format
msgid "%s not allowed: %s:%d"
msgstr "%s: командата не е позволена: „%s:%d“"
@@ -1667,6 +1680,18 @@ msgstr ""
"Ðко ви Ñ‚Ñ€Ñбва начална удивителна, ползвайте „\\!“."
#, c-format
+msgid "cannot fstat gitattributes file '%s'"
+msgstr "неуÑпешно изпълнение на „fstat“ върху файла за атрибути на git „%s“"
+
+#, c-format
+msgid "ignoring overly large gitattributes file '%s'"
+msgstr "преÑкачане на прекалено Ð³Ð¾Ð»ÐµÐ¼Ð¸Ñ Ñ„Ð°Ð¹Ð» за атрибути на git: „%s“"
+
+#, c-format
+msgid "ignoring overly large gitattributes blob '%s'"
+msgstr "преÑкачане на прекалено Ð³Ð¾Ð»ÐµÐ¼Ð¸Ñ Ð¾Ð±ÐµÐºÑ‚-BLOB за атрибути на git: „%s“"
+
+#, c-format
msgid "Badly quoted content in file '%s': %s"
msgstr "Ðеправилно цитирано Ñъдържание във файла „%s“: %s"
@@ -1945,12 +1970,12 @@ msgstr "подмодул „%s“: подмодулът липÑва"
#, c-format
msgid ""
-"You may try updating the submodules using 'git checkout %s && git submodule "
-"update --init'"
+"You may try updating the submodules using 'git checkout --no-recurse-"
+"submodules %s && git submodule update --init'"
msgstr ""
"Може да обновите подмодулите Ñ ÐºÐ¾Ð¼Ð°Ð½Ð´Ð°Ñ‚Ð°:\n"
"\n"
-" git checkout %s && git submodule update --init"
+" git checkout --no-recurse-submodules %s && git submodule update --init"
#, c-format
msgid "submodule '%s': cannot create branch '%s'"
@@ -1969,7 +1994,7 @@ msgstr "git add [ОПЦИЯ…] [--] ПЪТ…"
#, c-format
msgid "cannot chmod %cx '%s'"
-msgstr "правата на „%2$s“ не може да Ñе зададат да Ñа %1$cx"
+msgstr "права̀та на „%2$s“ не може да Ñе зададат да Ñа %1$cx"
#, c-format
msgid "unexpected diff status %c"
@@ -1985,6 +2010,13 @@ msgstr "изтриване на „%s“\n"
msgid "Unstaged changes after refreshing the index:"
msgstr "Промѐни, които и Ñлед обновÑването на индекÑа не Ñа добавени към него:"
+msgid ""
+"the add.interactive.useBuiltin setting has been removed!\n"
+"See its entry in 'git help config' for details."
+msgstr ""
+"ÐаÑтройката „add.interactive.useBuiltin“ е премахната!\n"
+"За подробноÑти Ñ Ð¿Ð¾Ñ‚ÑŠÑ€Ñете в изхода от „git help config“."
+
msgid "Could not read the index"
msgstr "ИндекÑÑŠÑ‚ не може да бъде прочетен"
@@ -2385,7 +2417,7 @@ msgid "options '%s=%s' and '%s=%s' cannot be used together"
msgstr "опциите „%s=%s“ и „%s=%s“ Ñа неÑъвмеÑтими"
msgid "git am [<options>] [(<mbox> | <Maildir>)...]"
-msgstr "git am [ОПЦИЯ…] [(ФÐЙЛ_С_ПОЩÐ|ДИРЕКТОРИЯ_С_ПОЩÐ)…]"
+msgstr "git am [ОПЦИЯ…] [(ФÐЙЛ_С_ПОЩР| ДИРЕКТОРИЯ_С_ПОЩÐ)…]"
msgid "git am [<options>] (--continue | --skip | --abort)"
msgstr "git am [ОПЦИЯ…] (--continue | --skip | --abort)"
@@ -2393,6 +2425,11 @@ msgstr "git am [ОПЦИЯ…] (--continue | --skip | --abort)"
msgid "run interactively"
msgstr "интерактивна работа"
+msgid "bypass pre-applypatch and applypatch-msg hooks"
+msgstr ""
+"без изпълнение на куките преди прилагане на кръпка и Ñъобщение преди "
+"прилагане на кръпка"
+
msgid "historical option -- no-op"
msgstr "изоÑтавена опциÑ, ÑъщеÑтвува по иÑторичеÑки причини, нищо не прави"
@@ -2542,31 +2579,28 @@ msgstr "git archive: протоколна грешка"
msgid "git archive: expected a flush"
msgstr "git archive: очакваше Ñе изчиÑтване на буферите чрез „flush“"
-msgid "git bisect--helper --bisect-reset [<commit>]"
-msgstr "git bisect--helper --bisect-reset [ПОДÐÐ’ÐÐЕ]"
-
msgid ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}"
-"=<term>] [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] "
-"[<paths>...]"
+"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>] [--no-"
+"checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]"
msgstr ""
-"git bisect--helper --bisect-start [--term-{new,bad}=ЛОШО --term-{old,good}"
-"=ДОБРО] [--no-checkout] [--first-parent] [ЛОШО [ДОБРО…]] [--] [ПЪТ…]"
+"git bisect start [--term-{new,bad}=УПРÐВЛЯВÐЩÐ_ДУМР--term-{old,good}"
+"=УПРÐВЛЯВÐЩÐ_ДУМÐ] [--no-checkout] [--first-parent] [ЛОШО [ДОБРО…]] [--] "
+"[ПЪТ…]"
-msgid "git bisect--helper --bisect-state (bad|new) [<rev>]"
-msgstr "git bisect--helper --bisect-state (ЛОШО) [ВЕРСИЯ]"
+msgid "git bisect (good|bad) [<rev>...]"
+msgstr "git bisect (good|bad) [ВЕРСИЯ…]"
-msgid "git bisect--helper --bisect-state (good|old) [<rev>...]"
-msgstr "git bisect--helper --bisect-state (ДОБРО) [ВЕРСИЯ…]"
+msgid "git bisect skip [(<rev>|<range>)...]"
+msgstr "git bisect skip [(ВЕРСИЯ|ДИÐПÐЗОÐ)…]"
-msgid "git bisect--helper --bisect-replay <filename>"
-msgstr "git bisect--helper --bisect-replay ИМЕ_ÐÐ_ФÐЙЛ"
+msgid "git bisect reset [<commit>]"
+msgstr "git bisect reset [ПОДÐÐ’ÐÐЕ]"
-msgid "git bisect--helper --bisect-skip [(<rev>|<range>)...]"
-msgstr "git bisect--helper --bisect-skip [(ВЕРСИЯ|ДИÐПÐЗОÐ)…]"
+msgid "git bisect replay <logfile>"
+msgstr "git bisect replay ИМЕ_ÐÐ_ФÐЙЛ"
-msgid "git bisect--helper --bisect-run <cmd>..."
-msgstr "git bisect--helper --bisect-run КОМÐÐДÐ…"
+msgid "git bisect run <cmd>..."
+msgstr "git bisect run КОМÐÐДÐ…"
#, c-format
msgid "cannot open file '%s' in mode '%s'"
@@ -2715,11 +2749,6 @@ msgstr ""
"ÐеуÑпешно преминаване към „%s“. Изпълнете командата „git bisect start "
"СЪЩЕСТВУВÐЩ_КЛОГ."
-msgid "won't bisect on cg-seek'ed tree"
-msgstr ""
-"не може да Ñе Ñ‚ÑŠÑ€Ñи двоично, когато е изпълнена командата „cg-seek“ от "
-"„cogito“"
-
msgid "bad HEAD - strange symbolic ref"
msgstr "Ðеправилен указател „HEAD“ — необичаен Ñимволен указател"
@@ -2775,7 +2804,7 @@ msgid "bisect run failed: no command provided."
msgstr "неуÑпешно двоично Ñ‚ÑŠÑ€Ñене, не е зададена команда."
#, c-format
-msgid "unable to verify '%s' on good revision"
+msgid "unable to verify %s on good revision"
msgstr "„%s“ не може да провери Ñ Ð´Ð¾Ð±Ñ€Ð° верÑиÑ"
#, c-format
@@ -2783,7 +2812,7 @@ msgid "bogus exit code %d for good revision"
msgstr "неправилен изходен код %d за добро подаване"
#, c-format
-msgid "bisect run failed: exit code %d from '%s' is < 0 or >= 128"
+msgid "bisect run failed: exit code %d from %s is < 0 or >= 128"
msgstr ""
"неуÑпешно двоично Ñ‚ÑŠÑ€Ñене: изходниÑÑ‚ код от командата „%2$s“ е %1$d — това е "
"извън интервала [0, 128)"
@@ -2795,76 +2824,48 @@ msgstr "файлът „%s“ не може да бъде отворен за з
msgid "bisect run cannot continue any more"
msgstr "двоичното Ñ‚ÑŠÑ€Ñене не може да продължи"
-#, c-format
msgid "bisect run success"
msgstr "уÑпешно двоично Ñ‚ÑŠÑ€Ñене"
-#, c-format
msgid "bisect found first bad commit"
msgstr "двоичното Ñ‚ÑŠÑ€Ñене откри първото лошо подаване"
#, c-format
-msgid ""
-"bisect run failed: 'git bisect--helper --bisect-state %s' exited with error "
-"code %d"
-msgstr ""
-"неуÑпешно двоично Ñ‚ÑŠÑ€Ñене: „git bisect--helper --bisect-state %s“ завърши Ñ "
-"код за грешка: %d"
-
-msgid "reset the bisection state"
-msgstr "изчиÑтване на ÑÑŠÑтоÑнието на двоичното Ñ‚ÑŠÑ€Ñене"
-
-msgid "check whether bad or good terms exist"
-msgstr "проверка дали ÑъщеÑтвуват одобрÑващи/отхвърлÑщи управлÑващи думи"
-
-msgid "print out the bisect terms"
-msgstr "извеждане на управлÑващите думи"
+msgid "bisect run failed: 'git bisect %s' exited with error code %d"
+msgstr "неуÑпешно двоично Ñ‚ÑŠÑ€Ñене: „git bisect %s“ завърши Ñ ÐºÐ¾Ð´ за грешка: %d"
-msgid "start the bisect session"
-msgstr "начало на двоично Ñ‚ÑŠÑ€Ñене"
-
-msgid "find the next bisection commit"
-msgstr "откриване на Ñледващото подаване при двоично Ñ‚ÑŠÑ€Ñене"
-
-msgid "mark the state of ref (or refs)"
-msgstr "задаване на ÑÑŠÑтоÑнието на указателÑ/ите"
-
-msgid "list the bisection steps so far"
-msgstr "извеждане на Ñтъпките на двоичното Ñ‚ÑŠÑ€Ñене доÑега"
-
-msgid "replay the bisection process from the given file"
-msgstr "наново изпълнение на двоичното Ñ‚ÑŠÑ€Ñене чрез Ð´Ð°Ð´ÐµÐ½Ð¸Ñ Ñ„Ð°Ð¹Ð»"
-
-msgid "skip some commits for checkout"
-msgstr "преÑкачане на нÑкои Ð¿Ð¾Ð´Ð°Ð²Ð°Ð½Ð¸Ñ Ð¿Ñ€Ð¸ изтеглÑне"
-
-msgid "visualize the bisection"
-msgstr "визуализиране на двоичното Ñ‚ÑŠÑ€Ñене"
-
-msgid "use <cmd>... to automatically bisect"
-msgstr "за автоматично двоично Ñ‚ÑŠÑ€Ñене да Ñе ползва тази КОМÐÐДÐ…"
+#, c-format
+msgid "'%s' requires either no argument or a commit"
+msgstr "„%s“ изиÑква или 0 аргументи, или едно подаване"
-msgid "no log for BISECT_WRITE"
-msgstr "липÑва Ð·Ð°Ð¿Ð¸Ñ Ð·Ð° „BISECT_WRITE“"
+#, c-format
+msgid "'%s' requires 0 or 1 argument"
+msgstr "„%s“ изиÑква 0 или 1 аргумент"
-msgid "--bisect-reset requires either no argument or a commit"
-msgstr "опциÑта „--bisect-reset“ изиÑква или 0 аргументи, или 1 — подаване"
+#, c-format
+msgid "'%s' requires 0 arguments"
+msgstr "„%s“ изиÑква 0 аргументи"
-msgid "--bisect-terms requires 0 or 1 argument"
-msgstr "опциÑта „--bisect-terms“ изиÑква 0 или 1 аргумента"
+msgid "no logfile given"
+msgstr "не е зададен журнален файл"
-msgid "--bisect-next requires 0 arguments"
-msgstr "опциÑта „--bisect-next“ не приема аргументи"
+#, c-format
+msgid "'%s' failed: no command provided."
+msgstr "неуÑпешно изпълнение на „%s“: не е зададена команда."
-msgid "--bisect-log requires 0 arguments"
-msgstr "опциÑта „--bisect-log“ не приема аргументи"
+msgid "need a command"
+msgstr "необходима е команда"
-msgid "no logfile given"
-msgstr "не е зададен журнален файл"
+#, c-format
+msgid "unknown command: '%s'"
+msgstr "непозната команда: „%s“"
msgid "git blame [<options>] [<rev-opts>] [<rev>] [--] <file>"
msgstr "git blame [ОПЦИЯ…] [ОПЦИЯ_ЗÐ_ВЕРСИЯТÐ…] [ВЕРСИЯ] [--] ФÐЙЛ"
+msgid "git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>"
+msgstr "git annotate [ОПЦИЯ…] [ОПЦИЯ_ЗÐ_ВЕРСИЯТÐ…] [ВЕРСИЯ] [--] ФÐЙЛ"
+
msgid "<rev-opts> are documented in git-rev-list(1)"
msgstr "ОПЦИИте_ЗÐ_ВЕРСИЯТРÑа документирани в ръководÑтвото git-rev-list(1)"
@@ -3071,9 +3072,6 @@ msgstr "ÐеуÑпешно обновÑване на конфигурационÐ
msgid "cannot use -a with -d"
msgstr "опциите „-a“ и „-d“ Ñа неÑъвмеÑтими"
-msgid "Couldn't look up commit object for HEAD"
-msgstr "Обектът-подаване, Ñочен от ÑƒÐºÐ°Ð·Ð°Ñ‚ÐµÐ»Ñ â€žHEAD“, не може да бъде открит"
-
#, c-format
msgid "Cannot delete branch '%s' checked out at '%s'"
msgstr "Ðе може да изтриете клона „%s“, който е изтеглен в Ð¿ÑŠÑ‚Ñ â€ž%s“"
@@ -3112,17 +3110,18 @@ msgstr "Клонът „%s“ Ñе пребазира върху „%s“"
msgid "Branch %s is being bisected at %s"
msgstr "ТърÑи Ñе двоично в клона „%s“ при „%s“"
-msgid "cannot copy the current branch while not on any."
-msgstr "не може да копирате Ñ‚ÐµÐºÑƒÑ‰Ð¸Ñ ÐºÐ»Ð¾Ð½, защото Ñте извън който и да е клон"
-
-msgid "cannot rename the current branch while not on any."
-msgstr ""
-"не може да преименувате Ñ‚ÐµÐºÑƒÑ‰Ð¸Ñ ÐºÐ»Ð¾Ð½, защото Ñте извън който и да е клон"
-
#, c-format
msgid "Invalid branch name: '%s'"
msgstr "Ðеправилно име на клон: „%s“"
+#, c-format
+msgid "No commit on branch '%s' yet."
+msgstr "Ð’ клона „%s“ вÑе още нÑма подаваниÑ."
+
+#, c-format
+msgid "No branch named '%s'."
+msgstr "ЛипÑва клон на име „%s“."
+
msgid "Branch rename failed"
msgstr "ÐеуÑпешно преименуване на клон"
@@ -3285,13 +3284,12 @@ msgstr "Ðе може да зададете опиÑание на неÑвърз
msgid "cannot edit description of more than one branch"
msgstr "Ðе може да редактирате опиÑанието на повече от един клон едновременно"
-#, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "Ð’ клона „%s“ вÑе още нÑма подаваниÑ."
+msgid "cannot copy the current branch while not on any."
+msgstr "не може да копирате Ñ‚ÐµÐºÑƒÑ‰Ð¸Ñ ÐºÐ»Ð¾Ð½, защото Ñте извън който и да е клон"
-#, c-format
-msgid "No branch named '%s'."
-msgstr "ЛипÑва клон на име „%s“."
+msgid "cannot rename the current branch while not on any."
+msgstr ""
+"не може да преименувате Ñ‚ÐµÐºÑƒÑ‰Ð¸Ñ ÐºÐ»Ð¾Ð½, защото Ñте извън който и да е клон"
msgid "too many branches for a copy operation"
msgstr "прекалено много клони за копиране"
@@ -3358,13 +3356,12 @@ msgstr "библиотека на C: "
msgid "not run from a git repository - no hooks to show\n"
msgstr "командата е Ñтартирана извън хранилище на Git, затова нÑма куки\n"
-# FIXME
msgid ""
-"git bugreport [-o|--output-directory <file>] [-s|--suffix <format>] [--"
-"diagnose[=<mode>]"
+"git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--diagnose[=<mode>]]"
msgstr ""
-"git bugreport [-o|--output-directory ФÐЙЛ] [-s|--suffix ФОРМÐТ] [--"
-"diagnose[=РЕЖИМ]]"
+"git bugreport [(-o | --output-directory) ПЪТ] [(-s | --suffix) ФОРМÐТ]\n"
+" [--diagnose[=РЕЖИМ]]"
msgid ""
"Thank you for filling out a Git bug report!\n"
@@ -3438,17 +3435,26 @@ msgstr "в „%s“ не може да Ñе пише"
msgid "Created new report at '%s'.\n"
msgstr "ÐовиÑÑ‚ доклад е Ñъздаден в „%s“.\n"
-msgid "git bundle create [<options>] <file> <git-rev-list args>"
-msgstr "git bundle create [ОПЦИЯ…] ФÐЙЛ ÐРГУМЕÐТ_ЗÐ_git_rev-list…"
+msgid ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<version>] <file> <git-rev-list-args>"
+msgstr ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=ВЕРСИЯ] ФÐЙЛ ОПЦИЯ_ЗÐ_git-rev-list…"
-msgid "git bundle verify [<options>] <file>"
-msgstr "git bundle verify [ОПЦИЯ…] ФÐЙЛ…"
+msgid "git bundle verify [-q | --quiet] <file>"
+msgstr "git bundle verify [-q | --quiet] ФÐЙЛ"
msgid "git bundle list-heads <file> [<refname>...]"
msgstr "git bundle list-heads ФÐЙЛ [ИМЕ_ÐÐ_УКÐЗÐТЕЛ…]"
-msgid "git bundle unbundle <file> [<refname>...]"
-msgstr "git bundle unbundle ФÐЙЛ [ИМЕ_ÐÐ_УКÐЗÐТЕЛ…]"
+msgid "git bundle unbundle [--progress] <file> [<refname>...]"
+msgstr "git bundle unbundle [--progress] ФÐЙЛ [ИМЕ_ÐÐ_УКÐЗÐТЕЛ…]"
+
+msgid "need a <file> argument"
+msgstr "необходим е аргумент ФÐЙЛ"
msgid "do not show progress meter"
msgstr "без извеждане на напредъка"
@@ -3504,10 +3510,6 @@ msgstr "командата „%s“ изиÑква аргумент"
msgid "%s takes no arguments"
msgstr "командата „%s“ не приема аргументи"
-#, c-format
-msgid "unknown command: '%s'"
-msgstr "непозната команда: „%s“"
-
msgid "only one batch option may be specified"
msgstr "може да укажете Ñамо една пакетна опциÑ"
@@ -3524,12 +3526,12 @@ msgid ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgstr ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgid ""
"git cat-file (--textconv | --filters)\n"
@@ -3646,18 +3648,22 @@ msgstr "опциÑта „%s“ изиÑква верÑиÑ"
msgid "<object> required with '-%c'"
msgstr "опциÑта „-%c“ изиÑква обект"
-msgid "too many arguments"
-msgstr "прекалено много аргументи"
-
#, c-format
msgid "only two arguments allowed in <type> <object> mode, not %d"
msgstr "в режим Ñ Ð¿Ð¾Ñочен ВИД ОБЕКТ Ñе изиÑкват точно два аргумента, а не %d"
-msgid "git check-attr [-a | --all | <attr>...] [--] <pathname>..."
-msgstr "git check-attr [-a | --all | ÐТРИБУТ…] [--] ПЪТ…"
+msgid ""
+"git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] "
+"<pathname>..."
+msgstr ""
+"git check-attr [--source УКÐЗÐТЕЛ_КЪМ_ДЪРВО] [-a | --all | ÐТРИБУТ…] [--] "
+"ПЪТ…"
-msgid "git check-attr --stdin [-z] [-a | --all | <attr>...]"
-msgstr "git check-attr --stdin [-z] [-a | --all | ÐТРИБУТ…]"
+msgid ""
+"git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]"
+msgstr ""
+"git check-attr --stdin [-z] [--source УКÐЗÐТЕЛ_КЪМ_ДЪРВО] [-a | --all | "
+"ÐТРИБУТ…]"
msgid "report all attributes set on file"
msgstr "извеждане на вÑички атрибути, зададени върху файл"
@@ -3671,6 +3677,12 @@ msgstr "изчитане на имената на файловете от Ñта
msgid "terminate input and output records by a NUL character"
msgstr "разделÑне на входните и изходните запиÑи Ñ Ð½ÑƒÐ»ÐµÐ²Ð¸Ñ Ð·Ð½Ð°Ðº „NUL“"
+msgid "<tree-ish>"
+msgstr "УКÐЗÐТЕЛ_КЪМ_ДЪРВО"
+
+msgid "which tree-ish to check attributes at"
+msgstr "към кой УКÐЗÐТЕЛ_КЪМ_ДЪРВО да Ñе премине"
+
msgid "suppress progress reporting"
msgstr "без показване на напредъка"
@@ -4193,8 +4205,9 @@ msgid "use overlay mode"
msgstr "използване на припокриващ режим"
msgid ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>..."
-msgstr "git clean [-d] [-f] [-i] [-n] [-q] [-e ШÐБЛОÐ] [-x | -X] [--] ПЪТ…"
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] "
+"[<pathspec>...]"
+msgstr "git clean [-d] [-f] [-i] [-n] [-q] [-e ШÐБЛОÐ] [-x | -X] [--] [ПЪТ…]"
#, c-format
msgid "Removing %s\n"
@@ -4258,7 +4271,7 @@ msgstr ""
"* — избиране на вÑички обекти\n"
" — (празно) завършване на избирането\n"
-#, c-format, perl-format
+#, c-format
msgid "Huh (%s)?\n"
msgstr "Ðеправилен избор (%s).\n"
@@ -4409,9 +4422,6 @@ msgstr "ДЪЛБОЧИÐÐ"
msgid "create a shallow clone of that depth"
msgstr "плитко клониране до тази ДЪЛБОЧИÐÐ"
-msgid "time"
-msgstr "ВРЕМЕ"
-
msgid "create a shallow clone since a specific time"
msgstr "плитко клониране до момент във времето"
@@ -4493,6 +4503,11 @@ msgid "failed to start iterator over '%s'"
msgstr "неуÑпешно итериране по „%s“"
#, c-format
+msgid "symlink '%s' exists, refusing to clone with --local"
+msgstr ""
+"Ñимволната връзка „%s“ ÑъщеÑтвува, не може да Ñе клонира Ñ Ð¾Ð¿Ñ†Ð¸Ñта „--local“"
+
+#, c-format
msgid "failed to unlink '%s'"
msgstr "неуÑпешно изтриване на „%s“"
@@ -4563,10 +4578,6 @@ msgstr "Прекалено много аргументи."
msgid "You must specify a repository to clone."
msgstr "ТрÑбва да укажете кое хранилище иÑкате да клонирате."
-#, c-format
-msgid "options '%s' and '%s %s' cannot be used together"
-msgstr "опциите „%s“ и „%s %s“ Ñа неÑъвмеÑтими"
-
msgid ""
"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
"exclude"
@@ -4661,6 +4672,9 @@ msgstr ""
msgid "failed to fetch objects from bundle URI '%s'"
msgstr "неуÑпешно доÑтавÑне на обекти от пратка на Ð°Ð´Ñ€ÐµÑ â€ž%s“"
+msgid "failed to fetch advertised bundles"
+msgstr "неуÑпешно доÑтавÑне на обÑвените за налични пратки"
+
msgid "remote transport reported error"
msgstr "отдалечениÑÑ‚ транÑпорт върна грешка"
@@ -4696,19 +4710,25 @@ msgid "--command must be the first argument"
msgstr "опциÑта „--command“ Ñ‚Ñ€Ñбва да е първиÑÑ‚ аргумент"
msgid ""
-"git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"
+"git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]"
msgstr ""
-"git commit-graph verify [--object-dir ДИР_ОБЕКТИ] [--shallow] [--"
+"git commit-graph verify [--object-dir ДИРЕКТОРИЯ] [--shallow] [--"
"[no-]progress]"
msgid ""
-"git commit-graph write [--object-dir <objdir>] [--append] [--"
-"split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] <split options>"
+"git commit-graph write [--object-dir <dir>] [--append]\n"
+" [--split[=<strategy>]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <split options>"
msgstr ""
-"git commit-graph write [--object-dir ДИР_ОБЕКТИ] [--append] [--"
-"split[=СТРÐТЕГИЯ]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] ОПЦИИ_ЗÐ_РÐЗДЕЛЯÐЕ"
+"git commit-graph write [--object-dir ДИРЕКТОРИЯ] [--append]\n"
+" [--split[=СТРÐТЕГИЯ]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters БРОЙ] [--"
+"[no-]progress]\n"
+" ОПЦИИ_ЗÐ_РÐЗДЕЛЯÐЕ"
msgid "dir"
msgstr "директориÑ"
@@ -4781,12 +4801,16 @@ msgstr ""
msgid "Collecting commits from input"
msgstr "Получаване на подаваниÑта от входа"
+msgid "git commit-tree <tree> [(-p <parent>)...]"
+msgstr "git commit-tree ДЪРВО [(-p РОДИТЕЛ)…]"
+
msgid ""
-"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...] [(-F "
-"<file>)...] <tree>"
+"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n"
+" [(-F <file>)...] <tree>"
msgstr ""
-"git commit-tree [(-p РОДИТЕЛ)…] [-S[ИДЕÐТИФИКÐТОР]] [(-m СЪОБЩЕÐИЕ)…] [(-F "
-"ФÐЙЛ)…] ДЪРВО"
+"git commit-tree [(-p РОДИТЕЛ)…] [-S[ИДЕÐТИФИКÐТОР_ÐÐ_КЛЮЧ]] [(-m "
+"СЪОБЩЕÐИЕ)…]\n"
+" [(-F ФÐЙЛ)…] ДЪРВО"
#, c-format
msgid "duplicate parent %s ignored"
@@ -4828,11 +4852,30 @@ msgstr "Ñ‚Ñ€Ñбва да е точно едно дърво"
msgid "git commit-tree: failed to read"
msgstr "git commit-tree: не може да Ñе прочете"
-msgid "git commit [<options>] [--] <pathspec>..."
-msgstr "git commit [ОПЦИЯ…] [--] ПЪТ…"
+msgid ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|"
+"reword):]<commit>)]\n"
+" [-F <file> | -m <msg>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n"
+" [--date=<date>] [--cleanup=<mode>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u РЕЖИМ] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) ПОДÐÐ’ÐÐЕ | --fixup [(amend|"
+"reword):]ПОДÐÐ’ÐÐЕ)]\n"
+" [-F ФÐЙЛ | -m СЪОБЩЕÐИЕ] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=ÐВТОР]\n"
+" [--date=ДÐТÐ] [--cleanup=РЕЖИМ] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=ФÐЙЛ> [--pathspec-file-nul]]\n"
+" [(--trailer ЛЕКСЕМÐ[(=|:)СТОЙÐОСТ])…] [-"
+"S[ИДЕÐТИФИКÐТОР_ÐÐ_КЛЮЧ]]\n"
+" [--] [ПЪТ…]"
-msgid "git status [<options>] [--] <pathspec>..."
-msgstr "git status [ОПЦИЯ…] [--] ПЪТ…"
+msgid "git status [<options>] [--] [<pathspec>...]"
+msgstr "git status [ОПЦИЯ…] [--] [ПЪТ…]"
msgid ""
"You asked to amend the most recent commit, but doing so would make\n"
@@ -4908,7 +4951,7 @@ msgid "unable to update temporary index"
msgstr "временниÑÑ‚ Ð¸Ð½Ð´ÐµÐºÑ Ð½Ðµ може да бъде обновен"
msgid "Failed to update main cache tree"
-msgstr "Дървото на оÑÐ½Ð¾Ð²Ð½Ð¸Ñ ÐºÐµÑˆ не може да бъде обновено"
+msgstr "Кешът за обектите-дървета не може да бъде обновен"
msgid "unable to write new_index file"
msgstr "новиÑÑ‚ Ð¸Ð½Ð´ÐµÐºÑ (new_index) не може да бъде запиÑан"
@@ -5613,7 +5656,7 @@ msgid ""
"\n"
"\tchmod 0700 %s"
msgstr ""
-"Правата за доÑтъп до директориÑта за програмните гнезда Ñа прекалено "
+"Права̀та за доÑтъп до директориÑта за програмните гнезда Ñа прекалено "
"Ñвободни —\n"
"другите потребители може да получат доÑтъп до кешираните ви пароли. За да\n"
"коригирате това, изпълнете:\n"
@@ -5638,11 +5681,19 @@ msgstr ""
"ключалката на хранилището на идентификациите не бе получена в рамките на %d "
"ms"
-msgid "git describe [<options>] [<commit-ish>...]"
-msgstr "git describe [ОПЦИЯ…] [УКÐЗÐТЕЛ_КЪМ_ПОДÐÐ’ÐÐЕ…]"
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=БРОЙ] "
+"[УКÐЗÐТЕЛ_КЪМ_ПОДÐÐ’ÐÐЕ…]"
+
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=БРОЙ] --dirty[=ÐœÐРКЕР]"
-msgid "git describe [<options>] --dirty"
-msgstr "git describe [ОПЦИЯ…] --dirty"
+msgid "git describe <blob>"
+msgstr "git describe обект-BLOB"
msgid "head"
msgstr "оÑновно"
@@ -5766,11 +5817,11 @@ msgid "option '%s' and commit-ishes cannot be used together"
msgstr "опциите „%s“ и указателите към обекти Ñа неÑъвмеÑтими"
msgid ""
-"git diagnose [-o|--output-directory <path>] [-s|--suffix <format>] [--"
-"mode=<mode>]"
+"git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--mode=<mode>]"
msgstr ""
-"git diagnose [-o|--output-directory ФÐЙЛ] [-s|--suffix ФОРМÐТ] [--"
-"diagnose[=РЕЖИМ]]"
+"git diagnose [(-o | --output-directory) ПЪТ] [(-s | --suffix) ФОРМÐТ]\n"
+" [--diagnose[=РЕЖИМ]]"
msgid "specify a destination for the diagnostics archive"
msgstr "укажете меÑтоположение на архива Ñ Ð´Ð¸Ð°Ð³Ð½Ð¾Ñтичната информациÑ"
@@ -5788,6 +5839,9 @@ msgstr "опциÑта „--merge-base“ изиÑква точно две поÐ
msgid "'%s': not a regular file or symlink"
msgstr "„%s“: не е нито обикновен файл, нито Ñимволна връзка"
+msgid "no merge given, only parents."
+msgstr "липÑва Ñливане, зададени Ñа Ñамо родителÑки подаваниÑ."
+
#, c-format
msgid "invalid option: %s"
msgstr "неправилна опциÑ: %s"
@@ -5904,29 +5958,6 @@ msgstr "не е зададена програма за „--tool=ПРОГРÐÐœÐ
msgid "no <cmd> given for --extcmd=<cmd>"
msgstr "не е зададена команда за „--extcmd=КОМÐÐДГ"
-msgid "git env--helper --type=[bool|ulong] <options> <env-var>"
-msgstr "git env--helper --type=[bool|ulong] ОПЦИИ ПРОМЕÐЛИВИ"
-
-msgid "default for git_env_*(...) to fall back on"
-msgstr "Ñтандартна, резервна ÑтойноÑÑ‚ за „git_env_*(…)“"
-
-msgid "be quiet only use git_env_*() value as exit code"
-msgstr ""
-"без извеждане на Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ â€” ÑтойноÑтта на „git_env_*()“ да е изходен код"
-
-#, c-format
-msgid "option `--default' expects a boolean value with `--type=bool`, not `%s`"
-msgstr ""
-"опциÑта „--default“ изиÑква булева ÑтойноÑÑ‚ при „--type=bool“, а не „%s“"
-
-#, c-format
-msgid ""
-"option `--default' expects an unsigned long value with `--type=ulong`, not `"
-"%s`"
-msgstr ""
-"опциÑта „--default“ изиÑква целочиÑлена ÑтойноÑÑ‚ без знак при „--"
-"type=ulong“, а не „%s“"
-
msgid "git fast-export [<rev-list-opts>]"
msgstr "git fast-export [ОПЦИЯ_ЗÐ_СПИСЪКÐ_С_ВЕРСИИ…]"
@@ -6335,6 +6366,10 @@ msgstr "отрицателна дълбочина като аргумент на
msgid "--unshallow on a complete repository does not make sense"
msgstr "не може да използвате опциÑта „--unshallow“ върху пълно хранилище"
+#, c-format
+msgid "failed to fetch bundles from '%s'"
+msgstr "неуÑпешно доÑтавÑне на пратки от „%s“"
+
msgid "fetch --all does not take a repository argument"
msgstr "към „git fetch --all“ не може да добавите аргумент-хранилище"
@@ -6438,8 +6473,8 @@ msgstr "извеждане Ñамо на указателите, които ÑÑŠ
msgid "print only refs which don't contain the commit"
msgstr "извеждане Ñамо на указателите, които не Ñъдържат това ПОДÐÐ’ÐÐЕ"
-msgid "git for-each-repo --config=<config> <command-args>"
-msgstr "git for-each-repo --config=ÐÐСТРОЙКРÐРГУМЕÐТ…"
+msgid "git for-each-repo --config=<config> [--] <arguments>"
+msgstr "git for-each-repo --config=ÐÐСТРОЙКР[--] ÐРГУМЕÐТ…"
msgid "config"
msgstr "наÑтройка"
@@ -6597,21 +6632,29 @@ msgid "notice: %s points to an unborn branch (%s)"
msgstr "предупреждение: „%s“ Ñочи към вÑе още неÑъщеÑтвуващ клон (%s)"
msgid "Checking cache tree"
-msgstr "Проверка на дървото на кеша"
+msgstr "Проверка на кеша на обектите-дървета"
#, c-format
msgid "%s: invalid sha1 pointer in cache-tree"
-msgstr "„%s“: неправилен указател за SHA1 в дървото на кеша"
+msgstr "„%s“: неправилен указател за SHA1 в кеша на обектите-дървета"
msgid "non-tree in cache-tree"
-msgstr "в дървото на кеша има нещо, което не е дърво"
+msgstr "в кеша на обектите-дървета има нещо, което не е дърво"
#, c-format
msgid "%s: invalid sha1 pointer in resolve-undo"
msgstr "„%s“: неправилен указател за отмÑна на разрешените подаваниÑ"
-msgid "git fsck [<options>] [<object>...]"
-msgstr "git fsck [ОПЦИЯ…] [ОБЕКТ…]"
+msgid ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<object>...]"
+msgstr ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [ОБЕКТ…]"
msgid "show unreachable objects"
msgstr "показване на недоÑтижимите обекти"
@@ -6666,12 +6709,6 @@ msgstr "git fsmonitor--daemon start [ОПЦИЯ…]"
msgid "git fsmonitor--daemon run [<options>]"
msgstr "git fsmonitor--daemon run [ОПЦИЯ…]"
-msgid "git fsmonitor--daemon stop"
-msgstr "git fsmonitor--daemon stop"
-
-msgid "git fsmonitor--daemon status"
-msgstr "git fsmonitor--daemon status"
-
#, c-format
msgid "value of '%s' out of range: %d"
msgstr "дължината на „%s“ e извън диапазона: %d"
@@ -6923,8 +6960,20 @@ msgstr "изпълнение на определена задача"
msgid "use at most one of --auto and --schedule=<frequency>"
msgstr "опциите „--auto“ и „--schedule=ЧЕСТОТГ Ñа неÑъвмеÑтими"
-msgid "failed to run 'git config'"
-msgstr "неуÑпешно изпълнение на „git config“"
+#, c-format
+msgid "unable to add '%s' value of '%s'"
+msgstr "неуÑпешно добавÑне на ÑтойноÑÑ‚ на „%s“ за „%s“"
+
+msgid "return success even if repository was not registered"
+msgstr "уÑпешно завършване, дори ако хранилището не бъде региÑтрирано"
+
+#, c-format
+msgid "unable to unset '%s' value of '%s'"
+msgstr "неуÑпешно изчиÑтване на ÑтойноÑÑ‚ на „%s“ за „%s“"
+
+#, c-format
+msgid "repository '%s' is not registered"
+msgstr "хранилището „%s“ не е региÑтрирано"
#, c-format
msgid "failed to expand path '%s'"
@@ -7227,11 +7276,14 @@ msgid "both --cached and trees are given"
msgstr "опциÑта „--cached“ е неÑъвмеÑтима ÑÑŠÑ Ð·Ð°Ð´Ð°Ð²Ð°Ð½Ðµ на дърво"
msgid ""
-"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters] [--stdin] "
-"[--] <file>..."
+"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]\n"
+" [--stdin [--literally]] [--] <file>..."
msgstr ""
-"git hash-object [-t ВИД] [-w] [--path=ФÐЙЛ | --no-filters] [--stdin] [--] "
-"ФÐЙЛ…"
+"git hash-object [-t ВИД] [-w] [--path=ФÐЙЛ | --no-filters]\n"
+" [--stdin [--literally]] [--] ФÐЙЛ…"
+
+msgid "git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]"
+msgstr "git hash-object [-t ВИД] [-w] --stdin-paths [--no-filters]"
msgid "object type"
msgstr "ВИД на обекта"
@@ -7362,12 +7414,18 @@ msgstr "употреба: %s%s"
msgid "'git help config' for more information"
msgstr "За повече Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¸Ð·Ð¿ÑŠÐ»Ð½ÐµÑ‚Ðµ „git help config“"
-msgid "git hook run [--ignore-missing] <hook-name> [-- <hook-args>]"
-msgstr "git hook run [--ignore-missing] КУКР[-- ÐРГУМЕÐТ_ЗÐ_КУКÐ…]"
+msgid ""
+"git hook run [--ignore-missing] [--to-stdin=<path>] <hook-name> [-- <hook-"
+"args>]"
+msgstr ""
+"git hook run [--ignore-missing] [--to-stdin=ПЪТ] КУКР[-- ÐРГУМЕÐТ_ЗÐ_КУКÐ…]"
msgid "silently ignore missing requested <hook-name>"
msgstr "преÑкачане на заÑвена КУКÐ, коÑто липÑва"
+msgid "file to read into hooks' stdin"
+msgstr "файл за изчитане от ÑÑ‚Ð°Ð½Ð´Ð°Ñ€Ñ‚Ð½Ð¸Ñ Ð²Ñ…Ð¾Ð´ на куката"
+
#, c-format
msgid "object type mismatch at %s"
msgstr "неправилен вид на обекта „%s“"
@@ -7662,14 +7720,18 @@ msgid "Initialized empty Git repository in %s%s\n"
msgstr "Инициализиране на празно хранилище на Git в „%s%s“\n"
msgid ""
-"git init [-q | --quiet] [--bare] [--template=<template-directory>] [--"
-"shared[=<permissions>]] [<directory>]"
+"git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
+" [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+" [-b <branch-name> | --initial-branch=<branch-name>]\n"
+" [--shared[=<permissions>]] [<directory>]"
msgstr ""
-"git init [-q | --quiet] [--bare] [--template=ДИРЕКТОРИЯ_С_ШÐБЛОÐИ] [--"
-"shared[=ПРÐÐ’Ð]] [ДИРЕКТОРИЯ]"
+"git init [-q | --quiet] [--bare] [--template=ДИРЕКТОРИЯ_С_ШÐБЛОÐИ]\n"
+" [--separate-git-dir ДИРЕКТОРИЯ_ÐÐ_GIT] [--object-format=ФОРМÐТ]\n"
+" [-b КЛОР| --initial-branch=КЛОÐ]\n"
+" [--shared[=ПРÐÐ’ÐÌ€]] [ДИРЕКТОРИЯ]"
msgid "permissions"
-msgstr "права"
+msgstr "права̀"
msgid "specify that the git repository is to be shared amongst several users"
msgstr ""
@@ -7709,11 +7771,13 @@ msgid "--separate-git-dir incompatible with bare repository"
msgstr "опциÑта „--separate-git-dir“ е неÑъвмеÑтима Ñ Ð³Ð¾Ð»Ð¾ хранилище"
msgid ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<token>[(=|:)<value>])...] [<file>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <token>[(=|:)<value>])...]\n"
+" [--parse] [<file>...]"
msgstr ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"ЛЕКСЕМÐ[(=|:)СТОЙÐОСТ])…] [ФÐЙЛ…]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer ЛЕКСЕМÐ[(=|:)СТОЙÐОСТ])…]\n"
+" [--parse] [ФÐЙЛ…]"
msgid "edit files in place"
msgstr "директно редактиране на файловете"
@@ -8213,12 +8277,12 @@ msgstr ""
msgid ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<repository> [<refs>...]]"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n"
+" [--symref] [<repository> [<patterns>...]]"
msgstr ""
-"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [ХРÐÐИЛИЩЕ [УКÐЗÐТЕЛ…]]"
+"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=КОМÐÐДÐ]\n"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=КЛЮЧ]\n"
+" [--symref] [ХРÐÐИЛИЩЕ [ШÐБЛОÐ]]"
msgid "do not print remote URL"
msgstr "без извеждане на адреÑите на отдалечените хранилища"
@@ -8352,12 +8416,12 @@ msgstr "git merge-base [-a | --all] ПОДÐÐ’ÐÐЕ ПОДÐÐ’ÐÐЕ…"
msgid "git merge-base [-a | --all] --octopus <commit>..."
msgstr "git merge-base [-a | --all] --octopus ПОДÐÐ’ÐÐЕ…"
-msgid "git merge-base --independent <commit>..."
-msgstr "git merge-base --independent ПОДÐÐ’ÐÐЕ…"
-
msgid "git merge-base --is-ancestor <commit> <commit>"
msgstr "git merge-base --is-ancestor ПОДÐÐ’ÐÐЕ_1 ПОДÐÐ’ÐÐЕ_2"
+msgid "git merge-base --independent <commit>..."
+msgstr "git merge-base --independent ПОДÐÐ’ÐÐЕ…"
+
msgid "git merge-base --fork-point <ref> [<commit>]"
msgstr "git merge-base --fork-point УКÐЗÐТЕЛ [ПОДÐÐ’ÐÐЕ]"
@@ -8467,9 +8531,26 @@ msgstr ""
msgid "allow merging unrelated histories"
msgstr "позволÑване на Ñливане на незавиÑими иÑтории"
+msgid "perform multiple merges, one per line of input"
+msgstr "извършване на множеÑтво ÑливаниÑ, по едно на ред"
+
+msgid "specify a merge-base for the merge"
+msgstr "база за Ñливането"
+
msgid "--trivial-merge is incompatible with all other options"
msgstr "„--trivial-merge“ е неÑъвмеÑтима Ñ Ð´Ñ€ÑƒÐ³Ð¸Ñ‚Ðµ опции"
+msgid "--merge-base is incompatible with --stdin"
+msgstr "опциите „--merge-base“ и „--stdin“ Ñа неÑъвмеÑтими"
+
+#, c-format
+msgid "malformed input line: '%s'."
+msgstr "входен ред Ñ Ð½ÐµÐ¿Ñ€Ð°Ð²Ð¸Ð»ÐµÐ½ формат: „%s“."
+
+#, c-format
+msgid "merging cannot continue; got unclean result of %d"
+msgstr "Ñливането не може да продължи — %d-тото завърши Ñ Ð³Ñ€ÐµÑˆÐºÐ°"
+
msgid "git merge [<options>] [<commit>...]"
msgstr "git merge [ОПЦИЯ…] [ПОДÐÐ’ÐÐЕ…]"
@@ -9105,10 +9186,6 @@ msgstr ""
"Ñъдържанието на бележка не може да Ñе вземе от обект, който не е BLOB: „%s“."
#, c-format
-msgid "malformed input line: '%s'."
-msgstr "входен ред Ñ Ð½ÐµÐ¿Ñ€Ð°Ð²Ð¸Ð»ÐµÐ½ формат: „%s“."
-
-#, c-format
msgid "failed to copy notes from '%s' to '%s'"
msgstr "бележката не може да Ñе копира от „%s“ към „%s“"
@@ -9305,13 +9382,12 @@ msgstr "да Ñе използва бележката Ñочена от този
msgid "unknown subcommand: `%s'"
msgstr "непозната подкоманда: „%s“"
-msgid ""
-"git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"
+msgid "git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"
msgstr ""
"git pack-objects --stdout [ОПЦИЯ…] [< СПИСЪК_С_УКÐЗÐТЕЛИ | < СПИСЪК_С_ОБЕКТИ]"
msgid ""
-"git pack-objects [<options>...] <base-name> [< <ref-list> | < <object-list>]"
+"git pack-objects [<options>] <base-name> [< <ref-list> | < <object-list>]"
msgstr ""
"git pack-objects [ОПЦИЯ…] ПРЕФИКС_ÐÐ_ИМЕТО [< СПИСЪК_С_УКÐЗÐТЕЛИ | < "
"СПИСЪК_С_ОБЕКТИ]"
@@ -9712,8 +9788,8 @@ msgstr ""
"ни извеÑтите Ñ Ðµ-пиÑмо до пощенÑÐºÐ¸Ñ ÑпиÑък:\n"
"<git@vger.kernel.org>.\n"
-msgid "git pack-refs [<options>]"
-msgstr "git pack-refs [ОПЦИЯ…]"
+msgid "git pack-refs [--all] [--no-prune]"
+msgstr "git pack-refs [--all] [--no-prune]"
msgid "pack everything"
msgstr "пакетиране на вÑичко"
@@ -9721,6 +9797,18 @@ msgstr "пакетиране на вÑичко"
msgid "prune loose refs (default)"
msgstr "окаÑÑ‚Ñ€Ñне на недоÑтижимите указатели (Ñтандартно)"
+msgid "git patch-id [--stable | --unstable | --verbatim]"
+msgstr "git patch-id [--stable | --unstable | --verbatim]"
+
+msgid "use the unstable patch-id algorithm"
+msgstr "използване на неÑтабилен алгоритъм за идентифициране на кръпка"
+
+msgid "use the stable patch-id algorithm"
+msgstr "използване на Ñтабилен алгоритъм за идентифициране на кръпка"
+
+msgid "don't strip whitespace from the patch"
+msgstr "без махане на празните знаци в кръпката"
+
msgid "git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]"
msgstr "git prune [-n] [-v] [--progress] [--expire ВРЕМЕ] [--] [ВРЪХ…]"
@@ -9938,14 +10026,13 @@ msgstr ""
msgid ""
"\n"
-"To avoid automatically configuring upstream branches when their name\n"
-"doesn't match the local branch, see option 'simple' of branch."
-"autoSetupMerge\n"
+"To avoid automatically configuring an upstream branch when its name\n"
+"won't match the local branch, see option 'simple' of branch.autoSetupMerge\n"
"in 'git help config'.\n"
msgstr ""
"\n"
-"За да избегнете автоматичното задаване на Ñледени клони, когато името им не "
-"Ñъвпада Ñ Ñ‚Ð¾Ð²Ð° на Ð»Ð¾ÐºÐ°Ð»Ð½Ð¸Ñ ÐºÐ»Ð¾Ð½, погледнете документациÑта за ÑтойноÑтта "
+"За да избегнете автоматичното задаване на Ñледени клони, когато името им\n"
+"не Ñъвпада Ñ Ñ‚Ð¾Ð²Ð° на Ð»Ð¾ÐºÐ°Ð»Ð½Ð¸Ñ ÐºÐ»Ð¾Ð½, погледнете документациÑта за ÑтойноÑтта\n"
"„simple“ на наÑтройката „branch.autoSetupMerge“ в „git help config“.\n"
#, c-format
@@ -10109,6 +10196,13 @@ msgstr "ИзтлаÑкване към „%s“\n"
msgid "failed to push some refs to '%s'"
msgstr "чаÑÑ‚ от указателите не бÑха изтлаÑкани към „%s“"
+msgid ""
+"recursing into submodule with push.recurseSubmodules=only; using on-demand "
+"instead"
+msgstr ""
+"рекурÑивно обхождане на подмодулите чрез „push.recurseSubmodules=only“. "
+"ВмеÑто това Ñе ползва ПРИ ÐУЖДÐ"
+
#, c-format
msgid "invalid value for '%s'"
msgstr "Ðеправилна ÑтойноÑÑ‚ за „%s“"
@@ -10247,13 +10341,15 @@ msgid "need two commit ranges"
msgstr "необходими Ñа два диапазона Ñ Ð¿Ð¾Ð´Ð°Ð²Ð°Ð½Ð¸Ñ"
msgid ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>) "
-"[-u | -i]] [--no-sparse-checkout] [--index-output=<file>] (--empty | <tree-"
-"ish1> [<tree-ish2> [<tree-ish3>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
+"prefix=<prefix>)\n"
+" [-u | -i]] [--index-output=<file>] [--no-sparse-checkout]\n"
+" (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"
msgstr ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=ПРЕФИКС) "
-"[-u | -i]] [--no-sparse-checkout] [--index-output=ФÐЙЛ] (--empty | "
-"УКÐЗÐТЕЛ_КЪМ_ДЪРВО_1 [УКÐЗÐТЕЛ_КЪМ_ДЪРВО_2 [УКÐЗÐТЕЛ_КЪМ_ДЪРВО_3]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=ПРЕФИКС)\n"
+" [-u | -i]] [--index-output=ФÐЙЛ] [--no-sparse-checkout]\n"
+" (--empty | УКÐЗÐТЕЛ_КЪМ_ДЪРВО_1 [УКÐЗÐТЕЛ_КЪМ_ДЪРВО_2 "
+"[УКÐЗÐТЕЛ_КЪМ_ДЪРВО_3]])"
msgid "write resulting index to <file>"
msgstr "запазване на индекÑа в този ФÐЙЛ"
@@ -10343,8 +10439,8 @@ msgid "%s requires the merge backend"
msgstr "„%s“ изиÑква пребазиране"
#, c-format
-msgid "could not get 'onto': '%s'"
-msgstr "не може да Ñе премине към новата база, зададена Ñ â€žonto“: „%s“"
+msgid "invalid onto: '%s'"
+msgstr "неправилен указател върху какво да Ñе пребазира: „%s“"
#, c-format
msgid "invalid orig-head: '%s'"
@@ -10392,10 +10488,13 @@ msgstr ""
msgid "could not switch to %s"
msgstr "не може да Ñе премине към „%s“"
+msgid "apply options and merge options cannot be used together"
+msgstr "опциите за прилагане и Ñливане Ñа неÑъвмеÑтими"
+
#, c-format
msgid ""
-"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and \"ask"
-"\"."
+"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and "
+"\"ask\"."
msgstr ""
"неправилна ÑтойноÑÑ‚ „%s“: вариантите Ñа „drop“ (преÑкачане), "
"„keep“ (запазване) и „ask“ (питане)"
@@ -10637,8 +10736,19 @@ msgid "--strategy requires --merge or --interactive"
msgstr ""
"опциÑта „--strategy“ изиÑква нÑÐºÐ¾Ñ Ð¾Ñ‚ опциите „--merge“ или „--interactive“"
-msgid "apply options and merge options cannot be used together"
-msgstr "опциите за прилагане и Ñливане Ñа неÑъвмеÑтими"
+msgid ""
+"apply options are incompatible with rebase.autosquash. Consider adding --no-"
+"autosquash"
+msgstr ""
+"опциите за прилагане Ñа неÑъвмеÑтими Ñ â€žrebase.autosquash“. Пробвайте да "
+"добавите опциÑта „--no-autosquash“"
+
+msgid ""
+"apply options are incompatible with rebase.updateRefs. Consider adding --no-"
+"update-refs"
+msgstr ""
+"опциите за прилагане Ñа неÑъвмеÑтими Ñ â€žrebase.updateRefs“. Пробвайте да "
+"добавите опциÑта „--no-update-refs“"
#, c-format
msgid "Unknown rebase backend: %s"
@@ -10664,7 +10774,7 @@ msgstr "не ÑъщеÑтвува клон/подаване „%s“"
msgid "No such ref: %s"
msgstr "Такъв указател нÑма: %s"
-msgid "Could not resolve HEAD to a revision"
+msgid "Could not resolve HEAD to a commit"
msgstr "Подаването, Ñочено от ÑƒÐºÐ°Ð·Ð°Ñ‚ÐµÐ»Ñ â€žHEAD“, не може да бъде открито"
#, c-format
@@ -11346,6 +11456,10 @@ msgstr "временниÑÑ‚ файл „%s“ не може да бъде отÐ
msgid "could not close refs snapshot tempfile"
msgstr "временниÑÑ‚ файл ÑÑŠÑ Ñнимка на указателите не може да Ñе затвори"
+#, c-format
+msgid "could not remove stale bitmap: %s"
+msgstr "изтриването на оÑтарÑлата битова маÑка „%s“ е невъзможно"
+
msgid "pack everything in a single pack"
msgstr "пакетиране на вÑичко в пакет"
@@ -11430,6 +11544,9 @@ msgstr "откриване на геометрична прогреÑÐ¸Ñ Ñ Ñ‡Ð
msgid "write a multi-pack index of the resulting packs"
msgstr "запазване на многопакетен Ð¸Ð½Ð´ÐµÐºÑ Ð·Ð° Ñъздадените пакети"
+msgid "pack prefix to store a pack containing pruned objects"
+msgstr "Ð¿Ñ€ÐµÑ„Ð¸ÐºÑ Ð½Ð° името на Ð¿Ð°ÐºÐµÑ‚Ð½Ð¸Ñ Ð·Ð° пакети за окаÑтрени обекти"
+
msgid "cannot delete packs in a precious-objects repo"
msgstr "пакетите в хранилище Ñ Ð²Ð°Ð¶Ð½Ð¸ обекти не може да Ñе триÑÑ‚"
@@ -11441,8 +11558,12 @@ msgid "pack prefix %s does not begin with objdir %s"
msgstr "името на Ð¿Ð°ÐºÐµÑ‚Ð½Ð¸Ñ Ñ„Ð°Ð¹Ð» „%s“ не започва Ñ Ð´Ð¸Ñ€ÐµÐºÑ‚Ð¾Ñ€Ð¸Ñта за обекти Ñ â€ž%s“"
#, c-format
-msgid "missing required file: %s"
-msgstr "липÑва Ð·Ð°Ð´ÑŠÐ»Ð¶Ð¸Ñ‚ÐµÐ»Ð½Ð¸Ñ Ñ„Ð°Ð¹Ð» „%s“"
+msgid "renaming pack to '%s' failed"
+msgstr "неуÑпешно преименуване на Ð¿Ð°ÐºÐµÑ‚Ð½Ð¸Ñ Ñ„Ð°Ð¹Ð» на „%s“"
+
+#, c-format
+msgid "pack-objects did not write a '%s' file for pack %s-%s"
+msgstr "Командата „git pack-objects“ не запиÑа файл „%s“ за пакета „%s-%s“"
#, c-format
msgid "could not unlink: %s"
@@ -11636,8 +11757,9 @@ msgstr "опциÑта „--convert-graft-file“ не приема аргуме
msgid "only one pattern can be given with -l"
msgstr "опциÑта „-l“ приема точно един шаблон"
-msgid "git rerere [clear | forget <path>... | status | remaining | diff | gc]"
-msgstr "git rerere [clear | forget ПЪТ… | status | remaining | diff | gc]"
+msgid ""
+"git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
+msgstr "git rerere [clear | forget ПЪТ… | diff | status | remaining | gc]"
msgid "register clean resolutions in index"
msgstr "региÑтриране на чиÑти корекции на конфликти в индекÑа"
@@ -11843,6 +11965,15 @@ msgstr "опциÑта „--prefix“ изиÑква аргумент"
msgid "unknown mode for --abbrev-ref: %s"
msgstr "непознат режим за „--abbrev-ref“: „%s“"
+msgid "--exclude-hidden cannot be used together with --branches"
+msgstr "опциите „--exclude-hidden“ и „--branches“ Ñа неÑъвмеÑтими"
+
+msgid "--exclude-hidden cannot be used together with --tags"
+msgstr "опциите „--exclude-hidden“ и „--tags“ Ñа неÑъвмеÑтими"
+
+msgid "--exclude-hidden cannot be used together with --remotes"
+msgstr "опциите „--exclude-hidden“ и „--remotes“ Ñа неÑъвмеÑтими"
+
msgid "this operation must be run in a work tree"
msgstr "тази команда Ñ‚Ñ€Ñбва да Ñе изпълни в работно дърво"
@@ -11850,17 +11981,25 @@ msgstr "тази команда Ñ‚Ñ€Ñбва да Ñе изпълни в рабÐ
msgid "unknown mode for --show-object-format: %s"
msgstr "непознат режим за „--show-object-format“: „%s“"
-msgid "git revert [<options>] <commit-ish>..."
-msgstr "git revert [ОПЦИЯ…] УКÐЗÐТЕЛ_КЪМ_ПОДÐÐ’ÐÐЕ…"
+msgid ""
+"git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] "
+"<commit>..."
+msgstr ""
+"git revert [--[no-]edit] [-n] [-m ÐОМЕР_ÐÐ_РОДИТЕЛ] [-s]\n"
+" [-S[ИДЕÐТИФИКÐТОР_ÐÐ_КЛЮЧ]] ПОДÐÐ’ÐÐЕ…"
-msgid "git revert <subcommand>"
-msgstr "git revert ПОДКОМÐÐДÐ"
+msgid "git revert (--continue | --skip | --abort | --quit)"
+msgstr "git revert (--continue | --skip | --abort | --quit)"
-msgid "git cherry-pick [<options>] <commit-ish>..."
-msgstr "git cherry-pick [ОПЦИЯ…] УКÐЗÐТЕЛ_КЪМ_ПОДÐÐ’ÐÐЕ…"
+msgid ""
+"git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n"
+" [-S[<keyid>]] <commit>..."
+msgstr ""
+"git cherry-pick [--edit] [-n] [-m ÐОМЕР_ÐÐ_РОДИТЕЛ] [-s] [-x] [--ff]\n"
+" [-S[ИДЕÐТИФИКÐТОР_ÐÐ_КЛЮЧ]] ПОДÐÐ’ÐÐЕ…"
-msgid "git cherry-pick <subcommand>"
-msgstr "git cherry-pick ПОДКОМÐÐДÐ"
+msgid "git cherry-pick (--continue | --skip | --abort | --quit)"
+msgstr "git cherry-pick (--continue | --skip | --abort | --quit)"
#, c-format
msgid "option `%s' expects a number greater than zero"
@@ -11889,7 +12028,7 @@ msgid "edit the commit message"
msgstr "редактиране на Ñъобщението при подаване"
msgid "parent-number"
-msgstr "номер на родителÑ"
+msgstr "номер на родител"
msgid "select mainline parent"
msgstr "избор на оÑÐ½Ð¾Ð²Ð½Ð¸Ñ Ñ€Ð¾Ð´Ð¸Ñ‚ÐµÐ»"
@@ -11921,8 +12060,14 @@ msgstr "неуÑпешна отмÑна"
msgid "cherry-pick failed"
msgstr "неуÑпешно отбиране"
-msgid "git rm [<options>] [--] <file>..."
-msgstr "git rm [ОПЦИЯ…] [--] ФÐЙЛ…"
+msgid ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=ФÐЙЛ [--pathspec-file-nul]]\n"
+" [--] [ПЪТ…]"
msgid ""
"the following file has staged content different from both the\n"
@@ -12001,12 +12146,14 @@ msgid ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<host>:]<directory> (--all | <ref>...)"
msgstr ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=ПÐКЕТ]\n"
" [--verbose] [--thin] [--atomic]\n"
-" [ХОСТ:]ДИРЕКТОРИЯ (--all | УКÐЗÐТЕЛ…])"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
+" [ХОСТ:]ДИРЕКТОРИЯ (--all | УКÐЗÐТЕЛ…)"
msgid "remote name"
msgstr "име на отдалечено хранилище"
@@ -12029,8 +12176,9 @@ msgstr "git log --pretty=short | git shortlog [ОПЦИЯ…]"
msgid "using multiple --group options with stdin is not supported"
msgstr "повече от една опции „--group“ Ñа неÑъвмеÑтими ÑÑŠÑ ÑÑ‚Ð°Ð½Ð´Ð°Ñ€Ñ‚Ð½Ð¸Ñ Ð²Ñ…Ð¾Ð´"
-msgid "using --group=trailer with stdin is not supported"
-msgstr "опциÑта „--group=trailer“ е неÑъвмеÑтима ÑÑŠÑ ÑÑ‚Ð°Ð½Ð´Ð°Ñ€Ñ‚Ð½Ð¸Ñ Ð²Ñ…Ð¾Ð´"
+#, c-format
+msgid "using %s with stdin is not supported"
+msgstr "„%s“ не поддържа ÑÑ‚Ð°Ð½Ð´Ð°Ñ€Ñ‚Ð½Ð¸Ñ Ð²Ñ…Ð¾Ð´"
#, c-format
msgid "unknown group type: %s"
@@ -12067,12 +12215,14 @@ msgid ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<when>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<rev> | <glob>)...]"
msgstr ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=КОГÐ] | --no-color] [--sparse]\n"
-" [--more=БРОЙ | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(РЕВИЗИЯ | УКÐЗÐТЕЛ)…]"
+" [--more=<n> | --list | --independent | --merge-base]\n"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(РЕВИЗИЯ | УКÐЗÐТЕЛ)…]"
msgid "git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]"
msgstr "git show-branch (-g | --reflog)[=БРОЙ[,БÐЗÐ]] [--list] [УКÐЗÐТЕЛ]"
@@ -12118,7 +12268,7 @@ msgid "show refs unreachable from any other ref"
msgstr "извеждане на недоÑтижимите указатели"
msgid "show commits in topological order"
-msgstr "извеждане на подаваниÑта в топологичеÑка подредба"
+msgstr "извеждане на подаваниÑта в топологична подредба"
msgid "show only commits not on the first branch"
msgstr "извеждане Ñамо на подаваниÑта, които не Ñа от Ð¿ÑŠÑ€Ð²Ð¸Ñ ÐºÐ»Ð¾Ð½"
@@ -12128,7 +12278,7 @@ msgstr "извеждане на ÑливаниÑта, които може да Ñ
msgid "topologically sort, maintaining date order where possible"
msgstr ""
-"топологичеÑка подредба, при запазване на подредбата по дата, доколкото е\n"
+"топологична подредба, при запазване на подредбата по дата, доколкото е\n"
"възможно"
msgid "<n>[,<base>]"
@@ -12174,11 +12324,13 @@ msgid "Unknown hash algorithm"
msgstr "Ðепознат алгоритъм за контролни Ñуми"
msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<pattern>...]"
msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=ЧИСЛО]] [--abbrev[=ЧИСЛО]] [--tags] [--heads] [--] [ШÐБЛОÐ…]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=БРОЙ]] [--abbrev[=БРОЙ]] [--tags]\n"
+" [--heads] [--] [ШÐБЛОÐ…]"
msgid "git show-ref --exclude-existing[=<pattern>]"
msgstr "git show-ref --exclude-existing[=ШÐБЛОÐ]"
@@ -12211,8 +12363,10 @@ msgstr ""
"извеждане на указателите приети от ÑÑ‚Ð°Ð½Ð´Ð°Ñ€Ñ‚Ð½Ð¸Ñ Ð²Ñ…Ð¾Ð´, които липÑват в "
"локалното хранилище"
-msgid "git sparse-checkout (init|list|set|add|reapply|disable) <options>"
-msgstr "git sparse-checkout (init|list|set|add|reapply|disable) ОПЦИЯ…"
+msgid ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<options>]"
+msgstr ""
+"git sparse-checkout (init | list | set | add | reapply | disable) ОПЦИЯ…"
msgid "this worktree is not sparse"
msgstr "това работно дърво не е чаÑтично"
@@ -12338,67 +12492,57 @@ msgstr ""
msgid "error while refreshing working directory"
msgstr "грешка при обновÑване на работната директориÑ"
-msgid "git stash list [<options>]"
-msgstr "git stash list [ОПЦИЯ…]"
+msgid "git stash list [<log-options>]"
+msgstr "git stash list [ОПЦИЯ_ЗÐ_ЖУРÐÐЛ…]"
-msgid "git stash show [<options>] [<stash>]"
-msgstr "git stash show [ОПЦИЯ…] [СКÐТÐÐО]"
+msgid ""
+"git stash show [-u | --include-untracked | --only-untracked] [<diff-"
+"options>] [<stash>]"
+msgstr ""
+"git stash show [-u | --include-untracked | --only-untracked] "
+"[ОПЦИЯ_ЗÐ_РÐЗЛИКÐ…] [СКÐТÐÐО]"
+
+msgid "git stash drop [-q | --quiet] [<stash>]"
+msgstr "git stash drop [-q | --quiet] [СКÐТÐÐО]"
-msgid "git stash drop [-q|--quiet] [<stash>]"
-msgstr "git stash drop [-q|--quiet] [СКÐТÐÐО]"
+msgid "git stash pop [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash pop [--index] [-q | --quiet] [СКÐТÐÐО]"
-msgid "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash ( pop | apply ) [--index] [-q|--quiet] [СКÐТÐÐО]"
+msgid "git stash apply [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash apply [--index] [-q | --quiet] [СКÐТÐÐО]"
msgid "git stash branch <branchname> [<stash>]"
msgstr "git stash branch КЛОР[СКÐТÐÐО]"
+msgid "git stash store [(-m | --message) <message>] [-q | --quiet] <commit>"
+msgstr "git stash store [-m | --message СЪОБЩЕÐИЕ] [-q | --quiet] ПОДÐÐ’ÐÐЕ"
+
msgid ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"<message>]\n"
" [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
" [--] [<pathspec>...]]"
msgstr ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message СЪОБЩЕÐИЕ]\n"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"СЪОБЩЕÐИЕ]\n"
" [--pathspec-from-file=ФÐЙЛ [--pathspec-file-nul]]\n"
" [--] [ПЪТ…]]"
msgid ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [СЪОБЩЕÐИЕ]"
-
-msgid "git stash pop [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash pop [--index] [-q|--quiet] [СКÐТÐÐО]"
-
-msgid "git stash apply [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash apply [--index] [-q|--quiet] [СКÐТÐÐО]"
-
-msgid "git stash store [-m|--message <message>] [-q|--quiet] <commit>"
-msgstr "git stash store [-m|--message СЪОБЩЕÐИЕ] [-q|--quiet] ПОДÐÐ’ÐÐЕ"
-
-msgid ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
-" [--] [<pathspec>...]]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<message>]"
msgstr ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message СЪОБЩЕÐИЕ]\n"
-" [--] [ПЪТ…]]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [СЪОБЩЕÐИЕ]"
-msgid ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [СЪОБЩЕÐИЕ]]"
+msgid "git stash create [<message>]"
+msgstr "git stash create [СЪОБЩЕÐИЕ]"
#, c-format
msgid "'%s' is not a stash-like commit"
@@ -12973,9 +13117,6 @@ msgstr "рекурÑивно обхождане на подмодулите"
msgid "don't fetch new objects from the remote site"
msgstr "без доÑтавÑне на новите обекти от отдалеченото хранилище"
-msgid "path into the working tree"
-msgstr "път към работното дърво"
-
msgid "use the 'checkout' update strategy (default)"
msgstr ""
"използване на ÑтратегиÑта за обновÑване „checkout“ (изтеглÑне — Ñтандартно)"
@@ -13012,27 +13153,9 @@ msgstr ""
"shallow] [--reference <repository>] [--recursive] [--[no-]single-branch] "
"[--] [ПЪТ…]"
-msgid "recurse into submodules"
-msgstr "рекурÑивно обхождане подмодулите"
-
msgid "git submodule absorbgitdirs [<options>] [<path>...]"
msgstr "git submodule absorbgitdirs [ОПЦИЯ…] [ПЪТ…]"
-msgid "check if it is safe to write to the .gitmodules file"
-msgstr "проверка дали пиÑането във файла „.gitmodules“ е безопаÑно"
-
-msgid "unset the config in the .gitmodules file"
-msgstr "изтриване на наÑтройка във файла „.gitmodules“"
-
-msgid "git submodule--helper config <name> [<value>]"
-msgstr "git submodule--helper config ИМЕ [СТОЙÐОСТ]"
-
-msgid "git submodule--helper config --unset <name>"
-msgstr "git submodule--helper config --unset ИМЕ"
-
-msgid "please make sure that the .gitmodules file is in the working tree"
-msgstr "файлът „.gitmodules“ Ñ‚Ñ€Ñбва да е в работното дърво"
-
msgid "suppress output for setting url of a submodule"
msgstr "без извеждане на Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¿Ñ€Ð¸ задаването на адреÑа на подмодул"
@@ -13112,6 +13235,9 @@ msgstr "Ðктивиране на локалното хранилище за пÐ
msgid "unable to checkout submodule '%s'"
msgstr "Подмодулът „%s“ не може да бъде изтеглен"
+msgid "please make sure that the .gitmodules file is in the working tree"
+msgstr "файлът „.gitmodules“ Ñ‚Ñ€Ñбва да е в работното дърво"
+
#, c-format
msgid "Failed to add submodule '%s'"
msgstr "ÐеуÑпешно добавÑне на подмодула „%s“"
@@ -13165,19 +13291,17 @@ msgstr ""
msgid "'%s' is not a valid submodule name"
msgstr "„%s“ е неправилно име за подмодул"
-#, c-format
-msgid "%s doesn't support --super-prefix"
-msgstr "„%s“ не поддържа опциÑта „--super-prefix“"
+msgid "git submodule--helper <command>"
+msgstr "git submodule--helper КОМÐÐДÐ"
-#, c-format
-msgid "'%s' is not a valid submodule--helper subcommand"
-msgstr "„%s“ не е подкоманда на „submodule--helper“"
+msgid "git symbolic-ref [-m <reason>] <name> <ref>"
+msgstr "git symbolic-ref [-m ПРИЧИÐÐ] ИМЕ УКÐЗÐТЕЛ"
-msgid "git symbolic-ref [<options>] <name> [<ref>]"
-msgstr "git symbolic-ref [ОПЦИЯ…] ИМЕ [УКÐЗÐТЕЛ]"
+msgid "git symbolic-ref [-q] [--short] [--no-recurse] <name>"
+msgstr "git symbolic-ref [-q] [--short] [--no-recurse] ИМЕ"
-msgid "git symbolic-ref -d [-q] <name>"
-msgstr "git symbolic-ref -d [-q] ИМЕ"
+msgid "git symbolic-ref --delete [-q] <name>"
+msgstr "git symbolic-ref --delete [-q] ИМЕ"
msgid "suppress error message for non-symbolic (detached) refs"
msgstr "без извеждане на грешка за неÑвързани (неÑимволни) указатели"
@@ -13188,6 +13312,9 @@ msgstr "изтриване на Ñимволен указател"
msgid "shorten ref output"
msgstr "кратка Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð·Ð° указателÑ"
+msgid "recursively dereference (default)"
+msgstr "рекурÑивно извеждане на идентификатори (Ñтандартно)"
+
msgid "reason"
msgstr "причина"
@@ -13195,24 +13322,26 @@ msgid "reason of the update"
msgstr "причина за обновÑването"
msgid ""
-"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]\n"
-" <tagname> [<head>]"
+"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n"
+" <tagname> [<commit> | <object>]"
msgstr ""
-"git tag [-a | -s | -u ИДЕÐТИФИКÐТОР_ÐÐ_КЛЮЧ] [-f] [-m СЪОБЩЕÐИЕ | -F ФÐЙЛ]\n"
-" ЕТИКЕТ [ВРЪХ]"
+"git tag [-a | -s | -u ИДЕÐТИФИКÐТОР_ÐÐ_КЛЮЧ] [-f] [-m СЪОБЩЕÐИЕ | -F ФÐЙЛ] [-"
+"e]\n"
+" ЕТИКЕТ [ПОДÐÐ’ÐÐЕ | ОБЕКТ]"
msgid "git tag -d <tagname>..."
msgstr "git tag -d ЕТИКЕТ…"
msgid ""
-"git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--"
-"points-at <object>]\n"
-" [--format=<format>] [--merged <commit>] [--no-merged <commit>] "
-"[<pattern>...]"
+"git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]\n"
+" [--points-at <object>] [--column[=<options>] | --no-column]\n"
+" [--create-reflog] [--sort=<key>] [--format=<format>]\n"
+" [--merged <commit>] [--no-merged <commit>] [<pattern>...]"
msgstr ""
-"git tag -l [-n[БРОЙ]] [--contains ПОДÐÐ’ÐÐЕ] [--no-contains ПОДÐÐ’ÐÐЕ]\n"
-" [--points-at ОБЕКТ] [--format=ФОРМÐТ] [--merged ПОДÐÐ’ÐÐЕ]\n"
-" [--no-merged ПОДÐÐ’ÐÐЕ] [ШÐБЛОÐ…]"
+"git tag [-n[БРОЙ]] -l [--contains ПОДÐÐ’ÐÐЕ] [--no-contains ПОДÐÐ’ÐÐЕ]\n"
+" [--points-at ОБЕКТ] [--column[=ОПЦИЯ…] | --no-column]\n"
+" [--create-reflog] [--sort=<key>] [--format=ФОРМÐТ]\n"
+" [--merged ПОДÐÐ’ÐÐЕ] [--no-merged ПОДÐÐ’ÐÐЕ] [ШÐБЛОÐ…]"
msgid "git tag -v [--format=<format>] <tagname>..."
msgstr "git tag -v [--format=ФОРМÐТ] ЕТИКЕТ…"
@@ -13614,8 +13743,12 @@ msgstr "изчитане на указателите от ÑтандартниÑ
msgid "update the info files from scratch"
msgstr "обновÑване на информационните файлове от нулата"
-msgid "git upload-pack [<options>] <dir>"
-msgstr "git upload-pack [ОПЦИЯ…] ДИРЕКТОРИЯ"
+msgid ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <directory>"
+msgstr ""
+"git-upload-pack [--[no-]strict] [--timeout=БРОЙ] [--stateless-rpc]\n"
+" [--advertise-refs] ДИРЕКТОРИЯ"
msgid "quit after a single request/response exchange"
msgstr "изход Ñлед първоначалната размÑна на заÑвка и отговор"
@@ -13630,8 +13763,8 @@ msgstr ""
msgid "interrupt transfer after <n> seconds of inactivity"
msgstr "транÑферът да Ñе преуÑтанови Ñлед този БРОЙ Ñекунди"
-msgid "git verify-commit [-v | --verbose] <commit>..."
-msgstr "git verify-commit [-v | --verbose] ПОДÐÐ’ÐÐЕ…"
+msgid "git verify-commit [-v | --verbose] [--raw] <commit>..."
+msgstr "git verify-commit [-v | --verbose] [--raw] ПОДÐÐ’ÐÐЕ…"
msgid "print commit contents"
msgstr "извеждане на Ñъдържанието на подаването"
@@ -13639,8 +13772,8 @@ msgstr "извеждане на Ñъдържанието на подаванет
msgid "print raw gpg status output"
msgstr "извеждане на Ð½ÐµÐ¾Ð±Ñ€Ð°Ð±Ð¾Ñ‚ÐµÐ½Ð¸Ñ Ð¸Ð·Ñ…Ð¾Ð´ от ÑÑŠÑтоÑнието на „gpg“"
-msgid "git verify-pack [-v | --verbose] [-s | --stat-only] <pack>..."
-msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] ПÐКЕТ…"
+msgid "git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pack>.idx..."
+msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] [--] ПÐКЕТ.idx…"
msgid "verbose"
msgstr "извеждане на подробна информациÑ"
@@ -13648,35 +13781,39 @@ msgstr "извеждане на подробна информациÑ"
msgid "show statistics only"
msgstr "извеждане Ñамо на ÑтатиÑтиката"
-msgid "git verify-tag [-v | --verbose] [--format=<format>] <tag>..."
-msgstr "git verify-tag [-v | --verbose] [--format=ФОРМÐТ] ЕТИКЕТ…"
+msgid "git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."
+msgstr "git verify-tag [-v | --verbose] [--format=ФОРМÐТ] [--raw] ЕТИКЕТ…"
msgid "print tag contents"
msgstr "извеждане на Ñъдържанието на ЕТИКЕТи"
-msgid "git worktree add [<options>] <path> [<commit-ish>]"
-msgstr "git worktree add [ОПЦИЯ…] ПЪТ [УКÐЗÐТЕЛ_КЪМ_ПОДÐÐ’ÐÐЕ]"
+msgid ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]\n"
+" [-b <new-branch>] <path> [<commit-ish>]"
+msgstr ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason ÐИЗ]]\n"
+" [-b ÐОВ_КЛОÐ] ПЪТ [УКÐЗÐТЕЛ_КЪМ_ПОДÐÐ’ÐÐЕ]"
-msgid "git worktree list [<options>]"
-msgstr "git worktree list [ОПЦИЯ…]"
+msgid "git worktree list [-v | --porcelain [-z]]"
+msgstr "git worktree list [-v | --porcelain [-z]]"
-msgid "git worktree lock [<options>] <path>"
-msgstr "git worktree lock [ОПЦИЯ…] [ПЪТ]"
+msgid "git worktree lock [--reason <string>] <worktree>"
+msgstr "git worktree lock [--reason ПРИЧИÐÐ] ФОРМÐТ"
msgid "git worktree move <worktree> <new-path>"
msgstr "git worktree move [ДЪРВО] [ÐОВ_ПЪТ]"
-msgid "git worktree prune [<options>]"
-msgstr "git worktree prune [ОПЦИЯ…]"
+msgid "git worktree prune [-n] [-v] [--expire <expire>]"
+msgstr "git worktree prune [-n] [-v] [--expire ВРЕМЕ]"
-msgid "git worktree remove [<options>] <worktree>"
-msgstr "git worktree remove [ОПЦИЯ…] [ДЪРВО]"
+msgid "git worktree remove [-f] <worktree>"
+msgstr "git worktree remove [-f] ДЪРВО"
msgid "git worktree repair [<path>...]"
msgstr "git worktree repair [ПЪТ…]"
-msgid "git worktree unlock <path>"
-msgstr "git worktree unlock [ПЪТ]"
+msgid "git worktree unlock <worktree>"
+msgstr "git worktree unlock ДЪРВО"
#, c-format
msgid "Removing %s/%s: %s"
@@ -13918,6 +14055,15 @@ msgstr "Ñамо за изчиÑтване на грешки"
msgid "core.fsyncMethod = batch is unsupported on this platform"
msgstr "„core.fsyncMethod = batch“ не Ñе поддържа на тази платформа"
+#, c-format
+msgid "could not parse bundle list key %s with value '%s'"
+msgstr ""
+"ключът за ÑпиÑък Ñ Ð¿Ñ€Ð°Ñ‚ÐºÐ¸ „%s“ не може да Ñе анализира ÑÑŠÑ ÑтойноÑÑ‚ „%s“"
+
+#, c-format
+msgid "bundle list at '%s' has no mode"
+msgstr "липÑва режим в ÑпиÑъка от пратки „%s“"
+
msgid "failed to create temporary file"
msgstr "не може да Ñе Ñъздаде временен файл"
@@ -13925,16 +14071,44 @@ msgid "insufficient capabilities"
msgstr "недоÑтатъчно възможноÑти"
#, c-format
+msgid "file downloaded from '%s' is not a bundle"
+msgstr "изтеглениÑÑ‚ от Ð°Ð´Ñ€ÐµÑ â€ž%s“ файл не е пратка"
+
+msgid "failed to store maximum creation token"
+msgstr "неуÑпешно запазване на данните за поÑледно Ñъздаденото"
+
+#, c-format
+msgid "unrecognized bundle mode from URI '%s'"
+msgstr "непознат режим на пратки от Ð°Ð´Ñ€ÐµÑ â€ž%s“"
+
+#, c-format
+msgid "exceeded bundle URI recursion limit (%d)"
+msgstr ""
+"преминато е ограничениeто за рекурÑивно обхождане на адреÑи на пратки (%d)"
+
+#, c-format
msgid "failed to download bundle from URI '%s'"
msgstr "неуÑпешно изтеглÑне на пратка от адреÑ: „%s“"
#, c-format
-msgid "file at URI '%s' is not a bundle"
-msgstr "файлът на Ð°Ð´Ñ€ÐµÑ â€ž%s“ не е пратка"
+msgid "file at URI '%s' is not a bundle or bundle list"
+msgstr "файлът на Ð°Ð´Ñ€ÐµÑ â€ž%s“ не е нито пратка, нито ÑпиÑък Ñ Ð¿Ñ€Ð°Ñ‚ÐºÐ¸"
#, c-format
-msgid "failed to unbundle bundle from URI '%s'"
-msgstr "неуÑпешно разпакетиране на пратка от Ð°Ð´Ñ€ÐµÑ â€ž%s“"
+msgid "bundle-uri: unexpected argument: '%s'"
+msgstr "bundle-uri: непознат аргумент: %s"
+
+msgid "bundle-uri: expected flush after arguments"
+msgstr "bundle-uri: Ñлед аргументите Ñе очаква изчиÑтване на буферите"
+
+msgid "bundle-uri: got an empty line"
+msgstr "bundle-uri: получен е празен ред"
+
+msgid "bundle-uri: line is not of the form 'key=value'"
+msgstr "bundle-uri: редът не е във формат „КЛЮЧ=СТОЙÐОСТ“"
+
+msgid "bundle-uri: line has empty key or value"
+msgstr "bundle-uri: редът Ñъдържа празен ключ или ÑтойноÑÑ‚"
#, c-format
msgid "unrecognized bundle hash algorithm: %s"
@@ -13958,6 +14132,13 @@ msgstr "Ð’ хранилището липÑват Ñледните необход
msgid "need a repository to verify a bundle"
msgstr "за проверката на пратка е необходимо хранилище"
+msgid ""
+"some prerequisite commits exist in the object store, but are not connected "
+"to the repository's history"
+msgstr ""
+"в хранилището на обекти ÑъщеÑтвуват необходими подаваниÑ, които не Ñа "
+"Ñвързани Ñ Ð¸ÑториÑта на хранилището"
+
#, c-format
msgid "The bundle contains this ref:"
msgid_plural "The bundle contains these %<PRIuMAX> refs:"
@@ -14163,7 +14344,7 @@ msgstr "СравнÑване на обекти-дърво Ñ Ñ€Ð°Ð±Ð¾Ñ‚Ð½Ð¾Ñ‚Ð¾
msgid "Compares the content and mode of blobs found via two tree objects"
msgstr ""
-"СравнÑване на Ñъдържанието и правата за доÑтъп на обектите-BLOB чрез два "
+"СравнÑване на Ñъдържанието и права̀та за доÑтъп на обектите-BLOB чрез два "
"обекта-дърво"
msgid "Show changes using common diff tools"
@@ -14521,7 +14702,7 @@ msgstr "Формат на пратките"
msgid "Chunk-based file formats"
msgstr "Формати на откъÑите"
-msgid "Git commit graph format"
+msgid "Git commit-graph format"
msgstr "Формат на гра̀фа Ñ Ð¿Ð¾Ð´Ð°Ð²Ð°Ð½Ð¸Ñта"
msgid "Git index format"
@@ -14691,7 +14872,7 @@ msgstr "не може да бъде Ñъздаден временен Ñлой Ð
#, c-format
msgid "unable to adjust shared permissions for '%s'"
-msgstr "правата за Ñподелен доÑтъп до „%s“ не може да бъдат зададени"
+msgstr "права̀та за Ñподелен доÑтъп до „%s“ не може да бъдат зададени"
#, c-format
msgid "Writing out commit graph in %d pass"
@@ -14888,8 +15069,12 @@ msgstr "необработен Ñлучай в „has_worktree_moved“: %d"
#, c-format
msgid "health thread wait failed [GLE %ld]"
msgstr ""
-"грешка в нишката за Ñледене на ÑÑŠÑтоÑнието [поÑледна грешка в нишката: GLE="
-"%1$ld]"
+"грешка в нишката за Ñледене на ÑÑŠÑтоÑнието [поÑледна грешка в нишката: "
+"GLE=%1$ld]"
+
+#, c-format
+msgid "Invalid path: %s"
+msgstr "Ðеправилен път: „%s“"
msgid "Unable to create FSEventStream."
msgstr "ÐеуÑпешно Ñъздаване на „FSEventStream“."
@@ -14911,8 +15096,8 @@ msgstr "„%2$s“ не може да Ñе наблюдава [поÑледна
#, c-format
msgid "[GLE %ld] could not get longname of '%s'"
msgstr ""
-"дългото име на „%2$s“ те може да Ñе получи [поÑледна грешка в нишката: GLE="
-"%1$ld]"
+"дългото име на „%2$s“ те може да Ñе получи [поÑледна грешка в нишката: "
+"GLE=%1$ld]"
#, c-format
msgid "ReadDirectoryChangedW failed on '%s' [GLE %ld]"
@@ -14933,6 +15118,22 @@ msgstr ""
"нишката: GLE=%ld]"
#, c-format
+msgid "opendir('%s') failed"
+msgstr "неуÑпешно изпълнение на opendir(„%s“)"
+
+#, c-format
+msgid "lstat('%s') failed"
+msgstr "неуÑпешно изпълнение на lstat(„%s“)"
+
+#, c-format
+msgid "strbuf_readlink('%s') failed"
+msgstr "неуÑпешно изпълнение на strbuf_readlink(„%s“)"
+
+#, c-format
+msgid "closedir('%s') failed"
+msgstr "неуÑпешно изпълнение на closedir(„%s“)"
+
+#, c-format
msgid "[GLE %ld] unable to open for read '%ls'"
msgstr ""
"файлът „%2$ls“ не може да бъде отворен за четене [поÑледна грешка в нишката: "
@@ -15324,7 +15525,7 @@ msgstr "неуÑпешно изпълнение на „mmap“ върху „%s
#, c-format
msgid "chmod on %s failed"
-msgstr "неуÑпешна ÑмÑна на права Ñ â€žchmod“ върху „%s“"
+msgstr "неуÑпешна ÑмÑна на права̀ Ñ â€žchmod“ върху „%s“"
#, c-format
msgid "could not write config file %s"
@@ -15353,7 +15554,7 @@ msgid ""
msgstr ""
"Ðе може да Ñе чете от отдалеченото хранилище.\n"
"\n"
-"Проверете дали то ÑъщеÑтвува и дали имате права\n"
+"Проверете дали то ÑъщеÑтвува и дали имате права̀\n"
"за доÑтъп."
#, c-format
@@ -15394,15 +15595,23 @@ msgid "unknown object format '%s' specified by server"
msgstr "Ñървърът указа непознат формат на обект: „%s“"
#, c-format
+msgid "error on bundle-uri response line %d: %s"
+msgstr "грешка на ред %d в отговора на командата „bundle-uri“: %s"
+
+msgid "expected flush after bundle-uri listing"
+msgstr ""
+"Ñлед изброÑването на адреÑите на пратките Ñе очаква изчиÑтване на буферите"
+
+msgid "expected response end packet after ref listing"
+msgstr "Ñлед изброÑването на указателите Ñе очаква пакет за край"
+
+#, c-format
msgid "invalid ls-refs response: %s"
msgstr "неправилен отговор на „ls-refs“: „%s“"
msgid "expected flush after ref listing"
msgstr "Ñлед изброÑването на указателите Ñе очаква изчиÑтване на буферите"
-msgid "expected response end packet after ref listing"
-msgstr "Ñлед изброÑването на указателите Ñе очаква пакет за край"
-
#, c-format
msgid "protocol '%s' is not supported"
msgstr "протокол „%s“ не Ñе поддържа"
@@ -16541,7 +16750,7 @@ msgstr "такъв отдалечен указател нÑма: %s"
#, c-format
msgid "Server does not allow request for unadvertised object %s"
-msgstr "Сървърът не позволÑва заÑвка за необÑвен обект „%s“"
+msgstr "Сървърът не позволÑва заÑвка за необÑвен за наличен обект „%s“"
#, c-format
msgid "fsmonitor_ipc__send_query: invalid path '%s'"
@@ -16576,9 +16785,11 @@ msgstr "виртуалното хранилище „%s“ е неÑъвмеÑÑ‚
#, c-format
msgid ""
-"repository '%s' is incompatible with fsmonitor due to lack of Unix sockets"
+"socket directory '%s' is incompatible with fsmonitor due to lack of Unix "
+"sockets support"
msgstr ""
-"хранилището „%s“ е неÑъвмеÑтимо Ñ fsmonitor заради липÑата на гнезда на unix"
+"директориÑта за гнезда „%s“ е неÑъвмеÑтима Ñ fsmonitor заради липÑата на "
+"гнезда на Unix"
msgid ""
"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n"
@@ -16586,16 +16797,20 @@ msgid ""
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
-" [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n"
-" <command> [<args>]"
+" [--config-env=<name>=<envvar>] <command> [<args>]"
msgstr ""
+"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n"
+" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
+" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
+"bare]\n"
+" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
+" [--config-env=<name>=<envvar>] <command> [<args>]\n"
"git [-v | --version] [-h | --help] [-C ПЪТ] [-c ИМЕ=СТОЙÐОСТ]\n"
" [--exec-path[=ПЪТ]] [--html-path] [--man-path] [--info-path]\n"
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=ПЪТ] [--work-tree=ПЪТ] [--namespace=ИМЕ]\n"
-" [--super-prefix=ПЪТ] [--config-env=ИМЕ=ПРОМЕÐЛИВÐ_ÐÐ_СРЕДÐТÐ]\n"
-" КОМÐÐДР[ÐРГ…]"
+" [--config-env=ИМЕ=ПРОМЕÐЛИВÐ_ÐÐ_СРЕДÐТÐ] КОМÐÐДР[ÐРГ…]"
msgid ""
"'git help -a' and 'git help -g' list available subcommands and some\n"
@@ -16623,10 +16838,6 @@ msgid "no namespace given for --namespace\n"
msgstr "опциÑта „--namespace“ изиÑква име\n"
#, c-format
-msgid "no prefix given for --super-prefix\n"
-msgstr "опциÑта „--super-prefix“ изиÑква префикÑ\n"
-
-#, c-format
msgid "-c expects a configuration string\n"
msgstr "опциÑта „-c“ изиÑква низ за наÑтройка\n"
@@ -16746,8 +16957,13 @@ msgstr ""
msgid "gpg.ssh.defaultKeyCommand failed: %s %s"
msgstr "неуÑпешно изпълнение на „gpg.ssh.defaultKeyCommand“: %s %s"
-msgid "gpg failed to sign the data"
-msgstr "Програмата „gpg“ не подпиÑа данните"
+#, c-format
+msgid ""
+"gpg failed to sign the data:\n"
+"%s"
+msgstr ""
+"Програмата „gpg“ не подпиÑа данните:\n"
+"%s"
msgid "user.signingKey needs to be set for ssh signing"
msgstr ""
@@ -16915,8 +17131,8 @@ msgstr[1] ""
"\n"
"Ðай-близките команди Ñа"
-msgid "git version [<options>]"
-msgstr "git version [ОПЦИЯ…]"
+msgid "git version [--build-options]"
+msgstr "git version [--build-options]"
#, c-format
msgid "%s: %s - %s"
@@ -16940,7 +17156,7 @@ msgid ""
"The '%s' hook was ignored because it's not set as executable.\n"
"You can disable this warning with `git config advice.ignoredHook false`."
msgstr ""
-"Куката „%s“ Ñе преÑкача, защото липÑват права за изпълнение.\n"
+"Куката „%s“ Ñе преÑкача, защото липÑват права̀ за изпълнение.\n"
"За да изключите това предупреждение, изпълнете:\n"
" git config advice.ignoredHook false"
@@ -17339,7 +17555,7 @@ msgid ""
" or update to an existing commit which has merged those changes\n"
msgstr ""
" ⃠преминаване към подмодула (%s), Ñлед които или де Ñе Ñлее подаването\n"
-" „%s“, или да Ñе обновÑви към ÑъщеÑтвуващо подаване, в които\n"
+" „%s“, или да Ñе обнови към ÑъщеÑтвуващо подаване, в които\n"
" тези промени Ñа Ñлети\n"
#, c-format
@@ -17420,7 +17636,7 @@ msgstr "неуÑпешно Ñъздаване на Ñимволната връз
#, c-format
msgid "do not know what to do with %06o %s '%s'"
msgstr ""
-"не е ÑÑно какво да Ñе прави Ñ Ð¾Ð±ÐµÐºÑ‚Ð° „%2$s“ (%3$s) Ñ Ð¿Ñ€Ð°Ð²Ð° за доÑтъп „%1$06o“"
+"не е ÑÑно какво да Ñе прави Ñ Ð¾Ð±ÐµÐºÑ‚Ð° „%2$s“ (%3$s) Ñ Ð¿Ñ€Ð°Ð²Ð°Ì€ за доÑтъп „%1$06o“"
#, c-format
msgid "Fast-forwarding submodule %s to the following commit:"
@@ -17533,8 +17749,8 @@ msgstr ""
#, c-format
msgid ""
-"CONFLICT (rename/rename): Rename \"%s\"->\"%s\" in branch \"%s\" rename \"%s"
-"\"->\"%s\" in \"%s\"%s"
+"CONFLICT (rename/rename): Rename \"%s\"->\"%s\" in branch \"%s\" rename "
+"\"%s\"->\"%s\" in \"%s\"%s"
msgstr ""
"КОÐФЛИКТ (преименуване/преименуване): „%s“ е преименуван на „%s“ в клон "
"„%s“, а „%s“ е преименуван на „%s“ в „%s“/%s."
@@ -17877,10 +18093,6 @@ msgstr ""
"%s: алтернативните хранилища за обекти Ñе пренебрегват поради прекалено "
"дълбоко влагане"
-#, c-format
-msgid "unable to normalize object directory: %s"
-msgstr "директориÑта за обекти „%s“ не може да бъде нормализирана"
-
msgid "unable to fdopen alternates lockfile"
msgstr "заключващиÑÑ‚ файл за алтернативите не може да Ñе отвори Ñ â€žfdopen“"
@@ -17940,6 +18152,10 @@ msgid "garbage at end of loose object '%s'"
msgstr "грешни данни в ÐºÑ€Ð°Ñ Ð½Ð° Ð½ÐµÐ¿Ð°ÐºÐµÑ‚Ð¸Ñ€Ð°Ð½Ð¸Ñ Ð¾Ð±ÐµÐºÑ‚ „%s“"
#, c-format
+msgid "unable to open loose object %s"
+msgstr "непакетираниÑÑ‚ обект „%s“ не може да Ñе отвори"
+
+#, c-format
msgid "unable to parse %s header"
msgstr "заглавната чаÑÑ‚ на „%s“ не може да бъде анализирана"
@@ -17955,18 +18171,14 @@ msgid "header for %s too long, exceeds %d bytes"
msgstr "заглавната чаÑÑ‚ на „%s“ е прекалено дълга — Ð½Ð°Ð´Ñ…Ð²ÑŠÑ€Ð»Ñ %d байта"
#, c-format
-msgid "failed to read object %s"
-msgstr "обектът „%s“ не може да бъде прочетен"
+msgid "loose object %s (stored in %s) is corrupt"
+msgstr "непакетираниÑÑ‚ обект „%s“ (в „%s“) е повреден"
#, c-format
msgid "replacement %s not found for %s"
msgstr "замеÑтителÑÑ‚ „%s“ на „%s“ не може да бъде открит"
#, c-format
-msgid "loose object %s (stored in %s) is corrupt"
-msgstr "непакетираниÑÑ‚ обект „%s“ (в „%s“) е повреден"
-
-#, c-format
msgid "packed object %s (stored in %s) is corrupt"
msgstr "пакетираниÑÑ‚ обект „%s“ (в „%s“) е повреден"
@@ -17976,10 +18188,7 @@ msgstr "файлът „%s“ не може да бъде запиÑан"
#, c-format
msgid "unable to set permission to '%s'"
-msgstr "правата за доÑтъп до „%s“ не може да бъдат зададени"
-
-msgid "file write error"
-msgstr "грешка при Ð·Ð°Ð¿Ð¸Ñ Ð½Ð° файл"
+msgstr "права̀та за доÑтъп до „%s“ не може да бъдат зададени"
msgid "error when closing loose object file"
msgstr "грешка при затварÑнето на файла Ñ Ð½ÐµÐ¿Ð°ÐºÐµÑ‚Ð¸Ñ€Ð°Ð½ обект"
@@ -17987,7 +18196,7 @@ msgstr "грешка при затварÑнето на файла Ñ Ð½ÐµÐ¿Ð°Ðº
#, c-format
msgid "insufficient permission for adding an object to repository database %s"
msgstr ""
-"нÑма права за добавÑне на обект към базата от данни на хранилището „%s“"
+"нÑма права̀ за добавÑне на обект към базата от данни на хранилището „%s“"
msgid "unable to create temporary file"
msgstr "не може да бъде Ñъздаден временен файл"
@@ -18027,11 +18236,12 @@ msgstr "директориÑта „%s“ не може да бъде Ñъзда
msgid "cannot read object for %s"
msgstr "обектът за „%s“ не може да Ñе прочете"
-msgid "corrupt commit"
-msgstr "повредено подаване"
+#, c-format
+msgid "object fails fsck: %s"
+msgstr "„fsck“ откри грешка в обект: „%s“"
-msgid "corrupt tag"
-msgstr "повреден етикет"
+msgid "refusing to create malformed object"
+msgstr "не може да Ñе Ñъздаде Ñгрешен обект"
#, c-format
msgid "read error while indexing %s"
@@ -18302,10 +18512,6 @@ msgstr "неправилно отмеÑтване по XOR в пакетен иÐ
msgid "cannot fstat bitmap file"
msgstr "не може да Ñе получи Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð·Ð° файла Ñ Ð±Ð¸Ñ‚Ð¾Ð²Ð¸ маÑки Ñ â€žfstat“"
-#, c-format
-msgid "ignoring extra bitmap file: '%s'"
-msgstr "игнориране на Ð¸Ð·Ð»Ð¸ÑˆÐ½Ð¸Ñ Ñ„Ð°Ð¹Ð» Ñ Ð±Ð¸Ñ‚Ð¾Ð²Ð¸ маÑки: „%s“"
-
msgid "checksum doesn't match in MIDX and bitmap"
msgstr ""
"Ñумата за проверка Ñе различава във файла Ñ Ð¸Ð½Ð´ÐµÐºÑа за множеÑтво пакети и "
@@ -18436,7 +18642,7 @@ msgstr "не може да Ñе получи Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ñ‡Ñ€ÐµÐ· „st
#, c-format
msgid "failed to make %s readable"
-msgstr "не може да Ñе дадат права за четене на „%s“"
+msgstr "не може да Ñе дадат права̀ за четене на „%s“"
#, c-format
msgid "could not write '%s' promisor file"
@@ -18591,6 +18797,9 @@ msgstr "по-малко подробноÑти"
msgid "use <n> digits to display object names"
msgstr "да Ñе показват такъв БРОЙ цифри от имената на обектите"
+msgid "prefixed path to initial superproject"
+msgstr "път Ñ Ð¿Ñ€ÐµÑ„Ð¸ÐºÑ ÐºÑŠÐ¼ Ð¿ÑŠÑ€Ð²Ð¾Ð½Ð°Ñ‡Ð°Ð»Ð½Ð¸Ñ Ñвръхпроект"
+
msgid "how to strip spaces and #comments from message"
msgstr "кои празни знаци и #коментари да Ñе махат от ÑъобщениÑта"
@@ -18605,7 +18814,7 @@ msgstr ""
#, c-format
msgid "Could not make %s writable by group"
-msgstr "Ðе може да Ñе дадат права за Ð·Ð°Ð¿Ð¸Ñ Ð² директориÑта „%s“ на групата"
+msgstr "Ðе може да Ñе дадат права̀ за Ð·Ð°Ð¿Ð¸Ñ Ð² директориÑта „%s“ на групата"
msgid "Escape character '\\' not allowed as last character in attr value"
msgstr ""
@@ -18741,6 +18950,10 @@ msgid "promisor remote name cannot begin with '/': %s"
msgstr ""
"името отдалеченото хранилище-гарант не може за започва ÑÑŠÑ Ð·Ð½Ð°ÐºÐ° „/“: %s"
+#, c-format
+msgid "could not fetch %s from promisor remote"
+msgstr "„%s“ не може да Ñе доÑтави от гарантиращото хранилище"
+
msgid "object-info: expected flush after arguments"
msgstr "object-info: Ñлед аргументите Ñе очаква изчиÑтване на буферите"
@@ -18934,7 +19147,7 @@ msgstr "неуÑпешно изтриване на „%s“"
#, c-format
msgid "cannot fix permission bits on '%s'"
-msgstr "правата за доÑтъп до „%s“ не може да бъдат поправени"
+msgstr "права̀та за доÑтъп до „%s“ не може да бъдат поправени"
#, c-format
msgid "%s: cannot drop to stage #0"
@@ -19106,6 +19319,14 @@ msgid "ahead %d, behind %d"
msgstr "напред Ñ %d, назад Ñ %d"
#, c-format
+msgid "%%(%.*s) does not take arguments"
+msgstr "%%(%.*s) не приема аргументи"
+
+#, c-format
+msgid "unrecognized %%(%.*s) argument: %s"
+msgstr "непознат аргумент за „%%(%.*s)“: %s"
+
+#, c-format
msgid "expected format: %%(color:<color>)"
msgstr "очакван формат: %%(color:ЦВЯТ)"
@@ -19122,22 +19343,6 @@ msgid "Integer value expected refname:rstrip=%s"
msgstr "очаква Ñе цÑло чиÑло за „refname:rstrip=%s“"
#, c-format
-msgid "unrecognized %%(%s) argument: %s"
-msgstr "непознат аргумент за „%%(%s)“: %s"
-
-#, c-format
-msgid "%%(objecttype) does not take arguments"
-msgstr "%%(objecttype) не приема аргументи"
-
-#, c-format
-msgid "%%(deltabase) does not take arguments"
-msgstr "%%(deltabase) не приема аргументи"
-
-#, c-format
-msgid "%%(body) does not take arguments"
-msgstr "%%(body) не приема аргументи"
-
-#, c-format
msgid "expected %%(trailers:key=<value>)"
msgstr "очаква Ñе %%(trailers:key=ЕПИЛОГ)"
@@ -19154,10 +19359,6 @@ msgid "positive value expected '%s' in %%(%s)"
msgstr "очаква Ñе положителна ÑтойноÑÑ‚ за „%s“ в %%(%s)"
#, c-format
-msgid "unrecognized email option: %s"
-msgstr "непозната Ð¾Ð¿Ñ†Ð¸Ñ Ð·Ð° е-поща: %s"
-
-#, c-format
msgid "expected format: %%(align:<width>,<position>)"
msgstr "очакван формат: %%(align:ШИРОЧИÐÐ,ПОЗИЦИЯ)"
@@ -19170,12 +19371,12 @@ msgid "unrecognized width:%s"
msgstr "непозната широчина: %s"
#, c-format
-msgid "positive width expected with the %%(align) atom"
-msgstr "очаква Ñе положителна широчина Ñ Ð»ÐµÐºÑемата „%%(align)“"
+msgid "unrecognized %%(%s) argument: %s"
+msgstr "непознат аргумент за „%%(%s)“: %s"
#, c-format
-msgid "%%(rest) does not take arguments"
-msgstr "%%(rest) не приема аргументи"
+msgid "positive width expected with the %%(align) atom"
+msgstr "очаква Ñе положителна широчина Ñ Ð»ÐµÐºÑемата „%%(align)“"
#, c-format
msgid "malformed field name: %.*s"
@@ -19838,6 +20039,13 @@ msgid "failed to find tree of %s"
msgstr "дървото, Ñочено от „%s“, не може да бъде открито"
#, c-format
+msgid "unsupported section for hidden refs: %s"
+msgstr "неподдържан раздел за Ñкрити указатели: „%s“"
+
+msgid "--exclude-hidden= passed more than once"
+msgstr "опциÑта „--exclude-hidden=“ не може да Ñе подава повече от веднъж"
+
+#, c-format
msgid "resolve-undo records `%s` which is missing"
msgstr ""
"в информациÑта за отмÑна на разрешените Ð¿Ð¾Ð´Ð°Ð²Ð°Ð½Ð¸Ñ Ð¿Ñ€Ð¸ÑÑŠÑтва „%s“, който "
@@ -19986,6 +20194,14 @@ msgid "--all or <enlistment>, but not both"
msgstr "опциÑта „--all“ и указването на зачиÑлена Ð´Ð¸Ñ€ÐµÐºÑ‚Ð¾Ñ€Ð¸Ñ Ð½Ðµ Ñа ÑъвмеÑтими"
#, c-format
+msgid "could not remove stale scalar.repo '%s'"
+msgstr "оÑтарÑлото Ñкаларно хранилище (scalar.repo) „%s“ не може да Ñе изтрие"
+
+#, c-format
+msgid "removing stale scalar.repo '%s'"
+msgstr "изтриване на оÑтарÑлото Ñкаларно хранилище (scalar.repo) „%s“"
+
+#, c-format
msgid "git repository gone in '%s'"
msgstr "вече нÑма хранилище на git в „%s“"
@@ -20194,7 +20410,7 @@ msgid "%s: Unable to write new index file"
msgstr "%s: новиÑÑ‚ Ð¸Ð½Ð´ÐµÐºÑ Ð½Ðµ може да бъде запазен"
msgid "unable to update cache tree"
-msgstr "дървото на кеша не може да бъде обновено"
+msgstr "кешът на обектите-дървета не може да бъде обновен"
msgid "could not resolve HEAD commit"
msgstr "подаването, Ñочено от ÑƒÐºÐ°Ð·Ð°Ñ‚ÐµÐ»Ñ â€žHEAD“, не може да бъде открито"
@@ -20452,6 +20668,23 @@ msgid "git %s: failed to refresh the index"
msgstr "git %s: неуÑпешно обновÑване на индекÑа"
#, c-format
+msgid "'%s' is not a valid label"
+msgstr "„%s“ е неправилен етикет"
+
+#, c-format
+msgid "'%s' is not a valid refname"
+msgstr "„%s“ е неправилно име на указател"
+
+#, c-format
+msgid "update-ref requires a fully qualified refname e.g. refs/heads/%s"
+msgstr ""
+"командата „update-ref“ изиÑква пълно име на указател, напр. „refs/heads/%s“"
+
+#, c-format
+msgid "invalid command '%.*s'"
+msgstr "неправилна команда „%.*s“"
+
+#, c-format
msgid "%s does not accept arguments: '%s'"
msgstr "„%s“ не приема аргументи: „%s“"
@@ -20652,16 +20885,16 @@ msgstr ""
msgid "illegal label name: '%.*s'"
msgstr "неправилно име на етикет: „%.*s“"
+#, c-format
+msgid "could not resolve '%s'"
+msgstr "„%s“ не може да бъде открит"
+
msgid "writing fake root commit"
msgstr "запазване на фалшиво начално подаване"
msgid "writing squash-onto"
msgstr "запазване на подаването, в което другите да Ñе вкарат"
-#, c-format
-msgid "could not resolve '%s'"
-msgstr "„%s“ не може да бъде открит"
-
msgid "cannot merge without a current revision"
msgstr "без текущо подаване не може да Ñе Ñлива"
@@ -21032,7 +21265,7 @@ msgid ""
msgstr ""
"зададениÑÑ‚ в „core.sharedRepository“ режим за доÑтъп до файлове е неправилен "
"(0%.3o).\n"
-"СобÑтвеникът на файла Ñ‚Ñ€Ñбва да има права за пиÑане и четене."
+"СобÑтвеникът на файла Ñ‚Ñ€Ñбва да има права̀ за пиÑане и четене."
msgid "fork failed"
msgstr "неуÑпешно Ñъздаване на Ð¿Ñ€Ð¾Ñ†ÐµÑ Ñ‡Ñ€ÐµÐ· „fork“"
@@ -21277,6 +21510,27 @@ msgstr "„ls-tree“ завърши Ñ Ð½ÐµÐ¾Ñ‡Ð°ÐºÐ²Ð°Ð½ изходен код
msgid "failed to lstat '%s'"
msgstr "не може да бъде получена Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ñ‡Ñ€ÐµÐ· „lstat“ за „%s“"
+msgid "no remote configured to get bundle URIs from"
+msgstr "не е наÑтроено отдалечено хранилище за ÑпиÑъците Ñ Ð°Ð´Ñ€ÐµÑи на пратки"
+
+#, c-format
+msgid "remote '%s' has no configured URL"
+msgstr "не е зададен никакъв Ð°Ð´Ñ€ÐµÑ Ð·Ð° отдалеченото хранилище„%s“"
+
+msgid "could not get the bundle-uri list"
+msgstr "ÑпиÑъкът Ñ Ð°Ð´Ñ€ÐµÑи на пратки не може да Ñе получи"
+
+msgid "test-tool cache-tree <options> (control|prime|update)"
+msgstr "test-tool cache-tree ОПЦИЯ… (control|prime|update)"
+
+msgid "clear the cache tree before each iteration"
+msgstr "изчиÑтване на кеша на обектите-дървета преди вÑÑка итерациÑ"
+
+msgid "number of entries in the cache tree to invalidate (default 0)"
+msgstr ""
+"какъв брой запиÑи в кеша на обектите-дървета да Ñе отбележат като невалидни "
+"(Ñтандартно е 0)"
+
msgid "unhandled options"
msgstr "неподдържани опции"
@@ -21377,7 +21631,7 @@ msgstr "„%s“ не е обикновен файл"
#, c-format
msgid "file %s is not writable by user"
-msgstr "„%s“: нÑма права за запиÑване на файла"
+msgstr "„%s“: нÑма права̀ за запиÑване на файла"
msgid "could not open temporary file"
msgstr "временниÑÑ‚ файл не може да Ñе отвори"
@@ -21625,11 +21879,19 @@ msgstr "ПреуÑтановÑване на дейÑтвието."
msgid "failed to push all needed submodules"
msgstr "неуÑпешно изтлаÑкване на вÑички необходими подмодули"
+msgid "bundle-uri operation not supported by protocol"
+msgstr "операциÑта „bundle-uri“ (адреÑи на пратки) не Ñе поддържа от протокола"
+
+msgid "could not retrieve server-advertised bundle-uri list"
+msgstr ""
+"ÑпъÑъкът Ñ Ð°Ð´Ñ€ÐµÑи на пратки обÑвени за налични от Ñървъра не може да Ñе "
+"получи "
+
msgid "too-short tree object"
msgstr "прекалено кратък обект-дърво"
msgid "malformed mode in tree entry"
-msgstr "неправилни права за доÑтъп в Ð·Ð°Ð¿Ð¸Ñ Ð² дърво"
+msgstr "неправилни права̀ за доÑтъп в Ð·Ð°Ð¿Ð¸Ñ Ð² дърво"
msgid "empty filename in tree entry"
msgstr "празно име на файл в Ð·Ð°Ð¿Ð¸Ñ Ð² дърво"
@@ -22373,14 +22635,18 @@ msgstr "Игнорирани файлове"
#, c-format
msgid ""
-"It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
-"may speed it up, but you have to be careful not to forget to add\n"
-"new files yourself (see 'git help status')."
+"It took %.2f seconds to enumerate untracked files,\n"
+"but the results were cached, and subsequent runs may be faster."
msgstr ""
-"БÑха необходими %.2f Ñекунди за изброÑването на неÑледените файлове.\n"
-"ДобавÑнето на опциÑта „-uno“ към командата „git status“ ще уÑкори\n"
-"изпълнението, но ще Ñ‚Ñ€Ñбва да добавÑте новите файлове ръчно.\n"
-"За повече подробноÑти погледнете „git status help“."
+"ИзброÑването на неÑледените файлове отне %.2f Ñекунди, но\n"
+"резултатите Ñа запомнени и може да забързат поÑледващиге изброÑваниÑ."
+
+#, c-format
+msgid "It took %.2f seconds to enumerate untracked files."
+msgstr "ИзброÑването на неÑледените файлове отне %.2f Ñекунди."
+
+msgid "See 'git help status' for information on how to improve this."
+msgstr "Вижте в „git help status“ за начините да подобрите това."
#, c-format
msgid "Untracked files not listed%s"
@@ -22529,294 +22795,6 @@ msgstr ""
msgid "Unable to determine absolute path of git directory"
msgstr "ÐбÑолютниÑÑ‚ път на работното дърво не може да Ñе определи"
-#. TRANSLATORS: you can adjust this to align "git add -i" status menu
-#, perl-format
-msgid "%12s %12s %s"
-msgstr "%14s %14s %s"
-
-#, perl-format
-msgid "touched %d path\n"
-msgid_plural "touched %d paths\n"
-msgstr[0] "%d файл заÑегнат\n"
-msgstr[1] "%d файла заÑегнати\n"
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for staging."
-msgstr ""
-"Ðко кръпката може да Ñе приложи чиÑто, редактираното парче ще бъде "
-"незабавно\n"
-"добавено към индекÑа"
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for stashing."
-msgstr ""
-"Ðко кръпката може да Ñе приложи чиÑто, редактираното парче ще бъде "
-"незабавно\n"
-"Ñкътано"
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for unstaging."
-msgstr ""
-"Ðко кръпката може да Ñе приложи чиÑто, редактираното парче ще бъде "
-"незабавно\n"
-"извадено от индекÑа."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for applying."
-msgstr ""
-"Ðко кръпката може да Ñе приложи чиÑто, редактираното парче ще бъде "
-"незабавно\n"
-"набелÑзано за прилагане."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for discarding."
-msgstr ""
-"Ðко кръпката може да Ñе приложи чиÑто, редактираното парче ще бъде "
-"незабавно\n"
-"набелÑзано за занулÑване."
-
-#, perl-format
-msgid "failed to open hunk edit file for writing: %s"
-msgstr "файлът за редактиране на парчето код не може да бъде отворен: „%s“"
-
-#, perl-format
-msgid ""
-"---\n"
-"To remove '%s' lines, make them ' ' lines (context).\n"
-"To remove '%s' lines, delete them.\n"
-"Lines starting with %s will be removed.\n"
-msgstr ""
-"———\n"
-"За да пропуÑнете редовете започващи Ñ â€ž%s“ — заменете знака ÑÑŠÑ â€ž “ (Ñтават "
-"контекÑÑ‚)\n"
-"За да пропуÑнете редовете започващи Ñ â€ž%s“ — изтрийте ги.\n"
-"Редовете, които започват Ñ â€ž%s“ ще бъдат пропуÑнати.\n"
-
-#, perl-format
-msgid "failed to open hunk edit file for reading: %s"
-msgstr ""
-"файлът за редактиране на парчето код не може да бъде отворен за четене: „%s“"
-
-msgid ""
-"y - stage this hunk\n"
-"n - do not stage this hunk\n"
-"q - quit; do not stage this hunk or any of the remaining ones\n"
-"a - stage this hunk and all later hunks in the file\n"
-"d - do not stage this hunk or any of the later hunks in the file"
-msgstr ""
-"y — добавÑне на парчето в индекÑа\n"
-"n — без добавÑне на парчето в индекÑа\n"
-"q — изход, без добавÑне на това и вÑички оÑтаващи парчета от файла\n"
-"a — добавÑне на това и вÑички Ñледващи парчета от файла в индекÑа\n"
-"d — без добавÑне на това и вÑички Ñледващи парчета от файла в индекÑа"
-
-msgid ""
-"y - stash this hunk\n"
-"n - do not stash this hunk\n"
-"q - quit; do not stash this hunk or any of the remaining ones\n"
-"a - stash this hunk and all later hunks in the file\n"
-"d - do not stash this hunk or any of the later hunks in the file"
-msgstr ""
-"y — Ñкатаване на парчето\n"
-"n — без Ñкатаване на парчето\n"
-"q — изход, без Ñкатаване на това и вÑички оÑтаващи парчета\n"
-"a — Ñкатаване на това и вÑички Ñледващи парчета от файла\n"
-"d — без Ñкатаване на това и вÑички Ñледващи парчета от файла"
-
-msgid ""
-"y - unstage this hunk\n"
-"n - do not unstage this hunk\n"
-"q - quit; do not unstage this hunk or any of the remaining ones\n"
-"a - unstage this hunk and all later hunks in the file\n"
-"d - do not unstage this hunk or any of the later hunks in the file"
-msgstr ""
-"y — изваждане на парчето от индекÑа\n"
-"n — без изваждане на парчето от индекÑа\n"
-"q — изход, без изваждане на това и вÑички оÑтаващи парчета от индекÑа\n"
-"a — изваждане на това и вÑички Ñледващи парчета от файла от индекÑа\n"
-"d — без изваждане на това и вÑички Ñледващи парчета от файла от индекÑа"
-
-msgid ""
-"y - apply this hunk to index\n"
-"n - do not apply this hunk to index\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y — прилагане на парчето към индекÑа\n"
-"n — без прилагане на парчето към индекÑа\n"
-"q — изход, без прилагане на това и вÑички оÑтаващи парчета към индекÑа\n"
-"a — прилагане на това и вÑички Ñледващи парчета от файла към индекÑа\n"
-"d — без прилагане на това и вÑички Ñледващи парчета от файла към индекÑа"
-
-msgid ""
-"y - discard this hunk from worktree\n"
-"n - do not discard this hunk from worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-"y — премахване на парчето от работното дърво\n"
-"n — без премахване на парчето от работното дърво\n"
-"q — изход, без премахване на това и вÑички оÑтаващи парчета от работното "
-"дърво\n"
-"a — премахване на това и вÑички Ñледващи парчета от файла от работното "
-"дърво\n"
-"d — без премахване на това и вÑички Ñледващи парчета от файла от работното "
-"дърво"
-
-msgid ""
-"y - discard this hunk from index and worktree\n"
-"n - do not discard this hunk from index and worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-"y — премахване на парчето от индекÑа и работното дърво\n"
-"n — без премахване на парчето от индекÑа и работното дърво\n"
-"q — изход, без премахване на това и вÑички оÑтаващи парчета от индекÑа и "
-"работното дърво\n"
-"a — премахване на това и вÑички Ñледващи парчета от файла от индекÑа и "
-"работното дърво\n"
-"d — без премахване на това и вÑички Ñледващи парчета от файла от индекÑа и "
-"работното дърво"
-
-msgid ""
-"y - apply this hunk to index and worktree\n"
-"n - do not apply this hunk to index and worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y — прилагане на парчето от индекÑа и работното дърво\n"
-"n — без прилагане на парчето от индекÑа и работното дърво\n"
-"q — изход, без прилагане на това и вÑички оÑтаващи парчета от индекÑа и "
-"работното дърво\n"
-"a — прилагане на това и вÑички Ñледващи парчета от файла от индекÑа и "
-"работното дърво\n"
-"d — без прилагане на това и вÑички Ñледващи парчета от файла от индекÑа и "
-"работното дърво"
-
-msgid ""
-"y - apply this hunk to worktree\n"
-"n - do not apply this hunk to worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y — прилагане на парчето към работното дърво\n"
-"n — без прилагане на парчето към работното дърво\n"
-"q — изход, без прилагане на това и вÑички оÑтаващи парчета\n"
-"a — прилагане на това и вÑички Ñледващи парчета от файла\n"
-"d — без прилагане на това и вÑички Ñледващи парчета от файла"
-
-msgid ""
-"g - select a hunk to go to\n"
-"/ - search for a hunk matching the given regex\n"
-"j - leave this hunk undecided, see next undecided hunk\n"
-"J - leave this hunk undecided, see next hunk\n"
-"k - leave this hunk undecided, see previous undecided hunk\n"
-"K - leave this hunk undecided, see previous hunk\n"
-"s - split the current hunk into smaller hunks\n"
-"e - manually edit the current hunk\n"
-"? - print help\n"
-msgstr ""
-"g — избор към кое парче да Ñе премине\n"
-"/ — Ñ‚ÑŠÑ€Ñене на парче, напаÑващо към даден регулÑрен израз\n"
-"j — без решение за парчето, към Ñледващото парче без решение\n"
-"J — без решение за парчето, към Ñледващото парче\n"
-"k — без решение за парчето, към предишното парче без решение\n"
-"K — без решение за парчето, към предишното парче\n"
-"s — разделÑне на текущото парче на по-малки\n"
-"e — ръчно редактиране на текущото парче\n"
-"? — извеждане не помощта\n"
-
-msgid "The selected hunks do not apply to the index!\n"
-msgstr "Избраните парчета не може да Ñе добавÑÑ‚ в индекÑа!\n"
-
-#, perl-format
-msgid "ignoring unmerged: %s\n"
-msgstr "пренебрегване на неÑлÑтото: „%s“\n"
-
-msgid "No other hunks to goto\n"
-msgstr "ÐÑма други парчета\n"
-
-#, perl-format
-msgid "Invalid number: '%s'\n"
-msgstr "Ðеправилен номер: „%s“\n"
-
-#, perl-format
-msgid "Sorry, only %d hunk available.\n"
-msgid_plural "Sorry, only %d hunks available.\n"
-msgstr[0] "Има Ñамо %d парче.\n"
-msgstr[1] "Има Ñамо %d парчета.\n"
-
-msgid "No other hunks to search\n"
-msgstr "ÐÑма други парчета за Ñ‚ÑŠÑ€Ñене\n"
-
-#, perl-format
-msgid "Malformed search regexp %s: %s\n"
-msgstr "Сгрешен регулÑрен израз „%s“: %s\n"
-
-msgid "No hunk matches the given pattern\n"
-msgstr "Ðикое парче не напаÑва на регулÑÑ€Ð½Ð¸Ñ Ð¸Ð·Ñ€Ð°Ð·\n"
-
-msgid "No previous hunk\n"
-msgstr "ÐÑма друго парче преди това\n"
-
-msgid "No next hunk\n"
-msgstr "ÐÑма друго парче Ñлед това\n"
-
-msgid "Sorry, cannot split this hunk\n"
-msgstr "Това парче не може да бъде разделено\n"
-
-#, perl-format
-msgid "Split into %d hunk.\n"
-msgid_plural "Split into %d hunks.\n"
-msgstr[0] "РазделÑне на %d парче.\n"
-msgstr[1] "РазделÑне на %d парчета.\n"
-
-msgid "Sorry, cannot edit this hunk\n"
-msgstr "Това парче не може да бъде редактирано\n"
-
-#. TRANSLATORS: please do not translate the command names
-#. 'status', 'update', 'revert', etc.
-msgid ""
-"status - show paths with changes\n"
-"update - add working tree state to the staged set of changes\n"
-"revert - revert staged set of changes back to the HEAD version\n"
-"patch - pick hunks and update selectively\n"
-"diff - view diff between HEAD and index\n"
-"add untracked - add contents of untracked files to the staged set of "
-"changes\n"
-msgstr ""
-"status — извеждане на пътищата Ñ Ð¿Ñ€Ð¾Ð¼ÐµÌ€Ð½Ð¸Ñ‚Ðµ\n"
-"update — добавÑне на ÑÑŠÑтоÑнието на работното дърво към промѐните в\n"
-" индекÑа\n"
-"revert — отмÑна на промѐните в индекÑа към ÑÑŠÑтоÑнието Ñочено от "
-"„HEAD“\n"
-"patch — избиране на парчета код и обновÑване поединично\n"
-"diff — извеждане на разликата между ÑÑŠÑтоÑнието на Ñоченото от "
-"„HEAD“\n"
-" и индекÑа\n"
-"add untracked — добавÑне на неÑледените файлове към промѐните в индекÑа\n"
-
-msgid "missing --"
-msgstr "„--“ липÑва"
-
-#, perl-format
-msgid "unknown --patch mode: %s"
-msgstr "неизвеÑтна ÑÑ‚Ñ€Ð°Ñ‚ÐµÐ³Ð¸Ñ Ð·Ð° прилагане на кръпка към „--patch“: „%s“"
-
-#, perl-format
-msgid "invalid argument %s, expecting --"
-msgstr "указан е неправилен аргумент „%s“, а Ñе очаква „--“."
-
msgid "local zone differs from GMT by a non-minute interval\n"
msgstr ""
"разликата между меÑÑ‚Ð½Ð¸Ñ Ñ‡Ð°Ñови поÑÑ Ð¸ GMT Ñъдържа дробна чаÑÑ‚ от минута\n"
diff --git a/po/ca.po b/po/ca.po
index 7a17ed5936..c6d2dd6ecc 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -1,7 +1,7 @@
# Catalan translations for Git.
# This file is distributed under the same license as the Git package.
# Alex Henrie <alexhenrie24@gmail.com>, 2014-2016.
-# Jordi Mas i Hernàndez <jmas@softcatala.org>, 2016-2022
+# Jordi Mas i Hernàndez <jmas@softcatala.org>, 2016-2023
#
# Terminologia i criteris utilitzats
#
@@ -68,8 +68,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Git\n"
"Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2022-09-28 18:55+0200\n"
-"PO-Revision-Date: 2022-09-28 19:00-0600\n"
+"POT-Creation-Date: 2023-03-01 01:20+0000\n"
+"PO-Revision-Date: 2023-03-01 19:00-0600\n"
"Last-Translator: Jordi Mas i Hernàndez <jmas@softcatala.org>\n"
"Language-Team: Catalan\n"
"Language: ca\n"
@@ -105,13 +105,13 @@ msgstr "no s'ha pogut fer «stage» «%s»"
msgid "could not write index"
msgstr "no s'ha pogut escriure l'índex"
-#, c-format, perl-format
+#, c-format
msgid "updated %d path\n"
msgid_plural "updated %d paths\n"
msgstr[0] "actualitzat %d camí\n"
msgstr[1] "actualitzats %d camins\n"
-#, c-format, perl-format
+#, c-format
msgid "note: %s is untracked now.\n"
msgstr "nota: %s està ara sense seguiment.\n"
@@ -125,7 +125,7 @@ msgstr "Reverteix"
msgid "Could not parse HEAD^{tree}"
msgstr "No s'ha pogut analitzar HEAD^{tree}"
-#, c-format, perl-format
+#, c-format
msgid "reverted %d path\n"
msgid_plural "reverted %d paths\n"
msgstr[0] "revertit %d camí\n"
@@ -138,7 +138,7 @@ msgstr "Sense fitxers no seguits.\n"
msgid "Add untracked"
msgstr "Afegeix sense seguiment"
-#, c-format, perl-format
+#, c-format
msgid "added %d path\n"
msgid_plural "added %d paths\n"
msgstr[0] "afegit %d camí\n"
@@ -232,19 +232,19 @@ msgstr "no s'ha pogut actualitzar l'índex"
msgid "Bye.\n"
msgstr "Adeu.\n"
-#, c-format, perl-format
+#, c-format
msgid "Stage mode change [y,n,q,a,d%s,?]? "
msgstr "Canvia el mode de «stage» [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage deletion [y,n,q,a,d%s,?]? "
msgstr "Suprimeix «stage» [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage addition [y,n,q,a,d%s,?]? "
msgstr "Afegeix a «stage» [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage this hunk [y,n,q,a,d%s,?]? "
msgstr "Fer un «stage» d'aquest tros [y,n,q,a,d%s,?]? "
@@ -268,19 +268,19 @@ msgstr ""
"a - fes «stage» d'aquest tros i de tota la resta de trossos del fitxer\n"
"d - no facis «stage» d'aquest tros ni de cap altre restant del fitxer\n"
-#, c-format, perl-format
+#, c-format
msgid "Stash mode change [y,n,q,a,d%s,?]? "
msgstr "Canvia el mode de «stash» [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash deletion [y,n,q,a,d%s,?]? "
msgstr "Suprimeix «stash» [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash addition [y,n,q,a,d%s,?]? "
msgstr "Afegeix a «stash» [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash this hunk [y,n,q,a,d%s,?]? "
msgstr "Fer un «stash» d'aquest tros [y,n,q,a,d%s,?]? "
@@ -304,19 +304,19 @@ msgstr ""
"a - fes «stash» d'aquest tros i de tota la resta de trossos del fitxer\n"
"d - no facis «stash» d'aquest tros ni de cap altre restant del fitxer\n"
-#, c-format, perl-format
+#, c-format
msgid "Unstage mode change [y,n,q,a,d%s,?]? "
msgstr "Canvia el mode de «unstage» [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage deletion [y,n,q,a,d%s,?]? "
msgstr "Suprimeix «Unstage» [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage addition [y,n,q,a,d%s,?]? "
msgstr "Afegeix a «unstage» [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage this hunk [y,n,q,a,d%s,?]? "
msgstr "Fer un «unstage» d'aquest tros [y,n,q,a,d%s,?]? "
@@ -340,19 +340,19 @@ msgstr ""
"a - fes «unstage» d'aquest tros i de tota la resta de trossos del fitxer\n"
"d - no facis «unstage» d'aquest tros ni de cap altre restant del fitxer\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to index [y,n,q,a,d%s,?]? "
msgstr "Aplica el canvi de mode a l'índex [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to index [y,n,q,a,d%s,?]? "
msgstr "Aplica la supressió a l'índex [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to index [y,n,q,a,d%s,?]? "
msgstr "Aplica l'addició a l'índex [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to index [y,n,q,a,d%s,?]? "
msgstr "Aplica aquest tros a l'índex [y,n,q,a,d%s,?]? "
@@ -376,19 +376,19 @@ msgstr ""
"a - aplica aquest tros i tots els trossos posteriors en el fitxer\n"
"d - no apliquis aquest tros ni cap dels trossos posteriors en el fitxer\n"
-#, c-format, perl-format
+#, c-format
msgid "Discard mode change from worktree [y,n,q,a,d%s,?]? "
msgstr "Descarta el canvi de mode de l'arbre de treball [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard deletion from worktree [y,n,q,a,d%s,?]? "
msgstr "Descarta suprimir de l'arbre de treball [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard addition from worktree [y,n,q,a,d%s,?]? "
msgstr "Descarta l'addició de l'arbre de treball [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard this hunk from worktree [y,n,q,a,d%s,?]? "
msgstr "Descarta aquest tros de l'arbre de treball [y,n,q,a,d%s,?]? "
@@ -412,22 +412,22 @@ msgstr ""
"a - descarta aquest tros i tots els trossos posteriors en el fitxer\n"
"d - no descartis aquest tros ni cap dels trossos posteriors en el fitxer\n"
-#, c-format, perl-format
+#, c-format
msgid "Discard mode change from index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Descarta el canvi de mode de l'índex i de l'arbre de treball [y,n,q,a,"
"d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard deletion from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Descarta suprimir de l'índex i de l'arbre de treball [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard addition from index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Descarta l'addició de l'índex i de l'arbre de treball [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard this hunk from index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Descarta aquest tros de l'índex i de l'arbre de treball [y,n,q,a,d%s,?]? "
@@ -445,20 +445,20 @@ msgstr ""
"a - descarta aquest tros i tots els trossos posteriors en el fitxer\n"
"d - no descartis aquest tros ni cap dels trossos posteriors en el fitxer\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Aplica el canvi de mode a l'índex i a l'arbre de treball [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Aplica la supressió a l'índex i a l'arbre de treball [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Aplica l'addició a l'índex i a l'arbre de treball [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Aplica aquest tros a l'índex i a l'arbre de treball [y,n,q,a,d%s,?]? "
@@ -475,19 +475,19 @@ msgstr ""
"a - aplica aquest tros i tots els trossos posteriors en el fitxer\n"
"d - no apliquis aquest tros ni cap dels trossos posteriors en el fitxer\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to worktree [y,n,q,a,d%s,?]? "
msgstr "Aplica el canvi de mode a l'arbre de treball [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to worktree [y,n,q,a,d%s,?]? "
msgstr "Aplica la supressió a l'arbre de treball [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to worktree [y,n,q,a,d%s,?]? "
msgstr "Aplica l'addició a l'arbre de treball [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to worktree [y,n,q,a,d%s,?]? "
msgstr "Aplica aquest tros a l'arbre de treball [y,n,q,a,d%s,?]? "
@@ -564,8 +564,6 @@ msgstr ""
"Per a eliminar les línies «%c», suprimiu-les.\n"
"Les línies que comencin per %c s'eliminaran.\n"
-#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
-#. TRANSLATORS: 'it' refers to the patch mentioned in the previous messages.
msgid ""
"If it does not apply cleanly, you will be given an opportunity to\n"
"edit again. If all lines of the hunk are removed, then the edit is\n"
@@ -581,20 +579,12 @@ msgstr "no s'ha pogut analitzar la capçalera del tros"
msgid "'git apply --cached' failed"
msgstr "«git apply --cached» ha fallat"
-#. #-#-#-#-# add-patch.c.po #-#-#-#-#
#. TRANSLATORS: do not translate [y/n]
#. The program will only accept that input at this point.
#. Consider translating (saying "no" discards!) as
#. (saying "n" for "no" discards!) if the translation
#. of the word "no" does not start with n.
#.
-#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
-#. TRANSLATORS: do not translate [y/n]
-#. The program will only accept that input
-#. at this point.
-#. Consider translating (saying "no" discards!) as
-#. (saying "n" for "no" discards!) if the translation
-#. of the word "no" does not start with n.
msgid ""
"Your edited hunk does not apply. Edit again (saying \"no\" discards!) [y/n]? "
msgstr ""
@@ -818,7 +808,10 @@ msgid "cmdline ends with \\"
msgstr "la línia d'ordres acaba amb \\"
msgid "unclosed quote"
-msgstr "commetes no tancades"
+msgstr "cometes no tancades"
+
+msgid "too many arguments"
+msgstr "hi ha massa arguments"
#, c-format
msgid "unrecognized whitespace option '%s'"
@@ -1440,6 +1433,12 @@ msgstr "llegeix .gitattributes en el directori de treball"
msgid "report archived files on stderr"
msgstr "informa de fitxers arxivats en stderr"
+msgid "time"
+msgstr "data"
+
+msgid "set modification time of archive entries"
+msgstr "estableix l'hora de modificació de les entrades de l'arxiu"
+
msgid "set compression level"
msgstr "estableix el nivell de compressió"
@@ -1480,6 +1479,13 @@ msgstr "Argument no admès per al format «%s»: -%d"
msgid "%.*s is not a valid attribute name"
msgstr "%.*s no és un nom d'atribut vàlid"
+msgid "unable to add additional attribute"
+msgstr "no s'ha pogut afegir l'atribut addicional"
+
+#, c-format
+msgid "ignoring overly long attributes line %d"
+msgstr "s'ignorarà la línia d'atributs massa llarga %d"
+
#, c-format
msgid "%s not allowed: %s:%d"
msgstr "%s no està permès: %s:%d"
@@ -1492,6 +1498,18 @@ msgstr ""
"Useu «\\!» per exclamació capdavantera literal."
#, c-format
+msgid "cannot fstat gitattributes file '%s'"
+msgstr "no es pot fer fstat gitattributes al fitxer «%s»"
+
+#, c-format
+msgid "ignoring overly large gitattributes file '%s'"
+msgstr "s'ignorarà el fitxer «%s» gitattributes per massa gran"
+
+#, c-format
+msgid "ignoring overly large gitattributes blob '%s'"
+msgstr "s'ignorarà la blob «%s» gitattributes per massa gran"
+
+#, c-format
msgid "Badly quoted content in file '%s': %s"
msgstr "Comentari amb cometes errònies en el fitxer «%s»: %s"
@@ -1770,11 +1788,11 @@ msgstr "submòdul «%s»: no es pot trobar el submòdul"
#, c-format
msgid ""
-"You may try updating the submodules using 'git checkout %s && git submodule "
-"update --init'"
+"You may try updating the submodules using 'git checkout --no-recurse-"
+"submodules %s && git submodule update --init'"
msgstr ""
-"Podeu provar d'actualitzar els submòduls utilitzant «git checkout %s && git "
-"submodule update --init»"
+"Podeu provar d'actualitzar els submòduls utilitzant «git checkout --no-"
+"recurse-submodules %s && git submodule update --init»"
#, c-format
msgid "submodule '%s': cannot create branch '%s'"
@@ -1809,6 +1827,13 @@ msgstr "elimina «%s»\n"
msgid "Unstaged changes after refreshing the index:"
msgstr "Canvis «unstaged» després d'actualitzar l'índex:"
+msgid ""
+"the add.interactive.useBuiltin setting has been removed!\n"
+"See its entry in 'git help config' for details."
+msgstr ""
+"s'ha eliminat la configuració add.interactive.useBuiltin\n"
+"Per a més detalls, vegeu la seva entrada a «git help config»."
+
msgid "Could not read the index"
msgstr "No s'ha pogut llegir l'índex"
@@ -1878,7 +1903,7 @@ msgstr ""
"comprova si els fitxers, fins i tot els absents, s'ignoren en fer una prova"
msgid "allow updating entries outside of the sparse-checkout cone"
-msgstr "permet actualitzar entrada fora del con del «sparse-checkout»"
+msgstr "permet actualitzar les entrades fora del con del «sparse-checkout»"
msgid "override the executable bit of the listed files"
msgstr "sobreescriu el bit executable dels fitxers llistats"
@@ -2198,6 +2223,9 @@ msgstr "git am [<opcions>] (--continue | --skip | --abort)"
msgid "run interactively"
msgstr "executa interactivament"
+msgid "bypass pre-applypatch and applypatch-msg hooks"
+msgstr "evita els lligams pre-applypatch i applypatch-msg"
+
msgid "historical option -- no-op"
msgstr "opció històrica -- no-op"
@@ -2341,32 +2369,27 @@ msgstr "git archive: error de protocol"
msgid "git archive: expected a flush"
msgstr "git archive: s'esperava una neteja"
-msgid "git bisect--helper --bisect-reset [<commit>]"
-msgstr "git bisect--helper --bisect-reset [<comissió>]"
-
msgid ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}"
-"=<term>] [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] "
-"[<paths>...]"
+"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>] [--no-"
+"checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]"
msgstr ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}"
-"=<term>] [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] "
-"[<paths>...]"
+"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>] [--no-"
+"checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]"
-msgid "git bisect--helper --bisect-state (bad|new) [<rev>]"
-msgstr "git bisect--helper --bisect-state (bad|new) [<rev>]"
+msgid "git bisect (good|bad) [<rev>...]"
+msgstr "git bisect (good|bad) [<rev>...]"
-msgid "git bisect--helper --bisect-state (good|old) [<rev>...]"
-msgstr "git bisect--helper --bisect-state (good|old) [<rev>...]"
+msgid "git bisect skip [(<rev>|<range>)...]"
+msgstr "git bisect skip [(<rev>|<range>)...]"
-msgid "git bisect--helper --bisect-replay <filename>"
-msgstr "git bisect--helper --bisect-replay <filename>"
+msgid "git bisect reset [<commit>]"
+msgstr "git bisect reset [<comissió>]"
-msgid "git bisect--helper --bisect-skip [(<rev>|<range>)...]"
-msgstr "git bisect--helper --bisect-skip [(<rev>|<range>)...]"
+msgid "git bisect replay <logfile>"
+msgstr "git bisect replay <logfile>"
-msgid "git bisect--helper --bisect-run <cmd>..."
-msgstr "git bisect--helper --bisect-run <ordre>..."
+msgid "git bisect run <cmd>..."
+msgstr "git bisect run <ordre>..."
#, c-format
msgid "cannot open file '%s' in mode '%s'"
@@ -2408,7 +2431,7 @@ msgid ""
"could not check out original HEAD '%s'. Try 'git bisect reset <commit>'."
msgstr ""
"no s'ha pogut agafar la HEAD original «%s». Proveu «git bisect reset "
-"<commit>»."
+"<comissió>»."
#, c-format
msgid "Bad bisect_write argument: %s"
@@ -2516,9 +2539,6 @@ msgid "checking out '%s' failed. Try 'git bisect start <valid-branch>'."
msgstr ""
"l'agafament de «%s» ha fallat. Proveu «git bisect start <branca-vàlida>»."
-msgid "won't bisect on cg-seek'ed tree"
-msgstr "no es bisecarà en un arbre en el qual s'ha fet cg-seek"
-
msgid "bad HEAD - strange symbolic ref"
msgstr "HEAD incorrecte - referència simbòlica estranya"
@@ -2570,7 +2590,7 @@ msgid "bisect run failed: no command provided."
msgstr "ha fallat l'execució de bisect: no s'ha proporcionat cap ordre."
#, c-format
-msgid "unable to verify '%s' on good revision"
+msgid "unable to verify %s on good revision"
msgstr "no s'ha pogut verificar «%s» en una bona revisió"
#, c-format
@@ -2578,10 +2598,10 @@ msgid "bogus exit code %d for good revision"
msgstr "codi d'error de sortida %d per a una bona revisió"
#, c-format
-msgid "bisect run failed: exit code %d from '%s' is < 0 or >= 128"
+msgid "bisect run failed: exit code %d from %s is < 0 or >= 128"
msgstr ""
-"l'execució de la de bisecció ha fallat: codi de sortida %d de «%s» és < 0 o "
-">= 128"
+"l'execució de la de bisecció ha fallat: codi de sortida %d de %s és < 0 o >= "
+"128"
#, c-format
msgid "cannot open file '%s' for writing"
@@ -2590,76 +2610,50 @@ msgstr "no es pot obrir «%s» per a escriptura"
msgid "bisect run cannot continue any more"
msgstr "l'execució de la bisecció no pot continuar més"
-#, c-format
msgid "bisect run success"
msgstr "execució de bisecció amb èxit"
-#, c-format
msgid "bisect found first bad commit"
msgstr "la bisecció ha trobat una primera comissió errònia"
#, c-format
-msgid ""
-"bisect run failed: 'git bisect--helper --bisect-state %s' exited with error "
-"code %d"
+msgid "bisect run failed: 'git bisect %s' exited with error code %d"
msgstr ""
-"l'execució de la bisecció ha fallat: «git bisect--helper --bisect-state %s» "
-"ha sortit amb el codi d'error %d"
-
-msgid "reset the bisection state"
-msgstr "restableix l'estat de la bisecció"
-
-msgid "check whether bad or good terms exist"
-msgstr "comprova si existeixen termes correctes o incorrectes"
-
-msgid "print out the bisect terms"
-msgstr "imprimeix els termes de la bisecció"
-
-msgid "start the bisect session"
-msgstr "inicia la sessió bisecció"
-
-msgid "find the next bisection commit"
-msgstr "troba la comissió de bisecció següent"
+"ha fallat l'execució del bisect: «git bisect %s» ha sortit amb el codi "
+"d'error %d"
-msgid "mark the state of ref (or refs)"
-msgstr "marca l'estat de la referència o referències"
-
-msgid "list the bisection steps so far"
-msgstr "mostra les passes de la bisecció fins ara"
-
-msgid "replay the bisection process from the given file"
-msgstr "torna a reproduir el procés de bisecció des del fitxer donat"
-
-msgid "skip some commits for checkout"
-msgstr "omet algunes comissions en agafar"
-
-msgid "visualize the bisection"
-msgstr "visualitza la bisecció"
-
-msgid "use <cmd>... to automatically bisect"
-msgstr "useu <cmd>... per a fer una bisecció automàticament"
+#, c-format
+msgid "'%s' requires either no argument or a commit"
+msgstr "«%s» no requereix cap argument ni comissió"
-msgid "no log for BISECT_WRITE"
-msgstr "no hi ha registre per a BISECT_WRITE"
+#, c-format
+msgid "'%s' requires 0 or 1 argument"
+msgstr "%s requereix 0 o 1 arguments"
-msgid "--bisect-reset requires either no argument or a commit"
-msgstr "--bisect-reset no requereix cap argument ni comissió"
+#, c-format
+msgid "'%s' requires 0 arguments"
+msgstr "«%s» requereix 0 arguments"
-msgid "--bisect-terms requires 0 or 1 argument"
-msgstr "--bisect-terms requereix 0 o 1 argument"
+msgid "no logfile given"
+msgstr "no s'ha donat cap fitxer de registre"
-msgid "--bisect-next requires 0 arguments"
-msgstr "--bisect-next no requereix cap argument"
+#, c-format
+msgid "'%s' failed: no command provided."
+msgstr "«%s» ha fallat: no s'ha proporcionat cap ordre."
-msgid "--bisect-log requires 0 arguments"
-msgstr "--bisect-log no requereix cap argument"
+msgid "need a command"
+msgstr "cal una subordre"
-msgid "no logfile given"
-msgstr "no s'ha donat cap fitxer de registre"
+#, c-format
+msgid "unknown command: '%s'"
+msgstr "ordre desconeguda: «%s»"
msgid "git blame [<options>] [<rev-opts>] [<rev>] [--] <file>"
msgstr "git blame [<opcions>] [<opcions-de-revisió>] [<revisió>] [--] fitxer"
+msgid "git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>"
+msgstr "git annotate [<opcions>] [<rev-opts>] [<rev>] [--] <fitxer>"
+
msgid "<rev-opts> are documented in git-rev-list(1)"
msgstr "es documenten les <opcions-de-revisió> en git-rev-list(1)"
@@ -2799,11 +2793,11 @@ msgid ""
"git branch [<options>] [-f] [--recurse-submodules] <branch-name> [<start-"
"point>]"
msgstr ""
-"git branch [<options>] [-f] [--recurse-submodules] <branch-name> [<start-"
+"git branch [<opcions>] [-f] [--recurse-submodules] <branch-name> [<start-"
"point>]"
msgid "git branch [<options>] [-l] [<pattern>...]"
-msgstr "git branch [<options>] [-l] [<pattern>...]"
+msgstr "git branch [<opcions>] [-l] [<patró>...]"
msgid "git branch [<options>] [-r] (-d | -D) <branch-name>..."
msgstr "git branch [<opcions>] [-r] (-d | -D) <nom-de-branca>..."
@@ -2856,9 +2850,6 @@ msgstr "L'actualització del fitxer de configuració ha fallat"
msgid "cannot use -a with -d"
msgstr "no es pot usar -a amb -d"
-msgid "Couldn't look up commit object for HEAD"
-msgstr "No s'ha pogut trobar l'objecte de comissió de HEAD"
-
#, c-format
msgid "Cannot delete branch '%s' checked out at '%s'"
msgstr "No es pot suprimir la branca «%s» agafada a «%s»"
@@ -2897,16 +2888,18 @@ msgstr "S'està fent «rebase» en la branca %s a %s"
msgid "Branch %s is being bisected at %s"
msgstr "La branca %s s'està bisecant a %s"
-msgid "cannot copy the current branch while not on any."
-msgstr "no es pot copiar branca actual mentre no s'és a cap."
-
-msgid "cannot rename the current branch while not on any."
-msgstr "no es pot canviar el nom de la branca actual mentre no s'és a cap."
-
#, c-format
msgid "Invalid branch name: '%s'"
msgstr "Nom de branca no vàlid: «%s»"
+#, c-format
+msgid "No commit on branch '%s' yet."
+msgstr "Encara no hi ha cap comissió en la branca «%s»."
+
+#, c-format
+msgid "No branch named '%s'."
+msgstr "No hi ha cap branca amb nom «%s»."
+
msgid "Branch rename failed"
msgstr "El canvi de nom de branca ha fallat"
@@ -3039,7 +3032,7 @@ msgid "sorting and filtering are case insensitive"
msgstr "ordenació i filtratge distingeixen entre majúscules i minúscules"
msgid "recurse through submodules"
-msgstr "inclou recursivament als submòduls"
+msgstr "inclou recursivament els submòduls"
msgid "format to use for the output"
msgstr "format a usar en la sortida"
@@ -3069,13 +3062,11 @@ msgstr "No es pot donar descripció a una HEAD separada"
msgid "cannot edit description of more than one branch"
msgstr "no es pot editar la descripció de més d'una branca"
-#, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "Encara no hi ha cap comissió en la branca «%s»."
+msgid "cannot copy the current branch while not on any."
+msgstr "no es pot copiar branca actual mentre no s'és a cap."
-#, c-format
-msgid "No branch named '%s'."
-msgstr "No hi ha cap branca amb nom «%s»."
+msgid "cannot rename the current branch while not on any."
+msgstr "no es pot canviar el nom de la branca actual mentre no s'és a cap."
msgid "too many branches for a copy operation"
msgstr "hi ha massa branques per a una operació de còpia"
@@ -3116,7 +3107,7 @@ msgid ""
"Did you mean to use: -a|-r --list <pattern>?"
msgstr ""
"Les opcions -a i -r a «git branch» no prenen un nom de branca.\n"
-"Volíeu usar -a|-r --list <pattern>?"
+"Volíeu usar -a|-r --list <patró>?"
msgid ""
"the '--set-upstream' option is no longer supported. Please use '--track' or "
@@ -3143,11 +3134,11 @@ msgstr ""
"no s'està executant en un repositori de git - no hi ha lligams a mostrar\n"
msgid ""
-"git bugreport [-o|--output-directory <file>] [-s|--suffix <format>] [--"
-"diagnose[=<mode>]"
+"git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--diagnose[=<mode>]]"
msgstr ""
-"git bugreport [-o|--output-directory <file>] [-s|--suffix <format>] [--"
-"diagnose[=<mode>]"
+"git bugreport [(-o | --output-directory) <camí>] [(-s | --suffix) <format>]\n"
+" [--diagnose[=<mode>]]"
msgid ""
"Thank you for filling out a Git bug report!\n"
@@ -3218,17 +3209,26 @@ msgstr "no s'ha pogut escriure a %s"
msgid "Created new report at '%s'.\n"
msgstr "S'ha creat un nou informe a «%s».\n"
-msgid "git bundle create [<options>] <file> <git-rev-list args>"
-msgstr "git bundle create [<opcions>] <fitxer> <git-rev-list args>"
+msgid ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<version>] <file> <git-rev-list-args>"
+msgstr ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<versió>] <fitxer> <git-rev-list-args>"
-msgid "git bundle verify [<options>] <file>"
-msgstr "git bundle verify [<opcions>] <fitxer>"
+msgid "git bundle verify [-q | --quiet] <file>"
+msgstr "git bundle verify [-q | --quiet] <fitxer>"
msgid "git bundle list-heads <file> [<refname>...]"
msgstr "git bundle list-heads <fitxer> [<refname>...]"
-msgid "git bundle unbundle <file> [<refname>...]"
-msgstr "git bundle unbundle <fitxer> [<refname>...]"
+msgid "git bundle unbundle [--progress] <file> [<refname>...]"
+msgstr "git bundle unbundle [--progress] <fitxer> [<refname>...]"
+
+msgid "need a <file> argument"
+msgstr "necessita un argument <fitxer>"
msgid "do not show progress meter"
msgstr "no mostris l'indicador de progrés"
@@ -3283,32 +3283,28 @@ msgstr "%s requereix arguments"
msgid "%s takes no arguments"
msgstr "%s no accepta cap valor"
-#, c-format
-msgid "unknown command: '%s'"
-msgstr "ordre desconeguda: «%s»"
-
msgid "only one batch option may be specified"
msgstr "només es pot especificar una opció per lots"
msgid "git cat-file <type> <object>"
-msgstr "git cat-file <type> <object>"
+msgstr "git cat-file <tipus> <objecte>"
msgid "git cat-file (-e | -p) <object>"
-msgstr "git cat-file (-e | -p) <object>"
+msgstr "git cat-file (-e | -p) <objecte>"
msgid "git cat-file (-t | -s) [--allow-unknown-type] <object>"
-msgstr "git cat-file (-t | -s) [--allow-unknown-type] <object>"
+msgstr "git cat-file (-t | -s) [--allow-unknown-type] <objecte>"
msgid ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgstr ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgid ""
"git cat-file (--textconv | --filters)\n"
@@ -3321,7 +3317,7 @@ msgid "Check object existence or emit object contents"
msgstr "Comprova l'existència de l'objecte o emet el contingut de l'objecte"
msgid "check if <object> exists"
-msgstr "comprova si <object> existeix"
+msgstr "comprova si <objecte> existeix"
msgid "pretty-print <object> content"
msgstr "impressió embellida del contingut de l'<objecte>"
@@ -3390,7 +3386,7 @@ msgid "blob|tree"
msgstr "blob|tree"
msgid "use a <path> for (--textconv | --filters); Not with 'batch'"
-msgstr "useu un <path> per a (--textconv | --filters); no amb «batch»"
+msgstr "useu un <camí> per a (--textconv | --filters); no amb «batch»"
#, c-format
msgid "'%s=<%s>' needs '%s' or '%s'"
@@ -3416,20 +3412,23 @@ msgstr "<rev> requerida amb «%s»"
#, c-format
msgid "<object> required with '-%c'"
-msgstr "<object> requerit amb «-%c»"
-
-msgid "too many arguments"
-msgstr "hi ha massa arguments"
+msgstr "<objecte> requerit amb «-%c»"
#, c-format
msgid "only two arguments allowed in <type> <object> mode, not %d"
-msgstr "només es permeten dos arguments en el mode <type> <object>, no %d"
+msgstr "només es permeten dos arguments en el mode <tipus> <objecte>, no %d"
-msgid "git check-attr [-a | --all | <attr>...] [--] <pathname>..."
-msgstr "git check-attr [-a | --all | <atribut>...] [--] <nom-de-camí>..."
+msgid ""
+"git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] "
+"<pathname>..."
+msgstr ""
+"git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] "
+"<pathname>..."
-msgid "git check-attr --stdin [-z] [-a | --all | <attr>...]"
-msgstr "git check-attr --stdin [-z] [-a | --all | <atribut>...]"
+msgid ""
+"git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]"
+msgstr ""
+"git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]"
msgid "report all attributes set on file"
msgstr "informa de tots els atributs establerts en el fitxer"
@@ -3443,6 +3442,12 @@ msgstr "llegeix els noms de fitxer de stdin"
msgid "terminate input and output records by a NUL character"
msgstr "acaba els registres d'entrada i de sortida amb un caràcter NUL"
+msgid "<tree-ish>"
+msgstr "<tree-ish>"
+
+msgid "which tree-ish to check attributes at"
+msgstr "a quin tree-ish s'han de comprovar els atributs"
+
msgid "suppress progress reporting"
msgstr "omet els informes de progrés"
@@ -3533,7 +3538,7 @@ msgid "git checkout [<options>] [<branch>] -- <file>..."
msgstr "git checkout [<opcions>] [<branca>] -- <fitxer>..."
msgid "git switch [<options>] [<branch>]"
-msgstr "git switch [<options>] [<branch>]"
+msgstr "git switch [<opcions>] [<branca>]"
msgid "git restore [<options>] [--source=<branch>] <file>..."
msgstr "git restore [<opcions>] [--source=<branca>] <fitxer>..."
@@ -3955,9 +3960,11 @@ msgid "use overlay mode"
msgstr "utilitza el mode de superposició"
msgid ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] "
+"[<pathspec>...]"
msgstr ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <patró>] [-x | -X] [--] <camins>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <patró>] [-x | -X] [--] "
+"[<pathspec>...]"
#, c-format
msgid "Removing %s\n"
@@ -4021,7 +4028,7 @@ msgstr ""
"* - tria tots els ítems\n"
" - (buit) finalitza la selecció\n"
-#, c-format, perl-format
+#, c-format
msgid "Huh (%s)?\n"
msgstr "Perdó (%s)?\n"
@@ -4170,9 +4177,6 @@ msgstr "profunditat"
msgid "create a shallow clone of that depth"
msgstr "crea un clon superficial d'aquesta profunditat"
-msgid "time"
-msgstr "data"
-
msgid "create a shallow clone since a specific time"
msgstr "crea un clon superficial des d'una data específica"
@@ -4250,6 +4254,10 @@ msgid "failed to start iterator over '%s'"
msgstr "no s'ha pogut iniciar l'iterador sobre «%s»"
#, c-format
+msgid "symlink '%s' exists, refusing to clone with --local"
+msgstr "l'enllaç simbòlic «%s» existeix, es nega a clonar amb --local"
+
+#, c-format
msgid "failed to unlink '%s'"
msgstr "s'ha produït un error en desenllaçar «%s»"
@@ -4315,10 +4323,6 @@ msgstr "Hi ha massa arguments."
msgid "You must specify a repository to clone."
msgstr "Heu d'especificar un repositori per a clonar."
-#, c-format
-msgid "options '%s' and '%s %s' cannot be used together"
-msgstr "les opcions «%s» i «%s %s» no es poden usar juntes"
-
msgid ""
"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
"exclude"
@@ -4405,6 +4409,9 @@ msgstr "no s'ha pogut inicialitzar el repositori, s'omet l'URI del paquet"
msgid "failed to fetch objects from bundle URI '%s'"
msgstr "no s'han pogut obtenir els objectes de l'URI del paquet «%s»"
+msgid "failed to fetch advertised bundles"
+msgstr "no s'han pogut obtenir els paquets anunciats"
+
msgid "remote transport reported error"
msgstr "el transport remot ha informat d'un error"
@@ -4440,18 +4447,24 @@ msgid "--command must be the first argument"
msgstr "--command ha de ser el primer argument"
msgid ""
-"git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"
+"git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]"
msgstr ""
-"git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"
+"git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]"
msgid ""
-"git commit-graph write [--object-dir <objdir>] [--append] [--"
-"split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] <split options>"
+"git commit-graph write [--object-dir <dir>] [--append]\n"
+" [--split[=<strategy>]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <split options>"
msgstr ""
-"git commit-graph write [--object-dir <objdir>] [--append] [--"
-"split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] <split options>"
+"git commit-graph write [--object-dir <dir>] [--append]\n"
+" [--split[=<strategy>]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <split options>"
msgid "dir"
msgstr "directori"
@@ -4520,12 +4533,15 @@ msgstr "usa com a màxim un --reachable, --stdin-commits, o --stdin-packs"
msgid "Collecting commits from input"
msgstr "S'estan recollint les comissions de l'entrada"
+msgid "git commit-tree <tree> [(-p <parent>)...]"
+msgstr "git commit-tree <tree> [(-p <pare>)...]"
+
msgid ""
-"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...] [(-F "
-"<file>)...] <tree>"
+"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n"
+" [(-F <file>)...] <tree>"
msgstr ""
-"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...] [(-F "
-"<file>)...] <tree>"
+"git commit-tree [(-p <pare>)...] [-S[<keyid>]] [(-m <missatge>)...]\n"
+" [(-F <fitxer>)...] <tree>"
#, c-format
msgid "duplicate parent %s ignored"
@@ -4567,11 +4583,29 @@ msgstr "ha de donar exactament un arbre"
msgid "git commit-tree: failed to read"
msgstr "git commit-tree: ha fallat en llegir"
-msgid "git commit [<options>] [--] <pathspec>..."
-msgstr "git commit [<opcions>] [--] <especificació-de-camí>..."
+msgid ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|"
+"reword):]<commit>)]\n"
+" [-F <file> | -m <msg>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n"
+" [--date=<date>] [--cleanup=<mode>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <comissió> | --fixup [(amend|"
+"reword):]<comissió>)]\n"
+" [-F <fitxer> | -m <msg>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n"
+" [--date=<date>] [--cleanup=<mode>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<fitxer> [--pathspec-file-nul]]\n"
+" [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]\n"
+" [--] [<pathspec>...]"
-msgid "git status [<options>] [--] <pathspec>..."
-msgstr "git status [<opcions>] [--] <especificació-de-camí>..."
+msgid "git status [<options>] [--] [<pathspec>...]"
+msgstr "git status [<opcions>] [--] [<pathspec>...]"
msgid ""
"You asked to amend the most recent commit, but doing so would make\n"
@@ -5352,11 +5386,18 @@ msgid "unable to get credential storage lock in %d ms"
msgstr ""
"no s'ha pogut obtenir el bloqueig de l'emmagatzematge de credencials en %d ms"
-msgid "git describe [<options>] [<commit-ish>...]"
-msgstr "git describe [<opcions>] [<comissió>...]"
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]"
+
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]"
-msgid "git describe [<options>] --dirty"
-msgstr "git describe [<opcions>] --dirty"
+msgid "git describe <blob>"
+msgstr "git describe <blob>"
msgid "head"
msgstr "davant per"
@@ -5479,11 +5520,11 @@ msgid "option '%s' and commit-ishes cannot be used together"
msgstr "les opcions «%s» i de comissió no es poden usar juntes"
msgid ""
-"git diagnose [-o|--output-directory <path>] [-s|--suffix <format>] [--"
-"mode=<mode>]"
+"git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--mode=<mode>]"
msgstr ""
-"git diagnose [-o|--output-directory <path>] [-s|--suffix <format>] [--"
-"mode=<mode>]"
+"git diagnose [(-o | --output-directory) <camí>] [(-s | --suffix) <format>]\n"
+" [--mode=<mode>]"
msgid "specify a destination for the diagnostics archive"
msgstr "especifiqueu una destinació per a l'arxiu de diagnòstic"
@@ -5501,6 +5542,9 @@ msgstr "--merge-base només funciona amb dues comissions"
msgid "'%s': not a regular file or symlink"
msgstr "«%s»: no és ni fitxer regular ni enllaç simbòlic"
+msgid "no merge given, only parents."
+msgstr "no s'ha donat cap fusió, només els pares."
+
#, c-format
msgid "invalid option: %s"
msgstr "opció no vàlida: %s"
@@ -5529,7 +5573,7 @@ msgid "%s...%s: multiple merge bases, using %s"
msgstr "%s...%s: múltiples bases de fusió, utilitzant %s"
msgid "git difftool [<options>] [<commit> [<commit>]] [--] [<path>...]"
-msgstr "git difftool [<opcions>] [<commit> [<commit>]] [--] [<camí>...]"
+msgstr "git difftool [<opcions>] [<comissió> [<comissió>]] [--] [<camí>...]"
#, c-format
msgid "could not read symlink %s"
@@ -5616,27 +5660,6 @@ msgstr "no s'ha proporcionat l'<eina> per a --tool=<eina>"
msgid "no <cmd> given for --extcmd=<cmd>"
msgstr "no s'ha proporcionat l'<ordre> per a --extcmd=<ordre>"
-msgid "git env--helper --type=[bool|ulong] <options> <env-var>"
-msgstr "git env--helper --type=[bool|ulong] <opcions> <env-var>"
-
-msgid "default for git_env_*(...) to fall back on"
-msgstr "valor per defecte per a git_env_*(...) en cas d'absència"
-
-msgid "be quiet only use git_env_*() value as exit code"
-msgstr "silenciós només utilitza el valor git_env_*() com a codi de sortida"
-
-#, c-format
-msgid "option `--default' expects a boolean value with `--type=bool`, not `%s`"
-msgstr "l'opció «--default» espera un valor booleà amb «--type=bool», no «%s»"
-
-#, c-format
-msgid ""
-"option `--default' expects an unsigned long value with `--type=ulong`, not "
-"`%s`"
-msgstr ""
-"l'opció «--default» espera un valor llarg sense signe amb «--type=ulong», no "
-"«%s»"
-
msgid "git fast-export [<rev-list-opts>]"
msgstr "git fast-export [<rev-list-opts>]"
@@ -6046,6 +6069,10 @@ msgstr "no s'admet una profunditat negativa en --deepen"
msgid "--unshallow on a complete repository does not make sense"
msgstr "--unshallow en un repositori complet no té sentit"
+#, c-format
+msgid "failed to fetch bundles from '%s'"
+msgstr "no s'han pogut obtenir els paquets de «%s»"
+
msgid "fetch --all does not take a repository argument"
msgstr "fetch --all no accepta un argument de repositori"
@@ -6108,7 +6135,7 @@ msgid "git for-each-ref [--points-at <object>]"
msgstr "git for-each-ref [--points-at <objecte>]"
msgid "git for-each-ref [--merged [<commit>]] [--no-merged [<commit>]]"
-msgstr "git for-each-ref [--merged [<commit>]] [--no-merged [<commit>]]"
+msgstr "git for-each-ref [--merged [<comissió>]] [--no-merged [<comissió>]]"
msgid "git for-each-ref [--contains [<commit>]] [--no-contains [<commit>]]"
msgstr ""
@@ -6149,8 +6176,8 @@ msgstr "imprimeix només les referències que continguin la comissió"
msgid "print only refs which don't contain the commit"
msgstr "imprimeix només les referències que no continguin la comissió"
-msgid "git for-each-repo --config=<config> <command-args>"
-msgstr "git for-each-repo --config=<config> <command-args>"
+msgid "git for-each-repo --config=<config> [--] <arguments>"
+msgstr "git for-each-repo --config=<config> [--] <arguments>"
msgid "config"
msgstr "config"
@@ -6321,8 +6348,16 @@ msgstr "un no arbre en l'arbre de la memòria cau"
msgid "%s: invalid sha1 pointer in resolve-undo"
msgstr "%s: el punter sha1 no és vàlid a «resolve-undo»"
-msgid "git fsck [<options>] [<object>...]"
-msgstr "git fsck [<opcions>] [<objecte>...]"
+msgid ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<object>...]"
+msgstr ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<objecte>...]"
msgid "show unreachable objects"
msgstr "mostra els objectes inabastables"
@@ -6372,16 +6407,10 @@ msgid "invalid parameter: expected sha1, got '%s'"
msgstr "paràmetre no vàlid: s'esperava sha1, s'ha obtingut «%s»"
msgid "git fsmonitor--daemon start [<options>]"
-msgstr "git fsmonitor--daemon start [<options>]"
+msgstr "git fsmonitor--daemon start [<opcions>]"
msgid "git fsmonitor--daemon run [<options>]"
-msgstr "git fsmonitor--daemon run [<options>]"
-
-msgid "git fsmonitor--daemon stop"
-msgstr "git fsmonitor--daemon stop"
-
-msgid "git fsmonitor--daemon status"
-msgstr "git fsmonitor--daemon status"
+msgstr "git fsmonitor--daemon run [<opcions>]"
#, c-format
msgid "value of '%s' out of range: %d"
@@ -6576,7 +6605,7 @@ msgid "failed to finish 'git pack-objects' process"
msgstr "no s'ha pogut finalitzar el procés «git pack-objects»"
msgid "failed to write multi-pack-index"
-msgstr "no s'han pogut escriu l'índex del multipaquet"
+msgstr "no s'ha pogut escriure l'índex del multipaquet"
msgid "'git multi-pack-index expire' failed"
msgstr "ha fallat el venciment de «git multi-pack-index expire»"
@@ -6627,8 +6656,20 @@ msgstr "executa una tasca específica"
msgid "use at most one of --auto and --schedule=<frequency>"
msgstr "usa com a màxim un entre --auto i --schedule=<frequency>"
-msgid "failed to run 'git config'"
-msgstr "no s'ha pogut executar «git config»"
+#, c-format
+msgid "unable to add '%s' value of '%s'"
+msgstr "no es pot afegir el valor «%s» de «%s»"
+
+msgid "return success even if repository was not registered"
+msgstr "retorna èxit encara que el repositori no estigui registrat"
+
+#, c-format
+msgid "unable to unset '%s' value of '%s'"
+msgstr "no es pot desassignar el valor «%s» de «%s»"
+
+#, c-format
+msgid "repository '%s' is not registered"
+msgstr "el repositori «%s» no està registrat"
#, c-format
msgid "failed to expand path '%s'"
@@ -6710,7 +6751,7 @@ msgid "failed to add repo to global config"
msgstr "no s'ha pogut afegir un repositori a la configuració global"
msgid "git maintenance <subcommand> [<options>]"
-msgstr "git maintenance <subcommand> [<options>]"
+msgstr "git maintenance <subcommand> [<opcions>]"
msgid "git grep [<options>] [-e] <pattern> [<rev>...] [[--] <path>...]"
msgstr "git grep [<opcions>] [-e] <patró> [<revisió>...] [[--] <camí>...]"
@@ -6922,11 +6963,14 @@ msgid "both --cached and trees are given"
msgstr "ambdós --cached i arbres venen donats"
msgid ""
-"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters] [--stdin] "
-"[--] <file>..."
+"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]\n"
+" [--stdin [--literally]] [--] <file>..."
msgstr ""
-"git hash-object [-t <tipus>] [-w] [--path=<fitxer> | --no-filters] [--stdin] "
-"[--] <fitxer>..."
+"git hash-object [-t <tipus>] [-w] [--path=<fitxer> | --no-filters]\n"
+" [--stdin [--literally]] [--] <fitxer>..."
+
+msgid "git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]"
+msgstr "git hash-object [-t <tipus>] [-w] --stdin-paths [--no-filters]"
msgid "object type"
msgstr "tipus d'objecte"
@@ -7061,12 +7105,19 @@ msgstr "ús: %s%s"
msgid "'git help config' for more information"
msgstr "«git help config» per a més informació"
-msgid "git hook run [--ignore-missing] <hook-name> [-- <hook-args>]"
-msgstr "git hook run [--ignore-missing] <hook-name> [-- <hook-args>]"
+msgid ""
+"git hook run [--ignore-missing] [--to-stdin=<path>] <hook-name> [-- <hook-"
+"args>]"
+msgstr ""
+"git hook run [--ignore-missing] [--to-stdin=<camí>] <hook-name> [-- <hook-"
+"args>]"
msgid "silently ignore missing requested <hook-name>"
msgstr "ignora silenciosament la sol·licitud <hook-name> perduda"
+msgid "file to read into hooks' stdin"
+msgstr "fitxer per a llegir a l'entrada estàndard dels lligams"
+
#, c-format
msgid "object type mismatch at %s"
msgstr "hi ha una discordança de tipus d'objecte a %s"
@@ -7357,11 +7408,15 @@ msgid "Initialized empty Git repository in %s%s\n"
msgstr "S'ha inicialitzat un repositori buit del Git en %s%s\n"
msgid ""
-"git init [-q | --quiet] [--bare] [--template=<template-directory>] [--"
-"shared[=<permissions>]] [<directory>]"
+"git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
+" [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+" [-b <branch-name> | --initial-branch=<branch-name>]\n"
+" [--shared[=<permissions>]] [<directory>]"
msgstr ""
-"git init [-q | --quiet] [--bare] [--template=<directori-de-plantilla>] [--"
-"shared[=<permisos>]] [<directori>]"
+"git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
+" [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+" [-b <branch-name> | --initial-branch=<branch-name>]\n"
+" [--shared[=<permissions>]] [<directory>]"
msgid "permissions"
msgstr "permisos"
@@ -7403,11 +7458,13 @@ msgid "--separate-git-dir incompatible with bare repository"
msgstr "--separate-git-dir és incompatible amb un repositori nu"
msgid ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<token>[(=|:)<value>])...] [<file>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <token>[(=|:)<value>])...]\n"
+" [--parse] [<file>...]"
msgstr ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<testimoni>[(=|:)<valor>])...] [<fitxer>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <token>[(=|:)<value>])...]\n"
+" [--parse] [<fitxer>...]"
msgid "edit files in place"
msgstr "edita els fitxers in situ"
@@ -7481,14 +7538,14 @@ msgid ""
"<file>"
msgstr ""
"traça l'evolució del rang de línia <start>,<end> o funcions :<funcname> a "
-"<file>"
+"<fitxer>"
#, c-format
msgid "unrecognized argument: %s"
msgstr "argument no reconegut: %s"
msgid "-L<range>:<file> cannot be used with pathspec"
-msgstr "-L<range>:<file> no es pot usar amb una especificació de camí"
+msgstr "-L<range>:<fitxer> no es pot usar amb una especificació de camí"
#, c-format
msgid "Final output: %d %s\n"
@@ -7857,7 +7914,7 @@ msgid "skip files matching pattern"
msgstr "omet els fitxers coincidents amb el patró"
msgid "read exclude patterns from <file>"
-msgstr "llegeix els patrons des de <file>"
+msgstr "llegeix els patrons des de <fitxer>"
msgid "read additional per-directory exclude patterns in <file>"
msgstr "llegeix els patrons addicionals d'exclusió per directori en <fitxer>"
@@ -7896,12 +7953,12 @@ msgstr ""
msgid ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<repository> [<refs>...]]"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n"
+" [--symref] [<repository> [<patterns>...]]"
msgstr ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<repository> [<refs>...]]"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n"
+" [--symref] [<repository> [<patterns>...]]"
msgid "do not print remote URL"
msgstr "no imprimeixis l'URL remot"
@@ -7982,7 +8039,7 @@ msgstr "--format no es pot combinar amb altres opcions d'alteració de format"
#. TRANSLATORS: keep <> in "<" mail ">" info.
msgid "git mailinfo [<options>] <msg> <patch> < mail >info"
-msgstr "git mailinfo [<options>] <msg> <patch> < mail >info"
+msgstr "git mailinfo [<opcions>] <msg> <pedaç> < mail >info"
msgid "keep subject"
msgstr "mantén l'assumpte"
@@ -8030,12 +8087,12 @@ msgstr "git merge-base [-a | --all] <comissió> <comissió>..."
msgid "git merge-base [-a | --all] --octopus <commit>..."
msgstr "git merge-base [-a | --all] --octopus <comissió>..."
-msgid "git merge-base --independent <commit>..."
-msgstr "git merge-base --independent <comissió>..."
-
msgid "git merge-base --is-ancestor <commit> <commit>"
msgstr "git merge-base --is-ancestor <comissió> <comissió>"
+msgid "git merge-base --independent <commit>..."
+msgstr "git merge-base --independent <comissió>..."
+
msgid "git merge-base --fork-point <ref> [<commit>]"
msgstr "git merge-base --fork-point <referència> [<comissió>]"
@@ -8124,7 +8181,7 @@ msgid "failure to merge"
msgstr "s'ha produït un error en fusionar"
msgid "git merge-tree [--write-tree] [<options>] <branch1> <branch2>"
-msgstr "git merge-tree [--write-tree] [<options>] <branch1> <branch2>"
+msgstr "git merge-tree [--write-tree] [<opcions>] <branch1> <branch2>"
msgid "git merge-tree [--trivial-merge] <base-tree> <branch1> <branch2>"
msgstr "git merge-tree [--trivial-merge] <base-tree> <branch1> <branch2>"
@@ -8144,9 +8201,26 @@ msgstr "llista els noms de fitxer sense modes/oids/stages"
msgid "allow merging unrelated histories"
msgstr "permet fusionar històries no relacionades"
+msgid "perform multiple merges, one per line of input"
+msgstr "realitza múltiples fusions, una per línia d'entrada"
+
+msgid "specify a merge-base for the merge"
+msgstr "cal especificar una referència base per a la fusió"
+
msgid "--trivial-merge is incompatible with all other options"
msgstr "--trivial-merge és incompatible amb totes les altres opcions"
+msgid "--merge-base is incompatible with --stdin"
+msgstr "--merge-base és incompatible amb --stdin"
+
+#, c-format
+msgid "malformed input line: '%s'."
+msgstr "línia d'entrada mal formada: «%s»."
+
+#, c-format
+msgid "merging cannot continue; got unclean result of %d"
+msgstr "la fusió no pot continuar; s'ha obtingut un resultat no net de %d"
+
msgid "git merge [<options>] [<commit>...]"
msgstr "git merge [<opcions>] [<comissió>...]"
@@ -8492,8 +8566,8 @@ msgid ""
"git multi-pack-index [<options>] write [--preferred-pack=<pack>][--refs-"
"snapshot=<path>]"
msgstr ""
-"git multi-pack-index [<options>] write [--preferred-pack=<pack>][--refs-"
-"snapshot=<path>]"
+"git multi-pack-index [<opcions>] write [--preferred-pack=<pack>][--refs-"
+"snapshot=<camí>]"
msgid "git multi-pack-index [<options>] verify"
msgstr "git multi-pack-index [<opcions>] verify"
@@ -8622,7 +8696,7 @@ msgid "git name-rev [<options>] --all"
msgstr "git name-rev [<opcions>] --all"
msgid "git name-rev [<options>] --annotate-stdin"
-msgstr "git name-rev [<options>] --annotate-stdin"
+msgstr "git name-rev [<opcions>] --annotate-stdin"
msgid "print only ref-based names (no object names)"
msgstr "imprimeix només els noms basats en referències (no els noms d'objecte)"
@@ -8772,10 +8846,6 @@ msgid "cannot read note data from non-blob object '%s'."
msgstr "no es poden llegir les dades de node de l'objecte no de blob «%s»."
#, c-format
-msgid "malformed input line: '%s'."
-msgstr "línia d'entrada mal formada: «%s»."
-
-#, c-format
msgid "failed to copy notes from '%s' to '%s'"
msgstr "s'ha produït un error en copiar les notes de «%s» a «%s»"
@@ -8968,17 +9038,13 @@ msgstr "usa les notes de <referència-de-notes>"
msgid "unknown subcommand: `%s'"
msgstr "subordre desconeguda: «%s»"
-msgid ""
-"git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"
-msgstr ""
-"git pack-objects --stdout [<opcions>...] [< <llista-de-referències> | < "
-"<llista-de-objectes>]"
+msgid "git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"
+msgstr "git pack-objects --stdout [<opcions>] [< <ref-list> | < <object-list>]"
msgid ""
-"git pack-objects [<options>...] <base-name> [< <ref-list> | < <object-list>]"
+"git pack-objects [<options>] <base-name> [< <ref-list> | < <object-list>]"
msgstr ""
-"git pack-objects [<opcions>...] <nom-base> [< <llista-de-referències> | < "
-"<llista-de-objectes>]"
+"git pack-objects [<opcions>] <base-name> [< <ref-list> | < <object-list>]"
#, c-format
msgid ""
@@ -9369,8 +9435,8 @@ msgstr ""
"i feu-nos saber que encara l'useu enviant un correu electrònic\n"
"a <git@vger.kernel.org>. Gràcies.\n"
-msgid "git pack-refs [<options>]"
-msgstr "git pack-refs [<opcions>]"
+msgid "git pack-refs [--all] [--no-prune]"
+msgstr "git pack-refs [--all] [--no-prune]"
msgid "pack everything"
msgstr "empaqueta-ho tot"
@@ -9378,6 +9444,18 @@ msgstr "empaqueta-ho tot"
msgid "prune loose refs (default)"
msgstr "poda les referències soltes (per defecte)"
+msgid "git patch-id [--stable | --unstable | --verbatim]"
+msgstr "git patch-id [--stable | --unstable | --verbatim]"
+
+msgid "use the unstable patch-id algorithm"
+msgstr "utilitza l'algorisme inestable de patch-id"
+
+msgid "use the stable patch-id algorithm"
+msgstr "utilitza l'algorisme estable de patch-id"
+
+msgid "don't strip whitespace from the patch"
+msgstr "no eliminis els espais en blanc del pedaç"
+
msgid "git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]"
msgstr "git prune [-n] [-v] [--progress] [--expire <data>] [--] [<head>...]"
@@ -9597,16 +9675,14 @@ msgstr ""
msgid ""
"\n"
-"To avoid automatically configuring upstream branches when their name\n"
-"doesn't match the local branch, see option 'simple' of branch."
-"autoSetupMerge\n"
+"To avoid automatically configuring an upstream branch when its name\n"
+"won't match the local branch, see option 'simple' of branch.autoSetupMerge\n"
"in 'git help config'.\n"
msgstr ""
"\n"
"Per a evitar configurar automàticament les branques font quan el seu nom\n"
-"no coincideix amb el de la branca local, vegeu l'opció «simple» de «branch."
-"autoSetupMerge»\n"
-"a «git help config».\n"
+"no coincideix amb el de la branca local, vegeu l'opció «simple» de\n"
+"«branch.autoSetupMerge» a «git help config».\n"
#, c-format
msgid ""
@@ -9764,6 +9840,13 @@ msgstr "S'està pujant a %s\n"
msgid "failed to push some refs to '%s'"
msgstr "s'ha produït un error en pujar algunes referències a «%s»"
+msgid ""
+"recursing into submodule with push.recurseSubmodules=only; using on-demand "
+"instead"
+msgstr ""
+"cerca recursivament en el submòdul amb push.recurseSubmodules=only; "
+"utilitzant «on-demand» en el seu lloc"
+
#, c-format
msgid "invalid value for '%s'"
msgstr "valor no vàlid per a «%s»"
@@ -9899,13 +9982,15 @@ msgid "need two commit ranges"
msgstr "calen dos rangs de comissió"
msgid ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>) "
-"[-u | -i]] [--no-sparse-checkout] [--index-output=<file>] (--empty | <tree-"
-"ish1> [<tree-ish2> [<tree-ish3>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
+"prefix=<prefix>)\n"
+" [-u | -i]] [--index-output=<file>] [--no-sparse-checkout]\n"
+" (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"
msgstr ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>) "
-"[-u | -i]] [--no-sparse-checkout] [--index-output=<file>] (--empty | <tree-"
-"ish1> [<tree-ish2> [<tree-ish3>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
+"prefix=<prefix>)\n"
+" [-u | -i]] [--index-output=<fitxer>] [--no-sparse-checkout]\n"
+" (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"
msgid "write resulting index to <file>"
msgstr "escriu l'índex resultant al <fitxer>"
@@ -9965,13 +10050,14 @@ msgid ""
"git rebase [-i] [options] [--exec <cmd>] [--onto <newbase> | --keep-base] "
"[<upstream> [<branch>]]"
msgstr ""
-"git rebase [-i] [options] [--exec <cmd>] [--onto <newbase> | --keep-base] "
-"[<upstream> [<branch>]]"
+"git rebase [-i] [options] [--exec <ordre>] [--onto <newbase> | --keep-base] "
+"[<upstream> [<branca>]]"
msgid ""
"git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>]"
msgstr ""
-"git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>]"
+"git rebase [-i] [options] [--exec <ordre>] [--onto <newbase>] --root "
+"[<branca>]"
#, c-format
msgid "could not read '%s'."
@@ -9995,8 +10081,8 @@ msgid "%s requires the merge backend"
msgstr "%s requereix un rerefons de fusió"
#, c-format
-msgid "could not get 'onto': '%s'"
-msgstr "no s'ha pogut obtenir «onto»: «%s»"
+msgid "invalid onto: '%s'"
+msgstr "no vàlid a: «%s»"
#, c-format
msgid "invalid orig-head: '%s'"
@@ -10047,6 +10133,9 @@ msgstr ""
msgid "could not switch to %s"
msgstr "no s'ha pogut commutar a %s"
+msgid "apply options and merge options cannot be used together"
+msgstr "les opcions apply i merge no es poden usar juntes"
+
#, c-format
msgid ""
"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and "
@@ -10257,7 +10346,7 @@ msgid ""
"and run me again. I am stopping in case you still have something\n"
"valuable there.\n"
msgstr ""
-"Sembla que ja exigeix un directori %s, i em pregunto\n"
+"Sembla que ja existeix un directori %s, i em pregunto\n"
"si esteu enmig d'un altre «rebase». Si aquest és el cas, proveu\n"
"\t%s\n"
"Si no és cas, feu:\n"
@@ -10275,8 +10364,19 @@ msgstr "Mode desconegut: %s"
msgid "--strategy requires --merge or --interactive"
msgstr "--strategy requereix --merge o --interactive"
-msgid "apply options and merge options cannot be used together"
-msgstr "les opcions apply i merge no es poden usar juntes"
+msgid ""
+"apply options are incompatible with rebase.autosquash. Consider adding --no-"
+"autosquash"
+msgstr ""
+"les opcions «apply» són incompatibles amb rebase.autosquash. Considereu "
+"afegir-hi --no-autosquash"
+
+msgid ""
+"apply options are incompatible with rebase.updateRefs. Consider adding --no-"
+"update-refs"
+msgstr ""
+"les opcions «apply» són incompatibles amb rebase.updateRefs. Considereu "
+"afegir-hi --no-update-refs"
#, c-format
msgid "Unknown rebase backend: %s"
@@ -10300,8 +10400,8 @@ msgstr "no existeix aquesta branca o comissió «%s»"
msgid "No such ref: %s"
msgstr "No hi ha tal referència: %s"
-msgid "Could not resolve HEAD to a revision"
-msgstr "No s'ha pogut resoldre HEAD a una revisió"
+msgid "Could not resolve HEAD to a commit"
+msgstr "No s'ha pogut resoldre HEAD com a una comissió"
#, c-format
msgid "'%s': need exactly one merge base with branch"
@@ -10498,7 +10598,7 @@ msgid ""
"git remote add [-t <branch>] [-m <master>] [-f] [--tags | --no-tags] [--"
"mirror=<fetch|push>] <name> <url>"
msgstr ""
-"git remote add [-t <branca>] [-m <mestra>] [-f] [--tags | --no-tags] [--"
+"git remote add [-t <branca>] [-m <master>] [-f] [--tags | --no-tags] [--"
"mirror=<fetch|push>] <nom> <url>"
msgid "git remote rename [--[no-]progress] <old> <new>"
@@ -10973,6 +11073,10 @@ msgid "could not close refs snapshot tempfile"
msgstr ""
"no s'ha pogut tancar el fitxer temporal amb la instantània de referències"
+#, c-format
+msgid "could not remove stale bitmap: %s"
+msgstr "no s'ha pogut eliminar el mapa de bits estancat: %s"
+
msgid "pack everything in a single pack"
msgstr "empaqueta-ho tot en un únic paquet"
@@ -11049,6 +11153,10 @@ msgstr "troba una progressió geomètrica amb el factor <N>"
msgid "write a multi-pack index of the resulting packs"
msgstr "escriu un índex multipaquet dels paquets resultants"
+msgid "pack prefix to store a pack containing pruned objects"
+msgstr ""
+"prefix del paquet per a emmagatzemar un paquet que contingui objectes podats"
+
msgid "cannot delete packs in a precious-objects repo"
msgstr "no es poden suprimir paquets en un repositori d'objectes preciosos"
@@ -11060,8 +11168,13 @@ msgid "pack prefix %s does not begin with objdir %s"
msgstr "el prefix de paquet %s no comença amb objdir %s"
#, c-format
-msgid "missing required file: %s"
-msgstr "falta el fitxer requerit: %s"
+msgid "renaming pack to '%s' failed"
+msgstr "el canvi del nom a «%s» ha fallat"
+
+#, c-format
+msgid "pack-objects did not write a '%s' file for pack %s-%s"
+msgstr ""
+"els objectes de paquet no han escrit a un fitxer «%s» per al paquet %s-%s"
#, c-format
msgid "could not unlink: %s"
@@ -11074,7 +11187,7 @@ msgid "git replace [-f] --edit <object>"
msgstr "git replace [-f] --edit <objecte>"
msgid "git replace [-f] --graft <commit> [<parent>...]"
-msgstr "git replace [-f] --graft <comissió> [<parent>...]"
+msgstr "git replace [-f] --graft <comissió> [<pare>...]"
msgid "git replace -d <object>..."
msgstr "git replace -d <objecte>..."
@@ -11255,8 +11368,10 @@ msgstr "--convert-graft-file arguments"
msgid "only one pattern can be given with -l"
msgstr "només es pot especificar un patró amb -l"
-msgid "git rerere [clear | forget <path>... | status | remaining | diff | gc]"
-msgstr "git rerere [clear | forget <camí>... | status | remaining | diff | gc]"
+msgid ""
+"git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
+msgstr ""
+"git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
msgid "register clean resolutions in index"
msgstr "registra les resolucions netes en l'índex"
@@ -11424,9 +11539,9 @@ msgid ""
"\n"
"Run \"git rev-parse --parseopt -h\" for more information on the first usage."
msgstr ""
-"git rev-parse --parseopt [<options>] -- [<args>...]\n"
+"git rev-parse --parseopt [<opcions>] -- [<args>...]\n"
" o bé: git rev-parse --sq-quote [<arg>...]\n"
-" o bé: git rev-parse [<options>] [<arg>...]\n"
+" o bé: git rev-parse [<opcions>] [<arg>...]\n"
"\n"
"Executeu «git rev-parse --parseopt -h» per a més informació sobre el primer "
"ús."
@@ -11461,6 +11576,15 @@ msgstr "--prefix requereix un argument"
msgid "unknown mode for --abbrev-ref: %s"
msgstr "mode desconegut per a --abbrev-ref: %s"
+msgid "--exclude-hidden cannot be used together with --branches"
+msgstr "--exclude-hidden no es pot utilitzar juntament amb --branches"
+
+msgid "--exclude-hidden cannot be used together with --tags"
+msgstr "--exclude-hidden no es pot utilitzar juntament amb --tags"
+
+msgid "--exclude-hidden cannot be used together with --remotes"
+msgstr "--exclude-hidden no es pot utilitzar juntament amb --remotes"
+
msgid "this operation must be run in a work tree"
msgstr "aquesta operació s'ha d'executar en un arbre de treball"
@@ -11468,17 +11592,25 @@ msgstr "aquesta operació s'ha d'executar en un arbre de treball"
msgid "unknown mode for --show-object-format: %s"
msgstr "mode desconegut per a --show-object-format: %s"
-msgid "git revert [<options>] <commit-ish>..."
-msgstr "git revert [<opcions>] <comissió>..."
+msgid ""
+"git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] "
+"<commit>..."
+msgstr ""
+"git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] "
+"<comissió>..."
-msgid "git revert <subcommand>"
-msgstr "git revert <subordre>"
+msgid "git revert (--continue | --skip | --abort | --quit)"
+msgstr "git revert (--continue | --skip | --abort | --quit)"
-msgid "git cherry-pick [<options>] <commit-ish>..."
-msgstr "git cherry-pick [<opcions>] <comissió>..."
+msgid ""
+"git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n"
+" [-S[<keyid>]] <commit>..."
+msgstr ""
+"git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n"
+" [-S[<keyid>]] <comissió>..."
-msgid "git cherry-pick <subcommand>"
-msgstr "git cherry-pick <subordre>"
+msgid "git cherry-pick (--continue | --skip | --abort | --quit)"
+msgstr "git cherry-pick (--continue | --skip | --abort | --quit)"
#, c-format
msgid "option `%s' expects a number greater than zero"
@@ -11539,8 +11671,14 @@ msgstr "la reversió ha fallat"
msgid "cherry-pick failed"
msgstr "el «cherry pick» ha fallat"
-msgid "git rm [<options>] [--] <file>..."
-msgstr "git rm [<opcions>] [--] <fitxer>..."
+msgid ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<fitxer> [--pathspec-file-nul]]\n"
+" [--] [<pathspec>...]"
msgid ""
"the following file has staged content different from both the\n"
@@ -11614,11 +11752,13 @@ msgid ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<host>:]<directory> (--all | <ref>...)"
msgstr ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<host>:]<directory> (--all | <ref>...)"
msgid "remote name"
@@ -11642,8 +11782,9 @@ msgstr "git log --pretty=short | git shortlog [<opcions>]"
msgid "using multiple --group options with stdin is not supported"
msgstr "no s'admet l'ús de múltiples opcions --group amb stdin"
-msgid "using --group=trailer with stdin is not supported"
-msgstr "no s'admet l'ús de --group=trailer amb stdin"
+#, c-format
+msgid "using %s with stdin is not supported"
+msgstr "no s'admet l'ús de %s amb stdin"
#, c-format
msgid "unknown group type: %s"
@@ -11682,12 +11823,14 @@ msgid ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<when>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<rev> | <glob>)...]"
msgstr ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<when>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<rev> | <glob>)...]"
msgid "git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]"
msgstr "git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<referència>]"
@@ -11787,11 +11930,13 @@ msgid "Unknown hash algorithm"
msgstr "Algorisme de resum desconegut"
msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<pattern>...]"
msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<patró>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<patró>...]"
msgid "git show-ref --exclude-existing[=<pattern>]"
msgstr "git show-ref --exclude-existing[=<patró>]"
@@ -11822,8 +11967,10 @@ msgstr "no imprimeixis els resultats a stdout (útil amb --verify)"
msgid "show refs from stdin that aren't in local repository"
msgstr "mostra les referències de stdin que no siguin en el repositori local"
-msgid "git sparse-checkout (init|list|set|add|reapply|disable) <options>"
-msgstr "git sparse-checkout (init|list|set|add|reapply|disable) <opcions>"
+msgid ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<options>]"
+msgstr ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<opcions>]"
msgid "this worktree is not sparse"
msgstr "aquest arbre de treball no és dispers"
@@ -11947,67 +12094,58 @@ msgstr ""
msgid "error while refreshing working directory"
msgstr "s'ha produït un error en actualitzar el directori de treball"
-msgid "git stash list [<options>]"
-msgstr "git stash list [<opcions>]"
+msgid "git stash list [<log-options>]"
+msgstr "git stash list [<log-options>]"
-msgid "git stash show [<options>] [<stash>]"
-msgstr "git stash show [<opcions>] [<stash>]"
+msgid ""
+"git stash show [-u | --include-untracked | --only-untracked] [<diff-"
+"options>] [<stash>]"
+msgstr ""
+"git stash show [-u | --include-untracked | --only-untracked] [<diff-"
+"options>] [<stash>]"
+
+msgid "git stash drop [-q | --quiet] [<stash>]"
+msgstr "git stash drop [-q | --quiet] [<stash>]"
-msgid "git stash drop [-q|--quiet] [<stash>]"
-msgstr "git stash drop [-q|--quiet] [<stash>]"
+msgid "git stash pop [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash pop [--index] [-q | --quiet] [<stash>]"
-msgid "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
+msgid "git stash apply [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash apply [--index] [-q | --quiet] [<stash>]"
msgid "git stash branch <branchname> [<stash>]"
msgstr "git stash branch <nom-de-branca> [<stash>]"
+msgid "git stash store [(-m | --message) <message>] [-q | --quiet] <commit>"
+msgstr ""
+"git stash store [(-m | --message) <missatge>] [-q | --quiet] <comissió>"
+
msgid ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"<message>]\n"
" [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
" [--] [<pathspec>...]]"
msgstr ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <missatge>]\n"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"<missatge>]\n"
" [--pathspec-from-file=<fitxer> [--pathspec-file-nul]]\n"
" [--] [<pathspec>...]]"
msgid ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<missatge>]"
-
-msgid "git stash pop [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash pop [--index] [-q|--quiet] [<stash>]"
-
-msgid "git stash apply [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash apply [--index] [-q|--quiet] [<stash>]"
-
-msgid "git stash store [-m|--message <message>] [-q|--quiet] <commit>"
-msgstr "git stash store [-m|--message <missatge>] [-q|--quiet] <commit>"
-
-msgid ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
-" [--] [<pathspec>...]]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<message>]"
msgstr ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <missatge>]\n"
-" [--] [<pathspec>...]]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<missatge>]"
-msgid ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<missatge>]"
+msgid "git stash create [<message>]"
+msgstr "git stash create [<missatge>]"
#, c-format
msgid "'%s' is not a stash-like commit"
@@ -12223,7 +12361,7 @@ msgid "suppress output of entering each submodule command"
msgstr "omet la sortida en entrar a cada ordre del submòdul"
msgid "recurse into nested submodules"
-msgstr "inclou recursivament els submòduls imbricats"
+msgstr "cerca recursivament als submòduls imbricats"
msgid "git submodule foreach [--quiet] [--recursive] [--] <command>"
msgstr "git submodule foreach [--quiet] [--recursive] [--] <ordre>"
@@ -12316,7 +12454,7 @@ msgid "limit the summary size"
msgstr "limita la mida del resum"
msgid "git submodule summary [<options>] [<commit>] [--] [<path>]"
-msgstr "git submodule summary [<options>] [<commit>] [--] [<path>]"
+msgstr "git submodule summary [<opcions>] [<comissió>] [--] [<camí>]"
msgid "could not fetch a revision for HEAD"
msgstr "no s'ha pogut obtenir una revisió per a HEAD"
@@ -12337,7 +12475,7 @@ msgid "suppress output of synchronizing submodule url"
msgstr "omet la sortida de la sincronització de l'URL del submòdul"
msgid "git submodule sync [--quiet] [--recursive] [<path>]"
-msgstr "git submodule sync [--quiet] [--recursive] [<path>]"
+msgstr "git submodule sync [--quiet] [--recursive] [<camí>]"
#, c-format
msgid ""
@@ -12457,9 +12595,9 @@ msgid ""
"<repository>] [--name <name>] [--depth <depth>] [--single-branch] [--filter "
"<filter-spec>] --url <url> --path <path>"
msgstr ""
-"git submodule--helper clone [--prefix=<path>] [--quiet] [--reference "
+"git submodule--helper clone [--prefix=<camí>] [--quiet] [--reference "
"<repository>] [--name <name>] [--depth <depth>] [--single-branch] [--filter "
-"<filter-spec>] --url <url> --path <path>"
+"<filter-spec>] --url <url> --path <camí>"
#, c-format
msgid "Invalid update mode '%s' configured for submodule path '%s'"
@@ -12579,9 +12717,6 @@ msgstr "recorre els submòduls recursivament"
msgid "don't fetch new objects from the remote site"
msgstr "no obtinguis els objectes nous del lloc remot"
-msgid "path into the working tree"
-msgstr "camí a l'arbre de treball"
-
msgid "use the 'checkout' update strategy (default)"
msgstr "utilitza l'estratègia d'actualització «checkout» (predeterminada)"
@@ -12615,34 +12750,16 @@ msgstr ""
"git submodule [--quiet] update [--init [--filter=<filter-spec>]] [--remote] "
"[-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--[no-]recommend-"
"shallow] [--reference <repository>] [--recursive] [--[no-]single-branch] "
-"[--] [<path>...]"
-
-msgid "recurse into submodules"
-msgstr "inclou recursivament als submòduls"
+"[--] [<camí>...]"
msgid "git submodule absorbgitdirs [<options>] [<path>...]"
-msgstr "git submodule absorbgitdirs [<options>] [<path>...]"
-
-msgid "check if it is safe to write to the .gitmodules file"
-msgstr "comprova si és segur escriure al fitxer .gitmodules"
-
-msgid "unset the config in the .gitmodules file"
-msgstr "desconfigura l'opció de configuració al fitxer .gitmodules"
-
-msgid "git submodule--helper config <name> [<value>]"
-msgstr "git submodule--helper config <nom> [<valor>]"
-
-msgid "git submodule--helper config --unset <name>"
-msgstr "git submodule--helper config --unset <nom>"
-
-msgid "please make sure that the .gitmodules file is in the working tree"
-msgstr "assegureu-vos que el fitxer .gitmodules és a l'arbre de treball"
+msgstr "git submodule absorbgitdirs [<opcions>] [<camí>...]"
msgid "suppress output for setting url of a submodule"
msgstr "omet la sortida en configurar un URL d'un submòdul"
msgid "git submodule set-url [--quiet] <path> <newurl>"
-msgstr "git submodule set-url [--quiet] <path> <newurl>"
+msgstr "git submodule set-url [--quiet] <camí> <newurl>"
msgid "set the default tracking branch to master"
msgstr "estableix la branca de seguiment per defecte a «master»"
@@ -12651,10 +12768,10 @@ msgid "set the default tracking branch"
msgstr "estableix la branca de seguiment per defecte"
msgid "git submodule set-branch [-q|--quiet] (-d|--default) <path>"
-msgstr "git submodule set-branch [-q|--quiet] (-d|--default) <path>"
+msgstr "git submodule set-branch [-q|--quiet] (-d|--default) <camí>"
msgid "git submodule set-branch [-q|--quiet] (-b|--branch) <branch> <path>"
-msgstr "git submodule set-branch [-q|--quiet] (-b|--branch) <branch> <path>"
+msgstr "git submodule set-branch [-q|--quiet] (-b|--branch) <branca> <camí>"
msgid "--branch or --default required"
msgstr "cal --branch o --default"
@@ -12716,6 +12833,9 @@ msgstr "S'està reactivant el directori de git local per al submòdul «%s»\n"
msgid "unable to checkout submodule '%s'"
msgstr "no s'ha pogut agafar el submòdul «%s»"
+msgid "please make sure that the .gitmodules file is in the working tree"
+msgstr "assegureu-vos que el fitxer .gitmodules és a l'arbre de treball"
+
#, c-format
msgid "Failed to add submodule '%s'"
msgstr "S'ha produït un error en afegir el submòdul «%s»"
@@ -12753,7 +12873,7 @@ msgstr ""
"seu camí"
msgid "git submodule add [<options>] [--] <repository> [<path>]"
-msgstr "git submodule add [<options>] [--] <repository> [<path>]"
+msgstr "git submodule add [<opcions>] [--] <repository> [<camí>]"
msgid "Relative path can only be used from the toplevel of the working tree"
msgstr ""
@@ -12768,19 +12888,17 @@ msgstr "URL de repositori: «%s» ha de ser absolut o començar amb ./|../"
msgid "'%s' is not a valid submodule name"
msgstr "«%s» no és un nom de submòdul vàlid"
-#, c-format
-msgid "%s doesn't support --super-prefix"
-msgstr "%s no admet --super-prefix"
+msgid "git submodule--helper <command>"
+msgstr "git submodule--helper <command>"
-#, c-format
-msgid "'%s' is not a valid submodule--helper subcommand"
-msgstr "«%s» no és una subordre vàlida de submodule--helper"
+msgid "git symbolic-ref [-m <reason>] <name> <ref>"
+msgstr "git symbolic-ref [-m <reason>] <name> <ref>"
-msgid "git symbolic-ref [<options>] <name> [<ref>]"
-msgstr "git symbolic-ref [<opcions>] <nom> [<referència>]"
+msgid "git symbolic-ref [-q] [--short] [--no-recurse] <name>"
+msgstr "git symbolic-ref [-q] [--short] [--no-recurse] <name>"
-msgid "git symbolic-ref -d [-q] <name>"
-msgstr "git symbolic-ref -d [-q] <nom>"
+msgid "git symbolic-ref --delete [-q] <name>"
+msgstr "git symbolic-ref --delete [-q] <name>"
msgid "suppress error message for non-symbolic (detached) refs"
msgstr "omet el missatge d'error de referències no simbòliques (separades)"
@@ -12791,6 +12909,9 @@ msgstr "suprimeix la referència simbòlica"
msgid "shorten ref output"
msgstr "escurça la sortida de referències"
+msgid "recursively dereference (default)"
+msgstr "desreferencia recursivament (per defecte)"
+
msgid "reason"
msgstr "raó"
@@ -12798,25 +12919,25 @@ msgid "reason of the update"
msgstr "raó de l'actualització"
msgid ""
-"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]\n"
-" <tagname> [<head>]"
+"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n"
+" <tagname> [<commit> | <object>]"
msgstr ""
-"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <fitxer>]\n"
-" <tagname> [<head>]"
+"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <fitxer>] [-e]\n"
+" <tagname> [<comissió> | <objecte>]"
msgid "git tag -d <tagname>..."
msgstr "git tag -d <nom-d'etiqueta>..."
msgid ""
-"git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--"
-"points-at <object>]\n"
-" [--format=<format>] [--merged <commit>] [--no-merged <commit>] "
-"[<pattern>...]"
+"git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]\n"
+" [--points-at <object>] [--column[=<options>] | --no-column]\n"
+" [--create-reflog] [--sort=<key>] [--format=<format>]\n"
+" [--merged <commit>] [--no-merged <commit>] [<pattern>...]"
msgstr ""
-"git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--"
-"points-at <object>]\n"
-" [--format=<format>] [--merged <comissió>] [--no-merged <comissió>] "
-"[<patró>...]"
+"git tag [-n[<num>]] -l [--contains <comissió>] [--no-contains <comissió>]\n"
+" [--points-at <objecte>] [--column[=<opcions>] | --no-column]\n"
+" [--create-reflog] [--sort=<key>] [--format=<format>]\n"
+" [--merged <comissió>] [--no-merged <comissió>] [<patró>...]"
msgid "git tag -v [--format=<format>] <tagname>..."
msgstr "git tag -v [--format=<format>] <nom-d'etiqueta>..."
@@ -13206,8 +13327,12 @@ msgstr "llegeix les actualitzacions des de stdin"
msgid "update the info files from scratch"
msgstr "actualitza els fitxers d'informació des de zero"
-msgid "git upload-pack [<options>] <dir>"
-msgstr "git upload-pack [<opcions>] <directori>"
+msgid ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <directory>"
+msgstr ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <directory>"
msgid "quit after a single request/response exchange"
msgstr "surt després d'un sol intercanvi de sol·licitud/resposta"
@@ -13222,8 +13347,8 @@ msgstr ""
msgid "interrupt transfer after <n> seconds of inactivity"
msgstr "interromp la transferència després de <n> segons d'inactivitat"
-msgid "git verify-commit [-v | --verbose] <commit>..."
-msgstr "git verify-commit [-v | --verbose] <comissió>..."
+msgid "git verify-commit [-v | --verbose] [--raw] <commit>..."
+msgstr "git verify-commit [-v | --verbose] [--raw] <comissió>..."
msgid "print commit contents"
msgstr "imprimeix els continguts de la comissió"
@@ -13231,8 +13356,8 @@ msgstr "imprimeix els continguts de la comissió"
msgid "print raw gpg status output"
msgstr "imprimeix la sortida crua de l'estat gpg"
-msgid "git verify-pack [-v | --verbose] [-s | --stat-only] <pack>..."
-msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] <paquet>..."
+msgid "git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pack>.idx..."
+msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pack>.idx..."
msgid "verbose"
msgstr "detallat"
@@ -13240,35 +13365,39 @@ msgstr "detallat"
msgid "show statistics only"
msgstr "mostra només estadístiques"
-msgid "git verify-tag [-v | --verbose] [--format=<format>] <tag>..."
-msgstr "git verify-tag [-v | --verbose] [--format=<format>] <etiqueta>..."
+msgid "git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."
+msgstr "git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."
msgid "print tag contents"
msgstr "imprimeix els continguts de l'etiqueta"
-msgid "git worktree add [<options>] <path> [<commit-ish>]"
-msgstr "git worktree add [<opcions>] <camí> [<commit-ish>]"
+msgid ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]\n"
+" [-b <new-branch>] <path> [<commit-ish>]"
+msgstr ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]\n"
+" [-b <new-branch>] <camí> [<commit-ish>]"
-msgid "git worktree list [<options>]"
-msgstr "git worktree list [<opcions>]"
+msgid "git worktree list [-v | --porcelain [-z]]"
+msgstr "git worktree list [-v | --porcelain [-z]]"
-msgid "git worktree lock [<options>] <path>"
-msgstr "git worktree lock [<opcions>] <camí>"
+msgid "git worktree lock [--reason <string>] <worktree>"
+msgstr "git worktree lock [--reason <string>] <worktree>"
msgid "git worktree move <worktree> <new-path>"
msgstr "git worktree move <arbre de treball> <camí-nou>"
-msgid "git worktree prune [<options>]"
-msgstr "git worktree prune [<opcions>]"
+msgid "git worktree prune [-n] [-v] [--expire <expire>]"
+msgstr "git worktree prune [-n] [-v] [--expire <expire>]"
-msgid "git worktree remove [<options>] <worktree>"
-msgstr "git worktree remove [<opcions>] <arbre de treball>"
+msgid "git worktree remove [-f] <worktree>"
+msgstr "git worktree remove [-f] <worktree>"
msgid "git worktree repair [<path>...]"
-msgstr "git worktree repair [<path>...]"
+msgstr "git worktree repair [<camí>...]"
-msgid "git worktree unlock <path>"
-msgstr "git worktree unlock <camí>"
+msgid "git worktree unlock <worktree>"
+msgstr "git worktree unlock <worktree>"
#, c-format
msgid "Removing %s/%s: %s"
@@ -13508,6 +13637,15 @@ msgstr "només útil per a la depuració"
msgid "core.fsyncMethod = batch is unsupported on this platform"
msgstr "core.fsyncMethod = batch no és compatible amb aquesta plataforma"
+#, c-format
+msgid "could not parse bundle list key %s with value '%s'"
+msgstr ""
+"no s'ha pogut analitzar la clau de llista de paquets %s amb el valor «%s»"
+
+#, c-format
+msgid "bundle list at '%s' has no mode"
+msgstr "la llista de farcells a «%s» no té mode"
+
msgid "failed to create temporary file"
msgstr "no s'ha pogut crear un fitxer temporal"
@@ -13515,16 +13653,43 @@ msgid "insufficient capabilities"
msgstr "capacitats insuficients"
#, c-format
+msgid "file downloaded from '%s' is not a bundle"
+msgstr "el fitxer baixat de «%s» no és un paquet"
+
+msgid "failed to store maximum creation token"
+msgstr "no s'ha pogut emmagatzemar el testimoni de creació màxim"
+
+#, c-format
+msgid "unrecognized bundle mode from URI '%s'"
+msgstr "no s'ha reconegut el model del farcell de l'URI «%s»"
+
+#, c-format
+msgid "exceeded bundle URI recursion limit (%d)"
+msgstr "s'ha excedit el límit de recursió URI del paquet (%d)"
+
+#, c-format
msgid "failed to download bundle from URI '%s'"
msgstr "no s'ha pogut baixar el paquet de l'URI «%s»"
#, c-format
-msgid "file at URI '%s' is not a bundle"
-msgstr "el fitxer a l'URI «%s» no és farcell"
+msgid "file at URI '%s' is not a bundle or bundle list"
+msgstr "el fitxer a l'URI «%s» no és farcell o una llista de farcells"
#, c-format
-msgid "failed to unbundle bundle from URI '%s'"
-msgstr "s'ha produït un error en desempaquetar el farcell de l'URI «%s»"
+msgid "bundle-uri: unexpected argument: '%s'"
+msgstr "bundle-uri: argument inesperat: «%s»"
+
+msgid "bundle-uri: expected flush after arguments"
+msgstr "bundle-uri: s'esperava una neteja després dels arguments"
+
+msgid "bundle-uri: got an empty line"
+msgstr "bundle-uri: té una línia buida"
+
+msgid "bundle-uri: line is not of the form 'key=value'"
+msgstr "bundle-uri: la línia no és de la forma «key=value»"
+
+msgid "bundle-uri: line has empty key or value"
+msgstr "bundle-uri: la línia té una clau o un valor buit"
#, c-format
msgid "unrecognized bundle hash algorithm: %s"
@@ -13548,6 +13713,13 @@ msgstr "Al repositori li manquen aquestes comissions prerequerides:"
msgid "need a repository to verify a bundle"
msgstr "cal un repositori per a verificar un farcell"
+msgid ""
+"some prerequisite commits exist in the object store, but are not connected "
+"to the repository's history"
+msgstr ""
+"hi ha algunes comissions requerides al magatzem d'objectes, però no estan "
+"connectades a l'historial del repositori"
+
#, c-format
msgid "The bundle contains this ref:"
msgid_plural "The bundle contains these %<PRIuMAX> refs:"
@@ -14112,7 +14284,7 @@ msgstr "El format del fitxer de farcell"
msgid "Chunk-based file formats"
msgstr "Formats de fitxer basats en blocs"
-msgid "Git commit graph format"
+msgid "Git commit-graph format"
msgstr "Format de graf de comissions del Git"
msgid "Git index format"
@@ -14485,6 +14657,10 @@ msgstr "cas no gestionat a «has_worktree_moved»: %d"
msgid "health thread wait failed [GLE %ld]"
msgstr "ha fallat l'espera del fil de salut [GLE %ld]"
+#, c-format
+msgid "Invalid path: %s"
+msgstr "Camí no vàlid: «%s»"
+
msgid "Unable to create FSEventStream."
msgstr "No s'ha pogut crear el FSEventStream."
@@ -14516,6 +14692,22 @@ msgid "could not read directory changes [GLE %ld]"
msgstr "no s'han pogut llegir els canvis de directori [GLE %ld]"
#, c-format
+msgid "opendir('%s') failed"
+msgstr "ha fallat opendir(«%s»)"
+
+#, c-format
+msgid "lstat('%s') failed"
+msgstr "ha fallat lstat(«%s»)"
+
+#, c-format
+msgid "strbuf_readlink('%s') failed"
+msgstr "ha fallat strbuf_readlink(«%s»)"
+
+#, c-format
+msgid "closedir('%s') failed"
+msgstr "ha fallat closedir(«%s»)"
+
+#, c-format
msgid "[GLE %ld] unable to open for read '%ls'"
msgstr "[GLE %ld] no s'ha pogut obrir per a llegir «%ls»"
@@ -14971,17 +15163,24 @@ msgid "unknown object format '%s' specified by server"
msgstr "format d'objecte «%s» especificat pel servidor desconegut"
#, c-format
-msgid "invalid ls-refs response: %s"
-msgstr "resposta de ls-refs no vàlida: %s"
+msgid "error on bundle-uri response line %d: %s"
+msgstr "error a la línia de resposta de bundle-uri %d: %s"
-msgid "expected flush after ref listing"
-msgstr "s'esperava una neteja després del llistat de referències"
+msgid "expected flush after bundle-uri listing"
+msgstr "s'esperava un buidatge després del llistat de bundle-uri"
msgid "expected response end packet after ref listing"
msgstr ""
"s'esperava un paquet de final de resposta després del llistat de referències"
#, c-format
+msgid "invalid ls-refs response: %s"
+msgstr "resposta de ls-refs no vàlida: %s"
+
+msgid "expected flush after ref listing"
+msgstr "s'esperava una neteja després del llistat de referències"
+
+#, c-format
msgid "protocol '%s' is not supported"
msgstr "el protocol «%s» no és compatible"
@@ -15354,7 +15553,7 @@ msgid ""
"unknown color-moved-ws mode '%s', possible values are 'ignore-space-change', "
"'ignore-space-at-eol', 'ignore-all-space', 'allow-indentation-change'"
msgstr ""
-"el mode «%s» de «color-moved-ws» és desconegut, els valor possibles són "
+"el mode «%s» de «color-moved-ws» és desconegut, els valors possibles són "
"«ignore-space-change», «ignore-space-at-eol», «ignore-all-space», «allow-"
"indentation-change»"
@@ -16147,10 +16346,11 @@ msgstr "el repositori virtual «%s» és incompatible amb fsmonitor"
#, c-format
msgid ""
-"repository '%s' is incompatible with fsmonitor due to lack of Unix sockets"
+"socket directory '%s' is incompatible with fsmonitor due to lack of Unix "
+"sockets support"
msgstr ""
-"el repositori «%s» és incompatible amb fsmonitor a causa de la manca de "
-"sòcols Unix"
+"el directori del sòcol «%s» és incompatible amb fsmonitor a causa de la "
+"manca de compatibilitat amb els sòcols Unix"
msgid ""
"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n"
@@ -16158,16 +16358,14 @@ msgid ""
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
-" [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n"
-" <command> [<args>]"
+" [--config-env=<name>=<envvar>] <command> [<args>]"
msgstr ""
"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n"
" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
-" [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n"
-" <command> [<args>]"
+" [--config-env=<name>=<envvar>] <command> [<args>]"
msgid ""
"'git help -a' and 'git help -g' list available subcommands and some\n"
@@ -16193,10 +16391,6 @@ msgid "no namespace given for --namespace\n"
msgstr "no s'ha especificat un nom d'espai per --namespace\n"
#, c-format
-msgid "no prefix given for --super-prefix\n"
-msgstr "no s'ha especificat cap prefix per a --super-prefix\n"
-
-#, c-format
msgid "-c expects a configuration string\n"
msgstr "-c espera una cadena de configuració\n"
@@ -16308,8 +16502,13 @@ msgstr ""
msgid "gpg.ssh.defaultKeyCommand failed: %s %s"
msgstr "gpg.ssh.defaultKeyCommand ha fallat: %s %s"
-msgid "gpg failed to sign the data"
-msgstr "gpg ha fallat en signar les dades"
+#, c-format
+msgid ""
+"gpg failed to sign the data:\n"
+"%s"
+msgstr ""
+"gpg ha fallat en signar les dades:\n"
+"%s"
msgid "user.signingKey needs to be set for ssh signing"
msgstr "user.signingKey s'ha d'establir per a signar amb ssh"
@@ -16471,8 +16670,8 @@ msgstr[1] ""
"\n"
"Les ordres més similars són"
-msgid "git version [<options>]"
-msgstr "git version [<opcions>]"
+msgid "git version [--build-options]"
+msgstr "git version [--build-options]"
#, c-format
msgid "%s: %s - %s"
@@ -16608,7 +16807,7 @@ msgstr "sparse: s'ha eliminat la implementació de filtres de camí sparse"
#, c-format
msgid "'%s' for 'object:type=<type>' is not a valid object type"
-msgstr "«%s» per a «object:type=<type>» no és un tipus d'objecte vàlid"
+msgstr "«%s» per a «object:type=<tipus>» no és un tipus d'objecte vàlid"
#, c-format
msgid "invalid filter-spec '%s'"
@@ -17419,10 +17618,6 @@ msgstr ""
"%s: s'estan ignorant els emmagatzematges alternatius d'objectes, imbricació "
"massa profunda"
-#, c-format
-msgid "unable to normalize object directory: %s"
-msgstr "no s'ha pogut normalitzar el directori de l'objecte: %s"
-
msgid "unable to fdopen alternates lockfile"
msgstr "no s'ha pogut fer «fdopen» al fitxer de bloqueig alternatiu"
@@ -17483,6 +17678,10 @@ msgid "garbage at end of loose object '%s'"
msgstr "brossa al final de l'objecte solt «%s»"
#, c-format
+msgid "unable to open loose object %s"
+msgstr "no s'ha pogut obrir l'objecte solt %s"
+
+#, c-format
msgid "unable to parse %s header"
msgstr "no s'ha pogut analitzar la capçalera %s"
@@ -17498,18 +17697,14 @@ msgid "header for %s too long, exceeds %d bytes"
msgstr "la capçalera per a %s és massa llarga, supera els %d bytes"
#, c-format
-msgid "failed to read object %s"
-msgstr "s'ha produït un error en llegir l'objecte %s"
+msgid "loose object %s (stored in %s) is corrupt"
+msgstr "l'objecte solt %s (emmagatzemat a %s) és corrupte"
#, c-format
msgid "replacement %s not found for %s"
msgstr "no s'ha trobat el reemplaçament %s per a %s"
#, c-format
-msgid "loose object %s (stored in %s) is corrupt"
-msgstr "l'objecte solt %s (emmagatzemat a %s) és corrupte"
-
-#, c-format
msgid "packed object %s (stored in %s) is corrupt"
msgstr "l'objecte empaquetat %s (emmagatzemat a %s) és corrupte"
@@ -17521,9 +17716,6 @@ msgstr "no s'ha pogut escriure al fitxer %s"
msgid "unable to set permission to '%s'"
msgstr "no s'ha pogut establir el permís a «%s»"
-msgid "file write error"
-msgstr "s'ha produït un error en escriure al fitxer"
-
msgid "error when closing loose object file"
msgstr "error en tancar el fitxer d'objecte solt"
@@ -17571,11 +17763,12 @@ msgstr "s'ha produït un error en crear el directori %s"
msgid "cannot read object for %s"
msgstr "no es pot llegir l'objecte per a %s"
-msgid "corrupt commit"
-msgstr "comissió corrupta"
+#, c-format
+msgid "object fails fsck: %s"
+msgstr "l'objecte ha fallat fsck: %s"
-msgid "corrupt tag"
-msgstr "etiqueta corrupta"
+msgid "refusing to create malformed object"
+msgstr "es nega a crear un objecte mal format"
#, c-format
msgid "read error while indexing %s"
@@ -17770,7 +17963,7 @@ msgstr ""
#, c-format
msgid "<object>:<path> required, only <object> '%s' given"
-msgstr "<object>:<path> requerit, només s'ha donat <object> «%s»"
+msgstr "<objecte>:<camí> requerit, només s'ha donat <objecte> «%s»"
#, c-format
msgid "invalid object name '%.*s'."
@@ -17844,10 +18037,6 @@ msgstr "el desplaçament XOR a l'índex de mapa de bits no és vàlid"
msgid "cannot fstat bitmap file"
msgstr "no es pot fer fstat en el fitxer de mapa de bits"
-#, c-format
-msgid "ignoring extra bitmap file: '%s'"
-msgstr "s'ignorarà el fitxer extra de mapa de bits: «%s»"
-
msgid "checksum doesn't match in MIDX and bitmap"
msgstr "la suma de verificació no coincideix amb el MIDX i el mapa de bits"
@@ -18118,6 +18307,9 @@ msgstr "sigues més discret"
msgid "use <n> digits to display object names"
msgstr "usa <n> xifres per a mostrar els noms d'objecte"
+msgid "prefixed path to initial superproject"
+msgstr "camí prefixat al superprojecte inicial"
+
msgid "how to strip spaces and #comments from message"
msgstr "com suprimir els espais i #comentaris del missatge"
@@ -18269,6 +18461,10 @@ msgstr "promisor-remote: no s'ha pogut tancar stdin al subprocés d'obtenció"
msgid "promisor remote name cannot begin with '/': %s"
msgstr "el nom remot «promisor» no pot començar amb «/»: %s"
+#, c-format
+msgid "could not fetch %s from promisor remote"
+msgstr "no s'ha pogut obtenir «%s» del «promisor» remot"
+
msgid "object-info: expected flush after arguments"
msgstr "object-info: s'esperava una neteja després dels arguments"
@@ -18623,6 +18819,14 @@ msgid "ahead %d, behind %d"
msgstr "davant per %d, darrere per %d"
#, c-format
+msgid "%%(%.*s) does not take arguments"
+msgstr "%%(%.*s) no accepta arguments"
+
+#, c-format
+msgid "unrecognized %%(%.*s) argument: %s"
+msgstr "argument %%(%.*s) desconegut: %s"
+
+#, c-format
msgid "expected format: %%(color:<color>)"
msgstr "format esperat: %%(color:<color>)"
@@ -18639,22 +18843,6 @@ msgid "Integer value expected refname:rstrip=%s"
msgstr "Valor enter esperat pel nom de referència:rstrip=%s"
#, c-format
-msgid "unrecognized %%(%s) argument: %s"
-msgstr "argument %%(%s) desconegut: %s"
-
-#, c-format
-msgid "%%(objecttype) does not take arguments"
-msgstr "%%(objecttype) no accepta arguments"
-
-#, c-format
-msgid "%%(deltabase) does not take arguments"
-msgstr "%%(deltabase) no accepta arguments"
-
-#, c-format
-msgid "%%(body) does not take arguments"
-msgstr "%%(body) no accepta arguments"
-
-#, c-format
msgid "expected %%(trailers:key=<value>)"
msgstr "s'esperava %%(trailers:key=<value>)"
@@ -18671,10 +18859,6 @@ msgid "positive value expected '%s' in %%(%s)"
msgstr "valor positiu esperat «%s» a %%(%s)"
#, c-format
-msgid "unrecognized email option: %s"
-msgstr "opció del correu electrònic no reconeguda: «%s»"
-
-#, c-format
msgid "expected format: %%(align:<width>,<position>)"
msgstr "format esperat: %%(align:<amplada>,<posició>)"
@@ -18687,12 +18871,12 @@ msgid "unrecognized width:%s"
msgstr "amplada no reconeguda:%s"
#, c-format
-msgid "positive width expected with the %%(align) atom"
-msgstr "amplada positiva esperada amb l'àtom %%(align)"
+msgid "unrecognized %%(%s) argument: %s"
+msgstr "argument %%(%s) desconegut: %s"
#, c-format
-msgid "%%(rest) does not take arguments"
-msgstr "%%(rest) no accepta arguments"
+msgid "positive width expected with the %%(align) atom"
+msgstr "amplada positiva esperada amb l'àtom %%(align)"
#, c-format
msgid "malformed field name: %.*s"
@@ -19005,7 +19189,7 @@ msgstr "El transport http no admet %s"
msgid "protocol error: expected '<url> <path>', missing space"
msgstr ""
-"s'ha produït un error de protocol: s'esperava «<url> <path>», falta espai"
+"s'ha produït un error de protocol: s'esperava «<url> <camí>», falta espai"
#, c-format
msgid "failed to download file at URL '%s'"
@@ -19355,6 +19539,13 @@ msgid "failed to find tree of %s"
msgstr "s'ha produït un error en cercar l'arbre de %s"
#, c-format
+msgid "unsupported section for hidden refs: %s"
+msgstr "secció d'índex no compatible per a les referències ocultes: %s"
+
+msgid "--exclude-hidden= passed more than once"
+msgstr "--exclude-hidden= passat més d'una vegada"
+
+#, c-format
msgid "resolve-undo records `%s` which is missing"
msgstr "resolve-undo indica «%s» que manquen"
@@ -19452,7 +19643,7 @@ msgid "only download metadata for the branch that will be checked out"
msgstr "només baixa les metadades per a la branca que s'agafarà"
msgid "scalar clone [<options>] [--] <repo> [<dir>]"
-msgstr "scalar clone [<opcions>] [--] <repo> [<dir>]"
+msgstr "scalar clone [<opcions>] [--] <repositori> [<dir>]"
#, c-format
msgid "cannot deduce worktree name from '%s'"
@@ -19499,6 +19690,14 @@ msgid "--all or <enlistment>, but not both"
msgstr "--all o <enlistment>, però no ambdós"
#, c-format
+msgid "could not remove stale scalar.repo '%s'"
+msgstr "no s'ha pogut suprimir el scalar.repo «%s» estancat"
+
+#, c-format
+msgid "removing stale scalar.repo '%s'"
+msgstr "s'està eliminant el scalar.repo «%s» estancat"
+
+#, c-format
msgid "git repository gone in '%s'"
msgstr "no existeix un repositori de git a: «%s»"
@@ -19546,7 +19745,7 @@ msgid ""
"\n"
"Commands:\n"
msgstr ""
-"scalar [-C <directory>] [-c <key>=<value>] <command> [<options>]\n"
+"scalar [-C <directory>] [-c <key>=<value>] <command> [<opcions>]\n"
"\n"
"Ordres:\n"
@@ -19853,7 +20052,7 @@ msgid "unknown command: %d"
msgstr "ordre desconeguda: %d"
msgid "This is the 1st commit message:"
-msgstr "Aquest és el missatge de la 1ra comissió:"
+msgstr "Aquest és el missatge de la 1a comissió:"
#, c-format
msgid "This is the commit message #%d:"
@@ -19936,6 +20135,23 @@ msgid "git %s: failed to refresh the index"
msgstr "git %s: s'ha produït un error en actualitzar l'índex"
#, c-format
+msgid "'%s' is not a valid label"
+msgstr "«%s» no és una etiqueta vàlida"
+
+#, c-format
+msgid "'%s' is not a valid refname"
+msgstr "«%s» no és un nom de referència vàlid"
+
+#, c-format
+msgid "update-ref requires a fully qualified refname e.g. refs/heads/%s"
+msgstr ""
+"«update-ref» requereix un refname plenament qualificat, p. ex. refs/heads/%s"
+
+#, c-format
+msgid "invalid command '%.*s'"
+msgstr "ordre no vàlida «%.*s»"
+
+#, c-format
msgid "%s does not accept arguments: '%s'"
msgstr "%s no accepta arguments: «%s»"
@@ -20124,16 +20340,16 @@ msgstr ""
msgid "illegal label name: '%.*s'"
msgstr "nom d'etiqueta no permès: «%.*s»"
+#, c-format
+msgid "could not resolve '%s'"
+msgstr "no s'ha pogut resoldre «%s»"
+
msgid "writing fake root commit"
msgstr "s'està escrivint una comissió arrel falsa"
msgid "writing squash-onto"
msgstr "s'està escrivint «squash-onto»"
-#, c-format
-msgid "could not resolve '%s'"
-msgstr "no s'ha pogut resoldre «%s»"
-
msgid "cannot merge without a current revision"
msgstr "no es pot fusionar sense una revisió actual"
@@ -20741,6 +20957,26 @@ msgstr "ls-tree ha retornat un codi de retorn %d no esperat"
msgid "failed to lstat '%s'"
msgstr "s'ha produït un error en fer lstat a «%s»"
+msgid "no remote configured to get bundle URIs from"
+msgstr "no hi ha cap remot configurat per a obtenir els URI del paquet"
+
+#, c-format
+msgid "remote '%s' has no configured URL"
+msgstr "el remot «%s» no té cap URL configurat"
+
+msgid "could not get the bundle-uri list"
+msgstr "no s'ha pogut obtenir la llista bundle-uri"
+
+msgid "test-tool cache-tree <options> (control|prime|update)"
+msgstr "test-tool cache-tree <opcions> (control|prime|update)"
+
+msgid "clear the cache tree before each iteration"
+msgstr "neteja l'arbre de la memòria cau abans de cada iteració"
+
+msgid "number of entries in the cache tree to invalidate (default 0)"
+msgstr ""
+"nombre d'entrades a l'arbre de la memòria cau a invalidar (per defecte 0)"
+
msgid "unhandled options"
msgstr "opcions no gestionades"
@@ -21083,6 +21319,13 @@ msgstr "S'està avortant."
msgid "failed to push all needed submodules"
msgstr "no s'han pogut pujar tots els submòduls necessaris"
+msgid "bundle-uri operation not supported by protocol"
+msgstr "L'operació bundle-uri no és compatible amb el protocol"
+
+msgid "could not retrieve server-advertised bundle-uri list"
+msgstr ""
+"no s'ha pogut recuperar la llista de paquets d'URI anunciats pel servidor"
+
msgid "too-short tree object"
msgstr "objecte d'arbre massa curt"
@@ -21520,7 +21763,7 @@ msgstr " (useu «git add/rm <fitxer>...» per a actualitzar què es cometrà)"
msgid ""
" (use \"git restore <file>...\" to discard changes in working directory)"
msgstr ""
-" (useu «git restore <file>...» per a descartar canvis en el directori de "
+" (useu «git restore <fitxer>...» per a descartar canvis en el directori de "
"treball)"
msgid " (commit or discard the untracked or modified content in submodules)"
@@ -21830,14 +22073,20 @@ msgstr "Fitxers ignorats"
#, c-format
msgid ""
-"It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
-"may speed it up, but you have to be careful not to forget to add\n"
-"new files yourself (see 'git help status')."
+"It took %.2f seconds to enumerate untracked files,\n"
+"but the results were cached, and subsequent runs may be faster."
msgstr ""
-"S'ha trigat %.2f segons enumerar els fitxers no seguits.\n"
-"«status -uno» pot accelerar-ho, però heu d'anar amb compte de no\n"
-"oblidar-vos d'afegir fitxers nous vosaltres mateixos (vegeu\n"
-"«git help status»)."
+"S'han trigat %.2f segons a enumerar els fitxers sense seguiment,\n"
+"però els resultats es van emmagatzemar a la memòria cau, i les\n"
+"execucions posteriors podrien ser més ràpides."
+
+#, c-format
+msgid "It took %.2f seconds to enumerate untracked files."
+msgstr "S'han trigat %.2f segons a enumerar els fitxers sense seguiment."
+
+msgid "See 'git help status' for information on how to improve this."
+msgstr ""
+"Vegeu «git help status» per a obtenir informació sobre com millorar-ho."
#, c-format
msgid "Untracked files not listed%s"
@@ -21983,276 +22232,6 @@ msgstr ""
msgid "Unable to determine absolute path of git directory"
msgstr "No s'ha pogut determinar el camí absolut del directori de git"
-#. TRANSLATORS: you can adjust this to align "git add -i" status menu
-#, perl-format
-msgid "%12s %12s %s"
-msgstr "%12s %12s %s"
-
-#, perl-format
-msgid "touched %d path\n"
-msgid_plural "touched %d paths\n"
-msgstr[0] "modificat %d camí\n"
-msgstr[1] "modificat %d camins\n"
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for staging."
-msgstr ""
-"Si el pedaç s'aplica correctament, el tros editat es marcarà immediatament\n"
-"per «staging»."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for stashing."
-msgstr ""
-"Si el pedaç s'aplica correctament, el tros editat es marcarà immediatament\n"
-"per «stashing»."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for unstaging."
-msgstr ""
-"Si el pedaç s'aplica correctament, el tros editat es marcarà immediatament\n"
-"per «unstaging»."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for applying."
-msgstr ""
-"Si el pedaç s'aplica correctament, el tros editat es marcarà immediatament\n"
-"per a aplicar-se."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for discarding."
-msgstr ""
-"Si el pedaç s'aplica correctament, el tros editat es marcarà immediatament\n"
-"per a descartar-se."
-
-#, perl-format
-msgid "failed to open hunk edit file for writing: %s"
-msgstr "s'ha produït un error en escriure al fitxer d'edició del tros: %s"
-
-#, perl-format
-msgid ""
-"---\n"
-"To remove '%s' lines, make them ' ' lines (context).\n"
-"To remove '%s' lines, delete them.\n"
-"Lines starting with %s will be removed.\n"
-msgstr ""
-"---\n"
-"Per a eliminar les línies «%s», convertiu-les en línies ' ' (context).\n"
-"Per a eliminar les línies «%s», suprimiu-les.\n"
-"Les línies que comencin per %s s'eliminaran.\n"
-
-#, perl-format
-msgid "failed to open hunk edit file for reading: %s"
-msgstr "s'ha produït un error en llegir al fitxer d'edició del tros: %s"
-
-msgid ""
-"y - stage this hunk\n"
-"n - do not stage this hunk\n"
-"q - quit; do not stage this hunk or any of the remaining ones\n"
-"a - stage this hunk and all later hunks in the file\n"
-"d - do not stage this hunk or any of the later hunks in the file"
-msgstr ""
-"y - fes «stage» d'aquest tros\n"
-"n - no facis «stage» d'aquest tros\n"
-"q - surt; no facis «stage» d'aquest tros o de cap altre restant\n"
-"a - fes «stage» d'aquest tros i tota la resta de trossos del fitxer\n"
-"d - no facis «stage» d'aquest tros o de cap altre restant del fitxer"
-
-msgid ""
-"y - stash this hunk\n"
-"n - do not stash this hunk\n"
-"q - quit; do not stash this hunk or any of the remaining ones\n"
-"a - stash this hunk and all later hunks in the file\n"
-"d - do not stash this hunk or any of the later hunks in the file"
-msgstr ""
-"y - fes «stash» d'aquest tros\n"
-"n - no facis «stash» d'aquest tros\n"
-"q - surt; no facis «stash» d'aquest tros o de cap altre restant\n"
-"a - fes «stash» d'aquest tros i tota la resta de trossos del fitxer\n"
-"d - no facis «stash» d'aquest tros o de cap altre restant del fitxer"
-
-msgid ""
-"y - unstage this hunk\n"
-"n - do not unstage this hunk\n"
-"q - quit; do not unstage this hunk or any of the remaining ones\n"
-"a - unstage this hunk and all later hunks in the file\n"
-"d - do not unstage this hunk or any of the later hunks in the file"
-msgstr ""
-"y - fes «unstage» d'aquest tros\n"
-"n - no facis «unstage» d'aquest tros\n"
-"q - surt; no facis «unstage» d'aquest tros o de cap altre restant\n"
-"a - fes «unstage» d'aquest tros i tota la resta de trossos del fitxer\n"
-"d - no facis «unstage» d'aquest tros o de cap altre restant del fitxer"
-
-msgid ""
-"y - apply this hunk to index\n"
-"n - do not apply this hunk to index\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - aplica aquest tros a l'índex\n"
-"n - no apliquis aquest tros a l'índex\n"
-"q - surt; no apliquis aquest tros ni cap dels pendents\n"
-"a - aplica aquest tros i tots els trossos posteriors en el fitxer\n"
-"d - no apliquis aquest tros ni cap dels trossos posteriors en el fitxer"
-
-msgid ""
-"y - discard this hunk from worktree\n"
-"n - do not discard this hunk from worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-"y - descarta aquest tros de l'arbre de treball\n"
-"n - no descartis aquest tros des de l'arbre de treball\n"
-"q - surt; no descartis aquest tros ni cap dels pendents\n"
-"a - descarta aquest tros i tots els trossos posteriors en el fitxer\n"
-"d - no descartis aquest tros ni cap dels trossos posteriors en el fitxer"
-
-msgid ""
-"y - discard this hunk from index and worktree\n"
-"n - do not discard this hunk from index and worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-"y - descarta aquest tros de l'índex i de l'arbre de treball\n"
-"n - no descartis aquest tros des de l'índex i de l'arbre de treball\n"
-"q - surt; no descartis aquest tros ni cap dels pendents\n"
-"a - descarta aquest tros i tots els trossos posteriors en el fitxer\n"
-"d - no descartis aquest tros ni cap dels trossos posteriors en el fitxer"
-
-msgid ""
-"y - apply this hunk to index and worktree\n"
-"n - do not apply this hunk to index and worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - aplica aquest tros a l'índex i l'arbre de treball\n"
-"n - no apliquis aquest tros des de l'índex i de l'arbre de treball\n"
-"q - surt; no apliquis aquest tros ni cap dels pendents\n"
-"a - aplica aquest tros i tots els trossos posteriors en el fitxer\n"
-"d - no apliquis aquest tros ni cap dels trossos posteriors en el fitxer"
-
-msgid ""
-"y - apply this hunk to worktree\n"
-"n - do not apply this hunk to worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - aplica aquest tros a l'arbre de treball\n"
-"n - no apliquis aquest tros a l'arbre de treball\n"
-"q - surt; no apliquis aquest tros ni cap dels pendents\n"
-"a - aplica aquest tros i tots els trossos posteriors en el fitxer\n"
-"d - no apliquis aquest tros ni cap dels trossos posteriors en el fitxer"
-
-msgid ""
-"g - select a hunk to go to\n"
-"/ - search for a hunk matching the given regex\n"
-"j - leave this hunk undecided, see next undecided hunk\n"
-"J - leave this hunk undecided, see next hunk\n"
-"k - leave this hunk undecided, see previous undecided hunk\n"
-"K - leave this hunk undecided, see previous hunk\n"
-"s - split the current hunk into smaller hunks\n"
-"e - manually edit the current hunk\n"
-"? - print help\n"
-msgstr ""
-"g - selecciona el tros on voleu anar\n"
-"/ - cerca un tros que coincideixi amb l'expressió regular donada\n"
-"j - deixa aquest tros sense decidir, veure el tros sense decidir següent\n"
-"J - deixa aquest tros sense decidir, veure el tros següent\n"
-"k - deixa aquest tros sense decidir, veure el tros sense decidir anterior\n"
-"K - deixa aquest tros sense decidir, veure el tros anterior\n"
-"s - divideix el tros actual en trossos més petits\n"
-"e - edita manualment el tros actual\n"
-"? - mostra l'ajuda\n"
-
-msgid "The selected hunks do not apply to the index!\n"
-msgstr "Els trossos seleccionats no apliquen a l'índex\n"
-
-#, perl-format
-msgid "ignoring unmerged: %s\n"
-msgstr "s'està ignorant %s no fusionat\n"
-
-msgid "No other hunks to goto\n"
-msgstr "No hi ha altres trossos on anar-hi\n"
-
-#, perl-format
-msgid "Invalid number: '%s'\n"
-msgstr "Número no vàlid: «%s»\n"
-
-#, perl-format
-msgid "Sorry, only %d hunk available.\n"
-msgid_plural "Sorry, only %d hunks available.\n"
-msgstr[0] "Només %d tros disponible.\n"
-msgstr[1] "Només %d trossos disponibles.\n"
-
-msgid "No other hunks to search\n"
-msgstr "No hi ha cap altre tros a cercar\n"
-
-#, perl-format
-msgid "Malformed search regexp %s: %s\n"
-msgstr "Expressió regular de cerca mal formada %s: %s\n"
-
-msgid "No hunk matches the given pattern\n"
-msgstr "No hi ha trossos que coincideixin amb el patró donat\n"
-
-msgid "No previous hunk\n"
-msgstr "Sense tros previ\n"
-
-msgid "No next hunk\n"
-msgstr "No hi ha tros següent\n"
-
-msgid "Sorry, cannot split this hunk\n"
-msgstr "No es pot dividir aquest tros\n"
-
-#, perl-format
-msgid "Split into %d hunk.\n"
-msgid_plural "Split into %d hunks.\n"
-msgstr[0] "Divideix en %d tros.\n"
-msgstr[1] "Divideix en %d trossos.\n"
-
-msgid "Sorry, cannot edit this hunk\n"
-msgstr "No es pot editar aquest tros\n"
-
-#. TRANSLATORS: please do not translate the command names
-#. 'status', 'update', 'revert', etc.
-msgid ""
-"status - show paths with changes\n"
-"update - add working tree state to the staged set of changes\n"
-"revert - revert staged set of changes back to the HEAD version\n"
-"patch - pick hunks and update selectively\n"
-"diff - view diff between HEAD and index\n"
-"add untracked - add contents of untracked files to the staged set of "
-"changes\n"
-msgstr ""
-"status - mostra els camins amb canvis\n"
-"update - afegeix l'estat de l'arbre de treball al conjunt de canvis "
-"«staged»\n"
-"revert - reverteix el conjunt de canvis de «staged» a la versió HEAD\n"
-"patch - selecciona trossos i actualitza'ls selectivament\n"
-"diff - mostra la diferència entre HEAD i l'índex\n"
-"add untracked - afegeix el contingut dels fitxers no seguits al conjunt de "
-"canvis «staged»\n"
-
-msgid "missing --"
-msgstr "manca --"
-
-#, perl-format
-msgid "unknown --patch mode: %s"
-msgstr "desconegut --patch mode: %s"
-
-#, perl-format
-msgid "invalid argument %s, expecting --"
-msgstr "argument %s no vàlid, s'esperava --"
-
msgid "local zone differs from GMT by a non-minute interval\n"
msgstr "la zona local difereix de GMT per un interval que no és de minuts\n"
@@ -22577,83 +22556,366 @@ msgstr "S'està ometent %s amb el sufix de còpia de seguretat «%s».\n"
msgid "Do you really want to send %s? [y|N]: "
msgstr "Esteu segur que voleu enviar %s? [y|N]: "
-#~ msgid "(stats|all)"
-#~ msgstr "(stats|all)"
+#~ msgid "git bisect--helper --bisect-state (bad|new) [<rev>]"
+#~ msgstr "git bisect--helper --bisect-state (bad|new) [<rev>]"
-#~ msgid "git maintenance register"
-#~ msgstr "git maintenance register"
+#~ msgid "won't bisect on cg-seek'ed tree"
+#~ msgstr "no es bisecarà en un arbre en el qual s'ha fet cg-seek"
-#~ msgid "git maintenance unregister"
-#~ msgstr "git maintenance unregister"
+#~ msgid "--bisect-terms requires 0 or 1 argument"
+#~ msgstr "--bisect-terms requereix 0 o 1 argument"
-#~ msgid "git maintenance stop"
-#~ msgstr "git maintenance stop"
+#~ msgid "--bisect-next requires 0 arguments"
+#~ msgstr "--bisect-next no requereix cap argument"
-#, c-format
-#~ msgid "could not parse colored hunk header '%.*s'"
-#~ msgstr "no s'ha pogut analitzar la capçalera del tros acolorida «%.*s»"
+#~ msgid "--bisect-log requires 0 arguments"
+#~ msgstr "--bisect-log no requereix cap argument"
-#, c-format
-#~ msgid "Unknown subcommand: %s"
-#~ msgstr "Subordre desconeguda: %s"
+#~ msgid "git env--helper --type=[bool|ulong] <options> <env-var>"
+#~ msgstr "git env--helper --type=[bool|ulong] <opcions> <env-var>"
-#~ msgid "checked out in another worktree"
-#~ msgstr "s'ha agafat en un altre arbre de treball"
+#~ msgid "default for git_env_*(...) to fall back on"
+#~ msgstr "valor per defecte per a git_env_*(...) en cas d'absència"
-#~ msgid "failed to open stdin of 'crontab'"
-#~ msgstr "s'ha produït un error en obrir stdin de «crontab»"
+#~ msgid "be quiet only use git_env_*() value as exit code"
+#~ msgstr "silenciós només utilitza el valor git_env_*() com a codi de sortida"
#, c-format
-#~ msgid "invalid subcommand: %s"
-#~ msgstr "subordre no vàlida: %s"
-
-#~ msgid "single arg format must be symmetric range"
-#~ msgstr "el format de l'argument únic ha de ser de rang simètric"
+#~ msgid ""
+#~ "option `--default' expects a boolean value with `--type=bool`, not `%s`"
+#~ msgstr ""
+#~ "l'opció «--default» espera un valor booleà amb «--type=bool», no «%s»"
-#~ msgid "git submodule--helper list [--prefix=<path>] [<path>...]"
-#~ msgstr "git submodule--helper list [--prefix=<camí>] [<camí>...]"
+#, c-format
+#~ msgid ""
+#~ "option `--default' expects an unsigned long value with `--type=ulong`, "
+#~ "not `%s`"
+#~ msgstr ""
+#~ "l'opció «--default» espera un valor llarg sense signe amb «--type=ulong», "
+#~ "no «%s»"
-#~ msgid "git submodule--helper name <path>"
-#~ msgstr "git submodule--helper name <camí>"
+#, c-format
+#~ msgid "%s doesn't support --super-prefix"
+#~ msgstr "%s no admet --super-prefix"
#, c-format
-#~ msgid "failed to get the default remote for submodule '%s'"
-#~ msgstr ""
-#~ "s'ha produït un error en obtenir el remot per defecte pel submòdul «%s»"
+#~ msgid "no prefix given for --super-prefix\n"
+#~ msgstr "no s'ha especificat cap prefix per a --super-prefix\n"
#, c-format
-#~ msgid "Invalid update mode '%s' for submodule path '%s'"
-#~ msgstr "Mode d'actualització «%s» no vàlid per al camí de submòdul «%s»"
+#~ msgid "failed to read object %s"
+#~ msgstr "s'ha produït un error en llegir l'objecte %s"
+
+#~ msgid "file write error"
+#~ msgstr "s'ha produït un error en escriure al fitxer"
-#~ msgid "path into the working tree, across nested submodule boundaries"
-#~ msgstr "camí a l'arbre de treball, a través de fronteres de submòduls niats"
+#~ msgid "corrupt commit"
+#~ msgstr "comissió corrupta"
-#~ msgid "rebase, merge, checkout or none"
-#~ msgstr "rebase, merge, checkout o none"
+#~ msgid "corrupt tag"
+#~ msgstr "etiqueta corrupta"
-#~ msgid "bad value for update parameter"
-#~ msgstr "valor incorrecte per al paràmetre update"
+#, c-format
+#~ msgid "%%(objecttype) does not take arguments"
+#~ msgstr "%%(objecttype) no accepta arguments"
-#~ msgid "Show three-way merge without touching index"
-#~ msgstr "Mostra la fusió de tres vies sense tocar l'índex"
+#, c-format
+#~ msgid "%%(deltabase) does not take arguments"
+#~ msgstr "%%(deltabase) no accepta arguments"
-# c-format
#, c-format
-#~ msgid "could not create directory for '%s'"
-#~ msgstr "no s'ha pogut crear el directori per a «%s»"
+#~ msgid "%%(body) does not take arguments"
+#~ msgstr "%%(body) no accepta arguments"
#, c-format
-#~ msgid "Couldn't start hook '%s'\n"
-#~ msgstr "No s'ha pogut iniciar el lligam «%s»'\n"
+#~ msgid "unrecognized email option: %s"
+#~ msgstr "opció del correu electrònic no reconeguda: «%s»"
#, c-format
#~ msgid ""
-#~ "Note: %s not up to date and in way of checking out conflicted version; "
-#~ "old copy renamed to %s"
+#~ "It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
+#~ "may speed it up, but you have to be careful not to forget to add\n"
+#~ "new files yourself (see 'git help status')."
+#~ msgstr ""
+#~ "S'ha trigat %.2f segons enumerar els fitxers no seguits.\n"
+#~ "«status -uno» pot accelerar-ho, però heu d'anar amb compte de no\n"
+#~ "oblidar-vos d'afegir fitxers nous vosaltres mateixos (vegeu\n"
+#~ "«git help status»)."
+
+#, perl-format
+#~ msgid "%12s %12s %s"
+#~ msgstr "%12s %12s %s"
+
+#, perl-format
+#~ msgid "touched %d path\n"
+#~ msgid_plural "touched %d paths\n"
+#~ msgstr[0] "modificat %d camí\n"
+#~ msgstr[1] "modificat %d camins\n"
+
+#~ msgid ""
+#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
+#~ "marked for staging."
+#~ msgstr ""
+#~ "Si el pedaç s'aplica correctament, el tros editat es marcarà "
+#~ "immediatament\n"
+#~ "per «staging»."
+
+#~ msgid ""
+#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
+#~ "marked for stashing."
+#~ msgstr ""
+#~ "Si el pedaç s'aplica correctament, el tros editat es marcarà "
+#~ "immediatament\n"
+#~ "per «stashing»."
+
+#~ msgid ""
+#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
+#~ "marked for unstaging."
+#~ msgstr ""
+#~ "Si el pedaç s'aplica correctament, el tros editat es marcarà "
+#~ "immediatament\n"
+#~ "per «unstaging»."
+
+#~ msgid ""
+#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
+#~ "marked for applying."
+#~ msgstr ""
+#~ "Si el pedaç s'aplica correctament, el tros editat es marcarà "
+#~ "immediatament\n"
+#~ "per a aplicar-se."
+
+#~ msgid ""
+#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
+#~ "marked for discarding."
+#~ msgstr ""
+#~ "Si el pedaç s'aplica correctament, el tros editat es marcarà "
+#~ "immediatament\n"
+#~ "per a descartar-se."
+
+#, perl-format
+#~ msgid "failed to open hunk edit file for writing: %s"
+#~ msgstr "s'ha produït un error en escriure al fitxer d'edició del tros: %s"
+
+#, perl-format
+#~ msgid ""
+#~ "---\n"
+#~ "To remove '%s' lines, make them ' ' lines (context).\n"
+#~ "To remove '%s' lines, delete them.\n"
+#~ "Lines starting with %s will be removed.\n"
+#~ msgstr ""
+#~ "---\n"
+#~ "Per a eliminar les línies «%s», convertiu-les en línies ' ' (context).\n"
+#~ "Per a eliminar les línies «%s», suprimiu-les.\n"
+#~ "Les línies que comencin per %s s'eliminaran.\n"
+
+#, perl-format
+#~ msgid "failed to open hunk edit file for reading: %s"
+#~ msgstr "s'ha produït un error en llegir al fitxer d'edició del tros: %s"
+
+#~ msgid ""
+#~ "y - stage this hunk\n"
+#~ "n - do not stage this hunk\n"
+#~ "q - quit; do not stage this hunk or any of the remaining ones\n"
+#~ "a - stage this hunk and all later hunks in the file\n"
+#~ "d - do not stage this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - fes «stage» d'aquest tros\n"
+#~ "n - no facis «stage» d'aquest tros\n"
+#~ "q - surt; no facis «stage» d'aquest tros o de cap altre restant\n"
+#~ "a - fes «stage» d'aquest tros i tota la resta de trossos del fitxer\n"
+#~ "d - no facis «stage» d'aquest tros o de cap altre restant del fitxer"
+
+#~ msgid ""
+#~ "y - stash this hunk\n"
+#~ "n - do not stash this hunk\n"
+#~ "q - quit; do not stash this hunk or any of the remaining ones\n"
+#~ "a - stash this hunk and all later hunks in the file\n"
+#~ "d - do not stash this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - fes «stash» d'aquest tros\n"
+#~ "n - no facis «stash» d'aquest tros\n"
+#~ "q - surt; no facis «stash» d'aquest tros o de cap altre restant\n"
+#~ "a - fes «stash» d'aquest tros i tota la resta de trossos del fitxer\n"
+#~ "d - no facis «stash» d'aquest tros o de cap altre restant del fitxer"
+
+#~ msgid ""
+#~ "y - unstage this hunk\n"
+#~ "n - do not unstage this hunk\n"
+#~ "q - quit; do not unstage this hunk or any of the remaining ones\n"
+#~ "a - unstage this hunk and all later hunks in the file\n"
+#~ "d - do not unstage this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - fes «unstage» d'aquest tros\n"
+#~ "n - no facis «unstage» d'aquest tros\n"
+#~ "q - surt; no facis «unstage» d'aquest tros o de cap altre restant\n"
+#~ "a - fes «unstage» d'aquest tros i tota la resta de trossos del fitxer\n"
+#~ "d - no facis «unstage» d'aquest tros o de cap altre restant del fitxer"
+
+#~ msgid ""
+#~ "y - apply this hunk to index\n"
+#~ "n - do not apply this hunk to index\n"
+#~ "q - quit; do not apply this hunk or any of the remaining ones\n"
+#~ "a - apply this hunk and all later hunks in the file\n"
+#~ "d - do not apply this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - aplica aquest tros a l'índex\n"
+#~ "n - no apliquis aquest tros a l'índex\n"
+#~ "q - surt; no apliquis aquest tros ni cap dels pendents\n"
+#~ "a - aplica aquest tros i tots els trossos posteriors en el fitxer\n"
+#~ "d - no apliquis aquest tros ni cap dels trossos posteriors en el fitxer"
+
+#~ msgid ""
+#~ "y - discard this hunk from worktree\n"
+#~ "n - do not discard this hunk from worktree\n"
+#~ "q - quit; do not discard this hunk or any of the remaining ones\n"
+#~ "a - discard this hunk and all later hunks in the file\n"
+#~ "d - do not discard this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - descarta aquest tros de l'arbre de treball\n"
+#~ "n - no descartis aquest tros des de l'arbre de treball\n"
+#~ "q - surt; no descartis aquest tros ni cap dels pendents\n"
+#~ "a - descarta aquest tros i tots els trossos posteriors en el fitxer\n"
+#~ "d - no descartis aquest tros ni cap dels trossos posteriors en el fitxer"
+
+#~ msgid ""
+#~ "y - discard this hunk from index and worktree\n"
+#~ "n - do not discard this hunk from index and worktree\n"
+#~ "q - quit; do not discard this hunk or any of the remaining ones\n"
+#~ "a - discard this hunk and all later hunks in the file\n"
+#~ "d - do not discard this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - descarta aquest tros de l'índex i de l'arbre de treball\n"
+#~ "n - no descartis aquest tros des de l'índex i de l'arbre de treball\n"
+#~ "q - surt; no descartis aquest tros ni cap dels pendents\n"
+#~ "a - descarta aquest tros i tots els trossos posteriors en el fitxer\n"
+#~ "d - no descartis aquest tros ni cap dels trossos posteriors en el fitxer"
+
+#~ msgid ""
+#~ "y - apply this hunk to index and worktree\n"
+#~ "n - do not apply this hunk to index and worktree\n"
+#~ "q - quit; do not apply this hunk or any of the remaining ones\n"
+#~ "a - apply this hunk and all later hunks in the file\n"
+#~ "d - do not apply this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - aplica aquest tros a l'índex i l'arbre de treball\n"
+#~ "n - no apliquis aquest tros des de l'índex i de l'arbre de treball\n"
+#~ "q - surt; no apliquis aquest tros ni cap dels pendents\n"
+#~ "a - aplica aquest tros i tots els trossos posteriors en el fitxer\n"
+#~ "d - no apliquis aquest tros ni cap dels trossos posteriors en el fitxer"
+
+#~ msgid ""
+#~ "y - apply this hunk to worktree\n"
+#~ "n - do not apply this hunk to worktree\n"
+#~ "q - quit; do not apply this hunk or any of the remaining ones\n"
+#~ "a - apply this hunk and all later hunks in the file\n"
+#~ "d - do not apply this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - aplica aquest tros a l'arbre de treball\n"
+#~ "n - no apliquis aquest tros a l'arbre de treball\n"
+#~ "q - surt; no apliquis aquest tros ni cap dels pendents\n"
+#~ "a - aplica aquest tros i tots els trossos posteriors en el fitxer\n"
+#~ "d - no apliquis aquest tros ni cap dels trossos posteriors en el fitxer"
+
+#~ msgid ""
+#~ "g - select a hunk to go to\n"
+#~ "/ - search for a hunk matching the given regex\n"
+#~ "j - leave this hunk undecided, see next undecided hunk\n"
+#~ "J - leave this hunk undecided, see next hunk\n"
+#~ "k - leave this hunk undecided, see previous undecided hunk\n"
+#~ "K - leave this hunk undecided, see previous hunk\n"
+#~ "s - split the current hunk into smaller hunks\n"
+#~ "e - manually edit the current hunk\n"
+#~ "? - print help\n"
+#~ msgstr ""
+#~ "g - selecciona el tros on voleu anar\n"
+#~ "/ - cerca un tros que coincideixi amb l'expressió regular donada\n"
+#~ "j - deixa aquest tros sense decidir, veure el tros sense decidir següent\n"
+#~ "J - deixa aquest tros sense decidir, veure el tros següent\n"
+#~ "k - deixa aquest tros sense decidir, veure el tros sense decidir "
+#~ "anterior\n"
+#~ "K - deixa aquest tros sense decidir, veure el tros anterior\n"
+#~ "s - divideix el tros actual en trossos més petits\n"
+#~ "e - edita manualment el tros actual\n"
+#~ "? - mostra l'ajuda\n"
+
+#~ msgid "The selected hunks do not apply to the index!\n"
+#~ msgstr "Els trossos seleccionats no apliquen a l'índex\n"
+
+#, perl-format
+#~ msgid "ignoring unmerged: %s\n"
+#~ msgstr "s'està ignorant %s no fusionat\n"
+
+#~ msgid "No other hunks to goto\n"
+#~ msgstr "No hi ha altres trossos on anar-hi\n"
+
+#, perl-format
+#~ msgid "Invalid number: '%s'\n"
+#~ msgstr "Número no vàlid: «%s»\n"
+
+#, perl-format
+#~ msgid "Sorry, only %d hunk available.\n"
+#~ msgid_plural "Sorry, only %d hunks available.\n"
+#~ msgstr[0] "Només %d tros disponible.\n"
+#~ msgstr[1] "Només %d trossos disponibles.\n"
+
+#~ msgid "No other hunks to search\n"
+#~ msgstr "No hi ha cap altre tros a cercar\n"
+
+#, perl-format
+#~ msgid "Malformed search regexp %s: %s\n"
+#~ msgstr "Expressió regular de cerca mal formada %s: %s\n"
+
+#~ msgid "No hunk matches the given pattern\n"
+#~ msgstr "No hi ha trossos que coincideixin amb el patró donat\n"
+
+#~ msgid "No previous hunk\n"
+#~ msgstr "Sense tros previ\n"
+
+#~ msgid "No next hunk\n"
+#~ msgstr "No hi ha tros següent\n"
+
+#~ msgid "Sorry, cannot split this hunk\n"
+#~ msgstr "No es pot dividir aquest tros\n"
+
+#, perl-format
+#~ msgid "Split into %d hunk.\n"
+#~ msgid_plural "Split into %d hunks.\n"
+#~ msgstr[0] "Divideix en %d tros.\n"
+#~ msgstr[1] "Divideix en %d trossos.\n"
+
+#~ msgid "Sorry, cannot edit this hunk\n"
+#~ msgstr "No es pot editar aquest tros\n"
+
+#~ msgid ""
+#~ "status - show paths with changes\n"
+#~ "update - add working tree state to the staged set of changes\n"
+#~ "revert - revert staged set of changes back to the HEAD version\n"
+#~ "patch - pick hunks and update selectively\n"
+#~ "diff - view diff between HEAD and index\n"
+#~ "add untracked - add contents of untracked files to the staged set of "
+#~ "changes\n"
#~ msgstr ""
-#~ "Nota: %s no està actualitzat i en forma de comprovar la versió en "
-#~ "conflicte; còpia antiga reanomenada a %s"
+#~ "status - mostra els camins amb canvis\n"
+#~ "update - afegeix l'estat de l'arbre de treball al conjunt de "
+#~ "canvis «staged»\n"
+#~ "revert - reverteix el conjunt de canvis de «staged» a la versió "
+#~ "HEAD\n"
+#~ "patch - selecciona trossos i actualitza'ls selectivament\n"
+#~ "diff - mostra la diferència entre HEAD i l'índex\n"
+#~ "add untracked - afegeix el contingut dels fitxers no seguits al conjunt "
+#~ "de canvis «staged»\n"
+
+#~ msgid "missing --"
+#~ msgstr "manca --"
+
+#, perl-format
+#~ msgid "unknown --patch mode: %s"
+#~ msgstr "desconegut --patch mode: %s"
+
+#, perl-format
+#~ msgid "invalid argument %s, expecting --"
+#~ msgstr "argument %s no vàlid, s'esperava --"
#, c-format
-#~ msgid "%s: fast-forward"
-#~ msgstr "%s: avanç ràpid"
+#~ msgid "unable to normalize object directory: %s"
+#~ msgstr "no s'ha pogut normalitzar el directori de l'objecte: %s"
diff --git a/po/de.po b/po/de.po
index f5c9c29e0b..7559a8c64e 100644
--- a/po/de.po
+++ b/po/de.po
@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Git\n"
"Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2022-09-28 17:09+0200\n"
-"PO-Revision-Date: 2022-09-28 17:10+0200\n"
+"POT-Creation-Date: 2023-03-03 17:13+0100\n"
+"PO-Revision-Date: 2023-03-03 13:46+0100\n"
"Last-Translator: Ralf Thielow <ralf.thielow@gmail.com>\n"
"Language-Team: German\n"
"Language: de\n"
@@ -17,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n!=1);\n"
-"X-Generator: Poedit 3.1.1\n"
+"X-Generator: Poedit 3.2.2\n"
#, c-format
msgid "Huh (%s)?"
@@ -45,13 +45,13 @@ msgstr "Konnte '%s' nicht zum Commit vormerken."
msgid "could not write index"
msgstr "konnte Index nicht schreiben"
-#, c-format, perl-format
+#, c-format
msgid "updated %d path\n"
msgid_plural "updated %d paths\n"
msgstr[0] "%d Pfad aktualisiert\n"
msgstr[1] "%d Pfade aktualisiert\n"
-#, c-format, perl-format
+#, c-format
msgid "note: %s is untracked now.\n"
msgstr "Hinweis: %s ist nun unversioniert.\n"
@@ -65,7 +65,7 @@ msgstr "Revert"
msgid "Could not parse HEAD^{tree}"
msgstr "Konnte HEAD^{tree} nicht parsen."
-#, c-format, perl-format
+#, c-format
msgid "reverted %d path\n"
msgid_plural "reverted %d paths\n"
msgstr[0] "%d Pfad wiederhergestellt\n"
@@ -78,7 +78,7 @@ msgstr "Keine unversionierten Dateien.\n"
msgid "Add untracked"
msgstr "Unversionierte Dateien hinzufügen"
-#, c-format, perl-format
+#, c-format
msgid "added %d path\n"
msgid_plural "added %d paths\n"
msgstr[0] "%d Pfad hinzugefügt\n"
@@ -172,19 +172,19 @@ msgstr "Index konnte nicht aktualisiert werden"
msgid "Bye.\n"
msgstr "Tschüss.\n"
-#, c-format, perl-format
+#, c-format
msgid "Stage mode change [y,n,q,a,d%s,?]? "
msgstr "Modusänderung der Staging-Area hinzufügen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage deletion [y,n,q,a,d%s,?]? "
msgstr "Löschung der Staging-Area hinzufügen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage addition [y,n,q,a,d%s,?]? "
msgstr "Ergänzung der Staging-Area hinzufügen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage this hunk [y,n,q,a,d%s,?]? "
msgstr "Diesen Patch-Block der Staging-Area hinzufügen [y,n,q,a,d%s,?]? "
@@ -210,19 +210,19 @@ msgstr ""
"d - diesen oder alle weiteren Patch-Blöcke in dieser Datei nicht zum Commit "
"vormerken\n"
-#, c-format, perl-format
+#, c-format
msgid "Stash mode change [y,n,q,a,d%s,?]? "
msgstr "Modusänderung stashen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash deletion [y,n,q,a,d%s,?]? "
msgstr "Löschung stashen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash addition [y,n,q,a,d%s,?]? "
msgstr "Ergänzung stashen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash this hunk [y,n,q,a,d%s,?]? "
msgstr "Diesen Patch-Block stashen [y,n,q,a,d%s,?]? "
@@ -246,19 +246,19 @@ msgstr ""
"a - diesen und alle weiteren Patch-Blöcke dieser Datei stashen\n"
"d - diesen oder alle weiteren Patch-Blöcke dieser Datei nicht stashen\n"
-#, c-format, perl-format
+#, c-format
msgid "Unstage mode change [y,n,q,a,d%s,?]? "
msgstr "Modusänderung aus der Staging-Area entfernen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage deletion [y,n,q,a,d%s,?]? "
msgstr "Löschung aus der Staging-Area entfernen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage addition [y,n,q,a,d%s,?]? "
msgstr "Ergänzung aus der Staging-Area entfernen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage this hunk [y,n,q,a,d%s,?]? "
msgstr "Diesen Patch-Block aus der Staging-Area entfernen [y,n,q,a,d%s,?]? "
@@ -285,19 +285,19 @@ msgstr ""
"d - diesen oder alle weiteren Patch-Blöcke dieser Datei nicht aus Staging-"
"Area entfernen\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to index [y,n,q,a,d%s,?]? "
msgstr "Modusänderung auf Index anwenden [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to index [y,n,q,a,d%s,?]? "
msgstr "Löschung auf Index anwenden [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to index [y,n,q,a,d%s,?]? "
msgstr "Ergänzung auf Index anwenden [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to index [y,n,q,a,d%s,?]? "
msgstr "Diesen Patch-Block auf Index anwenden [y,n,q,a,d%s,?]? "
@@ -324,19 +324,19 @@ msgstr ""
"d - diesen oder alle weiteren Patch-Blöcke dieser Datei nicht auf den Index "
"anwenden\n"
-#, c-format, perl-format
+#, c-format
msgid "Discard mode change from worktree [y,n,q,a,d%s,?]? "
msgstr "Modusänderung im Arbeitsverzeichnis verwerfen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard deletion from worktree [y,n,q,a,d%s,?]? "
msgstr "Löschung im Arbeitsverzeichnis verwerfen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard addition from worktree [y,n,q,a,d%s,?]? "
msgstr "Ergänzung im Arbeitsverzeichnis verwerfen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard this hunk from worktree [y,n,q,a,d%s,?]? "
msgstr "Diesen Patch-Block im Arbeitsverzeichnis verwerfen [y,n,q,a,d%s,?]? "
@@ -363,24 +363,24 @@ msgstr ""
"d - diesen oder alle weiteren Patch-Blöcke dieser Datei nicht im "
"Arbeitsverzeichnis verwerfen\n"
-#, c-format, perl-format
+#, c-format
msgid "Discard mode change from index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Modusänderung vom Index und Arbeitsverzeichnis verwerfen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard deletion from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Löschung vom Index und Arbeitsverzeichnis verwerfen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard addition from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Ergänzung im Index und Arbeitsverzeichnis verwerfen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard this hunk from index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
-"Diesen Patch-Block vom Index und Arbeitsverzeichnis verwerfen [y,n,q,a,d"
-"%s,?]? "
+"Diesen Patch-Block vom Index und Arbeitsverzeichnis verwerfen [y,n,q,a,"
+"d%s,?]? "
msgid ""
"y - discard this hunk from index and worktree\n"
@@ -395,24 +395,24 @@ msgstr ""
"a - diesen und alle weiteren Patch-Blöcke in der Datei verwerfen\n"
"d - diesen oder alle weiteren Patch-Blöcke in der Datei nicht verwerfen\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Modusänderung auf Index und Arbeitsverzeichnis anwenden [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Löschung auf Index und Arbeitsverzeichnis anwenden [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Ergänzung auf Index und Arbeitsverzeichnis anwenden [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
-"Diesen Patch-Block auf Index und Arbeitsverzeichnis anwenden [y,n,q,a,d"
-"%s,?]? "
+"Diesen Patch-Block auf Index und Arbeitsverzeichnis anwenden [y,n,q,a,"
+"d%s,?]? "
msgid ""
"y - apply this hunk to index and worktree\n"
@@ -428,19 +428,19 @@ msgstr ""
"a - diesen und alle weiteren Patch-Blöcke in der Datei anwenden\n"
"d - diesen oder alle weiteren Patch-Blöcke in der Datei nicht anwenden\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to worktree [y,n,q,a,d%s,?]? "
msgstr "Modusänderung auf Arbeitsverzeichnis anwenden [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to worktree [y,n,q,a,d%s,?]? "
msgstr "Löschung auf Arbeitsverzeichnis anwenden [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to worktree [y,n,q,a,d%s,?]? "
msgstr "Ergänzung auf Arbeitsverzeichnis anwenden [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Diesen Patch-Block auf das Arbeitsverzeichnis anwenden [y,n,q,a,d%s,?]? "
@@ -519,7 +519,6 @@ msgstr ""
"Um '%c' Zeilen zu entfernen, löschen Sie diese.\n"
"Zeilen, die mit %c beginnen, werden entfernt.\n"
-#. TRANSLATORS: 'it' refers to the patch mentioned in the previous messages.
msgid ""
"If it does not apply cleanly, you will be given an opportunity to\n"
"edit again. If all lines of the hunk are removed, then the edit is\n"
@@ -542,12 +541,6 @@ msgstr "'git apply --cached' schlug fehl"
#. (saying "n" for "no" discards!) if the translation
#. of the word "no" does not start with n.
#.
-#. TRANSLATORS: do not translate [y/n]
-#. The program will only accept that input
-#. at this point.
-#. Consider translating (saying "no" discards!) as
-#. (saying "n" for "no" discards!) if the translation
-#. of the word "no" does not start with n.
msgid ""
"Your edited hunk does not apply. Edit again (saying \"no\" discards!) [y/n]? "
msgstr ""
@@ -786,6 +779,9 @@ msgstr "Befehlszeile endet mit \\"
msgid "unclosed quote"
msgstr "nicht geschlossene Anführungszeichen"
+msgid "too many arguments"
+msgstr "zu viele Argumente"
+
#, c-format
msgid "unrecognized whitespace option '%s'"
msgstr "Nicht erkannte Whitespace-Option: '%s'"
@@ -1413,6 +1409,12 @@ msgstr ".gitattributes aus dem Arbeitsverzeichnis lesen"
msgid "report archived files on stderr"
msgstr "archivierte Dateien in der Standard-Fehlerausgabe ausgeben"
+msgid "time"
+msgstr "Zeit"
+
+msgid "set modification time of archive entries"
+msgstr "Änderungszeitpunkt von Archiveinträgen festlegen"
+
msgid "set compression level"
msgstr "Komprimierungsgrad setzen"
@@ -1453,6 +1455,13 @@ msgstr "Argument für Format '%s' nicht unterstützt: -%d"
msgid "%.*s is not a valid attribute name"
msgstr "%.*s ist kein gültiger Attributname"
+msgid "unable to add additional attribute"
+msgstr "konnte kein zusätzliches Attribut hinzufügen"
+
+#, c-format
+msgid "ignoring overly long attributes line %d"
+msgstr "ignoriere übermäßig lange Attribut-Zeile %d"
+
#, c-format
msgid "%s not allowed: %s:%d"
msgstr "%s nicht erlaubt: %s:%d"
@@ -1465,6 +1474,18 @@ msgstr ""
"Benutzen Sie '\\!' für führende Ausrufezeichen."
#, c-format
+msgid "cannot fstat gitattributes file '%s'"
+msgstr "Kann gitattributes-Datei '%s' nicht lesen"
+
+#, c-format
+msgid "ignoring overly large gitattributes file '%s'"
+msgstr "ignoriere übermäßig große gitattributes-Datei '%s'"
+
+#, c-format
+msgid "ignoring overly large gitattributes blob '%s'"
+msgstr "ignoriere übermäßig großen gitattribute-Blob '%s'"
+
+#, c-format
msgid "Badly quoted content in file '%s': %s"
msgstr "Ungültiger Inhalt bzgl. Anführungszeichen in Datei '%s': %s"
@@ -1648,10 +1669,12 @@ msgstr ""
msgid "not tracking: ambiguous information for ref '%s'"
msgstr "kein Tracking: mehrdeutige Informationen für Referenz '%s'"
+#. #-#-#-#-# branch.c.po #-#-#-#-#
#. TRANSLATORS: This is a line listing a remote with duplicate
#. refspecs in the advice message below. For RTL languages you'll
#. probably want to swap the "%s" and leading " " space around.
#.
+#. #-#-#-#-# object-name.c.po #-#-#-#-#
#. TRANSLATORS: This is line item of ambiguous object output
#. from describe_ambiguous_object() above. For RTL languages
#. you'll probably want to swap the "%s" and leading " " space
@@ -1745,11 +1768,11 @@ msgstr "Submodul '%s': Submodul konnte nicht gefunden werden"
#, c-format
msgid ""
-"You may try updating the submodules using 'git checkout %s && git submodule "
-"update --init'"
+"You may try updating the submodules using 'git checkout --no-recurse-"
+"submodules %s && git submodule update --init'"
msgstr ""
-"Sie können versuchen die Submodule mit 'git checkout %s && git submodule "
-"update --init' zu aktualisieren"
+"Sie können versuchen, die Submodule mit \"git checkout --no-recurse-"
+"submodules %s && git submodule update --init\" zu aktualisieren."
#, c-format
msgid "submodule '%s': cannot create branch '%s'"
@@ -1785,6 +1808,13 @@ msgid "Unstaged changes after refreshing the index:"
msgstr ""
"Nicht zum Commit vorgemerkte Änderungen nach Aktualisierung der Staging-Area:"
+msgid ""
+"the add.interactive.useBuiltin setting has been removed!\n"
+"See its entry in 'git help config' for details."
+msgstr ""
+"Die Einstellung add.interactive.useBuiltin wurde entfernt!\n"
+"Siehe den Eintrag in 'git help config' für Details."
+
msgid "Could not read the index"
msgstr "Konnte den Index nicht lesen"
@@ -2018,8 +2048,8 @@ msgstr ""
#, c-format
msgid "If you prefer to skip this patch, run \"%s --skip\" instead."
msgstr ""
-"Falls Sie diesen Patch auslassen möchten, führen Sie stattdessen \"%s --skip"
-"\" aus."
+"Falls Sie diesen Patch auslassen möchten, führen Sie stattdessen \"%s --"
+"skip\" aus."
#, c-format
msgid "To record the empty patch as an empty commit, run \"%s --allow-empty\"."
@@ -2191,6 +2221,9 @@ msgstr "git am [<Optionen>] (--continue | --skip | --abort)"
msgid "run interactively"
msgstr "interaktiv ausführen"
+msgid "bypass pre-applypatch and applypatch-msg hooks"
+msgstr "Hooks pre-applypatch und applypatch-msg umgehen"
+
msgid "historical option -- no-op"
msgstr "historische Option -- kein Effekt"
@@ -2332,32 +2365,28 @@ msgstr "git archive: Protokollfehler"
msgid "git archive: expected a flush"
msgstr "git archive: erwartete eine Spülung (flush)"
-msgid "git bisect--helper --bisect-reset [<commit>]"
-msgstr "git bisect--helper --bisect-reset [<Commit>]"
-
msgid ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}"
-"=<term>] [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] "
-"[<paths>...]"
+"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>] [--no-"
+"checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]"
msgstr ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<Begriff> --term-{old,"
-"good}=<Begriff>] [--no-checkout] [--first-parent] [<schlecht> [<gut>...]] "
-"[--] [<Pfade>...]"
+"git bisect start [--term-{new,bad}=<Begriff> --term-{old,good}=<Begriff>] [--"
+"no-checkout] [--first-parent] [<schlecht> [<gut>...]] [--] "
+"[<Pfadspezifikation>...]"
-msgid "git bisect--helper --bisect-state (bad|new) [<rev>]"
-msgstr "git bisect--helper --bisect-state (bad|new) [<Commit>]"
+msgid "git bisect (good|bad) [<rev>...]"
+msgstr "git bisect (good|bad) [<Commit>...]"
-msgid "git bisect--helper --bisect-state (good|old) [<rev>...]"
-msgstr "git bisect--helper --bisect-state (good|old) [<Commit>...]"
+msgid "git bisect skip [(<rev>|<range>)...]"
+msgstr "git bisect skip [(<Commit>|<Bereich>)...]"
-msgid "git bisect--helper --bisect-replay <filename>"
-msgstr "git bisect--helper --bisect-replay <Dateiname>"
+msgid "git bisect reset [<commit>]"
+msgstr "git bisect reset [<Commit>]"
-msgid "git bisect--helper --bisect-skip [(<rev>|<range>)...]"
-msgstr "git bisect--helper --bisect-skip [(<Commit>|<Bereich>)...]"
+msgid "git bisect replay <logfile>"
+msgstr "git bisect replay <Logdatei>"
-msgid "git bisect--helper --bisect-run <cmd>..."
-msgstr "git bisect--helper --bisect-run <Programm>..."
+msgid "git bisect run <cmd>..."
+msgstr "git bisect run <Programm>..."
#, c-format
msgid "cannot open file '%s' in mode '%s'"
@@ -2504,10 +2533,6 @@ msgstr ""
"Auschecken von '%s' fehlgeschlagen. Versuchen Sie 'git bisect start "
"<gültiger-Branch>'."
-msgid "won't bisect on cg-seek'ed tree"
-msgstr ""
-"binäre Suche auf einem durch 'cg-seek' geändertem Verzeichnis nicht möglich"
-
msgid "bad HEAD - strange symbolic ref"
msgstr "ungültiger HEAD - merkwürdige symbolische Referenz"
@@ -2559,16 +2584,16 @@ msgid "bisect run failed: no command provided."
msgstr "'bisect run' fehlgeschlagen: kein Befehl angegeben."
#, c-format
-msgid "unable to verify '%s' on good revision"
-msgstr "konnte '%s' nicht für guten Commit überprüfen"
+msgid "unable to verify %s on good revision"
+msgstr "kann %s bei gutem Commit nicht verifizieren"
#, c-format
msgid "bogus exit code %d for good revision"
msgstr "fehlerhafter Exit-Code %d für guten Commit"
#, c-format
-msgid "bisect run failed: exit code %d from '%s' is < 0 or >= 128"
-msgstr "'bisect run' fehlgeschlagen: Exit-Code %d von '%s' ist < 0 oder >= 128"
+msgid "bisect run failed: exit code %d from %s is < 0 or >= 128"
+msgstr "bisect-Lauf fehlgeschlagen: Exit-Code %d von %s ist < 0 oder >= 128"
#, c-format
msgid "cannot open file '%s' for writing"
@@ -2577,76 +2602,49 @@ msgstr "Datei '%s' kann nicht zum Schreiben geöffnet werden"
msgid "bisect run cannot continue any more"
msgstr "'bisect run' kann nicht mehr fortgesetzt werden"
-#, c-format
msgid "bisect run success"
msgstr "'bisect run' erfolgreich ausgeführt"
-#, c-format
msgid "bisect found first bad commit"
msgstr "binäre Suche fand ersten schlechten Commit"
#, c-format
-msgid ""
-"bisect run failed: 'git bisect--helper --bisect-state %s' exited with error "
-"code %d"
+msgid "bisect run failed: 'git bisect %s' exited with error code %d"
msgstr ""
-"'bisect run' fehlgeschlagen: 'git bisect--helper --bisect-state %s' mit "
-"Fehlercode %d beendet"
-
-msgid "reset the bisection state"
-msgstr "den Zustand der binären Suche zurücksetzen"
-
-msgid "check whether bad or good terms exist"
-msgstr "prüfen, ob Begriffe für gute und schlechte Commits existieren"
-
-msgid "print out the bisect terms"
-msgstr "die Begriffe für die binäre Suche ausgeben"
+"bisect-Lauf fehlgeschlagen: 'git bisect %s' wurde mit Fehlercode %d beendet"
-msgid "start the bisect session"
-msgstr "Sitzung für binäre Suche starten"
-
-msgid "find the next bisection commit"
-msgstr "nächsten Commit für die binäre Suche finden"
-
-msgid "mark the state of ref (or refs)"
-msgstr "den Status der Referenz(en) markieren"
-
-msgid "list the bisection steps so far"
-msgstr "die bisherigen Schritte der binären Suche auflisten"
-
-msgid "replay the bisection process from the given file"
-msgstr "binäre Suche aus der angegebenen Datei wiederholen"
-
-msgid "skip some commits for checkout"
-msgstr "einige Commits für das Auschecken überspringen"
-
-msgid "visualize the bisection"
-msgstr "binäre Suche visualisieren"
-
-msgid "use <cmd>... to automatically bisect"
-msgstr "verwende <Programm>... für die automatische binäre Suche"
+#, c-format
+msgid "'%s' requires either no argument or a commit"
+msgstr "'%s' erfordert entweder kein Argument oder einen Commit"
-msgid "no log for BISECT_WRITE"
-msgstr "kein Log für BISECT_WRITE"
+#, c-format
+msgid "'%s' requires 0 or 1 argument"
+msgstr "'%s' erfordert 0 oder 1 Argument"
-msgid "--bisect-reset requires either no argument or a commit"
-msgstr "--bisect-reset benötigt entweder kein Argument oder ein Commit"
+#, c-format
+msgid "'%s' requires 0 arguments"
+msgstr "'%s' erfordert 0 Argumente"
-msgid "--bisect-terms requires 0 or 1 argument"
-msgstr "--bisect-terms benötigt 0 oder 1 Argument"
+msgid "no logfile given"
+msgstr "keine Log-Datei angegeben"
-msgid "--bisect-next requires 0 arguments"
-msgstr "--bisect-next benötigt 0 Argumente"
+#, c-format
+msgid "'%s' failed: no command provided."
+msgstr "'%s' ist fehlgeschlagen: kein Befehl angegeben."
-msgid "--bisect-log requires 0 arguments"
-msgstr "--bisect-log benötigt 0 Argumente"
+msgid "need a command"
+msgstr "Befehl benötigt"
-msgid "no logfile given"
-msgstr "keine Log-Datei angegeben"
+#, c-format
+msgid "unknown command: '%s'"
+msgstr "unbekannter Befehl: '%s'"
msgid "git blame [<options>] [<rev-opts>] [<rev>] [--] <file>"
msgstr "git blame [<Optionen>] [<rev-opts>] [<Commit>] [--] <Datei>"
+msgid "git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>"
+msgstr "git annotate [<Optionen>] [<rev-opts>] [<Commit>] [--] <Datei>"
+
msgid "<rev-opts> are documented in git-rev-list(1)"
msgstr "<rev-opts> sind dokumentiert in git-rev-list(1)"
@@ -2842,9 +2840,6 @@ msgstr "Aktualisierung der Konfigurationsdatei fehlgeschlagen."
msgid "cannot use -a with -d"
msgstr "kann -a nicht mit -d benutzen"
-msgid "Couldn't look up commit object for HEAD"
-msgstr "Konnte Commit-Objekt für HEAD nicht nachschlagen."
-
#, c-format
msgid "Cannot delete branch '%s' checked out at '%s'"
msgstr "Kann Branch '%s' nicht entfernen, ausgecheckt in '%s'."
@@ -2883,19 +2878,18 @@ msgstr "Branch %s wird auf %s umgesetzt"
msgid "Branch %s is being bisected at %s"
msgstr "Binäre Suche von Branch %s zu %s im Gange"
-msgid "cannot copy the current branch while not on any."
-msgstr ""
-"Kann den aktuellen Branch nicht kopieren, solange Sie sich auf keinem "
-"befinden."
-
-msgid "cannot rename the current branch while not on any."
-msgstr ""
-"Kann aktuellen Branch nicht umbenennen, solange Sie sich auf keinem befinden."
-
#, c-format
msgid "Invalid branch name: '%s'"
msgstr "Ungültiger Branchname: '%s'"
+#, c-format
+msgid "No commit on branch '%s' yet."
+msgstr "Noch kein Commit in Branch '%s'."
+
+#, c-format
+msgid "No branch named '%s'."
+msgstr "Branch '%s' nicht vorhanden."
+
msgid "Branch rename failed"
msgstr "Umbenennung des Branches fehlgeschlagen"
@@ -3059,13 +3053,14 @@ msgstr "zu losgelöstem HEAD kann keine Beschreibung hinterlegt werden"
msgid "cannot edit description of more than one branch"
msgstr "Beschreibung von mehr als einem Branch kann nicht bearbeitet werden"
-#, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "Noch kein Commit in Branch '%s'."
+msgid "cannot copy the current branch while not on any."
+msgstr ""
+"Kann den aktuellen Branch nicht kopieren, solange Sie sich auf keinem "
+"befinden."
-#, c-format
-msgid "No branch named '%s'."
-msgstr "Branch '%s' nicht vorhanden."
+msgid "cannot rename the current branch while not on any."
+msgstr ""
+"Kann aktuellen Branch nicht umbenennen, solange Sie sich auf keinem befinden."
msgid "too many branches for a copy operation"
msgstr "zu viele Branches für eine Kopieroperation angegeben"
@@ -3137,11 +3132,11 @@ msgid "not run from a git repository - no hooks to show\n"
msgstr "nicht in einem Git-Repository ausgeführt - keine Hooks zum Anzeigen\n"
msgid ""
-"git bugreport [-o|--output-directory <file>] [-s|--suffix <format>] [--"
-"diagnose[=<mode>]"
+"git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--diagnose[=<mode>]]"
msgstr ""
-"git bugreport [-o|--output-directory <Datei>] [-s|--suffix <Format>] [--"
-"diagnose[=<Modus>]"
+"git bugreport [(-o | --output-directory) <Pfad>] [(-s | --suffix) <Format>]\n"
+" [--diagnose[=<Modus>]]"
msgid ""
"Thank you for filling out a Git bug report!\n"
@@ -3216,17 +3211,26 @@ msgstr "konnte nicht nach %s schreiben"
msgid "Created new report at '%s'.\n"
msgstr "Neuer Bericht unter '%s' erstellt.\n"
-msgid "git bundle create [<options>] <file> <git-rev-list args>"
-msgstr "git bundle create [<Optionen>] <Datei> <git-rev-list Argumente>"
+msgid ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<version>] <file> <git-rev-list-args>"
+msgstr ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<Version>] <Datei> <git-rev-list-Argumente>"
-msgid "git bundle verify [<options>] <file>"
-msgstr "git bundle verify [<Optionen>] <Datei>"
+msgid "git bundle verify [-q | --quiet] <file>"
+msgstr "git bundle verify [-q | --quiet] <Datei>"
msgid "git bundle list-heads <file> [<refname>...]"
msgstr "git bundle list-heads <Datei> [<Referenzname>...]"
-msgid "git bundle unbundle <file> [<refname>...]"
-msgstr "git bundle unbundle <Datei> [<Referenzname>...]"
+msgid "git bundle unbundle [--progress] <file> [<refname>...]"
+msgstr "git bundle unbundle [--progress] <Datei> [<Referenzname>...]"
+
+msgid "need a <file> argument"
+msgstr "<Datei> Argument benötigt"
msgid "do not show progress meter"
msgstr "keine Fortschrittsanzeige anzeigen"
@@ -3281,10 +3285,6 @@ msgstr "%s benötigt Argumente"
msgid "%s takes no arguments"
msgstr "%s braucht kein Argument"
-#, c-format
-msgid "unknown command: '%s'"
-msgstr "unbekannter Befehl: '%s'"
-
msgid "only one batch option may be specified"
msgstr "Nur eine Batch-Option erlaubt."
@@ -3301,12 +3301,12 @@ msgid ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgstr ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgid ""
"git cat-file (--textconv | --filters)\n"
@@ -3419,18 +3419,22 @@ msgstr "<Commit> benötigt mit '%s'"
msgid "<object> required with '-%c'"
msgstr "<Objekt> benötigt mit '-%c'"
-msgid "too many arguments"
-msgstr "zu viele Argumente"
-
#, c-format
msgid "only two arguments allowed in <type> <object> mode, not %d"
msgstr "nur zwei Argumente im <Typ> <Objekt> Modus erlaubt, nicht %d"
-msgid "git check-attr [-a | --all | <attr>...] [--] <pathname>..."
-msgstr "git check-attr [-a | --all | <Attribut>...] [--] <Pfadname>..."
+msgid ""
+"git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] "
+"<pathname>..."
+msgstr ""
+"git check-attr [--source <Commit-Referenz>] [-a | --all | <Attribut>...] "
+"[--] <Pfadname>..."
-msgid "git check-attr --stdin [-z] [-a | --all | <attr>...]"
-msgstr "git check-attr --stdin [-z] [-a | --all | <Attribut>...]"
+msgid ""
+"git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]"
+msgstr ""
+"git check-attr --stdin [-z] [--source <Commit-Referenz>] [-a | --all | "
+"<Attribut>...]"
msgid "report all attributes set on file"
msgstr "alle Attribute einer Datei ausgeben"
@@ -3444,6 +3448,12 @@ msgstr "Dateinamen von der Standard-Eingabe lesen"
msgid "terminate input and output records by a NUL character"
msgstr "Einträge von Ein- und Ausgabe mit NUL-Zeichen abschließen"
+msgid "<tree-ish>"
+msgstr "<Commit-Referenz>"
+
+msgid "which tree-ish to check attributes at"
+msgstr "in welchem Commit die Attribute zu prüfen sind"
+
msgid "suppress progress reporting"
msgstr "Fortschrittsanzeige unterdrücken"
@@ -3968,9 +3978,11 @@ msgid "use overlay mode"
msgstr "benutze Overlay-Modus"
msgid ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] "
+"[<pathspec>...]"
msgstr ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <Muster>] [-x | -X] [--] <Pfade>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <Muster>] [-x | -X] [--] "
+"[<Pfadspezifikation>...]"
#, c-format
msgid "Removing %s\n"
@@ -4034,7 +4046,7 @@ msgstr ""
"* - alle Elemente auswählen\n"
" - (leer) Auswahl beenden\n"
-#, c-format, perl-format
+#, c-format
msgid "Huh (%s)?\n"
msgstr "Wie bitte (%s)?\n"
@@ -4184,9 +4196,6 @@ msgid "create a shallow clone of that depth"
msgstr ""
"einen Klon mit unvollständiger Historie (shallow) in dieser Tiefe erstellen"
-msgid "time"
-msgstr "Zeit"
-
msgid "create a shallow clone since a specific time"
msgstr ""
"einen Klon mit unvollständiger Historie (shallow) seit einer bestimmten "
@@ -4270,6 +4279,11 @@ msgid "failed to start iterator over '%s'"
msgstr "Fehler beim Starten der Iteration über '%s'"
#, c-format
+msgid "symlink '%s' exists, refusing to clone with --local"
+msgstr ""
+"symbolische Verknüpfung '%s' existiert, verweigere das Klonen mit --local"
+
+#, c-format
msgid "failed to unlink '%s'"
msgstr "Konnte '%s' nicht entfernen."
@@ -4335,10 +4349,6 @@ msgstr "Zu viele Argumente."
msgid "You must specify a repository to clone."
msgstr "Sie müssen ein Repository zum Klonen angeben."
-#, c-format
-msgid "options '%s' and '%s %s' cannot be used together"
-msgstr "die Optionen '%s' und '%s %s' können nicht gemeinsam verwendet werden"
-
msgid ""
"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
"exclude"
@@ -4437,6 +4447,9 @@ msgstr "konnte das Repository nicht initialisieren, überspringe Bundle-URI"
msgid "failed to fetch objects from bundle URI '%s'"
msgstr "Objekte aus Bundle-URI '%s' konnten nicht abgerufen werden"
+msgid "failed to fetch advertised bundles"
+msgstr "angekündigte Bundles konnten nicht abgerufen werden"
+
msgid "remote transport reported error"
msgstr "Remoteübertragung meldete Fehler"
@@ -4472,19 +4485,25 @@ msgid "--command must be the first argument"
msgstr "--command muss an erster Stelle stehen"
msgid ""
-"git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"
+"git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]"
msgstr ""
-"git commit-graph verify [--object-dir <Objektverzeichnis>] [--shallow] [--"
+"git commit-graph verify [--object-dir <Verzeichnis>] [--shallow] [--"
"[no-]progress]"
msgid ""
-"git commit-graph write [--object-dir <objdir>] [--append] [--"
-"split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] <split options>"
+"git commit-graph write [--object-dir <dir>] [--append]\n"
+" [--split[=<strategy>]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <split options>"
msgstr ""
-"git commit-graph write [--object-dir <Objektverzeichnis>] [--append] [--"
-"split[=<Strategie>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <Anzahl>] [--[no-]progress] <Split-Optionen>"
+"git commit-graph write [--object-dir <Verzeichnis>] [--append]\n"
+" [--split[=<Strategie>]] [--reachable | --stdin-packs "
+"| --stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <Split-Optionen>"
msgid "dir"
msgstr "Verzeichnis"
@@ -4558,12 +4577,15 @@ msgstr ""
msgid "Collecting commits from input"
msgstr "Sammle Commits von der Standard-Eingabe"
+msgid "git commit-tree <tree> [(-p <parent>)...]"
+msgstr "git commit-tree <Tree-Objekt> [(-p <Elternteil>)...]"
+
msgid ""
-"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...] [(-F "
-"<file>)...] <tree>"
+"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n"
+" [(-F <file>)...] <tree>"
msgstr ""
-"git commit-tree [(-p <Eltern-Commit>)...] [-S[<Key-ID>]] [(-m "
-"<Nachricht>)...] [(-F <Datei>)...] <Tree-Objekt>"
+"git commit-tree [(-p <Elternteil>)...] [-S[<Key-ID>]] [(-m <Nachricht>)...]\n"
+" [(-F <Datei>)...] <Tree-Objekt>"
#, c-format
msgid "duplicate parent %s ignored"
@@ -4605,11 +4627,29 @@ msgstr "Brauche genau ein Tree-Objekt."
msgid "git commit-tree: failed to read"
msgstr "git commit-tree: Fehler beim Lesen"
-msgid "git commit [<options>] [--] <pathspec>..."
-msgstr "git commit [<Optionen>] [--] <Pfadspezifikation>..."
+msgid ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|"
+"reword):]<commit>)]\n"
+" [-F <file> | -m <msg>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n"
+" [--date=<date>] [--cleanup=<mode>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<Modus>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <Commit> | --fixup [(amend|"
+"reword):]<Commit>)]\n"
+" [-F <Datei> | -m <Nachricht>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<Autor>]\n"
+" [--date=<Datum>] [--cleanup=<Modus>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<Datei> [--pathspec-file-nul]]\n"
+" [(--trailer <Token>[(=|:)<Wert>])...] [-S[<Key-Id>]]\n"
+" [--] [<Pfadspezifikation>...]"
-msgid "git status [<options>] [--] <pathspec>..."
-msgstr "git status [<Optionen>] [--] <Pfadspezifikation>..."
+msgid "git status [<options>] [--] [<pathspec>...]"
+msgstr "git status [<Optionen>] [--] [<Pfadspezifikation>...]"
msgid ""
"You asked to amend the most recent commit, but doing so would make\n"
@@ -5396,11 +5436,20 @@ msgstr "credential-cache nicht verfügbar; Unix-Socket wird nicht unterstützt"
msgid "unable to get credential storage lock in %d ms"
msgstr "konnte Sperre für Zugangsdatenspeicher nicht in %d ms bekommen"
-msgid "git describe [<options>] [<commit-ish>...]"
-msgstr "git describe [<Optionen>] [<Commit-Angabe>...]"
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<Commit-"
+"Angabe>...]"
-msgid "git describe [<options>] --dirty"
-msgstr "git describe [<Optionen>] --dirty"
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --"
+"dirty[=<Markierung>]"
+
+msgid "git describe <blob>"
+msgstr "git describe <Blob>"
msgid "head"
msgstr "Branch"
@@ -5511,8 +5560,8 @@ msgstr "Markierung"
msgid "append <mark> on dirty working tree (default: \"-dirty\")"
msgstr ""
-"<Markierung> bei geändertem Arbeitsverzeichnis anhängen (Standard: \"-dirty"
-"\")"
+"<Markierung> bei geändertem Arbeitsverzeichnis anhängen (Standard: \"-"
+"dirty\")"
msgid "append <mark> on broken working tree (default: \"-broken\")"
msgstr ""
@@ -5526,11 +5575,11 @@ msgid "option '%s' and commit-ishes cannot be used together"
msgstr "Option '%s' und Commit-Angaben können nicht gemeinsam verwendet werden"
msgid ""
-"git diagnose [-o|--output-directory <path>] [-s|--suffix <format>] [--"
-"mode=<mode>]"
+"git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--mode=<mode>]"
msgstr ""
-"git diagnose [-o|--output-directory <Pfad>] [-s|--suffix <Format>] [--"
-"mode=<Modus>]"
+"git diagnose [(-o | --output-directory) <Pfad>] [(-s | --suffix) <Format>]\n"
+" [--mode=<Modus>]"
msgid "specify a destination for the diagnostics archive"
msgstr "einen Zielort für das Diagnosearchiv angeben"
@@ -5548,6 +5597,9 @@ msgstr "--merge-base funktioniert nur mit zwei Commits"
msgid "'%s': not a regular file or symlink"
msgstr "'%s': keine reguläre Datei oder symbolische Verknüpfung"
+msgid "no merge given, only parents."
+msgstr "kein Merge gegeben, nur Eltern."
+
#, c-format
msgid "invalid option: %s"
msgstr "Ungültige Option: %s"
@@ -5663,29 +5715,6 @@ msgstr "kein <Tool> für --tool=<Tool> angegeben"
msgid "no <cmd> given for --extcmd=<cmd>"
msgstr "kein <Programm> für --extcmd=<Programm> angegeben"
-msgid "git env--helper --type=[bool|ulong] <options> <env-var>"
-msgstr "git env--helper --type=[bool|ulong] <Optionen> <Umgebungsvariable>"
-
-msgid "default for git_env_*(...) to fall back on"
-msgstr "Standard für git_env_*(...), um darauf zurückzugreifen"
-
-msgid "be quiet only use git_env_*() value as exit code"
-msgstr "Ausgaben unterdrücken; nur git_env_*() Werte als Exit-Code verwenden"
-
-#, c-format
-msgid "option `--default' expects a boolean value with `--type=bool`, not `%s`"
-msgstr ""
-"Option `--default' erwartet einen booleschen Wert bei `--type=bool`, nicht `"
-"%s`"
-
-#, c-format
-msgid ""
-"option `--default' expects an unsigned long value with `--type=ulong`, not `"
-"%s`"
-msgstr ""
-"Option `--default' erwartet einen vorzeichenlosen Long-Wert bei `--"
-"type=ulong`, nicht `%s`"
-
msgid "git fast-export [<rev-list-opts>]"
msgstr "git fast-export [<rev-list-opts>]"
@@ -6099,6 +6128,10 @@ msgstr ""
"--unshallow kann nicht in einem Repository mit vollständiger Historie "
"verwendet werden"
+#, c-format
+msgid "failed to fetch bundles from '%s'"
+msgstr "Bundles aus '%s' konnten nicht abgerufen werden"
+
msgid "fetch --all does not take a repository argument"
msgstr "fetch --all akzeptiert kein Repository als Argument"
@@ -6206,8 +6239,8 @@ msgstr "nur Referenzen ausgeben, die diesen Commit enthalten"
msgid "print only refs which don't contain the commit"
msgstr "nur Referenzen ausgeben, die diesen Commit nicht enthalten"
-msgid "git for-each-repo --config=<config> <command-args>"
-msgstr "git for-each-repo --config=<Konfiguration> <Befehlsargumente>"
+msgid "git for-each-repo --config=<config> [--] <arguments>"
+msgstr "git for-each-repo --config=<Konfiguration> [--] <Argumente>"
msgid "config"
msgstr "Konfiguration"
@@ -6378,8 +6411,16 @@ msgstr "non-tree in Cache-Verzeichnis"
msgid "%s: invalid sha1 pointer in resolve-undo"
msgstr "%s: Ungültiger sha1-Zeiger in resolve-undo"
-msgid "git fsck [<options>] [<object>...]"
-msgstr "git fsck [<Optionen>] [<Objekt>...]"
+msgid ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<object>...]"
+msgstr ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<Objekt>...]"
msgid "show unreachable objects"
msgstr "unerreichbare Objekte anzeigen"
@@ -6434,12 +6475,6 @@ msgstr "git fsmonitor--daemon start [<Optionen>]"
msgid "git fsmonitor--daemon run [<options>]"
msgstr "git fsmonitor--daemon run [<Optionen>]"
-msgid "git fsmonitor--daemon stop"
-msgstr "git fsmonitor--daemon stop"
-
-msgid "git fsmonitor--daemon status"
-msgstr "git fsmonitor--daemon status"
-
#, c-format
msgid "value of '%s' out of range: %d"
msgstr "Wert von '%s' außerhalb des Bereichs: %d"
@@ -6689,8 +6724,20 @@ msgid "use at most one of --auto and --schedule=<frequency>"
msgstr ""
"nutzen Sie höchstens eine der Optionen --auto oder --schedule=<Häufigkeit>"
-msgid "failed to run 'git config'"
-msgstr "Fehler beim Ausführen von 'git config'"
+#, c-format
+msgid "unable to add '%s' value of '%s'"
+msgstr "Wert '%s' von '%s' kann nicht hinzugefügt werden"
+
+msgid "return success even if repository was not registered"
+msgstr "Erfolg zurückgeben, auch wenn das Repository nicht registriert wurde"
+
+#, c-format
+msgid "unable to unset '%s' value of '%s'"
+msgstr "Wert '%s' von '%s' kann nicht zurückgesetzt werden"
+
+#, c-format
+msgid "repository '%s' is not registered"
+msgstr "Repository '%s' ist nicht registriert"
#, c-format
msgid "failed to expand path '%s'"
@@ -6786,6 +6833,7 @@ msgstr "grep: Fehler beim Erzeugen eines Thread: %s"
msgid "invalid number of threads specified (%d) for %s"
msgstr "ungültige Anzahl von Threads (%d) für %s angegeben"
+#. #-#-#-#-# grep.c.po #-#-#-#-#
#. TRANSLATORS: %s is the configuration
#. variable for tweaking threads, currently
#. grep.threads
@@ -6988,11 +7036,14 @@ msgid "both --cached and trees are given"
msgstr "--cached und \"Tree\"-Objekte angegeben"
msgid ""
-"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters] [--stdin] "
-"[--] <file>..."
+"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]\n"
+" [--stdin [--literally]] [--] <file>..."
msgstr ""
-"git hash-object [-t <Art>] [-w] [--path=<Datei> | --no-filters] [--stdin] "
-"[--] <Datei>..."
+"git hash-object [-t <Art>] [-w] [--path=<Datei> | --no-filters]\n"
+" [--stdin [--literally]] [--] <Datei>..."
+
+msgid "git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]"
+msgstr "git hash-object [-t <Art>] [-w] --stdin-paths [--no-filters]"
msgid "object type"
msgstr "Art des Objektes"
@@ -7127,12 +7178,19 @@ msgstr "Verwendung: %s%s"
msgid "'git help config' for more information"
msgstr "'git help config' für weitere Informationen"
-msgid "git hook run [--ignore-missing] <hook-name> [-- <hook-args>]"
-msgstr "git hook run [--ignore-missing] <Hook-Name> [-- <Hook-Argumente>]"
+msgid ""
+"git hook run [--ignore-missing] [--to-stdin=<path>] <hook-name> [-- <hook-"
+"args>]"
+msgstr ""
+"git hook run [--ignore-missing] [--to-stdin=<Pfad>] <Hook-Name> [-- <Hook-"
+"Argumente>]"
msgid "silently ignore missing requested <hook-name>"
msgstr "fehlende Anforderung <Hook-Name> stillschweigend ignorieren"
+msgid "file to read into hooks' stdin"
+msgstr "Datei zum Einlesen in das Hook-stdin"
+
#, c-format
msgid "object type mismatch at %s"
msgstr "Objekt-Typen passen bei %s nicht zusammen"
@@ -7422,11 +7480,15 @@ msgid "Initialized empty Git repository in %s%s\n"
msgstr "Leeres Git-Repository in %s%s initialisiert\n"
msgid ""
-"git init [-q | --quiet] [--bare] [--template=<template-directory>] [--"
-"shared[=<permissions>]] [<directory>]"
+"git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
+" [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+" [-b <branch-name> | --initial-branch=<branch-name>]\n"
+" [--shared[=<permissions>]] [<directory>]"
msgstr ""
-"git init [-q | --quiet] [--bare] [--template=<Vorlagenverzeichnis>] [--"
-"shared[=<Berechtigungen>]] [<Verzeichnis>]"
+"git init [-q | --quiet] [--bare] [--template=<Vorlagenverzeichnis>]\n"
+" [--separate-git-dir <Git-Verzeichnis>] [--object-format=<Format>]\n"
+" [-b <Branchname> | --initial-branch=<Branchname>]\n"
+" [--shared[=<Berechtigungen>]] [<Verzeichnis>]"
msgid "permissions"
msgstr "Berechtigungen"
@@ -7467,11 +7529,13 @@ msgid "--separate-git-dir incompatible with bare repository"
msgstr "--separate-git-dir nicht kompatibel mit Bare-Repository"
msgid ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<token>[(=|:)<value>])...] [<file>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <token>[(=|:)<value>])...]\n"
+" [--parse] [<file>...]"
msgstr ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<Token>[(=|:)<Wert>])...] [<Datei>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <Token>[(=|:)<Wert>])...]\n"
+" [--parse] [<Datei>...]"
msgid "edit files in place"
msgstr "vorhandene Dateien direkt bearbeiten"
@@ -7963,12 +8027,12 @@ msgstr ""
msgid ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<repository> [<refs>...]]"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n"
+" [--symref] [<repository> [<patterns>...]]"
msgstr ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<Programm>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<Repository> [<Referenzen>...]]"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<Schlüssel>]\n"
+" [--symref] [<Repository> [<Muster>...]]"
msgid "do not print remote URL"
msgstr "URL des Remote-Repositories nicht ausgeben"
@@ -8101,12 +8165,12 @@ msgstr "git merge-base [-a | --all] <Commit> <Commit>..."
msgid "git merge-base [-a | --all] --octopus <commit>..."
msgstr "git merge-base [-a | --all] --octopus <Commit>..."
-msgid "git merge-base --independent <commit>..."
-msgstr "git merge-base --independent <Commit>..."
-
msgid "git merge-base --is-ancestor <commit> <commit>"
msgstr "git merge-base --is-ancestor <Commit> <Commit>"
+msgid "git merge-base --independent <commit>..."
+msgstr "git merge-base --independent <Commit>..."
+
msgid "git merge-base --fork-point <ref> [<commit>]"
msgstr "git merge-base --fork-point <Referenz> [<Commit>]"
@@ -8215,9 +8279,27 @@ msgstr "Dateinamen ohne Modi/Oids/Stufen auflisten"
msgid "allow merging unrelated histories"
msgstr "erlaube das Zusammenführen von nicht zusammenhängenden Historien"
+msgid "perform multiple merges, one per line of input"
+msgstr "mehrere Merges durchführen, eine pro Eingabezeile"
+
+msgid "specify a merge-base for the merge"
+msgstr "Merge-Basis für den Merge angeben"
+
msgid "--trivial-merge is incompatible with all other options"
msgstr "--trivial-merge ist mit allen anderen Optionen inkompatibel"
+msgid "--merge-base is incompatible with --stdin"
+msgstr "--merge-base ist inkompatibel mit --stdin"
+
+#, c-format
+msgid "malformed input line: '%s'."
+msgstr "Fehlerhafte Eingabezeile: '%s'."
+
+#, c-format
+msgid "merging cannot continue; got unclean result of %d"
+msgstr ""
+"Merge kann nicht fortgesetzt werden; unsauberes Ergebnis von %d erhalten"
+
msgid "git merge [<options>] [<commit>...]"
msgstr "git merge [<Optionen>] [<Commit>...]"
@@ -8849,10 +8931,6 @@ msgid "cannot read note data from non-blob object '%s'."
msgstr "Kann Notiz-Daten nicht von Nicht-Blob Objekt '%s' lesen."
#, c-format
-msgid "malformed input line: '%s'."
-msgstr "Fehlerhafte Eingabezeile: '%s'."
-
-#, c-format
msgid "failed to copy notes from '%s' to '%s'"
msgstr "Fehler beim Kopieren der Notizen von '%s' nach '%s'"
@@ -9049,16 +9127,14 @@ msgstr "Notizen von <Notiz-Referenz> verwenden"
msgid "unknown subcommand: `%s'"
msgstr "unbekannter Unterbefehl: `%s'"
-msgid ""
-"git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"
+msgid "git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"
msgstr ""
-"git pack-objects --stdout [<Optionen>...] [< <Referenzliste> | < "
-"<Objektliste>]"
+"git pack-objects --stdout [<Optionen>] [< <Referenzliste> | < <Objektliste>]"
msgid ""
-"git pack-objects [<options>...] <base-name> [< <ref-list> | < <object-list>]"
+"git pack-objects [<options>] <base-name> [< <ref-list> | < <object-list>]"
msgstr ""
-"git pack-objects [<Optionen>...] <Basis-Name> [< <Referenzliste> | < "
+"git pack-objects [<Optionen>] <Basis-Name> [< <Referenzliste> | < "
"<Objektliste>]"
#, c-format
@@ -9454,8 +9530,8 @@ msgstr ""
"Sie es immer noch verwenden, indem Sie eine E-Mail an\n"
"<git@vger.kernel.org> senden. Danke.\n"
-msgid "git pack-refs [<options>]"
-msgstr "git pack-refs [<Optionen>]"
+msgid "git pack-refs [--all] [--no-prune]"
+msgstr "git pack-refs [--all] [--no-prune]"
msgid "pack everything"
msgstr "alles packen"
@@ -9463,6 +9539,18 @@ msgstr "alles packen"
msgid "prune loose refs (default)"
msgstr "lose Referenzen entfernen (Standard)"
+msgid "git patch-id [--stable | --unstable | --verbatim]"
+msgstr "git patch-id [--stable | --unstable | --verbatim]"
+
+msgid "use the unstable patch-id algorithm"
+msgstr "den instabilen Patch-ID-Algorithmus verwenden"
+
+msgid "use the stable patch-id algorithm"
+msgstr "den stabilen Patch-ID-Algorithmus verwenden"
+
+msgid "don't strip whitespace from the patch"
+msgstr "keine Leerzeichen aus dem Patch entfernen"
+
msgid "git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]"
msgstr "git prune [-n] [-v] [--progress] [--expire <Zeit>] [--] [<Branch>...]"
@@ -9690,13 +9778,12 @@ msgstr ""
msgid ""
"\n"
-"To avoid automatically configuring upstream branches when their name\n"
-"doesn't match the local branch, see option 'simple' of branch."
-"autoSetupMerge\n"
+"To avoid automatically configuring an upstream branch when its name\n"
+"won't match the local branch, see option 'simple' of branch.autoSetupMerge\n"
"in 'git help config'.\n"
msgstr ""
"\n"
-"Um das automatische Konfigurieren von Upstream-Branches zu verhindern,\n"
+"Um das automatische Konfigurieren eines Upstream-Branches zu verhindern,\n"
"wenn deren Namen nicht mit dem lokalen Branch übereinstimmen, siehe\n"
"Option 'simple' bei branch.autoSetupMerge in 'git help config'.\n"
@@ -9861,6 +9948,13 @@ msgstr "Push nach %s\n"
msgid "failed to push some refs to '%s'"
msgstr "Fehler beim Versenden einiger Referenzen nach '%s'"
+msgid ""
+"recursing into submodule with push.recurseSubmodules=only; using on-demand "
+"instead"
+msgstr ""
+"Rekursion in Submodule mit push.recurseSubmodules=only; stattdessen "
+"Verwendung von on-demand"
+
#, c-format
msgid "invalid value for '%s'"
msgstr "ungültiger Wert für '%s'"
@@ -9998,13 +10092,16 @@ msgid "need two commit ranges"
msgstr "Benötige zwei Commit-Bereiche."
msgid ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>) "
-"[-u | -i]] [--no-sparse-checkout] [--index-output=<file>] (--empty | <tree-"
-"ish1> [<tree-ish2> [<tree-ish3>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
+"prefix=<prefix>)\n"
+" [-u | -i]] [--index-output=<file>] [--no-sparse-checkout]\n"
+" (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"
msgstr ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<Präfix>) "
-"[-u | -i]] [--no-sparse-checkout] [--index-output=<Datei>] (--empty | "
-"<Commit-Referenz1> [<Commit-Referenz2> [<Commit-Referenz3>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
+"prefix=<Präfix>)\n"
+" [-u | -i]] [--index-output=<Datei>] [--no-sparse-checkout]\n"
+" (--empty | <Commit-Referenz1> [<Commit-Referenz2> [<Commit-"
+"Referenz3>]])"
msgid "write resulting index to <file>"
msgstr "resultierenden Index nach <Datei> schreiben"
@@ -10095,8 +10192,8 @@ msgid "%s requires the merge backend"
msgstr "%s erfordert das Merge-Backend"
#, c-format
-msgid "could not get 'onto': '%s'"
-msgstr "Konnte 'onto' nicht bestimmen: '%s'"
+msgid "invalid onto: '%s'"
+msgstr "ungültig auf: '%s'"
#, c-format
msgid "invalid orig-head: '%s'"
@@ -10148,10 +10245,15 @@ msgstr ""
msgid "could not switch to %s"
msgstr "Konnte nicht zu %s wechseln."
+msgid "apply options and merge options cannot be used together"
+msgstr ""
+"Optionen für \"am\" und Optionen für \"merge\" können nicht gemeinsam "
+"verwendet werden"
+
#, c-format
msgid ""
-"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and \"ask"
-"\"."
+"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and "
+"\"ask\"."
msgstr ""
"nicht erkannter leerer Typ '%s'; gültige Werte sind \"drop\", \"keep\", und "
"\"ask\"."
@@ -10388,10 +10490,19 @@ msgstr "Unbekannter Modus: %s"
msgid "--strategy requires --merge or --interactive"
msgstr "--strategy erfordert --merge oder --interactive"
-msgid "apply options and merge options cannot be used together"
+msgid ""
+"apply options are incompatible with rebase.autosquash. Consider adding --no-"
+"autosquash"
msgstr ""
-"Optionen für \"am\" und Optionen für \"merge\" können nicht gemeinsam "
-"verwendet werden"
+"apply-Optionen sind mit rebase.autosquash nicht kompatibel. Erwägen Sie das "
+"Hinzufügen von --no-autosquash"
+
+msgid ""
+"apply options are incompatible with rebase.updateRefs. Consider adding --no-"
+"update-refs"
+msgstr ""
+"apply-Optionen sind nicht kompatibel mit rebase.updateRefs. Erwägen Sie das "
+"Hinzufügen von --no-update-refs"
#, c-format
msgid "Unknown rebase backend: %s"
@@ -10415,8 +10526,8 @@ msgstr "Branch/Commit '%s' nicht gefunden"
msgid "No such ref: %s"
msgstr "Referenz nicht gefunden: %s"
-msgid "Could not resolve HEAD to a revision"
-msgstr "Konnte HEAD zu keinem Commit auflösen."
+msgid "Could not resolve HEAD to a commit"
+msgstr "HEAD konnte nicht in einen Commit aufgelöst werden"
#, c-format
msgid "'%s': need exactly one merge base with branch"
@@ -11094,6 +11205,10 @@ msgstr "konnte temporäre Datei '%s' nicht zum Schreiben öffnen"
msgid "could not close refs snapshot tempfile"
msgstr "konnte temporäre Referenzen-Snapshot-Datei nicht schließen"
+#, c-format
+msgid "could not remove stale bitmap: %s"
+msgstr "konnte veraltete Bitmap nicht entfernen: %s"
+
msgid "pack everything in a single pack"
msgstr "alles in eine einzige Pack-Datei packen"
@@ -11169,6 +11284,9 @@ msgstr "eine geometrische Progression mit Faktor <N> finden"
msgid "write a multi-pack index of the resulting packs"
msgstr "ein Multi-Pack-Index des resultierenden Pakets schreiben"
+msgid "pack prefix to store a pack containing pruned objects"
+msgstr "pack-Präfix zum Speichern eines Pakets mit gelöschten Objekten"
+
msgid "cannot delete packs in a precious-objects repo"
msgstr "kann Pack-Dateien in precious-objects Repository nicht löschen"
@@ -11180,8 +11298,12 @@ msgid "pack prefix %s does not begin with objdir %s"
msgstr "Pack-Präfix %s fängt nicht mit objdir %s an"
#, c-format
-msgid "missing required file: %s"
-msgstr "benötigte Datei fehlt: %s"
+msgid "renaming pack to '%s' failed"
+msgstr "Umbenennung des Pakets in '%s' fehlgeschlagen"
+
+#, c-format
+msgid "pack-objects did not write a '%s' file for pack %s-%s"
+msgstr "pack-objects hat keine '%s' Datei für Paket %s-%s geschrieben"
#, c-format
msgid "could not unlink: %s"
@@ -11376,8 +11498,11 @@ msgstr "--convert-graft-file erwartet keine Argumente"
msgid "only one pattern can be given with -l"
msgstr "Mit -l kann nur ein Muster angegeben werden"
-msgid "git rerere [clear | forget <path>... | status | remaining | diff | gc]"
-msgstr "git rerere [clean | forget <Pfad>... | status | remaining | diff | gc]"
+msgid ""
+"git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
+msgstr ""
+"git rerere [clear | forget <Pfadspezifikation>... | diff | status | "
+"remaining | gc]"
msgid "register clean resolutions in index"
msgstr "saubere Auflösungen im Index registrieren"
@@ -11584,6 +11709,15 @@ msgstr "--prefix benötigt ein Argument"
msgid "unknown mode for --abbrev-ref: %s"
msgstr "unbekannter Modus für --abbrev-ref: %s"
+msgid "--exclude-hidden cannot be used together with --branches"
+msgstr "--exclude-hidden kann nicht zusammen mit --branches verwendet werden"
+
+msgid "--exclude-hidden cannot be used together with --tags"
+msgstr "--exclude-hidden kann nicht zusammen mit --tags verwendet werden"
+
+msgid "--exclude-hidden cannot be used together with --remotes"
+msgstr "--exclude-hidden kann nicht zusammen mit --remotes verwendet werden"
+
msgid "this operation must be run in a work tree"
msgstr "Diese Operation muss in einem Arbeitsverzeichnis ausgeführt werden."
@@ -11591,17 +11725,26 @@ msgstr "Diese Operation muss in einem Arbeitsverzeichnis ausgeführt werden."
msgid "unknown mode for --show-object-format: %s"
msgstr "unbekannter Modus für --show-object-format: %s"
-msgid "git revert [<options>] <commit-ish>..."
-msgstr "git revert [<Optionen>] <Commit-Angabe>..."
+msgid ""
+"git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] "
+"<commit>..."
+msgstr ""
+"git revert [--[no-]edit] [-n] [-m <Nummer des Elterncommits>] [-s] [-S[<Key-"
+"ID>]] <Commit>…"
-msgid "git revert <subcommand>"
-msgstr "git revert <Unterbefehl>"
+msgid "git revert (--continue | --skip | --abort | --quit)"
+msgstr "git revert (--continue | --skip | --abort | --quit)"
-msgid "git cherry-pick [<options>] <commit-ish>..."
-msgstr "git cherry-pick [<Optionen>] <Commit-Angabe>..."
+msgid ""
+"git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n"
+" [-S[<keyid>]] <commit>..."
+msgstr ""
+"git cherry-pick [--edit] [-n] [-m <Nummer des Elterncommits>] [-s] [-x] [--"
+"ff]\n"
+" [-S[<Key-ID>]] <Commit>…"
-msgid "git cherry-pick <subcommand>"
-msgstr "git cherry-pick <Unterbefehl>"
+msgid "git cherry-pick (--continue | --skip | --abort | --quit)"
+msgstr "git cherry-pick (--continue | --skip | --abort | --quit)"
#, c-format
msgid "option `%s' expects a number greater than zero"
@@ -11662,8 +11805,14 @@ msgstr "\"revert\" fehlgeschlagen"
msgid "cherry-pick failed"
msgstr "\"cherry-pick\" fehlgeschlagen"
-msgid "git rm [<options>] [--] <file>..."
-msgstr "git rm [<Optionen>] [--] <Datei>..."
+msgid ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<Datei> [--pathspec-file-nul]]\n"
+" [--] [<Pfadspezifikation>...]"
msgid ""
"the following file has staged content different from both the\n"
@@ -11741,11 +11890,13 @@ msgid ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<host>:]<directory> (--all | <ref>...)"
msgstr ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<Host>:]<Verzeichnis> (--all | <Referenz>...)"
msgid "remote name"
@@ -11769,9 +11920,9 @@ msgstr "git log --pretty=short | git shortlog [<Optionen>]"
msgid "using multiple --group options with stdin is not supported"
msgstr "mehrere Optionen --group mit Standard-Eingabe wird nicht unterstützt"
-msgid "using --group=trailer with stdin is not supported"
-msgstr ""
-"Nutzung von --group=trailer mit Standard-Eingabe wird nicht unterstützt"
+#, c-format
+msgid "using %s with stdin is not supported"
+msgstr "die Verwendung von %s mit stdin wird nicht unterstützt"
#, c-format
msgid "unknown group type: %s"
@@ -11808,12 +11959,14 @@ msgid ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<when>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<rev> | <glob>)...]"
msgstr ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
-" [--current] [--color[=<Wann>] | --no-color] [--sparse]\n"
+" [--current] [--color[=<wann>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<Commit> | <glob>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<Commit> | <Glob>)...]"
msgid "git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]"
msgstr "git show-branch (-g | --reflog)[=<n>[,<Basis>]] [--list] [<Referenz>]"
@@ -11914,11 +12067,13 @@ msgid "Unknown hash algorithm"
msgstr "Unbekannter Hash-Algorithmus"
msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<pattern>...]"
msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<Muster>...] "
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<Muster>...]"
msgid "git show-ref --exclude-existing[=<pattern>]"
msgstr "git show-ref --exclude-existing[=<Muster>]"
@@ -11951,8 +12106,11 @@ msgstr ""
"Referenzen von der Standard-Eingabe anzeigen, die sich nicht im lokalen "
"Repository befinden"
-msgid "git sparse-checkout (init|list|set|add|reapply|disable) <options>"
-msgstr "git sparse-checkout (init|list|set|add|reapply|disable) <Optionen>"
+msgid ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<options>]"
+msgstr ""
+"git sparse-checkout (init | list | set | add | reapply | disable) "
+"[<Optionen>]"
msgid "this worktree is not sparse"
msgstr "dieses Arbeitsverzeichnis ist nicht partiell"
@@ -12083,67 +12241,58 @@ msgstr ""
msgid "error while refreshing working directory"
msgstr "Fehler während der Aktualisierung des Arbeitsverzeichnisses."
-msgid "git stash list [<options>]"
-msgstr "git stash list [<Optionen>]"
+msgid "git stash list [<log-options>]"
+msgstr "git stash list [<log-Optionen>]"
-msgid "git stash show [<options>] [<stash>]"
-msgstr "git stash show [<Optionen>] [<Stash>]"
+msgid ""
+"git stash show [-u | --include-untracked | --only-untracked] [<diff-"
+"options>] [<stash>]"
+msgstr ""
+"git stash show [-u | --include-untracked | --only-untracked] [<Diff-"
+"Optionen>] [<Stash>]"
-msgid "git stash drop [-q|--quiet] [<stash>]"
-msgstr "git stash drop [-q|--quiet] [<Stash>]"
+msgid "git stash drop [-q | --quiet] [<stash>]"
+msgstr "git stash drop [-q | --quiet] [<Stash>]"
-msgid "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash ( pop | apply ) [--index] [-q|--quiet] [<Stash>]"
+msgid "git stash pop [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash pop [--index] [-q | --quiet] [<Stash>]"
+
+msgid "git stash apply [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash apply [--index] [-q | --quiet] [<Stash>]"
msgid "git stash branch <branchname> [<stash>]"
msgstr "git stash branch <Branch> [<Stash>]"
+msgid "git stash store [(-m | --message) <message>] [-q | --quiet] <commit>"
+msgstr ""
+"git stash store [(-m | --message) <Beschreibung>] [-q | --quiet] <Commit>"
+
msgid ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"<message>]\n"
" [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
" [--] [<pathspec>...]]"
msgstr ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <Nachricht>]\n"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"<Nachricht>]\n"
" [--pathspec-from-file=<Datei> [--pathspec-file-nul]]\n"
" [--] [<Pfadspezifikation>...]]"
msgid ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<Nachricht>]"
-
-msgid "git stash pop [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash pop [--index] [-q|--quiet] [<Stash>]"
-
-msgid "git stash apply [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash apply [--index] [-q|--quiet] [<Stash>]"
-
-msgid "git stash store [-m|--message <message>] [-q|--quiet] <commit>"
-msgstr "git stash store [-m|--message <Nachricht>] [-q|--quiet] <Commit>"
-
-msgid ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
-" [--] [<pathspec>...]]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<message>]"
msgstr ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <Nachricht>]\n"
-" [--] [<Pfadspezifikation>...]]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<Beschreibung>]"
-msgid ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<Nachricht>]"
+msgid "git stash create [<message>]"
+msgstr "git stash create [<Beschreibung>]"
#, c-format
msgid "'%s' is not a stash-like commit"
@@ -12721,9 +12870,6 @@ msgstr "Submodule rekursiv durchlaufen"
msgid "don't fetch new objects from the remote site"
msgstr "keine neuen Objekte von Remote abrufen"
-msgid "path into the working tree"
-msgstr "Pfad zum Arbeitsverzeichnis"
-
msgid "use the 'checkout' update strategy (default)"
msgstr "die Aktualisierungsstrategie \"checkout\" verwenden (Standard)"
@@ -12764,29 +12910,9 @@ msgstr ""
"shallow] [--reference <Repository>] [--recursive] [--[no-]single-branch] "
"[--] [<Pfad>...]"
-msgid "recurse into submodules"
-msgstr "Rekursion in Submodule durchführen"
-
msgid "git submodule absorbgitdirs [<options>] [<path>...]"
msgstr "git submodule absorbgitdirs [<Optionen>] [<Pfad>...]"
-msgid "check if it is safe to write to the .gitmodules file"
-msgstr "prüfen, ob es sicher ist, in die Datei .gitmodules zu schreiben"
-
-msgid "unset the config in the .gitmodules file"
-msgstr "Konfiguration in der .gitmodules-Datei entfernen"
-
-msgid "git submodule--helper config <name> [<value>]"
-msgstr "git submodule--helper config <name> [<Wert>]"
-
-msgid "git submodule--helper config --unset <name>"
-msgstr "git submodule--helper config --unset <Name>"
-
-msgid "please make sure that the .gitmodules file is in the working tree"
-msgstr ""
-"Bitte stellen Sie sicher, dass sich die Datei .gitmodules im "
-"Arbeitsverzeichnis befindet."
-
msgid "suppress output for setting url of a submodule"
msgstr "Ausgaben beim Setzen der URL eines Submoduls unterdrücken"
@@ -12867,6 +12993,11 @@ msgstr "Reaktiviere lokales Git-Verzeichnis für Submodul '%s'\n"
msgid "unable to checkout submodule '%s'"
msgstr "kann Submodul '%s' nicht auschecken"
+msgid "please make sure that the .gitmodules file is in the working tree"
+msgstr ""
+"Bitte stellen Sie sicher, dass sich die Datei .gitmodules im "
+"Arbeitsverzeichnis befindet."
+
#, c-format
msgid "Failed to add submodule '%s'"
msgstr "Hinzufügen von Submodul '%s' fehlgeschlagen"
@@ -12919,19 +13050,17 @@ msgstr "repo URL: '%s' muss absolut sein oder mit ./|../ beginnen"
msgid "'%s' is not a valid submodule name"
msgstr "'%s' ist kein gültiger Submodul-Name"
-#, c-format
-msgid "%s doesn't support --super-prefix"
-msgstr "%s unterstützt kein --super-prefix"
+msgid "git submodule--helper <command>"
+msgstr "git submodule--helper <Befehl>"
-#, c-format
-msgid "'%s' is not a valid submodule--helper subcommand"
-msgstr "'%s' ist kein gültiger Unterbefehl von submodule--helper"
+msgid "git symbolic-ref [-m <reason>] <name> <ref>"
+msgstr "git symbolic-ref [-m <Grund>] <Name> <Referenz>"
-msgid "git symbolic-ref [<options>] <name> [<ref>]"
-msgstr "git symbolic-ref [<Optionen>] <Name> [<Referenz>]"
+msgid "git symbolic-ref [-q] [--short] [--no-recurse] <name>"
+msgstr "git symbolic-ref [-q] [--short] [--no-recurse] <Name>"
-msgid "git symbolic-ref -d [-q] <name>"
-msgstr "git symbolic-ref -d [-q] <Name>"
+msgid "git symbolic-ref --delete [-q] <name>"
+msgstr "git symbolic-ref --delete [-q] <Name>"
msgid "suppress error message for non-symbolic (detached) refs"
msgstr ""
@@ -12943,6 +13072,9 @@ msgstr "symbolische Referenzen löschen"
msgid "shorten ref output"
msgstr "verkürzte Ausgabe der Referenzen"
+msgid "recursively dereference (default)"
+msgstr "rekursives Dereferenzieren (Standard)"
+
msgid "reason"
msgstr "Grund"
@@ -12950,25 +13082,25 @@ msgid "reason of the update"
msgstr "Grund für die Aktualisierung"
msgid ""
-"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]\n"
-" <tagname> [<head>]"
+"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n"
+" <tagname> [<commit> | <object>]"
msgstr ""
-"git tag [-a | -s | -u <Schlüssel-ID>] [-f] [-m <Beschreibung> | -F <Datei>]\n"
-" <Tagname> [<Commit>]"
+"git tag [-a | -s | -u <Key-ID>] [-f] [-m <Beschreibung> | -F <Datei>] [-e]\n"
+" <Tagname> [<Commit> | <Objekt>]"
msgid "git tag -d <tagname>..."
msgstr "git tag -d <Tagname>..."
msgid ""
-"git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--"
-"points-at <object>]\n"
-" [--format=<format>] [--merged <commit>] [--no-merged <commit>] "
-"[<pattern>...]"
+"git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]\n"
+" [--points-at <object>] [--column[=<options>] | --no-column]\n"
+" [--create-reflog] [--sort=<key>] [--format=<format>]\n"
+" [--merged <commit>] [--no-merged <commit>] [<pattern>...]"
msgstr ""
-"git tag -l [-n[<Nummer>]] [--contains <Commit>] [--no-contains <Commit>] [--"
-"points-at <Objekt>]\n"
-" [--format=<format>] [--merged <Commit>] [--no-merged <Commit>] "
-"[<Muster>...]"
+"git tag [-n[<Nummer>]] -l [--contains <Commit>] [--no-contains <Commit>]\n"
+" [--points-at <Objekt>] [--column[=<Optionen>] | --no-column]\n"
+" [--create-reflog] [--sort=<Schlüssel>] [--format=<Format>]\n"
+" [--merged <Commit>] [--no-merged <Commit>] [<Muster>...]"
msgid "git tag -v [--format=<format>] <tagname>..."
msgstr "git tag -v [--format=<Format>] <Tagname>..."
@@ -13367,8 +13499,12 @@ msgstr "Aktualisierungen von der Standard-Eingabe lesen"
msgid "update the info files from scratch"
msgstr "die Informationsdateien von Grund auf aktualisieren"
-msgid "git upload-pack [<options>] <dir>"
-msgstr "git upload-pack [<Optionen>] <Verzeichnis>"
+msgid ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <directory>"
+msgstr ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <directory>"
msgid "quit after a single request/response exchange"
msgstr "nach einem einzigen Request/Response-Austausch beenden"
@@ -13384,8 +13520,8 @@ msgstr ""
msgid "interrupt transfer after <n> seconds of inactivity"
msgstr "Übertragung nach <n> Sekunden Inaktivität unterbrechen"
-msgid "git verify-commit [-v | --verbose] <commit>..."
-msgstr "git verify-commit [-v | --verbose] <Commit>..."
+msgid "git verify-commit [-v | --verbose] [--raw] <commit>..."
+msgstr "git verify-commit [-v | --verbose] [--raw] <Commit>..."
msgid "print commit contents"
msgstr "Commit-Inhalte ausgeben"
@@ -13393,8 +13529,9 @@ msgstr "Commit-Inhalte ausgeben"
msgid "print raw gpg status output"
msgstr "unbearbeitete Ausgabe des Status von gpg ausgeben"
-msgid "git verify-pack [-v | --verbose] [-s | --stat-only] <pack>..."
-msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] <Paket>..."
+msgid "git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pack>.idx..."
+msgstr ""
+"git verify-pack [-v | --verbose] [-s | --stat-only] [--] <Paket>.idx..."
msgid "verbose"
msgstr "erweiterte Ausgaben"
@@ -13402,35 +13539,40 @@ msgstr "erweiterte Ausgaben"
msgid "show statistics only"
msgstr "nur Statistiken anzeigen"
-msgid "git verify-tag [-v | --verbose] [--format=<format>] <tag>..."
-msgstr "git verify-tag [-v | --verbose] [--format=<Format>] <Tag>..."
+msgid "git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."
+msgstr "git verify-tag [-v | --verbose] [--format=<Format>] [--raw] <Tag>..."
msgid "print tag contents"
msgstr "Tag-Inhalte ausgeben"
-msgid "git worktree add [<options>] <path> [<commit-ish>]"
-msgstr "git worktree add [<Optionen>] <Pfad> [<Commit-Angabe>]"
+msgid ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]\n"
+" [-b <new-branch>] <path> [<commit-ish>]"
+msgstr ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason "
+"<Zeichenkette>]]\n"
+" [-b <neuer-Branch>] <Pfad> [<Commit-Angabe>]"
-msgid "git worktree list [<options>]"
-msgstr "git worktree list [<Optionen>]"
+msgid "git worktree list [-v | --porcelain [-z]]"
+msgstr "git worktree list [-v | --porcelain [-z]]"
-msgid "git worktree lock [<options>] <path>"
-msgstr "git worktree lock [<Optionen>] <Pfad>"
+msgid "git worktree lock [--reason <string>] <worktree>"
+msgstr "git worktree lock [--reason <Zeichenkette>] <Arbeitsverzeichnis>"
msgid "git worktree move <worktree> <new-path>"
msgstr "git worktree move <Arbeitsverzeichnis> <neuer-Pfad>"
-msgid "git worktree prune [<options>]"
-msgstr "git worktree prune [<Optionen>]"
+msgid "git worktree prune [-n] [-v] [--expire <expire>]"
+msgstr "git worktree prune [-n] [-v] [--expire <Zeit>]"
-msgid "git worktree remove [<options>] <worktree>"
-msgstr "git worktree remove [<Optionen>] <Arbeitsverzeichnis>"
+msgid "git worktree remove [-f] <worktree>"
+msgstr "git worktree remove [-f] <Arbeitsverzeichnis>"
msgid "git worktree repair [<path>...]"
msgstr "git worktree repair [<Pfad>...]"
-msgid "git worktree unlock <path>"
-msgstr "git worktree unlock <Pfad>"
+msgid "git worktree unlock <worktree>"
+msgstr "git worktree unlock <Arbeitsverzeichnis>"
#, c-format
msgid "Removing %s/%s: %s"
@@ -13681,6 +13823,14 @@ msgstr "nur nützlich für Fehlersuche"
msgid "core.fsyncMethod = batch is unsupported on this platform"
msgstr "core.fsyncMethod = batch wird auf dieser Plattform nicht unterstützt"
+#, c-format
+msgid "could not parse bundle list key %s with value '%s'"
+msgstr "Konnte Bundle-Listenschlüssel %s mit Wert '%s' nicht parsen."
+
+#, c-format
+msgid "bundle list at '%s' has no mode"
+msgstr "Paketliste bei '%s' hat keinen Modus"
+
msgid "failed to create temporary file"
msgstr "temporäre Datei kann nicht erstellt werden"
@@ -13688,16 +13838,43 @@ msgid "insufficient capabilities"
msgstr "unzureichende Fähigkeiten"
#, c-format
+msgid "file downloaded from '%s' is not a bundle"
+msgstr "die von '%s' heruntergeladene Datei ist kein Bundle"
+
+msgid "failed to store maximum creation token"
+msgstr "das maximale Erstellungs-Token konnte nicht gespeichert werden"
+
+#, c-format
+msgid "unrecognized bundle mode from URI '%s'"
+msgstr "nicht erkannter Bundle-Modus von URI '%s'"
+
+#, c-format
+msgid "exceeded bundle URI recursion limit (%d)"
+msgstr "Rekursionsgrenze für Bundle-URI überschritten (%d)"
+
+#, c-format
msgid "failed to download bundle from URI '%s'"
msgstr "Download des Bundles von URI '%s' fehlgeschlagen"
#, c-format
-msgid "file at URI '%s' is not a bundle"
-msgstr "Datei unter URI '%s' ist kein Bundle"
+msgid "file at URI '%s' is not a bundle or bundle list"
+msgstr "Datei unter URI '%s' ist kein Paket oder keine Paketliste"
#, c-format
-msgid "failed to unbundle bundle from URI '%s'"
-msgstr "Bundle von URI '%s' konnte nicht entpackt werden"
+msgid "bundle-uri: unexpected argument: '%s'"
+msgstr "bundle-uri: unerwartetes Argument: '%s'"
+
+msgid "bundle-uri: expected flush after arguments"
+msgstr "bundle-uri: erwarteter Flush nach Argumenten"
+
+msgid "bundle-uri: got an empty line"
+msgstr "bundle-uri: erhielt eine leere Zeile"
+
+msgid "bundle-uri: line is not of the form 'key=value'"
+msgstr "bundle-uri: Zeile hat nicht die Form 'Schlüssel=Wert'"
+
+msgid "bundle-uri: line has empty key or value"
+msgstr "bundle-uri: Zeile hat leeren Schlüssel oder Wert"
#, c-format
msgid "unrecognized bundle hash algorithm: %s"
@@ -13721,6 +13898,13 @@ msgstr "Dem Repository fehlen folgende vorausgesetzte Commits:"
msgid "need a repository to verify a bundle"
msgstr "um ein Paket zu überprüfen wird ein Repository benötigt"
+msgid ""
+"some prerequisite commits exist in the object store, but are not connected "
+"to the repository's history"
+msgstr ""
+"einige vorausgesetzte Commits sind im Objektspeicher vorhanden, aber sind "
+"nicht mit der Repository-Historie verbunden"
+
#, c-format
msgid "The bundle contains this ref:"
msgid_plural "The bundle contains these %<PRIuMAX> refs:"
@@ -14301,8 +14485,8 @@ msgstr "Das Bundle-Dateiformat"
msgid "Chunk-based file formats"
msgstr "Chunk-basierte Dateiformate"
-msgid "Git commit graph format"
-msgstr "Git Commit Graph Format"
+msgid "Git commit-graph format"
+msgstr "Git Commit-Graph Format"
msgid "Git index format"
msgstr "Git-Index-Format"
@@ -14653,6 +14837,10 @@ msgstr "unbehandelter Fall in 'has_worktree_moved': %d"
msgid "health thread wait failed [GLE %ld]"
msgstr "Warten des health Thread fehlgeschlagen [GLE %ld]"
+#, c-format
+msgid "Invalid path: %s"
+msgstr "Ungültiger Pfad: %s"
+
msgid "Unable to create FSEventStream."
msgstr "Konnte FSEventStream nicht erstellen."
@@ -14684,6 +14872,22 @@ msgid "could not read directory changes [GLE %ld]"
msgstr "konnte Verzeichnisveränderungen nicht lesen [GLE %ld]"
#, c-format
+msgid "opendir('%s') failed"
+msgstr "opendir('%s') fehlgeschlagen"
+
+#, c-format
+msgid "lstat('%s') failed"
+msgstr "lstat('%s') fehlgeschlagen"
+
+#, c-format
+msgid "strbuf_readlink('%s') failed"
+msgstr "strbuf_readlink('%s') fehlgeschlagen"
+
+#, c-format
+msgid "closedir('%s') failed"
+msgstr "closedir('%s') fehlgeschlagen"
+
+#, c-format
msgid "[GLE %ld] unable to open for read '%ls'"
msgstr "[GLE %ld] '%ls' kann nicht zum Lesen geöffnet werden"
@@ -15153,15 +15357,22 @@ msgid "unknown object format '%s' specified by server"
msgstr "unbekanntes Objekt-Format '%s' vom Server angegeben"
#, c-format
+msgid "error on bundle-uri response line %d: %s"
+msgstr "Fehler in der bundle-uri-Antwortzeile %d: %s"
+
+msgid "expected flush after bundle-uri listing"
+msgstr "erwartete Flush nach Bundle-uri-Auflistung"
+
+msgid "expected response end packet after ref listing"
+msgstr "Antwort-Endpaket nach Auflistung der Referenzen erwartet"
+
+#, c-format
msgid "invalid ls-refs response: %s"
msgstr "ungültige ls-refs Antwort: %s"
msgid "expected flush after ref listing"
msgstr "Flush nach Auflistung der Referenzen erwartet"
-msgid "expected response end packet after ref listing"
-msgstr "Antwort-Endpaket nach Auflistung der Referenzen erwartet"
-
#, c-format
msgid "protocol '%s' is not supported"
msgstr "Protokoll '%s' wird nicht unterstützt"
@@ -16326,9 +16537,11 @@ msgstr "virtuelles Repository '%s' ist inkompatibel mit fsmonitor"
#, c-format
msgid ""
-"repository '%s' is incompatible with fsmonitor due to lack of Unix sockets"
+"socket directory '%s' is incompatible with fsmonitor due to lack of Unix "
+"sockets support"
msgstr ""
-"Repository '%s' is inkompatibel mit fsmonitor wegen fehlender Unix sockets"
+"Socket-Verzeichnis '%s' ist mit fsmonitor inkompatibel, da es keine Unix-"
+"Sockets unterstützt"
msgid ""
"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n"
@@ -16336,16 +16549,14 @@ msgid ""
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
-" [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n"
-" <command> [<args>]"
+" [--config-env=<name>=<envvar>] <command> [<args>]"
msgstr ""
"git [-v | --version] [-h | --help] [-C <Pfad>] [-c <Name>=<Wert>]\n"
" [--exec-path[=<Pfad>]] [--html-path] [--man-path] [--info-path]\n"
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<Pfad>] [--work-tree=<Pfad>] [--namespace=<Name>]\n"
-" [--super-prefix=<Pfad>] [--config-env=<Name>=<Variable>]\n"
-" <Befehl> [<Argumente>]"
+" [--config-env=<Name>=<Umgebungsvariable>] <Befehl> [<Argumente>]"
msgid ""
"'git help -a' and 'git help -g' list available subcommands and some\n"
@@ -16372,10 +16583,6 @@ msgid "no namespace given for --namespace\n"
msgstr "Kein Namespace für --namespace angegeben.\n"
#, c-format
-msgid "no prefix given for --super-prefix\n"
-msgstr "Kein Präfix für --super-prefix angegeben.\n"
-
-#, c-format
msgid "-c expects a configuration string\n"
msgstr "-c erwartet einen Konfigurationsstring.\n"
@@ -16489,8 +16696,13 @@ msgstr ""
msgid "gpg.ssh.defaultKeyCommand failed: %s %s"
msgstr "gpg.ssh.defaultKeyCommand fehlgeschlagen: %s %s"
-msgid "gpg failed to sign the data"
-msgstr "gpg beim Signieren der Daten fehlgeschlagen"
+#, c-format
+msgid ""
+"gpg failed to sign the data:\n"
+"%s"
+msgstr ""
+"gpg konnte die Daten nicht signieren:\n"
+"%s"
msgid "user.signingKey needs to be set for ssh signing"
msgstr "user.signingKey muss für die SSH-Signatur gesetzt sein"
@@ -16653,8 +16865,8 @@ msgstr[1] ""
"\n"
"Die ähnlichsten Befehle sind"
-msgid "git version [<options>]"
-msgstr "git version [<Optionen>]"
+msgid "git version [--build-options]"
+msgstr "git version [--build-options]"
#, c-format
msgid "%s: %s - %s"
@@ -17070,7 +17282,7 @@ msgstr ""
#. conflict in a submodule. The first argument is the submodule
#. name, and the second argument is the abbreviated id of the
#. commit that needs to be merged. For example:
-#. - go to submodule (mysubmodule), and either merge commit abc1234"
+#. - go to submodule (mysubmodule), and either merge commit abc1234"
#.
#, c-format
msgid ""
@@ -17272,8 +17484,8 @@ msgstr ""
#, c-format
msgid ""
-"CONFLICT (rename/rename): Rename \"%s\"->\"%s\" in branch \"%s\" rename \"%s"
-"\"->\"%s\" in \"%s\"%s"
+"CONFLICT (rename/rename): Rename \"%s\"->\"%s\" in branch \"%s\" rename "
+"\"%s\"->\"%s\" in \"%s\"%s"
msgstr ""
"KONFLIKT (umbenennen/umbenennen): Benenne um \"%s\"->\"%s\" in Branch \"%s\" "
"und \"%s\"->\"%s\" in Branch \"%s\"%s"
@@ -17601,10 +17813,6 @@ msgstr "Konnte alternativen Objektpfad '%s' nicht normalisieren."
msgid "%s: ignoring alternate object stores, nesting too deep"
msgstr "%s: ignoriere alternative Objektspeicher - Verschachtelung zu tief"
-#, c-format
-msgid "unable to normalize object directory: %s"
-msgstr "Konnte Objektverzeichnis '%s' nicht normalisieren."
-
msgid "unable to fdopen alternates lockfile"
msgstr "Konnte fdopen nicht auf Lock-Datei für \"alternates\" aufrufen."
@@ -17668,6 +17876,10 @@ msgid "garbage at end of loose object '%s'"
msgstr "Nutzlose Daten am Ende von losem Objekt '%s'."
#, c-format
+msgid "unable to open loose object %s"
+msgstr "loses Objekt %s kann nicht geöffnet werden"
+
+#, c-format
msgid "unable to parse %s header"
msgstr "Konnte %s Kopfbereich nicht parsen."
@@ -17683,18 +17895,14 @@ msgid "header for %s too long, exceeds %d bytes"
msgstr "Header für %s zu lang, überschreitet %d Bytes"
#, c-format
-msgid "failed to read object %s"
-msgstr "Konnte Objekt %s nicht lesen."
+msgid "loose object %s (stored in %s) is corrupt"
+msgstr "Loses Objekt %s (gespeichert in %s) ist beschädigt."
#, c-format
msgid "replacement %s not found for %s"
msgstr "Ersetzung %s für %s nicht gefunden."
#, c-format
-msgid "loose object %s (stored in %s) is corrupt"
-msgstr "Loses Objekt %s (gespeichert in %s) ist beschädigt."
-
-#, c-format
msgid "packed object %s (stored in %s) is corrupt"
msgstr "Gepacktes Objekt %s (gespeichert in %s) ist beschädigt."
@@ -17706,9 +17914,6 @@ msgstr "Konnte Datei %s nicht schreiben."
msgid "unable to set permission to '%s'"
msgstr "Konnte Zugriffsberechtigung auf '%s' nicht setzen."
-msgid "file write error"
-msgstr "Fehler beim Schreiben einer Datei."
-
msgid "error when closing loose object file"
msgstr "Fehler beim Schließen der Datei für lose Objekte."
@@ -17756,11 +17961,12 @@ msgstr "Verzeichnis %s kann nicht erstellt werden"
msgid "cannot read object for %s"
msgstr "Kann Objekt für %s nicht lesen."
-msgid "corrupt commit"
-msgstr "fehlerhafter Commit"
+#, c-format
+msgid "object fails fsck: %s"
+msgstr "fsck schlägt bei Objekt fehl: %s"
-msgid "corrupt tag"
-msgstr "fehlerhaftes Tag"
+msgid "refusing to create malformed object"
+msgstr "verweigere Erstellung eines ungültigen Objekts"
#, c-format
msgid "read error while indexing %s"
@@ -17817,7 +18023,7 @@ msgstr "%s [ungültiges Objekt]"
#. TRANSLATORS: This is a line of ambiguous commit
#. object output. E.g.:
#. *
-#. "deadbeef commit 2021-01-01 - Some Commit Message"
+#. "deadbeef commit 2021-01-01 - Some Commit Message"
#.
#, c-format
msgid "%s commit %s - %s"
@@ -17826,7 +18032,7 @@ msgstr "%s Commit %s - %s"
#. TRANSLATORS: This is a line of ambiguous
#. tag object output. E.g.:
#. *
-#. "deadbeef tag 2022-01-01 - Some Tag Message"
+#. "deadbeef tag 2022-01-01 - Some Tag Message"
#. *
#. The second argument is the YYYY-MM-DD found
#. in the tag.
@@ -17842,7 +18048,7 @@ msgstr "%s Tag %s - %s"
#. tag object output where we couldn't parse
#. the tag itself. E.g.:
#. *
-#. "deadbeef [bad tag, could not parse it]"
+#. "deadbeef [bad tag, could not parse it]"
#.
#, c-format
msgid "%s [bad tag, could not parse it]"
@@ -18028,10 +18234,6 @@ msgstr "ungültiger XOR-Offset im Bitmap-Pack-Index"
msgid "cannot fstat bitmap file"
msgstr "kann Bitmap-Datei nicht lesen"
-#, c-format
-msgid "ignoring extra bitmap file: '%s'"
-msgstr "ignoriere zusätzliche Bitmap-Datei: '%s'"
-
msgid "checksum doesn't match in MIDX and bitmap"
msgstr "Prüfsumme stimmt in MIDX und Bitmap nicht überein"
@@ -18300,6 +18502,9 @@ msgstr "weniger Ausgaben"
msgid "use <n> digits to display object names"
msgstr "benutze <Anzahl> Ziffern zur Anzeige von Objektnamen"
+msgid "prefixed path to initial superproject"
+msgstr "vorangestellter Pfad zum ursprünglichen Superprojekt"
+
msgid "how to strip spaces and #comments from message"
msgstr ""
"wie Leerzeichen und #Kommentare von der Beschreibung getrennt werden sollen"
@@ -18450,6 +18655,10 @@ msgstr ""
msgid "promisor remote name cannot begin with '/': %s"
msgstr "Promisor-Remote-Name kann nicht mit '/' beginnen: %s"
+#, c-format
+msgid "could not fetch %s from promisor remote"
+msgstr "konnte %s nicht von Promisor-Remote abrufen"
+
msgid "object-info: expected flush after arguments"
msgstr "object-info: erwartete Flush nach Argumenten"
@@ -18803,6 +19012,14 @@ msgid "ahead %d, behind %d"
msgstr "%d voraus, %d hinterher"
#, c-format
+msgid "%%(%.*s) does not take arguments"
+msgstr "%%(%.*s) nimmt keine Argumente entgegen"
+
+#, c-format
+msgid "unrecognized %%(%.*s) argument: %s"
+msgstr "nicht erkanntes %%(%.*s) Argument: %s"
+
+#, c-format
msgid "expected format: %%(color:<color>)"
msgstr "Erwartetes Format: %%(color:<Farbe>)"
@@ -18819,22 +19036,6 @@ msgid "Integer value expected refname:rstrip=%s"
msgstr "Positiver Wert erwartet refname:rstrip=%s"
#, c-format
-msgid "unrecognized %%(%s) argument: %s"
-msgstr "nicht erkanntes %%(%s) Argument: %s"
-
-#, c-format
-msgid "%%(objecttype) does not take arguments"
-msgstr "%%(objecttype) akzeptiert keine Argumente"
-
-#, c-format
-msgid "%%(deltabase) does not take arguments"
-msgstr "%%(deltabase) akzeptiert keine Argumente"
-
-#, c-format
-msgid "%%(body) does not take arguments"
-msgstr "%%(body) akzeptiert keine Argumente"
-
-#, c-format
msgid "expected %%(trailers:key=<value>)"
msgstr "%%(trailers:key=<Wert>) erwartet"
@@ -18851,10 +19052,6 @@ msgid "positive value expected '%s' in %%(%s)"
msgstr "positiver Wert erwartet '%s' in %%(%s)"
#, c-format
-msgid "unrecognized email option: %s"
-msgstr "nicht erkannte E-Mail Option: %s"
-
-#, c-format
msgid "expected format: %%(align:<width>,<position>)"
msgstr "erwartetes Format: %%(align:<Breite>,<Position>)"
@@ -18867,12 +19064,12 @@ msgid "unrecognized width:%s"
msgstr "nicht erkannte Breite:%s"
#, c-format
-msgid "positive width expected with the %%(align) atom"
-msgstr "Positive Breitenangabe für %%(align) erwartet"
+msgid "unrecognized %%(%s) argument: %s"
+msgstr "nicht erkanntes %%(%s) Argument: %s"
#, c-format
-msgid "%%(rest) does not take arguments"
-msgstr "%%(rest) akzeptiert keine Argumente"
+msgid "positive width expected with the %%(align) atom"
+msgstr "Positive Breitenangabe für %%(align) erwartet"
#, c-format
msgid "malformed field name: %.*s"
@@ -19540,6 +19737,13 @@ msgid "failed to find tree of %s"
msgstr "Fehler beim Finden des \"Tree\"-Objektes von %s."
#, c-format
+msgid "unsupported section for hidden refs: %s"
+msgstr "nicht unterstützter Abschnitt für versteckte Referenzen: %s"
+
+msgid "--exclude-hidden= passed more than once"
+msgstr "--exclude-hidden= mehr als einmal übergeben"
+
+#, c-format
msgid "resolve-undo records `%s` which is missing"
msgstr "resolve-undo zeichnet `%s` auf, das fehlt"
@@ -19684,6 +19888,14 @@ msgid "--all or <enlistment>, but not both"
msgstr "--all oder <Eintragung>, aber nicht beides"
#, c-format
+msgid "could not remove stale scalar.repo '%s'"
+msgstr "konnte veraltetes scalar.repo '%s' nicht entfernen"
+
+#, c-format
+msgid "removing stale scalar.repo '%s'"
+msgstr "entferne veraltetes scalar.repo '%s'"
+
+#, c-format
msgid "git repository gone in '%s'"
msgstr "Git-Repository entfernt in '%s'"
@@ -20124,6 +20336,24 @@ msgid "git %s: failed to refresh the index"
msgstr "git %s: Fehler beim Aktualisieren des Index"
#, c-format
+msgid "'%s' is not a valid label"
+msgstr "'%s' ist keine gültige Beschriftung"
+
+#, c-format
+msgid "'%s' is not a valid refname"
+msgstr "'%s' ist kein gültiger Referenzname"
+
+#, c-format
+msgid "update-ref requires a fully qualified refname e.g. refs/heads/%s"
+msgstr ""
+"update-ref erfordert einen vollständig qualifizierten Referenznamen, z. B. "
+"refs/heads/%s"
+
+#, c-format
+msgid "invalid command '%.*s'"
+msgstr "ungültiger Befehl '%.*s'"
+
+#, c-format
msgid "%s does not accept arguments: '%s'"
msgstr "%s akzeptiert keine Argumente: '%s'"
@@ -20317,16 +20547,16 @@ msgstr ""
msgid "illegal label name: '%.*s'"
msgstr "unerlaubter Beschriftungsname: '%.*s'"
+#, c-format
+msgid "could not resolve '%s'"
+msgstr "konnte '%s' nicht auflösen"
+
msgid "writing fake root commit"
msgstr "unechten Root-Commit schreiben"
msgid "writing squash-onto"
msgstr "squash-onto schreiben"
-#, c-format
-msgid "could not resolve '%s'"
-msgstr "konnte '%s' nicht auflösen"
-
msgid "cannot merge without a current revision"
msgstr "kann nicht ohne einen aktuellen Commit mergen"
@@ -20936,6 +21166,27 @@ msgstr "ls-tree mit unerwartetem Rückgabewert %d beendet"
msgid "failed to lstat '%s'"
msgstr "'lstat' für '%s' fehlgeschlagen"
+msgid "no remote configured to get bundle URIs from"
+msgstr "kein Remote-Repository zum Erhalten von Bundle-URIs konfiguriert"
+
+#, c-format
+msgid "remote '%s' has no configured URL"
+msgstr "Remote-Repository '%s' hat keine konfigurierte URL"
+
+msgid "could not get the bundle-uri list"
+msgstr "konnte die Bundle-uri-Liste nicht erhalten"
+
+msgid "test-tool cache-tree <options> (control|prime|update)"
+msgstr "test-tool cache-tree <Optionen> (control|prime|update)"
+
+msgid "clear the cache tree before each iteration"
+msgstr "das Cache-Verzeichnis vor jeder Iteration löschen"
+
+msgid "number of entries in the cache tree to invalidate (default 0)"
+msgstr ""
+"Anzahl der Einträge im Cache-Verzeichnis, die ungültig gemacht werden sollen "
+"(Standardwert 0)"
+
msgid "unhandled options"
msgstr "unbehandelte Optionen"
@@ -21280,6 +21531,12 @@ msgstr "Abbruch."
msgid "failed to push all needed submodules"
msgstr "Fehler beim Versand aller erforderlichen Submodule."
+msgid "bundle-uri operation not supported by protocol"
+msgstr "bundle-uri Operation wird vom Protokoll nicht unterstützt"
+
+msgid "could not retrieve server-advertised bundle-uri list"
+msgstr "konnte die vom Server angekündigte bundle-uri-Liste nicht abrufen"
+
msgid "too-short tree object"
msgstr "zu kurzes Tree-Objekt"
@@ -21970,8 +22227,8 @@ msgstr "Sie führen gerade \"cherry-pick\" von Commit %s aus."
msgid " (fix conflicts and run \"git cherry-pick --continue\")"
msgstr ""
-" (beheben Sie die Konflikte und führen Sie dann \"git cherry-pick --continue"
-"\" aus)"
+" (beheben Sie die Konflikte und führen Sie dann \"git cherry-pick --"
+"continue\" aus)"
msgid " (run \"git cherry-pick --continue\" to continue)"
msgstr " (Führen Sie \"git cherry-pick --continue\" aus, um weiterzumachen)"
@@ -22067,13 +22324,22 @@ msgstr "Ignorierte Dateien"
#, c-format
msgid ""
-"It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
-"may speed it up, but you have to be careful not to forget to add\n"
-"new files yourself (see 'git help status')."
+"It took %.2f seconds to enumerate untracked files,\n"
+"but the results were cached, and subsequent runs may be faster."
+msgstr ""
+"Es dauerte %.2f Sekunden, um die unversionierten Dateien aufzuzählen,\n"
+"aber die Ergebnisse wurden zwischengespeichert, sodass spätere Durchläufe "
+"schneller sein können."
+
+#, c-format
+msgid "It took %.2f seconds to enumerate untracked files."
+msgstr ""
+"Es hat %.2f Sekunden gedauert, um die unversionierten Dateien aufzuzählen."
+
+msgid "See 'git help status' for information on how to improve this."
msgstr ""
-"Es dauerte %.2f Sekunden die unversionierten Dateien zu bestimmen.\n"
-"'status -uno' könnte das beschleunigen, aber Sie müssen darauf achten,\n"
-"neue Dateien selbstständig hinzuzufügen (siehe 'git help status')."
+"Siehe 'git help status' für Informationen darüber, wie man dies verbessern "
+"kann."
#, c-format
msgid "Untracked files not listed%s"
@@ -22233,289 +22499,6 @@ msgstr ""
msgid "Unable to determine absolute path of git directory"
msgstr "Konnte absoluten Pfad des Git-Verzeichnisses nicht bestimmen"
-#. TRANSLATORS: you can adjust this to align "git add -i" status menu
-#, perl-format
-msgid "%12s %12s %s"
-msgstr "%28s %25s %s"
-
-#, perl-format
-msgid "touched %d path\n"
-msgid_plural "touched %d paths\n"
-msgstr[0] "%d Pfad angefasst\n"
-msgstr[1] "%d Pfade angefasst\n"
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for staging."
-msgstr ""
-"Wenn der Patch sauber angewendet werden kann, wird der bearbeitete\n"
-"Patch-Block direkt zum Hinzufügen zur Staging-Area markiert."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for stashing."
-msgstr ""
-"Wenn der Patch sauber angewendet werden kann, wird der bearbeitete\n"
-"Patch-Block direkt zum Hinzufügen zum Stash markiert."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for unstaging."
-msgstr ""
-"Wenn der Patch sauber angewendet werden kann, wird der bearbeitete\n"
-"Patch-Block direkt zum Entfernen aus der Staging-Area markiert."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for applying."
-msgstr ""
-"Wenn der Patch sauber angewendet werden kann, wird der bearbeitete\n"
-"Patch-Block direkt zum Anwenden markiert."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for discarding."
-msgstr ""
-"Wenn der Patch sauber angewendet werden kann, wird der bearbeitete\n"
-"Patch-Block direkt zum Verwerfen markiert."
-
-#, perl-format
-msgid "failed to open hunk edit file for writing: %s"
-msgstr ""
-"Fehler beim Öffnen von Editier-Datei eines Patch-Blocks zum Schreiben: %s"
-
-#, perl-format
-msgid ""
-"---\n"
-"To remove '%s' lines, make them ' ' lines (context).\n"
-"To remove '%s' lines, delete them.\n"
-"Lines starting with %s will be removed.\n"
-msgstr ""
-"---\n"
-"Um '%s' Zeilen zu entfernen, machen Sie aus diesen ' ' Zeilen (Kontext).\n"
-"Um '%s' Zeilen zu entfernen, löschen Sie diese.\n"
-"Zeilen, die mit %s beginnen, werden entfernt.\n"
-
-#, perl-format
-msgid "failed to open hunk edit file for reading: %s"
-msgstr "Fehler beim Öffnen von Editier-Datei eines Patch-Blocks zum Lesen: %s"
-
-msgid ""
-"y - stage this hunk\n"
-"n - do not stage this hunk\n"
-"q - quit; do not stage this hunk or any of the remaining ones\n"
-"a - stage this hunk and all later hunks in the file\n"
-"d - do not stage this hunk or any of the later hunks in the file"
-msgstr ""
-"y - diesen Patch-Block zum Commit vormerken\n"
-"n - diesen Patch-Block nicht zum Commit vormerken\n"
-"q - Beenden; diesen oder alle verbleibenden Patch-Blöcke nicht zum Commit "
-"vormerken\n"
-"a - diesen und alle weiteren Patch-Blöcke dieser Datei zum Commit vormerken\n"
-"d - diesen oder alle weiteren Patch-Blöcke in dieser Datei nicht zum Commit "
-"vormerken"
-
-msgid ""
-"y - stash this hunk\n"
-"n - do not stash this hunk\n"
-"q - quit; do not stash this hunk or any of the remaining ones\n"
-"a - stash this hunk and all later hunks in the file\n"
-"d - do not stash this hunk or any of the later hunks in the file"
-msgstr ""
-"y - diesen Patch-Block stashen\n"
-"n - diesen Patch-Block nicht stashen\n"
-"q - Beenden; diesen oder alle verbleibenden Patch-Blöcke nicht stashen\n"
-"a - diesen und alle weiteren Patch-Blöcke dieser Datei stashen\n"
-"d - diesen oder alle weiteren Patch-Blöcke dieser Datei nicht stashen"
-
-msgid ""
-"y - unstage this hunk\n"
-"n - do not unstage this hunk\n"
-"q - quit; do not unstage this hunk or any of the remaining ones\n"
-"a - unstage this hunk and all later hunks in the file\n"
-"d - do not unstage this hunk or any of the later hunks in the file"
-msgstr ""
-"y - diesen Patch-Block unstashen\n"
-"n - diesen Patch-Block nicht unstashen\n"
-"q - Beenden; diesen oder alle verbleibenden Patch-Blöcke nicht unstashen\n"
-"a - diesen und alle weiteren Patch-Blöcke dieser Datei unstashen\n"
-"d - diesen oder alle weiteren Patch-Blöcke dieser Datei nicht unstashen"
-
-msgid ""
-"y - apply this hunk to index\n"
-"n - do not apply this hunk to index\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - diesen Patch-Block auf den Index anwenden\n"
-"n - diesen Patch-Block nicht auf den Index anwenden\n"
-"q - Beenden; diesen oder alle verbleibenden Patch-Blöcke nicht auf den Index "
-"anwenden\n"
-"a - diesen und alle weiteren Patch-Blöcke dieser Datei auf den Index "
-"anwenden\n"
-"d - diesen oder alle weiteren Patch-Blöcke dieser Datei nicht auf den Index "
-"anwenden"
-
-msgid ""
-"y - discard this hunk from worktree\n"
-"n - do not discard this hunk from worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-"y - diesen Patch-Block im Arbeitsverzeichnis verwerfen\n"
-"n - diesen Patch-Block im Arbeitsverzeichnis nicht verwerfen\n"
-"q - Beenden; diesen oder alle verbleibenden Patch-Blöcke nicht im "
-"Arbeitsverzeichnis verwerfen\n"
-"a - diesen und alle weiteren Patch-Blöcke dieser Datei im Arbeitsverzeichnis "
-"verwerfen\n"
-"d - diesen oder alle weiteren Patch-Blöcke dieser Datei nicht im "
-"Arbeitsverzeichnis verwerfen"
-
-msgid ""
-"y - discard this hunk from index and worktree\n"
-"n - do not discard this hunk from index and worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-"y - diesen Patch-Block im Index und Arbeitsverzeichnis verwerfen\n"
-"n - diesen Patch-Block nicht im Index und Arbeitsverzeichnis verwerfen\n"
-"q - Beenden; diesen oder alle verbleibenden Patch-Blöcke nicht im Index und "
-"Arbeitsverzeichnis verwerfen\n"
-"a - diesen und alle weiteren Patch-Blöcke in der Datei verwerfen\n"
-"d - diesen oder alle weiteren Patch-Blöcke in der Datei nicht verwerfen"
-
-msgid ""
-"y - apply this hunk to index and worktree\n"
-"n - do not apply this hunk to index and worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - diesen Patch-Block im Index und auf Arbeitsverzeichnis anwenden\n"
-"n - diesen Patch-Block nicht im Index und auf Arbeitsverzeichnis anwenden\n"
-"q - Beenden; diesen oder alle verbleibenden Patch-Blöcke nicht anwenden\n"
-"a - diesen und alle weiteren Patch-Blöcke in der Datei anwenden\n"
-"d - diesen oder alle weiteren Patch-Blöcke in der Datei nicht anwenden"
-
-msgid ""
-"y - apply this hunk to worktree\n"
-"n - do not apply this hunk to worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - diesen Patch-Block auf das Arbeitsverzeichnis anwenden\n"
-"n - diesen Patch-Block nicht auf das Arbeitsverzeichnis anwenden\n"
-"q - Beenden; diesen und alle verbleibenden Patch-Blöcke nicht anwenden\n"
-"a - diesen und alle weiteren Patch-Blöcke in der Datei anwenden\n"
-"d - diesen und alle weiteren Patch-Blöcke in der Datei nicht anwenden"
-
-msgid ""
-"g - select a hunk to go to\n"
-"/ - search for a hunk matching the given regex\n"
-"j - leave this hunk undecided, see next undecided hunk\n"
-"J - leave this hunk undecided, see next hunk\n"
-"k - leave this hunk undecided, see previous undecided hunk\n"
-"K - leave this hunk undecided, see previous hunk\n"
-"s - split the current hunk into smaller hunks\n"
-"e - manually edit the current hunk\n"
-"? - print help\n"
-msgstr ""
-"g - Patch-Block zum Hinspringen auswählen\n"
-"/ - nach Patch-Block suchen, der gegebenem regulärem Ausdruck entspricht\n"
-"j - diesen Patch-Block unbestimmt lassen, nächsten unbestimmten Patch-Block "
-"anzeigen\n"
-"J - diesen Patch-Block unbestimmt lassen, nächsten Patch-Block anzeigen\n"
-"k - diesen Patch-Block unbestimmt lassen, vorherigen unbestimmten Patch-"
-"Block anzeigen\n"
-"K - diesen Patch-Block unbestimmt lassen, vorherigen Patch-Block anzeigen\n"
-"s - aktuellen Patch-Block in kleinere Patch-Blöcke aufteilen\n"
-"e - aktuellen Patch-Block manuell editieren\n"
-"? - Hilfe anzeigen\n"
-
-msgid "The selected hunks do not apply to the index!\n"
-msgstr ""
-"Die ausgewählten Patch-Blöcke können nicht auf den Index angewendet werden!\n"
-
-#, perl-format
-msgid "ignoring unmerged: %s\n"
-msgstr "ignoriere nicht zusammengeführte Datei: %s\n"
-
-msgid "No other hunks to goto\n"
-msgstr "Keine anderen Patch-Blöcke verbleibend\n"
-
-#, perl-format
-msgid "Invalid number: '%s'\n"
-msgstr "Ungültige Nummer: '%s'\n"
-
-#, perl-format
-msgid "Sorry, only %d hunk available.\n"
-msgid_plural "Sorry, only %d hunks available.\n"
-msgstr[0] "Entschuldigung, nur %d Patch-Block verfügbar.\n"
-msgstr[1] "Entschuldigung, nur %d Patch-Blöcke verfügbar.\n"
-
-msgid "No other hunks to search\n"
-msgstr "Keine anderen Patch-Blöcke zum Durchsuchen\n"
-
-#, perl-format
-msgid "Malformed search regexp %s: %s\n"
-msgstr "Fehlerhafter regulärer Ausdruck für Suche %s: %s\n"
-
-msgid "No hunk matches the given pattern\n"
-msgstr "Kein Patch-Block entspricht dem angegebenen Muster\n"
-
-msgid "No previous hunk\n"
-msgstr "Kein vorheriger Patch-Block\n"
-
-msgid "No next hunk\n"
-msgstr "Kein folgender Patch-Block\n"
-
-msgid "Sorry, cannot split this hunk\n"
-msgstr "Entschuldigung, kann diesen Patch-Block nicht aufteilen.\n"
-
-#, perl-format
-msgid "Split into %d hunk.\n"
-msgid_plural "Split into %d hunks.\n"
-msgstr[0] "In %d Patch-Block aufgeteilt.\n"
-msgstr[1] "In %d Patch-Blöcke aufgeteilt.\n"
-
-msgid "Sorry, cannot edit this hunk\n"
-msgstr "Entschuldigung, kann diesen Patch-Block nicht bearbeiten.\n"
-
-#. TRANSLATORS: please do not translate the command names
-#. 'status', 'update', 'revert', etc.
-msgid ""
-"status - show paths with changes\n"
-"update - add working tree state to the staged set of changes\n"
-"revert - revert staged set of changes back to the HEAD version\n"
-"patch - pick hunks and update selectively\n"
-"diff - view diff between HEAD and index\n"
-"add untracked - add contents of untracked files to the staged set of "
-"changes\n"
-msgstr ""
-"status - Pfade mit Änderungen anzeigen\n"
-"update - Zustand des Arbeitsverzeichnisses den zum Commit "
-"vorgemerkten Änderungen hinzufügen\n"
-"revert - zum Commit vorgemerkte Änderungen auf HEAD Version "
-"zurücksetzen\n"
-"patch - Patch-Blöcke auswählen und selektiv aktualisieren\n"
-"diff - Unterschiede zwischen HEAD und Index anzeigen\n"
-"add untracked - Inhalte von unversionierten Dateien zum Commit vormerken\n"
-
-msgid "missing --"
-msgstr "-- fehlt"
-
-#, perl-format
-msgid "unknown --patch mode: %s"
-msgstr "Unbekannter --patch Modus: %s"
-
-#, perl-format
-msgid "invalid argument %s, expecting --"
-msgstr "ungültiges Argument %s, erwarte --"
-
msgid "local zone differs from GMT by a non-minute interval\n"
msgstr ""
"lokale Zeitzone unterscheidet sich von GMT nicht um ein Minutenintervall\n"
@@ -22854,3 +22837,377 @@ msgstr "Lasse %s mit Backup-Suffix '%s' aus.\n"
#, perl-format
msgid "Do you really want to send %s? [y|N]: "
msgstr "Wollen Sie %s wirklich versenden? [y|N]: "
+
+#~ msgid "git bisect--helper --bisect-state (bad|new) [<rev>]"
+#~ msgstr "git bisect--helper --bisect-state (bad|new) [<Commit>]"
+
+#~ msgid "won't bisect on cg-seek'ed tree"
+#~ msgstr ""
+#~ "binäre Suche auf einem durch 'cg-seek' geändertem Verzeichnis nicht "
+#~ "möglich"
+
+#~ msgid "--bisect-terms requires 0 or 1 argument"
+#~ msgstr "--bisect-terms benötigt 0 oder 1 Argument"
+
+#~ msgid "--bisect-next requires 0 arguments"
+#~ msgstr "--bisect-next benötigt 0 Argumente"
+
+#~ msgid "--bisect-log requires 0 arguments"
+#~ msgstr "--bisect-log benötigt 0 Argumente"
+
+#~ msgid "git env--helper --type=[bool|ulong] <options> <env-var>"
+#~ msgstr "git env--helper --type=[bool|ulong] <Optionen> <Umgebungsvariable>"
+
+#~ msgid "default for git_env_*(...) to fall back on"
+#~ msgstr "Standard für git_env_*(...), um darauf zurückzugreifen"
+
+#~ msgid "be quiet only use git_env_*() value as exit code"
+#~ msgstr ""
+#~ "Ausgaben unterdrücken; nur git_env_*() Werte als Exit-Code verwenden"
+
+#, c-format
+#~ msgid ""
+#~ "option `--default' expects a boolean value with `--type=bool`, not `%s`"
+#~ msgstr ""
+#~ "Option `--default' erwartet einen booleschen Wert bei `--type=bool`, "
+#~ "nicht `%s`"
+
+#, c-format
+#~ msgid ""
+#~ "option `--default' expects an unsigned long value with `--type=ulong`, "
+#~ "not `%s`"
+#~ msgstr ""
+#~ "Option `--default' erwartet einen vorzeichenlosen Long-Wert bei `--"
+#~ "type=ulong`, nicht `%s`"
+
+#, c-format
+#~ msgid "%s doesn't support --super-prefix"
+#~ msgstr "%s unterstützt kein --super-prefix"
+
+#, c-format
+#~ msgid "no prefix given for --super-prefix\n"
+#~ msgstr "Kein Präfix für --super-prefix angegeben.\n"
+
+#, c-format
+#~ msgid "failed to read object %s"
+#~ msgstr "Konnte Objekt %s nicht lesen."
+
+#~ msgid "file write error"
+#~ msgstr "Fehler beim Schreiben einer Datei."
+
+#~ msgid "corrupt commit"
+#~ msgstr "fehlerhafter Commit"
+
+#~ msgid "corrupt tag"
+#~ msgstr "fehlerhaftes Tag"
+
+#, c-format
+#~ msgid "%%(objecttype) does not take arguments"
+#~ msgstr "%%(objecttype) akzeptiert keine Argumente"
+
+#, c-format
+#~ msgid "%%(deltabase) does not take arguments"
+#~ msgstr "%%(deltabase) akzeptiert keine Argumente"
+
+#, c-format
+#~ msgid "%%(body) does not take arguments"
+#~ msgstr "%%(body) akzeptiert keine Argumente"
+
+#, c-format
+#~ msgid "unrecognized email option: %s"
+#~ msgstr "nicht erkannte E-Mail Option: %s"
+
+#, c-format
+#~ msgid ""
+#~ "It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
+#~ "may speed it up, but you have to be careful not to forget to add\n"
+#~ "new files yourself (see 'git help status')."
+#~ msgstr ""
+#~ "Es dauerte %.2f Sekunden die unversionierten Dateien zu bestimmen.\n"
+#~ "'status -uno' könnte das beschleunigen, aber Sie müssen darauf achten,\n"
+#~ "neue Dateien selbstständig hinzuzufügen (siehe 'git help status')."
+
+#, perl-format
+#~ msgid "%12s %12s %s"
+#~ msgstr "%28s %25s %s"
+
+#, perl-format
+#~ msgid "touched %d path\n"
+#~ msgid_plural "touched %d paths\n"
+#~ msgstr[0] "%d Pfad angefasst\n"
+#~ msgstr[1] "%d Pfade angefasst\n"
+
+#~ msgid ""
+#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
+#~ "marked for staging."
+#~ msgstr ""
+#~ "Wenn der Patch sauber angewendet werden kann, wird der bearbeitete\n"
+#~ "Patch-Block direkt zum Hinzufügen zur Staging-Area markiert."
+
+#~ msgid ""
+#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
+#~ "marked for stashing."
+#~ msgstr ""
+#~ "Wenn der Patch sauber angewendet werden kann, wird der bearbeitete\n"
+#~ "Patch-Block direkt zum Hinzufügen zum Stash markiert."
+
+#~ msgid ""
+#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
+#~ "marked for unstaging."
+#~ msgstr ""
+#~ "Wenn der Patch sauber angewendet werden kann, wird der bearbeitete\n"
+#~ "Patch-Block direkt zum Entfernen aus der Staging-Area markiert."
+
+#~ msgid ""
+#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
+#~ "marked for applying."
+#~ msgstr ""
+#~ "Wenn der Patch sauber angewendet werden kann, wird der bearbeitete\n"
+#~ "Patch-Block direkt zum Anwenden markiert."
+
+#~ msgid ""
+#~ "If the patch applies cleanly, the edited hunk will immediately be\n"
+#~ "marked for discarding."
+#~ msgstr ""
+#~ "Wenn der Patch sauber angewendet werden kann, wird der bearbeitete\n"
+#~ "Patch-Block direkt zum Verwerfen markiert."
+
+#, perl-format
+#~ msgid "failed to open hunk edit file for writing: %s"
+#~ msgstr ""
+#~ "Fehler beim Öffnen von Editier-Datei eines Patch-Blocks zum Schreiben: %s"
+
+#, perl-format
+#~ msgid ""
+#~ "---\n"
+#~ "To remove '%s' lines, make them ' ' lines (context).\n"
+#~ "To remove '%s' lines, delete them.\n"
+#~ "Lines starting with %s will be removed.\n"
+#~ msgstr ""
+#~ "---\n"
+#~ "Um '%s' Zeilen zu entfernen, machen Sie aus diesen ' ' Zeilen (Kontext).\n"
+#~ "Um '%s' Zeilen zu entfernen, löschen Sie diese.\n"
+#~ "Zeilen, die mit %s beginnen, werden entfernt.\n"
+
+#, perl-format
+#~ msgid "failed to open hunk edit file for reading: %s"
+#~ msgstr ""
+#~ "Fehler beim Öffnen von Editier-Datei eines Patch-Blocks zum Lesen: %s"
+
+#~ msgid ""
+#~ "y - stage this hunk\n"
+#~ "n - do not stage this hunk\n"
+#~ "q - quit; do not stage this hunk or any of the remaining ones\n"
+#~ "a - stage this hunk and all later hunks in the file\n"
+#~ "d - do not stage this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - diesen Patch-Block zum Commit vormerken\n"
+#~ "n - diesen Patch-Block nicht zum Commit vormerken\n"
+#~ "q - Beenden; diesen oder alle verbleibenden Patch-Blöcke nicht zum Commit "
+#~ "vormerken\n"
+#~ "a - diesen und alle weiteren Patch-Blöcke dieser Datei zum Commit "
+#~ "vormerken\n"
+#~ "d - diesen oder alle weiteren Patch-Blöcke in dieser Datei nicht zum "
+#~ "Commit vormerken"
+
+#~ msgid ""
+#~ "y - stash this hunk\n"
+#~ "n - do not stash this hunk\n"
+#~ "q - quit; do not stash this hunk or any of the remaining ones\n"
+#~ "a - stash this hunk and all later hunks in the file\n"
+#~ "d - do not stash this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - diesen Patch-Block stashen\n"
+#~ "n - diesen Patch-Block nicht stashen\n"
+#~ "q - Beenden; diesen oder alle verbleibenden Patch-Blöcke nicht stashen\n"
+#~ "a - diesen und alle weiteren Patch-Blöcke dieser Datei stashen\n"
+#~ "d - diesen oder alle weiteren Patch-Blöcke dieser Datei nicht stashen"
+
+#~ msgid ""
+#~ "y - unstage this hunk\n"
+#~ "n - do not unstage this hunk\n"
+#~ "q - quit; do not unstage this hunk or any of the remaining ones\n"
+#~ "a - unstage this hunk and all later hunks in the file\n"
+#~ "d - do not unstage this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - diesen Patch-Block unstashen\n"
+#~ "n - diesen Patch-Block nicht unstashen\n"
+#~ "q - Beenden; diesen oder alle verbleibenden Patch-Blöcke nicht unstashen\n"
+#~ "a - diesen und alle weiteren Patch-Blöcke dieser Datei unstashen\n"
+#~ "d - diesen oder alle weiteren Patch-Blöcke dieser Datei nicht unstashen"
+
+#~ msgid ""
+#~ "y - apply this hunk to index\n"
+#~ "n - do not apply this hunk to index\n"
+#~ "q - quit; do not apply this hunk or any of the remaining ones\n"
+#~ "a - apply this hunk and all later hunks in the file\n"
+#~ "d - do not apply this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - diesen Patch-Block auf den Index anwenden\n"
+#~ "n - diesen Patch-Block nicht auf den Index anwenden\n"
+#~ "q - Beenden; diesen oder alle verbleibenden Patch-Blöcke nicht auf den "
+#~ "Index anwenden\n"
+#~ "a - diesen und alle weiteren Patch-Blöcke dieser Datei auf den Index "
+#~ "anwenden\n"
+#~ "d - diesen oder alle weiteren Patch-Blöcke dieser Datei nicht auf den "
+#~ "Index anwenden"
+
+#~ msgid ""
+#~ "y - discard this hunk from worktree\n"
+#~ "n - do not discard this hunk from worktree\n"
+#~ "q - quit; do not discard this hunk or any of the remaining ones\n"
+#~ "a - discard this hunk and all later hunks in the file\n"
+#~ "d - do not discard this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - diesen Patch-Block im Arbeitsverzeichnis verwerfen\n"
+#~ "n - diesen Patch-Block im Arbeitsverzeichnis nicht verwerfen\n"
+#~ "q - Beenden; diesen oder alle verbleibenden Patch-Blöcke nicht im "
+#~ "Arbeitsverzeichnis verwerfen\n"
+#~ "a - diesen und alle weiteren Patch-Blöcke dieser Datei im "
+#~ "Arbeitsverzeichnis verwerfen\n"
+#~ "d - diesen oder alle weiteren Patch-Blöcke dieser Datei nicht im "
+#~ "Arbeitsverzeichnis verwerfen"
+
+#~ msgid ""
+#~ "y - discard this hunk from index and worktree\n"
+#~ "n - do not discard this hunk from index and worktree\n"
+#~ "q - quit; do not discard this hunk or any of the remaining ones\n"
+#~ "a - discard this hunk and all later hunks in the file\n"
+#~ "d - do not discard this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - diesen Patch-Block im Index und Arbeitsverzeichnis verwerfen\n"
+#~ "n - diesen Patch-Block nicht im Index und Arbeitsverzeichnis verwerfen\n"
+#~ "q - Beenden; diesen oder alle verbleibenden Patch-Blöcke nicht im Index "
+#~ "und Arbeitsverzeichnis verwerfen\n"
+#~ "a - diesen und alle weiteren Patch-Blöcke in der Datei verwerfen\n"
+#~ "d - diesen oder alle weiteren Patch-Blöcke in der Datei nicht verwerfen"
+
+#~ msgid ""
+#~ "y - apply this hunk to index and worktree\n"
+#~ "n - do not apply this hunk to index and worktree\n"
+#~ "q - quit; do not apply this hunk or any of the remaining ones\n"
+#~ "a - apply this hunk and all later hunks in the file\n"
+#~ "d - do not apply this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - diesen Patch-Block im Index und auf Arbeitsverzeichnis anwenden\n"
+#~ "n - diesen Patch-Block nicht im Index und auf Arbeitsverzeichnis "
+#~ "anwenden\n"
+#~ "q - Beenden; diesen oder alle verbleibenden Patch-Blöcke nicht anwenden\n"
+#~ "a - diesen und alle weiteren Patch-Blöcke in der Datei anwenden\n"
+#~ "d - diesen oder alle weiteren Patch-Blöcke in der Datei nicht anwenden"
+
+#~ msgid ""
+#~ "y - apply this hunk to worktree\n"
+#~ "n - do not apply this hunk to worktree\n"
+#~ "q - quit; do not apply this hunk or any of the remaining ones\n"
+#~ "a - apply this hunk and all later hunks in the file\n"
+#~ "d - do not apply this hunk or any of the later hunks in the file"
+#~ msgstr ""
+#~ "y - diesen Patch-Block auf das Arbeitsverzeichnis anwenden\n"
+#~ "n - diesen Patch-Block nicht auf das Arbeitsverzeichnis anwenden\n"
+#~ "q - Beenden; diesen und alle verbleibenden Patch-Blöcke nicht anwenden\n"
+#~ "a - diesen und alle weiteren Patch-Blöcke in der Datei anwenden\n"
+#~ "d - diesen und alle weiteren Patch-Blöcke in der Datei nicht anwenden"
+
+#~ msgid ""
+#~ "g - select a hunk to go to\n"
+#~ "/ - search for a hunk matching the given regex\n"
+#~ "j - leave this hunk undecided, see next undecided hunk\n"
+#~ "J - leave this hunk undecided, see next hunk\n"
+#~ "k - leave this hunk undecided, see previous undecided hunk\n"
+#~ "K - leave this hunk undecided, see previous hunk\n"
+#~ "s - split the current hunk into smaller hunks\n"
+#~ "e - manually edit the current hunk\n"
+#~ "? - print help\n"
+#~ msgstr ""
+#~ "g - Patch-Block zum Hinspringen auswählen\n"
+#~ "/ - nach Patch-Block suchen, der gegebenem regulärem Ausdruck entspricht\n"
+#~ "j - diesen Patch-Block unbestimmt lassen, nächsten unbestimmten Patch-"
+#~ "Block anzeigen\n"
+#~ "J - diesen Patch-Block unbestimmt lassen, nächsten Patch-Block anzeigen\n"
+#~ "k - diesen Patch-Block unbestimmt lassen, vorherigen unbestimmten Patch-"
+#~ "Block anzeigen\n"
+#~ "K - diesen Patch-Block unbestimmt lassen, vorherigen Patch-Block "
+#~ "anzeigen\n"
+#~ "s - aktuellen Patch-Block in kleinere Patch-Blöcke aufteilen\n"
+#~ "e - aktuellen Patch-Block manuell editieren\n"
+#~ "? - Hilfe anzeigen\n"
+
+#~ msgid "The selected hunks do not apply to the index!\n"
+#~ msgstr ""
+#~ "Die ausgewählten Patch-Blöcke können nicht auf den Index angewendet "
+#~ "werden!\n"
+
+#, perl-format
+#~ msgid "ignoring unmerged: %s\n"
+#~ msgstr "ignoriere nicht zusammengeführte Datei: %s\n"
+
+#~ msgid "No other hunks to goto\n"
+#~ msgstr "Keine anderen Patch-Blöcke verbleibend\n"
+
+#, perl-format
+#~ msgid "Invalid number: '%s'\n"
+#~ msgstr "Ungültige Nummer: '%s'\n"
+
+#, perl-format
+#~ msgid "Sorry, only %d hunk available.\n"
+#~ msgid_plural "Sorry, only %d hunks available.\n"
+#~ msgstr[0] "Entschuldigung, nur %d Patch-Block verfügbar.\n"
+#~ msgstr[1] "Entschuldigung, nur %d Patch-Blöcke verfügbar.\n"
+
+#~ msgid "No other hunks to search\n"
+#~ msgstr "Keine anderen Patch-Blöcke zum Durchsuchen\n"
+
+#, perl-format
+#~ msgid "Malformed search regexp %s: %s\n"
+#~ msgstr "Fehlerhafter regulärer Ausdruck für Suche %s: %s\n"
+
+#~ msgid "No hunk matches the given pattern\n"
+#~ msgstr "Kein Patch-Block entspricht dem angegebenen Muster\n"
+
+#~ msgid "No previous hunk\n"
+#~ msgstr "Kein vorheriger Patch-Block\n"
+
+#~ msgid "No next hunk\n"
+#~ msgstr "Kein folgender Patch-Block\n"
+
+#~ msgid "Sorry, cannot split this hunk\n"
+#~ msgstr "Entschuldigung, kann diesen Patch-Block nicht aufteilen.\n"
+
+#, perl-format
+#~ msgid "Split into %d hunk.\n"
+#~ msgid_plural "Split into %d hunks.\n"
+#~ msgstr[0] "In %d Patch-Block aufgeteilt.\n"
+#~ msgstr[1] "In %d Patch-Blöcke aufgeteilt.\n"
+
+#~ msgid "Sorry, cannot edit this hunk\n"
+#~ msgstr "Entschuldigung, kann diesen Patch-Block nicht bearbeiten.\n"
+
+#~ msgid ""
+#~ "status - show paths with changes\n"
+#~ "update - add working tree state to the staged set of changes\n"
+#~ "revert - revert staged set of changes back to the HEAD version\n"
+#~ "patch - pick hunks and update selectively\n"
+#~ "diff - view diff between HEAD and index\n"
+#~ "add untracked - add contents of untracked files to the staged set of "
+#~ "changes\n"
+#~ msgstr ""
+#~ "status - Pfade mit Änderungen anzeigen\n"
+#~ "update - Zustand des Arbeitsverzeichnisses den zum Commit "
+#~ "vorgemerkten Änderungen hinzufügen\n"
+#~ "revert - zum Commit vorgemerkte Änderungen auf HEAD Version "
+#~ "zurücksetzen\n"
+#~ "patch - Patch-Blöcke auswählen und selektiv aktualisieren\n"
+#~ "diff - Unterschiede zwischen HEAD und Index anzeigen\n"
+#~ "add untracked - Inhalte von unversionierten Dateien zum Commit vormerken\n"
+
+#~ msgid "missing --"
+#~ msgstr "-- fehlt"
+
+#, perl-format
+#~ msgid "unknown --patch mode: %s"
+#~ msgstr "Unbekannter --patch Modus: %s"
+
+#, perl-format
+#~ msgid "invalid argument %s, expecting --"
+#~ msgstr "ungültiges Argument %s, erwarte --"
diff --git a/po/fr.po b/po/fr.po
index b29d341002..f032441614 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -1,5 +1,5 @@
# French translations for Git.
-# Copyright (C) 2019 Jean-Noël Avila <jn.avila@free.fr>
+# Copyright (C) 2023 Jean-Noël Avila <jn.avila@free.fr>
# This file is distributed under the same license as the Git package.
# Jean-Noël Avila <jn.avila@free.fr>, 2013-2019.
# Sébastien Helleu <flashcode@flashtux.org>, 2013.
@@ -48,7 +48,7 @@
# pack | paquet
# patches | patchs
# pattern | motif
-# to prune | éliminer
+# to prune | élaguer
# to push | pousser
# to rebase | rebaser
# scheduler | planificateur
@@ -78,8 +78,8 @@ msgid ""
msgstr ""
"Project-Id-Version: git\n"
"Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2022-09-28 21:43+0200\n"
-"PO-Revision-Date: 2022-09-28 21:45+0200\n"
+"POT-Creation-Date: 2023-03-01 01:20+0000\n"
+"PO-Revision-Date: 2023-03-02 18:44+0100\n"
"Last-Translator: Cédric Malard <c.malard-git@valdun.net>\n"
"Language-Team: Jean-Noël Avila <jn.avila@free.fr>\n"
"Language: fr\n"
@@ -115,13 +115,13 @@ msgstr "impossible d'indexer '%s'"
msgid "could not write index"
msgstr "impossible d'écrire l'index"
-#, c-format, perl-format
+#, c-format
msgid "updated %d path\n"
msgid_plural "updated %d paths\n"
msgstr[0] "%d chemin mis à jour\n"
msgstr[1] "%d chemins mis à jour\n"
-#, c-format, perl-format
+#, c-format
msgid "note: %s is untracked now.\n"
msgstr "note : %s n'est plus suivi à présent.\n"
@@ -135,7 +135,7 @@ msgstr "Inverser"
msgid "Could not parse HEAD^{tree}"
msgstr "Impossible d'analyser HEAD^{tree}"
-#, c-format, perl-format
+#, c-format
msgid "reverted %d path\n"
msgid_plural "reverted %d paths\n"
msgstr[0] "%d chemin inversé\n"
@@ -148,7 +148,7 @@ msgstr "Aucun Fichier non suivi.\n"
msgid "Add untracked"
msgstr "Ajouter un fichier non-suivi"
-#, c-format, perl-format
+#, c-format
msgid "added %d path\n"
msgid_plural "added %d paths\n"
msgstr[0] "%d chemin ajouté\n"
@@ -245,19 +245,19 @@ msgstr "impossible de rafraîchir l'index"
msgid "Bye.\n"
msgstr "Au revoir.\n"
-#, c-format, perl-format
+#, c-format
msgid "Stage mode change [y,n,q,a,d%s,?]? "
msgstr "Indexer le changement de mode [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Stage deletion [y,n,q,a,d%s,?]? "
msgstr "Indexer la suppression [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Stage addition [y,n,q,a,d%s,?]? "
msgstr "Indexer l'ajout [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Stage this hunk [y,n,q,a,d%s,?]? "
msgstr "Indexer cette section [y,n,q,a,d%s,?] ? "
@@ -281,19 +281,19 @@ msgstr ""
"a - indexer cette section et toutes les suivantes de ce fichier\n"
"d - ne pas indexer cette section ni les suivantes de ce fichier\n"
-#, c-format, perl-format
+#, c-format
msgid "Stash mode change [y,n,q,a,d%s,?]? "
msgstr "Remiser le changement de mode [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Stash deletion [y,n,q,a,d%s,?]? "
msgstr "Remiser la suppression [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Stash addition [y,n,q,a,d%s,?]? "
msgstr "Remiser l'ajout [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Stash this hunk [y,n,q,a,d%s,?]? "
msgstr "Remiser cette section [y,n,q,a,d%s,?] ? "
@@ -317,19 +317,19 @@ msgstr ""
"a - remiser cette section et toutes les suivantes de ce fichier\n"
"d - ne pas remiser cette section ni les suivantes de ce fichier\n"
-#, c-format, perl-format
+#, c-format
msgid "Unstage mode change [y,n,q,a,d%s,?]? "
msgstr "Désindexer le changement de mode [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage deletion [y,n,q,a,d%s,?]? "
msgstr "Désindexer la suppression [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage addition [y,n,q,a,d%s,?]? "
msgstr "Désindexer l'ajout [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage this hunk [y,n,q,a,d%s,?]? "
msgstr "Désindexer cette section [y,n,q,a,d%s,?] ? "
@@ -353,19 +353,19 @@ msgstr ""
"a - désindexer cette section et toutes les suivantes de ce fichier\n"
"d - ne pas désindexer cette section ni les suivantes de ce fichier\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to index [y,n,q,a,d%s,?]? "
msgstr "Appliquer le changement de mode à l'index [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to index [y,n,q,a,d%s,?]? "
msgstr "Appliquer la suppression à l'index [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to index [y,n,q,a,d%s,?]? "
msgstr "Appliquer l'ajout à l'index [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to index [y,n,q,a,d%s,?]? "
msgstr "Appliquer cette section à l'index [y,n,q,a,d%s,?] ? "
@@ -389,19 +389,19 @@ msgstr ""
"a - appliquer cette section et toutes les suivantes de ce fichier\n"
"d - ne pas appliquer cette section ni les suivantes de ce fichier\n"
-#, c-format, perl-format
+#, c-format
msgid "Discard mode change from worktree [y,n,q,a,d%s,?]? "
msgstr "Abandonner le changement de mode dans l'arbre [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Discard deletion from worktree [y,n,q,a,d%s,?]? "
msgstr "Abandonner la suppression dans l'arbre [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Discard addition from worktree [y,n,q,a,d%s,?]? "
msgstr "Abandonner l'ajout dans l'arbre [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Discard this hunk from worktree [y,n,q,a,d%s,?]? "
msgstr "Abandonner cette section dans l'arbre [y,n,q,a,d%s,?] ? "
@@ -425,20 +425,20 @@ msgstr ""
"a - supprimer cette section et toutes les suivantes de ce fichier\n"
"d - ne pas supprimer cette section ni les suivantes de ce fichier\n"
-#, c-format, perl-format
+#, c-format
msgid "Discard mode change from index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Abandonner le changement de mode dans l'index et l'arbre [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Discard deletion from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Abandonner la suppression de l'index et de l'arbre [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Discard addition from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Abandonner l'ajout de l'index et de l'arbre [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Discard this hunk from index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Supprimer la section dans l'index et l'arbre de travail [y,n,q,a,d%s,?] ? "
@@ -456,24 +456,24 @@ msgstr ""
"a - éliminer cette section et toutes les suivantes de ce fichier\n"
"d - ne pas éliminer cette section ni les suivantes de ce fichier\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Appliquer le changement de mode dans l'index et l'arbre de travail [y,n,q,a,"
"d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Appliquer la suppression dans l'index et l'arbre de travail [y,n,q,a,"
"d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Appliquer l'ajout dans l'index et l'arbre de travail [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Appliquer la section à l'index et l'arbre de travail [y,n,q,a,d%s,?] ? "
@@ -491,20 +491,20 @@ msgstr ""
"a - appliquer cette section et toutes les suivantes de ce fichier\n"
"d - ne pas appliquer cette section ni les suivantes de ce fichier\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Appliquer le changement de mode dans l'arbre de travail [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to worktree [y,n,q,a,d%s,?]? "
msgstr "Appliquer la suppression dans l'arbre de travail [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to worktree [y,n,q,a,d%s,?]? "
msgstr "Appliquer l'ajout dans l'arbre de travail [y,n,q,a,d%s,?] ? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to worktree [y,n,q,a,d%s,?]? "
msgstr "Appliquer la section à l'arbre de travail [y,n,q,a,d%s,?] ? "
@@ -581,8 +581,6 @@ msgstr ""
"Pour éliminer les lignes '%c', effacez-les.\n"
"Les lignes commençant par %c seront éliminées.\n"
-#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
-#. TRANSLATORS: 'it' refers to the patch mentioned in the previous messages.
msgid ""
"If it does not apply cleanly, you will be given an opportunity to\n"
"edit again. If all lines of the hunk are removed, then the edit is\n"
@@ -598,24 +596,16 @@ msgstr "impossible d'analyser l'entête de section"
msgid "'git apply --cached' failed"
msgstr "'git apply --cached' a échoué"
-#. #-#-#-#-# add-patch.c.po #-#-#-#-#
#. TRANSLATORS: do not translate [y/n]
#. The program will only accept that input at this point.
#. Consider translating (saying "no" discards!) as
#. (saying "n" for "no" discards!) if the translation
#. of the word "no" does not start with n.
#.
-#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
-#. TRANSLATORS: do not translate [y/n]
-#. The program will only accept that input
-#. at this point.
-#. Consider translating (saying "no" discards!) as
-#. (saying "n" for "no" discards!) if the translation
-#. of the word "no" does not start with n.
msgid ""
"Your edited hunk does not apply. Edit again (saying \"no\" discards!) [y/n]? "
msgstr ""
-"Votre section éditée ne s'applique pas. L'éditer à nouveau (\"no\" "
+"Votre section éditée ne s'applique pas. L'éditer à nouveau (\"n\" "
"l'élimine !) [y|n] ? "
msgid "The selected hunks do not apply to the index!"
@@ -841,6 +831,9 @@ msgstr "cmdline se termine par \\"
msgid "unclosed quote"
msgstr "citation non fermée"
+msgid "too many arguments"
+msgstr "trop d'arguments"
+
#, c-format
msgid "unrecognized whitespace option '%s'"
msgstr "option d'espace non reconnue '%s'"
@@ -1466,6 +1459,12 @@ msgstr "lire .gitattributes dans le répertoire de travail"
msgid "report archived files on stderr"
msgstr "afficher les fichiers archivés sur stderr"
+msgid "time"
+msgstr "heure"
+
+msgid "set modification time of archive entries"
+msgstr "régler la date de modification des entrées de l'archive"
+
msgid "set compression level"
msgstr "régler le niveau de compression"
@@ -1506,6 +1505,13 @@ msgstr "Argument non supporté pour le format '%s' : -%d"
msgid "%.*s is not a valid attribute name"
msgstr "%.*s n'est pas un nom valide d'attribut"
+msgid "unable to add additional attribute"
+msgstr "Impossible d'ajouter l'attribut additionnel"
+
+#, c-format
+msgid "ignoring overly long attributes line %d"
+msgstr "ligne d'attribute trop longue ignorée %d"
+
#, c-format
msgid "%s not allowed: %s:%d"
msgstr "%s non permis : %s : %d"
@@ -1518,6 +1524,18 @@ msgstr ""
"Utilisez '\\!' pour un point d'exclamation littéral."
#, c-format
+msgid "cannot fstat gitattributes file '%s'"
+msgstr "impossible de fstat le fichier gitattributes '%s'"
+
+#, c-format
+msgid "ignoring overly large gitattributes file '%s'"
+msgstr "fichier gitattributes trop gros ignoré '%s'"
+
+#, c-format
+msgid "ignoring overly large gitattributes blob '%s'"
+msgstr "blob gitattributes trop gros ignoré '%s'"
+
+#, c-format
msgid "Badly quoted content in file '%s': %s"
msgstr "Contenu mal cité dans le fichier '%s' : %s"
@@ -1795,11 +1813,11 @@ msgstr "sous-module '%s' : impossible de trouver le sous-module"
#, c-format
msgid ""
-"You may try updating the submodules using 'git checkout %s && git submodule "
-"update --init'"
+"You may try updating the submodules using 'git checkout --no-recurse-"
+"submodules %s && git submodule update --init'"
msgstr ""
"Vous pouvez essayer de mettre à jour les sous-modules en utilisant 'git "
-"checkout %s && git submodule update --init'"
+"checkout --no-recurse-submodules %s && git submodule update --init'"
#, c-format
msgid "submodule '%s': cannot create branch '%s'"
@@ -1834,6 +1852,13 @@ msgstr "suppression de '%s'\n"
msgid "Unstaged changes after refreshing the index:"
msgstr "Modifications non indexées après rafraîchissement de l'index :"
+msgid ""
+"the add.interactive.useBuiltin setting has been removed!\n"
+"See its entry in 'git help config' for details."
+msgstr ""
+"le réglage add.interactive.useBuiltin a été supprimé !\n"
+"Référez-vous à cette entrée dans 'git help config' pour plus de détails."
+
msgid "Could not read the index"
msgstr "Impossible de lire l'index"
@@ -2229,6 +2254,9 @@ msgstr "git am [<options>] (--continue | --skip | --abort)"
msgid "run interactively"
msgstr "exécution interactive"
+msgid "bypass pre-applypatch and applypatch-msg hooks"
+msgstr "court-circuiter les crochets pre-applypatch and applypatch-msg"
+
msgid "historical option -- no-op"
msgstr "option historique -- no-op"
@@ -2373,32 +2401,28 @@ msgstr "git archive : erreur de protocole"
msgid "git archive: expected a flush"
msgstr "git archive : vidage attendu"
-msgid "git bisect--helper --bisect-reset [<commit>]"
-msgstr "git bisect--helper --bisect-reset [<commit>]"
-
msgid ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}"
-"=<term>] [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] "
-"[<paths>...]"
+"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>] [--no-"
+"checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]"
msgstr ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<terme> --term-{old,good}"
-"=<terme>][--no-checkout] [--first-parent] [<mauvais> [<bon>...]] [--] "
-"[<chemins>...]"
+"git bisect start [--term-{new,bad}=<terme> --term-{old,good}=<terme>] [--"
+"no-checkout] [--first-parent] [<mauvais> [<bon>...]] [--] [<spéc-de-"
+"chemin>...]"
-msgid "git bisect--helper --bisect-state (bad|new) [<rev>]"
-msgstr "git bisect--helper --bisect-state (bad|new) [<rév>]"
+msgid "git bisect (good|bad) [<rev>...]"
+msgstr "git bisect (good|bad) [<rév>...]"
-msgid "git bisect--helper --bisect-state (good|old) [<rev>...]"
-msgstr "git bisect--helper --bisect-state (good|old) [<rév>...]"
+msgid "git bisect skip [(<rev>|<range>)...]"
+msgstr "git bisect skip [(<rév>|<plage>)...]"
-msgid "git bisect--helper --bisect-replay <filename>"
-msgstr "git bisect--helper --bisect-replay <nom-de-fichier>"
+msgid "git bisect reset [<commit>]"
+msgstr "git bisect reset [<commit>]"
-msgid "git bisect--helper --bisect-skip [(<rev>|<range>)...]"
-msgstr "git bisect--helper --bisect-skip [(<rév>|<plage>)...]"
+msgid "git bisect replay <logfile>"
+msgstr "git bisect replay <fichier-journal>"
-msgid "git bisect--helper --bisect-run <cmd>..."
-msgstr "git bisect--helper --bisect-run <cmd>..."
+msgid "git bisect run <cmd>..."
+msgstr "git bisect run <cmd>..."
#, c-format
msgid "cannot open file '%s' in mode '%s'"
@@ -2545,9 +2569,6 @@ msgid "checking out '%s' failed. Try 'git bisect start <valid-branch>'."
msgstr ""
"l'extraction de '%s' a échoué. Essayez 'git bisect start <branche-valide>'."
-msgid "won't bisect on cg-seek'ed tree"
-msgstr "refus de bissecter sur un arbre 'cg-seeked'"
-
msgid "bad HEAD - strange symbolic ref"
msgstr "mauvaise HEAD - référence symbolique douteuse"
@@ -2599,16 +2620,16 @@ msgid "bisect run failed: no command provided."
msgstr "la bissection a échoué : aucune commande fournie."
#, c-format
-msgid "unable to verify '%s' on good revision"
-msgstr "impossible de vérifier '%s' sur une bonne révision"
+msgid "unable to verify %s on good revision"
+msgstr "impossible de vérifier %s sur une bonne révision"
#, c-format
msgid "bogus exit code %d for good revision"
msgstr "code de sortie %d erroné pour une bonne révision"
#, c-format
-msgid "bisect run failed: exit code %d from '%s' is < 0 or >= 128"
-msgstr "la bissection a échoué : le code retour %d de '%s' est < 0 ou >= 128"
+msgid "bisect run failed: exit code %d from %s is < 0 or >= 128"
+msgstr "la bissection a échoué : le code retour %d de %s est < 0 ou >= 128"
#, c-format
msgid "cannot open file '%s' for writing"
@@ -2617,76 +2638,48 @@ msgstr "impossible d'ouvrir '%s' en écriture"
msgid "bisect run cannot continue any more"
msgstr "la bissection ne peut plus continuer"
-#, c-format
msgid "bisect run success"
msgstr "succès de la bissection"
-#, c-format
msgid "bisect found first bad commit"
msgstr "la bissection a trouvé le premier mauvais commit"
#, c-format
-msgid ""
-"bisect run failed: 'git bisect--helper --bisect-state %s' exited with error "
-"code %d"
-msgstr ""
-"la bissection a échoué : 'git bisect--helper --bisect-state %s' a retourné "
-"le code erreur %d"
-
-msgid "reset the bisection state"
-msgstr "réinitialiser l'état de la bissection"
-
-msgid "check whether bad or good terms exist"
-msgstr "vérifier si les termes bons ou mauvais existent"
-
-msgid "print out the bisect terms"
-msgstr "afficher les termes de bissection"
-
-msgid "start the bisect session"
-msgstr "démarrer une session de bissection"
-
-msgid "find the next bisection commit"
-msgstr "trouver le prochain commit de bissection"
-
-msgid "mark the state of ref (or refs)"
-msgstr "marquer l'état d'une références (ou plusieurs)"
+msgid "bisect run failed: 'git bisect %s' exited with error code %d"
+msgstr "la bissection a échoué : 'git bisect %s' a retourné le code erreur %d"
-msgid "list the bisection steps so far"
-msgstr "lister les étapes de bissection jusqu'ici"
-
-msgid "replay the bisection process from the given file"
-msgstr "rejouer le processus de bissection depuis le fichier fourni"
-
-msgid "skip some commits for checkout"
-msgstr "sauter certains commits pour l'extraction"
-
-msgid "visualize the bisection"
-msgstr "visualiser la bissection"
-
-msgid "use <cmd>... to automatically bisect"
-msgstr "utiliser <cmd>... pour bissecter automatiquement"
+#, c-format
+msgid "'%s' requires either no argument or a commit"
+msgstr "%s supporte soit aucun argument, soit un commit"
-msgid "no log for BISECT_WRITE"
-msgstr "pas de journal pour BISECT_WRITE"
+#, c-format
+msgid "'%s' requires 0 or 1 argument"
+msgstr "'%s' nécessite 0 ou 1 argument"
-msgid "--bisect-reset requires either no argument or a commit"
-msgstr "--bisect-reset supporte soit aucun argument, soit un commit"
+#, c-format
+msgid "'%s' requires 0 arguments"
+msgstr "'%s' n'accepte aucun argument"
-msgid "--bisect-terms requires 0 or 1 argument"
-msgstr "--bisect-terms exige 0 ou 1 argument"
+msgid "no logfile given"
+msgstr "pas de fichier de log donné"
-msgid "--bisect-next requires 0 arguments"
-msgstr "--bisect-next exige 0 argument"
+#, c-format
+msgid "'%s' failed: no command provided."
+msgstr "'%s' a échoué : aucune commande fournie."
-msgid "--bisect-log requires 0 arguments"
-msgstr "--bisect-log exige 0 argument"
+msgid "need a command"
+msgstr "commande requise"
-msgid "no logfile given"
-msgstr "pas de fichier de log donné"
+#, c-format
+msgid "unknown command: '%s'"
+msgstr "commande inconnue : '%s'"
msgid "git blame [<options>] [<rev-opts>] [<rev>] [--] <file>"
msgstr "git blame [<options>] [<rev-opts>] [<rev>] [--] <fichier>"
+msgid "git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>"
+msgstr "git annotate [<options>] [<options-de-rev>] [<rev>] [--] <fichier>"
+
msgid "<rev-opts> are documented in git-rev-list(1)"
msgstr "<options-de-révision> sont documentés dans git-rev-list(1)"
@@ -2887,9 +2880,6 @@ msgstr "Échec de la mise à jour du fichier de configuration"
msgid "cannot use -a with -d"
msgstr "impossible d'utiliser -a avec -d"
-msgid "Couldn't look up commit object for HEAD"
-msgstr "Impossible de rechercher l'objet commit pour HEAD"
-
#, c-format
msgid "Cannot delete branch '%s' checked out at '%s'"
msgstr "Impossible de supprimer la branche '%s' extraite dans '%s'"
@@ -2928,16 +2918,18 @@ msgstr "La branche %s est en cours de rebasage sur %s"
msgid "Branch %s is being bisected at %s"
msgstr "La branche %s est en cours de bissection sur %s"
-msgid "cannot copy the current branch while not on any."
-msgstr "impossible de copier la branche actuelle, il n'y en a pas."
-
-msgid "cannot rename the current branch while not on any."
-msgstr "impossible de renommer la branche actuelle, il n'y en a pas."
-
#, c-format
msgid "Invalid branch name: '%s'"
msgstr "Nom de branche invalide : '%s'"
+#, c-format
+msgid "No commit on branch '%s' yet."
+msgstr "Aucun commit sur la branche '%s'."
+
+#, c-format
+msgid "No branch named '%s'."
+msgstr "Aucune branche nommée '%s'."
+
msgid "Branch rename failed"
msgstr "Échec de renommage de la branche"
@@ -3100,13 +3092,11 @@ msgstr "Impossible de décrire une HEAD détachée"
msgid "cannot edit description of more than one branch"
msgstr "impossible d'éditer la description de plus d'une branche"
-#, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "Aucun commit sur la branche '%s'."
+msgid "cannot copy the current branch while not on any."
+msgstr "impossible de copier la branche actuelle, il n'y en a pas."
-#, c-format
-msgid "No branch named '%s'."
-msgstr "Aucune branche nommée '%s'."
+msgid "cannot rename the current branch while not on any."
+msgstr "impossible de renommer la branche actuelle, il n'y en a pas."
msgid "too many branches for a copy operation"
msgstr "trop de branches pour une opération de copie"
@@ -3176,11 +3166,12 @@ msgid "not run from a git repository - no hooks to show\n"
msgstr "lancé hors d'un dépôt git - aucun crochet à montrer\n"
msgid ""
-"git bugreport [-o|--output-directory <file>] [-s|--suffix <format>] [--"
-"diagnose[=<mode>]"
+"git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--diagnose[=<mode>]]"
msgstr ""
-"git bugreport [-o|--output-directory <fichier>] [-s|--suffix <format>] [--"
-"diagnose[=<mode>]]"
+"git bugreport [(-o | --output-directory) <chemin>] [(-s | --suffix) "
+"<format>]\n"
+" [--diagnose[=<mode>]]"
msgid ""
"Thank you for filling out a Git bug report!\n"
@@ -3255,17 +3246,26 @@ msgstr "impossible d'écrire dans %s"
msgid "Created new report at '%s'.\n"
msgstr "Nouveau rapport créé à '%s'.\n"
-msgid "git bundle create [<options>] <file> <git-rev-list args>"
-msgstr "git bundle create [<options>] <fichier> <args git-rev-list>"
+msgid ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<version>] <file> <git-rev-list-args>"
+msgstr ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<version>] <file> <args-de-git-rev-list>"
-msgid "git bundle verify [<options>] <file>"
-msgstr "git bundle verify [<options>] <fichier>"
+msgid "git bundle verify [-q | --quiet] <file>"
+msgstr "git bundle verify [-q | --quiet] <fichier>"
msgid "git bundle list-heads <file> [<refname>...]"
msgstr "git bundle list-heads <fichier> [<nom-de-ref>...]"
-msgid "git bundle unbundle <file> [<refname>...]"
-msgstr "git bundle unbundle <fichier> [<nom-de-ref>...]"
+msgid "git bundle unbundle [--progress] <file> [<refname>...]"
+msgstr "git bundle unbundle [--progress] <fichier> [<nom-de-ref>...]"
+
+msgid "need a <file> argument"
+msgstr "requiert un argument <fichier>"
msgid "do not show progress meter"
msgstr "ne pas afficher la barre de progression"
@@ -3320,10 +3320,6 @@ msgstr "%s nécessite des arguments"
msgid "%s takes no arguments"
msgstr "%s n'accepte aucune argument"
-#, c-format
-msgid "unknown command: '%s'"
-msgstr "commande inconnue : %s"
-
msgid "only one batch option may be specified"
msgstr "une seule option de traitement ne peut être spécifiée à la fois"
@@ -3340,12 +3336,12 @@ msgid ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgstr ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgid ""
"git cat-file (--textconv | --filters)\n"
@@ -3456,18 +3452,21 @@ msgstr "<rev> nécessaire avec '%s'"
msgid "<object> required with '-%c'"
msgstr "<objet> nécessaire avec '-%c'"
-msgid "too many arguments"
-msgstr "trop d'arguments"
-
#, c-format
msgid "only two arguments allowed in <type> <object> mode, not %d"
msgstr "deux arguments seulement permis dans le mode <type> <objet>, pas %d"
-msgid "git check-attr [-a | --all | <attr>...] [--] <pathname>..."
-msgstr "git check-attr [-a | --all | <attr>...] [--] <chemin>..."
+msgid ""
+"git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] "
+"<pathname>..."
+msgstr ""
+"git check-attr [--source <arbre-esque>] [-a | --all | <attr>...] [--] "
+"<chemin>..."
-msgid "git check-attr --stdin [-z] [-a | --all | <attr>...]"
-msgstr "git check-attr --stdin [-z] [-a | --all | <attr>...]"
+msgid ""
+"git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]"
+msgstr ""
+"git check-attr --stdin [-z] [--source <arbre-esque>] [-a | --all | <attr>...]"
msgid "report all attributes set on file"
msgstr "afficher tous les attributs associés au fichier"
@@ -3482,6 +3481,12 @@ msgid "terminate input and output records by a NUL character"
msgstr ""
"terminer les enregistrements en entrée et en sortie par un caractère NUL"
+msgid "<tree-ish>"
+msgstr "<arbre-esque>"
+
+msgid "which tree-ish to check attributes at"
+msgstr "à quel <arbre-esque> vérifier les attributs"
+
msgid "suppress progress reporting"
msgstr "supprimer l'état d'avancement"
@@ -4001,9 +4006,11 @@ msgid "use overlay mode"
msgstr "utiliser le mode de superposition"
msgid ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] "
+"[<pathspec>...]"
msgstr ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <motif>] [-x | -X] [--] <chemins>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <motif>] [-x | -X] [--] [<spec-de-"
+"chemins>...]"
#, c-format
msgid "Removing %s\n"
@@ -4067,7 +4074,7 @@ msgstr ""
"* - choisir tous les éléments\n"
" - (vide) terminer la sélection\n"
-#, c-format, perl-format
+#, c-format
msgid "Huh (%s)?\n"
msgstr "Hein (%s) ?\n"
@@ -4216,9 +4223,6 @@ msgstr "profondeur"
msgid "create a shallow clone of that depth"
msgstr "créer un clone superficiel de cette profondeur"
-msgid "time"
-msgstr "heure"
-
msgid "create a shallow clone since a specific time"
msgstr "créer un clone superficiel depuis une date spécifique"
@@ -4301,6 +4305,10 @@ msgid "failed to start iterator over '%s'"
msgstr "échec du démarrage un itérateur sur '%s'"
#, c-format
+msgid "symlink '%s' exists, refusing to clone with --local"
+msgstr "le lien symbolique '%s' existe, refus de cloner avec --local"
+
+#, c-format
msgid "failed to unlink '%s'"
msgstr "échec pour délier '%s'"
@@ -4366,10 +4374,6 @@ msgstr "Trop d'arguments."
msgid "You must specify a repository to clone."
msgstr "Vous devez spécifier un dépôt à cloner."
-#, c-format
-msgid "options '%s' and '%s %s' cannot be used together"
-msgstr "les options '%s' et '%s %s' ne peuvent pas être utilisées ensemble"
-
msgid ""
"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
"exclude"
@@ -4461,6 +4465,9 @@ msgstr "échec lors de l'initialisation du dépôt, URI du paquet ignoré"
msgid "failed to fetch objects from bundle URI '%s'"
msgstr "impossible de récupérer les objets depuis l'URI de paquet '%s'"
+msgid "failed to fetch advertised bundles"
+msgstr "échec de récupération des colis annoncés"
+
msgid "remote transport reported error"
msgstr "le transport distant a retourné une erreur"
@@ -4496,18 +4503,24 @@ msgid "--command must be the first argument"
msgstr "--command doit être le premier argument"
msgid ""
-"git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"
+"git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]"
msgstr ""
-"git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"
+"git commit-graph verify [--object-dir <rép>] [--shallow] [--[no-]progress]"
msgid ""
-"git commit-graph write [--object-dir <objdir>] [--append] [--"
-"split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] <split options>"
+"git commit-graph write [--object-dir <dir>] [--append]\n"
+" [--split[=<strategy>]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <split options>"
msgstr ""
-"git commit-graph write [--object-dir <répertoire-d'objet>] [--append] [--"
-"split[=<stratégie>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] <options de division>"
+"git commit-graph write [--object-dir <rép>] [--append]\n"
+" [--split[=<stratégie>]] [--reachable | --stdin-packs "
+"| --stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <options de division>"
msgid "dir"
msgstr "répertoire"
@@ -4577,12 +4590,15 @@ msgstr "utilisez un seul parmi --reachable, --stdin-commits ou --stdin-packs"
msgid "Collecting commits from input"
msgstr "Collecte des commits depuis l'entrée"
+msgid "git commit-tree <tree> [(-p <parent>)...]"
+msgstr "git commit-tree <arbre> [(-p <parent>)...]"
+
msgid ""
-"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...] [(-F "
-"<file>)...] <tree>"
+"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n"
+" [(-F <file>)...] <tree>"
msgstr ""
-"git commit-tree [(-p <parent>)...] [-S[<idclé>]] [(-m <message>)...] [(-F "
-"<fichier>)...] <arbre>"
+"git commit-tree [(-p <parent>)...] [-S[<idclé>]] [(-m <message>)...]\n"
+" [(-F <fichier>)...] <arbre>"
#, c-format
msgid "duplicate parent %s ignored"
@@ -4624,11 +4640,29 @@ msgstr "exactement un arbre obligatoire"
msgid "git commit-tree: failed to read"
msgstr "git commit-tree : échec de la lecture"
-msgid "git commit [<options>] [--] <pathspec>..."
-msgstr "git commit [<options>] [--] <spécification-de-chemin>..."
+msgid ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|"
+"reword):]<commit>)]\n"
+" [-F <file> | -m <msg>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n"
+" [--date=<date>] [--cleanup=<mode>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|"
+"reword):]<commit>)]\n"
+" [-F <file> | -m <msg>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<auteur>]\n"
+" [--date=<date>] [--cleanup=<mode>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<fichier> [--pathspec-file-nul]]\n"
+" [(--trailer <symbole>[(=|:)<valeur>])...] [-S[<id-clé>]]\n"
+" [--] [<spéc-de-chemin>...]"
-msgid "git status [<options>] [--] <pathspec>..."
-msgstr "git status [<options>] [--] <spécification-de-chemin>..."
+msgid "git status [<options>] [--] [<pathspec>...]"
+msgstr "git status [<options>] [--] [<spécification-de-chemin>...]"
msgid ""
"You asked to amend the most recent commit, but doing so would make\n"
@@ -5412,11 +5446,18 @@ msgstr "credential-cache non disponible ; pas de gestion des socket unix"
msgid "unable to get credential storage lock in %d ms"
msgstr "impossible d'accéder au verrou de stockage d'identification en %d ms"
-msgid "git describe [<options>] [<commit-ish>...]"
-msgstr "git describe [<options>] <commit ou apparenté>*"
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-esque>...]"
+
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<marque>]"
-msgid "git describe [<options>] --dirty"
-msgstr "git describe [<options>] --dirty"
+msgid "git describe <blob>"
+msgstr "git describe <blob>"
msgid "head"
msgstr "tête"
@@ -5543,11 +5584,11 @@ msgstr ""
"l'option '%s' et des commit-esques ne peuvent pas être utilisées ensemble"
msgid ""
-"git diagnose [-o|--output-directory <path>] [-s|--suffix <format>] [--"
-"mode=<mode>]"
+"git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--mode=<mode>]"
msgstr ""
-"git diagnose [-o|--output-directory <fichier>] [-s|--suffix <format>] [--"
-"mode=<mode>]"
+"git diagnose [-o | --output-directory <fichier>] [(-s | --suffix) <format>]\n"
+" [--mode=<mode>]"
msgid "specify a destination for the diagnostics archive"
msgstr "spécifier la destination de l'archive de diagnostique"
@@ -5565,6 +5606,9 @@ msgstr "--merge-base ne fonctionne qu'avec deux commits"
msgid "'%s': not a regular file or symlink"
msgstr "'%s' : n'est pas un fichier régulier ni un lien symbolique"
+msgid "no merge given, only parents."
+msgstr "pas de fusion fournie, seulement des parents."
+
#, c-format
msgid "invalid option: %s"
msgstr "option invalide : %s"
@@ -5679,30 +5723,6 @@ msgstr "pas d'<outil> spécifié pour --tool=<outil>"
msgid "no <cmd> given for --extcmd=<cmd>"
msgstr "pas de <commande> spécifié pour --extcmd=<commande>"
-msgid "git env--helper --type=[bool|ulong] <options> <env-var>"
-msgstr "git env--helper --type=[bool|ulong] <options> <var d'env>"
-
-msgid "default for git_env_*(...) to fall back on"
-msgstr "valeur par défaut pour git_env_*(...) en cas d'absence"
-
-msgid "be quiet only use git_env_*() value as exit code"
-msgstr ""
-"mode silencieux n'utilisant la valeur de git_env_*() que pour le code de "
-"sortie"
-
-#, c-format
-msgid "option `--default' expects a boolean value with `--type=bool`, not `%s`"
-msgstr ""
-"l'option `--default` attend une valeur booléenne avec `--type=bool`, pas `%s`"
-
-#, c-format
-msgid ""
-"option `--default' expects an unsigned long value with `--type=ulong`, not "
-"`%s`"
-msgstr ""
-"l'option `--default` attend une valeur entier long non signé avec `--"
-"type=ulong`, pas `%s`"
-
msgid "git fast-export [<rev-list-opts>]"
msgstr "git fast-export [<options-de-liste-de-révisions>]"
@@ -5858,12 +5878,12 @@ msgstr ""
msgid "prune remote-tracking branches no longer on remote"
msgstr ""
-"éliminer les branches de suivi distant si la branche n'existe plus dans le "
+"élaguer les branches de suivi distant si la branche n'existe plus dans le "
"dépôt distant"
msgid "prune local tags no longer on remote and clobber changed tags"
msgstr ""
-"éliminer les étiquettes locales qui ont disparu du dépôt distant et qui "
+"élaguer les étiquettes locales qui ont disparu du dépôt distant et qui "
"encombrent les étiquettes modifiées"
msgid "on-demand"
@@ -6112,6 +6132,10 @@ msgstr "une profondeur négative dans --deepen n'est pas supportée"
msgid "--unshallow on a complete repository does not make sense"
msgstr "--unshallow sur un dépôt complet n'a pas de sens"
+#, c-format
+msgid "failed to fetch bundles from '%s'"
+msgstr "échec de récupération des colis depuis '%s'"
+
msgid "fetch --all does not take a repository argument"
msgstr "fetch --all n'accepte pas d'argument de dépôt"
@@ -6214,8 +6238,8 @@ msgstr "afficher seulement les références qui contiennent le commit"
msgid "print only refs which don't contain the commit"
msgstr "afficher seulement les références qui ne contiennent pas le commit"
-msgid "git for-each-repo --config=<config> <command-args>"
-msgstr "git for-each-repo --config=<config> <arguments-de-commande>"
+msgid "git for-each-repo --config=<config> [--] <arguments>"
+msgstr "git for-each-repo --config=<config> [--] <arguments>"
msgid "config"
msgstr "config"
@@ -6386,8 +6410,16 @@ msgstr "non-arbre dans l'arbre de cache"
msgid "%s: invalid sha1 pointer in resolve-undo"
msgstr "%s : pointeur sha1 invalide dans resolve-undo"
-msgid "git fsck [<options>] [<object>...]"
-msgstr "git fsck [<options>] [<objet>...]"
+msgid ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<object>...]"
+msgstr ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<objec>...]"
msgid "show unreachable objects"
msgstr "afficher les objets inaccessibles"
@@ -6443,12 +6475,6 @@ msgstr "git fsmonitor--daemon start [<options>]"
msgid "git fsmonitor--daemon run [<options>]"
msgstr "git fsmonitor--daemon run [<options>]"
-msgid "git fsmonitor--daemon stop"
-msgstr "git fsmonitor--daemon stop"
-
-msgid "git fsmonitor--daemon status"
-msgstr "git fsmonitor--daemon status"
-
#, c-format
msgid "value of '%s' out of range: %d"
msgstr "valeur de '%s' hors de gamme : %d"
@@ -6565,7 +6591,7 @@ msgstr ""
"%s"
msgid "prune unreferenced objects"
-msgstr "éliminer les objets non référencés"
+msgstr "élaguer les objets non référencés"
msgid "pack unreferenced objects separately"
msgstr "empaqueter les objets non référencés séparément"
@@ -6694,8 +6720,20 @@ msgstr "lancer une tâche spécifique"
msgid "use at most one of --auto and --schedule=<frequency>"
msgstr "--auto et --schedule=<fréquence> sont mutuellement exclusifs"
-msgid "failed to run 'git config'"
-msgstr "échec du lancement de 'git config'"
+#, c-format
+msgid "unable to add '%s' value of '%s'"
+msgstr "impossible d'ajouter la valeur '%s' de '%s'"
+
+msgid "return success even if repository was not registered"
+msgstr "renvoyer un succès même si le dépôt n'était pas enregistré"
+
+#, c-format
+msgid "unable to unset '%s' value of '%s'"
+msgstr "impossible de retirer la valeur '%s' de '%s'"
+
+#, c-format
+msgid "repository '%s' is not registered"
+msgstr "le dépôt '%s' n'est pas enregistré"
#, c-format
msgid "failed to expand path '%s'"
@@ -6996,11 +7034,14 @@ msgid "both --cached and trees are given"
msgstr "--cached et des arbres sont fournis en même temps"
msgid ""
-"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters] [--stdin] "
-"[--] <file>..."
+"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]\n"
+" [--stdin [--literally]] [--] <file>..."
msgstr ""
-"git hash-object [-t <type>] [-w] [--path=<fichier> | --no-filters] [--stdin] "
-"[--] <fichier>..."
+"git hash-object [-t <type>] [-w] [--path=<fichier> | --no-filters]\n"
+" [--stdin [--literally]] [--] <fichier>..."
+
+msgid "git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]"
+msgstr "git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]"
msgid "object type"
msgstr "type d'objet"
@@ -7133,13 +7174,19 @@ msgstr "usage : %s%s"
msgid "'git help config' for more information"
msgstr "'git help config' pour plus d'information"
-msgid "git hook run [--ignore-missing] <hook-name> [-- <hook-args>]"
+msgid ""
+"git hook run [--ignore-missing] [--to-stdin=<path>] <hook-name> [-- <hook-"
+"args>]"
msgstr ""
-"git hook run [--ignore-missing] <nom-de-crochet> [-- <arguments-de-crochet>]"
+"git hook run [--ignore-missing] [--to-stdin=<chemin>] <nom-de-crochet> [-- "
+"<arguments-de-crochet>]"
msgid "silently ignore missing requested <hook-name>"
msgstr "ignorer silencieusement le <nom-de-crochet> requis manquant"
+msgid "file to read into hooks' stdin"
+msgstr "fichier à la lire dans l'entrée standard du crochet"
+
#, c-format
msgid "object type mismatch at %s"
msgstr "type d'objet non correspondant à %s"
@@ -7429,11 +7476,15 @@ msgid "Initialized empty Git repository in %s%s\n"
msgstr "Dépôt Git vide initialisé dans %s%s\n"
msgid ""
-"git init [-q | --quiet] [--bare] [--template=<template-directory>] [--"
-"shared[=<permissions>]] [<directory>]"
+"git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
+" [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+" [-b <branch-name> | --initial-branch=<branch-name>]\n"
+" [--shared[=<permissions>]] [<directory>]"
msgstr ""
-"git init [-q | --quiet] [--bare] [--template=<répertoire-modèle>] [--"
-"shared[=<permissions>]] [<répertoire>]"
+"git init [-q | --quiet] [--bare] [--template=<répertoire-modèle>]\n"
+" [--separate-git-dir <rép-git>] [--object-format=<format>]\\n\"\n"
+" [-b <nom-de-branche> | --initial-branch=<nom-de-branche>]\\n\"\n"
+" [--shared[=<permissions>]] [<répertoire>]"
msgid "permissions"
msgstr "permissions"
@@ -7474,11 +7525,13 @@ msgid "--separate-git-dir incompatible with bare repository"
msgstr "--separate-git-dir est incompatible avec un dépôt nu"
msgid ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<token>[(=|:)<value>])...] [<file>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <token>[(=|:)<value>])...]\n"
+" [--parse] [<file>...]"
msgstr ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<symbole>[(=|:)<valeur>])...] [<fichier>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <symbole>[(=|:)<valeur>])...]\n"
+" [--parse] [<fichier>...]"
msgid "edit files in place"
msgstr "éditer les fichiers sur place"
@@ -7952,7 +8005,7 @@ msgid "if any <file> is not in the index, treat this as an error"
msgstr "si un <fichier> n'est pas dans l'index, traiter cela comme une erreur"
msgid "tree-ish"
-msgstr "arbre ou apparenté"
+msgstr "arbre-esque"
msgid "pretend that paths removed since <tree-ish> are still present"
msgstr ""
@@ -7977,12 +8030,12 @@ msgstr ""
msgid ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<repository> [<refs>...]]"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n"
+" [--symref] [<repository> [<patterns>...]]"
msgstr ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<dépôt> [<réf>...]]"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<clé>]\n"
+" [--symref] [<dépôt> [<motif>...]]"
msgid "do not print remote URL"
msgstr "ne pas afficher les URL distantes"
@@ -8116,12 +8169,12 @@ msgstr "git merge-base [-a | --all] <commit> <commit>..."
msgid "git merge-base [-a | --all] --octopus <commit>..."
msgstr "git merge-base [-a | --all] --octopus <commit>..."
-msgid "git merge-base --independent <commit>..."
-msgstr "git merge-base --independent <validation>..."
-
msgid "git merge-base --is-ancestor <commit> <commit>"
msgstr "git merge-base --is-ancestor <validation> <validation>"
+msgid "git merge-base --independent <commit>..."
+msgstr "git merge-base --independent <validation>..."
+
msgid "git merge-base --fork-point <ref> [<commit>]"
msgstr "git merge-base --fork-point <référence> [<validation>]"
@@ -8229,9 +8282,26 @@ msgstr "lister les noms de fichier sans modes/oids/indexation"
msgid "allow merging unrelated histories"
msgstr "permettre la fusion d'historiques sans rapport"
+msgid "perform multiple merges, one per line of input"
+msgstr "réaliser des fusions multiples, une par ligne d'entrée"
+
+msgid "specify a merge-base for the merge"
+msgstr "spécifier une base de fusion pour la fusion"
+
msgid "--trivial-merge is incompatible with all other options"
msgstr "--trivial-merge est incompatible avec d'autres options"
+msgid "--merge-base is incompatible with --stdin"
+msgstr "--merge-base est incompatible avec --stdin"
+
+#, c-format
+msgid "malformed input line: '%s'."
+msgstr "ligne en entrée malformée : '%s'."
+
+#, c-format
+msgid "merging cannot continue; got unclean result of %d"
+msgstr "la fusion ne peut pas continuer ; résultat non propre retourné %d"
+
msgid "git merge [<options>] [<commit>...]"
msgstr "git merge [<options>] [<commit>...]"
@@ -8860,10 +8930,6 @@ msgid "cannot read note data from non-blob object '%s'."
msgstr "impossible de lire les informations de note d'un objet non-blob '%s'."
#, c-format
-msgid "malformed input line: '%s'."
-msgstr "ligne en entrée malformée : '%s'."
-
-#, c-format
msgid "failed to copy notes from '%s' to '%s'"
msgstr "impossible de copier les notes de '%s' vers '%s'"
@@ -9055,16 +9121,15 @@ msgstr "utiliser les notes depuis <références-notes>"
msgid "unknown subcommand: `%s'"
msgstr "sous-commande inconnue : `%s'"
-msgid ""
-"git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"
+msgid "git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"
msgstr ""
-"git pack-objects --stdout [options...] [< <liste-références> | < <liste-"
+"git pack-objects --stdout [<options>] [< <liste-références> | < <liste-"
"objets>]"
msgid ""
-"git pack-objects [<options>...] <base-name> [< <ref-list> | < <object-list>]"
+"git pack-objects [<options>] <base-name> [< <ref-list> | < <object-list>]"
msgstr ""
-"git pack-objects [options...] base-name [< <liste-références> | < <liste-"
+"git pack-objects [<options>] <nom-de-base> [< <liste-références> | < <liste-"
"objets>]"
#, c-format
@@ -9453,20 +9518,32 @@ msgstr ""
"sur la ligne de commande pour nous avertir par\n"
"un courriel à <git@vger.kernel.org>. Merci.\n"
-msgid "git pack-refs [<options>]"
-msgstr "git pack-refs [<options>]"
+msgid "git pack-refs [--all] [--no-prune]"
+msgstr "git pack-refs [--all] [--no-prune]"
msgid "pack everything"
msgstr "empaqueter tout"
msgid "prune loose refs (default)"
-msgstr "éliminer les références perdues (défaut)"
+msgstr "élaguer les références perdues (défaut)"
+
+msgid "git patch-id [--stable | --unstable | --verbatim]"
+msgstr "git patch-id [--stable | --unstable | --verbatim]"
+
+msgid "use the unstable patch-id algorithm"
+msgstr "utiliser l'algorithme instable patch-id"
+
+msgid "use the stable patch-id algorithm"
+msgstr "utiliser l'algorithme stable patch-id"
+
+msgid "don't strip whitespace from the patch"
+msgstr "ne pas retirer les espaces blancs de la rustine"
msgid "git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]"
msgstr "git prune [-n] [-v] [--progress] [--expire <heure>] [--] [<head>…]"
msgid "report pruned objects"
-msgstr "afficher les objets éliminés"
+msgstr "afficher les objets élagués"
msgid "expire objects older than <time>"
msgstr "faire expirer les objets plus vieux que <heure>"
@@ -9475,7 +9552,7 @@ msgid "limit traversal to objects outside promisor packfiles"
msgstr "limiter la traversée aux objets hors des fichiers paquets prometteurs"
msgid "cannot prune in a precious-objects repo"
-msgstr "impossible de nettoyer dans un dépôt d'objets précieux"
+msgstr "impossible d'élaguer dans un dépôt d'objets précieux"
msgid "git pull [<options>] [<repository> [<refspec>...]]"
msgstr "git pull [<options>] [<dépôt> [<spécification-de-référence>...]]"
@@ -9682,9 +9759,8 @@ msgstr ""
msgid ""
"\n"
-"To avoid automatically configuring upstream branches when their name\n"
-"doesn't match the local branch, see option 'simple' of branch."
-"autoSetupMerge\n"
+"To avoid automatically configuring an upstream branch when its name\n"
+"won't match the local branch, see option 'simple' of branch.autoSetupMerge\n"
"in 'git help config'.\n"
msgstr ""
"\n"
@@ -9856,6 +9932,13 @@ msgstr "Poussée vers %s\n"
msgid "failed to push some refs to '%s'"
msgstr "impossible de pousser des références vers '%s'"
+msgid ""
+"recursing into submodule with push.recurseSubmodules=only; using on-demand "
+"instead"
+msgstr ""
+"la récursion dans le sous-module avec push.recurseSubmodules=only ; "
+"utilisation de on-demande à la place"
+
#, c-format
msgid "invalid value for '%s'"
msgstr "valeur invalide pour '%s'"
@@ -9901,7 +9984,7 @@ msgid "set upstream for git pull/status"
msgstr "définir la branche amont pour git pull/status"
msgid "prune locally removed refs"
-msgstr "éliminer les références locales supprimées"
+msgstr "élaguer les références locales supprimées"
msgid "bypass pre-push hook"
msgstr "éviter d'utiliser le crochet pre-push"
@@ -9996,14 +10079,15 @@ msgid "need two commit ranges"
msgstr "plage entre deux commits requise"
msgid ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>) "
-"[-u | -i]] [--no-sparse-checkout] [--index-output=<file>] (--empty | <tree-"
-"ish1> [<tree-ish2> [<tree-ish3>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
+"prefix=<prefix>)\n"
+" [-u | -i]] [--index-output=<file>] [--no-sparse-checkout]\n"
+" (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"
msgstr ""
"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
-"prefix=<préfixe>) [-u | -i]] [--no-sparse-checkout] [--index-"
-"output=<fichier>] (--empty | <arbre-esque1> [<arbre-esque2> [<arbre-"
-"esque3>]])"
+"prefix=<préfixe>)\n"
+" [-u | -i]] [--index-output=<fichier>] [--no-sparse-checkout]\n"
+" (--empty | <arbre-esque1> [<arbre-esque2> [<arbre-esque3>]])"
msgid "write resulting index to <file>"
msgstr "écrire l'index résultant dans <fichier>"
@@ -10094,8 +10178,8 @@ msgid "%s requires the merge backend"
msgstr "%s requiert un moteur de fusion"
#, c-format
-msgid "could not get 'onto': '%s'"
-msgstr "impossible d'accéder 'onto' : '%s'"
+msgid "invalid onto: '%s'"
+msgstr "destination invalide : '%s'"
#, c-format
msgid "invalid orig-head: '%s'"
@@ -10144,6 +10228,10 @@ msgstr ""
msgid "could not switch to %s"
msgstr "impossible de basculer vers %s"
+msgid "apply options and merge options cannot be used together"
+msgstr ""
+"Les options d'apply et celles de merge ne peuvent pas être utilisées ensemble"
+
#, c-format
msgid ""
"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and "
@@ -10379,9 +10467,19 @@ msgstr "Mode inconnu : %s"
msgid "--strategy requires --merge or --interactive"
msgstr "--strategy requiert --merge ou --interactive"
-msgid "apply options and merge options cannot be used together"
+msgid ""
+"apply options are incompatible with rebase.autosquash. Consider adding --no-"
+"autosquash"
msgstr ""
-"Les options d'apply et celles de merge ne peuvent pas être utilisées ensemble"
+"les options d'application sont incompatibles avec rebase.autosquash. "
+"Considérez l'ajout de --no-autosquash"
+
+msgid ""
+"apply options are incompatible with rebase.updateRefs. Consider adding --no-"
+"update-refs"
+msgstr ""
+"les options d'application sont incompatibles avec rebase.updateRefs. "
+"Considérez l'ajout de --no-update-refs"
#, c-format
msgid "Unknown rebase backend: %s"
@@ -10405,8 +10503,8 @@ msgstr "pas de branche ou commit '%s'"
msgid "No such ref: %s"
msgstr "Référence inexistante : %s"
-msgid "Could not resolve HEAD to a revision"
-msgstr "Impossible de résoudre le commit HEAD vers un révision"
+msgid "Could not resolve HEAD to a commit"
+msgstr "impossible de résoudre HEAD en un commit"
#, c-format
msgid "'%s': need exactly one merge base with branch"
@@ -10981,14 +11079,14 @@ msgstr "URL : %s"
#, c-format
msgid " * [would prune] %s"
-msgstr " * [serait éliminé] %s"
+msgstr " * [élaguerait] %s"
#, c-format
msgid " * [pruned] %s"
-msgstr " * [éliminé] %s"
+msgstr " * [élagué] %s"
msgid "prune remotes after fetching"
-msgstr "éliminer les distants après le rapatriement"
+msgstr "élagué les distants après la récupération"
#, c-format
msgid "No such remote '%s'"
@@ -11082,6 +11180,10 @@ msgstr "impossible d'ouvrir le fichier temporaire %s en écriture"
msgid "could not close refs snapshot tempfile"
msgstr "impossible de fermer le fichier temporaire d'instantané des réfs"
+#, c-format
+msgid "could not remove stale bitmap: %s"
+msgstr "impossible de revenir la bitmap obsolète : %s"
+
msgid "pack everything in a single pack"
msgstr "empaqueter tout dans un seul paquet"
@@ -11156,6 +11258,9 @@ msgstr "trouver une progression géométrique avec un facteur <N>"
msgid "write a multi-pack index of the resulting packs"
msgstr "écrire un index de multi-paquet des paquets résultants"
+msgid "pack prefix to store a pack containing pruned objects"
+msgstr "préfixe de paquet pour stocker un paquet contenant les objets élagués"
+
msgid "cannot delete packs in a precious-objects repo"
msgstr "impossible de supprimer les paquets dans un dépôt d'objets précieux"
@@ -11167,8 +11272,12 @@ msgid "pack prefix %s does not begin with objdir %s"
msgstr "le préfixe %s ne commence pas avec objdir %s"
#, c-format
-msgid "missing required file: %s"
-msgstr "fichier nécessaire manquant : %s"
+msgid "renaming pack to '%s' failed"
+msgstr "le renommage du paquet en '%s' a échoué"
+
+#, c-format
+msgid "pack-objects did not write a '%s' file for pack %s-%s"
+msgstr "pack-objects n'a pas écrit un fichier '%s' pour la paquet %s-%s"
#, c-format
msgid "could not unlink: %s"
@@ -11362,9 +11471,10 @@ msgstr "--convert-graft-file ne supporte aucun argument"
msgid "only one pattern can be given with -l"
msgstr "-l n'accepte qu'un motifs"
-msgid "git rerere [clear | forget <path>... | status | remaining | diff | gc]"
+msgid ""
+"git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
msgstr ""
-"git rerere [clear | forget <chemin>... | status | remaining | diff | gc]"
+"git rerere [clear | forget <chemin>... | diff | status | remaining | gc]"
msgid "register clean resolutions in index"
msgstr "enregistrer des résolutions propres dans l'index"
@@ -11572,6 +11682,15 @@ msgstr "--prefix exige un argument"
msgid "unknown mode for --abbrev-ref: %s"
msgstr "mode inconnu pour --abbrev-ref : %s"
+msgid "--exclude-hidden cannot be used together with --branches"
+msgstr "--exclude-hidden ne peut être utilisé avec --branches"
+
+msgid "--exclude-hidden cannot be used together with --tags"
+msgstr "--exclude-hidden ne peut pas être utilisé avec --tags"
+
+msgid "--exclude-hidden cannot be used together with --remotes"
+msgstr "--exclude-hidden ne peut pas être utilisé avec --remotes"
+
msgid "this operation must be run in a work tree"
msgstr "cette opération doit être effectuée dans un arbre de travail"
@@ -11579,17 +11698,25 @@ msgstr "cette opération doit être effectuée dans un arbre de travail"
msgid "unknown mode for --show-object-format: %s"
msgstr "mode inconnu pour --show-object-format : %s"
-msgid "git revert [<options>] <commit-ish>..."
-msgstr "git revert [<options>] <commit ou apparenté>..."
+msgid ""
+"git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] "
+"<commit>..."
+msgstr ""
+"git revert [--[no-]edit] [-n] [-m <numéro-de-parent>] [-s] [-S[<id-clé>]] "
+"<commit>..."
-msgid "git revert <subcommand>"
-msgstr "git revert <sous-commande>"
+msgid "git revert (--continue | --skip | --abort | --quit)"
+msgstr "git revert (--continue | --skip | --abort | --quit)"
-msgid "git cherry-pick [<options>] <commit-ish>..."
-msgstr "git cherry-pick [<options>] <commit ou apparenté>..."
+msgid ""
+"git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n"
+" [-S[<keyid>]] <commit>..."
+msgstr ""
+"git cherry-pick [--edit] [-n] [-m <numéro-de-parent>] [-s] [-x] [--ff]\n"
+" [-S[<clé-id>]] <commit>..."
-msgid "git cherry-pick <subcommand>"
-msgstr "git cherry-pick <sous-commande>"
+msgid "git cherry-pick (--continue | --skip | --abort | --quit)"
+msgstr "git cherry-pick (--continue | --skip | --abort | --quit)"
#, c-format
msgid "option `%s' expects a number greater than zero"
@@ -11650,8 +11777,14 @@ msgstr "revert a échoué"
msgid "cherry-pick failed"
msgstr "le picorage a échoué"
-msgid "git rm [<options>] [--] <file>..."
-msgstr "git rm [<options>] [--] <fichier>..."
+msgid ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<fichier> [--pathspec-file-nul]]\n"
+" [--] [<spéc-de-chemin>...]"
msgid ""
"the following file has staged content different from both the\n"
@@ -11726,11 +11859,13 @@ msgid ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<host>:]<directory> (--all | <ref>...)"
msgstr ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true | false | if-asked)]\n"
" [<hôte>:]<répertoire> (--all | <réf>...)"
msgid "remote name"
@@ -11755,8 +11890,9 @@ msgid "using multiple --group options with stdin is not supported"
msgstr ""
"l'utilisation de plusieurs options --group avec stdin n'est pas supportée"
-msgid "using --group=trailer with stdin is not supported"
-msgstr "l'utilisation de --group=trailer avec stdin n'est pas supportée"
+#, c-format
+msgid "using %s with stdin is not supported"
+msgstr "l'utilisation de %s avec stdin n'est pas supportée"
#, c-format
msgid "unknown group type: %s"
@@ -11795,12 +11931,14 @@ msgid ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<when>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<rev> | <glob>)...]"
msgstr ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<quand>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<rév> | <glob>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<rév> | <glob>)...]"
msgid "git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]"
msgstr "git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<référence>]"
@@ -11902,11 +12040,13 @@ msgid "Unknown hash algorithm"
msgstr "Algorithme d'empreinte inconnu"
msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<pattern>...]"
msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<motif>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<motif>...]"
msgid "git show-ref --exclude-existing[=<pattern>]"
msgstr "git show-ref --exclude-existing[=<motif>]"
@@ -11940,8 +12080,10 @@ msgstr ""
"afficher les références de l'entrée standard qui ne sont pas dans le dépôt "
"local"
-msgid "git sparse-checkout (init|list|set|add|reapply|disable) <options>"
-msgstr "git sparse-checkout (init|list|set|add|reapply|disable) <options>"
+msgid ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<options>]"
+msgstr ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<options>]"
msgid "this worktree is not sparse"
msgstr "cet arbre de travail n'est pas clairsemé"
@@ -12071,67 +12213,57 @@ msgstr ""
msgid "error while refreshing working directory"
msgstr "erreur lors du rafraîchissement du répertoire de travail"
-msgid "git stash list [<options>]"
-msgstr "git stash list [<options>]"
+msgid "git stash list [<log-options>]"
+msgstr "git stash list [<options-de-log>]"
-msgid "git stash show [<options>] [<stash>]"
-msgstr "git stash show [<options>] [<remise>]"
+msgid ""
+"git stash show [-u | --include-untracked | --only-untracked] [<diff-"
+"options>] [<stash>]"
+msgstr ""
+"git stash show [-u | --include-untracked | --only-untracked] [<options-de-"
+"diff>] [<stash>]"
-msgid "git stash drop [-q|--quiet] [<stash>]"
-msgstr "git stash drop [-q|--quiet] [<remise>]"
+msgid "git stash drop [-q | --quiet] [<stash>]"
+msgstr "git stash drop [-q | --quiet] [<remise>]"
-msgid "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash ( pop | apply ) [--index] [-q|--quiet] [<remise>]"
+msgid "git stash pop [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash pop [--index] [-q | --quiet] [<remise>]"
+
+msgid "git stash apply [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash apply [--index] [-q | --quiet] [<remise>]"
msgid "git stash branch <branchname> [<stash>]"
msgstr "git stash branch <nom-de-branche> [<remise>]"
+msgid "git stash store [(-m | --message) <message>] [-q | --quiet] <commit>"
+msgstr "git stash store [(-m | --message) <message>] [-q | --quiet] <remise>"
+
msgid ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"<message>]\n"
" [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
" [--] [<pathspec>...]]"
msgstr ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"<message>]\n"
" [--pathspec-from-file=<fichier> [--pathspec-file-nul]]\n"
" [--] [<spécificateur-de-chemin>...]]"
msgid ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-
-msgid "git stash pop [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash pop [--index] [-q|--quiet] [<remise>]"
-
-msgid "git stash apply [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash apply [--index] [-q|--quiet] [<remise>]"
-
-msgid "git stash store [-m|--message <message>] [-q|--quiet] <commit>"
-msgstr "git stash store [-m|--message <message>] [-q|--quiet] <remise>"
-
-msgid ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
-" [--] [<pathspec>...]]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<message>]"
msgstr ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
-" [--] [<spécificateur-de-chemin>...]]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<message>]"
-msgid ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
+msgid "git stash create [<message>]"
+msgstr "git stash create [<message>]"
#, c-format
msgid "'%s' is not a stash-like commit"
@@ -12712,9 +12844,6 @@ msgstr "traverser les sous-modules récursivement"
msgid "don't fetch new objects from the remote site"
msgstr "ne pas récupérer les nouveaux objets depuis le site distant"
-msgid "path into the working tree"
-msgstr "chemin dans la copie de travail"
-
msgid "use the 'checkout' update strategy (default)"
msgstr "utiliser la stratégie de mise à jour 'checkout' (valeur par défaut)"
@@ -12750,28 +12879,9 @@ msgstr ""
"[no-]recommend-shallow] [--reference <dépôt>] [--recursive] [--[no-]single-"
"branch] [--] [<chemin>...]"
-msgid "recurse into submodules"
-msgstr "parcourir récursivement les sous-modules"
-
msgid "git submodule absorbgitdirs [<options>] [<path>...]"
msgstr "git submodule absorbgitdirs [<options>] [<chemin>...]"
-msgid "check if it is safe to write to the .gitmodules file"
-msgstr "vérifier si écrire dans le fichier .gitmodules est sur"
-
-msgid "unset the config in the .gitmodules file"
-msgstr "désactiver la configuration dans le fichier .gitmodules"
-
-msgid "git submodule--helper config <name> [<value>]"
-msgstr "git submodule--helper config name [<valeur>]"
-
-msgid "git submodule--helper config --unset <name>"
-msgstr "git submodule--helper config --unset <nom>"
-
-msgid "please make sure that the .gitmodules file is in the working tree"
-msgstr ""
-"veuillez vous assurer que le fichier .gitmodules est dans l'arbre de travail"
-
msgid "suppress output for setting url of a submodule"
msgstr "supprimer la sortie lors du paramétrage de l'url d'un sous-module"
@@ -12851,6 +12961,10 @@ msgstr "Réactivation du répertoire git local pour le sous-module '%s'\n"
msgid "unable to checkout submodule '%s'"
msgstr "Impossible d'extraire le sous-module '%s'"
+msgid "please make sure that the .gitmodules file is in the working tree"
+msgstr ""
+"veuillez vous assurer que le fichier .gitmodules est dans l'arbre de travail"
+
#, c-format
msgid "Failed to add submodule '%s'"
msgstr "Échec d'ajout du sous-module '%s'"
@@ -12903,19 +13017,17 @@ msgstr "l'URL de dépôt : '%s' doit être absolu ou commencer par ./|../"
msgid "'%s' is not a valid submodule name"
msgstr "'%s' n'est pas un nom valide de sous-module"
-#, c-format
-msgid "%s doesn't support --super-prefix"
-msgstr "%s ne gère pas --super-prefix"
+msgid "git submodule--helper <command>"
+msgstr "git submodule--helper <commande>"
-#, c-format
-msgid "'%s' is not a valid submodule--helper subcommand"
-msgstr "'%s' n'est pas une sous-commande valide de submodule--helper"
+msgid "git symbolic-ref [-m <reason>] <name> <ref>"
+msgstr "git symbolic-ref [-m <raison>] <nom> <réf>"
-msgid "git symbolic-ref [<options>] <name> [<ref>]"
-msgstr "git symbolic-ref [<options>] <nom> [<référence>]"
+msgid "git symbolic-ref [-q] [--short] [--no-recurse] <name>"
+msgstr "git symbolic-ref [-q] [--short] [--no-recurse] <nom>"
-msgid "git symbolic-ref -d [-q] <name>"
-msgstr "git symbolic-ref -d [-q] <nom>"
+msgid "git symbolic-ref --delete [-q] <name>"
+msgstr "git symbolic-ref --delete [-q] <nom>"
msgid "suppress error message for non-symbolic (detached) refs"
msgstr ""
@@ -12927,6 +13039,9 @@ msgstr "supprimer la référence symbolique"
msgid "shorten ref output"
msgstr "raccourcir l'affichage de la référence"
+msgid "recursively dereference (default)"
+msgstr "déréférencer récursivement (défaut)"
+
msgid "reason"
msgstr "raison"
@@ -12934,25 +13049,25 @@ msgid "reason of the update"
msgstr "raison de la mise à jour"
msgid ""
-"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]\n"
-" <tagname> [<head>]"
+"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n"
+" <tagname> [<commit> | <object>]"
msgstr ""
-"git tag [-a | -s | -u <id-clé>] [-f] [-m <msg> | -F <fichier>]\n"
-" <nom-d-étiquette> [<tête>]"
+"git tag [-a | -s | -u <id-clé>] [-f] [-m <msg> | -F <fichier>] [-e]\n"
+" <nom-d-étiquette> [<commit> | <objet>]"
msgid "git tag -d <tagname>..."
msgstr "git tag -d <nom-d-étiquette>..."
msgid ""
-"git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--"
-"points-at <object>]\n"
-" [--format=<format>] [--merged <commit>] [--no-merged <commit>] "
-"[<pattern>...]"
+"git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]\n"
+" [--points-at <object>] [--column[=<options>] | --no-column]\n"
+" [--create-reflog] [--sort=<key>] [--format=<format>]\n"
+" [--merged <commit>] [--no-merged <commit>] [<pattern>...]"
msgstr ""
-"git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--"
-"points-at <objet>]\n"
-" [--format=<format>] [--merged <commit>] [--no-merged <commit>] "
-"[<motif>...]"
+"git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]\n"
+" [--points-at <objet>] [--column[=<options>] | --no-column]\n"
+" [--create-reflog] [--sort=<clé>] [--format=<format>]\n"
+" [--merged <commit>] [--no-merged <commit>] [<motif>...]"
msgid "git tag -v [--format=<format>] <tagname>..."
msgstr "git tag -v [--format=<format>] <nom-d-étiquette>..."
@@ -13345,8 +13460,12 @@ msgstr "lire les mises à jour depuis l'entrée standard"
msgid "update the info files from scratch"
msgstr "mettre à jour les fichiers d'information à partir de zéro"
-msgid "git upload-pack [<options>] <dir>"
-msgstr "git upload-pack [<options>] <répertoire>"
+msgid ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <directory>"
+msgstr ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <répertoire>"
msgid "quit after a single request/response exchange"
msgstr "quitter après un unique échange requête/réponse"
@@ -13361,8 +13480,8 @@ msgstr ""
msgid "interrupt transfer after <n> seconds of inactivity"
msgstr "interrompre le transfert après <n> secondes d'inactivité"
-msgid "git verify-commit [-v | --verbose] <commit>..."
-msgstr "git verify-commit [-v | --verbose] <commit>..."
+msgid "git verify-commit [-v | --verbose] [--raw] <commit>..."
+msgstr "git verify-commit [-v | --verbose] [--raw] <commit>..."
msgid "print commit contents"
msgstr "afficher le contenu du commit"
@@ -13370,8 +13489,9 @@ msgstr "afficher le contenu du commit"
msgid "print raw gpg status output"
msgstr "afficher les messages bruts de gpg"
-msgid "git verify-pack [-v | --verbose] [-s | --stat-only] <pack>..."
-msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] <pack>..."
+msgid "git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pack>.idx..."
+msgstr ""
+"git verify-pack [-v | --verbose] [-s | --stat-only] [--] <paquet>.idx..."
msgid "verbose"
msgstr "verbeux"
@@ -13379,42 +13499,47 @@ msgstr "verbeux"
msgid "show statistics only"
msgstr "afficher seulement les statistiques"
-msgid "git verify-tag [-v | --verbose] [--format=<format>] <tag>..."
-msgstr "git verify-tag [-v | --verbose] [--format=<format>] <étiquette>..."
+msgid "git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."
+msgstr ""
+"git verify-tag [-v | --verbose] [--format=<format>] [--raw] <étiquette>..."
msgid "print tag contents"
msgstr "afficher le contenu de l'étiquette"
-msgid "git worktree add [<options>] <path> [<commit-ish>]"
-msgstr "git worktree add [<options>] <chemin> [<commit>]"
+msgid ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]\n"
+" [-b <new-branch>] <path> [<commit-ish>]"
+msgstr ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <chaîne>]]\n"
+" [-b <nouvelle-branche>] <chemin> [<commit-esque>]"
-msgid "git worktree list [<options>]"
-msgstr "git worktree list [<options>]"
+msgid "git worktree list [-v | --porcelain [-z]]"
+msgstr "git worktree list [-v | --porcelain [-z]]"
-msgid "git worktree lock [<options>] <path>"
-msgstr "git worktree lock [<options>] <chemin>"
+msgid "git worktree lock [--reason <string>] <worktree>"
+msgstr "git worktree lock [--reason <chaîne>] <arbre-de-travail>"
msgid "git worktree move <worktree> <new-path>"
msgstr "git worktree move <arbre-de-travail> <nouveau-chemin>"
-msgid "git worktree prune [<options>]"
-msgstr "git worktree prune [<options>]"
+msgid "git worktree prune [-n] [-v] [--expire <expire>]"
+msgstr "git worktree prune [-n] [-v] [--expire <date>]"
-msgid "git worktree remove [<options>] <worktree>"
-msgstr "git worktree remove [<options>] <arbre-de-travail>"
+msgid "git worktree remove [-f] <worktree>"
+msgstr "git worktree remove [-f] <arbre-de-travail>"
msgid "git worktree repair [<path>...]"
msgstr "git worktree repair [<chemin>...]"
-msgid "git worktree unlock <path>"
-msgstr "git worktree unlock <chemin>"
+msgid "git worktree unlock <worktree>"
+msgstr "git worktree unlock <arbre-de-travail>"
#, c-format
msgid "Removing %s/%s: %s"
msgstr "Suppression de %s/%s : %s"
msgid "report pruned working trees"
-msgstr "afficher les arbres de travail éliminés"
+msgstr "afficher les arbres de travail élagués"
msgid "expire working trees older than <time>"
msgstr "faire expirer les arbres de travail plus vieux que <temps>"
@@ -13654,6 +13779,14 @@ msgstr "seulement utile pour le débogage"
msgid "core.fsyncMethod = batch is unsupported on this platform"
msgstr "core.fsyncMethod = batch non géré sur cette plateforme"
+#, c-format
+msgid "could not parse bundle list key %s with value '%s'"
+msgstr "impossible d'analyser la clé de liste de colis %s avec la valeur '%s'"
+
+#, c-format
+msgid "bundle list at '%s' has no mode"
+msgstr "la liste de colis n'a pas de mode à '%s'"
+
msgid "failed to create temporary file"
msgstr "impossible de créer un fichier temporaire"
@@ -13661,16 +13794,43 @@ msgid "insufficient capabilities"
msgstr "capacités insuffisantes"
#, c-format
+msgid "file downloaded from '%s' is not a bundle"
+msgstr "le fichier téléchargé depuis '%s' n'est pas un colis"
+
+msgid "failed to store maximum creation token"
+msgstr "échec de stockage du jeton de création maximum"
+
+#, c-format
+msgid "unrecognized bundle mode from URI '%s'"
+msgstr "mode de colisage non reconnu depuis l'URI '%s'"
+
+#, c-format
+msgid "exceeded bundle URI recursion limit (%d)"
+msgstr "limite de récursion d'URI de colis dépassée (%d)"
+
+#, c-format
msgid "failed to download bundle from URI '%s'"
msgstr "impossible de télécharger le colis depuis l'URI '%s'"
#, c-format
-msgid "file at URI '%s' is not a bundle"
-msgstr "le fichier à l'URI '%s' n'est pas un colis"
+msgid "file at URI '%s' is not a bundle or bundle list"
+msgstr "le fichier à l'URI '%s' n'est pas un colis ou une liste de colis"
#, c-format
-msgid "failed to unbundle bundle from URI '%s'"
-msgstr "échec pour ouvrir le colis de l'URI '%s'"
+msgid "bundle-uri: unexpected argument: '%s'"
+msgstr "bundle-uri :argument inattendu : '%s'"
+
+msgid "bundle-uri: expected flush after arguments"
+msgstr "bundle-uri : vidage attendu après les arguments"
+
+msgid "bundle-uri: got an empty line"
+msgstr "bundle-uri : ligne vide rencontrée"
+
+msgid "bundle-uri: line is not of the form 'key=value'"
+msgstr "bundle-uri : la ligne n'est pas de la forme 'clé=valeur'"
+
+msgid "bundle-uri: line has empty key or value"
+msgstr "bundle-uri : la ligne a une clé ou une valeur vide"
#, c-format
msgid "unrecognized bundle hash algorithm: %s"
@@ -13694,6 +13854,13 @@ msgstr "Le dépôt ne dispose pas des commits prérequis suivants :"
msgid "need a repository to verify a bundle"
msgstr "la vérification d'un colis requiert un dépôt"
+msgid ""
+"some prerequisite commits exist in the object store, but are not connected "
+"to the repository's history"
+msgstr ""
+"des commits prérequis existent dans le stock d'objets, mais ne sont pas "
+"connectés à l'historique du dépôt"
+
#, c-format
msgid "The bundle contains this ref:"
msgid_plural "The bundle contains these %<PRIuMAX> refs:"
@@ -14062,8 +14229,7 @@ msgid "Compute unique ID for a patch"
msgstr "Calculer l'ID unique d'un patch"
msgid "Prune all unreachable objects from the object database"
-msgstr ""
-"Éliminer les objets inatteignables depuis la base de données des objets"
+msgstr "Élaguer les objets inatteignables depuis la base de données des objets"
msgid "Remove extra objects that are already in pack files"
msgstr "Éliminer les objets qui sont déjà présents dans les fichiers pack"
@@ -14265,8 +14431,8 @@ msgstr "le format du fichier de colis"
msgid "Chunk-based file formats"
msgstr "format de fichier avec des sections"
-msgid "Git commit graph format"
-msgstr "format de graphe de commit de Gti"
+msgid "Git commit-graph format"
+msgstr "format de graphe de commit de Git"
msgid "Git index format"
msgstr "format d'index Git"
@@ -14634,6 +14800,10 @@ msgstr "cas non géré dans 'has_worktree_moved': %d"
msgid "health thread wait failed [GLE %ld]"
msgstr "l'attente du fil de santé a échoué [GLE %ld]"
+#, c-format
+msgid "Invalid path: %s"
+msgstr "chemin invalide : '%s'"
+
msgid "Unable to create FSEventStream."
msgstr "impossible de créer FSEVEntStream."
@@ -14665,6 +14835,22 @@ msgid "could not read directory changes [GLE %ld]"
msgstr "impossible de lire les modifications du répertoire [GLE %ld]"
#, c-format
+msgid "opendir('%s') failed"
+msgstr "échec de opendir(%s)"
+
+#, c-format
+msgid "lstat('%s') failed"
+msgstr "échec de lstat('%s')"
+
+#, c-format
+msgid "strbuf_readlink('%s') failed"
+msgstr "échec de strbuf_readlink('%s')"
+
+#, c-format
+msgid "closedir('%s') failed"
+msgstr "échec de closedir('%s')"
+
+#, c-format
msgid "[GLE %ld] unable to open for read '%ls'"
msgstr "[GLE %ld] impossible d'ouvrir pour lire '%ls'"
@@ -15130,15 +15316,22 @@ msgid "unknown object format '%s' specified by server"
msgstr "format d'objet spécifié par le serveur inconnu '%s'"
#, c-format
+msgid "error on bundle-uri response line %d: %s"
+msgstr "erreur sur la ligne %d de réponse bundle-uri : %s"
+
+msgid "expected flush after bundle-uri listing"
+msgstr "vidage attendu après le listage des bundle-uri"
+
+msgid "expected response end packet after ref listing"
+msgstr "paquet de fin de réponse attendu après le listage de références"
+
+#, c-format
msgid "invalid ls-refs response: %s"
msgstr "réponse à ls-ref invalide : %s"
msgid "expected flush after ref listing"
msgstr "vidage attendu après le listage de références"
-msgid "expected response end packet after ref listing"
-msgstr "paquet de fin de réponse attendu après le listage de références"
-
#, c-format
msgid "protocol '%s' is not supported"
msgstr "le protocole '%s' n'est pas supporté"
@@ -16302,11 +16495,11 @@ msgstr "fsmonitor--daemon n'est pas en cours d'exécution"
#, c-format
msgid "could not send '%s' command to fsmonitor--daemon"
-msgstr "impossible de lancer la commmand '%s' à fsmonitor--daemon"
+msgstr "impossible de lancer la commande '%s' à fsmonitor--daemon"
#, c-format
msgid "bare repository '%s' is incompatible with fsmonitor"
-msgstr "le dépôit nu '%s' est incompatible avec fsmonitor"
+msgstr "le dépôt nu '%s' est incompatible avec fsmonitor"
#, c-format
msgid "repository '%s' is incompatible with fsmonitor due to errors"
@@ -16322,9 +16515,11 @@ msgstr "le dépôt virtuel '%s' est incompatible avec fsmonitor"
#, c-format
msgid ""
-"repository '%s' is incompatible with fsmonitor due to lack of Unix sockets"
+"socket directory '%s' is incompatible with fsmonitor due to lack of Unix "
+"sockets support"
msgstr ""
-"le dépôt '%s' est incompatible avec fsmonitor par manque de sockets Unix"
+"le répertoire de socket '%s' est incompatible avec fsmonitor par manque de "
+"sockets Unix"
msgid ""
"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n"
@@ -16332,18 +16527,16 @@ msgid ""
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
-" [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n"
-" <command> [<args>]"
+" [--config-env=<name>=<envvar>] <command> [<args>]"
msgstr ""
-"git [--version] [-h | --help] [-C <chemin>] [-c <nom>=<valeur>]\n"
+"git [-v | --version] [-h | --help] [-C <chemin>] [-c <nom>=<valeur>]\n"
" [--exec-path[=<chemin>]] [--html-path] [--man-path] [--info-"
"path]\n"
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<chemin>] [--work-tree=<chemin>] [--namespace=<nom>]\n"
-" [--super-prefix=<chemin>] [--config-env=<nom>=<variable-d-"
-"environnement>]\n"
-" <commande> [<args>]"
+" [--config-env=<nom>=<variable-d-environnement>] <commande> "
+"[<args>]"
msgid ""
"'git help -a' and 'git help -g' list available subcommands and some\n"
@@ -16369,10 +16562,6 @@ msgid "no namespace given for --namespace\n"
msgstr "aucun espace de nom fournit pour --namespace\n"
#, c-format
-msgid "no prefix given for --super-prefix\n"
-msgstr "aucun préfixe fourni pour --super-prefix\n"
-
-#, c-format
msgid "-c expects a configuration string\n"
msgstr "-c requiert une chaîne de configuration\n"
@@ -16484,8 +16673,13 @@ msgstr ""
msgid "gpg.ssh.defaultKeyCommand failed: %s %s"
msgstr "gpg.ssh.defaultKeyCommand a échoué : %s %s"
-msgid "gpg failed to sign the data"
-msgstr "gpg n'a pas pu signer les données"
+#, c-format
+msgid ""
+"gpg failed to sign the data:\n"
+"%s"
+msgstr ""
+"gpg n'a pas pu signer les données :\n"
+"%s"
msgid "user.signingKey needs to be set for ssh signing"
msgstr "user.signingKey doit être configuré pour signer avec ssh"
@@ -16650,8 +16844,8 @@ msgstr[1] ""
"\n"
"Les commandes les plus ressemblantes sont"
-msgid "git version [<options>]"
-msgstr "git version [<options>]"
+msgid "git version [--build-options]"
+msgstr "git version [--build-options]"
#, c-format
msgid "%s: %s - %s"
@@ -17584,10 +17778,6 @@ msgstr "impossible de normaliser le chemin d'objet alternatif : %s"
msgid "%s: ignoring alternate object stores, nesting too deep"
msgstr "%s : magasins d'objets alternatifs ignorés, récursion trop profonde"
-#, c-format
-msgid "unable to normalize object directory: %s"
-msgstr "impossible de normaliser le répertoire d'objet : %s"
-
msgid "unable to fdopen alternates lockfile"
msgstr "impossible d'ouvrir (fdopen) le fichier verrou des alternatives"
@@ -17648,6 +17838,10 @@ msgid "garbage at end of loose object '%s'"
msgstr "données incorrectes à la fin de l'objet libre '%s'"
#, c-format
+msgid "unable to open loose object %s"
+msgstr "impossible d'ouvrir l'objet libre %s"
+
+#, c-format
msgid "unable to parse %s header"
msgstr "impossible d'analyser l'entête %s"
@@ -17663,18 +17857,14 @@ msgid "header for %s too long, exceeds %d bytes"
msgstr "entête de %s trop long, attendu %d octets"
#, c-format
-msgid "failed to read object %s"
-msgstr "impossible de lire l'objet %s"
+msgid "loose object %s (stored in %s) is corrupt"
+msgstr "l'objet libre %s (stocké dans %s) est corrompu"
#, c-format
msgid "replacement %s not found for %s"
msgstr "remplacement %s non trouvé pour %s"
#, c-format
-msgid "loose object %s (stored in %s) is corrupt"
-msgstr "l'objet libre %s (stocké dans %s) est corrompu"
-
-#, c-format
msgid "packed object %s (stored in %s) is corrupt"
msgstr "l'objet empaqueté %s (stocké dans %s) est corrompu"
@@ -17686,9 +17876,6 @@ msgstr "impossible d'écrire le fichier %s"
msgid "unable to set permission to '%s'"
msgstr "impossible de régler les droits de '%s'"
-msgid "file write error"
-msgstr "erreur d'écriture d'un fichier"
-
msgid "error when closing loose object file"
msgstr "erreur en fermeture du fichier d'objet esseulé"
@@ -17735,11 +17922,12 @@ msgstr "échec de la création du répertoire %s"
msgid "cannot read object for %s"
msgstr "impossible de lire l'objet pour %s"
-msgid "corrupt commit"
-msgstr "commit corrompu"
+#, c-format
+msgid "object fails fsck: %s"
+msgstr "l'objet est en échec de fsck : %s"
-msgid "corrupt tag"
-msgstr "étiquette corrompue"
+msgid "refusing to create malformed object"
+msgstr "Refus de créer un objet malformé"
#, c-format
msgid "read error while indexing %s"
@@ -18008,10 +18196,6 @@ msgstr "décalage XOR invalide dans l'index de paquet en bitmap"
msgid "cannot fstat bitmap file"
msgstr "impossible d'obtenir le statut (fstat) du fichier de bitmap"
-#, c-format
-msgid "ignoring extra bitmap file: '%s'"
-msgstr "fichier bitmap extra ignoré : '%s'"
-
msgid "checksum doesn't match in MIDX and bitmap"
msgstr "la somme de contrôle ne correspond pas entre MIDX et bitmap"
@@ -18277,6 +18461,9 @@ msgstr "être plus silencieux"
msgid "use <n> digits to display object names"
msgstr "utiliser <n> chiffres pour afficher les noms des objets"
+msgid "prefixed path to initial superproject"
+msgstr "chemin préfixé vers le superprojet initial"
+
msgid "how to strip spaces and #comments from message"
msgstr "comment éliminer les espaces et les commentaires # du message"
@@ -18433,6 +18620,10 @@ msgstr ""
msgid "promisor remote name cannot begin with '/': %s"
msgstr "un nom de prometteur distant ne peut pas commencer par '/' : %s"
+#, c-format
+msgid "could not fetch %s from promisor remote"
+msgstr "impossible de récupérer %s depuis le distant de prometteur"
+
msgid "object-info: expected flush after arguments"
msgstr "object-info : vidage attendu après les arguments"
@@ -18787,6 +18978,14 @@ msgid "ahead %d, behind %d"
msgstr "en avance de %d, en retard de %d"
#, c-format
+msgid "%%(%.*s) does not take arguments"
+msgstr "%%(%.*s) n'accepte pas d'argument"
+
+#, c-format
+msgid "unrecognized %%(%.*s) argument: %s"
+msgstr "argument %%(%.*s) non reconnu : %s"
+
+#, c-format
msgid "expected format: %%(color:<color>)"
msgstr "format attendu : %%(color:<couleur>)"
@@ -18803,22 +19002,6 @@ msgid "Integer value expected refname:rstrip=%s"
msgstr "Valeur entière attendue refname:rstrip=%s"
#, c-format
-msgid "unrecognized %%(%s) argument: %s"
-msgstr "argument %%(%s) non reconnu : %s"
-
-#, c-format
-msgid "%%(objecttype) does not take arguments"
-msgstr "%%(objecttype) n'accepte pas d'argument"
-
-#, c-format
-msgid "%%(deltabase) does not take arguments"
-msgstr "%%(deltabase) n'accepte pas d'argument"
-
-#, c-format
-msgid "%%(body) does not take arguments"
-msgstr "%%(body) n'accepte pas d'argument"
-
-#, c-format
msgid "expected %%(trailers:key=<value>)"
msgstr "%%(trailers:key=<value>) attendu"
@@ -18835,10 +19018,6 @@ msgid "positive value expected '%s' in %%(%s)"
msgstr "valeur positive attendue '%s' dans %%(%s)"
#, c-format
-msgid "unrecognized email option: %s"
-msgstr "option de courriel non reconnue : %s"
-
-#, c-format
msgid "expected format: %%(align:<width>,<position>)"
msgstr "format attendu : %%(align:<largeur>,<position>)"
@@ -18851,12 +19030,12 @@ msgid "unrecognized width:%s"
msgstr "largeur non reconnue : %s"
#, c-format
-msgid "positive width expected with the %%(align) atom"
-msgstr "valeur positive attendue avec l'atome %%(align)"
+msgid "unrecognized %%(%s) argument: %s"
+msgstr "argument %%(%s) non reconnu : %s"
#, c-format
-msgid "%%(rest) does not take arguments"
-msgstr "%%(rest) n'accepte pas d'argument"
+msgid "positive width expected with the %%(align) atom"
+msgstr "valeur positive attendue avec l'atome %%(align)"
#, c-format
msgid "malformed field name: %.*s"
@@ -19519,6 +19698,13 @@ msgid "failed to find tree of %s"
msgstr "impossible de trouver l'arbre de %s"
#, c-format
+msgid "unsupported section for hidden refs: %s"
+msgstr "section non géree pour les réfs cachées : %s"
+
+msgid "--exclude-hidden= passed more than once"
+msgstr "--exclude-hidden= présent plus d'une fois"
+
+#, c-format
msgid "resolve-undo records `%s` which is missing"
msgstr "resolve-undo enregistre `%s` qui manque"
@@ -19664,6 +19850,14 @@ msgid "--all or <enlistment>, but not both"
msgstr "--all ou <enrôlement>, mais pas les deux"
#, c-format
+msgid "could not remove stale scalar.repo '%s'"
+msgstr "impossible de supprimé le scalar.repo obsolète '%s'"
+
+#, c-format
+msgid "removing stale scalar.repo '%s'"
+msgstr "suppression du scalar.repo obsolète '%s'"
+
+#, c-format
msgid "git repository gone in '%s'"
msgstr "dépôt git parti dans '%s'"
@@ -20101,6 +20295,24 @@ msgid "git %s: failed to refresh the index"
msgstr "git %s : échec du rafraîchissement de l'index"
#, c-format
+msgid "'%s' is not a valid label"
+msgstr "'%s' n'est pas un label valide"
+
+#, c-format
+msgid "'%s' is not a valid refname"
+msgstr "'%s' n'est pas un nom valide de référence"
+
+#, c-format
+msgid "update-ref requires a fully qualified refname e.g. refs/heads/%s"
+msgstr ""
+"update-ref requiert un nom de référence totalement qualifié par ex. refs/"
+"heads/%s"
+
+#, c-format
+msgid "invalid command '%.*s'"
+msgstr "commande '%.*s' invalide"
+
+#, c-format
msgid "%s does not accept arguments: '%s'"
msgstr "%s n'accepte pas d'argument : '%s'"
@@ -20291,16 +20503,16 @@ msgstr ""
msgid "illegal label name: '%.*s'"
msgstr "nom de label illégal '%.*s'"
+#, c-format
+msgid "could not resolve '%s'"
+msgstr "impossible de résoudre '%s'"
+
msgid "writing fake root commit"
msgstr "écriture d'un commit racine bidon"
msgid "writing squash-onto"
msgstr "écriture de 'écraser-sur'"
-#, c-format
-msgid "could not resolve '%s'"
-msgstr "impossible de résoudre '%s'"
-
msgid "cannot merge without a current revision"
msgstr "impossible de fusionner avec une révision courante"
@@ -20911,6 +21123,25 @@ msgstr "ls-tree a renvoyé un code de retour inattendu %d"
msgid "failed to lstat '%s'"
msgstr "échec du lstat de '%s'"
+msgid "no remote configured to get bundle URIs from"
+msgstr "aucun distant configuré depuis lequel récupérer des URIs de colis"
+
+#, c-format
+msgid "remote '%s' has no configured URL"
+msgstr "le distant '%s' n'a pas d'URL configuré"
+
+msgid "could not get the bundle-uri list"
+msgstr "impossible d'avoir la liste de bundle-uris"
+
+msgid "test-tool cache-tree <options> (control|prime|update)"
+msgstr "test-tool cache-tree <options> (control|prime|update)"
+
+msgid "clear the cache tree before each iteration"
+msgstr "effacer l'arbre de cache avant chaque itération"
+
+msgid "number of entries in the cache tree to invalidate (default 0)"
+msgstr "nombre d'entrées dans l'arbre de cache à invalider (par défaut, 0)"
+
msgid "unhandled options"
msgstr "options non gérées"
@@ -21261,6 +21492,13 @@ msgstr "Abandon."
msgid "failed to push all needed submodules"
msgstr "échec de la poussée de tous les sous-modules nécessaires"
+msgid "bundle-uri operation not supported by protocol"
+msgstr "opération bundle-uri non supportée par le protocole"
+
+msgid "could not retrieve server-advertised bundle-uri list"
+msgstr ""
+"impossible de récupérer la liste de bundle-uris annoncée par le serveur"
+
msgid "too-short tree object"
msgstr "objet arbre trop court"
@@ -22014,14 +22252,19 @@ msgstr "Fichiers ignorés"
#, c-format
msgid ""
-"It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
-"may speed it up, but you have to be careful not to forget to add\n"
-"new files yourself (see 'git help status')."
+"It took %.2f seconds to enumerate untracked files,\n"
+"but the results were cached, and subsequent runs may be faster."
msgstr ""
-"L'énumération des fichiers non suivis a duré %.2f secondes. 'status -uno'\n"
-"peut l'accélérer, mais vous devez alors faire attention à ne pas\n"
-"oublier d'ajouter les nouveaux fichiers par vous-même (voir 'git help "
-"status')."
+"L'énumération des fichiers non-suivis a pris %.2f secondes,\n"
+"mais les resultats ont été mis en cache, et les lancements suivants seront "
+"plus rapides."
+
+#, c-format
+msgid "It took %.2f seconds to enumerate untracked files."
+msgstr "L'énumération des fichiers non-suivis a pris %.2f secondes."
+
+msgid "See 'git help status' for information on how to improve this."
+msgstr "Voir 'git help status' pour tout information pour améliorer ceci."
#, c-format
msgid "Untracked files not listed%s"
@@ -22172,275 +22415,6 @@ msgstr ""
msgid "Unable to determine absolute path of git directory"
msgstr "Impossible de déterminer le chemin absolu du répertoire git"
-#. TRANSLATORS: you can adjust this to align "git add -i" status menu
-#, perl-format
-msgid "%12s %12s %s"
-msgstr "%12s %s12s %s"
-
-#, perl-format
-msgid "touched %d path\n"
-msgid_plural "touched %d paths\n"
-msgstr[0] "%d chemin touché\n"
-msgstr[1] "%d chemins touchés\n"
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for staging."
-msgstr ""
-"Si le patch s'applique proprement, la section éditée sera\n"
-"immédiatement marquée comme indexée."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for stashing."
-msgstr ""
-"Si le patch s'applique proprement, la section éditée sera\n"
-"immédiatement marquée comme remisée."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for unstaging."
-msgstr ""
-"Si le patch s'applique proprement, la section éditée sera\n"
-"immédiatement marquée comme desindexée."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for applying."
-msgstr ""
-"Si le patch s'applique proprement, la section éditée sera\n"
-"immédiatement marquée comme appliquée."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for discarding."
-msgstr ""
-"Si le patch s'applique proprement, la section éditée sera\n"
-"immédiatement marquée comme éliminée."
-
-#, perl-format
-msgid "failed to open hunk edit file for writing: %s"
-msgstr "impossible d'ouvrir le fichier d'édition de section en écriture : %s"
-
-#, perl-format
-msgid ""
-"---\n"
-"To remove '%s' lines, make them ' ' lines (context).\n"
-"To remove '%s' lines, delete them.\n"
-"Lines starting with %s will be removed.\n"
-msgstr ""
-"---\n"
-"Pour éliminer les lignes '%s', rendez-les ' ' (contexte).\n"
-"Pour éliminer les lignes '%s', effacez-les.\n"
-"Les lignes commençant par %s seront éliminées.\n"
-
-#, perl-format
-msgid "failed to open hunk edit file for reading: %s"
-msgstr "échec de l'ouverture du fichier d'édition de section en lecture : %s"
-
-msgid ""
-"y - stage this hunk\n"
-"n - do not stage this hunk\n"
-"q - quit; do not stage this hunk or any of the remaining ones\n"
-"a - stage this hunk and all later hunks in the file\n"
-"d - do not stage this hunk or any of the later hunks in the file"
-msgstr ""
-"y - indexer cette section\n"
-"n - ne pas indexer cette section\n"
-"q - quitter ; ne pas indexer cette section ni les autres restantes\n"
-"a - indexer cette section et toutes les suivantes de ce fichier\n"
-"d - ne pas indexer cette section ni les suivantes de ce fichier"
-
-msgid ""
-"y - stash this hunk\n"
-"n - do not stash this hunk\n"
-"q - quit; do not stash this hunk or any of the remaining ones\n"
-"a - stash this hunk and all later hunks in the file\n"
-"d - do not stash this hunk or any of the later hunks in the file"
-msgstr ""
-"y - remiser cette section\n"
-"n - ne pas remiser cette section\n"
-"q - quitter ; ne pas remiser cette section ni les autres restantes\n"
-"a - remiser cette section et toutes les suivantes de ce fichier\n"
-"d - ne pas remiser cette section ni les suivantes de ce fichier"
-
-msgid ""
-"y - unstage this hunk\n"
-"n - do not unstage this hunk\n"
-"q - quit; do not unstage this hunk or any of the remaining ones\n"
-"a - unstage this hunk and all later hunks in the file\n"
-"d - do not unstage this hunk or any of the later hunks in the file"
-msgstr ""
-"y - désindexer cette section\n"
-"n - ne pas désindexer cette section\n"
-"q - quitter ; ne pas désindexer cette section ni les autres restantes\n"
-"a - désindexer cette section et toutes les suivantes de ce fichier\n"
-"d - ne pas désindexer cette section ni les suivantes de ce fichier"
-
-msgid ""
-"y - apply this hunk to index\n"
-"n - do not apply this hunk to index\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - appliquer cette section\n"
-"n - ne pas appliquer cette section\n"
-"q - quitter ; ne pas appliquer cette section ni les autres restantes\n"
-"a - appliquer cette section et toutes les suivantes de ce fichier\n"
-"d - ne pas appliquer cette section ni les suivantes de ce fichier"
-
-msgid ""
-"y - discard this hunk from worktree\n"
-"n - do not discard this hunk from worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-"y - supprimer cette section\n"
-"n - ne pas supprimer cette section\n"
-"q - quitter ; ne pas supprimer cette section ni les autres restantes\n"
-"a - supprimer cette section et toutes les suivantes de ce fichier\n"
-"d - ne pas supprimer cette section ni les suivantes de ce fichier"
-
-msgid ""
-"y - discard this hunk from index and worktree\n"
-"n - do not discard this hunk from index and worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-"y - éliminer cette section de l'index et de l'arbre de travail\n"
-"n - ne pas éliminer cette section\n"
-"q - quitter ; ne pas éliminer cette section ni les autres restantes\n"
-"a - éliminer cette section et toutes les suivantes de ce fichier\n"
-"d - ne pas éliminer cette section ni les suivantes de ce fichier"
-
-msgid ""
-"y - apply this hunk to index and worktree\n"
-"n - do not apply this hunk to index and worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - appliquer cette section à l'index et à l'arbre de travail\n"
-"n - ne pas appliquer cette section\n"
-"q - quitter ; ne pas appliquer cette section ni les autres restantes\n"
-"a - appliquer cette section et toutes les suivantes de ce fichier\n"
-"d - ne pas appliquer cette section ni les suivantes de ce fichier"
-
-msgid ""
-"y - apply this hunk to worktree\n"
-"n - do not apply this hunk to worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - appliquer cette section à l'arbre de travail\n"
-"n - ne pas appliquer cette section\n"
-"q - quitter ; ne pas appliquer cette section ni les autres restantes\n"
-"a - appliquer cette section et toutes les suivantes de ce fichier\n"
-"d - ne pas appliquer cette section ni les suivantes de ce fichier"
-
-msgid ""
-"g - select a hunk to go to\n"
-"/ - search for a hunk matching the given regex\n"
-"j - leave this hunk undecided, see next undecided hunk\n"
-"J - leave this hunk undecided, see next hunk\n"
-"k - leave this hunk undecided, see previous undecided hunk\n"
-"K - leave this hunk undecided, see previous hunk\n"
-"s - split the current hunk into smaller hunks\n"
-"e - manually edit the current hunk\n"
-"? - print help\n"
-msgstr ""
-"g - selectionner une section et s'y rendre\n"
-"/ - rechercher une section correspondant à une regex donnée\n"
-"j - laisser cette section non décidée et aller à la suivante non-décidée\n"
-"J - laisser cette section non décidée et aller à la suivante\n"
-"k - laisser cette section non décidée et aller à la précédente non-décidée\n"
-"K - laisser cette section non décidée et aller à la précédente\n"
-"s - découper la section en sections plus petites\n"
-"e - éditer manuellement la section actuelle\n"
-"? - afficher l'aide\n"
-
-msgid "The selected hunks do not apply to the index!\n"
-msgstr "Les sections sélectionnées ne s'applique pas à l'index !\n"
-
-#, perl-format
-msgid "ignoring unmerged: %s\n"
-msgstr "fichier non-fusionné ignoré : %s\n"
-
-msgid "No other hunks to goto\n"
-msgstr "Aucune autre section à atteindre\n"
-
-#, perl-format
-msgid "Invalid number: '%s'\n"
-msgstr "Nombre invalide : '%s'\n"
-
-#, perl-format
-msgid "Sorry, only %d hunk available.\n"
-msgid_plural "Sorry, only %d hunks available.\n"
-msgstr[0] "Désolé, %d seule section disponible.\n"
-msgstr[1] "Désolé, Seulement %d sections disponibles.\n"
-
-msgid "No other hunks to search\n"
-msgstr "Aucune autre section à rechercher\n"
-
-#, perl-format
-msgid "Malformed search regexp %s: %s\n"
-msgstr "Regex de recherche malformée %s : %s\n"
-
-msgid "No hunk matches the given pattern\n"
-msgstr "Aucune section ne correspond au motif donné\n"
-
-msgid "No previous hunk\n"
-msgstr "Pas de section précédente\n"
-
-msgid "No next hunk\n"
-msgstr "Pas de section suivante\n"
-
-msgid "Sorry, cannot split this hunk\n"
-msgstr "Désolé, impossible de découper cette section\n"
-
-#, perl-format
-msgid "Split into %d hunk.\n"
-msgid_plural "Split into %d hunks.\n"
-msgstr[0] "Découpée en %d section.\n"
-msgstr[1] "Découpée en %d sections.\n"
-
-msgid "Sorry, cannot edit this hunk\n"
-msgstr "Désolé, impossible d'éditer cette section\n"
-
-#. TRANSLATORS: please do not translate the command names
-#. 'status', 'update', 'revert', etc.
-msgid ""
-"status - show paths with changes\n"
-"update - add working tree state to the staged set of changes\n"
-"revert - revert staged set of changes back to the HEAD version\n"
-"patch - pick hunks and update selectively\n"
-"diff - view diff between HEAD and index\n"
-"add untracked - add contents of untracked files to the staged set of "
-"changes\n"
-msgstr ""
-"status - montrer les chemins modifiés\n"
-"update - ajouter l'état de l'arbre de travail aux modifications à "
-"indexer\n"
-"revert - faire revenir les modifications à indexer à la version HEAD\n"
-"patch - sélectionner les sections et mettre à jour sélectivement\n"
-"diff - visualiser les diff entre HEAD et l'index\n"
-"add untracked - ajouter les fichiers non-suivis aux modifications à indexer\n"
-
-msgid "missing --"
-msgstr "-- manquant"
-
-#, perl-format
-msgid "unknown --patch mode: %s"
-msgstr "mode de --patch inconnu : %s"
-
-#, perl-format
-msgid "invalid argument %s, expecting --"
-msgstr "argument invalide %s, -- attendu"
-
msgid "local zone differs from GMT by a non-minute interval\n"
msgstr ""
"la zone locale diffère du GMT par un intervalle supérieur à une minute\n"
@@ -22767,88 +22741,3 @@ msgstr "%s sauté avec un suffix de sauvegarde '%s'.\n"
#, perl-format
msgid "Do you really want to send %s? [y|N]: "
msgstr "Souhaitez-vous réellement envoyer %s ?[y|N] : "
-
-#~ msgid "(stats|all)"
-#~ msgstr "(stats|all)"
-
-#~ msgid "git maintenance register"
-#~ msgstr "git maintenance register"
-
-#~ msgid "git maintenance unregister"
-#~ msgstr "git maintenance unregister"
-
-#~ msgid "git maintenance stop"
-#~ msgstr "git maintenance stop"
-
-#, c-format
-#~ msgid "could not parse colored hunk header '%.*s'"
-#~ msgstr "impossible d'analyser l'entête coloré de section '%.*s'"
-
-#, c-format
-#~ msgid "Unknown subcommand: %s"
-#~ msgstr "Sous-commande inconnue : %s"
-
-#~ msgid "checked out in another worktree"
-#~ msgstr "extrait dans un autre arbre de travail"
-
-#~ msgid "failed to open stdin of 'crontab'"
-#~ msgstr "échec à l'ouverture de stdin de 'crontab'"
-
-#, c-format
-#~ msgid "invalid subcommand: %s"
-#~ msgstr "sous-commande invalide : %s"
-
-#~ msgid "single arg format must be symmetric range"
-#~ msgstr "un format d'argument unique doit être une plage symétrique"
-
-#~ msgid "git submodule--helper list [--prefix=<path>] [<path>...]"
-#~ msgstr "git submodule--helper list [--prefix=<chemin>] [<chemin>...]"
-
-#~ msgid "git submodule--helper name <path>"
-#~ msgstr "git submodule--helper <nom> <chemin>"
-
-#, c-format
-#~ msgid "failed to get the default remote for submodule '%s'"
-#~ msgstr ""
-#~ "échec d'obtention du dépôt distant par défaut pour le sous-module '%s'"
-
-#, c-format
-#~ msgid "Invalid update mode '%s' for submodule path '%s'"
-#~ msgstr ""
-#~ "Mode de mise à jour '%s' invalide pour le chemin de sous-module '%s'"
-
-#~ msgid "path into the working tree, across nested submodule boundaries"
-#~ msgstr ""
-#~ "chemin dans la copie de travail, traversant les frontières de sous-modules"
-
-#~ msgid "rebase, merge, checkout or none"
-#~ msgstr "valeurs possibles : rebase, merge, checkout ou none"
-
-#~ msgid "bad value for update parameter"
-#~ msgstr "valeur invalide pour la mise à jour du paramètre"
-
-#~ msgid "Show three-way merge without touching index"
-#~ msgstr "Afficher la fusion à trois points sans modifier l'index"
-
-#, c-format
-#~ msgid "could not create directory for '%s'"
-#~ msgstr "impossible de créer le répertoire pour '%s'"
-
-#, c-format
-#~ msgid "Couldn't start hook '%s'\n"
-#~ msgstr "impossible de démarrer le crochet '%s'\n"
-
-#, c-format
-#~ msgid ""
-#~ "Note: %s not up to date and in way of checking out conflicted version; "
-#~ "old copy renamed to %s"
-#~ msgstr ""
-#~ "Note :%s pas à jour et au milieu de l'extraction d'une version "
-#~ "conflictuelle ; la vielle copie a été renommée en %s"
-
-#, c-format
-#~ msgid "%s: fast-forward"
-#~ msgstr "%s : avance rapide"
-
-#~ msgid "--preserve-merges was replaced by --rebase-merges"
-#~ msgstr "--preserve-merges a été remplacé par --rebase-merges"
diff --git a/po/id.po b/po/id.po
index 7ce5acb674..e468b6d9b8 100644
--- a/po/id.po
+++ b/po/id.po
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Git\n"
"Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2022-09-28 14:31+0700\n"
-"PO-Revision-Date: 2022-09-28 14:50+0700\n"
+"POT-Creation-Date: 2023-03-02 15:18+0700\n"
+"PO-Revision-Date: 2023-03-02 17:52+0700\n"
"Last-Translator: Bagas Sanjaya <bagasdotme@gmail.com>\n"
"Language-Team: Indonesian\n"
"Language: id\n"
@@ -26,19 +26,19 @@ msgstr "Huh (%s)?"
msgid "could not read index"
msgstr "tidak dapat membaca indeks"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "binary"
msgstr "biner"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "nothing"
msgstr "tidak ada"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "unchanged"
msgstr "tak berubah"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "Update"
msgstr "Perbarui"
@@ -51,15 +51,15 @@ msgstr "tidak dapat menggelar '%s'"
msgid "could not write index"
msgstr "tidak dapat menulis indeks"
-#: add-interactive.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-interactive.c
+#, c-format
msgid "updated %d path\n"
msgid_plural "updated %d paths\n"
msgstr[0] "%d jalur diperbarui\n"
msgstr[1] "%d jalur diperbarui\n"
-#: add-interactive.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-interactive.c
+#, c-format
msgid "note: %s is untracked now.\n"
msgstr "catatan: %s sekarang tak terlacak.\n"
@@ -68,7 +68,7 @@ msgstr "catatan: %s sekarang tak terlacak.\n"
msgid "make_cache_entry failed for path '%s'"
msgstr "make_cache_entry gagal untuk jalur '%s'"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "Revert"
msgstr "Kembalikan"
@@ -76,24 +76,24 @@ msgstr "Kembalikan"
msgid "Could not parse HEAD^{tree}"
msgstr "Tidak dapat menguraikan HEAD^{tree}"
-#: add-interactive.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-interactive.c
+#, c-format
msgid "reverted %d path\n"
msgid_plural "reverted %d paths\n"
msgstr[0] "%d jalur dikembalikan\n"
msgstr[1] "%d jalur dikembalikan\n"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
#, c-format
msgid "No untracked files.\n"
msgstr "Tidak ada berkas tak terlacak.\n"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "Add untracked"
msgstr "Tambahkan tak terlacak"
-#: add-interactive.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-interactive.c
+#, c-format
msgid "added %d path\n"
msgid_plural "added %d paths\n"
msgstr[0] "%d jalur ditambahkan\n"
@@ -104,21 +104,21 @@ msgstr[1] "%d jalur ditambahkan\n"
msgid "ignoring unmerged: %s"
msgstr "mengabaikan tak tergabung: %s"
-#: add-interactive.c add-patch.c git-add--interactive.perl
+#: add-interactive.c add-patch.c
#, c-format
msgid "Only binary files changed.\n"
msgstr "Hanya berkas biner yang berubah.\n"
-#: add-interactive.c add-patch.c git-add--interactive.perl
+#: add-interactive.c add-patch.c
#, c-format
msgid "No changes.\n"
msgstr "Tidak ada perubahan.\n"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "Patch update"
msgstr "Pembaruan tambalan"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "Review diff"
msgstr "Tinjau diff"
@@ -186,25 +186,25 @@ msgstr "pilih item bernomor"
msgid "(empty) select nothing"
msgstr "(empty) tidak pilih apapun"
-#: add-interactive.c builtin/clean.c git-add--interactive.perl
+#: add-interactive.c builtin/clean.c
msgid "*** Commands ***"
msgstr "*** Perintah ***"
-#: add-interactive.c builtin/clean.c git-add--interactive.perl
+#: add-interactive.c builtin/clean.c
msgid "What now"
msgstr "Apa sekarang"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "staged"
msgstr "tergelar"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "unstaged"
msgstr "tak tergelar"
#: add-interactive.c apply.c builtin/am.c builtin/bugreport.c builtin/clone.c
-#: builtin/diagnose.c builtin/fetch.c builtin/merge.c builtin/pull.c
-#: builtin/submodule--helper.c git-add--interactive.perl
+#: builtin/diagnose.c builtin/fetch.c builtin/hook.c builtin/merge.c
+#: builtin/pull.c builtin/submodule--helper.c
msgid "path"
msgstr "jalur"
@@ -212,28 +212,28 @@ msgstr "jalur"
msgid "could not refresh index"
msgstr "tidak dapat menyegarkan indeks"
-#: add-interactive.c builtin/clean.c git-add--interactive.perl
+#: add-interactive.c builtin/clean.c
#, c-format
msgid "Bye.\n"
msgstr "Sampai jumpa.\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stage mode change [y,n,q,a,d%s,?]? "
msgstr "Gelar perubahan mode [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stage deletion [y,n,q,a,d%s,?]? "
msgstr "Gelar penghapusan [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stage addition [y,n,q,a,d%s,?]? "
msgstr "Gelar penambahan [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stage this hunk [y,n,q,a,d%s,?]? "
msgstr "Gelar bingkah ini [y,n,q,a,d%s,?]? "
@@ -259,23 +259,23 @@ msgstr ""
"a - gelar bingkah ini dan semua bingkah selanjutnya dalam berkas\n"
"d - jangan gelar bingkah ini atau bingkah selanjutnya dalam berkas\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stash mode change [y,n,q,a,d%s,?]? "
msgstr "Stase perubahan mode [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stash deletion [y,n,q,a,d%s,?]? "
msgstr "Stase penghapusan [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stash addition [y,n,q,a,d%s,?]? "
msgstr "Stase penambahan [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stash this hunk [y,n,q,a,d%s,?]? "
msgstr "Stase bingkah ini [y,n,q,a,d%s,?]? "
@@ -301,23 +301,23 @@ msgstr ""
"a - stase bingkah ini dan semua bingkah selanjutnya dalam berkas\n"
"d - jangan stase bingkah ini atau bingkah selanjutnya dalam berkas\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Unstage mode change [y,n,q,a,d%s,?]? "
msgstr "Batal gelar perubahan mode [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Unstage deletion [y,n,q,a,d%s,?]? "
msgstr "Batal gelar penghapusan [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Unstage addition [y,n,q,a,d%s,?]? "
msgstr "Batal gelar penambahan [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Unstage this hunk [y,n,q,a,d%s,?]? "
msgstr "Batal gelar bingkah ini [y,n,q,a,d%s,?]? "
@@ -343,23 +343,23 @@ msgstr ""
"a - batal gelar bingkah ini dan semua bingkah selanjutnya dalam berkas\n"
"d - jangan batal gelar bingkah ini atau bingkah selanjutnya dalam berkas\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply mode change to index [y,n,q,a,d%s,?]? "
msgstr "Terapkan perubahan mode ke indeks [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply deletion to index [y,n,q,a,d%s,?]? "
msgstr "Terapkan penghapusan ke indeks [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply addition to index [y,n,q,a,d%s,?]? "
msgstr "Terapkan penambahan ke indeks [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply this hunk to index [y,n,q,a,d%s,?]? "
msgstr "Terapkan bingkah ini ke indeks [y,n,q,a,d%s,?]? "
@@ -385,23 +385,23 @@ msgstr ""
"a - terapkan bingkah ini dan semua bingkah selanjutnya dalam berkas\n"
"d - jangan terapkan bingkah ini atau bingkah selanjutnya dalam berkas\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard mode change from worktree [y,n,q,a,d%s,?]? "
msgstr "Buang perubahan mode dari pohon kerja [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard deletion from worktree [y,n,q,a,d%s,?]? "
msgstr "Buang penghapusan dari pohon kerja [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard addition from worktree [y,n,q,a,d%s,?]? "
msgstr "Buang penambahan dari pohon kerja [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard this hunk from worktree [y,n,q,a,d%s,?]? "
msgstr "Buang bingkah ini dari pohon kerja [y,n,q,a,d%s,?]? "
@@ -427,23 +427,23 @@ msgstr ""
"a - buang hunk ini dan semua bingkah selanjutnya dalam berkas\n"
"d - jangan buang hunk ini atau bingkah selanjutnya dalam berkas\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard mode change from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Buang perubahan mode dari indeks dan pohon kerja [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard deletion from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Buang penghapusan dari indeks dan pohon kerja [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard addition from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Buang penambahan dari indeks dan pohon kerja [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard this hunk from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Buang bingkah ini dari indeks dan pohon kerja [y,n,q,a,d%s,?]? "
@@ -461,23 +461,23 @@ msgstr ""
"a - buang bingkah ini dan semua bingkah selanjutnya dalam berkas\n"
"d - jangan buang bingkah ini atau bingkah selanjutnya dalam berkas\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply mode change to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Terapkan perubahan mode pada indeks dan pohon kerja [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply deletion to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Terapkan penghapusan pada indeks dan pohon kerja [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply addition to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Terapkan penambahan pada indeks dan pohon kerja [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply this hunk to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Terapkan bingkah ini pada indeks dan pohon kerja [y,n,q,a,d%s,?]? "
@@ -495,23 +495,23 @@ msgstr ""
"a - terapkan bingkah ini dan semua bingkah selanjutnya dalam berkas\n"
"d - jangan terapkan bingkah ini atau bingkah selanjutnya dalam berkas\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply mode change to worktree [y,n,q,a,d%s,?]? "
msgstr "Terapkan perubahan mode pada pohon kerja [y,n,q,a,d%s,?]?"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply deletion to worktree [y,n,q,a,d%s,?]? "
msgstr "Terapkan penghapusan pada pohon kerja [y,n,q,a,d%s,?]?"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply addition to worktree [y,n,q,a,d%s,?]? "
msgstr "Terapkan penambahan pada pohon kerja [y,n,q,a,d%s,?]?"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply this hunk to worktree [y,n,q,a,d%s,?]? "
msgstr "Terapkan bingkah ini pada pohon kerja [y,n,q,a,d%s,?]?"
@@ -581,7 +581,7 @@ msgstr ""
"tidak berakhir dengan:\n"
"%.*s"
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid "Manual hunk edit mode -- see bottom for a quick guide.\n"
msgstr "Mode sunting bingkah manual -- lihat dibawah untuk panduan cepat.\n"
@@ -598,9 +598,7 @@ msgstr ""
"Untuk menghapus baris '%c', hapuslahnya.\n"
"Baris yang diawali dengan %c akan dihapus.\n"
-#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
-#. TRANSLATORS: 'it' refers to the patch mentioned in the previous messages.
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid ""
"If it does not apply cleanly, you will be given an opportunity to\n"
"edit again. If all lines of the hunk are removed, then the edit is\n"
@@ -618,21 +616,13 @@ msgstr "tidak dapat menguraikan kepala bingkah"
msgid "'git apply --cached' failed"
msgstr "'git apply --cached' gagal"
-#. #-#-#-#-# add-patch.c.po #-#-#-#-#
#. TRANSLATORS: do not translate [y/n]
#. The program will only accept that input at this point.
#. Consider translating (saying "no" discards!) as
#. (saying "n" for "no" discards!) if the translation
#. of the word "no" does not start with n.
#.
-#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
-#. TRANSLATORS: do not translate [y/n]
-#. The program will only accept that input
-#. at this point.
-#. Consider translating (saying "no" discards!) as
-#. (saying "n" for "no" discards!) if the translation
-#. of the word "no" does not start with n.
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid ""
"Your edited hunk does not apply. Edit again (saying \"no\" discards!) [y/n]? "
msgstr ""
@@ -643,11 +633,11 @@ msgstr ""
msgid "The selected hunks do not apply to the index!"
msgstr "Bingkah yang dipilih tidak diterapkan pada indeks!"
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid "Apply them to the worktree anyway? "
msgstr "Tetap terapkan pada pohon kerja? "
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid "Nothing was applied.\n"
msgstr "Tidak ada yang diterapkan.\n"
@@ -685,11 +675,11 @@ msgstr "Tidak ada bingkah selanjutnya"
msgid "No other hunks to goto"
msgstr "Tidak ada bingkah lainnya untuk dikunjungi"
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid "go to which hunk (<ret> to see more)? "
msgstr "pergi ke bingkah yang mana (<ret> untuk lihat lebih)? "
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid "go to which hunk? "
msgstr "pergi ke bingkah yang mana?"
@@ -709,7 +699,7 @@ msgstr[1] "Maaf, hanya %d bingkah yang tersedia."
msgid "No other hunks to search"
msgstr "Tidak ada bingkah lainnya untuk dicari"
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid "search for regex? "
msgstr "cari untuk regex? "
@@ -900,6 +890,11 @@ msgstr "baris perintah diakhiri dengan \\"
msgid "unclosed quote"
msgstr "tanda kutip tak ditutup"
+#: alias.c builtin/cat-file.c builtin/notes.c builtin/prune-packed.c
+#: builtin/receive-pack.c builtin/tag.c
+msgid "too many arguments"
+msgstr "terlalu banyak argumen"
+
#: apply.c
#, c-format
msgid "unrecognized whitespace option '%s'"
@@ -1303,7 +1298,7 @@ msgstr ""
msgid "unable to add cache entry for %s"
msgstr "tidak dapat menambahkan entri tembolok untuk %s"
-#: apply.c builtin/bisect--helper.c builtin/gc.c
+#: apply.c builtin/bisect.c builtin/gc.c
#, c-format
msgid "failed to write to '%s'"
msgstr "gagal menulis ke '%s'"
@@ -1364,7 +1359,7 @@ msgid "No valid patches in input (allow with \"--allow-empty\")"
msgstr ""
"Tidak ada tambalan valid dalam masukan (perbolehkan dengan \"--allow-empty\")"
-#: apply.c
+#: apply.c t/helper/test-cache-tree.c
msgid "unable to read index file"
msgstr "tidak dapa membaca berkas indeks"
@@ -1599,7 +1594,7 @@ msgstr "tidak ada referensi seperti: %.*s"
msgid "not a valid object name: %s"
msgstr "bukan nama objek valid: %s"
-#: archive.c
+#: archive.c t/helper/test-cache-tree.c
#, c-format
msgid "not a tree object: %s"
msgstr "bukan objek pohon: %s"
@@ -1641,7 +1636,7 @@ msgstr "fmt"
msgid "archive format"
msgstr "format arsip"
-#: archive.c builtin/log.c
+#: archive.c builtin/log.c parse-options.h
msgid "prefix"
msgstr "prefiks"
@@ -1650,7 +1645,7 @@ msgid "prepend prefix to each pathname in the archive"
msgstr "tambahkan prefiks di depan setiap nama jalur dalam arsip"
#: archive.c builtin/blame.c builtin/commit-tree.c builtin/config.c
-#: builtin/fast-export.c builtin/grep.c builtin/hash-object.c
+#: builtin/fast-export.c builtin/gc.c builtin/grep.c builtin/hash-object.c
#: builtin/ls-files.c builtin/notes.c builtin/read-tree.c parse-options.h
msgid "file"
msgstr "berkas"
@@ -1675,6 +1670,15 @@ msgstr "baca .gitattributes dalam direktori kerja"
msgid "report archived files on stderr"
msgstr "laporkan berkas terarsip ke error standar"
+#: archive.c builtin/clone.c builtin/fetch.c builtin/pack-objects.c
+#: builtin/pull.c
+msgid "time"
+msgstr "waktu"
+
+#: archive.c
+msgid "set modification time of archive entries"
+msgstr "setel waktu modifikasi entri arsip"
+
#: archive.c
msgid "set compression level"
msgstr "setel level kompresi"
@@ -1731,6 +1735,15 @@ msgid "%.*s is not a valid attribute name"
msgstr "%.*s bukan sebuah nama atribut valid"
#: attr.c
+msgid "unable to add additional attribute"
+msgstr "Tidak dapat menambahkan atribut tambahan"
+
+#: attr.c
+#, c-format
+msgid "ignoring overly long attributes line %d"
+msgstr "mengabaikan baris atribut ke-%d yang terlalu panjang"
+
+#: attr.c
#, c-format
msgid "%s not allowed: %s:%d"
msgstr "%s tidak diperbolehkan: %s:%d"
@@ -1743,6 +1756,21 @@ msgstr ""
"Pola negatif diabaikan di atribut git\n"
"Gunakan '\\!' untuk tanda seru awal literal."
+#: attr.c
+#, c-format
+msgid "cannot fstat gitattributes file '%s'"
+msgstr "tidak dapat menulis berkas gitattributes '%s'"
+
+#: attr.c
+#, c-format
+msgid "ignoring overly large gitattributes file '%s'"
+msgstr "mengabaikan berkas gitattributes yang terlalu besar '%s'"
+
+#: attr.c
+#, c-format
+msgid "ignoring overly large gitattributes blob '%s'"
+msgstr "mengabaikan blob gitattributes '%s' yang terlalu besar"
+
#: bisect.c
#, c-format
msgid "Badly quoted content in file '%s': %s"
@@ -1876,8 +1904,8 @@ msgstr ""
"--reverse dan --first-parent bersama-sama butuh komit terbaru yang disebutkan"
#: blame.c builtin/commit.c builtin/log.c builtin/merge.c
-#: builtin/pack-objects.c builtin/shortlog.c bundle.c midx.c pack-bitmap.c
-#: ref-filter.c remote.c sequencer.c submodule.c
+#: builtin/pack-objects.c builtin/shortlog.c midx.c pack-bitmap.c ref-filter.c
+#: remote.c sequencer.c submodule.c
msgid "revision walk setup failed"
msgstr "persiapan jalan revisi gagal"
@@ -2067,11 +2095,11 @@ msgstr "submodul '%s': tidak dapat menemukan submodul"
#: branch.c
#, c-format
msgid ""
-"You may try updating the submodules using 'git checkout %s && git submodule "
-"update --init'"
+"You may try updating the submodules using 'git checkout --no-recurse-"
+"submodules %s && git submodule update --init'"
msgstr ""
-"Anda dapat mencoba memperbarui submodul dengan 'git checkout %s && git "
-"submodule update --init'"
+"Anda dapat mencoba memperbarui submodul dengan 'git checkout --no-recurse-"
+"submodules %s && git submodule update --init'"
#: branch.c
#, c-format
@@ -2115,6 +2143,14 @@ msgstr "hapus '%s'\n"
msgid "Unstaged changes after refreshing the index:"
msgstr "Perubahan tak tergelar setelah menyegarkan indeks:"
+#: builtin/add.c
+msgid ""
+"the add.interactive.useBuiltin setting has been removed!\n"
+"See its entry in 'git help config' for details."
+msgstr ""
+"setelan add.interactive.useBuiltin sudah dihapus!\n"
+"Selengkapnya lihat entrinya di 'git help config'."
+
#: builtin/add.c builtin/rev-parse.c
msgid "Could not read the index"
msgstr "Tidak dapat membaca indeks"
@@ -2585,7 +2621,7 @@ msgstr ""
"Sepertinya Anda telah memindahkan HEAD sejak kegagalan 'am' terakhir.\n"
"Tidak memutar ulang ke ORIG_HEAD"
-#: builtin/am.c builtin/bisect--helper.c worktree.c
+#: builtin/am.c builtin/bisect.c worktree.c
#, c-format
msgid "failed to read '%s'"
msgstr "gagal membaca '%s'"
@@ -2608,6 +2644,10 @@ msgid "run interactively"
msgstr "jalankan secara interaktif"
#: builtin/am.c
+msgid "bypass pre-applypatch and applypatch-msg hooks"
+msgstr "lewati kail pre-applypatch dan applypatch-msg"
+
+#: builtin/am.c
msgid "historical option -- no-op"
msgstr "opsi bersejarah -- no-op"
@@ -2798,112 +2838,106 @@ msgstr "git archive: kesalahan protokol"
msgid "git archive: expected a flush"
msgstr "git archive: sebuah bilasan diharapkan"
-#: builtin/bisect--helper.c
-msgid "git bisect--helper --bisect-reset [<commit>]"
-msgstr "git bisect--helper --bisect-reset [<komit>]"
-
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}"
-"=<term>] [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] "
-"[<paths>...]"
+"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>] [--no-"
+"checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]"
msgstr ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<istilah> --term-{old,"
-"good}=<istilah>] [--no-checkout] [--first-parent] [<jelek> [<bagus>...]] "
-"[--] [<jalur>...]"
+"git bisect start [--term-{new,bad}=<istilah> --term-{old, good}=<istilah>] "
+"[--no-checkout] [--first-parent] [<jelek> [<bagus>...]] [--] [<jalur>...]"
-#: builtin/bisect--helper.c
-msgid "git bisect--helper --bisect-state (bad|new) [<rev>]"
-msgstr "git bisect--helper --bisect-state (bad|new) [<revisi>]"
+#: builtin/bisect.c
+msgid "git bisect (good|bad) [<rev>...]"
+msgstr "git bisect (good|bad) [<revisi>...]"
-#: builtin/bisect--helper.c
-msgid "git bisect--helper --bisect-state (good|old) [<rev>...]"
-msgstr "git bisect--helper --bisect-state (good|old) [<revisi>...]"
+#: builtin/bisect.c
+msgid "git bisect skip [(<rev>|<range>)...]"
+msgstr "git bisect skip [(<revisi>|<rentang>)...]"
-#: builtin/bisect--helper.c
-msgid "git bisect--helper --bisect-replay <filename>"
-msgstr "git bisect--helper --bisect-replay <nama berkas>"
+#: builtin/bisect.c
+msgid "git bisect reset [<commit>]"
+msgstr "git bisect reset [<komit>]"
-#: builtin/bisect--helper.c
-msgid "git bisect--helper --bisect-skip [(<rev>|<range>)...]"
-msgstr "git bisect--helper --bisect-skip [(<revisi>|<rentang>)...]"
+#: builtin/bisect.c
+msgid "git bisect replay <logfile>"
+msgstr "git bisect replay <berkas log>"
-#: builtin/bisect--helper.c
-msgid "git bisect--helper --bisect-run <cmd>..."
-msgstr "git bisect--helper --bisect-run <perintah>..."
+#: builtin/bisect.c
+msgid "git bisect run <cmd>..."
+msgstr "git bisect run <perintah>..."
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "cannot open file '%s' in mode '%s'"
msgstr "tidak dapat membuka berkas '%s' dalam mode '%s'"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "could not write to file '%s'"
msgstr "tidak dapat menulis ke berkas '%s'"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "cannot open file '%s' for reading"
msgstr "tidak dapat membuka berkas '%s' untuk dibaca"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "'%s' is not a valid term"
msgstr "'%s' bukan istilah yang valid"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "can't use the builtin command '%s' as a term"
msgstr "tidak dapat menggunakan perintah bawaan '%s' sebagai istilah"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "can't change the meaning of the term '%s'"
msgstr "tidak dapat mengubah makna istilah '%s'"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "please use two different terms"
msgstr "mohon gunakan dua istilah yang berbeda"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "We are not bisecting.\n"
msgstr "Kami tidak sedang membagi dua.\n"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "'%s' is not a valid commit"
msgstr "'%s' bukan sebuah komit yang valid"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid ""
"could not check out original HEAD '%s'. Try 'git bisect reset <commit>'."
msgstr ""
"tidak dapat men-checkout HEAD asli '%s'. Coba 'git bisect reset <komit>'."
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "Bad bisect_write argument: %s"
msgstr "argument bisect_write jelek: %s"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "couldn't get the oid of the rev '%s'"
msgstr "tidak dapat mendapatkan oid revisi '%s'"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "couldn't open the file '%s'"
msgstr "tidak dapat membuka berkas '%s'"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "Invalid command: you're currently in a %s/%s bisect"
msgstr "Perintah tidak valid: sekarang Anda berada dalam pembagian dua %s/%s"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid ""
"You need to give me at least one %s and %s revision.\n"
@@ -2912,7 +2946,7 @@ msgstr ""
"Anda perlu berikan saya setidaknya satu revisi %s dan %s.\n"
"Untuk itu Anda dapat menggunakan \"git bisect %s\" dan \"git bisect %s\"."
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid ""
"You need to start by \"git bisect start\".\n"
@@ -2923,7 +2957,7 @@ msgstr ""
"Lalu Anda perlu berikan saya setidaknya satu revisi %s dan %s.\n"
"Untuk itu Anda dapat menggunakan \"git bisect %s\" dan \"git bisect %s\"."
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "bisecting only with a %s commit"
msgstr "membagi dua hanya dengan sebuah komit %s"
@@ -2932,30 +2966,30 @@ msgstr "membagi dua hanya dengan sebuah komit %s"
#. translation. The program will only accept English input
#. at this point.
#.
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "Are you sure [Y/n]? "
msgstr "Anda yakin [Y/n]?"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "status: waiting for both good and bad commits\n"
msgstr "status: menunggu komit bagus dan jelek\n"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "status: waiting for bad commit, %d good commit known\n"
msgid_plural "status: waiting for bad commit, %d good commits known\n"
msgstr[0] "status: menunggu komit jelek, %d komit bagus diketahui\n"
msgstr[1] "status: menunggu komit jelek, %d komit bagus diketahui\n"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "status: waiting for good commit(s), bad commit known\n"
msgstr "status: menunggu komit bagus, komit jelek diketahui\n"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "no terms defined"
msgstr "tidak ada istilah yang didefinisikan"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid ""
"Your current terms are %s for the old state\n"
@@ -2964,7 +2998,7 @@ msgstr ""
"Istilah Anda saat ini adalah %s untuk keadaan lama\n"
"dan %s untuk keadaan baru.\n"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid ""
"invalid argument %s for 'git bisect terms'.\n"
@@ -2973,52 +3007,48 @@ msgstr ""
"argumen %s tidak valid untuk 'git bisect terms'.\n"
"Opsi yang didukung adalah: --term-good|--term-old dan --term-bad|--term-new."
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "revision walk setup failed\n"
msgstr "setup jalan revisi gagal\n"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "could not open '%s' for appending"
msgstr "tidak dapat membuka '%s' untuk menambahkan"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "'' is not a valid term"
msgstr "'' bukan istilah yang valid"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "unrecognized option: '%s'"
msgstr "opsi tidak dikenal: '%s'"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "'%s' does not appear to be a valid revision"
msgstr "'%s' sepertinya bukan revisi valid"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "bad HEAD - I need a HEAD"
msgstr "HEAD jelek - saya butuh HEAD"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "checking out '%s' failed. Try 'git bisect start <valid-branch>'."
msgstr "gagal men-checkout '%s'. Coba 'git bisect start <cabang valid>'."
-#: builtin/bisect--helper.c
-msgid "won't bisect on cg-seek'ed tree"
-msgstr "tidak akan membagi dua pada pohon yang di-cg-seek"
-
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "bad HEAD - strange symbolic ref"
msgstr "HEAD jelek - referensi simbolik aneh"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "invalid ref: '%s'"
msgstr "referensi tidak valid: '%s'"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "You need to start by \"git bisect start\"\n"
msgstr "Anda perlu memulai dengan \"git bisect start\"\n"
@@ -3026,168 +3056,131 @@ msgstr "Anda perlu memulai dengan \"git bisect start\"\n"
#. translation. The program will only accept English input
#. at this point.
#.
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "Do you want me to do it for you [Y/n]? "
msgstr "Anda ingin saya melakukannya untuk Anda [Y/n]"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "Please call `--bisect-state` with at least one argument"
msgstr "Mohon panggil `--bisect-state` dengan setidaknya satu argumen"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "'git bisect %s' can take only one argument."
msgstr "'git bisect %s' hanya dapat mengambil satu argumen."
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "Bad rev input: %s"
msgstr "Masukan revisi jelek: %s"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "Bad rev input (not a commit): %s"
msgstr "Masukan revisi jelek (bukan sebuah komit): %s"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "We are not bisecting."
msgstr "Kami tidak sedang membagi dua."
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "'%s'?? what are you talking about?"
msgstr "'%s'?? Anda bilang tentang apa?"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "cannot read file '%s' for replaying"
msgstr "tidak dapat membuka berkas '%s' untuk memainkan ulang"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "running %s\n"
msgstr "menjalankan %s\n"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "bisect run failed: no command provided."
msgstr "bisect run gagal: tidak ada perintah yang diberikan"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
-msgid "unable to verify '%s' on good revision"
-msgstr "tidak dapat memverifikasi '%s' pada revisi bagus"
+msgid "unable to verify %s on good revision"
+msgstr "tidak dapat memverifikasi %s pada revisi bagus"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "bogus exit code %d for good revision"
msgstr "kode keluar gadungan %d untuk revisi bagu"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
-msgid "bisect run failed: exit code %d from '%s' is < 0 or >= 128"
-msgstr "bisect run gagal: kode keluar %d dari '%s' < 0 atau >= 128"
+msgid "bisect run failed: exit code %d from %s is < 0 or >= 128"
+msgstr "bisect run gagal: kode keluar %d dari %s < 0 atau >= 128"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "cannot open file '%s' for writing"
msgstr "tidak dapat membuka berkas '%s' untuk ditulis"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "bisect run cannot continue any more"
msgstr "bisect run tidak dapat dilanjutkan lagi"
-#: builtin/bisect--helper.c
-#, c-format
+#: builtin/bisect.c
msgid "bisect run success"
msgstr "bisect run sukses"
-#: builtin/bisect--helper.c
-#, c-format
+#: builtin/bisect.c
msgid "bisect found first bad commit"
msgstr "pembagian dua menemukan komit jelek pertama"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
-msgid ""
-"bisect run failed: 'git bisect--helper --bisect-state %s' exited with error "
-"code %d"
-msgstr ""
-"bisect run gagal: 'git bisect--helper --bisect-state %s' keluar dengan kode "
-"keluar %d"
-
-#: builtin/bisect--helper.c
-msgid "reset the bisection state"
-msgstr "setel ulang keadaan pembagian dua"
-
-#: builtin/bisect--helper.c
-msgid "check whether bad or good terms exist"
-msgstr "periksa apakah ada istilah jelek atau bagus"
+msgid "bisect run failed: 'git bisect %s' exited with error code %d"
+msgstr "bisect run gagal: 'git bisect %s' keluar dengan kode keluar %d"
-#: builtin/bisect--helper.c
-msgid "print out the bisect terms"
-msgstr "cetak istilah pembagian dua"
-
-#: builtin/bisect--helper.c
-msgid "start the bisect session"
-msgstr "mulai sesi pembagian dua"
-
-#: builtin/bisect--helper.c
-msgid "find the next bisection commit"
-msgstr "temukan komit pembagian dua berikutnya"
-
-#: builtin/bisect--helper.c
-msgid "mark the state of ref (or refs)"
-msgstr "tandai keadaan referensi"
-
-#: builtin/bisect--helper.c
-msgid "list the bisection steps so far"
-msgstr "daftar langkah pembagian dua sejauh ini"
-
-#: builtin/bisect--helper.c
-msgid "replay the bisection process from the given file"
-msgstr "mainkan ulang proses pembagian dua dari berkas yang diberikan"
-
-#: builtin/bisect--helper.c
-msgid "skip some commits for checkout"
-msgstr "lewati beberapa komit untuk checkout"
-
-#: builtin/bisect--helper.c
-msgid "visualize the bisection"
-msgstr "visualisasikan pembagian dua"
-
-#: builtin/bisect--helper.c
-msgid "use <cmd>... to automatically bisect"
-msgstr "gunakan <cmd>... untuk bagi dua otomatis."
+#: builtin/bisect.c
+#, c-format
+msgid "'%s' requires either no argument or a commit"
+msgstr "'%s' perlu baik tanpa argumen atau sebuah komit"
-#: builtin/bisect--helper.c
-msgid "no log for BISECT_WRITE"
-msgstr "tidak ada log untuk BISECT_WRITE"
+#: builtin/bisect.c
+#, c-format
+msgid "'%s' requires 0 or 1 argument"
+msgstr "%s perlu sebuah argumen"
-#: builtin/bisect--helper.c
-msgid "--bisect-reset requires either no argument or a commit"
-msgstr "--bisect-reset butuh baik tanpa argumen atau sebuah komit"
+#: builtin/bisect.c
+#, c-format
+msgid "'%s' requires 0 arguments"
+msgstr "'%s' butuh tanpa argumen"
-#: builtin/bisect--helper.c
-msgid "--bisect-terms requires 0 or 1 argument"
-msgstr "--bisect-terms butuh 0 atau 1 argumen"
+#: builtin/bisect.c
+msgid "no logfile given"
+msgstr "tidak ada berkas log yang diberikan"
-#: builtin/bisect--helper.c
-msgid "--bisect-next requires 0 arguments"
-msgstr "--bisect-next butuh 0 argumen"
+#: builtin/bisect.c
+#, c-format
+msgid "'%s' failed: no command provided."
+msgstr "'%s' gagal: tidak ada perintah yang diberikan."
-#: builtin/bisect--helper.c
-msgid "--bisect-log requires 0 arguments"
-msgstr "--bisect-log butuh 0 argumen"
+#: builtin/bisect.c
+msgid "need a command"
+msgstr "butuh sebuah perintah"
-#: builtin/bisect--helper.c
-msgid "no logfile given"
-msgstr "tidak ada berkas log yang diberikan"
+#: builtin/bisect.c builtin/cat-file.c
+#, c-format
+msgid "unknown command: '%s'"
+msgstr "perintah tidak dikenal: '%s'"
#: builtin/blame.c
msgid "git blame [<options>] [<rev-opts>] [<rev>] [--] <file>"
msgstr "git blame [<opsi>] [<opsi revisi>] [<revisi>] [--] <berkas>"
#: builtin/blame.c
+msgid "git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>"
+msgstr "git annotate [<opsi>] [<opsi revisi>] [<revisi>] [--] <berkas>"
+
+#: builtin/blame.c
msgid "<rev-opts> are documented in git-rev-list(1)"
msgstr "<opsi revisi> didokumentasikan dalam git-rev-list(1)"
@@ -3427,10 +3420,6 @@ msgid "cannot use -a with -d"
msgstr "tidak dapat gunakan -a dengan -d"
#: builtin/branch.c
-msgid "Couldn't look up commit object for HEAD"
-msgstr "Tidak dapat mencari objek komit untuk HEAD"
-
-#: builtin/branch.c
#, c-format
msgid "Cannot delete branch '%s' checked out at '%s'"
msgstr "Tidak dapat menghapus cabang '%s' yang ter-checkout pada '%s'"
@@ -3479,17 +3468,19 @@ msgid "Branch %s is being bisected at %s"
msgstr "Cabang %s sedang dibagi dua pada %s"
#: builtin/branch.c
-msgid "cannot copy the current branch while not on any."
-msgstr "tidak dapat menyalin cabang saat ini ketika tidak ada."
+#, c-format
+msgid "Invalid branch name: '%s'"
+msgstr "Nama cabang tidak valid: '%s'"
#: builtin/branch.c
-msgid "cannot rename the current branch while not on any."
-msgstr "tidak dapat mengganti nama cabang saat ini ketika tidak ada."
+#, c-format
+msgid "No commit on branch '%s' yet."
+msgstr "Belum ada komit pada cabang '%s'."
#: builtin/branch.c
#, c-format
-msgid "Invalid branch name: '%s'"
-msgstr "Nama cabang tidak valid: '%s'"
+msgid "No branch named '%s'."
+msgstr "Tidak ada cabang bernama '%s'."
#: builtin/branch.c
msgid "Branch rename failed"
@@ -3699,14 +3690,12 @@ msgid "cannot edit description of more than one branch"
msgstr "tidak dapat menyunting deskripsi lebih dari satu cabang"
#: builtin/branch.c
-#, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "Belum ada komit pada cabang '%s'."
+msgid "cannot copy the current branch while not on any."
+msgstr "tidak dapat menyalin cabang saat ini ketika tidak ada."
#: builtin/branch.c
-#, c-format
-msgid "No branch named '%s'."
-msgstr "Tidak ada cabang bernama '%s'."
+msgid "cannot rename the current branch while not on any."
+msgstr "tidak dapat mengganti nama cabang saat ini ketika tidak ada."
#: builtin/branch.c
msgid "too many branches for a copy operation"
@@ -3794,11 +3783,12 @@ msgstr ""
#: builtin/bugreport.c
msgid ""
-"git bugreport [-o|--output-directory <file>] [-s|--suffix <format>] [--"
-"diagnose[=<mode>]"
+"git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--diagnose[=<mode>]]"
msgstr ""
-"git bugreport [-o|--output-directory <berkas>] [-s|--suffix <format>] [--"
-"diagnose[=<mode>]]"
+"git bugreport [(-o | --output-directory) <berkas>] [(-s |-- suffix) "
+"<format>]\n"
+" [--diagnose[=<mode>]]"
#: builtin/bugreport.c
msgid ""
@@ -3881,20 +3871,30 @@ msgid "Created new report at '%s'.\n"
msgstr "Laporan baru dibuat pada '%s'.\n"
#: builtin/bundle.c
-msgid "git bundle create [<options>] <file> <git-rev-list args>"
-msgstr "git bundle create [<opsi>] <berkas> <argumen git-rev-list>"
+msgid ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<version>] <file> <git-rev-list-args>"
+msgstr ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [-all-"
+"progress-implied]\n"
+" [--version=<versi>] <berkas> <argumen git-rev-list>"
#: builtin/bundle.c
-msgid "git bundle verify [<options>] <file>"
-msgstr "git bundle verify [<opsi>] <berkas>"
+msgid "git bundle verify [-q | --quiet] <file>"
+msgstr "git bundle verify [-q | --quiet] <berkas>"
#: builtin/bundle.c
msgid "git bundle list-heads <file> [<refname>...]"
msgstr "git bundle list-heads <berkas> [<nama referensi>...]"
#: builtin/bundle.c
-msgid "git bundle unbundle <file> [<refname>...]"
-msgstr "git bundle unbundle <berkas> [<nama referensi>...]"
+msgid "git bundle unbundle [--progress] <file> [<refname>...]"
+msgstr "git bundle unbundle [--progress] <berkas> [<nama referensi>...]"
+
+#: builtin/bundle.c
+msgid "need a <file> argument"
+msgstr "butuh sebuah argumen <berkas>"
#: builtin/bundle.c builtin/pack-objects.c
msgid "do not show progress meter"
@@ -3966,11 +3966,6 @@ msgid "%s takes no arguments"
msgstr "%s tidak mengambil argumen"
#: builtin/cat-file.c
-#, c-format
-msgid "unknown command: '%s'"
-msgstr "perintah tidak dikenal: '%s'"
-
-#: builtin/cat-file.c
msgid "only one batch option may be specified"
msgstr "hanya satu opsi setumpuk yang mungkin disebutkan"
@@ -3991,12 +3986,12 @@ msgid ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgstr ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
#: builtin/cat-file.c
msgid ""
@@ -4138,11 +4133,6 @@ msgstr "<revisi> diperlukan dengan '%s'"
msgid "<object> required with '-%c'"
msgstr "<objek> diperlukan dengan '-%c'"
-#: builtin/cat-file.c builtin/notes.c builtin/prune-packed.c
-#: builtin/receive-pack.c builtin/tag.c
-msgid "too many arguments"
-msgstr "terlalu banyak argumen"
-
#: builtin/cat-file.c
#, c-format
msgid "only two arguments allowed in <type> <object> mode, not %d"
@@ -4150,12 +4140,19 @@ msgstr ""
"hanya dua argumen yang diperbolehkan di dalam mode <tipe> <objek>, bukan %d"
#: builtin/check-attr.c
-msgid "git check-attr [-a | --all | <attr>...] [--] <pathname>..."
-msgstr "git check-attr [-a | --all | <atribut>...] [--] <nama jalur>..."
+msgid ""
+"git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] "
+"<pathname>..."
+msgstr ""
+"git check-attr [source <mirip-pohon> [-a | --all | <atribut>...] [--] <nama "
+"jalur>..."
#: builtin/check-attr.c
-msgid "git check-attr --stdin [-z] [-a | --all | <attr>...]"
-msgstr "git check-attr --stdin [-z] [-a | --all | <attribut>...]"
+msgid ""
+"git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]"
+msgstr ""
+"git check-attr --stdin [-z] [--source <mirip-pohon>] [-a | --all | "
+"<attribut>...]"
#: builtin/check-attr.c
msgid "report all attributes set on file"
@@ -4173,6 +4170,14 @@ msgstr "baca nama berkas dari masukan standar"
msgid "terminate input and output records by a NUL character"
msgstr "akhiri masukan dan keluarkan rekaman oleh sebuah karakter NUL"
+#: builtin/check-attr.c
+msgid "<tree-ish>"
+msgstr "<mirip-pohon>"
+
+#: builtin/check-attr.c
+msgid "which tree-ish to check attributes at"
+msgstr "mirip-pohon mana yang diperiksa atributnya"
+
#: builtin/check-ignore.c builtin/checkout.c builtin/gc.c builtin/worktree.c
msgid "suppress progress reporting"
msgstr "padamkan pelaporan kemajuan"
@@ -4810,9 +4815,11 @@ msgstr "gunakan mode hamparan"
#: builtin/clean.c
msgid ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] "
+"[<pathspec>...]"
msgstr ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <pola>] [-x | -X] [--] <jalur>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <pola>] [-x | -X] [--] [<spek "
+"jalur>...]"
#: builtin/clean.c
#, c-format
@@ -4852,7 +4859,7 @@ msgstr "Menolak menghapus direktori kerja saat ini\n"
msgid "Would refuse to remove current working directory\n"
msgstr "Akan menolak menghapus direktori kerja saat ini\n"
-#: builtin/clean.c git-add--interactive.perl
+#: builtin/clean.c
#, c-format
msgid ""
"Prompt help:\n"
@@ -4865,7 +4872,7 @@ msgstr ""
"foo - pilih item berdasarkan prefiks unik\n"
" - (kosong) tidak pilih apa-apa\n"
-#: builtin/clean.c git-add--interactive.perl
+#: builtin/clean.c
#, c-format
msgid ""
"Prompt help:\n"
@@ -4886,8 +4893,8 @@ msgstr ""
"* - pilih semua item\n"
" - (kosong) selesai memilih\n"
-#: builtin/clean.c git-add--interactive.perl
-#, c-format, perl-format
+#: builtin/clean.c
+#, c-format
msgid "Huh (%s)?\n"
msgstr "Huh (%s)?\n"
@@ -5078,10 +5085,6 @@ msgstr "kedalaman"
msgid "create a shallow clone of that depth"
msgstr "buat klon dangkal sedalam kedalaman tersebut"
-#: builtin/clone.c builtin/fetch.c builtin/pack-objects.c builtin/pull.c
-msgid "time"
-msgstr "waktu"
-
#: builtin/clone.c
msgid "create a shallow clone since a specific time"
msgstr "buat klon dangkal sejak waktu yang disebutkan"
@@ -5181,6 +5184,11 @@ msgstr "%s ada dan bukan direktori"
msgid "failed to start iterator over '%s'"
msgstr "gagal memulai iterator pada '%s'"
+#: builtin/clone.c
+#, c-format
+msgid "symlink '%s' exists, refusing to clone with --local"
+msgstr "tautan simbolik '%s' ada, menolak mengkloning dengan --local"
+
#: builtin/clone.c compat/precompose_utf8.c
#, c-format
msgid "failed to unlink '%s'"
@@ -5263,11 +5271,6 @@ msgid "You must specify a repository to clone."
msgstr "Anda harus sebutkan repositori untuk diklon."
#: builtin/clone.c
-#, c-format
-msgid "options '%s' and '%s %s' cannot be used together"
-msgstr "opsi '%s' dan '%s %s' tidak dapat digunakan bersamaan"
-
-#: builtin/clone.c
msgid ""
"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
"exclude"
@@ -5377,6 +5380,10 @@ msgid "failed to fetch objects from bundle URI '%s'"
msgstr "gagal mengambil objek dari URI bundel '%s'"
#: builtin/clone.c
+msgid "failed to fetch advertised bundles"
+msgstr "gagal mengambil bundel yang diiklankan"
+
+#: builtin/clone.c
msgid "remote transport reported error"
msgstr "transportasi remote melaporkan kesalahan"
@@ -5423,22 +5430,28 @@ msgstr "--command harus menjadi argumen pertama"
#: builtin/commit-graph.c
msgid ""
-"git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"
+"git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]"
msgstr ""
-"git commit-graph verify [--object-dir <direktori objek>] [--shallow] [--"
+"git commit-graph verify [--object-dir <direktori>] [--shallow] [--"
"[no-]progress]"
#: builtin/commit-graph.c
msgid ""
-"git commit-graph write [--object-dir <objdir>] [--append] [--"
-"split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] <split options>"
-msgstr ""
-"git commit-graph write [--object-dir <direktori objek>] [--append] [--"
-"split[=<strategi>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[-no-]progrss] <opsi pemisah>"
-
-#: builtin/commit-graph.c builtin/fetch.c builtin/log.c
+"git commit-graph write [--object-dir <dir>] [--append]\n"
+" [--split[=<strategy>]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <split options>"
+msgstr ""
+"git commit-graph write [--object-dir <direktori>] [--append]\n"
+" [--split[=<strategi>]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--[-"
+"no-]progress]\n"
+" <opsi pemisahan>"
+
+#: builtin/commit-graph.c builtin/fetch.c builtin/log.c builtin/repack.c
msgid "dir"
msgstr "direktori"
@@ -5526,12 +5539,16 @@ msgid "Collecting commits from input"
msgstr "Mengumpulkan komit dari masukan"
#: builtin/commit-tree.c
+msgid "git commit-tree <tree> [(-p <parent>)...]"
+msgstr "git commit-tree <pohon> [(-p <induk>)...]"
+
+#: builtin/commit-tree.c
msgid ""
-"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...] [(-F "
-"<file>)...] <tree>"
+"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n"
+" [(-F <file>)...] <tree>"
msgstr ""
-"git commit-tree [(-p <induk>)...] [-S[<id kunci>]] [(-m <pesan>)...] [(-F "
-"<berkas>)...] <pohon>"
+"git commit-tree [(-p <induk>)...] [-S[<id kunci>]] [(-m <pesan>)...]\n"
+" [(-F <berkas>)...] <pohon>"
#: builtin/commit-tree.c
#, c-format
@@ -5588,12 +5605,31 @@ msgid "git commit-tree: failed to read"
msgstr "git commit-tree: gagal membaca"
#: builtin/commit.c
-msgid "git commit [<options>] [--] <pathspec>..."
-msgstr "git commit [<opsi>] [--] <spek jalur>..."
+msgid ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|"
+"reword):]<commit>)]\n"
+" [-F <file> | -m <msg>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n"
+" [--date=<date>] [--cleanup=<mode>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <komit> | --fixup [(amend|"
+"reword):]<komit>)]\n"
+" [-F <berkas> | -m <pesan>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--"
+"author=<pengarang>]\n"
+" [--date=<tanggal>] [--cleanup=<mode>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<berkas> [--pathspec-file-nul]]\n"
+" [(--trailer <token>[(=|:)<nilai>])...] [-S[<id kunci>]]\n"
+" [--] [<spek jalur>...]"
#: builtin/commit.c
-msgid "git status [<options>] [--] <pathspec>..."
-msgstr "git status [<opsi>] [--] <spek jalur>..."
+msgid "git status [<options>] [--] [<pathspec>...]"
+msgstr "git status [<opsi>] [--] [<spek jalur>...]"
#: builtin/commit.c
msgid ""
@@ -5724,7 +5760,7 @@ msgstr ""
"tidak dapat memilih karakter komentar yang tidak terpakai\n"
"dalam pesan komit saat ini"
-#: builtin/commit.c
+#: builtin/commit.c builtin/merge-tree.c
#, c-format
msgid "could not lookup commit %s"
msgstr "tidak dapat mencari komit %s"
@@ -6032,7 +6068,7 @@ msgstr "tangal"
msgid "override date for commit"
msgstr "timpa tanggal komit"
-#: builtin/commit.c parse-options.h ref-filter.h
+#: builtin/commit.c builtin/merge-tree.c parse-options.h ref-filter.h
msgid "commit"
msgstr "komit"
@@ -6186,7 +6222,7 @@ msgstr ""
msgid "git config [<options>]"
msgstr "git config [<opsi>]"
-#: builtin/config.c builtin/env--helper.c
+#: builtin/config.c
#, c-format
msgid "unrecognized --type argument, %s"
msgstr "argumen --type tidak dikenal %s"
@@ -6215,7 +6251,7 @@ msgstr "gunakan berkas konfigurasi repositori"
msgid "use per-worktree config file"
msgstr "gunakan berkas konfigurasi per pohon kerja"
-#: builtin/config.c
+#: builtin/config.c builtin/gc.c
msgid "use given config file"
msgstr "gunakan berkas konfigurasi yang diberikan"
@@ -6295,11 +6331,11 @@ msgstr "temukan setelan warna: slot [stdout-is-tty]"
msgid "Type"
msgstr "Tipe"
-#: builtin/config.c builtin/env--helper.c builtin/hash-object.c
+#: builtin/config.c builtin/hash-object.c
msgid "type"
msgstr "tipe"
-#: builtin/config.c builtin/env--helper.c
+#: builtin/config.c
msgid "value is given this type"
msgstr "Nilai diberikan tipe ini"
@@ -6354,7 +6390,7 @@ msgstr ""
"perlihatkan cakupan konfigurasi (pohon kerja, lokal, global, sistem, "
"perintah)"
-#: builtin/config.c builtin/env--helper.c
+#: builtin/config.c
msgid "value"
msgstr "nilai"
@@ -6439,7 +6475,7 @@ msgstr "--blob hanya dapat digunakan di dalam repositori git"
msgid "--worktree can only be used inside a git repository"
msgstr "--worktree hanya dapat digunakan di dalam repositori git"
-#: builtin/config.c
+#: builtin/config.c builtin/gc.c
msgid "$HOME not set"
msgstr "$HOME tak disetel"
@@ -6553,12 +6589,20 @@ msgstr ""
"tidak dapat mendapatkan kunci penyimpanan kredensial dalam %d milidetik"
#: builtin/describe.c
-msgid "git describe [<options>] [<commit-ish>...]"
-msgstr "git describe [<opsi>] [<mirip-komit>...]"
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<mirip-komit>...]"
+
+#: builtin/describe.c
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<penanda>]"
#: builtin/describe.c
-msgid "git describe [<options>] --dirty"
-msgstr "git describe [<opsi>] --dirty"
+msgid "git describe <blob>"
+msgstr "git describe <blob>"
#: builtin/describe.c
msgid "head"
@@ -6713,11 +6757,11 @@ msgstr "opsi '%s' dan mirip-komit tidak dapat digunakan bersamaan"
#: builtin/diagnose.c
msgid ""
-"git diagnose [-o|--output-directory <path>] [-s|--suffix <format>] [--"
-"mode=<mode>]"
+"git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--mode=<mode>]"
msgstr ""
-"git diagnose [-o|--output-directory <jalur>] [-s|--suffix <format>] [--"
-"mode=<mode>]"
+"git diagnose [(-o | --output-directory) <jalur>] [(-s | --suffix) <format>]\n"
+" [--mode=<mode>]"
#: builtin/diagnose.c
msgid "specify a destination for the diagnostics archive"
@@ -6741,6 +6785,10 @@ msgid "'%s': not a regular file or symlink"
msgstr "'%s': bukan berkas reguler atau tautan simbolik"
#: builtin/diff.c
+msgid "no merge given, only parents."
+msgstr "tidak ada penggabungan yang diberikan, hanya induk."
+
+#: builtin/diff.c
#, c-format
msgid "invalid option: %s"
msgstr "opsi tidak valid: %s"
@@ -6885,34 +6933,6 @@ msgstr "tidak ada <alat> yang diberikan untuk --tool=<alat>"
msgid "no <cmd> given for --extcmd=<cmd>"
msgstr "tidak ada <perintah> yang diberikan untuk --extcmd=<perintah>"
-#: builtin/env--helper.c
-msgid "git env--helper --type=[bool|ulong] <options> <env-var>"
-msgstr "git env--helper --type=[bool|ulong] <opsi> <variabel lingkungan>"
-
-#: builtin/env--helper.c
-msgid "default for git_env_*(...) to fall back on"
-msgstr "asali untuk git_env_*(...) agar kembali"
-
-#: builtin/env--helper.c
-msgid "be quiet only use git_env_*() value as exit code"
-msgstr "jadi diam; hanya gunakan nilai git_env_*() sebagai kode keluar"
-
-#: builtin/env--helper.c
-#, c-format
-msgid "option `--default' expects a boolean value with `--type=bool`, not `%s`"
-msgstr ""
-"opsi `--default' mengharapkan sebuah nilai boolean dengan `--type=bool`, "
-"bukan `%s`"
-
-#: builtin/env--helper.c
-#, c-format
-msgid ""
-"option `--default' expects an unsigned long value with `--type=ulong`, not `"
-"%s`"
-msgstr ""
-"opsi `--default' mengharapkan sebuah nilai unsigned long dengan `--"
-"type=ulong`, bukan `%s`"
-
#: builtin/fast-export.c
msgid "git fast-export [<rev-list-opts>]"
msgstr "git fast-export [<opsi rev-list>]"
@@ -7421,6 +7441,11 @@ msgid "--unshallow on a complete repository does not make sense"
msgstr "--unshallow pada repositori penuh tidak masuk akal"
#: builtin/fetch.c
+#, c-format
+msgid "failed to fetch bundles from '%s'"
+msgstr "gagal mengambil bundel dari '%s'"
+
+#: builtin/fetch.c
msgid "fetch --all does not take a repository argument"
msgstr "fetch --all tidak mengambil argumen repositori"
@@ -7552,8 +7577,8 @@ msgid "print only refs which don't contain the commit"
msgstr "hanya cetak referensi yang tidak berisi komit"
#: builtin/for-each-repo.c
-msgid "git for-each-repo --config=<config> <command-args>"
-msgstr "git for-each-repo --config=<konfigurasi> <argumen perintah>"
+msgid "git for-each-repo --config=<config> [--] <arguments>"
+msgstr "git for-each-repo --config=<konfigurasi> [--] <argumen perintah>"
#: builtin/for-each-repo.c
msgid "config"
@@ -7770,8 +7795,16 @@ msgid "%s: invalid sha1 pointer in resolve-undo"
msgstr "%s: penunjuk sha1 tidak valid di resolve-undo"
#: builtin/fsck.c
-msgid "git fsck [<options>] [<object>...]"
-msgstr "git fsck [<opsi>] [<objek>...]"
+msgid ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<object>...]"
+msgstr ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<objek>...]"
#: builtin/fsck.c
msgid "show unreachable objects"
@@ -7844,14 +7877,6 @@ msgid "git fsmonitor--daemon run [<options>]"
msgstr "git fsmonitor--daemon run [<opsi>]"
#: builtin/fsmonitor--daemon.c
-msgid "git fsmonitor--daemon stop"
-msgstr "git fsmonitor--daemon stop"
-
-#: builtin/fsmonitor--daemon.c
-msgid "git fsmonitor--daemon status"
-msgstr "git fsmonitor--daemon status"
-
-#: builtin/fsmonitor--daemon.c
#, c-format
msgid "value of '%s' out of range: %d"
msgstr "nilai '%s' di luar jangkauan: %d"
@@ -7952,7 +7977,7 @@ msgstr ""
msgid "invalid 'ipc-threads' value (%d)"
msgstr "nilai 'ipc-threads' tidak valid (%d)"
-#: builtin/fsmonitor--daemon.c
+#: builtin/fsmonitor--daemon.c t/helper/test-cache-tree.c
#, c-format
msgid "Unhandled subcommand '%s'"
msgstr "Subperintah tidak tertangani '%s'"
@@ -8157,8 +8182,23 @@ msgid "use at most one of --auto and --schedule=<frequency>"
msgstr "gunakan paling banyak satu dari --auto dan --schedule=<frekuensi>"
#: builtin/gc.c
-msgid "failed to run 'git config'"
-msgstr "gagal menjalankan 'git config'"
+#, c-format
+msgid "unable to add '%s' value of '%s'"
+msgstr "tidak dapat menambahkan nilai '%s' dari '%s'"
+
+#: builtin/gc.c
+msgid "return success even if repository was not registered"
+msgstr "kembalikan sukses bahkan jika repositori tidak terdaftar"
+
+#: builtin/gc.c
+#, c-format
+msgid "unable to unset '%s' value of '%s'"
+msgstr "tidak dapat membatal-setel nilai '%s' dari '%s'"
+
+#: builtin/gc.c
+#, c-format
+msgid "repository '%s' is not registered"
+msgstr "repositori '%s' tidak terdaftar"
#: builtin/gc.c
#, c-format
@@ -8537,11 +8577,15 @@ msgstr "baik --cached dan pohon diberikan"
#: builtin/hash-object.c
msgid ""
-"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters] [--stdin] "
-"[--] <file>..."
+"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]\n"
+" [--stdin [--literally]] [--] <file>..."
msgstr ""
-"git hash-object [-t <tipe>] [-w] [--path=<berkas> | --no-filters] [--stdin] "
-"[--] <berkas>..."
+"git hash-object [-t <tipe>] [-w] [--path=<berkas> | --no-filters]\n"
+" [--stdin [--literally]] [--] <berkas>..."
+
+#: builtin/hash-object.c
+msgid "git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]"
+msgstr "git hash-object [-t <tipe>] [-w] --stdin-paths [--no-filters]"
#: builtin/hash-object.c
msgid "object type"
@@ -8709,13 +8753,21 @@ msgid "'git help config' for more information"
msgstr "'git help config' untuk informasi lebih lanjut"
#: builtin/hook.c
-msgid "git hook run [--ignore-missing] <hook-name> [-- <hook-args>]"
-msgstr "git hook run [--ignore-missing] <nama kait> [-- <argumen kait>]"
+msgid ""
+"git hook run [--ignore-missing] [--to-stdin=<path>] <hook-name> [-- <hook-"
+"args>]"
+msgstr ""
+"git hook run [--ignore-missing] [--to-stdin=<jalur>] <nama kait> [-- "
+"<argumen kait>]"
#: builtin/hook.c
msgid "silently ignore missing requested <hook-name>"
msgstr "diam-diam abaikan <nama kait> yang diminta yang hilang"
+#: builtin/hook.c
+msgid "file to read into hooks' stdin"
+msgstr "gagal membaca masukan standar kait"
+
#: builtin/index-pack.c
#, c-format
msgid "object type mismatch at %s"
@@ -9080,11 +9132,15 @@ msgstr "Repositori Git kosong dinisialisasi di %s%s\n"
#: builtin/init-db.c
msgid ""
-"git init [-q | --quiet] [--bare] [--template=<template-directory>] [--"
-"shared[=<permissions>]] [<directory>]"
+"git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
+" [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+" [-b <branch-name> | --initial-branch=<branch-name>]\n"
+" [--shared[=<permissions>]] [<directory>]"
msgstr ""
-"git init [-q | --quiet] [--bare] [--template=<direktori-templat>][--"
-"shared[=<perizinan>]] [<direktori>]"
+"git init [-q | --quiet] [--bare] [--template=<direktori templat>]\n"
+" [--separate-git-dir <direktori git>] [--object-format=<format>]\n"
+" [-b <nama cabang> | --initial-branch=<nama cabang>]\n"
+" [--shared[=<perizinan>]] [<direktori>]"
#: builtin/init-db.c
msgid "permissions"
@@ -9137,11 +9193,13 @@ msgstr "--separate-git-dir tidak kompatibel dengan repositori bare"
#: builtin/interpret-trailers.c
msgid ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<token>[(=|:)<value>])...] [<file>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <token>[(=|:)<value>])...]\n"
+" [--parse] [<file>...]"
msgstr ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<token>[(=|:)<nilai>])...] [<berkas>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <token>[(=|:)<nilai>])...]\n"
+" [--parse] [<berkas>...]"
#: builtin/interpret-trailers.c
msgid "edit files in place"
@@ -9771,12 +9829,12 @@ msgstr ""
#: builtin/ls-remote.c
msgid ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<repository> [<refs>...]]"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n"
+" [--symref] [<repository> [<patterns>...]]"
msgstr ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<repositori> [<referensi>...]]"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<kunci>]\n"
+" [--symref] [<repositori> [<pola>...]]"
#: builtin/ls-remote.c
msgid "do not print remote URL"
@@ -9948,14 +10006,14 @@ msgid "git merge-base [-a | --all] --octopus <commit>..."
msgstr "git merge-base [-a | --all] --octopus <komit>..."
#: builtin/merge-base.c
-msgid "git merge-base --independent <commit>..."
-msgstr "git merge-base --independent <komit>..."
-
-#: builtin/merge-base.c
msgid "git merge-base --is-ancestor <commit> <commit>"
msgstr "git merge-base --is-ancestor <komit> <komit>"
#: builtin/merge-base.c
+msgid "git merge-base --independent <commit>..."
+msgstr "git merge-base --independent <komit>..."
+
+#: builtin/merge-base.c
msgid "git merge-base --fork-point <ref> [<commit>]"
msgstr "git merge-base --fork-point <referensi> [<komit>]"
@@ -10095,9 +10153,31 @@ msgid "allow merging unrelated histories"
msgstr "perbolehkan penggabungan riwayat yang tak terkait"
#: builtin/merge-tree.c
+msgid "perform multiple merges, one per line of input"
+msgstr "lakukan banyak penggabungan, satu per baris masukan"
+
+#: builtin/merge-tree.c
+msgid "specify a merge-base for the merge"
+msgstr "harus menyebutkan sebuah dasar penggabungan untuk penggabungan"
+
+#: builtin/merge-tree.c
msgid "--trivial-merge is incompatible with all other options"
msgstr "--trivial-merge tidak kompatibel dengan semua opsi lainnya"
+#: builtin/merge-tree.c
+msgid "--merge-base is incompatible with --stdin"
+msgstr "--merge-base tidak kompatibel dengan --stdin"
+
+#: builtin/merge-tree.c builtin/notes.c
+#, c-format
+msgid "malformed input line: '%s'."
+msgstr "baris masukan jelek: '%s'."
+
+#: builtin/merge-tree.c
+#, c-format
+msgid "merging cannot continue; got unclean result of %d"
+msgstr "penggabungan tidak dapat berlanjut; dapat hasil kotor dari %d"
+
#: builtin/merge.c
msgid "git merge [<options>] [<commit>...]"
msgstr "git merge [<opsi>] [<komit>...]"
@@ -10680,7 +10760,7 @@ msgstr "%s, source=%s, destination=%s"
msgid "Renaming %s to %s\n"
msgstr "Mengganti nama %s ke %s\n"
-#: builtin/mv.c builtin/remote.c builtin/repack.c
+#: builtin/mv.c builtin/remote.c
#, c-format
msgid "renaming '%s' failed"
msgstr "gagal mengganti nama '%s'"
@@ -10886,11 +10966,6 @@ msgstr "gagal membaca data catatan dari objek bukan blob '%s'."
#: builtin/notes.c
#, c-format
-msgid "malformed input line: '%s'."
-msgstr "baris masukan jelek: '%s'."
-
-#: builtin/notes.c
-#, c-format
msgid "failed to copy notes from '%s' to '%s'"
msgstr "gagal menyalin catatan dari '%s' ke '%s'"
@@ -11130,15 +11205,14 @@ msgid "unknown subcommand: `%s'"
msgstr "subperintah tidak dikenal: `%s'"
#: builtin/pack-objects.c
-msgid ""
-"git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"
+msgid "git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"
msgstr ""
-"git pack-objects --stdout [<opsi>...] [< <daftar referensi>| < <daftar-"
+"git pack-objects --stdout [<opsi>...] [< <daftar referensi> | < <daftar-"
"objek>]"
#: builtin/pack-objects.c
msgid ""
-"git pack-objects [<options>...] <base-name> [< <ref-list> | < <object-list>]"
+"git pack-objects [<options>] <base-name> [< <ref-list> | < <object-list>]"
msgstr ""
"git pack-objects [<opsi>...] <nama dasar> [< <daftar referensi> | < <daftar-"
"objek>]"
@@ -11620,8 +11694,8 @@ msgstr ""
"<git@vger.kernel.org>. Terima kasih.\n"
#: builtin/pack-refs.c
-msgid "git pack-refs [<options>]"
-msgstr "git pack-refs [<opsi>]"
+msgid "git pack-refs [--all] [--no-prune]"
+msgstr "git pack-refs [--all] [--no-prune]"
#: builtin/pack-refs.c
msgid "pack everything"
@@ -11631,6 +11705,22 @@ msgstr "pak semuanya"
msgid "prune loose refs (default)"
msgstr "pangkas referensi longgar (asali)"
+#: builtin/patch-id.c
+msgid "git patch-id [--stable | --unstable | --verbatim]"
+msgstr "git patch-id [--stable | --unstable | --verbatim]"
+
+#: builtin/patch-id.c
+msgid "use the unstable patch-id algorithm"
+msgstr "gunakan algoritma id tambalan tidak stabil"
+
+#: builtin/patch-id.c
+msgid "use the stable patch-id algorithm"
+msgstr "gunakan algoritma id tambalan stabil"
+
+#: builtin/patch-id.c
+msgid "don't strip whitespace from the patch"
+msgstr "jangan kupas spasi dari tambalan"
+
#: builtin/prune.c
msgid "git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]"
msgstr "git prune [-n] [-v] [--progress] [--expire <waktu>] [--] [<kepala>...]"
@@ -11895,14 +11985,13 @@ msgstr ""
#: builtin/push.c
msgid ""
"\n"
-"To avoid automatically configuring upstream branches when their name\n"
-"doesn't match the local branch, see option 'simple' of branch."
-"autoSetupMerge\n"
+"To avoid automatically configuring an upstream branch when its name\n"
+"won't match the local branch, see option 'simple' of branch.autoSetupMerge\n"
"in 'git help config'.\n"
msgstr ""
"\n"
"Untuk menghindari konfigurasi cabang hulu otomatis ketika namanya\n"
-"tidak cocok dengan cabang lokal, lihat opsi 'simple' dari branch."
+"tidak akan cocok dengan cabang lokal, lihat opsi 'simple' dari branch."
"autoSetupMerge\n"
"di 'git help config'.\n"
@@ -12068,6 +12157,14 @@ msgstr "Mendorong ke %s\n"
msgid "failed to push some refs to '%s'"
msgstr "gagal dorong beberapa referensi ke '%s'"
+#: builtin/push.c
+msgid ""
+"recursing into submodule with push.recurseSubmodules=only; using on-demand "
+"instead"
+msgstr ""
+"mengulangi ke dalam submodul dengan push.recurseSubmodules=only; menggunakan "
+"on-demand sebagai gantinya"
+
#: builtin/push.c builtin/send-pack.c submodule-config.c
#, c-format
msgid "invalid value for '%s'"
@@ -12149,7 +12246,7 @@ msgstr "minta transaksi atomik pada sisi remote"
msgid "--delete doesn't make sense without any refs"
msgstr "--delete tidak masuk akal tanpa referensi"
-#: builtin/push.c
+#: builtin/push.c t/helper/test-bundle-uri.c
#, c-format
msgid "bad repository '%s'"
msgstr "repositori jelek '%s'"
@@ -12242,14 +12339,15 @@ msgstr "butuh dua rentang komit"
#: builtin/read-tree.c
msgid ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>) "
-"[-u | -i]] [--no-sparse-checkout] [--index-output=<file>] (--empty | <tree-"
-"ish1> [<tree-ish2> [<tree-ish3>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
+"prefix=<prefix>)\n"
+" [-u | -i]] [--index-output=<file>] [--no-sparse-checkout]\n"
+" (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"
msgstr ""
"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
-"prefix=<prefiks>) [-u | -i]] [--no-sparse-checkout] [--index-"
-"output=<berkas>] (--empty | <mirip-pohon 1> [<mirip-pohon 2> <mirip-pohon "
-"3>])"
+"prefix=<awalan>)\n"
+" [-u | -i]] [--index-output=<berkas>] [--no-sparse-checkout]\n"
+" (--empty | <mirip pohon 1> [<mirip pohon 2> [mirip pohon 3]])"
#: builtin/read-tree.c
msgid "write resulting index to <file>"
@@ -12368,8 +12466,8 @@ msgstr "%s butuh tulang belakang penggabungan"
#: builtin/rebase.c
#, c-format
-msgid "could not get 'onto': '%s'"
-msgstr "tidak dapat mendapatkan 'ke': '%s'"
+msgid "invalid onto: '%s'"
+msgstr "kepada tidak valid: '%s'"
#: builtin/rebase.c
#, c-format
@@ -12426,6 +12524,10 @@ msgid "could not switch to %s"
msgstr "tidak dapat mengganti ke %s"
#: builtin/rebase.c
+msgid "apply options and merge options cannot be used together"
+msgstr "opsi apply dan opsi merge tidak dapat digunakan bersamaan"
+
+#: builtin/rebase.c
#, c-format
msgid ""
"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and \"ask"
@@ -12710,8 +12812,20 @@ msgid "--strategy requires --merge or --interactive"
msgstr "--strategy butuh --merge atau --interactive"
#: builtin/rebase.c
-msgid "apply options and merge options cannot be used together"
-msgstr "opsi apply dan opsi merge tidak dapat digunakan bersamaan"
+msgid ""
+"apply options are incompatible with rebase.autosquash. Consider adding --no-"
+"autosquash"
+msgstr ""
+"opsi penerapan tidak kompatibel dengan rebase.autosquash. "
+"Pertimbangkanmenambahkan --no-autosquash"
+
+#: builtin/rebase.c
+msgid ""
+"apply options are incompatible with rebase.updateRefs. Consider adding --no-"
+"update-refs"
+msgstr ""
+"opsi penerapan tidak kompatibel dengan rebase.updateRefs. "
+"Pertimbangkanmenambahkan --no-update-refs"
#: builtin/rebase.c
#, c-format
@@ -12742,8 +12856,8 @@ msgid "No such ref: %s"
msgstr "Tidak ada referensi seperti: %s"
#: builtin/rebase.c
-msgid "Could not resolve HEAD to a revision"
-msgstr "Tidak dapat menguraikan HEAD ke sebuah revisi"
+msgid "Could not resolve HEAD to a commit"
+msgstr "tidak dapat menguraikan komit HEAD ke sebuah komit"
#: builtin/rebase.c
#, c-format
@@ -13558,6 +13672,11 @@ msgid "could not close refs snapshot tempfile"
msgstr "tidak dapat menutup berkas sementara jepretan referensi"
#: builtin/repack.c
+#, c-format
+msgid "could not remove stale bitmap: %s"
+msgstr "tidak dapt memindahkan bitmap basi: %s"
+
+#: builtin/repack.c
msgid "pack everything in a single pack"
msgstr "pak semuanya dalam satu pak"
@@ -13656,6 +13775,10 @@ msgid "write a multi-pack index of the resulting packs"
msgstr "tulis indeks multipak dari pak yang dihasilkan"
#: builtin/repack.c
+msgid "pack prefix to store a pack containing pruned objects"
+msgstr "awalan pak untuk menyimpan pak berisi objek terpangkas"
+
+#: builtin/repack.c
msgid "cannot delete packs in a precious-objects repo"
msgstr "tidak dapat menghapus pak dalam repositori objek berharga"
@@ -13670,11 +13793,16 @@ msgstr "nama berkas paket %s tidak diawali dengan %s"
#: builtin/repack.c
#, c-format
-msgid "missing required file: %s"
-msgstr "berkas yang diperlukan hilang: %s"
+msgid "renaming pack to '%s' failed"
+msgstr "gagal mengganti nama pak ke '%s'"
#: builtin/repack.c
#, c-format
+msgid "pack-objects did not write a '%s' file for pack %s-%s"
+msgstr "pack-objects tidak menulis berkas '%s' untuk pak %s-%s"
+
+#: builtin/repack.c sequencer.c
+#, c-format
msgid "could not unlink: %s"
msgstr "tidak dapat membatal taut: %s"
@@ -13917,8 +14045,10 @@ msgid "only one pattern can be given with -l"
msgstr "hanya satu pola yang dapat diberikan dengan -l"
#: builtin/rerere.c
-msgid "git rerere [clear | forget <path>... | status | remaining | diff | gc]"
-msgstr "git rerere [clear | forge <jalur>... | status | remaining | diff | gc]"
+msgid ""
+"git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
+msgstr ""
+"git rerere [clear | forget <spek jalur>... | diff | status | remaining | gc]"
#: builtin/rerere.c
msgid "register clean resolutions in index"
@@ -14176,6 +14306,18 @@ msgstr "--prefix butuh sebuah argumen"
msgid "unknown mode for --abbrev-ref: %s"
msgstr "mode untuk --abbrev-ref tidak dikenal: %s"
+#: builtin/rev-parse.c revision.c
+msgid "--exclude-hidden cannot be used together with --branches"
+msgstr "--exclude-hidden tidak dapat digunakan bersamaan dengan --branches"
+
+#: builtin/rev-parse.c revision.c
+msgid "--exclude-hidden cannot be used together with --tags"
+msgstr "--exclude-hidden tidak dapat digunakan bersamaan dengan --tags"
+
+#: builtin/rev-parse.c revision.c
+msgid "--exclude-hidden cannot be used together with --remotes"
+msgstr "--exclude-hidden tidak dapat digunakan dengan --remotes"
+
#: builtin/rev-parse.c setup.c
msgid "this operation must be run in a work tree"
msgstr "operasi ini harus dijalankan di dalam pohon kerja"
@@ -14186,20 +14328,28 @@ msgid "unknown mode for --show-object-format: %s"
msgstr "mode untuk --show-object-format tidak dikenal: %s"
#: builtin/revert.c
-msgid "git revert [<options>] <commit-ish>..."
-msgstr "git revert [<opsi>] <mirip-komit>..."
+msgid ""
+"git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] "
+"<commit>..."
+msgstr ""
+"git revert [--[no-]edit] [-n] [-m <nomor induk>] [-s] [-S[<id kunci>]] "
+"<komit>..."
#: builtin/revert.c
-msgid "git revert <subcommand>"
-msgstr "git revert <subperintah>"
+msgid "git revert (--continue | --skip | --abort | --quit)"
+msgstr "git revert (--continue | --skip | --abort | --quit)"
#: builtin/revert.c
-msgid "git cherry-pick [<options>] <commit-ish>..."
-msgstr "git cherry-pick [<opsi>] <mirip-komit>..."
+msgid ""
+"git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n"
+" [-S[<keyid>]] <commit>..."
+msgstr ""
+"git cherry-pick [--edit] [-n] [-m <nomor induk>] [-s] [-x] [--ff]\n"
+" [-S[<id kunci>]] <komit>..."
#: builtin/revert.c
-msgid "git cherry-pick <subcommand>"
-msgstr "git cherry-pick <subperintah>"
+msgid "git cherry-pick (--continue | --skip | --abort | --quit)"
+msgstr "git cherry-pick (--continue | --skip | --abort | --quit)"
#: builtin/revert.c
#, c-format
@@ -14280,8 +14430,14 @@ msgid "cherry-pick failed"
msgstr "pemetikan ceri gagal"
#: builtin/rm.c
-msgid "git rm [<options>] [--] <file>..."
-msgstr "git rm [<opsi>] [--] <berkas>..."
+msgid ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<berkas> [--pathspec-file-nul]]\n"
+" [--] [<spek jalur>...]"
#: builtin/rm.c
msgid ""
@@ -14369,11 +14525,13 @@ msgid ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<host>:]<directory> (--all | <ref>...)"
msgstr ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>\n"
-"] [--verbose] [--thin] [--atomic]\n"
+" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<tuan rumah>:]<direktori> (--all | <referensi>...)"
#: builtin/send-pack.c
@@ -14405,8 +14563,9 @@ msgid "using multiple --group options with stdin is not supported"
msgstr "menggunakan banyak opsi --group dengan masukan standar tidak didukung"
#: builtin/shortlog.c
-msgid "using --group=trailer with stdin is not supported"
-msgstr "mengguanakn --group=trailer dengan stdin tidak didukung"
+#, c-format
+msgid "using %s with stdin is not supported"
+msgstr "menggunakan %s dengan masukan standar tidak didukung"
#: builtin/shortlog.c
#, c-format
@@ -14454,12 +14613,14 @@ msgid ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<when>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<rev> | <glob>)...]"
msgstr ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<kapan>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<revisi> | <glob>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<revisi> | <glob>)...]"
#: builtin/show-branch.c
msgid "git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]"
@@ -14589,11 +14750,13 @@ msgstr "algoritma hash tidak dikenal"
#: builtin/show-ref.c
msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<pattern>...]"
msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pola>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<pola>...]"
#: builtin/show-ref.c
msgid "git show-ref --exclude-existing[=<pattern>]"
@@ -14634,8 +14797,10 @@ msgstr ""
"lokal"
#: builtin/sparse-checkout.c
-msgid "git sparse-checkout (init|list|set|add|reapply|disable) <options>"
-msgstr "git sparse-checkout (init|list|set|add|reapply|disable) <opsi>"
+msgid ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<options>]"
+msgstr ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<opsi>]"
#: builtin/sparse-checkout.c
msgid "this worktree is not sparse"
@@ -14787,76 +14952,66 @@ msgid "error while refreshing working directory"
msgstr "kesalahan saat menyegarkan direktori kerja"
#: builtin/stash.c
-msgid "git stash list [<options>]"
-msgstr "git stash list [<opsi>]"
+msgid "git stash list [<log-options>]"
+msgstr "git stash list [<opsi log>]"
#: builtin/stash.c
-msgid "git stash show [<options>] [<stash>]"
-msgstr "git stash show [<opsi>] [<stase>]"
+msgid ""
+"git stash show [-u | --include-untracked | --only-untracked] [<diff-"
+"options>] [<stash>]"
+msgstr ""
+"git stash show [-u | --include-untracked | --only-untracked] [<opsi diff>] "
+"[<stase>]"
#: builtin/stash.c
-msgid "git stash drop [-q|--quiet] [<stash>]"
-msgstr "git stash drop [-q|--quiet] [<stase>]"
+msgid "git stash drop [-q | --quiet] [<stash>]"
+msgstr "git stash drop [-q | --quiet] [<stase>]"
#: builtin/stash.c
-msgid "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash ( pop | apply ) [--index] [-q|--quiet] [<stase>]"
+msgid "git stash pop [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash pop [--index] [-q | --quiet] [<stase>]"
+
+#: builtin/stash.c
+msgid "git stash apply [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash apply [--index] [-q | --quiet] [<stase>]"
#: builtin/stash.c
msgid "git stash branch <branchname> [<stash>]"
msgstr "git stash branch <nama cabang> [<stase>]"
#: builtin/stash.c
+msgid "git stash store [(-m | --message) <message>] [-q | --quiet] <commit>"
+msgstr "git stash store [(-m | --message) <pesan>] [-q|--quiet] <komit>"
+
+#: builtin/stash.c
msgid ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"<message>]\n"
" [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
" [--] [<pathspec>...]]"
msgstr ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index]\n"
-" [-q|--quiet] [-u|--include-untracked] [-a|--all]\n"
-" [-m|--message <pesan>] [--pathspec-from-file=<berkas>\n"
-" [--pathspec-file-nul]] [--] [<spek jalur>...]]"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"<pesan>]\n"
+" [--pathspec-from-file=<berkas> [--pathspec-file-nul]]\n"
+" [--] [<spek jalur>...]]"
#: builtin/stash.c
msgid ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<message>]"
msgstr ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index]\n"
-" [-q|--quiet] [-u|--include-untracked] [-a|--all] [<pesan>]"
-
-#: builtin/stash.c
-msgid "git stash pop [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash pop [--index] [-q|--quiet] [<stase>]"
-
-#: builtin/stash.c
-msgid "git stash apply [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash apply [--index] [-q|--quiet] [<stase>]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<pesan>]"
#: builtin/stash.c
-msgid "git stash store [-m|--message <message>] [-q|--quiet] <commit>"
-msgstr "git stash store [-m|--message <pesan>] [-q|--quiet] <komit>"
-
-#: builtin/stash.c
-msgid ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
-" [--] [<pathspec>...]]"
-msgstr ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <pesan>]\n"
-" [--] [<spek jalur>...]"
-
-#: builtin/stash.c
-msgid ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<pesan>]"
+msgid "git stash create [<message>]"
+msgstr "git stash create [<pesan>]"
#: builtin/stash.c
#, c-format
@@ -15565,10 +15720,6 @@ msgid "don't fetch new objects from the remote site"
msgstr "jangan ambil objek baru dari situs remote"
#: builtin/submodule--helper.c
-msgid "path into the working tree"
-msgstr "jalur ke dalam pohon kerja"
-
-#: builtin/submodule--helper.c
msgid "use the 'checkout' update strategy (default)"
msgstr "gunakan strategi pembaruan 'checkout' (asali)"
@@ -15614,34 +15765,10 @@ msgstr ""
"[--] [<jalur>...]"
#: builtin/submodule--helper.c
-msgid "recurse into submodules"
-msgstr "rekursi ke dalam submodul"
-
-#: builtin/submodule--helper.c
msgid "git submodule absorbgitdirs [<options>] [<path>...]"
msgstr "git submodule absorbgitdirs [<opsi>] [<jalur>...]"
#: builtin/submodule--helper.c
-msgid "check if it is safe to write to the .gitmodules file"
-msgstr "periksa apakah itu aman untuk menulis ke berkas .gitmodules"
-
-#: builtin/submodule--helper.c
-msgid "unset the config in the .gitmodules file"
-msgstr "batal setel konfigurasi dalam berkas .gitmodules"
-
-#: builtin/submodule--helper.c
-msgid "git submodule--helper config <name> [<value>]"
-msgstr "git submodule--helper config <nama> [<nilai>]"
-
-#: builtin/submodule--helper.c
-msgid "git submodule--helper config --unset <name>"
-msgstr "git submodule--helper config --unset <nama>"
-
-#: builtin/submodule--helper.c
-msgid "please make sure that the .gitmodules file is in the working tree"
-msgstr "mohom pastikan berkas .gitmodules di dalam pohon kerja"
-
-#: builtin/submodule--helper.c
msgid "suppress output for setting url of a submodule"
msgstr "sembunyikan keluaran penyetelan url submodule"
@@ -15737,6 +15864,10 @@ msgid "unable to checkout submodule '%s'"
msgstr "Tidak dapat men-checkout submodul '%s'"
#: builtin/submodule--helper.c
+msgid "please make sure that the .gitmodules file is in the working tree"
+msgstr "mohom pastikan berkas .gitmodules di dalam pohon kerja"
+
+#: builtin/submodule--helper.c
#, c-format
msgid "Failed to add submodule '%s'"
msgstr "Tidak dapat menambahkan submodul '%s'"
@@ -15798,23 +15929,21 @@ msgstr "URL repo: '%s' harus absolut atau diawali dengan ./|../"
msgid "'%s' is not a valid submodule name"
msgstr "'%s' bukan nama submodul yang valid"
-#: builtin/submodule--helper.c git.c
-#, c-format
-msgid "%s doesn't support --super-prefix"
-msgstr "%s tidak mendukung --super-prefix"
-
#: builtin/submodule--helper.c
-#, c-format
-msgid "'%s' is not a valid submodule--helper subcommand"
-msgstr "'%s' bukan subperintah submodule--helper valid"
+msgid "git submodule--helper <command>"
+msgstr "git submodule--helper <nama>"
+
+#: builtin/symbolic-ref.c
+msgid "git symbolic-ref [-m <reason>] <name> <ref>"
+msgstr "git symbolic-ref [-m <alasan>] <nama> <referensi>"
#: builtin/symbolic-ref.c
-msgid "git symbolic-ref [<options>] <name> [<ref>]"
-msgstr "git symbolic-ref [<opsi>] <nama> [<referensi>]"
+msgid "git symbolic-ref [-q] [--short] [--no-recurse] <name>"
+msgstr "git symbolic-ref [-q] [--short] [--no-recurse] <nama>"
#: builtin/symbolic-ref.c
-msgid "git symbolic-ref -d [-q] <name>"
-msgstr "git symbolic-ref -d [-q] <nama>"
+msgid "git symbolic-ref --delete [-q] <name>"
+msgstr "git symbolic-ref --delete [-q] <nama>"
#: builtin/symbolic-ref.c
msgid "suppress error message for non-symbolic (detached) refs"
@@ -15828,6 +15957,10 @@ msgstr "hapus referensi simbolik"
msgid "shorten ref output"
msgstr "pendekkan keluaran referensi"
+#: builtin/symbolic-ref.c
+msgid "recursively dereference (default)"
+msgstr "derefensi secara rekursif (asali)"
+
#: builtin/symbolic-ref.c builtin/update-ref.c
msgid "reason"
msgstr "alasan"
@@ -15838,11 +15971,11 @@ msgstr "alasan pembaruan"
#: builtin/tag.c
msgid ""
-"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]\n"
-" <tagname> [<head>]"
+"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n"
+" <tagname> [<commit> | <object>]"
msgstr ""
-"git tag [-a | -s | -u <id kunci>] [-f] [-m <pesan | -F <berkas>]\n"
-" <nama tag> [<kepala>]"
+"git tag [-a | -s | -u <id kunci>] [-f] [-m <pesan> | -F <berkas>] [-e]\n"
+" <nama tag> [<komit> | <objek>]"
#: builtin/tag.c
msgid "git tag -d <tagname>..."
@@ -15850,15 +15983,15 @@ msgstr "git tag -d <nama tag>..."
#: builtin/tag.c
msgid ""
-"git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--"
-"points-at <object>]\n"
-" [--format=<format>] [--merged <commit>] [--no-merged <commit>] "
-"[<pattern>...]"
+"git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]\n"
+" [--points-at <object>] [--column[=<options>] | --no-column]\n"
+" [--create-reflog] [--sort=<key>] [--format=<format>]\n"
+" [--merged <commit>] [--no-merged <commit>] [<pattern>...]"
msgstr ""
-"git tag -l [-n[<angka>]] [--contains <komit>] [--no-contains <komit>] [--"
-"points-at <objek>]\n"
-" [--format=<format>] [--merged <komit>] [--no-merged <komit>] "
-"[<pola>...]"
+"git tag [-n[<angka>]] -l [--contains <komit>] [--no-contains <komit>]\n"
+" [--points-at <objeck>] [--column[=<opsi>] | --no-column]\n"
+" [--create-reflog] [--sort=<kunci>] [--format=<format>]\n"
+" [--merged <komit>] [--no-merged <komit>] [<pola>...]"
#: builtin/tag.c
msgid "git tag -v [--format=<format>] <tagname>..."
@@ -16340,8 +16473,12 @@ msgid "update the info files from scratch"
msgstr "perbarui berkas info dari awal"
#: builtin/upload-pack.c
-msgid "git upload-pack [<options>] <dir>"
-msgstr "git upload-pack [<opsi>] <direktori>"
+msgid ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <directory>"
+msgstr ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <direktori>"
#: builtin/upload-pack.c t/helper/test-serve-v2.c
msgid "quit after a single request/response exchange"
@@ -16360,8 +16497,8 @@ msgid "interrupt transfer after <n> seconds of inactivity"
msgstr "interupsi transfer setelah <n> detik niraktivitas"
#: builtin/verify-commit.c
-msgid "git verify-commit [-v | --verbose] <commit>..."
-msgstr "git verify-commit [-v | --verbose] <komit>..."
+msgid "git verify-commit [-v | --verbose] [--raw] <commit>..."
+msgstr "git verify-commit [-v | --verbose] [--raw] <komit>..."
#: builtin/verify-commit.c
msgid "print commit contents"
@@ -16372,8 +16509,8 @@ msgid "print raw gpg status output"
msgstr "cetak keluaran status gpg mentah"
#: builtin/verify-pack.c
-msgid "git verify-pack [-v | --verbose] [-s | --stat-only] <pack>..."
-msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] <pak>..."
+msgid "git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pack>.idx..."
+msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pak>.idx..."
#: builtin/verify-pack.c
msgid "verbose"
@@ -16384,44 +16521,48 @@ msgid "show statistics only"
msgstr "hanya perlihatkan statistik"
#: builtin/verify-tag.c
-msgid "git verify-tag [-v | --verbose] [--format=<format>] <tag>..."
-msgstr "git verify-tag [-v | --verbose] [--format=<format>] <tag>..."
+msgid "git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."
+msgstr "git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."
#: builtin/verify-tag.c
msgid "print tag contents"
msgstr "cetak isi tag"
#: builtin/worktree.c
-msgid "git worktree add [<options>] <path> [<commit-ish>]"
-msgstr "git worktree add [<opsi>] <jalur> [<mirip komit>]"
+msgid ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]\n"
+" [-b <new-branch>] <path> [<commit-ish>]"
+msgstr ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <untai>]]\n"
+" [-b <cabang baru>] <jalur> [<mirip komit>]"
#: builtin/worktree.c
-msgid "git worktree list [<options>]"
-msgstr "git worktree list [<opsi>]"
+msgid "git worktree list [-v | --porcelain [-z]]"
+msgstr "git worktree list [-v | --porcelain [-z]"
#: builtin/worktree.c
-msgid "git worktree lock [<options>] <path>"
-msgstr "git worktree lock [<opsi>] <jalur>"
+msgid "git worktree lock [--reason <string>] <worktree>"
+msgstr "git worktree lock [--reason <untai>] <pohon kerja>"
#: builtin/worktree.c
msgid "git worktree move <worktree> <new-path>"
msgstr "git worktree move <pohon kerja> <jalur baru>"
#: builtin/worktree.c
-msgid "git worktree prune [<options>]"
-msgstr "git worktree prune [<opsi>]"
+msgid "git worktree prune [-n] [-v] [--expire <expire>]"
+msgstr "git worktree prune [-n] [-v] [--expire <kadaluarsa>]"
#: builtin/worktree.c
-msgid "git worktree remove [<options>] <worktree>"
-msgstr "git worktree remove [<opsi>] <pohon kerja>"
+msgid "git worktree remove [-f] <worktree>"
+msgstr "git worktree remove [-f] <pohon kerja>"
#: builtin/worktree.c
msgid "git worktree repair [<path>...]"
msgstr "git worktree repair [<jalur>...]"
#: builtin/worktree.c
-msgid "git worktree unlock <path>"
-msgstr "git worktree unlock <jalur>"
+msgid "git worktree unlock <worktree>"
+msgstr "git worktree unlock <worktree>"
#: builtin/worktree.c
#, c-format
@@ -16713,6 +16854,16 @@ msgid "core.fsyncMethod = batch is unsupported on this platform"
msgstr "core.fsyncMethod = batch tidak didukung pada platform ini"
#: bundle-uri.c
+#, c-format
+msgid "could not parse bundle list key %s with value '%s'"
+msgstr "tidak dapat mengurai kunci daftar bundel %s dengan nilai '%s'"
+
+#: bundle-uri.c
+#, c-format
+msgid "bundle list at '%s' has no mode"
+msgstr "daftar bundel pada '%s' tidak punya mode"
+
+#: bundle-uri.c
msgid "failed to create temporary file"
msgstr "tidak dapat membuat berkas sementara"
@@ -16722,18 +16873,53 @@ msgstr "tidak cukup kemampuan"
#: bundle-uri.c
#, c-format
+msgid "file downloaded from '%s' is not a bundle"
+msgstr "berkas yang diunduh dari '%s' bukan sebuah bundel"
+
+#: bundle-uri.c
+msgid "failed to store maximum creation token"
+msgstr "gagal menyimpan token pembuatan maksimum"
+
+#: bundle-uri.c
+#, c-format
+msgid "unrecognized bundle mode from URI '%s'"
+msgstr "mode bundel tidak dikenal dari URI '%s'"
+
+#: bundle-uri.c
+#, c-format
+msgid "exceeded bundle URI recursion limit (%d)"
+msgstr "batas rekursi URI bundel (%d) terlewati"
+
+#: bundle-uri.c
+#, c-format
msgid "failed to download bundle from URI '%s'"
msgstr "gagal mengunduh bundel dari URI '%s'"
#: bundle-uri.c
#, c-format
-msgid "file at URI '%s' is not a bundle"
-msgstr "berkas pada URI '%s' bukan sebuah bundle"
+msgid "file at URI '%s' is not a bundle or bundle list"
+msgstr "berkas pada URI '%s' bukan sebuah bundel atau daftar bundel"
#: bundle-uri.c
#, c-format
-msgid "failed to unbundle bundle from URI '%s'"
-msgstr "gagal membongkar bundel dari URI '%s'"
+msgid "bundle-uri: unexpected argument: '%s'"
+msgstr "bundle-uri: argumen tidak diharapkan: '%s'"
+
+#: bundle-uri.c
+msgid "bundle-uri: expected flush after arguments"
+msgstr "bundle-uri: bilasan diharapkan setelah argumen"
+
+#: bundle-uri.c
+msgid "bundle-uri: got an empty line"
+msgstr "bundle-uri: dapat satu baris kosong"
+
+#: bundle-uri.c
+msgid "bundle-uri: line is not of the form 'key=value'"
+msgstr "bundle-uri: baris bukan berbentuk 'kunci=nilai'"
+
+#: bundle-uri.c
+msgid "bundle-uri: line has empty key or value"
+msgstr "bundle-uri: baris berisi kunci atau nilai kosong"
#: bundle.c
#, c-format
@@ -16764,6 +16950,14 @@ msgid "need a repository to verify a bundle"
msgstr "perlu sebuah repositori untuk verifikasi bundel"
#: bundle.c
+msgid ""
+"some prerequisite commits exist in the object store, but are not connected "
+"to the repository's history"
+msgstr ""
+"beberapa komit prasyarat ada pada penyimpanan objek, tetapi tidak terhubung "
+"ke riwayat repositori"
+
+#: bundle.c
#, c-format
msgid "The bundle contains this ref:"
msgid_plural "The bundle contains these %<PRIuMAX> refs:"
@@ -17496,7 +17690,7 @@ msgid "Chunk-based file formats"
msgstr "Berkas format berbasis bingkah"
#: command-list.h
-msgid "Git commit graph format"
+msgid "Git commit-graph format"
msgstr "Format grafik komit Git"
#: command-list.h
@@ -17929,6 +18123,11 @@ msgstr "kasus tak tertangani di 'has_worktree_moved': %d"
msgid "health thread wait failed [GLE %ld]"
msgstr "antri utas kesehatan gagal [GLE %ld]"
+#: compat/fsmonitor/fsm-ipc-darwin.c
+#, c-format
+msgid "Invalid path: %s"
+msgstr "Jalur tidak valid: %s"
+
#: compat/fsmonitor/fsm-listen-darwin.c
msgid "Unable to create FSEventStream."
msgstr "tidak dapat membuat FSEventStream."
@@ -17967,12 +18166,32 @@ msgstr "GetOverlappedResult gagal pada '%s' [GLE %ld]"
msgid "could not read directory changes [GLE %ld]"
msgstr "tidak dapat membaca perubahan direktori [GLE %ld]"
-#: compat/fsmonitor/fsm-settings-win32.c
+#: compat/fsmonitor/fsm-path-utils-darwin.c
+#, c-format
+msgid "opendir('%s') failed"
+msgstr "opendir('%s') gagal"
+
+#: compat/fsmonitor/fsm-path-utils-darwin.c
+#, c-format
+msgid "lstat('%s') failed"
+msgstr "lstat('%s') gagal"
+
+#: compat/fsmonitor/fsm-path-utils-darwin.c
+#, c-format
+msgid "strbuf_readlink('%s') failed"
+msgstr "strbuf_readlink('%s') gagal"
+
+#: compat/fsmonitor/fsm-path-utils-darwin.c
+#, c-format
+msgid "closedir('%s') failed"
+msgstr "closedir('%s') gagal"
+
+#: compat/fsmonitor/fsm-path-utils-win32.c
#, c-format
msgid "[GLE %ld] unable to open for read '%ls'"
msgstr "[GLE %ld] tidak dapat membuka untuk dibaca '%ls'"
-#: compat/fsmonitor/fsm-settings-win32.c
+#: compat/fsmonitor/fsm-path-utils-win32.c
#, c-format
msgid "[GLE %ld] unable to get protocol information for '%ls'"
msgstr "[GLE %ld] tidak dapat mendapatkan informasi protokol untuk '%ls'"
@@ -18535,12 +18754,12 @@ msgstr "format objek tidak dikenal '%s' disebutkan oleh peladen"
#: connect.c
#, c-format
-msgid "invalid ls-refs response: %s"
-msgstr "jawaban ls-refs tidak valid: %s"
+msgid "error on bundle-uri response line %d: %s"
+msgstr "kesalahan pada baris tanggapan bundle-uri ke-%d: %s"
#: connect.c
-msgid "expected flush after ref listing"
-msgstr "bilasan diharapkan setelah penyebutan referensi"
+msgid "expected flush after bundle-uri listing"
+msgstr "bilasan diharapkan setelah pendaftaran bundle-uri"
#: connect.c
msgid "expected response end packet after ref listing"
@@ -18548,6 +18767,15 @@ msgstr "jawaban akhir paket diharapkan setelah penyebutan referensi"
#: connect.c
#, c-format
+msgid "invalid ls-refs response: %s"
+msgstr "jawaban ls-refs tidak valid: %s"
+
+#: connect.c
+msgid "expected flush after ref listing"
+msgstr "bilasan diharapkan setelah penyebutan referensi"
+
+#: connect.c
+#, c-format
msgid "protocol '%s' is not supported"
msgstr "protokol '%s' tidak didukung"
@@ -19983,10 +20211,11 @@ msgstr "repositori virtual '%s' tidka kompatibel dengan fsmonitor"
#: fsmonitor-settings.c
#, c-format
msgid ""
-"repository '%s' is incompatible with fsmonitor due to lack of Unix sockets"
+"socket directory '%s' is incompatible with fsmonitor due to lack of Unix "
+"sockets support"
msgstr ""
-"repositori '%s' tidak kompatibel dengan fsmonitor karena kekurangan soket "
-"Unix"
+"direktori soket '%s' tidak kompatibel dengan fsmonitor karena kekurangan "
+"dukungan soket Unix"
#: git.c
msgid ""
@@ -19995,16 +20224,14 @@ msgid ""
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
-" [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n"
-" <command> [<args>]"
+" [--config-env=<name>=<envvar>] <command> [<args>]"
msgstr ""
"git [-v| --version] [-h | --help] [-C <jalur>] [-c <nama>=<nilai>]\n"
" [--exec-path[=<jalur>]] [--html-path] [--man-path] [--info-path]\n"
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<jalur>] [--work-tree=<jalur>] [--namespace=<nama>]\n"
-" [--super-prefix=<jalur>] [--config-env=<nama>=<variabel "
-"lingkungan>]\n"
+" [--config-env=<nama>=<variabel lingkungan>]\n"
" <perintah> [<argumen>]"
#: git.c
@@ -20036,11 +20263,6 @@ msgstr "tidak ada ruang nama yang diberikan untuk --namespace\n"
#: git.c
#, c-format
-msgid "no prefix given for --super-prefix\n"
-msgstr "tidak ada prefiks yang diberikan untuk --super-prefix\n"
-
-#: git.c
-#, c-format
msgid "-c expects a configuration string\n"
msgstr "-c mengharapkan sebuah untai konfigurasi\n"
@@ -20177,8 +20399,13 @@ msgid "gpg.ssh.defaultKeyCommand failed: %s %s"
msgstr "gpg.ssh.defaultKeyCommand gagal: %s %s"
#: gpg-interface.c
-msgid "gpg failed to sign the data"
-msgstr "gpg gagal menandatangani data"
+#, c-format
+msgid ""
+"gpg failed to sign the data:\n"
+"%s"
+msgstr ""
+"gpg gagal menandatangani data:\n"
+"%s"
#: gpg-interface.c
msgid "user.signingKey needs to be set for ssh signing"
@@ -20380,8 +20607,8 @@ msgstr[1] ""
"Perintah paling mirip adalah"
#: help.c
-msgid "git version [<options>]"
-msgstr "git version [<opsi>]"
+msgid "git version [--build-options]"
+msgstr "git version [--build-options]"
#: help.c
#, c-format
@@ -21493,11 +21720,6 @@ msgid "%s: ignoring alternate object stores, nesting too deep"
msgstr "%s: mengabaikan penyimpanan objek alternatif, bersarang terlalu dalam"
#: object-file.c
-#, c-format
-msgid "unable to normalize object directory: %s"
-msgstr "tidak dapat menormalisasikan direktori objek: %s"
-
-#: object-file.c
msgid "unable to fdopen alternates lockfile"
msgstr "tidak dapat men-fdopen berkas kunci alternatif"
@@ -21572,6 +21794,11 @@ msgstr "sampah pada ujung berkas objek '%s'"
#: object-file.c
#, c-format
+msgid "unable to open loose object %s"
+msgstr "tidak dapat membuka objek longgar %s"
+
+#: object-file.c
+#, c-format
msgid "unable to parse %s header"
msgstr "tidak dapat menguraikan kepala %s"
@@ -21591,8 +21818,8 @@ msgstr "kepala untuk %s terlalu panjang, melebihi %d bita"
#: object-file.c
#, c-format
-msgid "failed to read object %s"
-msgstr "gagal membaca objek %s"
+msgid "loose object %s (stored in %s) is corrupt"
+msgstr "objek longgar %s (disimpan di %s) rusak"
#: object-file.c
#, c-format
@@ -21601,11 +21828,6 @@ msgstr "pengganti %s tidak ditemukan untuk %s"
#: object-file.c
#, c-format
-msgid "loose object %s (stored in %s) is corrupt"
-msgstr "objek longgar %s (disimpan di %s) rusak"
-
-#: object-file.c
-#, c-format
msgid "packed object %s (stored in %s) is corrupt"
msgstr "objek terpak %s (disimpan di %s) rusak"
@@ -21620,10 +21842,6 @@ msgid "unable to set permission to '%s'"
msgstr "tidak dapat menyetel perizinan ke '%s'"
#: object-file.c
-msgid "file write error"
-msgstr "kesalahan menulis berkas"
-
-#: object-file.c
msgid "error when closing loose object file"
msgstr "kesalahan saat menutup berkas objek longgar"
@@ -21683,12 +21901,13 @@ msgid "cannot read object for %s"
msgstr "tidak dapat membaca objek untuk %s"
#: object-file.c
-msgid "corrupt commit"
-msgstr "komit rusak"
+#, c-format
+msgid "object fails fsck: %s"
+msgstr "fsck objek gagal: %s"
#: object-file.c
-msgid "corrupt tag"
-msgstr "tag rusak"
+msgid "refusing to create malformed object"
+msgstr "menolak membuat objek jelek"
#: object-file.c
#, c-format
@@ -22003,11 +22222,6 @@ msgid "cannot fstat bitmap file"
msgstr "tidak dapat fstat berkas bitmap"
#: pack-bitmap.c
-#, c-format
-msgid "ignoring extra bitmap file: '%s'"
-msgstr "mengabaikan berkas bitmap tambahan: '%s'"
-
-#: pack-bitmap.c
msgid "checksum doesn't match in MIDX and bitmap"
msgstr "checksum tidak cocok di MIDX dan bitmap"
@@ -22335,6 +22549,10 @@ msgid "use <n> digits to display object names"
msgstr "gunakan <n> digit untuk menampilkan nama objek"
#: parse-options.h
+msgid "prefixed path to initial superproject"
+msgstr "jalur terprefiks ke superproyek awal"
+
+#: parse-options.h
msgid "how to strip spaces and #comments from message"
msgstr "bagaimana cara mengupas spasi dan #komentar dari pesan"
@@ -22520,6 +22738,11 @@ msgstr ""
msgid "promisor remote name cannot begin with '/': %s"
msgstr "nama remote penjanji tidak dapat diawali dengan '/': %s"
+#: promisor-remote.c
+#, c-format
+msgid "could not fetch %s from promisor remote"
+msgstr "tidak dapat mengambil %s dari remote penjanji"
+
#: protocol-caps.c
msgid "object-info: expected flush after arguments"
msgstr "object-info: bilasan diharapkan setelah argumen"
@@ -22932,6 +23155,16 @@ msgstr "di depan %d, di belakang %d"
#: ref-filter.c
#, c-format
+msgid "%%(%.*s) does not take arguments"
+msgstr "%%(%.*s) tidak mengambil argumen"
+
+#: ref-filter.c
+#, c-format
+msgid "unrecognized %%(%.*s) argument: %s"
+msgstr "argumen %%(%.*s) tidak dikenal: %s"
+
+#: ref-filter.c
+#, c-format
msgid "expected format: %%(color:<color>)"
msgstr "format yang diharapkan: %%(color:<warna>)"
@@ -22952,26 +23185,6 @@ msgstr "Nilai bilangan bulat diharapkan refname:rstrip=%s"
#: ref-filter.c
#, c-format
-msgid "unrecognized %%(%s) argument: %s"
-msgstr "argumen %%(%s) tidak dikenal: %s"
-
-#: ref-filter.c
-#, c-format
-msgid "%%(objecttype) does not take arguments"
-msgstr "%%(objecttype) tidak mengambil argumen"
-
-#: ref-filter.c
-#, c-format
-msgid "%%(deltabase) does not take arguments"
-msgstr "%%(deltabase) tidak mengambil argumen"
-
-#: ref-filter.c
-#, c-format
-msgid "%%(body) does not take arguments"
-msgstr "%%(body) tidak mengambil argumen"
-
-#: ref-filter.c
-#, c-format
msgid "expected %%(trailers:key=<value>)"
msgstr "diharapkan %%(trailers:key=<nilai>)"
@@ -22992,11 +23205,6 @@ msgstr "nilai positif '%s' diharapkan di %%(%s)"
#: ref-filter.c
#, c-format
-msgid "unrecognized email option: %s"
-msgstr "opsi surel tidak dikenal: %s"
-
-#: ref-filter.c
-#, c-format
msgid "expected format: %%(align:<width>,<position>)"
msgstr "format diharapkan: %%(align:<lebar>,<posisi>)"
@@ -23012,13 +23220,13 @@ msgstr "lebar tidak dikenal: %s"
#: ref-filter.c
#, c-format
-msgid "positive width expected with the %%(align) atom"
-msgstr "lebar positif diharapkan dengan atom %%(align)"
+msgid "unrecognized %%(%s) argument: %s"
+msgstr "argumen %%(%s) tidak dikenal: %s"
#: ref-filter.c
#, c-format
-msgid "%%(rest) does not take arguments"
-msgstr "%%(rest) tidak mengambil argumen"
+msgid "positive width expected with the %%(align) atom"
+msgstr "lebar positif diharapkan dengan atom %%(align)"
#: ref-filter.c
#, c-format
@@ -23821,6 +24029,15 @@ msgstr "gagal menemukan pohon %s"
#: revision.c
#, c-format
+msgid "unsupported section for hidden refs: %s"
+msgstr "seksi tidak didukung untuk referensi tersembunyi: %s"
+
+#: revision.c
+msgid "--exclude-hidden= passed more than once"
+msgstr "--exclude-hidden= dilewatkan lebih dari sekali"
+
+#: revision.c
+#, c-format
msgid "resolve-undo records `%s` which is missing"
msgstr "resolve-undo merekam `%s` yang dimana hilang"
@@ -24007,6 +24224,16 @@ msgstr "--all atau <pendaftaran>, tetapi bukan kedua-duanya"
#: scalar.c
#, c-format
+msgid "could not remove stale scalar.repo '%s'"
+msgstr "tidak dapat menghapus scalar.repo basi '%s'"
+
+#: scalar.c
+#, c-format
+msgid "removing stale scalar.repo '%s'"
+msgstr "menghapus scalar.repo basi '%s'"
+
+#: scalar.c
+#, c-format
msgid "git repository gone in '%s'"
msgstr "repositori git pergi di '%s'"
@@ -24529,6 +24756,28 @@ msgstr "git %s: gagal menyegarkan indeks"
#: sequencer.c
#, c-format
+msgid "'%s' is not a valid label"
+msgstr "'%s' bukan label valid"
+
+#: sequencer.c
+#, c-format
+msgid "'%s' is not a valid refname"
+msgstr "'%s' bukan nama referensi valid"
+
+#: sequencer.c
+#, c-format
+msgid "update-ref requires a fully qualified refname e.g. refs/heads/%s"
+msgstr ""
+"update-ref memerlukan nama referensi terkualifikasi penuh, misalnya refs/"
+"heads/%s"
+
+#: sequencer.c
+#, c-format
+msgid "invalid command '%.*s'"
+msgstr "perintah tidak valid '%.*s'"
+
+#: sequencer.c
+#, c-format
msgid "%s does not accept arguments: '%s'"
msgstr "%s tidak menerima argumen: '%s'"
@@ -24763,6 +25012,11 @@ msgid "illegal label name: '%.*s'"
msgstr "nama label ilegal: '%.*s'"
#: sequencer.c
+#, c-format
+msgid "could not resolve '%s'"
+msgstr "tidak dapat menguraikan '%s'"
+
+#: sequencer.c
msgid "writing fake root commit"
msgstr "menulis komit akar palsu"
@@ -24771,11 +25025,6 @@ msgid "writing squash-onto"
msgstr "menulis squash-onto"
#: sequencer.c
-#, c-format
-msgid "could not resolve '%s'"
-msgstr "tidak dapat menguraikan '%s'"
-
-#: sequencer.c
msgid "cannot merge without a current revision"
msgstr "tidak dapat menggabungkan tanpa revisi saat ini"
@@ -25502,100 +25751,129 @@ msgstr "ls-tree kembalikan kode kembali %d yang tak diharapkan"
msgid "failed to lstat '%s'"
msgstr "gagal men-lstat '%s'"
+#: t/helper/test-bundle-uri.c
+msgid "no remote configured to get bundle URIs from"
+msgstr "tidak ada remote yang dikonfigurasi untuk mendapatkan URI bundel"
+
+#: t/helper/test-bundle-uri.c
+#, c-format
+msgid "remote '%s' has no configured URL"
+msgstr "remote '%s' tidak punya URL terkonfigurasi"
+
+#: t/helper/test-bundle-uri.c
+msgid "could not get the bundle-uri list"
+msgstr "tidak dapat mendapatkan daftar bundle-uri"
+
+#: t/helper/test-cache-tree.c
+msgid "test-tool cache-tree <options> (control|prime|update)"
+msgstr "test-tool cache-tree <opsi> (control|prime|update)"
+
+#: t/helper/test-cache-tree.c
+msgid "clear the cache tree before each iteration"
+msgstr "bersihkan pohon tembolok sebelum setiap iterasi"
+
+#: t/helper/test-cache-tree.c
+msgid "number of entries in the cache tree to invalidate (default 0)"
+msgstr "jumlah entri di dalam pohon tembolok untuk dinirvalidasi (asali 0)"
+
#: t/helper/test-fast-rebase.c
msgid "unhandled options"
-msgstr ""
+msgstr "opsi tak tertangani"
#: t/helper/test-fast-rebase.c
msgid "error preparing revisions"
-msgstr ""
+msgstr "kesalahan menyiapkan revisi"
#: t/helper/test-reach.c
#, c-format
msgid "commit %s is not marked reachable"
-msgstr ""
+msgstr "komit %s tidak ditandai sebagai dapat dicapai"
#: t/helper/test-reach.c
msgid "too many commits marked reachable"
-msgstr ""
+msgstr "terlalu banyak komit yang ditandai sebagai dapat dicapai"
#: t/helper/test-serve-v2.c
msgid "test-tool serve-v2 [<options>]"
-msgstr ""
+msgstr "test-tool serve-v2 [<opsi>]"
#: t/helper/test-serve-v2.c
msgid "exit immediately after advertising capabilities"
-msgstr ""
+msgstr "langsung keluar setelah mengiklankan kemampuan"
#: t/helper/test-simple-ipc.c
msgid "test-helper simple-ipc is-active [<name>] [<options>]"
-msgstr ""
+msgstr "test-helper simple-ipc is-active [<nama>] [<opsi>]"
#: t/helper/test-simple-ipc.c
msgid "test-helper simple-ipc run-daemon [<name>] [<threads>]"
-msgstr ""
+msgstr "test-helper simple-ipc run-daemon [<nama>] [<utas>]"
#: t/helper/test-simple-ipc.c
msgid "test-helper simple-ipc start-daemon [<name>] [<threads>] [<max-wait>]"
msgstr ""
+"test-helper simple-ipc start-daemon [<nama>] [<utas>] [<tunggu maksimum>]"
#: t/helper/test-simple-ipc.c
msgid "test-helper simple-ipc stop-daemon [<name>] [<max-wait>]"
-msgstr ""
+msgstr "test-helper simple-ipc stop-daemon [<nama> [<tunggu maksimum>]"
#: t/helper/test-simple-ipc.c
msgid "test-helper simple-ipc send [<name>] [<token>]"
-msgstr ""
+msgstr "test-helper simple-ipc send [<nama>] [<token>]"
#: t/helper/test-simple-ipc.c
msgid "test-helper simple-ipc sendbytes [<name>] [<bytecount>] [<byte>]"
msgstr ""
+"test-helper simple-ipc sendbytes [<nama>] [<hitungan bita>] [<bita>]"
#: t/helper/test-simple-ipc.c
msgid ""
"test-helper simple-ipc multiple [<name>] [<threads>] [<bytecount>] "
"[<batchsize>]"
msgstr ""
+"test-helper simple-ipc multiple [<nama>] [<utas>] [<hitungan bita>] "
+"[<ukuran batch>]"
#: t/helper/test-simple-ipc.c
msgid "name or pathname of unix domain socket"
-msgstr ""
+msgstr "nama atau nama jalur soket domain unix"
#: t/helper/test-simple-ipc.c
msgid "named-pipe name"
-msgstr ""
+msgstr "nama pipa bernama"
#: t/helper/test-simple-ipc.c
msgid "number of threads in server thread pool"
-msgstr ""
+msgstr "jumlah utas pada kolam utas peladen"
#: t/helper/test-simple-ipc.c
msgid "seconds to wait for daemon to start or stop"
-msgstr ""
+msgstr "waktu menunggu daemon dimulai atau dihentikan (dalam detik)"
#: t/helper/test-simple-ipc.c
msgid "number of bytes"
-msgstr ""
+msgstr "jumlah bita"
#: t/helper/test-simple-ipc.c
msgid "number of requests per thread"
-msgstr ""
+msgstr "jumlah permintaan tiap utas"
#: t/helper/test-simple-ipc.c
msgid "byte"
-msgstr ""
+msgstr "bita"
#: t/helper/test-simple-ipc.c
msgid "ballast character"
-msgstr ""
+msgstr "karakter pemberat"
#: t/helper/test-simple-ipc.c
msgid "token"
-msgstr ""
+msgstr "token"
#: t/helper/test-simple-ipc.c
msgid "command token to send to the server"
-msgstr ""
+msgstr "token perintah untuk dikirim ke peladen"
#: trailer.c
#, c-format
@@ -25927,6 +26205,14 @@ msgstr "Membatalkan."
msgid "failed to push all needed submodules"
msgstr "gagal mendorong semua submodul yang dibutuhkan"
+#: transport.c
+msgid "bundle-uri operation not supported by protocol"
+msgstr "operasi bundle-uri tidak didukung oleh protokol"
+
+#: transport.c
+msgid "could not retrieve server-advertised bundle-uri list"
+msgstr "tidak dapat menerima daftar bundle-uri teriklankan server"
+
#: tree-walk.c
msgid "too-short tree object"
msgstr "objek pohon terlalu pendek"
@@ -26831,13 +27117,22 @@ msgstr "Berkas yang diabaikan"
#: wt-status.c
#, c-format
msgid ""
-"It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
-"may speed it up, but you have to be careful not to forget to add\n"
-"new files yourself (see 'git help status')."
+"It took %.2f seconds to enumerate untracked files,\n"
+"but the results were cached, and subsequent runs may be faster."
msgstr ""
-"Butuh %.2f detik untuk menghitung berkas tak terlacak. 'status -uno'\n"
-"mungkin bisa mempercepat, tapi Anda harus berhati-hati jangan sampai lupa\n"
-"untuk tambahkan berkas baru sendiri (lihat 'git help status')."
+"Butuh %.2f detik untuk mengenumerasikan berkas tak terlacak,\n"
+"tapi hasilnya ditembolokkan, dan invokasi berikutnya mungkin\n"
+"lebih cepat."
+
+#: wt-status.c
+#, c-format
+msgid "It took %.2f seconds to enumerate untracked files."
+msgstr "Butuh %.2f detik untuk mengenumerasikan berkas tak terlacak."
+
+#: wt-status.c
+msgid "See 'git help status' for information on how to improve this."
+msgstr ""
+"Lihat 'git help status' untuk informasi bagaimana meningkatkankeadaan ini."
#: wt-status.c
#, c-format
@@ -27016,241 +27311,6 @@ msgstr "Anda perlu menjalankan perintah ini dari level atas dari pohon kerja."
msgid "Unable to determine absolute path of git directory"
msgstr "Tidak dapat menentukan jalur absolut direktori git"
-#. TRANSLATORS: you can adjust this to align "git add -i" status menu
-#: git-add--interactive.perl
-#, perl-format
-msgid "%12s %12s %s"
-msgstr ""
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "touched %d path\n"
-msgid_plural "touched %d paths\n"
-msgstr[0] ""
-msgstr[1] ""
-
-#: git-add--interactive.perl
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for staging."
-msgstr ""
-
-#: git-add--interactive.perl
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for stashing."
-msgstr ""
-
-#: git-add--interactive.perl
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for unstaging."
-msgstr ""
-
-#: git-add--interactive.perl
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for applying."
-msgstr ""
-
-#: git-add--interactive.perl
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for discarding."
-msgstr ""
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "failed to open hunk edit file for writing: %s"
-msgstr ""
-
-#: git-add--interactive.perl
-#, perl-format
-msgid ""
-"---\n"
-"To remove '%s' lines, make them ' ' lines (context).\n"
-"To remove '%s' lines, delete them.\n"
-"Lines starting with %s will be removed.\n"
-msgstr ""
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "failed to open hunk edit file for reading: %s"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid ""
-"y - stage this hunk\n"
-"n - do not stage this hunk\n"
-"q - quit; do not stage this hunk or any of the remaining ones\n"
-"a - stage this hunk and all later hunks in the file\n"
-"d - do not stage this hunk or any of the later hunks in the file"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid ""
-"y - stash this hunk\n"
-"n - do not stash this hunk\n"
-"q - quit; do not stash this hunk or any of the remaining ones\n"
-"a - stash this hunk and all later hunks in the file\n"
-"d - do not stash this hunk or any of the later hunks in the file"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid ""
-"y - unstage this hunk\n"
-"n - do not unstage this hunk\n"
-"q - quit; do not unstage this hunk or any of the remaining ones\n"
-"a - unstage this hunk and all later hunks in the file\n"
-"d - do not unstage this hunk or any of the later hunks in the file"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid ""
-"y - apply this hunk to index\n"
-"n - do not apply this hunk to index\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid ""
-"y - discard this hunk from worktree\n"
-"n - do not discard this hunk from worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid ""
-"y - discard this hunk from index and worktree\n"
-"n - do not discard this hunk from index and worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid ""
-"y - apply this hunk to index and worktree\n"
-"n - do not apply this hunk to index and worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid ""
-"y - apply this hunk to worktree\n"
-"n - do not apply this hunk to worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid ""
-"g - select a hunk to go to\n"
-"/ - search for a hunk matching the given regex\n"
-"j - leave this hunk undecided, see next undecided hunk\n"
-"J - leave this hunk undecided, see next hunk\n"
-"k - leave this hunk undecided, see previous undecided hunk\n"
-"K - leave this hunk undecided, see previous hunk\n"
-"s - split the current hunk into smaller hunks\n"
-"e - manually edit the current hunk\n"
-"? - print help\n"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid "The selected hunks do not apply to the index!\n"
-msgstr ""
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "ignoring unmerged: %s\n"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid "No other hunks to goto\n"
-msgstr ""
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "Invalid number: '%s'\n"
-msgstr ""
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "Sorry, only %d hunk available.\n"
-msgid_plural "Sorry, only %d hunks available.\n"
-msgstr[0] ""
-msgstr[1] ""
-
-#: git-add--interactive.perl
-msgid "No other hunks to search\n"
-msgstr ""
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "Malformed search regexp %s: %s\n"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid "No hunk matches the given pattern\n"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid "No previous hunk\n"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid "No next hunk\n"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid "Sorry, cannot split this hunk\n"
-msgstr ""
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "Split into %d hunk.\n"
-msgid_plural "Split into %d hunks.\n"
-msgstr[0] ""
-msgstr[1] ""
-
-#: git-add--interactive.perl
-msgid "Sorry, cannot edit this hunk\n"
-msgstr ""
-
-#. TRANSLATORS: please do not translate the command names
-#. 'status', 'update', 'revert', etc.
-#: git-add--interactive.perl
-msgid ""
-"status - show paths with changes\n"
-"update - add working tree state to the staged set of changes\n"
-"revert - revert staged set of changes back to the HEAD version\n"
-"patch - pick hunks and update selectively\n"
-"diff - view diff between HEAD and index\n"
-"add untracked - add contents of untracked files to the staged set of "
-"changes\n"
-msgstr ""
-
-#: git-add--interactive.perl
-msgid "missing --"
-msgstr ""
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "unknown --patch mode: %s"
-msgstr ""
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "invalid argument %s, expecting --"
-msgstr ""
-
#: git-send-email.perl
msgid "local zone differs from GMT by a non-minute interval\n"
msgstr "zona lokal berbeda dari GMT oleh selang non-menit\n"
diff --git a/po/sv.po b/po/sv.po
index 825142fde7..0ba8585b76 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -1,14 +1,14 @@
# Swedish translations for Git.
-# Copyright (C) 2010-2022 Peter Krefting <peter@softwolves.pp.se>
+# Copyright (C) 2010-2023 Peter Krefting <peter@softwolves.pp.se>
# This file is distributed under the same license as the Git package.
-# Peter Krefting <peter@softwolves.pp.se>, 2010-2022.
+# Peter Krefting <peter@softwolves.pp.se>, 2010-2023.
#
msgid ""
msgstr ""
-"Project-Id-Version: git 2.38.0\n"
+"Project-Id-Version: git 2.40.0\n"
"Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2022-09-26 06:34+0100\n"
-"PO-Revision-Date: 2022-09-26 06:35+0100\n"
+"POT-Creation-Date: 2023-03-02 09:34+0100\n"
+"PO-Revision-Date: 2023-03-02 09:35+0100\n"
"Last-Translator: Peter Krefting <peter@softwolves.pp.se>\n"
"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
"Language: sv\n"
@@ -44,13 +44,13 @@ msgstr "kunde inte köa \"%s\""
msgid "could not write index"
msgstr "kunde inte skriva indexet"
-#, c-format, perl-format
+#, c-format
msgid "updated %d path\n"
msgid_plural "updated %d paths\n"
msgstr[0] "uppdaterade %d sökväg\n"
msgstr[1] "uppdaterade %d sökvägar\n"
-#, c-format, perl-format
+#, c-format
msgid "note: %s is untracked now.\n"
msgstr "observera: %s spåras inte längre.\n"
@@ -64,7 +64,7 @@ msgstr "Återställ"
msgid "Could not parse HEAD^{tree}"
msgstr "kunde inte tolka HEAD^{tree}"
-#, c-format, perl-format
+#, c-format
msgid "reverted %d path\n"
msgid_plural "reverted %d paths\n"
msgstr[0] "återställde %d sökväg\n"
@@ -77,7 +77,7 @@ msgstr "Inga ospårade filer.\n"
msgid "Add untracked"
msgstr "Lägg till ospårad"
-#, c-format, perl-format
+#, c-format
msgid "added %d path\n"
msgid_plural "added %d paths\n"
msgstr[0] "lade till %d sökväg\n"
@@ -171,19 +171,19 @@ msgstr "kunde inte uppdatera indexet"
msgid "Bye.\n"
msgstr "Hej då.\n"
-#, c-format, perl-format
+#, c-format
msgid "Stage mode change [y,n,q,a,d%s,?]? "
msgstr "Köa ändrat läge [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage deletion [y,n,q,a,d%s,?]? "
msgstr "Köa borttagning [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage addition [y,n,q,a,d%s,?]? "
msgstr "Köa tillägg [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage this hunk [y,n,q,a,d%s,?]? "
msgstr "Köa stycket [y,n,q,a,d%s,?]? "
@@ -207,19 +207,19 @@ msgstr ""
"a - köa stycket och alla följande i filen\n"
"d - köa inte stycket eller något av de följande i filen\n"
-#, c-format, perl-format
+#, c-format
msgid "Stash mode change [y,n,q,a,d%s,?]? "
msgstr "Stash:a ändrat läge [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash deletion [y,n,q,a,d%s,?]? "
msgstr "Stash:a borttagning [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash addition [y,n,q,a,d%s,?]? "
msgstr "Stash:a tillägg [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash this hunk [y,n,q,a,d%s,?]? "
msgstr "Stash:a stycket [y,n,q,a,d%s,?]? "
@@ -243,19 +243,19 @@ msgstr ""
"a - \"stash\":a stycket och alla följande i filen\n"
"d - \"stash\":a inte stycket eller något av de följande i filen\n"
-#, c-format, perl-format
+#, c-format
msgid "Unstage mode change [y,n,q,a,d%s,?]? "
msgstr "Ta bort ändrat läge från kön [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage deletion [y,n,q,a,d%s,?]? "
msgstr "Ta bort borttagning från kön [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage addition [y,n,q,a,d%s,?]? "
msgstr "Ta bort tillägg från kön [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage this hunk [y,n,q,a,d%s,?]? "
msgstr "Ta bort stycket från kön [y,n,q,a,d%s,?]? "
@@ -279,19 +279,19 @@ msgstr ""
"a - ta bort stycket och alla följande i filen från kön\n"
"d - ta inte bort stycket eller något av de följande i filen från kön\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to index [y,n,q,a,d%s,?]? "
msgstr "Applicera ändrat läge på indexet [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to index [y,n,q,a,d%s,?]? "
msgstr "Applicera borttagning på indexet [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to index [y,n,q,a,d%s,?]? "
msgstr "Applicera tillägg på indexet [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to index [y,n,q,a,d%s,?]? "
msgstr "Applicera stycket på indexet [y,n,q,a,d%s,?]? "
@@ -315,19 +315,19 @@ msgstr ""
"a - applicera stycket och alla följande i filen\n"
"d - applicera inte stycket eller något av de följande i filen\n"
-#, c-format, perl-format
+#, c-format
msgid "Discard mode change from worktree [y,n,q,a,d%s,?]? "
msgstr "Kasta ändrat läge från arbetskatalogen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard deletion from worktree [y,n,q,a,d%s,?]? "
msgstr "Kasta borttagning från arbetskatalogen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard addition from worktree [y,n,q,a,d%s,?]? "
msgstr "Kasta tillägg från arbetskatalogen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard this hunk from worktree [y,n,q,a,d%s,?]? "
msgstr "Kasta stycket från arbetskatalogen [y,n,q,a,d%s,?]? "
@@ -351,19 +351,19 @@ msgstr ""
"a - förkasta stycket och alla följande i filen\n"
"d - förkasta inte stycket eller något av de följande i filen\n"
-#, c-format, perl-format
+#, c-format
msgid "Discard mode change from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Kasta ändrat läge från indexet och arbetskatalogen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard deletion from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Kasta borttagning från indexet och arbetskatalogen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard addition from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Kasta tillägg från indexet och arbetskatalogen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard this hunk from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Kasta stycket från indexet och arbetskatalogen [y,n,q,a,d%s,?]? "
@@ -380,19 +380,19 @@ msgstr ""
"a - förkasta stycket och alla följande i filen\n"
"d - förkasta inte stycket eller något av de följande i filen\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Applicera ändrat läge på indexet och arbetskatalogen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Applicera borttagning på indexet och arbetskatalogen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Applicera tillägg på indexet och arbetskatalogen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Applicera stycket på indexet och arbetskatalogen [y,n,q,a,d%s,?]? "
@@ -409,19 +409,19 @@ msgstr ""
"a - applicera stycket och alla följande i filen\n"
"d - applicera inte stycket eller något av de följande i filen\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to worktree [y,n,q,a,d%s,?]? "
msgstr "Applicera ändrat läge på arbetskatalogen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to worktree [y,n,q,a,d%s,?]? "
msgstr "Applicera borttagning på arbetskatalogen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to worktree [y,n,q,a,d%s,?]? "
msgstr "Applicera tillägg på arbetskatalogen [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to worktree [y,n,q,a,d%s,?]? "
msgstr "Applicera stycket på arbetskatalogen [y,n,q,a,d%s,?]? "
@@ -497,8 +497,6 @@ msgstr ""
"Ta bort \"%c\" rader genom att radera dem.\n"
"Rader som börjar med %c kommer att tas bort.\n"
-#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
-#. TRANSLATORS: 'it' refers to the patch mentioned in the previous messages.
msgid ""
"If it does not apply cleanly, you will be given an opportunity to\n"
"edit again. If all lines of the hunk are removed, then the edit is\n"
@@ -514,20 +512,12 @@ msgstr "kunde inte tolka styckehuvud"
msgid "'git apply --cached' failed"
msgstr "\"git apply --cached\" misslyckades"
-#. #-#-#-#-# add-patch.c.po #-#-#-#-#
#. TRANSLATORS: do not translate [y/n]
#. The program will only accept that input at this point.
#. Consider translating (saying "no" discards!) as
#. (saying "n" for "no" discards!) if the translation
#. of the word "no" does not start with n.
#.
-#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
-#. TRANSLATORS: do not translate [y/n]
-#. The program will only accept that input
-#. at this point.
-#. Consider translating (saying "no" discards!) as
-#. (saying "n" for "no" discards!) if the translation
-#. of the word "no" does not start with n.
msgid ""
"Your edited hunk does not apply. Edit again (saying \"no\" discards!) [y/n]? "
msgstr ""
@@ -764,6 +754,9 @@ msgstr "kommandorad avslutas med \\"
msgid "unclosed quote"
msgstr "citat ej stängt"
+msgid "too many arguments"
+msgstr "för många argument"
+
#, c-format
msgid "unrecognized whitespace option '%s'"
msgstr "okänt alternativ för whitespace: \"%s\""
@@ -1371,6 +1364,12 @@ msgstr "läs .gitattributes i arbetskatalogen"
msgid "report archived files on stderr"
msgstr "rapportera arkiverade filer på standard fel"
+msgid "time"
+msgstr "tid"
+
+msgid "set modification time of archive entries"
+msgstr "välj modifieringstid för arkivposter"
+
msgid "set compression level"
msgstr "välj komprimeringsgrad"
@@ -1411,6 +1410,13 @@ msgstr "Argumentet stöd inte för formatet \"%s\": -%d"
msgid "%.*s is not a valid attribute name"
msgstr "%-*s är inte ett giltigt namn på attribut"
+msgid "unable to add additional attribute"
+msgstr "Kunde inte lägga till ytterligare attribut"
+
+#, c-format
+msgid "ignoring overly long attributes line %d"
+msgstr "ignorerar överlång attributrad %d"
+
#, c-format
msgid "%s not allowed: %s:%d"
msgstr "%s inte tillåtet: %s:%d"
@@ -1423,6 +1429,18 @@ msgstr ""
"Använd '\\!' för att inleda med ett utropstecken."
#, c-format
+msgid "cannot fstat gitattributes file '%s'"
+msgstr "kan inte utföra fstat på gitattributes-filen \"%s\""
+
+#, c-format
+msgid "ignoring overly large gitattributes file '%s'"
+msgstr "ignorerar allt för stor gitattributes-fil \"%s\""
+
+#, c-format
+msgid "ignoring overly large gitattributes blob '%s'"
+msgstr "ignorerar allt för stor gitattributes-objekt \"%s\""
+
+#, c-format
msgid "Badly quoted content in file '%s': %s"
msgstr "Felaktigt citerat innehåll i filen \"%s\": %s"
@@ -1699,11 +1717,11 @@ msgstr "undermodulen \"%s\": kan inte hitta undermodulen"
#, c-format
msgid ""
-"You may try updating the submodules using 'git checkout %s && git submodule "
-"update --init'"
+"You may try updating the submodules using 'git checkout --no-recurse-"
+"submodules %s && git submodule update --init'"
msgstr ""
-"Du kan försöka uppdatera undermodulerna med \"git checkout %s && git "
-"submodule update --init\""
+"Du kan försöka uppdatera undermodulerna med \"git checkout --no-recurse-"
+"submodules %s && git submodule update --init\""
#, c-format
msgid "submodule '%s': cannot create branch '%s'"
@@ -1738,6 +1756,13 @@ msgstr "ta bort \"%s\"\n"
msgid "Unstaged changes after refreshing the index:"
msgstr "Oköade ändringar efter att ha uppdaterat indexet:"
+msgid ""
+"the add.interactive.useBuiltin setting has been removed!\n"
+"See its entry in 'git help config' for details."
+msgstr ""
+"inställningen add.interactive.useBuiltin har tagits bort!\n"
+"Se dess post i \"git help config\" för detaljer."
+
msgid "Could not read the index"
msgstr "Kunde inte läsa indexet"
@@ -2122,6 +2147,9 @@ msgstr "git am [<flaggor>] (--continue | --skip | --abort)"
msgid "run interactively"
msgstr "kör interaktivt"
+msgid "bypass pre-applypatch and applypatch-msg hooks"
+msgstr "förbigå pre-applypatch- och applypatch-msg-krokar"
+
msgid "historical option -- no-op"
msgstr "historisk flagga -- no-op"
@@ -2262,32 +2290,27 @@ msgstr "git archive: protokollfel"
msgid "git archive: expected a flush"
msgstr "git archive: förväntade en tömning (flush)"
-msgid "git bisect--helper --bisect-reset [<commit>]"
-msgstr "git bisect--helper --bisect-reset [<incheckning>]"
-
msgid ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}"
-"=<term>] [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] "
-"[<paths>...]"
+"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>] [--no-"
+"checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]"
msgstr ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}"
-"=<term>] [--no-checkout] [--first-parent] [<dålig> [<bra>...]] [--] "
-"[<sökvägar>...]"
+"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>] [--no-"
+"checkout] [--first-parent] [<dålig> [<bra>...]] [--] [<sökvägar>...]"
-msgid "git bisect--helper --bisect-state (bad|new) [<rev>]"
-msgstr "git bisect--helper --bisect-state (bad|new) [<incheckning>]"
+msgid "git bisect (good|bad) [<rev>...]"
+msgstr "git bisect (good|bad) [<incheckning>...]"
-msgid "git bisect--helper --bisect-state (good|old) [<rev>...]"
-msgstr "git bisect--helper --bisect-state (good|old) [<incheckning>...]"
+msgid "git bisect skip [(<rev>|<range>)...]"
+msgstr "git bisect skip [(<incheckning>|<intervall>)...]"
-msgid "git bisect--helper --bisect-replay <filename>"
-msgstr "git bisect--helper --bisect-replay <filnamn>"
+msgid "git bisect reset [<commit>]"
+msgstr "git bisect reset [<incheckning>]"
-msgid "git bisect--helper --bisect-skip [(<rev>|<range>)...]"
-msgstr "git bisect--helper --bisect-skip [(<incheckning>|<intervall>)...]"
+msgid "git bisect replay <logfile>"
+msgstr "git bisect replay <loggfil>"
-msgid "git bisect--helper --bisect-run <cmd>..."
-msgstr "git bisect--helper --bisect-run <kommando>..."
+msgid "git bisect run <cmd>..."
+msgstr "git bisect run <kommando>..."
#, c-format
msgid "cannot open file '%s' in mode '%s'"
@@ -2433,10 +2456,6 @@ msgid "checking out '%s' failed. Try 'git bisect start <valid-branch>'."
msgstr ""
"misslyckades checka ut \"%s\". Försök \"git bisect reset <giltig_gren>\"."
-# cogito-relaterat
-msgid "won't bisect on cg-seek'ed tree"
-msgstr "kör inte \"bisect\" på träd där \"cg-seek\" använts"
-
msgid "bad HEAD - strange symbolic ref"
msgstr "felaktigt HEAD - konstig symbolisk referens"
@@ -2488,17 +2507,17 @@ msgid "bisect run failed: no command provided."
msgstr "bisect-körning misslyckades: inget kommando gavs."
#, c-format
-msgid "unable to verify '%s' on good revision"
-msgstr "kan inte bekräfta \"%s\" på bra revision"
+msgid "unable to verify %s on good revision"
+msgstr "kan inte bekräfta %s på bra revision"
#, c-format
msgid "bogus exit code %d for good revision"
msgstr "falsk slutkod %d för bra revision"
#, c-format
-msgid "bisect run failed: exit code %d from '%s' is < 0 or >= 128"
+msgid "bisect run failed: exit code %d from %s is < 0 or >= 128"
msgstr ""
-"\"bisect\"-körningen misslyckades: felkod %d från \"%s\" är < 0 eller >= 128"
+"\"bisect\"-körningen misslyckades: felkod %d från %s är < 0 eller >= 128"
#, c-format
msgid "cannot open file '%s' for writing"
@@ -2507,76 +2526,50 @@ msgstr "kan inte öppna \"%s\" för skrivning"
msgid "bisect run cannot continue any more"
msgstr "\"bisect\"-körningen kan inte fortsätta längre"
-#, c-format
msgid "bisect run success"
msgstr "\"bisect\"-körningen lyckades"
-#, c-format
msgid "bisect found first bad commit"
msgstr "bisect hittade första trasiga incheckning"
#, c-format
-msgid ""
-"bisect run failed: 'git bisect--helper --bisect-state %s' exited with error "
-"code %d"
+msgid "bisect run failed: 'git bisect %s' exited with error code %d"
msgstr ""
-"\"bisect\"-körningen misslyckades: \"git bisect--helper --bisect-state %s\" "
-"avslutades med felkoden %d"
-
-msgid "reset the bisection state"
-msgstr "återställ bisect-tillstånd"
-
-msgid "check whether bad or good terms exist"
-msgstr "se efter om termer för rätt och fel finns"
-
-msgid "print out the bisect terms"
-msgstr "skriv ut termer för bisect"
+"\"bisect\"-körningen misslyckades: \"git bisect %s\" avslutades med felkoden "
+"%d"
-msgid "start the bisect session"
-msgstr "påbörja bisect-körningen"
-
-msgid "find the next bisection commit"
-msgstr "hitta nästa incheckning i bisect"
-
-msgid "mark the state of ref (or refs)"
-msgstr "markera tillståndet för en eller flera referenser"
-
-msgid "list the bisection steps so far"
-msgstr "lista \"bisect\"-stegen som utförts så långt"
-
-msgid "replay the bisection process from the given file"
-msgstr "spela upp \"bisect\"-processen från angiven fil"
-
-msgid "skip some commits for checkout"
-msgstr "hoppa över ett par incheckningar"
-
-msgid "visualize the bisection"
-msgstr "visualisera \"bisect\"-körningen"
-
-msgid "use <cmd>... to automatically bisect"
-msgstr "använd <kommando>... för att utföra \"bisect\" automatiskt"
+#, c-format
+msgid "'%s' requires either no argument or a commit"
+msgstr "\"%s\" kräver antingen inget argument eller en incheckning"
-msgid "no log for BISECT_WRITE"
-msgstr "ingen logg för BISECT_WRITE"
+#, c-format
+msgid "'%s' requires 0 or 1 argument"
+msgstr "\"%s\" kräver noll eller ett argument"
-msgid "--bisect-reset requires either no argument or a commit"
-msgstr "--bisect-reset kräver antingen inget argument eller en incheckning"
+#, c-format
+msgid "'%s' requires 0 arguments"
+msgstr "\"%s\" kräver noll argument"
-msgid "--bisect-terms requires 0 or 1 argument"
-msgstr "--bisect-terms kräver noll eller ett argument"
+msgid "no logfile given"
+msgstr "ingen loggfil angiven"
-msgid "--bisect-next requires 0 arguments"
-msgstr "--bisect-next kräver 0 argument"
+#, c-format
+msgid "'%s' failed: no command provided."
+msgstr "\"%s\" misslyckades: inget kommando gavs."
-msgid "--bisect-log requires 0 arguments"
-msgstr "--bisect-log kräver 0 argument"
+msgid "need a command"
+msgstr "behöver ett kommando"
-msgid "no logfile given"
-msgstr "ingen loggfil angiven"
+#, c-format
+msgid "unknown command: '%s'"
+msgstr "okänt kommando: \"%s\""
msgid "git blame [<options>] [<rev-opts>] [<rev>] [--] <file>"
msgstr "git blame [<flaggor>] [<rev-flaggor>] [<rev>] [--] <fil>"
+msgid "git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>"
+msgstr "git annotate [<flaggor>] [<rev-flaggor>] [<rev>] [--] <fil>"
+
msgid "<rev-opts> are documented in git-rev-list(1)"
msgstr "<rev-flaggor> dokumenteras i git-rev-list(1)"
@@ -2763,9 +2756,6 @@ msgstr "Misslyckades uppdatera konfigurationsfil"
msgid "cannot use -a with -d"
msgstr "kan inte ange -a med -d"
-msgid "Couldn't look up commit object for HEAD"
-msgstr "Kunde inte slå upp incheckningsobjekt för HEAD"
-
#, c-format
msgid "Cannot delete branch '%s' checked out at '%s'"
msgstr "Kan inte ta bort grenen \"%s\" som är utcheckad på \"%s\""
@@ -2804,17 +2794,18 @@ msgstr "Grenen %s ombaseras på %s"
msgid "Branch %s is being bisected at %s"
msgstr "Grenen %s är i en \"bisect\" på %s"
-msgid "cannot copy the current branch while not on any."
-msgstr "kunde inte kopiera aktuell gren när du inte befinner dig på någon."
-
-msgid "cannot rename the current branch while not on any."
-msgstr ""
-"kunde inte byta namn på aktuell gren när du inte befinner dig på någon."
-
#, c-format
msgid "Invalid branch name: '%s'"
msgstr "Felaktigt namn på gren: \"%s\""
+#, c-format
+msgid "No commit on branch '%s' yet."
+msgstr "Inga incheckningar på grenen \"%s\" ännu."
+
+#, c-format
+msgid "No branch named '%s'."
+msgstr "Ingen gren vid namnet \"%s\"."
+
msgid "Branch rename failed"
msgstr "Misslyckades byta namn på gren"
@@ -2962,7 +2953,7 @@ msgstr ""
"propagateBranches har aktiverats"
msgid "--recurse-submodules can only be used to create branches"
-msgstr "--recurse-submodules jan endast användas för att skapa grenar"
+msgstr "--recurse-submodules kan endast användas för att skapa grenar"
msgid "branch name required"
msgstr "grennamn krävs"
@@ -2973,13 +2964,12 @@ msgstr "Kan inte beskriva frånkopplad HEAD"
msgid "cannot edit description of more than one branch"
msgstr "kan inte redigera beskrivning för mer än en gren"
-#, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "Inga incheckningar på grenen \"%s\" ännu."
+msgid "cannot copy the current branch while not on any."
+msgstr "kunde inte kopiera aktuell gren när du inte befinner dig på någon."
-#, c-format
-msgid "No branch named '%s'."
-msgstr "Ingen gren vid namnet \"%s\"."
+msgid "cannot rename the current branch while not on any."
+msgstr ""
+"kunde inte byta namn på aktuell gren när du inte befinner dig på någon."
msgid "too many branches for a copy operation"
msgstr "för många grenar för kopiering"
@@ -3046,11 +3036,11 @@ msgid "not run from a git repository - no hooks to show\n"
msgstr "körs inte från ett git-arkiv - inga krokar att visa\n"
msgid ""
-"git bugreport [-o|--output-directory <file>] [-s|--suffix <format>] [--"
-"diagnose[=<mode>]"
+"git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--diagnose[=<mode>]]"
msgstr ""
-"git bugreport [-o|--output-directory <fil>] [-s|--suffix <format>] [--"
-"diagnose[=<läge>]"
+"git bugreport [(-o | --output-directory) <fil>] [(-s | --suffix) <format>]\n"
+" [--diagnose[=<läge>]"
msgid ""
"Thank you for filling out a Git bug report!\n"
@@ -3124,17 +3114,26 @@ msgstr "kunde inte skriva till %s"
msgid "Created new report at '%s'.\n"
msgstr "Skapade ny rapport på \"%s\"\n"
-msgid "git bundle create [<options>] <file> <git-rev-list args>"
-msgstr "git bundle create [<flaggor>] <fil> <git-rev-list-flaggor>"
+msgid ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<version>] <file> <git-rev-list-args>"
+msgstr ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<version>] <fil> <git-rev-list-flaggor>"
-msgid "git bundle verify [<options>] <file>"
-msgstr "git bundle verify [<flaggor>] <fil>"
+msgid "git bundle verify [-q | --quiet] <file>"
+msgstr "git bundle verify [-q | --quiet] <fil>"
msgid "git bundle list-heads <file> [<refname>...]"
msgstr "git bundle list-heads <fil> [<refnamn>...]"
-msgid "git bundle unbundle <file> [<refname>...]"
-msgstr "git bundle unbundle <fil> [<refnamn>...]"
+msgid "git bundle unbundle [--progress] <file> [<refname>...]"
+msgstr "git bundle unbundle [--progress] <fil> [<refnamn>...]"
+
+msgid "need a <file> argument"
+msgstr "behöver ett <fil>-argument"
msgid "do not show progress meter"
msgstr "visa inte förloppsindikator"
@@ -3189,10 +3188,6 @@ msgstr "%s kräver ett argument"
msgid "%s takes no arguments"
msgstr "%s tar inget argument"
-#, c-format
-msgid "unknown command: '%s'"
-msgstr "okänt kommando: \"%s\""
-
msgid "only one batch option may be specified"
msgstr "endast en buntflagga kan anges"
@@ -3209,12 +3204,12 @@ msgid ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgstr ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgid ""
"git cat-file (--textconv | --filters)\n"
@@ -3323,18 +3318,21 @@ msgstr "<rev> krävs med \"%s\""
msgid "<object> required with '-%c'"
msgstr "<objekt> krävs med \"-%c\""
-msgid "too many arguments"
-msgstr "för många argument"
-
#, c-format
msgid "only two arguments allowed in <type> <object> mode, not %d"
msgstr "endast två argument krävs i <typ> <objekt>-läge, inte %d"
-msgid "git check-attr [-a | --all | <attr>...] [--] <pathname>..."
-msgstr "git check-attr [-a | --all | <attr>...] [--] <sökväg>..."
+msgid ""
+"git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] "
+"<pathname>..."
+msgstr ""
+"git check-attr [--source <träd:igt>] [-a | --all | <attr>...] [--] "
+"<sökväg>..."
-msgid "git check-attr --stdin [-z] [-a | --all | <attr>...]"
-msgstr "git check-attr --stdin [-z] [-a | --all | <attr>...]"
+msgid ""
+"git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]"
+msgstr ""
+"git check-attr --stdin [-z] [--source <träd:igt>] [-a | --all | <attr>...]"
msgid "report all attributes set on file"
msgstr "visa alla attribut som satts på filen"
@@ -3348,6 +3346,12 @@ msgstr "läs filnamn från standard in"
msgid "terminate input and output records by a NUL character"
msgstr "avsluta in- och utdataposter med NUL-tecken"
+msgid "<tree-ish>"
+msgstr "<träd-igt>"
+
+msgid "which tree-ish to check attributes at"
+msgstr "vilken träd-igt att kontrollera attribut på"
+
msgid "suppress progress reporting"
msgstr "undertryck förloppsrapportering"
@@ -3858,10 +3862,10 @@ msgid "use overlay mode"
msgstr "använd överläggsläge"
msgid ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] "
+"[<pathspec>...]"
msgstr ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <mönster>] [-x | -X] [--] "
-"<sökvägar>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <mönster>] [-x | -X] [--] <sökväg>..."
#, c-format
msgid "Removing %s\n"
@@ -3925,7 +3929,7 @@ msgstr ""
"* - välj alla poster\n"
" - (tomt) avsluta markering\n"
-#, c-format, perl-format
+#, c-format
msgid "Huh (%s)?\n"
msgstr "Vadå (%s)?\n"
@@ -4074,9 +4078,6 @@ msgstr "djup"
msgid "create a shallow clone of that depth"
msgstr "skapa en grund klon på detta djup"
-msgid "time"
-msgstr "tid"
-
msgid "create a shallow clone since a specific time"
msgstr "skapa en grund klon från en angiven tidpunkt"
@@ -4151,6 +4152,10 @@ msgid "failed to start iterator over '%s'"
msgstr "misslyckades starta iterator över \"%s\""
#, c-format
+msgid "symlink '%s' exists, refusing to clone with --local"
+msgstr "symbolisk länk \"%s\" finns redan, vägrar klona med --local"
+
+#, c-format
msgid "failed to unlink '%s'"
msgstr "misslyckades ta bort länken \"%s\""
@@ -4214,10 +4219,6 @@ msgstr "För många argument."
msgid "You must specify a repository to clone."
msgstr "Du måste ange ett arkiv att klona."
-#, c-format
-msgid "options '%s' and '%s %s' cannot be used together"
-msgstr "flaggorna \"%s\" och \"%s %s\" kan inte användas samtidigt"
-
msgid ""
"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
"exclude"
@@ -4303,6 +4304,9 @@ msgstr "misslyckades initiera arkivet, hoppar över bunt-URI"
msgid "failed to fetch objects from bundle URI '%s'"
msgstr "misslyckades hämta objekt från bunt-URI \"%s\""
+msgid "failed to fetch advertised bundles"
+msgstr "misslyckades hämta annonserade buntar"
+
msgid "remote transport reported error"
msgstr "fjärrtransport rapporterade fel"
@@ -4338,18 +4342,24 @@ msgid "--command must be the first argument"
msgstr "--command måste vara första argument"
msgid ""
-"git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"
+"git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]"
msgstr ""
-"git commit-graph verify [--object-dir <objkat>] [--shallow] [--[no-]progress]"
+"git commit-graph verify [--object-dir <kat>] [--shallow] [--[no-]progress]"
msgid ""
-"git commit-graph write [--object-dir <objdir>] [--append] [--"
-"split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] <split options>"
+"git commit-graph write [--object-dir <dir>] [--append]\n"
+" [--split[=<strategy>]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <split options>"
msgstr ""
-"git commit-graph write [--object-dir <objkat>] [--append] [--"
-"split[=<strategi>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] <delnings-flaggor>"
+"git commit-graph write [--object-dir <kat>] [--append]\n"
+" [--split[=<strategi>]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <delnings-flaggor>"
msgid "dir"
msgstr "kat"
@@ -4417,12 +4427,16 @@ msgstr "använd som mest en av --reachable, --stdin-commits och --stdin-packs"
msgid "Collecting commits from input"
msgstr "Hämtar incheckningar från indata"
+msgid "git commit-tree <tree> [(-p <parent>)...]"
+msgstr "git commit-tree <träd> [(-p <förälder>)...]"
+
msgid ""
-"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...] [(-F "
-"<file>)...] <tree>"
+"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n"
+" [(-F <file>)...] <tree>"
msgstr ""
-"git commit-tree [(-p <föräldrer>)...] [-S[<nyckelid>]] [(-m "
-"<meddelande>)...] [(-F <fil>)...] <träd>"
+"git commit-tree [(-p <förälder>)...] [-S[<nyckelid>]] [(-m "
+"<meddelande>)...]\n"
+" [(-F <fil>)...] <träd>"
#, c-format
msgid "duplicate parent %s ignored"
@@ -4464,10 +4478,29 @@ msgstr "måste ange exakt ett träd"
msgid "git commit-tree: failed to read"
msgstr "git commit-tree: misslyckades läsa"
-msgid "git commit [<options>] [--] <pathspec>..."
-msgstr "git commit [<flaggor>] [--] <sökväg>..."
-
-msgid "git status [<options>] [--] <pathspec>..."
+msgid ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|"
+"reword):]<commit>)]\n"
+" [-F <file> | -m <msg>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n"
+" [--date=<date>] [--cleanup=<mode>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<läge>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <incheckning> | --fixup [(amend|"
+"reword):]<incheckning>)]\n"
+" [-F <fil> | -m <medd>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--"
+"author=<författare>]\n"
+" [--date=<datum>] [--cleanup=<läge>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<fil> [--pathspec-file-nul]]\n"
+" [(--trailer <symbol>[(=|:)<värde>])...] [-S[<nyckel-id>]]\n"
+" [--] [<sökväg>...]"
+
+msgid "git status [<options>] [--] [<pathspec>...]"
msgstr "git status [<flaggor>] [--] <sökväg>..."
msgid ""
@@ -5233,11 +5266,19 @@ msgstr "\"credential-cache\" ej tillgänglig; stöd för unix-uttag saknas"
msgid "unable to get credential storage lock in %d ms"
msgstr "kunde inte erhålla låset för lagring av inlogginsuppgifter på %d ms"
-msgid "git describe [<options>] [<commit-ish>...]"
-msgstr "git describe [<flaggor>] [<incheckning-igt>...]"
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]"
+msgstr ""
+"git describe [--all] [--tag] [--contains] [--abbrev=<n>] [<incheckning-"
+"igt>...]"
+
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<märke>]"
-msgid "git describe [<options>] --dirty"
-msgstr "git describe [<flaggor>] --dirty"
+msgid "git describe <blob>"
+msgstr "git describe <objekt>"
msgid "head"
msgstr "huvud"
@@ -5359,11 +5400,12 @@ msgid "option '%s' and commit-ishes cannot be used together"
msgstr "flaggorna \"%s\" och incheckning-igter kan inte användas samtidigt"
msgid ""
-"git diagnose [-o|--output-directory <path>] [-s|--suffix <format>] [--"
-"mode=<mode>]"
+"git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--mode=<mode>]"
msgstr ""
-"git diagnose [-o|--output-directory <sökväg>] [-s|--suffix <format>] [--"
-"mode=<läge>]"
+"git diagnose [(-o | --output-directory) <sökväg>] [(-s | --suffix) "
+"<format>]\n"
+" [--mode=<läge>]"
msgid "specify a destination for the diagnostics archive"
msgstr "ange mål för diagnostikarkivet"
@@ -5381,6 +5423,9 @@ msgstr "--merge-base fungerar endast med två incheckningar"
msgid "'%s': not a regular file or symlink"
msgstr "\"%s\": inte en normal fil eller symbolisk länk"
+msgid "no merge given, only parents."
+msgstr "ingen sammanslagning angiven, endast föräldrar."
+
#, c-format
msgid "invalid option: %s"
msgstr "ogiltig flagga: %s"
@@ -5496,29 +5541,6 @@ msgstr "inget <verktyg> angavs för --tool=<verktyg>"
msgid "no <cmd> given for --extcmd=<cmd>"
msgstr "inget <kommando> angavs för --extcmd=<kommando>"
-msgid "git env--helper --type=[bool|ulong] <options> <env-var>"
-msgstr "git env--helper --type=[bool|ulong] <flaggor> <miljövariabel>"
-
-msgid "default for git_env_*(...) to fall back on"
-msgstr "standard för git_env_*(...) att falla tillbaka på"
-
-msgid "be quiet only use git_env_*() value as exit code"
-msgstr "var tyst, använd bara git_env_*() som resultatvärde"
-
-#, c-format
-msgid "option `--default' expects a boolean value with `--type=bool`, not `%s`"
-msgstr ""
-"flaggan \"--default\" förväntar ett sanningsvärde med \"--type=bool\", inte "
-"\"%s\""
-
-#, c-format
-msgid ""
-"option `--default' expects an unsigned long value with `--type=ulong`, not `"
-"%s`"
-msgstr ""
-"flaggan \"--default\" förväntar ett teckenlöst långt värde med \"--type=ulong"
-"\", inte \"%s\""
-
msgid "git fast-export [<rev-list-opts>]"
msgstr "git fast-export [<rev-list-flaggor>]"
@@ -5911,6 +5933,10 @@ msgstr "negativa djup stöds inte i --deepen"
msgid "--unshallow on a complete repository does not make sense"
msgstr "--unshallow kan inte användas på ett komplett arkiv"
+#, c-format
+msgid "failed to fetch bundles from '%s'"
+msgstr "misslyckades hämta buntar från \"%s\""
+
msgid "fetch --all does not take a repository argument"
msgstr "fetch --all tar inte namnet på ett arkiv som argument"
@@ -6013,8 +6039,8 @@ msgstr "visa endast referenser som innehåller incheckningen"
msgid "print only refs which don't contain the commit"
msgstr "visa endast referenser som inte innehåller incheckningen"
-msgid "git for-each-repo --config=<config> <command-args>"
-msgstr "git for-each-repo --config=<konfig> <kommandoargument>"
+msgid "git for-each-repo --config=<config> [--] <arguments>"
+msgstr "git for-each-repo --config=<konfig> [--] <argument>"
msgid "config"
msgstr "konfig"
@@ -6189,8 +6215,16 @@ msgstr "icke-träd i cacheträd"
msgid "%s: invalid sha1 pointer in resolve-undo"
msgstr "%s: ogiltig sha1-pekare i resolve-undo"
-msgid "git fsck [<options>] [<object>...]"
-msgstr "git fsck [<flaggor>] [<objekt>...]"
+msgid ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<object>...]"
+msgstr ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<objekt>...]"
msgid "show unreachable objects"
msgstr "visa onåbara objekt"
@@ -6247,12 +6281,6 @@ msgstr "git fsmonitor--daemon start [<flaggor>]"
msgid "git fsmonitor--daemon run [<options>]"
msgstr "git fsmonitor--daemon run [<flaggor>]"
-msgid "git fsmonitor--daemon stop"
-msgstr "git fsmonitor--daemon stop"
-
-msgid "git fsmonitor--daemon status"
-msgstr "git fsmonitor--daemon status"
-
#, c-format
msgid "value of '%s' out of range: %d"
msgstr "värdet för \"%s\" utanför intervallet: %d"
@@ -6494,8 +6522,20 @@ msgstr "utför en specifik uppgift"
msgid "use at most one of --auto and --schedule=<frequency>"
msgstr "använd som mest en av --auto och --schedule=<frekvens>"
-msgid "failed to run 'git config'"
-msgstr "misslyckades köra \"git config\""
+#, c-format
+msgid "unable to add '%s' value of '%s'"
+msgstr "kan inte lägga till \"%s\"-värdet för \"%s\""
+
+msgid "return success even if repository was not registered"
+msgstr "returnera framgång även om arkivet inte var registrerat"
+
+#, c-format
+msgid "unable to unset '%s' value of '%s'"
+msgstr "kan inte ta bort \"%s\"-värdet för \"%s\""
+
+#, c-format
+msgid "repository '%s' is not registered"
+msgstr "arkivet \"%s\" har inte registrerats"
#, c-format
msgid "failed to expand path '%s'"
@@ -6783,11 +6823,14 @@ msgid "both --cached and trees are given"
msgstr "både --cached och träd angavs"
msgid ""
-"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters] [--stdin] "
-"[--] <file>..."
+"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]\n"
+" [--stdin [--literally]] [--] <file>..."
msgstr ""
-"git hash-object [-t <typ>] [-w] [--path=<fil> | --no-filters] [--stdin] [--] "
-"<fil>..."
+"git hash-object [-t <typ>] [-w] [--path=<fil> | --no-filters]\n"
+" [--stdin [--literally]] [--] <fil>..."
+
+msgid "git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]"
+msgstr "git hash-object [-t <typ>] [-w] --stdin-paths [--no-filters]"
msgid "object type"
msgstr "objekttyp"
@@ -6917,12 +6960,19 @@ msgstr "användning: %s%s"
msgid "'git help config' for more information"
msgstr "\"git help config\" för mer information"
-msgid "git hook run [--ignore-missing] <hook-name> [-- <hook-args>]"
-msgstr "git hook run [--ignore-missing] <krok-namn> [-- <krok-argument>]"
+msgid ""
+"git hook run [--ignore-missing] [--to-stdin=<path>] <hook-name> [-- <hook-"
+"args>]"
+msgstr ""
+"git hook run [--ignore-missing] [--to-stdin=<sökväg>] <krok-namn> [-- <krok-"
+"argument>]"
msgid "silently ignore missing requested <hook-name>"
msgstr "ignorera tyst om önskat <krok-namn> saknas"
+msgid "file to read into hooks' stdin"
+msgstr "misslyckades läsa till krokens standard in"
+
#, c-format
msgid "object type mismatch at %s"
msgstr "objekttyp stämmer inte överens vid %s"
@@ -7211,11 +7261,15 @@ msgid "Initialized empty Git repository in %s%s\n"
msgstr "Initierade tomt Git-arkiv i %s%s\n"
msgid ""
-"git init [-q | --quiet] [--bare] [--template=<template-directory>] [--"
-"shared[=<permissions>]] [<directory>]"
+"git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
+" [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+" [-b <branch-name> | --initial-branch=<branch-name>]\n"
+" [--shared[=<permissions>]] [<directory>]"
msgstr ""
-"git init [-q | --quiet] [--bare] [--template=<mallkatalog>] [--"
-"shared[=<behörigheter>]] [<katalog>]"
+"git init [-q | --quiet] [--bare] [--template=<mallkatalog>]\n"
+" [--separate-git-dir <git-kat>] [--object-format=<format>]\n"
+" [-b <grennamn> | --initial-branch=<grennamn>]\n"
+" [--shared[=<behörigheter>]] [<katalog>]"
msgid "permissions"
msgstr "behörigheter"
@@ -7256,11 +7310,13 @@ msgid "--separate-git-dir incompatible with bare repository"
msgstr "--separate-git-dir är inkompatibelt med naket arkiv"
msgid ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<token>[(=|:)<value>])...] [<file>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <token>[(=|:)<value>])...]\n"
+" [--parse] [<file>...]"
msgstr ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<symbol>[(=|:)<värde>])...] [<fil>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <symbol>[(=|:)<värde>])...]\n"
+" [--parse] [<fil>...]"
msgid "edit files in place"
msgstr "redigera filer på plats"
@@ -7735,12 +7791,12 @@ msgstr ""
msgid ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<repository> [<refs>...]]"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n"
+" [--symref] [<repository> [<patterns>...]]"
msgstr ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<arkiv> [<referenser>...]]"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<nyckel>]\n"
+" [--symref] [<arkiv> [<mönster>...]]"
msgid "do not print remote URL"
msgstr "visa inte fjärr-URL"
@@ -7868,12 +7924,12 @@ msgstr "git merge-base [-a | --all] <incheckning> <incheckning>..."
msgid "git merge-base [-a | --all] --octopus <commit>..."
msgstr "git merge-base [-a | --all] --octopus <incheckning>..."
-msgid "git merge-base --independent <commit>..."
-msgstr "git merge-base --independent <incheckning>..."
-
msgid "git merge-base --is-ancestor <commit> <commit>"
msgstr "git merge-base --is-ancestor <incheckning> <incheckning>"
+msgid "git merge-base --independent <commit>..."
+msgstr "git merge-base --independent <incheckning>..."
+
msgid "git merge-base --fork-point <ref> [<commit>]"
msgstr "git merge-base --fork-point <ref> [<incheckning>]"
@@ -7981,9 +8037,26 @@ msgstr "lista filnamn utan lägen/oid/köer"
msgid "allow merging unrelated histories"
msgstr "tillåt sammanslagning av orelaterade historier"
+msgid "perform multiple merges, one per line of input"
+msgstr "utför flera sammanslagningar, en per indatarad"
+
+msgid "specify a merge-base for the merge"
+msgstr "ange en sammanslagningsbas för sammanslagningen"
+
msgid "--trivial-merge is incompatible with all other options"
msgstr "--trivial-merge är inkompatibelt med andra flaggor"
+msgid "--merge-base is incompatible with --stdin"
+msgstr "--merge-base är inkompatibel med --stdin"
+
+#, c-format
+msgid "malformed input line: '%s'."
+msgstr "felaktig indatarad: \"%s\"."
+
+#, c-format
+msgid "merging cannot continue; got unclean result of %d"
+msgstr "sammanslagning kan inte fortsätta; fick inte rent resultat från %d"
+
msgid "git merge [<options>] [<commit>...]"
msgstr "git merge [<flaggor>] [<incheckning>...]"
@@ -8600,10 +8673,6 @@ msgid "cannot read note data from non-blob object '%s'."
msgstr "kan inte läsa anteckningsdata från icke-blob-objektet \"%s\"."
#, c-format
-msgid "malformed input line: '%s'."
-msgstr "felaktig indatarad: \"%s\"."
-
-#, c-format
msgid "failed to copy notes from '%s' to '%s'"
msgstr "misslyckades kopiera anteckningar från \"%s\" till \"%s\""
@@ -8794,15 +8863,13 @@ msgstr "använd anteckningar från <anteckningsref>"
msgid "unknown subcommand: `%s'"
msgstr "okänt underkommando: \"%s\""
-msgid ""
-"git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"
-msgstr ""
-"git pack-objects --stdout [<flaggor>...] [< <reflista> | < <objektlista>]"
+msgid "git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"
+msgstr "git pack-objects --stdout [<flaggor>] [< <reflista> | < <objektlista>]"
msgid ""
-"git pack-objects [<options>...] <base-name> [< <ref-list> | < <object-list>]"
+"git pack-objects [<options>] <base-name> [< <ref-list> | < <object-list>]"
msgstr ""
-"git pack-objects [<flaggor>...] <basnamn> [< <reflista> | < <objektlista>]"
+"git pack-objects [<flaggor>] <basnamn> [< <reflista> | < <objektlista>]"
#, c-format
msgid ""
@@ -9176,8 +9243,8 @@ msgstr ""
"oss att du fortfarande använder det på e-post till\n"
"<git@vger.kernel.org>. Tack.\n"
-msgid "git pack-refs [<options>]"
-msgstr "git pack-refs [<flaggor>]"
+msgid "git pack-refs [--all] [--no-prune]"
+msgstr "git pack-refs [--all] [--no-prune]"
msgid "pack everything"
msgstr "packa allt"
@@ -9185,6 +9252,18 @@ msgstr "packa allt"
msgid "prune loose refs (default)"
msgstr "ta bort lösa referenser (standard)"
+msgid "git patch-id [--stable | --unstable | --verbatim]"
+msgstr "git patch-id [--stable | --unstable | --verbatim]"
+
+msgid "use the unstable patch-id algorithm"
+msgstr "använd den instabila patch-id-algoritmen"
+
+msgid "use the stable patch-id algorithm"
+msgstr "använd den stabila patch-id-algoritmen"
+
+msgid "don't strip whitespace from the patch"
+msgstr "ta inte bort blanksteg från patchen"
+
msgid "git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]"
msgstr "git prune [-n] [-v] [--progress] [--expire <tid>] [--] [<huvud>...]"
@@ -9397,14 +9476,13 @@ msgstr ""
msgid ""
"\n"
-"To avoid automatically configuring upstream branches when their name\n"
-"doesn't match the local branch, see option 'simple' of branch."
-"autoSetupMerge\n"
+"To avoid automatically configuring an upstream branch when its name\n"
+"won't match the local branch, see option 'simple' of branch.autoSetupMerge\n"
"in 'git help config'.\n"
msgstr ""
"\n"
-"För att undvika att uppströmsgrenar automatiskt konfigureras när deras\n"
-"namn inte motsvarar en lokal gren, se värdet \"simple\" i branch."
+"För att undvika att en uppströmsgren automatiskt konfigureras när dess namn\n"
+"inte motsvarar den lokala grenen, se värdet \"simple\" i branch."
"autoSetupMerge\n"
"i \"git help config\".\n"
@@ -9556,6 +9634,13 @@ msgstr "Sänder till %s\n"
msgid "failed to push some refs to '%s'"
msgstr "misslyckades sända vissa referenser till \"%s\""
+msgid ""
+"recursing into submodule with push.recurseSubmodules=only; using on-demand "
+"instead"
+msgstr ""
+"rekurserar in i undermoduler med push.recurseSubmodules=only; använder "
+"istället vid behov"
+
#, c-format
msgid "invalid value for '%s'"
msgstr "ogiltigt värde för \"%s\""
@@ -9691,13 +9776,15 @@ msgid "need two commit ranges"
msgstr "behöver två incheckningsintervall"
msgid ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>) "
-"[-u | -i]] [--no-sparse-checkout] [--index-output=<file>] (--empty | <tree-"
-"ish1> [<tree-ish2> [<tree-ish3>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
+"prefix=<prefix>)\n"
+" [-u | -i]] [--index-output=<file>] [--no-sparse-checkout]\n"
+" (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"
msgstr ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>) "
-"[-u | -i]] [--no-sparse-checkout] [--index-output=<fil>] (--empty | <träd-"
-"igt1> [<träd-igt2> [<träd-igt3>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
+"prefix=<prefix>)\n"
+" [-u | -i]] [--index-output=<fil>] [--no-sparse-checkout]\n"
+" (--empty | <träd-igt1> [<träd-igt2> [<träd-igt3>]])"
msgid "write resulting index to <file>"
msgstr "skriv resulterande index till <fil>"
@@ -9787,12 +9874,12 @@ msgid "%s requires the merge backend"
msgstr "%s kräver \"merge\"-bakändan"
#, c-format
-msgid "could not get 'onto': '%s'"
-msgstr "kunde inte hämta \"onto\": \"%s\""
+msgid "invalid onto: '%s'"
+msgstr "ogiltig \"onto\": \"%s\""
#, c-format
msgid "invalid orig-head: '%s'"
-msgstr "ogiltigt orig-head: \"%s\""
+msgstr "ogiltig \"orig-head\": \"%s\""
#, c-format
msgid "ignoring invalid allow_rerere_autoupdate: '%s'"
@@ -9837,6 +9924,10 @@ msgstr ""
msgid "could not switch to %s"
msgstr "kunde inte växla till %s"
+msgid "apply options and merge options cannot be used together"
+msgstr ""
+"appliceringsflaggor och sammanslagningsflaggor kan inte användas tillsammans"
+
#, c-format
msgid ""
"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and \"ask"
@@ -10065,9 +10156,19 @@ msgstr "Okänt läge: %s"
msgid "--strategy requires --merge or --interactive"
msgstr "--strategy kräver --merge eller --interactive"
-msgid "apply options and merge options cannot be used together"
+msgid ""
+"apply options are incompatible with rebase.autosquash. Consider adding --no-"
+"autosquash"
msgstr ""
-"appliceringsflaggor och sammanslagningsflaggor kan inte användas tillsammans"
+"argument för \"apply\" är inkompatibla med rebase.autosquash. Överväg att "
+"lägga till --no-autosquash"
+
+msgid ""
+"apply options are incompatible with rebase.updateRefs. Consider adding --no-"
+"update-refs"
+msgstr ""
+"argument för \"apply\" är inkompatibla med rebase.updateRefs. Överväg att "
+"lägga till --no-update-refs"
#, c-format
msgid "Unknown rebase backend: %s"
@@ -10091,8 +10192,8 @@ msgstr "ingen sådan gren/incheckning: \"%s\""
msgid "No such ref: %s"
msgstr "Ingen sådan referens: %s"
-msgid "Could not resolve HEAD to a revision"
-msgstr "Kunde inte bestämma HEAD:s incheckning"
+msgid "Could not resolve HEAD to a commit"
+msgstr "Kunde inte bestämma en incheckning för HEAD"
#, c-format
msgid "'%s': need exactly one merge base with branch"
@@ -10746,6 +10847,10 @@ msgstr "kunde inte öppna temporär fil %s för skrivning"
msgid "could not close refs snapshot tempfile"
msgstr "kunde inte stänga temporär fil för refs-ögonblicksbild"
+#, c-format
+msgid "could not remove stale bitmap: %s"
+msgstr "kunde inte ta bort gammal bitkarta: %s"
+
msgid "pack everything in a single pack"
msgstr "packa allt i ett enda paket"
@@ -10818,6 +10923,9 @@ msgstr "hitta ett geometrisk förlopp med faktor <N>"
msgid "write a multi-pack index of the resulting packs"
msgstr "skriv ett flerpaketsindex för de skapade paketen"
+msgid "pack prefix to store a pack containing pruned objects"
+msgstr "paketprefix att lagra ett paket som innehåller bortrensade objekt"
+
msgid "cannot delete packs in a precious-objects repo"
msgstr "kan inte ta bort paket i ett \"precious-objects\"-arkiv"
@@ -10829,8 +10937,12 @@ msgid "pack prefix %s does not begin with objdir %s"
msgstr "paketprefixet %s börjar inte med objkat %s"
#, c-format
-msgid "missing required file: %s"
-msgstr "nödvändig fil saknas: %s"
+msgid "renaming pack to '%s' failed"
+msgstr "misslyckades byta namn på paket till \"%s\""
+
+#, c-format
+msgid "pack-objects did not write a '%s' file for pack %s-%s"
+msgstr "pack-objects skrev inte en \"%s\"-fil för paketet %s-%s"
#, c-format
msgid "could not unlink: %s"
@@ -11024,8 +11136,10 @@ msgstr "--convert-graft-file tar inga argument"
msgid "only one pattern can be given with -l"
msgstr "endast ett mönster kan anges med -l"
-msgid "git rerere [clear | forget <path>... | status | remaining | diff | gc]"
-msgstr "git rerere [clear | forget <path>... | status | remaining | diff | gc]"
+msgid ""
+"git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
+msgstr ""
+"git rerere [clear | forget <sökväg>... | diff | status | remaining | gc]"
msgid "register clean resolutions in index"
msgstr "registrera rena lösningar i indexet"
@@ -11229,6 +11343,15 @@ msgstr "--prefix kräver ett argument"
msgid "unknown mode for --abbrev-ref: %s"
msgstr "okänt läge för --abbrev-ref: %s"
+msgid "--exclude-hidden cannot be used together with --branches"
+msgstr "--exclude-hidden kan endast användas tillsammans med --branches"
+
+msgid "--exclude-hidden cannot be used together with --tags"
+msgstr "--exclude-hidden kan kan inte användas tillsammans med --tags"
+
+msgid "--exclude-hidden cannot be used together with --remotes"
+msgstr "--exclude-hidden kan kan inte användas tillsammans med --remotes"
+
msgid "this operation must be run in a work tree"
msgstr "funktionen måste köras i en arbetskatalog"
@@ -11236,17 +11359,25 @@ msgstr "funktionen måste köras i en arbetskatalog"
msgid "unknown mode for --show-object-format: %s"
msgstr "okänt läge för --show-object-format: %s"
-msgid "git revert [<options>] <commit-ish>..."
-msgstr "git revert [<flaggor>] <incheckning-igt>..."
+msgid ""
+"git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] "
+"<commit>..."
+msgstr ""
+"git revert [--[no-]edit] [-n] [-m <förälder-nummer>] [-s] [-S[<nyckelid>]] "
+"<incheckning>..."
-msgid "git revert <subcommand>"
-msgstr "git revert <underkommando>"
+msgid "git revert (--continue | --skip | --abort | --quit)"
+msgstr "git revert (--continue | --skip | --abort | --quit)"
-msgid "git cherry-pick [<options>] <commit-ish>..."
-msgstr "git cherry-pick [<flaggor>] <incheckning-igt>..."
+msgid ""
+"git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n"
+" [-S[<keyid>]] <commit>..."
+msgstr ""
+"git cherry-pick [--edit] [-n] [-m <förälder-nummer>] [-s] [-x] [--ff]\n"
+" [-S[<nyckelid>]] <incheckning>..."
-msgid "git cherry-pick <subcommand>"
-msgstr "git cherry-pick <underkommando>"
+msgid "git cherry-pick (--continue | --skip | --abort | --quit)"
+msgstr "git cherry-pick (--continue | --skip | --abort | --quit)"
#, c-format
msgid "option `%s' expects a number greater than zero"
@@ -11307,8 +11438,14 @@ msgstr "\"revert\" misslyckades"
msgid "cherry-pick failed"
msgstr "\"cherry-pick\" misslyckades"
-msgid "git rm [<options>] [--] <file>..."
-msgstr "git rm [<flaggor>] [--] <fil>..."
+msgid ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<fil> [--pathspec-file-nul]]\n"
+" [--] [<sökväg>...]"
msgid ""
"the following file has staged content different from both the\n"
@@ -11379,11 +11516,13 @@ msgid ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<host>:]<directory> (--all | <ref>...)"
msgstr ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<värd>:]<katalog> (--all | <ref>...)"
msgid "remote name"
@@ -11407,8 +11546,9 @@ msgstr "git log --pretty=short | git shortlog [<flaggor>]"
msgid "using multiple --group options with stdin is not supported"
msgstr "mer än en \"--group\"-flagga stöds inte med standard in"
-msgid "using --group=trailer with stdin is not supported"
-msgstr "att använda --group=trailer stöds inte med standard in"
+#, c-format
+msgid "using %s with stdin is not supported"
+msgstr "använda %s med standard in stöds inte"
#, c-format
msgid "unknown group type: %s"
@@ -11445,12 +11585,14 @@ msgid ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<when>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<rev> | <glob>)...]"
msgstr ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<när>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<rev> | <mönster>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<rev> | <mönster>)...]"
msgid "git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]"
msgstr "git show-branch (-g | --reflog)[=<n>[,<bas>]] [--list] [<ref>]"
@@ -11550,11 +11692,13 @@ msgid "Unknown hash algorithm"
msgstr "okänd hashningsalgoritm"
msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<pattern>...]"
msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<mönster>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<mönster>...]"
msgid "git show-ref --exclude-existing[=<pattern>]"
msgstr "git show-ref --exclude-existing[=<mönster>]"
@@ -11583,8 +11727,10 @@ msgstr "visa inte resultat på standard ut (användbart med --verify)"
msgid "show refs from stdin that aren't in local repository"
msgstr "visa referenser från standard in som inte finns i lokalt arkiv"
-msgid "git sparse-checkout (init|list|set|add|reapply|disable) <options>"
-msgstr "git sparse-checkout (init|list|set|add|reapply|disable) <flaggor>"
+msgid ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<options>]"
+msgstr ""
+"git sparse-checkout (init | list | set | add | reapply | disable) <flaggor>"
msgid "this worktree is not sparse"
msgstr "arbetskatalogen är inte gren"
@@ -11707,67 +11853,58 @@ msgstr ""
msgid "error while refreshing working directory"
msgstr "fel vid uppdatering av arbetskatalog"
-msgid "git stash list [<options>]"
-msgstr "git stash list [<flaggor>]"
+msgid "git stash list [<log-options>]"
+msgstr "git stash list [<\"log\"-flaggor>]"
+
+msgid ""
+"git stash show [-u | --include-untracked | --only-untracked] [<diff-"
+"options>] [<stash>]"
+msgstr ""
+"git stash show [-u | --include-untracked | --only-untracked] [<\"diff\"-"
+"flaggor>] [<stash>]"
-msgid "git stash show [<options>] [<stash>]"
-msgstr "git stash show [<flaggor>] [<stash>]"
+msgid "git stash drop [-q | --quiet] [<stash>]"
+msgstr "git stash drop [-q | --quiet] [<stash>]"
-msgid "git stash drop [-q|--quiet] [<stash>]"
-msgstr "git stash drop [-q|--quiet] [<stash>]"
+msgid "git stash pop [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash pop [--index] [-q | --quiet] [<stash>]"
-msgid "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
+msgid "git stash apply [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash apply [--index] [-q | --quiet] [<stash>]"
msgid "git stash branch <branchname> [<stash>]"
msgstr "git stash branch <grennamn> [<stash>]"
+msgid "git stash store [(-m | --message) <message>] [-q | --quiet] <commit>"
+msgstr ""
+"git stash store [(-m | --message) <meddelande>] [-q | --quiet] <incheckning>"
+
msgid ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"<message>]\n"
" [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
" [--] [<pathspec>...]]"
msgstr ""
-"git stash [push [-p|--patch] [S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <meddelande>]\n"
+"git stash [push [-p | --patch] [S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message "
+"<meddelande>]\n"
" [--pathspec-from-file=<fil> [--pathspec-file-nul]]\n"
" [--] [<sökväg>...]]"
msgid ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<meddelande>]"
-
-msgid "git stash pop [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash pop [--index] [-q|--quiet] [<stash>]"
-
-msgid "git stash apply [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash apply [--index] [-q|--quiet] [<stash>]"
-
-msgid "git stash store [-m|--message <message>] [-q|--quiet] <commit>"
-msgstr "git stash store [-m|--message <meddelande>] [-q|--quiet] <incheckning>"
-
-msgid ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
-" [--] [<pathspec>...]]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<message>]"
msgstr ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <meddelande>]\n"
-" [--] [<sökväg>...]]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<meddelande>]"
-msgid ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<meddelande>]"
+msgid "git stash create [<message>]"
+msgstr "git stash create [<meddelande>]"
#, c-format
msgid "'%s' is not a stash-like commit"
@@ -12327,9 +12464,6 @@ msgstr "traversera undermoduler rekursivt"
msgid "don't fetch new objects from the remote site"
msgstr "hämta inte nya objekt från fjärrplatsen"
-msgid "path into the working tree"
-msgstr "sökväg inuti arbetskatalogen"
-
msgid "use the 'checkout' update strategy (default)"
msgstr "använd uppdateringsstrategin \"checkout\" (utcheckning; förval)"
@@ -12365,27 +12499,9 @@ msgstr ""
"[no-]recommend-shallow] [--reference <arkiv>] [--recursive] [--[no-]single-"
"branch] [--] [<sökväg>...]"
-msgid "recurse into submodules"
-msgstr "rekursera ner i undermoduler"
-
msgid "git submodule absorbgitdirs [<options>] [<path>...]"
msgstr "git submodule absorbgitdirs [<flaggor>] [<sökväg>...]"
-msgid "check if it is safe to write to the .gitmodules file"
-msgstr "se om det är säkert att skriva till .gitmodules-filen"
-
-msgid "unset the config in the .gitmodules file"
-msgstr "ta bort konfigurationen från .gitmodules-filen"
-
-msgid "git submodule--helper config <name> [<value>]"
-msgstr "git submodule--helper config <namn> [<värde>]"
-
-msgid "git submodule--helper config --unset <name>"
-msgstr "git submodule--helper config --unset <namn>"
-
-msgid "please make sure that the .gitmodules file is in the working tree"
-msgstr "se till att .gitmodules finns i arbetskatalogen"
-
msgid "suppress output for setting url of a submodule"
msgstr "dölj utdata från inställning av url för undermodul"
@@ -12464,6 +12580,9 @@ msgstr "Aktiverar lokal git-katalog för undermodulen \"%s\" på nytt.\n"
msgid "unable to checkout submodule '%s'"
msgstr "Kan inte checka ut undermodulen \"%s\""
+msgid "please make sure that the .gitmodules file is in the working tree"
+msgstr "se till att .gitmodules finns i arbetskatalogen"
+
#, c-format
msgid "Failed to add submodule '%s'"
msgstr "Misslyckades lägga till undermodulen \"%s\""
@@ -12514,19 +12633,17 @@ msgstr "arkiv-URL: \"%s\" måste vara absolut eller börja med ./|../"
msgid "'%s' is not a valid submodule name"
msgstr "\"%s\" är inte ett giltigt namn på undermodul"
-#, c-format
-msgid "%s doesn't support --super-prefix"
-msgstr "%s stöder inte --super-prefix"
+msgid "git submodule--helper <command>"
+msgstr "git submodule--helper <kommando>"
-#, c-format
-msgid "'%s' is not a valid submodule--helper subcommand"
-msgstr "\"%s\" är inte ett giltigt underkommando till submodule--helper"
+msgid "git symbolic-ref [-m <reason>] <name> <ref>"
+msgstr "git symbolic-ref [-m <orsak>] <namn> <ref>"
-msgid "git symbolic-ref [<options>] <name> [<ref>]"
-msgstr "git symbolic-ref [<flaggor>] <namn> [<ref>]"
+msgid "git symbolic-ref [-q] [--short] [--no-recurse] <name>"
+msgstr "git symbolic-ref [-q] [--short] [--no-recurse] <namn>"
-msgid "git symbolic-ref -d [-q] <name>"
-msgstr "git symbolic-ref -d [-q] <namn>"
+msgid "git symbolic-ref --delete [-q] <name>"
+msgstr "git symbolic-ref --delete [-q] <namn>"
msgid "suppress error message for non-symbolic (detached) refs"
msgstr ""
@@ -12538,6 +12655,9 @@ msgstr "ta bort symbolisk referens"
msgid "shorten ref output"
msgstr "förkorta ref-utdata"
+msgid "recursively dereference (default)"
+msgstr "avreferera rekursivt (standard)"
+
msgid "reason"
msgstr "skäl"
@@ -12545,25 +12665,26 @@ msgid "reason of the update"
msgstr "skäl till uppdateringen"
msgid ""
-"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]\n"
-" <tagname> [<head>]"
+"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n"
+" <tagname> [<commit> | <object>]"
msgstr ""
-"git tag [-a | -s | -u <nyckel-id>] [-f] [-m <medd> | -F <fil>]\n"
-" <taggnamn> [<huvud>]"
+"git tag [-a | -s | -u <nyckel-id>] [-f] [-m <medd> | -F <fil>] [-e]\n"
+" <taggnamn> [<incheckning> | <objekt>]"
msgid "git tag -d <tagname>..."
msgstr "git tag -d <taggnamn>..."
msgid ""
-"git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--"
-"points-at <object>]\n"
-" [--format=<format>] [--merged <commit>] [--no-merged <commit>] "
-"[<pattern>...]"
+"git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]\n"
+" [--points-at <object>] [--column[=<options>] | --no-column]\n"
+" [--create-reflog] [--sort=<key>] [--format=<format>]\n"
+" [--merged <commit>] [--no-merged <commit>] [<pattern>...]"
msgstr ""
-"git tag -l [-n[<antal>]] [--contains <incheckning>] [--no-contains "
-"<incheckning>] [--points-at <objekt>]\n"
-" [--format=<format>] [--merged <incheckning>] [--no-merged "
-"<incheckning>] [<mönster>...]"
+"git tag [-n[<antal>]] -l [--contains <incheckning>] [--no-contains "
+"<incheckning>\n"
+" [--points-at <objekt>] [--column[=<flaggor>] | --no-column]\n"
+" [--create-reflog] [--sort=<nyckel>] [--format=<format>]\n"
+" [--merged <incheckning>] [--no-merged <incheckning>] [<mönster>...]"
msgid "git tag -v [--format=<format>] <tagname>..."
msgstr "git tag -v [--format=<format>] <taggnamn>..."
@@ -12938,8 +13059,12 @@ msgstr "läs uppdateringar från standard in"
msgid "update the info files from scratch"
msgstr "uppdatera informationsfilerna från grunden"
-msgid "git upload-pack [<options>] <dir>"
-msgstr "git upload-pack [<flaggor>] <katalog>"
+msgid ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <directory>"
+msgstr ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <katalog>"
msgid "quit after a single request/response exchange"
msgstr "avsluta omedelbart efter första anrop/svar-utväxling"
@@ -12953,8 +13078,8 @@ msgstr "testa inte <katalog>/.git/ om <katalog> inte är en Git-katalog"
msgid "interrupt transfer after <n> seconds of inactivity"
msgstr "avbryt överföringen efter <n> sekunders inaktivitet"
-msgid "git verify-commit [-v | --verbose] <commit>..."
-msgstr "git verify-commit [-v | --verbose] <incheckning>..."
+msgid "git verify-commit [-v | --verbose] [--raw] <commit>..."
+msgstr "git verify-commit [-v | --verbose] [--raw] <incheckning>..."
msgid "print commit contents"
msgstr "visa innehåll för incheckning"
@@ -12962,8 +13087,9 @@ msgstr "visa innehåll för incheckning"
msgid "print raw gpg status output"
msgstr "visa råa gpg-statusdata"
-msgid "git verify-pack [-v | --verbose] [-s | --stat-only] <pack>..."
-msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] <paket>..."
+msgid "git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pack>.idx..."
+msgstr ""
+"git verify-pack [-v | --verbose] [-s | --stat-only] [--] <paket>.idx..."
msgid "verbose"
msgstr "pratsam"
@@ -12971,35 +13097,39 @@ msgstr "pratsam"
msgid "show statistics only"
msgstr "visa endast statistik"
-msgid "git verify-tag [-v | --verbose] [--format=<format>] <tag>..."
-msgstr "git verify-tag [-v | --verbose] [--format=<format>] <tagg>..."
+msgid "git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."
+msgstr "git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tagg>..."
msgid "print tag contents"
msgstr "visa innehåll för tag"
-msgid "git worktree add [<options>] <path> [<commit-ish>]"
-msgstr "git worktree add [<flaggor>] <sökväg> [<incheckning-igt>]"
+msgid ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]\n"
+" [-b <new-branch>] <path> [<commit-ish>]"
+msgstr ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <sträng>]]\n"
+" [-b <ny-gren>] <sökväg> [<incheckning-igt>]"
-msgid "git worktree list [<options>]"
-msgstr "git worktree list [<flaggor>]"
+msgid "git worktree list [-v | --porcelain [-z]]"
+msgstr "git worktree list [-v | --porcelain [-z]]"
-msgid "git worktree lock [<options>] <path>"
-msgstr "git worktree lock [<flaggor>] <sökväg>"
+msgid "git worktree lock [--reason <string>] <worktree>"
+msgstr "git worktree lock [--reason <sträng>] <arbetskatalog>"
msgid "git worktree move <worktree> <new-path>"
msgstr "git worktree move <arbetskatalog> <ny-sökväg>"
-msgid "git worktree prune [<options>]"
-msgstr "git worktree prune [<flaggor>]"
+msgid "git worktree prune [-n] [-v] [--expire <expire>]"
+msgstr "git worktree prune [-n] [-v] [--expire <utgår>]"
-msgid "git worktree remove [<options>] <worktree>"
-msgstr "git worktree remove [<flaggor>] <arbetskatalog>"
+msgid "git worktree remove [-f] <worktree>"
+msgstr "git worktree remove [-f] <arbetskatalog>"
msgid "git worktree repair [<path>...]"
msgstr "git worktree repair [<sökväg>...]"
-msgid "git worktree unlock <path>"
-msgstr "git worktree unlock <sökväg>"
+msgid "git worktree unlock <worktree>"
+msgstr "git worktree unlock <arbetskatalog>"
#, c-format
msgid "Removing %s/%s: %s"
@@ -13235,6 +13365,14 @@ msgstr "endast användbart vid felsökning"
msgid "core.fsyncMethod = batch is unsupported on this platform"
msgstr "core.fsyncMethod = batch stöds inte på denna plattform"
+#, c-format
+msgid "could not parse bundle list key %s with value '%s'"
+msgstr "kunde inte tolka listnyckeln %s med värdet \"%s\""
+
+#, c-format
+msgid "bundle list at '%s' has no mode"
+msgstr "buntlistan på \"%s\" har inget läge"
+
msgid "failed to create temporary file"
msgstr "misslyckades skapa temporär fil"
@@ -13242,16 +13380,43 @@ msgid "insufficient capabilities"
msgstr "otillräckliga kapabiliteter"
#, c-format
+msgid "file downloaded from '%s' is not a bundle"
+msgstr "filen hämtad från \"%s\" är inte en bunt"
+
+msgid "failed to store maximum creation token"
+msgstr "misslyckades lagra maximal skaparsymbol"
+
+#, c-format
+msgid "unrecognized bundle mode from URI '%s'"
+msgstr "okänt buntlägre från URI:en \"%s\""
+
+#, c-format
+msgid "exceeded bundle URI recursion limit (%d)"
+msgstr "överskred buntens URI-rekursionsgräns (%d)"
+
+#, c-format
msgid "failed to download bundle from URI '%s'"
msgstr "kunde inte hämta bunt från URI:en \"%s\""
#, c-format
-msgid "file at URI '%s' is not a bundle"
-msgstr "filen på URI \"%s\" är inte en bunt"
+msgid "file at URI '%s' is not a bundle or bundle list"
+msgstr "filen på URI:en \"%s\" är inte en bunt eller buntlista"
#, c-format
-msgid "failed to unbundle bundle from URI '%s'"
-msgstr "misslyckades packa upp bunten från URI:en \"%s\""
+msgid "bundle-uri: unexpected argument: '%s'"
+msgstr "bundle-uri: okänt argument: \"%s\""
+
+msgid "bundle-uri: expected flush after arguments"
+msgstr "bundle-uri: förväntade \"flush\" efter argument"
+
+msgid "bundle-uri: got an empty line"
+msgstr "bunt-uri: fick en tom rad"
+
+msgid "bundle-uri: line is not of the form 'key=value'"
+msgstr "bunt-uri: raden är inte på formen \"nyckel=värde\""
+
+msgid "bundle-uri: line has empty key or value"
+msgstr "bunt-uri: raden har tom nyckel eller värde"
#, c-format
msgid "unrecognized bundle hash algorithm: %s"
@@ -13275,6 +13440,13 @@ msgstr "Arkivet saknar dessa nödvändiga incheckningar:"
msgid "need a repository to verify a bundle"
msgstr "behöver ett arkiv för att bekräfta en bunt."
+msgid ""
+"some prerequisite commits exist in the object store, but are not connected "
+"to the repository's history"
+msgstr ""
+"några förutsättande incheckningar finns i objektkatalogen, men är inte "
+"anslutna i arkivets historik"
+
#, c-format
msgid "The bundle contains this ref:"
msgid_plural "The bundle contains these %<PRIuMAX> refs:"
@@ -13822,7 +13994,7 @@ msgstr "Filformat för bunt"
msgid "Chunk-based file formats"
msgstr "Styckebaserade filformat"
-msgid "Git commit graph format"
+msgid "Git commit-graph format"
msgstr "Format för Git-incheckningsgraf"
msgid "Git index format"
@@ -14175,6 +14347,10 @@ msgstr "ohanterat fall i \"has_worktree_moved\": %d"
msgid "health thread wait failed [GLE %ld]"
msgstr "misslyckades vänta på hälsotråden [GLE %ld]"
+#, c-format
+msgid "Invalid path: %s"
+msgstr "ogiltig sökväg: %s"
+
msgid "Unable to create FSEventStream."
msgstr "kunde inte skapa FSEventStream."
@@ -14206,6 +14382,22 @@ msgid "could not read directory changes [GLE %ld]"
msgstr "kunde inte läsa katalogändringar [GLE %ld]"
#, c-format
+msgid "opendir('%s') failed"
+msgstr "opendir('%s') misslyckades"
+
+#, c-format
+msgid "lstat('%s') failed"
+msgstr "lstat('%s') misslyckades"
+
+#, c-format
+msgid "strbuf_readlink('%s') failed"
+msgstr "strbuf_readlink('%s') misslyckades"
+
+#, c-format
+msgid "closedir('%s') failed"
+msgstr "closedir('%s') misslyckades"
+
+#, c-format
msgid "[GLE %ld] unable to open for read '%ls'"
msgstr "[GLE %ld] kunde inte öppna \"%ls\" för läsning"
@@ -14660,15 +14852,22 @@ msgid "unknown object format '%s' specified by server"
msgstr "okänt objektformat \"%s\" angavs av servern"
#, c-format
+msgid "error on bundle-uri response line %d: %s"
+msgstr "fel på bundle-uri-svar rad %d: %s"
+
+msgid "expected flush after bundle-uri listing"
+msgstr "förväntade \"flush\" efter bundle-uri-listan"
+
+msgid "expected response end packet after ref listing"
+msgstr "förväntade svarsavslutningspaket efter ref-listan"
+
+#, c-format
msgid "invalid ls-refs response: %s"
msgstr "ogiltigt svar på ls-refs: %s"
msgid "expected flush after ref listing"
msgstr "förväntade \"flush\" efter ref-listan"
-msgid "expected response end packet after ref listing"
-msgstr "förväntade svarsavslutningspaket efter ref-listan"
-
#, c-format
msgid "protocol '%s' is not supported"
msgstr "protokollet \"%s\" stöds inte"
@@ -15804,10 +16003,11 @@ msgstr "det virtuella arkivet \"%s\" är inkompatibelt med fsmonitor"
#, c-format
msgid ""
-"repository '%s' is incompatible with fsmonitor due to lack of Unix sockets"
+"socket directory '%s' is incompatible with fsmonitor due to lack of Unix "
+"sockets support"
msgstr ""
-"arkivet \"%s\" är inkompatibelt med fsmonitor på grund av avsaknad av Unix-"
-"uttag"
+"uttagskatalogen \"%s\" är inkompatibelt med fsmonitor på grund av avsaknad "
+"av Unix-uttag"
msgid ""
"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n"
@@ -15815,8 +16015,7 @@ msgid ""
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
-" [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n"
-" <command> [<args>]"
+" [--config-env=<name>=<envvar>] <command> [<args>]"
msgstr ""
"git [-v | --version] [-h |--help] [-C <sökväg>] [-c <namn>=<värde>]\n"
" [--exec-path[=<sökväg>]] [--html-path] [--man-path] [--info-"
@@ -15824,8 +16023,7 @@ msgstr ""
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<sökväg>] [--work-tree=<sökväg>] [--namespace=<namn>]\n"
-" [--super-prefix=<sökväg>] [--config-env=<namn>=<miljövar>]\n"
-" <kommando> [<flaggor>]"
+" [--config-env=<namn>=<miljövar>] <kommando> [<flaggor>]"
msgid ""
"'git help -a' and 'git help -g' list available subcommands and some\n"
@@ -15851,10 +16049,6 @@ msgid "no namespace given for --namespace\n"
msgstr "ingen namnrymd angavs för --namespace\n"
#, c-format
-msgid "no prefix given for --super-prefix\n"
-msgstr "inget prefix angavs för --super-prefix\n"
-
-#, c-format
msgid "-c expects a configuration string\n"
msgstr "-c förväntar en konfigurationssträng\n"
@@ -15966,8 +16160,13 @@ msgstr "gpg.ssh.defaultKeyCommand lyckades men gav inga nycklar: %s %s"
msgid "gpg.ssh.defaultKeyCommand failed: %s %s"
msgstr "gpg.ssh.defaultKeyCommand misslyckades: %s %s"
-msgid "gpg failed to sign the data"
-msgstr "gpg misslyckades signera data"
+#, c-format
+msgid ""
+"gpg failed to sign the data:\n"
+"%s"
+msgstr ""
+"gpg misslyckades signera data:\n"
+"%s"
msgid "user.signingKey needs to be set for ssh signing"
msgstr "user.signingKey måste anges för ssh-signering"
@@ -16128,8 +16327,8 @@ msgstr[1] ""
"\n"
"Mest lika kommandon är"
-msgid "git version [<options>]"
-msgstr "git version [<flaggor>]"
+msgid "git version [--build-options]"
+msgstr "git version [--build-options]"
#, c-format
msgid "%s: %s - %s"
@@ -17041,10 +17240,6 @@ msgstr "kunde inte normalisera supplerande objektsökväg: %s"
msgid "%s: ignoring alternate object stores, nesting too deep"
msgstr "%s: ignorerar supplerande objektlager, för djup nästling"
-#, c-format
-msgid "unable to normalize object directory: %s"
-msgstr "kan inte normalisera objektkatalogen: %s"
-
msgid "unable to fdopen alternates lockfile"
msgstr "kan inte utföra \"fdopen\" på suppleantlåsfil"
@@ -17103,6 +17298,10 @@ msgid "garbage at end of loose object '%s'"
msgstr "skräp i slutet av löst objekt \"%s\""
#, c-format
+msgid "unable to open loose object %s"
+msgstr "kan inte öppna lösa objekt %s"
+
+#, c-format
msgid "unable to parse %s header"
msgstr "kan inte tolka %s-huvud"
@@ -17118,18 +17317,14 @@ msgid "header for %s too long, exceeds %d bytes"
msgstr "huvudet för %s är för långt, mer än %d byte"
#, c-format
-msgid "failed to read object %s"
-msgstr "misslyckades läsa objektet %s"
+msgid "loose object %s (stored in %s) is corrupt"
+msgstr "löst objekt %s (lagrat i %s) är trasigt"
#, c-format
msgid "replacement %s not found for %s"
msgstr "ersättningen %s hittades inte för %s"
#, c-format
-msgid "loose object %s (stored in %s) is corrupt"
-msgstr "löst objekt %s (lagrat i %s) är trasigt"
-
-#, c-format
msgid "packed object %s (stored in %s) is corrupt"
msgstr "packat objekt %s (lagrat i %s) är trasigt"
@@ -17141,9 +17336,6 @@ msgstr "kunde inte skriva filen %s"
msgid "unable to set permission to '%s'"
msgstr "kan inte sätta behörigheten till \"%s\""
-msgid "file write error"
-msgstr "fel vid skrivning av fil"
-
msgid "error when closing loose object file"
msgstr "fel vid stängning av fil för löst objekt"
@@ -17190,11 +17382,12 @@ msgstr "kunde inte skapa katalogen %s"
msgid "cannot read object for %s"
msgstr "kan inte läsa objekt för %s"
-msgid "corrupt commit"
-msgstr "trasik incheckning"
+#, c-format
+msgid "object fails fsck: %s"
+msgstr "objekt klarar inte fsck: %s"
-msgid "corrupt tag"
-msgstr "trasig tagg"
+msgid "refusing to create malformed object"
+msgstr "vägrar skapa ett felaktigt format objekt"
#, c-format
msgid "read error while indexing %s"
@@ -17455,10 +17648,6 @@ msgstr "ogiltigt XOR-offset i bitkarte-packindex"
msgid "cannot fstat bitmap file"
msgstr "kan inte utföra \"fstat\" på bitkartefil"
-#, c-format
-msgid "ignoring extra bitmap file: '%s'"
-msgstr "ignorerar extra bitkartefil: %s"
-
msgid "checksum doesn't match in MIDX and bitmap"
msgstr "checksumman stämmer inte i MIDX och bitkarta"
@@ -17723,6 +17912,9 @@ msgstr "var mer tyst"
msgid "use <n> digits to display object names"
msgstr "använd <n> siffror för att visa objektnamn"
+msgid "prefixed path to initial superproject"
+msgstr "inledande sökväg till start-överprojekt"
+
msgid "how to strip spaces and #comments from message"
msgstr "hur blanksteg och #kommentarer ska tas bort från meddelande"
@@ -17867,6 +18059,10 @@ msgstr ""
msgid "promisor remote name cannot begin with '/': %s"
msgstr "kontraktsfjärr kan inte börja med \"/\": %s"
+#, c-format
+msgid "could not fetch %s from promisor remote"
+msgstr "kunde inte hämta %s från kontraktsfjärr"
+
msgid "object-info: expected flush after arguments"
msgstr "object-info: förväntade \"flush\" efter argument"
@@ -18221,6 +18417,14 @@ msgid "ahead %d, behind %d"
msgstr "före %d, bakom %d"
#, c-format
+msgid "%%(%.*s) does not take arguments"
+msgstr "%%(%.*s) tar inte argument"
+
+#, c-format
+msgid "unrecognized %%(%.*s) argument: %s"
+msgstr "okänt %%(%.*s)-argument: %s"
+
+#, c-format
msgid "expected format: %%(color:<color>)"
msgstr "förväntat format: %%(color:<color>)"
@@ -18237,22 +18441,6 @@ msgid "Integer value expected refname:rstrip=%s"
msgstr "Heltalsvärde förväntades refname:rstrip=%s"
#, c-format
-msgid "unrecognized %%(%s) argument: %s"
-msgstr "okänt %%(%s)-argument: %s"
-
-#, c-format
-msgid "%%(objecttype) does not take arguments"
-msgstr "%%(objecttype) tar inte argument"
-
-#, c-format
-msgid "%%(deltabase) does not take arguments"
-msgstr "%%(deltabase) tar inte argument"
-
-#, c-format
-msgid "%%(body) does not take arguments"
-msgstr "%%(body) tar inte argument"
-
-#, c-format
msgid "expected %%(trailers:key=<value>)"
msgstr "förväntade %%(trailers:key=<värde>)"
@@ -18269,10 +18457,6 @@ msgid "positive value expected '%s' in %%(%s)"
msgstr "positivt värde förväntat \"%s\" i %%(%s)"
#, c-format
-msgid "unrecognized email option: %s"
-msgstr "okänd e-postalternativ: %s"
-
-#, c-format
msgid "expected format: %%(align:<width>,<position>)"
msgstr "förväntat format: %%(align:<bredd>,<position>)"
@@ -18285,12 +18469,12 @@ msgid "unrecognized width:%s"
msgstr "okänd bredd:%s"
#, c-format
-msgid "positive width expected with the %%(align) atom"
-msgstr "positiv bredd förväntad med atomen %%(align)"
+msgid "unrecognized %%(%s) argument: %s"
+msgstr "okänt %%(%s)-argument: %s"
#, c-format
-msgid "%%(rest) does not take arguments"
-msgstr "%%(rest) tar inte argument"
+msgid "positive width expected with the %%(align) atom"
+msgstr "positiv bredd förväntad med atomen %%(align)"
#, c-format
msgid "malformed field name: %.*s"
@@ -18937,6 +19121,13 @@ msgid "failed to find tree of %s"
msgstr "kunde inte hitta trädet för %s."
#, c-format
+msgid "unsupported section for hidden refs: %s"
+msgstr "sktionen för dolda referenser stöds ej: %s"
+
+msgid "--exclude-hidden= passed more than once"
+msgstr "--exclude-hidden= angavs mer än en gång"
+
+#, c-format
msgid "resolve-undo records `%s` which is missing"
msgstr "resolve-undo registrerar \"%s\" som saknas"
@@ -19080,6 +19271,14 @@ msgid "--all or <enlistment>, but not both"
msgstr "--all eller <enrollering>, men inte bägge"
#, c-format
+msgid "could not remove stale scalar.repo '%s'"
+msgstr "kunde inte ta bort gammal scalar.repo \"%s\""
+
+#, c-format
+msgid "removing stale scalar.repo '%s'"
+msgstr "tar bort gammal scalar.repo \"%s\""
+
+#, c-format
msgid "git repository gone in '%s'"
msgstr "git-arkiv försvunnet i \"%s\""
@@ -19511,6 +19710,22 @@ msgid "git %s: failed to refresh the index"
msgstr "git %s: misslyckades uppdatera indexet"
#, c-format
+msgid "'%s' is not a valid label"
+msgstr "\"%s\" är inte en giltig etikett"
+
+#, c-format
+msgid "'%s' is not a valid refname"
+msgstr "\"%s\" är inte ett giltigt referensnamn"
+
+#, c-format
+msgid "update-ref requires a fully qualified refname e.g. refs/heads/%s"
+msgstr "update-ref kräver ett fullständigt referensnamn, t.ex refs/heads/%s"
+
+#, c-format
+msgid "invalid command '%.*s'"
+msgstr "ogiltigt kommando \"%.*s\""
+
+#, c-format
msgid "%s does not accept arguments: '%s'"
msgstr "%s tar inte argument: \"%s\""
@@ -19702,16 +19917,16 @@ msgstr ""
msgid "illegal label name: '%.*s'"
msgstr "ogiltigt etikettnamn: \"%.*s\""
+#, c-format
+msgid "could not resolve '%s'"
+msgstr "kunde inte upplösa \"%s\""
+
msgid "writing fake root commit"
msgstr "skriver fejkad rotincheckning"
msgid "writing squash-onto"
msgstr "skriver squash-onto"
-#, c-format
-msgid "could not resolve '%s'"
-msgstr "kunde inte upplösa \"%s\""
-
msgid "cannot merge without a current revision"
msgstr "kan inte slå ihop utan en aktuell incheckning"
@@ -20308,6 +20523,25 @@ msgstr "ls-tree returnerade en oväntad returkod %d"
msgid "failed to lstat '%s'"
msgstr "misslyckades ta status (lstat) på \"%s\""
+msgid "no remote configured to get bundle URIs from"
+msgstr "ingen fjärr att hämta bunt-URI:er från inställd"
+
+#, c-format
+msgid "remote '%s' has no configured URL"
+msgstr "fjärren \"%s\" har ingen URL konfigurerad"
+
+msgid "could not get the bundle-uri list"
+msgstr "kunde inte hämta bundle-uri-listan"
+
+msgid "test-tool cache-tree <options> (control|prime|update)"
+msgstr "test-tool cache-tree <flaggor> (control|prime|update)"
+
+msgid "clear the cache tree before each iteration"
+msgstr "töm cacheträdet före varje iteration"
+
+msgid "number of entries in the cache tree to invalidate (default 0)"
+msgstr "antal poster i cacheträdet att ogiltigförklara (förval är 0)"
+
msgid "unhandled options"
msgstr "flaggor som inte hanterats"
@@ -20652,6 +20886,12 @@ msgstr "Avbryter."
msgid "failed to push all needed submodules"
msgstr "kunde inte sända alla nödvändiga undermoduler"
+msgid "bundle-uri operation not supported by protocol"
+msgstr "bundle-uri-funktionen stöds inte av protokollet"
+
+msgid "could not retrieve server-advertised bundle-uri list"
+msgstr "kunde inte hämta bundle-uri-listan som servern annonserade"
+
msgid "too-short tree object"
msgstr "trädobjekt för kort"
@@ -21386,13 +21626,18 @@ msgstr "Ignorerade filer"
#, c-format
msgid ""
-"It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
-"may speed it up, but you have to be careful not to forget to add\n"
-"new files yourself (see 'git help status')."
+"It took %.2f seconds to enumerate untracked files,\n"
+"but the results were cached, and subsequent runs may be faster."
msgstr ""
-"Det tog %.2f sekunder att räkna upp ospårade filer. \"status -uno\"\n"
-"kan gå snabbare, men du måste vara försiktig så du inte glömmer\n"
-"lägga till nya filer själv (se \"git help status\")."
+"Det tog %.2f sekunder att räkna upp ospårade filer,\n"
+"men resultaten cachelagrades och senare körningar kan bli snabbare."
+
+#, c-format
+msgid "It took %.2f seconds to enumerate untracked files."
+msgstr "Det tog %.2f sekunder att räkna upp ospårade filer."
+
+msgid "See 'git help status' for information on how to improve this."
+msgstr "Se \"git help status\" för information om hur du kan förbättra detta."
# %s är nästa sträng eller tom.
#, c-format
@@ -21535,274 +21780,6 @@ msgstr "Du måste köra kommandot från arbetskatalogens toppnivå."
msgid "Unable to determine absolute path of git directory"
msgstr "Kunde inte bestämma absolut sökväg till git-katalogen"
-#. TRANSLATORS: you can adjust this to align "git add -i" status menu
-#, perl-format
-msgid "%12s %12s %s"
-msgstr "%12s %12s %s"
-
-#, perl-format
-msgid "touched %d path\n"
-msgid_plural "touched %d paths\n"
-msgstr[0] "rörde %d sökväg\n"
-msgstr[1] "rörde %d sökvägar\n"
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for staging."
-msgstr ""
-"Om patchen kan appliceras rent kommer det redigerade stycket att\n"
-"köas omedelbart."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for stashing."
-msgstr ""
-"Om patchen kan appliceras rent kommer det redigerade stycket att\n"
-"läggas till i \"stash\" omedelbart."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for unstaging."
-msgstr ""
-"Om patchen kan appliceras rent kommer det redigerade stycket att\n"
-"tas bort från kön omedelbart."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for applying."
-msgstr ""
-"Om patchen kan appliceras rent kommer det redigerade stycket att\n"
-"markeras för applicering omedelbart."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for discarding."
-msgstr ""
-"Om patchen kan appliceras rent kommer det redigerade stycket att\n"
-"markeras för kasta omedelbart."
-
-#, perl-format
-msgid "failed to open hunk edit file for writing: %s"
-msgstr "misslyckades öppna styckeredigeringsfil för skrivning: %s"
-
-#, perl-format
-msgid ""
-"---\n"
-"To remove '%s' lines, make them ' ' lines (context).\n"
-"To remove '%s' lines, delete them.\n"
-"Lines starting with %s will be removed.\n"
-msgstr ""
-"---\n"
-"Ta bort \"%s\" rader genom att göra dem \" \"-rader (sammanhang).\n"
-"Ta bort \"%s\" rader genom att radera dem.\n"
-"Rader som börjar med %s kommer att tas bort.\n"
-
-#, perl-format
-msgid "failed to open hunk edit file for reading: %s"
-msgstr "misslyckades öppna styckesredigeringsfil för läsning: %s"
-
-msgid ""
-"y - stage this hunk\n"
-"n - do not stage this hunk\n"
-"q - quit; do not stage this hunk or any of the remaining ones\n"
-"a - stage this hunk and all later hunks in the file\n"
-"d - do not stage this hunk or any of the later hunks in the file"
-msgstr ""
-"y - köa stycket\n"
-"n - köa inte stycket\n"
-"q - avsluta; köa inte stycket eller något av de följande\n"
-"a - köa stycket och alla följande i filen\n"
-"d - köa inte stycket eller något av de följande i filen"
-
-msgid ""
-"y - stash this hunk\n"
-"n - do not stash this hunk\n"
-"q - quit; do not stash this hunk or any of the remaining ones\n"
-"a - stash this hunk and all later hunks in the file\n"
-"d - do not stash this hunk or any of the later hunks in the file"
-msgstr ""
-"y - \"stash\":a stycket\n"
-"n - \"stash\":a inte stycket\n"
-"q - avsluta; \"stash\":a inte stycket eller något av de följande\n"
-"a - \"stash\":a stycket och alla följande i filen\n"
-"d - \"stash\":a inte stycket eller något av de följande i filen"
-
-msgid ""
-"y - unstage this hunk\n"
-"n - do not unstage this hunk\n"
-"q - quit; do not unstage this hunk or any of the remaining ones\n"
-"a - unstage this hunk and all later hunks in the file\n"
-"d - do not unstage this hunk or any of the later hunks in the file"
-msgstr ""
-"y - ta bort stycket från kön\n"
-"n - ta inte bort stycket från kön\n"
-"q - avsluta; ta inte bort stycket eller något av de följande från kön\n"
-"a - ta bort stycket och alla följande i filen från kön\n"
-"d - ta inte bort stycket eller något av de följande i filen från kön"
-
-msgid ""
-"y - apply this hunk to index\n"
-"n - do not apply this hunk to index\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - applicera stycket på indexet\n"
-"n - applicera inte stycket på indexet\n"
-"q - avsluta; applicera inte stycket eller något av de följande\n"
-"a - applicera stycket och alla följande i filen\n"
-"d - applicera inte stycket eller något av de följande i filen"
-
-msgid ""
-"y - discard this hunk from worktree\n"
-"n - do not discard this hunk from worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-"y - förkasta stycket från arbetskatalogen\n"
-"n - förkasta inte stycket från arbetskatalogen\n"
-"q - avsluta; förkasta inte stycket eller något av de följande\n"
-"a - förkasta stycket och alla följande i filen\n"
-"d - förkasta inte stycket eller något av de följande i filen"
-
-msgid ""
-"y - discard this hunk from index and worktree\n"
-"n - do not discard this hunk from index and worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-"y - förkasta stycket från indexet och arbetskatalogen\n"
-"n - förkasta inte stycket från indexet och arbetskatalogen\n"
-"q - avsluta; förkasta inte stycket eller något av de följande\n"
-"a - förkasta stycket och alla följande i filen\n"
-"d - förkasta inte stycket eller något av de följande i filen"
-
-msgid ""
-"y - apply this hunk to index and worktree\n"
-"n - do not apply this hunk to index and worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - applicera stycket på indexet och arbetskatalogen\n"
-"n - applicera inte stycket på indexet och arbetskatalogen\n"
-"q - avsluta; applicera inte stycket eller något av de följande\n"
-"a - applicera stycket och alla följande i filen\n"
-"d - applicera inte stycket eller något av de följande i filen"
-
-msgid ""
-"y - apply this hunk to worktree\n"
-"n - do not apply this hunk to worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - applicera stycket på arbetskatalogen\n"
-"n - applicera inte stycket på arbetskatalogen\n"
-"q - avsluta; applicera inte stycket eller något av de följande\n"
-"a - applicera stycket och alla följande i filen\n"
-"d - applicera inte stycket eller något av de följande i filen"
-
-msgid ""
-"g - select a hunk to go to\n"
-"/ - search for a hunk matching the given regex\n"
-"j - leave this hunk undecided, see next undecided hunk\n"
-"J - leave this hunk undecided, see next hunk\n"
-"k - leave this hunk undecided, see previous undecided hunk\n"
-"K - leave this hunk undecided, see previous hunk\n"
-"s - split the current hunk into smaller hunks\n"
-"e - manually edit the current hunk\n"
-"? - print help\n"
-msgstr ""
-"g - välj ett stycke att gå till\n"
-"/ - sök efter stycke som motsvarar angivet reguljärt uttryck\n"
-"j - lämna stycket obestämt, se nästa obestämda stycke\n"
-"J - lämna stycket obestämt, se nästa stycke\n"
-"k - lämna stycket obestämt, se föregående obestämda stycke\n"
-"K - lämna stycket obestämt, se föregående stycke\n"
-"s - dela aktuellt stycke i mindre styckens\n"
-"e - redigera aktuellt stycke manuellt\n"
-"? - visa hjälp\n"
-
-msgid "The selected hunks do not apply to the index!\n"
-msgstr "Markerade stycken kan inte appliceras på indexet!\n"
-
-#, perl-format
-msgid "ignoring unmerged: %s\n"
-msgstr "ignorerar ej sammanslagen: %s\n"
-
-msgid "No other hunks to goto\n"
-msgstr "Inga andra stycken att gå till\n"
-
-#, perl-format
-msgid "Invalid number: '%s'\n"
-msgstr "Ogiltigt siffervärde: \"%s\"\n"
-
-#, perl-format
-msgid "Sorry, only %d hunk available.\n"
-msgid_plural "Sorry, only %d hunks available.\n"
-msgstr[0] "Beklagar, det finns bara %d stycke.\n"
-msgstr[1] "Beklagar, det finns bara %d stycken.\n"
-
-msgid "No other hunks to search\n"
-msgstr "Inga andra stycken att söka efter\n"
-
-#, perl-format
-msgid "Malformed search regexp %s: %s\n"
-msgstr "Felaktigt format på reguljärt sökuttryck %s: %s\n"
-
-msgid "No hunk matches the given pattern\n"
-msgstr "Inga stycken motsvarar givet mönster\n"
-
-msgid "No previous hunk\n"
-msgstr "Inget föregående stycke\n"
-
-msgid "No next hunk\n"
-msgstr "Inget följande stycke\n"
-
-msgid "Sorry, cannot split this hunk\n"
-msgstr "Beklagar, kan inte dela stycket\n"
-
-#, perl-format
-msgid "Split into %d hunk.\n"
-msgid_plural "Split into %d hunks.\n"
-msgstr[0] "Dela i %d stycke.\n"
-msgstr[1] "Dela i %d stycken.\n"
-
-msgid "Sorry, cannot edit this hunk\n"
-msgstr "Beklagar, kan inte redigera stycket\n"
-
-#. TRANSLATORS: please do not translate the command names
-#. 'status', 'update', 'revert', etc.
-msgid ""
-"status - show paths with changes\n"
-"update - add working tree state to the staged set of changes\n"
-"revert - revert staged set of changes back to the HEAD version\n"
-"patch - pick hunks and update selectively\n"
-"diff - view diff between HEAD and index\n"
-"add untracked - add contents of untracked files to the staged set of "
-"changes\n"
-msgstr ""
-"status - visa sökvägar med ändringar\n"
-"update - lägg arbetskatalogens tillstånd till köade ändringar\n"
-"revert - återställ köade ändringar till HEAD-versionen\n"
-"patch - välj och uppdatera valda stycken\n"
-"diff - visa diff mellan HEAD och index\n"
-"add untracked - lägg till innehåll i ospårade filer till köade ändringar\n"
-
-msgid "missing --"
-msgstr "saknad --"
-
-#, perl-format
-msgid "unknown --patch mode: %s"
-msgstr "okänt läge för --patch: %s"
-
-#, perl-format
-msgid "invalid argument %s, expecting --"
-msgstr "felaktigt argument %s, förväntar --"
-
msgid "local zone differs from GMT by a non-minute interval\n"
msgstr "lokal zon skiljer sig från GMT med delar av minuter\n"
diff --git a/po/tr.po b/po/tr.po
index 484e0acf2d..a24a7ae9cb 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -1,8 +1,8 @@
# Turkish translations for Git
# Git Türkçe çevirileri
-# Copyright (C) 2020-2022 Emir SARI <emir_sari@icloud.com>
+# Copyright (C) 2020-2023 Emir SARI <emir_sari@icloud.com>
# This file is distributed under the same license as the Git package.
-# Emir SARI <emir_sari@icloud.com>, 2020-2022
+# Emir SARI <emir_sari@icloud.com>, 2020-2023
#
# ######################################################### #
# Git Türkçe kavramlar dizini / Git Turkish Glossary #
@@ -92,8 +92,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Git Turkish Localization Project\n"
"Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2022-09-28 10:54+0300\n"
-"PO-Revision-Date: 2022-09-28 14:00+0300\n"
+"POT-Creation-Date: 2023-03-03 11:32+0300\n"
+"PO-Revision-Date: 2023-03-03 11:40+0300\n"
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
"Language-Team: Turkish (https://github.com/bitigchi/git-po/)\n"
"Language: tr\n"
@@ -128,13 +128,13 @@ msgstr "'%s' hazırlanamadı"
msgid "could not write index"
msgstr "indeks yazılamadı"
-#, c-format, perl-format
+#, c-format
msgid "updated %d path\n"
msgid_plural "updated %d paths\n"
msgstr[0] "%d yol güncellendi\n"
msgstr[1] "%d yol güncellendi\n"
-#, c-format, perl-format
+#, c-format
msgid "note: %s is untracked now.\n"
msgstr "not: %s artık izlenmiyor.\n"
@@ -148,7 +148,7 @@ msgstr "Geri al"
msgid "Could not parse HEAD^{tree}"
msgstr "HEAD^{tree} ayrıştırılamadı"
-#, c-format, perl-format
+#, c-format
msgid "reverted %d path\n"
msgid_plural "reverted %d paths\n"
msgstr[0] "%d yol geri alındı\n"
@@ -161,7 +161,7 @@ msgstr "Ä°zlenmeyen dosya yok.\n"
msgid "Add untracked"
msgstr "Ä°zlenmeyenleri ekle"
-#, c-format, perl-format
+#, c-format
msgid "added %d path\n"
msgid_plural "added %d paths\n"
msgstr[0] "%d yol eklendi\n"
@@ -255,19 +255,19 @@ msgstr "indeks yenilenemedi"
msgid "Bye.\n"
msgstr "Güle güle.\n"
-#, c-format, perl-format
+#, c-format
msgid "Stage mode change [y,n,q,a,d%s,?]? "
msgstr "Kip değişimi hazırlansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage deletion [y,n,q,a,d%s,?]? "
msgstr "Silme hazırlansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage addition [y,n,q,a,d%s,?]? "
msgstr "Ekleme hazırlansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stage this hunk [y,n,q,a,d%s,?]? "
msgstr "Bu parça hazırlansın mı [y,n,q,a,d%s,?]? "
@@ -291,19 +291,19 @@ msgstr ""
"a - bu parçayı ve sonraki tüm parçaları hazırla\n"
"d - bu parçayı veya sonraki parçalardan herhangi birini hazırlama\n"
-#, c-format, perl-format
+#, c-format
msgid "Stash mode change [y,n,q,a,d%s,?]? "
msgstr "Kip değişimi zulalansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash deletion [y,n,q,a,d%s,?]? "
msgstr "Silme zulalansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash addition [y,n,q,a,d%s,?]? "
msgstr "Ekleme zulalansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Stash this hunk [y,n,q,a,d%s,?]? "
msgstr "Bu parça zulalansın mı [y,n,q,a,d%s,?]? "
@@ -327,19 +327,19 @@ msgstr ""
"a - bu parçayı ve sonraki tüm parçaları zulala\n"
"d - bu parçayı veya sonraki parçalardan herhangi birini zulalama\n"
-#, c-format, perl-format
+#, c-format
msgid "Unstage mode change [y,n,q,a,d%s,?]? "
msgstr "Kip değişimi hazırlıktan çıkarılsın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage deletion [y,n,q,a,d%s,?]? "
msgstr "Silme hazırlıktan çıkarılsın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage addition [y,n,q,a,d%s,?]? "
msgstr "Ekleme hazırlıktan çıkarılsın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Unstage this hunk [y,n,q,a,d%s,?]? "
msgstr "Bu parça hazırlıktan çıkarılsın mı [y,n,q,a,d%s,?]? "
@@ -363,19 +363,19 @@ msgstr ""
"a - bu parçayı ve sonraki tüm parçaları hazırlıktan çıkar\n"
"d - bu parçayı veya sonraki parçalardan herhangi birini hazırlıktan çıkarma\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to index [y,n,q,a,d%s,?]? "
msgstr "Kip değişimi indekse uygulansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to index [y,n,q,a,d%s,?]? "
msgstr "Silme indekse uygulansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to index [y,n,q,a,d%s,?]? "
msgstr "Ekleme indekse uygulansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to index [y,n,q,a,d%s,?]? "
msgstr "Bu parça indekse uygulansın mı [y,n,q,a,d%s,?]? "
@@ -399,19 +399,19 @@ msgstr ""
"a - bu parçayı ve sonraki tüm parçaları uygula\n"
"d - bu parçayı veya sonraki parçalardan herhangi birini uygulama\n"
-#, c-format, perl-format
+#, c-format
msgid "Discard mode change from worktree [y,n,q,a,d%s,?]? "
msgstr "Kip değişimi çalışma ağacından atılsın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard deletion from worktree [y,n,q,a,d%s,?]? "
msgstr "Silme çalışma ağacından atılsın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard addition from worktree [y,n,q,a,d%s,?]? "
msgstr "Ekleme çalışma ağacından atılsın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard this hunk from worktree [y,n,q,a,d%s,?]? "
msgstr "Bu parça çalışma ağacından atılsın mı [y,n,q,a,d%s,?]? "
@@ -435,20 +435,20 @@ msgstr ""
"a - bu parçayı ve sonraki tüm parçaları at\n"
"d - bu parçayı veya sonraki parçalardan herhangi birini atma\n"
-#, c-format, perl-format
+#, c-format
msgid "Discard mode change from index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Kip değişimi indeksten ve çalışma ağacından atılsın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard deletion from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Silme indeksten ve çalışma ağacından atılsın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard addition from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Ekleme indeksten ve çalışma ağacından atılsın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Discard this hunk from index and worktree [y,n,q,a,d%s,?]? "
msgstr "Bu parça indeksten ve çalışma ağacından atılsın mı [y,n,q,a,d%s,?]? "
@@ -465,20 +465,20 @@ msgstr ""
"a - bu parçayı ve sonraki tüm parçaları at\n"
"d - bu parçayı veya sonraki parçalardan herhangi birini atma\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to index and worktree [y,n,q,a,d%s,?]? "
msgstr ""
"Kip değişimi indekse ve çalışma ağacına uygulansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Silme indekse ve çalışma ağacına uygulansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Ekleme indekse ve çalışma ağacına uygulansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to index and worktree [y,n,q,a,d%s,?]? "
msgstr "Bu parça indekse ve çalışma ağacına uygulansın mı [y,n,q,a,d%s,?]? "
@@ -495,19 +495,19 @@ msgstr ""
"a - bu parçayı ve sonraki tüm parçaları uygula\n"
"d - bu parçayı veya sonraki parçalardan herhangi birini uygulama\n"
-#, c-format, perl-format
+#, c-format
msgid "Apply mode change to worktree [y,n,q,a,d%s,?]? "
msgstr "Kip değişimi çalışma ağacına uygulansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply deletion to worktree [y,n,q,a,d%s,?]? "
msgstr "Silme çalışma ağacına uygulansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply addition to worktree [y,n,q,a,d%s,?]? "
msgstr "Ekleme çalışma ağacına uygulansın mı [y,n,q,a,d%s,?]? "
-#, c-format, perl-format
+#, c-format
msgid "Apply this hunk to worktree [y,n,q,a,d%s,?]? "
msgstr "Bu parça çalışma ağacına uygulansın mı [y,n,q,a,d%s,?]? "
@@ -583,8 +583,6 @@ msgstr ""
"'%c' satır kaldırmak için onları silin.\n"
"%c kaldırılacak.\n"
-#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
-#. TRANSLATORS: 'it' refers to the patch mentioned in the previous messages.
msgid ""
"If it does not apply cleanly, you will be given an opportunity to\n"
"edit again. If all lines of the hunk are removed, then the edit is\n"
@@ -600,20 +598,12 @@ msgstr "parça üstbilgisi ayrıştırılamadı"
msgid "'git apply --cached' failed"
msgstr "'git apply --cached' başarısız oldu"
-#. #-#-#-#-# add-patch.c.po #-#-#-#-#
#. TRANSLATORS: do not translate [y/n]
#. The program will only accept that input at this point.
#. Consider translating (saying "no" discards!) as
#. (saying "n" for "no" discards!) if the translation
#. of the word "no" does not start with n.
#.
-#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
-#. TRANSLATORS: do not translate [y/n]
-#. The program will only accept that input
-#. at this point.
-#. Consider translating (saying "no" discards!) as
-#. (saying "n" for "no" discards!) if the translation
-#. of the word "no" does not start with n.
msgid ""
"Your edited hunk does not apply. Edit again (saying \"no\" discards!) [y/n]? "
msgstr ""
@@ -840,6 +830,9 @@ msgstr "komut satırı \\ ile bitiyor"
msgid "unclosed quote"
msgstr "kapatılmamış tırnak"
+msgid "too many arguments"
+msgstr "pek fazla argüman"
+
#, c-format
msgid "unrecognized whitespace option '%s'"
msgstr "tanımlanamayan boşluk seçeneği '%s'"
@@ -1441,6 +1434,12 @@ msgstr "çalışma dizinindeki .gitattributes'u oku"
msgid "report archived files on stderr"
msgstr "arşivlenmiş dosyaları stderr'de raporla"
+msgid "time"
+msgstr "zaman"
+
+msgid "set modification time of archive entries"
+msgstr "arşiv girdilerinin değiştirilme zamanını ayarla"
+
msgid "set compression level"
msgstr "sıkıştırma düzeyini ayarla"
@@ -1481,6 +1480,13 @@ msgstr "'%s' biçimi için desteklenmeyen argüman: -%d"
msgid "%.*s is not a valid attribute name"
msgstr "%.*s geçerli bir öznitelik adı değil"
+msgid "unable to add additional attribute"
+msgstr "ek öznitelik eklenemiyor"
+
+#, c-format
+msgid "ignoring overly long attributes line %d"
+msgstr "pek uzun öznitelik satırı %d yok sayılıyor"
+
#, c-format
msgid "%s not allowed: %s:%d"
msgstr "%s izin verilmiyor: %s:%d"
@@ -1493,6 +1499,18 @@ msgstr ""
"Gerçek öncü ünlem için '\\!' kullanın."
#, c-format
+msgid "cannot fstat gitattributes file '%s'"
+msgstr "fstat gitattributes dosyası '%s' bulunamıyor"
+
+#, c-format
+msgid "ignoring overly large gitattributes file '%s'"
+msgstr "pek büyük gitattributes dosyası '%s' dosyası yok sayılıyor"
+
+#, c-format
+msgid "ignoring overly large gitattributes blob '%s'"
+msgstr "pek büyük gitattributes ikili nesnesi '%s' yok sayılıyor"
+
+#, c-format
msgid "Badly quoted content in file '%s': %s"
msgstr "'%s' dosyasında hatalı tırnağa alınmış içerik: %s"
@@ -1768,11 +1786,11 @@ msgstr "'%s' altmodülü: altmodül bulunamıyor"
#, c-format
msgid ""
-"You may try updating the submodules using 'git checkout %s && git submodule "
-"update --init'"
+"You may try updating the submodules using 'git checkout --no-recurse-"
+"submodules %s && git submodule update --init'"
msgstr ""
-"Altmodülleri güncellemeyi 'git checkout %s && git submodule update --init' "
-"kullanarak deneyebilirsiniz"
+"'git checkout --no-recurse-submodules %s && git submodule update --init' "
+"kullanarak altmodülleri güncellemeyi deneyebilirsiniz"
#, c-format
msgid "submodule '%s': cannot create branch '%s'"
@@ -1807,6 +1825,13 @@ msgstr "kaldır: '%s'\n"
msgid "Unstaged changes after refreshing the index:"
msgstr "İndeksi yeniledikten sonra hazırlanmamış değişiklikler:"
+msgid ""
+"the add.interactive.useBuiltin setting has been removed!\n"
+"See its entry in 'git help config' for details."
+msgstr ""
+"add.interactive.useBuiltin ayarı kaldırıldı!\n"
+"Ayrıntılar için onun 'git help config' içindeki girdisine bakın."
+
msgid "Could not read the index"
msgstr "İndeks okunamadı"
@@ -1880,7 +1905,7 @@ msgid "allow updating entries outside of the sparse-checkout cone"
msgstr "aralıklı çıkış konisi dışındaki girdileri güncellemeye izin ver"
msgid "override the executable bit of the listed files"
-msgstr "listelenen dosyaların çalıştırılabilir kısımlarını geçersiz kıl"
+msgstr "listelenen dosyaların yürütülebilir kısımlarını geçersiz kıl"
msgid "warn when adding an embedded repository"
msgstr "gömülü bir depo eklenirken uyar"
@@ -2197,6 +2222,9 @@ msgstr "git am [<seçenekler>] (--continue | --skip | --abort)"
msgid "run interactively"
msgstr "etkileşimli olarak çalıştır"
+msgid "bypass pre-applypatch and applypatch-msg hooks"
+msgstr "pre-applypatch ve applypatch-msg kancalarını atla"
+
msgid "historical option -- no-op"
msgstr "tarihi seçenek -- no-op"
@@ -2339,32 +2367,27 @@ msgstr "git archive: Protokol hatası"
msgid "git archive: expected a flush"
msgstr "git archive: FloÅŸ bekleniyordu"
-msgid "git bisect--helper --bisect-reset [<commit>]"
-msgstr "git bisect--helper --bisect-reset [<iÅŸleme>]"
-
msgid ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}"
-"=<term>] [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] "
-"[<paths>...]"
+"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>] [--no-"
+"checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]"
msgstr ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<terim> --term-{old,good}"
-"=<terim>] [--no-checkout] [--first-parent] [<kötü> [<iyi>...]] [--] "
-"[<yollar>...]"
+"git bisect start [--term-{new,bad}=<terim> --term-{old,good}=<terim>] [--"
+"no-checkout] [--first-parent] [<kötü> [<iyi>...]] [--] [<yol-blrtç>...]"
-msgid "git bisect--helper --bisect-state (bad|new) [<rev>]"
-msgstr "git bisect--helper --bisect-state (bad|new) [<rev>]"
+msgid "git bisect (good|bad) [<rev>...]"
+msgstr "git bisect (good|bad) [<rev>...]"
-msgid "git bisect--helper --bisect-state (good|old) [<rev>...]"
-msgstr "git bisect--helper --bisect-state (good|old) [<rev>...]"
+msgid "git bisect skip [(<rev>|<range>)...]"
+msgstr "git bisect skip [(<rev>|<erim>)...]"
-msgid "git bisect--helper --bisect-replay <filename>"
-msgstr "git bisect--helper --bisect-replay <dosyaadı>"
+msgid "git bisect reset [<commit>]"
+msgstr "git bisect reset [<iÅŸleme>]"
-msgid "git bisect--helper --bisect-skip [(<rev>|<range>)...]"
-msgstr "git bisect--helper --bisect-skip [(<rev>|<erim>)...]"
+msgid "git bisect replay <logfile>"
+msgstr "git bisect replay <günlük-dosyası>"
-msgid "git bisect--helper --bisect-run <cmd>..."
-msgstr "git bisect--helper --bisect-run <komut>..."
+msgid "git bisect run <cmd>..."
+msgstr "git bisect run <komut>..."
#, c-format
msgid "cannot open file '%s' in mode '%s'"
@@ -2508,9 +2531,6 @@ msgstr "hatalı HEAD - Bana bir HEAD gerek"
msgid "checking out '%s' failed. Try 'git bisect start <valid-branch>'."
msgstr "'%s' çıkış yapımı başarısız. 'git bisect start <geçerli-dal>' deneyin."
-msgid "won't bisect on cg-seek'ed tree"
-msgstr "cg-seek yapılmış bir ağaçta ikili arama yapılmayacak"
-
msgid "bad HEAD - strange symbolic ref"
msgstr "hatalı HEAD - tuhaf sembolik başvuru"
@@ -2562,17 +2582,16 @@ msgid "bisect run failed: no command provided."
msgstr "ikili arama başarısız: Komut verilmedi."
#, c-format
-msgid "unable to verify '%s' on good revision"
-msgstr "'%s', iyi revizyonda doğrulanamadı"
+msgid "unable to verify %s on good revision"
+msgstr "%s, iyi revizyonda doğrulanamıyor"
#, c-format
msgid "bogus exit code %d for good revision"
msgstr "iyi revizyon için anlamsız %d çıkış kodu"
#, c-format
-msgid "bisect run failed: exit code %d from '%s' is < 0 or >= 128"
-msgstr ""
-"bisect çalıştırılamadı: çıkış kodu %d, '%s' konumundan, < 0 veya >= 128"
+msgid "bisect run failed: exit code %d from %s is < 0 or >= 128"
+msgstr "bisect çalıştırılamadı: çıkış kodu %d, %s konumundan, < 0 veya >= 128"
#, c-format
msgid "cannot open file '%s' for writing"
@@ -2581,76 +2600,48 @@ msgstr "'%s' dosyası yazma için açılamadı"
msgid "bisect run cannot continue any more"
msgstr "ikili arama artık çalışmayı sürdüremiyor"
-#, c-format
msgid "bisect run success"
msgstr "ikili arama başarılı"
-#, c-format
msgid "bisect found first bad commit"
msgstr "ikili arama ilk hatalı işlemeyi buldu"
#, c-format
-msgid ""
-"bisect run failed: 'git bisect--helper --bisect-state %s' exited with error "
-"code %d"
-msgstr ""
-"ikili arama çalıştırılamadı: 'git bisect--helper --bisect-state %s', %d hata "
-"koduyla çıktı"
-
-msgid "reset the bisection state"
-msgstr "ikili arama durumunu sıfırla"
-
-msgid "check whether bad or good terms exist"
-msgstr "iyi veya kötü terimlerin olup olmadığını denetle"
+msgid "bisect run failed: 'git bisect %s' exited with error code %d"
+msgstr "ikili arama çalıştırılamadı: 'git bisect %s', %d hata koduyla çıktı"
-msgid "print out the bisect terms"
-msgstr "ikili arama terimlerini yazdır"
-
-msgid "start the bisect session"
-msgstr "ikili arama oturumunu baÅŸlat"
-
-msgid "find the next bisection commit"
-msgstr "bir sonraki ikili arama iÅŸlemesini bul"
-
-msgid "mark the state of ref (or refs)"
-msgstr "başvurunun (veya başvuruların) durumunu imle"
-
-msgid "list the bisection steps so far"
-msgstr "ÅŸu ana kadarki ikili arama durumunu listele"
-
-msgid "replay the bisection process from the given file"
-msgstr "verilen dosyadan ikili arama iÅŸlemini yeniden oynat"
-
-msgid "skip some commits for checkout"
-msgstr "çıkış için birkaç işlemeyi atla"
-
-msgid "visualize the bisection"
-msgstr "ikili aramayı görselleştir"
-
-msgid "use <cmd>... to automatically bisect"
-msgstr "kendiliğinden ikili aramak için <komut>... kullan"
+#, c-format
+msgid "'%s' requires either no argument or a commit"
+msgstr "'%s', bir argüman veya işleme gerektirmiyor"
-msgid "no log for BISECT_WRITE"
-msgstr "BISECT_WRITE için günlük yok"
+#, c-format
+msgid "'%s' requires 0 or 1 argument"
+msgstr "'%s', 0 veya 1 argümanı gerektiriyor"
-msgid "--bisect-reset requires either no argument or a commit"
-msgstr "--bisect-reset bir argüman veya işleme gerektirmiyor"
+#, c-format
+msgid "'%s' requires 0 arguments"
+msgstr "'%s', 0 argüman gerektiriyor"
-msgid "--bisect-terms requires 0 or 1 argument"
-msgstr "--bisect-terms 0 veya 1 argüman gerektiriyor"
+msgid "no logfile given"
+msgstr "hiçbir günlük dosyası verilmedi"
-msgid "--bisect-next requires 0 arguments"
-msgstr "--bisect-next 0 argüman gerektiriyor"
+#, c-format
+msgid "'%s' failed: no command provided."
+msgstr "'%s' başarısız: Komut verilmedi."
-msgid "--bisect-log requires 0 arguments"
-msgstr "--bisect-log 0 argüman gerektiriyor"
+msgid "need a command"
+msgstr "bir komut gerekli"
-msgid "no logfile given"
-msgstr "hiçbir günlük dosyası verilmedi"
+#, c-format
+msgid "unknown command: '%s'"
+msgstr "bilinmeyen komut: '%s'"
msgid "git blame [<options>] [<rev-opts>] [<rev>] [--] <file>"
msgstr "git blame [<seçenekler>] [<rev-sçnk>] [<rev>] [--] <dosya>"
+msgid "git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>"
+msgstr "git annotate [<seçenekler>] [<rev-sçnk>] [<rev>] [--] <dosya>"
+
msgid "<rev-opts> are documented in git-rev-list(1)"
msgstr "<rev-sçnk>, git-rev-list(1) içinde belgelendirilmiştir"
@@ -2774,7 +2765,7 @@ msgstr[0] "%s dosyasında yalnızca %lu satır var"
msgstr[1] "%s dosyasında yalnızca %lu satır var"
msgid "Blaming lines"
-msgstr "Genel bakış satırları"
+msgstr "Satırlara bakılıyor"
msgid "git branch [<options>] [-r | -a] [--merged] [--no-merged]"
msgstr "git branch [<seçenekler>] [-r | -a] [--merged] [--no-merged]"
@@ -2838,9 +2829,6 @@ msgstr "config-file güncellemesi başarısız"
msgid "cannot use -a with -d"
msgstr "-a, -d ile kullanılamıyor"
-msgid "Couldn't look up commit object for HEAD"
-msgstr "HEAD için işleme nesnesi aranamadı"
-
#, c-format
msgid "Cannot delete branch '%s' checked out at '%s'"
msgstr "'%s' dalı silinemiyor, şurada çıkış yapılmış: '%s'"
@@ -2879,16 +2867,18 @@ msgstr "%s dalı %s konumunda yeniden temellendiriliyor"
msgid "Branch %s is being bisected at %s"
msgstr "%s dalı %s konumunda ikili aranıyor"
-msgid "cannot copy the current branch while not on any."
-msgstr "Bir dalın üzerinde değilken geçerli dal kopyalanamaz."
-
-msgid "cannot rename the current branch while not on any."
-msgstr "Bir dalın üzerinde değilken geçerli dal yeniden adlandırılamaz."
-
#, c-format
msgid "Invalid branch name: '%s'"
msgstr "Geçersiz dal adı: '%s'"
+#, c-format
+msgid "No commit on branch '%s' yet."
+msgstr "'%s' dalında henüz bir işleme yok."
+
+#, c-format
+msgid "No branch named '%s'."
+msgstr "'%s' adında bir dal yok."
+
msgid "Branch rename failed"
msgstr "Dal yeniden adlandırması başarısız"
@@ -3047,22 +3037,20 @@ msgstr "Ayrılmış HEAD'e açıklama verilemiyor"
msgid "cannot edit description of more than one branch"
msgstr "birden çok dalın açıklaması düzenlenemiyor"
-#, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "'%s' dalında henüz bir işleme yok."
+msgid "cannot copy the current branch while not on any."
+msgstr "Bir dalın üzerinde değilken geçerli dal kopyalanamaz."
-#, c-format
-msgid "No branch named '%s'."
-msgstr "'%s' adında bir dal yok."
+msgid "cannot rename the current branch while not on any."
+msgstr "Bir dalın üzerinde değilken geçerli dal yeniden adlandırılamaz."
msgid "too many branches for a copy operation"
-msgstr "bir kopyalama işlemi için çok fazla dal"
+msgstr "bir kopyalama işlemi için pek fazla dal"
msgid "too many arguments for a rename operation"
-msgstr "bir yeniden adlandırma işlemi için çok fazla argüman"
+msgstr "bir yeniden adlandırma işlemi için pek fazla argüman"
msgid "too many arguments to set new upstream"
-msgstr "yeni üstkaynak ayarlamak için çok fazla argüman"
+msgstr "yeni üstkaynak ayarlamak için pek fazla argüman"
#, c-format
msgid ""
@@ -3080,7 +3068,7 @@ msgid "branch '%s' does not exist"
msgstr "'%s' diye bir dal yok"
msgid "too many arguments to unset upstream"
-msgstr "üst kaynağı kaldırmak için çok fazla argüman"
+msgstr "üst kaynağı kaldırmak için pek fazla argüman"
msgid "could not unset upstream of HEAD when it does not point to any branch."
msgstr ""
@@ -3121,11 +3109,11 @@ msgid "not run from a git repository - no hooks to show\n"
msgstr "bir git deposundan çalıştırılmadı - gösterilecek kanca yok\n"
msgid ""
-"git bugreport [-o|--output-directory <file>] [-s|--suffix <format>] [--"
-"diagnose[=<mode>]"
+"git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--diagnose[=<mode>]]"
msgstr ""
-"git bugreport [-o|--output-directory <dosya>] [-s|--suffix <biçim>] [--"
-"diagnose[=<kip>]"
+"git bugreport [(-o | --output-directory) <yol>] [(-s | --suffix) <biçim>]\n"
+" [--diagnose[=<kip>]]"
msgid ""
"Thank you for filling out a Git bug report!\n"
@@ -3196,17 +3184,26 @@ msgstr "%s dosyasına yazılamıyor"
msgid "Created new report at '%s'.\n"
msgstr "Hata raporu '%s' dosyasına yazıldı.\n"
-msgid "git bundle create [<options>] <file> <git-rev-list args>"
-msgstr "git bundle create [<seçenekler>] <dosya> <git-rev-liste argümanlar>"
+msgid ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<version>] <file> <git-rev-list-args>"
+msgstr ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<sürüm>] <dosya> <git-rev-liste-argümanları>"
-msgid "git bundle verify [<options>] <file>"
-msgstr "git bundle verify [<seçenekler>] <dosya>"
+msgid "git bundle verify [-q | --quiet] <file>"
+msgstr "git bundle verify [-q | --quiet] <dosya>"
msgid "git bundle list-heads <file> [<refname>...]"
msgstr "git bundle list-heads <dosya> [<başvuru-adı>...]"
-msgid "git bundle unbundle <file> [<refname>...]"
-msgstr "git bundle unbundle <dosya> [<başvuru-adı>...]"
+msgid "git bundle unbundle [--progress] <file> [<refname>...]"
+msgstr "git bundle unbundle [--progress] <dosya> [<başvuru-adı>...]"
+
+msgid "need a <file> argument"
+msgstr "bir <dosya> argümanı gerekiyor"
msgid "do not show progress meter"
msgstr "ilerleme çubuğunu gösterme"
@@ -3261,10 +3258,6 @@ msgstr "%s, argümanlar gerektiriyor"
msgid "%s takes no arguments"
msgstr "%s, bir argüman almıyor"
-#, c-format
-msgid "unknown command: '%s'"
-msgstr "bilinmeyen komut: '%s'"
-
msgid "only one batch option may be specified"
msgstr "yalnızca bir toplu iş seçeneği belirtilebilir"
@@ -3281,12 +3274,12 @@ msgid ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgstr ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgid ""
"git cat-file (--textconv | --filters)\n"
@@ -3396,18 +3389,22 @@ msgstr "<revizyon>, '%s' ile gerekiyor"
msgid "<object> required with '-%c'"
msgstr "<nesne>, '-%c' ile gerekiyor"
-msgid "too many arguments"
-msgstr "çok fazla argüman"
-
#, c-format
msgid "only two arguments allowed in <type> <object> mode, not %d"
msgstr "<tür> <nesne> kipinde yalnızca iki argümana izin veriliyor, %d değil"
-msgid "git check-attr [-a | --all | <attr>...] [--] <pathname>..."
-msgstr "git check-attr [-a | --all | <öznitelik>...] [--] <yol-adı>..."
+msgid ""
+"git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] "
+"<pathname>..."
+msgstr ""
+"git check-attr [--source <ağacımsı>] [-a | --all | <öznitelik>...] [--] <yol-"
+"adı>..."
-msgid "git check-attr --stdin [-z] [-a | --all | <attr>...]"
-msgstr "git check-attr --stdin [-z] [-a | --all | <öznitelik>...]"
+msgid ""
+"git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]"
+msgstr ""
+"git check-attr --stdin [-z] [--source <ağacımsı>] [-a | --all | "
+"<öznitelik>...]"
msgid "report all attributes set on file"
msgstr "tüm dosya özniteliklerini bildir"
@@ -3421,6 +3418,12 @@ msgstr "dosya adlarını stdin'den oku"
msgid "terminate input and output records by a NUL character"
msgstr "girdi ve çıktı kayıtlarını bir NUL karakteri ile sonlandır"
+msgid "<tree-ish>"
+msgstr "<ağacımsı>"
+
+msgid "which tree-ish to check attributes at"
+msgstr "özniteliklerin hangi ağacımsıda denetleneceği"
+
msgid "suppress progress reporting"
msgstr "ilerleme bildirimini gizle"
@@ -3929,9 +3932,11 @@ msgid "use overlay mode"
msgstr "yerpaylaşım kipini kullan"
msgid ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] "
+"[<pathspec>...]"
msgstr ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <dizgi>] [-x | -X] [--] <yollar>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <dizgi>] [-x | -X] [--] [<yol-"
+"blrtç>...]"
#, c-format
msgid "Removing %s\n"
@@ -3995,7 +4000,7 @@ msgstr ""
"* - tüm ögeleri seç\n"
" - (boş) seçimi bitir\n"
-#, c-format, perl-format
+#, c-format
msgid "Huh (%s)?\n"
msgstr "Pardon (%s)?\n"
@@ -4144,9 +4149,6 @@ msgstr "derinlik"
msgid "create a shallow clone of that depth"
msgstr "verilen derinlikte sığ bir depo oluştur"
-msgid "time"
-msgstr "zaman"
-
msgid "create a shallow clone since a specific time"
msgstr "verilen zamandan sonrasını içeren bir sığ depo oluştur"
@@ -4223,6 +4225,10 @@ msgid "failed to start iterator over '%s'"
msgstr "yineleyici '%s' üzerinden çalıştırılamadı"
#, c-format
+msgid "symlink '%s' exists, refusing to clone with --local"
+msgstr "'%s' sembolik bağlantısı var, --local ile klonlama reddediliyor"
+
+#, c-format
msgid "failed to unlink '%s'"
msgstr "'%s' bağlantısı kesilemedi"
@@ -4286,10 +4292,6 @@ msgstr "Çok fazla argüman."
msgid "You must specify a repository to clone."
msgstr "Klonlamak için bir depo belirtmelisiniz."
-#, c-format
-msgid "options '%s' and '%s %s' cannot be used together"
-msgstr "'%s' ve '%s %s' seçenekleri birlikte kullanılamaz"
-
msgid ""
"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
"exclude"
@@ -4374,6 +4376,9 @@ msgstr "depo ilklendirilemedi, demet URI'si atlanıyor"
msgid "failed to fetch objects from bundle URI '%s'"
msgstr "'%s' demet URI'sinden nesneler getirilemedi"
+msgid "failed to fetch advertised bundles"
+msgstr "tanıtılan demetler alınamadı"
+
msgid "remote transport reported error"
msgstr "uzak konum taşıması hata bildirdi"
@@ -4409,18 +4414,24 @@ msgid "--command must be the first argument"
msgstr "--command ilk argüman olmalı"
msgid ""
-"git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"
+"git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]"
msgstr ""
-"git commit-graph verify [--object-dir <nsndzn>] [--shallow] [--[no-]progress]"
+"git commit-graph verify [--object-dir <dizin>] [--shallow] [--[no-]progress]"
msgid ""
-"git commit-graph write [--object-dir <objdir>] [--append] [--"
-"split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] <split options>"
+"git commit-graph write [--object-dir <dir>] [--append]\n"
+" [--split[=<strategy>]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <split options>"
msgstr ""
-"git commit-graph write [--object-dir <nsndzn>] [--append] [--"
-"split[=<strateji>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] <bölme-seçenekleri>"
+"git commit-graph write [--object-dir <dizin>] [--append]\n"
+" [--split[=<<strateji>]] [--reachable | --stdin-packs "
+"| --stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <bölme-seçenekleri>"
msgid "dir"
msgstr "dizin"
@@ -4491,12 +4502,16 @@ msgstr ""
msgid "Collecting commits from input"
msgstr "Girdiden işlemeler toplanıyor"
+msgid "git commit-tree <tree> [(-p <parent>)...]"
+msgstr "git commit-tree <ağaç> [(-p <üst-öge>)...]"
+
msgid ""
-"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...] [(-F "
-"<file>)...] <tree>"
+"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n"
+" [(-F <file>)...] <tree>"
msgstr ""
-"git commit-tree [(-p <üst-öge>)...] [-S[<değer-no>]] [(-m <ileti>)...] [(-F "
-"<dosya>)...] <ağaç>"
+"git commit-tree [(-p <üst-öge>)...] [-S[<anahtar-kimliği>]] [(-m "
+"<ileti>)...]\n"
+" [(-F <dosya>)...] <ağaç>"
#, c-format
msgid "duplicate parent %s ignored"
@@ -4538,11 +4553,29 @@ msgstr "bir tam ağaç vermeli"
msgid "git commit-tree: failed to read"
msgstr "git commit-tree: okunamadı"
-msgid "git commit [<options>] [--] <pathspec>..."
-msgstr "git commit [<seçenekler>] [--] <yol-blrtç>..."
+msgid ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|"
+"reword):]<commit>)]\n"
+" [-F <file> | -m <msg>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n"
+" [--date=<date>] [--cleanup=<mode>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<kip>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <iÅŸleme> | --fixup [(amend|"
+"reword):]<iÅŸleme>)]\n"
+" [-F <dosya> | -m <ileti>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n"
+" [--date=<tarih>] [--cleanup=<kip>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<dosya> [--pathspec-file-nul]]\n"
+" [(--trailer <jeton>[(=|:)<deÄŸer>])...] [-S[<anahtar-kimliÄŸi>]]\n"
+" [--] [<yol-blrtç>...]"
-msgid "git status [<options>] [--] <pathspec>..."
-msgstr "git status [<seçenekler>] [--] <yol-blrtç>..."
+msgid "git status [<options>] [--] [<pathspec>...]"
+msgstr "git status [<seçenekler>] [--] [<yol-blrtç>...]"
msgid ""
"You asked to amend the most recent commit, but doing so would make\n"
@@ -5298,7 +5331,7 @@ msgid ""
"\n"
"\tchmod 0700 %s"
msgstr ""
-"Soket dizininizdeki izinler çok gevşek; diğer kullanıcılar sizin\n"
+"Yuva dizininizdeki izinler çok gevşek; diğer kullanıcılar sizin\n"
"önbelleğe alınmış yetkilerinizi okuyabilirler. Şunu çalıştırmayı düşünün:\n"
"\n"
"\tchmod 0700 %s"
@@ -5307,20 +5340,27 @@ msgid "print debugging messages to stderr"
msgstr "hata ayıklama iletilerini stderr'e yazdır"
msgid "credential-cache--daemon unavailable; no unix socket support"
-msgstr "credential-cache--daemon kullanılamıyor; unix soket desteği yok"
+msgstr "credential-cache--daemon kullanılamıyor; unix yuva desteği yok"
msgid "credential-cache unavailable; no unix socket support"
-msgstr "credential-cache kullanılamıyor; unix soket desteği yok"
+msgstr "credential-cache kullanılamıyor; unix yuva desteği yok"
#, c-format
msgid "unable to get credential storage lock in %d ms"
msgstr "kimlik depo kilidi %d ms içinde alınamadı"
-msgid "git describe [<options>] [<commit-ish>...]"
-msgstr "git describe [<seçenekler>] [<işlememsi>...]"
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<iÅŸlememsi>...]"
-msgid "git describe [<options>] --dirty"
-msgstr "git describe [<seçenekler>] --dirty"
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<im>]"
+
+msgid "git describe <blob>"
+msgstr "git describe <ikili>"
msgid "head"
msgstr "dal ucu"
@@ -5442,11 +5482,11 @@ msgid "option '%s' and commit-ishes cannot be used together"
msgstr "'%s' seçeneği ve işlememsiler birlikte kullanılamaz"
msgid ""
-"git diagnose [-o|--output-directory <path>] [-s|--suffix <format>] [--"
-"mode=<mode>]"
+"git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--mode=<mode>]"
msgstr ""
-"git diagnose [-o|--output-directory <yol>] [-s|--suffix <biçim>] [--"
-"mode=<kip>]"
+"git diagnose [(-o | --output-directory) <yol>] [(-s | --suffix) <biçim>]\n"
+" [--mode=<kip>]"
msgid "specify a destination for the diagnostics archive"
msgstr "tanı arşivi için bir hedef konum belirtin"
@@ -5464,6 +5504,9 @@ msgstr "--merge-base yalnızca iki işleme ile kullanılabilir"
msgid "'%s': not a regular file or symlink"
msgstr "'%s': Sıradan bir dosya veya sembolik bağ değil"
+msgid "no merge given, only parents."
+msgstr "birleştirme verilmedi, yalnızca üst ögeler."
+
#, c-format
msgid "invalid option: %s"
msgstr "geçersiz seçenek: %s"
@@ -5579,29 +5622,6 @@ msgstr "--tool=<araç> için bir <araç> verilmedi"
msgid "no <cmd> given for --extcmd=<cmd>"
msgstr "--extcmd=<komut> için bir <komut> verilmedi"
-msgid "git env--helper --type=[bool|ulong] <options> <env-var>"
-msgstr "git env--helper --type=[bool|ulong] <seçenekler> <ortam-dğşkn>"
-
-msgid "default for git_env_*(...) to fall back on"
-msgstr "git_env_*(...)'ın geri çekileceği öntanımlı"
-
-msgid "be quiet only use git_env_*() value as exit code"
-msgstr "sessiz ol, yalnızca git_env_*() değerini çıkış kodu olarak kullan"
-
-#, c-format
-msgid "option `--default' expects a boolean value with `--type=bool`, not `%s`"
-msgstr ""
-"--default seçeneği, --type=bool ile birlikte bir Boole değeri bekliyor, '%s' "
-"deÄŸil"
-
-#, c-format
-msgid ""
-"option `--default' expects an unsigned long value with `--type=ulong`, not `"
-"%s`"
-msgstr ""
-"--default seçeneği, --type=ulong ile birlikte bir imzalanmamış uzun değer "
-"bekliyor, '%s' deÄŸil"
-
msgid "git fast-export [<rev-list-opts>]"
msgstr "git fast-export [<revizyon-listesi-seçenekleri>]"
@@ -5999,6 +6019,10 @@ msgstr "--deepen içinde negatif derinlik desteklenmiyor"
msgid "--unshallow on a complete repository does not make sense"
msgstr "tam bir depo üzerinde --unshallow bir anlam ifade etmiyor"
+#, c-format
+msgid "failed to fetch bundles from '%s'"
+msgstr "'%s' konumundan demetler getirilemedi"
+
msgid "fetch --all does not take a repository argument"
msgstr "fetch --all bir depo argümanı almıyor"
@@ -6101,8 +6125,8 @@ msgstr "yalnızca işlemeyi içeren başvuruları yazdır"
msgid "print only refs which don't contain the commit"
msgstr "yalnızca işlemeyi içermeyen başvuruları yazdır"
-msgid "git for-each-repo --config=<config> <command-args>"
-msgstr "git for-each-repo --config=<yapılandırma> <komut-argümanları>"
+msgid "git for-each-repo --config=<config> [--] <arguments>"
+msgstr "git for-each-repo --config=<yapılandırma> [--] <argümanlar>"
msgid "config"
msgstr "yapılandırma"
@@ -6273,8 +6297,16 @@ msgstr "cache-tree içinde ağaç olmayan öge"
msgid "%s: invalid sha1 pointer in resolve-undo"
msgstr "%s: resolve-undo içinde geçersiz sha1 işaretçisi"
-msgid "git fsck [<options>] [<object>...]"
-msgstr "git fsck [<seçenekler>] [<nesne>...]"
+msgid ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<object>...]"
+msgstr ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<nesne>...]"
msgid "show unreachable objects"
msgstr "ulaşılamayan nesneleri göster"
@@ -6329,12 +6361,6 @@ msgstr "git fsmonitor--daemon start [<seçenekler>]"
msgid "git fsmonitor--daemon run [<options>]"
msgstr "git fsmonitor--daemon run [<seçenekler>]"
-msgid "git fsmonitor--daemon stop"
-msgstr "git fsmonitor--daemon stop"
-
-msgid "git fsmonitor--daemon status"
-msgstr "git fsmonitor--daemon status"
-
#, c-format
msgid "value of '%s' out of range: %d"
msgstr "'%s' değeri erim dışında: %d"
@@ -6574,8 +6600,20 @@ msgstr "belirli bir görevi çalıştır"
msgid "use at most one of --auto and --schedule=<frequency>"
msgstr "tek kezde --auto ve --schedule=<sıklık>'tan birini kullan"
-msgid "failed to run 'git config'"
-msgstr "'git config' çalıştırılamadı"
+#, c-format
+msgid "unable to add '%s' value of '%s'"
+msgstr "şunun için '%s' değeri eklenemiyor: '%s'"
+
+msgid "return success even if repository was not registered"
+msgstr "depo kaydı yapılmamış olsa bile başarılı durum döndür"
+
+#, c-format
+msgid "unable to unset '%s' value of '%s'"
+msgstr "şunun '%s' değeri ayarı kaldırılamıyor: '%s'"
+
+#, c-format
+msgid "repository '%s' is not registered"
+msgstr "'%s' deposu kaydı yapılmamış"
#, c-format
msgid "failed to expand path '%s'"
@@ -6863,11 +6901,14 @@ msgid "both --cached and trees are given"
msgstr "hem --cached hem ağaçlar verilmiş"
msgid ""
-"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters] [--stdin] "
-"[--] <file>..."
+"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]\n"
+" [--stdin [--literally]] [--] <file>..."
msgstr ""
-"git hash-object [-t <tür>] [-w] [--path=<dosya> | --no-filters] [--stdin] "
-"[--] <dosya>..."
+"git hash-object [-t <tür>] [-w] [--path=<dosya> | --no-filters]\n"
+" [--stdin [--literally]] [--] <dosya>..."
+
+msgid "git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]"
+msgstr "git hash-object [-t <tür>] [-w] --stdin-paths [--no-filters]"
msgid "object type"
msgstr "nesne türü"
@@ -7001,12 +7042,19 @@ msgstr "kullanım: %s%s"
msgid "'git help config' for more information"
msgstr "ek bilgi için: 'git help config'"
-msgid "git hook run [--ignore-missing] <hook-name> [-- <hook-args>]"
-msgstr "git hook run [--ignore-missing] <kanca-adı> [-- <kanca-argümanları>]"
+msgid ""
+"git hook run [--ignore-missing] [--to-stdin=<path>] <hook-name> [-- <hook-"
+"args>]"
+msgstr ""
+"git hook run [--ignore-missing] [--to-stdin=<yol>] <kanca-adı> [-- <kanca-"
+"argümanları>]"
msgid "silently ignore missing requested <hook-name>"
msgstr "istenen eksik <kanca-adı> sessizce yok sayılıyor"
+msgid "file to read into hooks' stdin"
+msgstr "kancaların stdin'ine okunacak dosya"
+
#, c-format
msgid "object type mismatch at %s"
msgstr "%s konumunda nesne türü uyuşmazlığı"
@@ -7295,11 +7343,15 @@ msgid "Initialized empty Git repository in %s%s\n"
msgstr "%s%s içinde boş Git deposu ilklendirildi\n"
msgid ""
-"git init [-q | --quiet] [--bare] [--template=<template-directory>] [--"
-"shared[=<permissions>]] [<directory>]"
+"git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
+" [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+" [-b <branch-name> | --initial-branch=<branch-name>]\n"
+" [--shared[=<permissions>]] [<directory>]"
msgstr ""
-"git init [-q | --quiet] [--bare] [--template=<ÅŸablon-dizini>] [--"
-"shared[=<izinler>]] [<dizin>]"
+"git init [-q | --quiet] [--bare] [--template=<ÅŸablon-dizini>]\n"
+" [--separate-git-dir <git-dizini>] [--object-format=<biçim>]\n"
+" [-b <dal-adı> | --initial-branch=<dal-adı>]\n"
+" [--shared[=<izinler>]] [<dizin>]"
msgid "permissions"
msgstr "izinler"
@@ -7340,11 +7392,13 @@ msgid "--separate-git-dir incompatible with bare repository"
msgstr "--separate-git-dir, çıplak depo ile uyumsuz"
msgid ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<token>[(=|:)<value>])...] [<file>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <token>[(=|:)<value>])...]\n"
+" [--parse] [<file>...]"
msgstr ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<jeton>[(=|:)<deÄŸer>])...] [<dosya>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <jeton>[(=|:)<deÄŸer>])...]\n"
+" [--parse] [<dosya>...]"
msgid "edit files in place"
msgstr "dosyaları yerinde düzenle"
@@ -7822,12 +7876,12 @@ msgstr ""
msgid ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<repository> [<refs>...]]"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n"
+" [--symref] [<repository> [<patterns>...]]"
msgstr ""
-"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<çlştr>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<depo> [<baÅŸvurular>...]]"
+"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<yürütülebilir>]\n"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<anahtar>]\n"
+" [--symref] [<depo> [<dizgiler>...]]"
msgid "do not print remote URL"
msgstr "uzak konum URL'sini yazdırma"
@@ -7955,12 +8009,12 @@ msgstr "git merge-base [-a | --all] <iÅŸleme> <iÅŸleme>..."
msgid "git merge-base [-a | --all] --octopus <commit>..."
msgstr "git merge-base [-a | --all] --octopus <iÅŸleme>..."
-msgid "git merge-base --independent <commit>..."
-msgstr "git merge-base --independent <iÅŸleme>..."
-
msgid "git merge-base --is-ancestor <commit> <commit>"
msgstr "git merge-base --is-ancestor <iÅŸleme> <iÅŸleme>"
+msgid "git merge-base --independent <commit>..."
+msgstr "git merge-base --independent <iÅŸleme>..."
+
msgid "git merge-base --fork-point <ref> [<commit>]"
msgstr "git merge-base --fork-point <baÅŸvuru> [<iÅŸleme>]"
@@ -8068,9 +8122,26 @@ msgstr "kipi/oid'si/hazırlığı olmayan dosya adlarını listele"
msgid "allow merging unrelated histories"
msgstr "birbiriyle ilişkisi olmayan geçmişlerin birleştirilmesine izin ver"
+msgid "perform multiple merges, one per line of input"
+msgstr "girdi satırı başına bir adet çoklu birleştirmeler gerçekleştir"
+
+msgid "specify a merge-base for the merge"
+msgstr "birleştirme için bir birleştirme temeli belirtilmeli"
+
msgid "--trivial-merge is incompatible with all other options"
msgstr "--trivial-merge, tüm diğer seçeneklerle uyumsuz"
+msgid "--merge-base is incompatible with --stdin"
+msgstr "--merge-base, --stdin ile uyumsuz"
+
+#, c-format
+msgid "malformed input line: '%s'."
+msgstr "hatalı oluşturulmuş girdi satırı: '%s'."
+
+#, c-format
+msgid "merging cannot continue; got unclean result of %d"
+msgstr "birleştirme sürdürülemiyor; %d için temiz olmayan sonuçlar alındı"
+
msgid "git merge [<options>] [<commit>...]"
msgstr "git merge [<seçenekler>] [<işleme>...]"
@@ -8683,10 +8754,6 @@ msgid "cannot read note data from non-blob object '%s'."
msgstr "İkili nesne olmayan '%s' nesnesinden not verisi okunamıyor."
#, c-format
-msgid "malformed input line: '%s'."
-msgstr "hatalı oluşturulmuş girdi satırı: '%s'."
-
-#, c-format
msgid "failed to copy notes from '%s' to '%s'"
msgstr "notlar '%s' konumundan '%s' konumuna kopyalanamadı"
@@ -8875,16 +8942,16 @@ msgstr "notları <not-bşvr>'ndan kullan"
msgid "unknown subcommand: `%s'"
msgstr "bilinmeyen altkomut: '%s'"
-msgid ""
-"git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"
+msgid "git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"
msgstr ""
-"git pack-objects --stdout [<seçenekler>...] [< <bşvr-liste> | < <nesne-"
-"liste>]"
+"git pack-objects --stdout [<sçnklr>] [< <başvuru-listesi> | < <nesne-"
+"listesi>]"
msgid ""
-"git pack-objects [<options>...] <base-name> [< <ref-list> | < <object-list>]"
+"git pack-objects [<options>] <base-name> [< <ref-list> | < <object-list>]"
msgstr ""
-"git pack-objects [<sçnklr>...] <base-name> [< <bşvr-liste> | < <nesne-liste>]"
+"git pack-objects [<sçnklr>] <temel-ad> [< <bşvru-listesi> | < <nesne-"
+"listesi>]"
#, c-format
msgid ""
@@ -9262,8 +9329,8 @@ msgstr ""
"<git@vger.kernel.org> adresine bir e-posta atarak\n"
"bize haber verin. SaÄŸ olun.\n"
-msgid "git pack-refs [<options>]"
-msgstr "git pack-refs [<seçenekler>]"
+msgid "git pack-refs [--all] [--no-prune]"
+msgstr "git pack-refs [--all] [--no-prune]"
msgid "pack everything"
msgstr "her ÅŸeyi paketle"
@@ -9271,6 +9338,18 @@ msgstr "her ÅŸeyi paketle"
msgid "prune loose refs (default)"
msgstr "gevşek başvuruları buda (öntanımlı)"
+msgid "git patch-id [--stable | --unstable | --verbatim]"
+msgstr "git patch-id [--stable | --unstable | --verbatim]"
+
+msgid "use the unstable patch-id algorithm"
+msgstr "kararlı olmayan yama kimliği algoritmasını kullan"
+
+msgid "use the stable patch-id algorithm"
+msgstr "kararlı yama kimliği algoritmasını kullan"
+
+msgid "don't strip whitespace from the patch"
+msgstr "yamadan boşlukları çıkarma"
+
msgid "git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]"
msgstr ""
"git prune [-n] [-v] [--progress] [--expire <zaman>] [--] [<dal-ucu>...]"
@@ -9484,9 +9563,8 @@ msgstr ""
msgid ""
"\n"
-"To avoid automatically configuring upstream branches when their name\n"
-"doesn't match the local branch, see option 'simple' of branch."
-"autoSetupMerge\n"
+"To avoid automatically configuring an upstream branch when its name\n"
+"won't match the local branch, see option 'simple' of branch.autoSetupMerge\n"
"in 'git help config'.\n"
msgstr ""
"\n"
@@ -9643,6 +9721,13 @@ msgstr "Ä°tme konumu: %s\n"
msgid "failed to push some refs to '%s'"
msgstr "bazı başvurular '%s' konumuna itilemedi"
+msgid ""
+"recursing into submodule with push.recurseSubmodules=only; using on-demand "
+"instead"
+msgstr ""
+"altmodül içine push.recurseSubmodules=only ile özyineleniyor; yerine talep "
+"başına kullanılıyor"
+
#, c-format
msgid "invalid value for '%s'"
msgstr "'%s' için geçersiz değer"
@@ -9666,7 +9751,7 @@ msgid "force updates"
msgstr "zorla güncelle"
msgid "<refname>:<expect>"
-msgstr "<başvuruadı>:<bekle>"
+msgstr "<bşvr-adı>:<bekle>"
msgid "require old value of ref to be at this value"
msgstr "başvurunun eski değerinin bu değerde olmasını gerektir"
@@ -9779,13 +9864,14 @@ msgid "need two commit ranges"
msgstr "iki iÅŸleme erimi gerekli"
msgid ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>) "
-"[-u | -i]] [--no-sparse-checkout] [--index-output=<file>] (--empty | <tree-"
-"ish1> [<tree-ish2> [<tree-ish3>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
+"prefix=<prefix>)\n"
+" [-u | -i]] [--index-output=<file>] [--no-sparse-checkout]\n"
+" (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"
msgstr ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<önek>) [-"
-"u | -i]] [--no-sparse-checkout] [--index-output=<dosya>] (--empty | "
-"<ağacımsı1> [<ağacımsı2> [<ağacımsı3>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<önek>)\n"
+" [-u | -i]] [--index-output=<dosya>] [--no-sparse-checkout]\n"
+" (--empty | <ağacımsı1> [<ağacımsı2> [<ağacımsı3>]])"
msgid "write resulting index to <file>"
msgstr "ortaya çıkan indeksi <dosya>'ya yaz"
@@ -9876,8 +9962,8 @@ msgid "%s requires the merge backend"
msgstr "%s birleÅŸtirme arka ucunu gerektiriyor"
#, c-format
-msgid "could not get 'onto': '%s'"
-msgstr "'onto' alınamadı: '%s'"
+msgid "invalid onto: '%s'"
+msgstr "üzerine geçersiz: '%s'"
#, c-format
msgid "invalid orig-head: '%s'"
@@ -9926,10 +10012,13 @@ msgstr ""
msgid "could not switch to %s"
msgstr "şuraya geçilemedi: %s"
+msgid "apply options and merge options cannot be used together"
+msgstr "uygulama seçenekleri ve birleştirme seçenekleri birlikte kullanılamaz"
+
#, c-format
msgid ""
-"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and \"ask"
-"\"."
+"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and "
+"\"ask\"."
msgstr ""
"Tanımlanamayan boş tür '%s'; geçerli türler: \"drop\", \"keep\" ve \"ask\"."
@@ -10161,8 +10250,19 @@ msgstr "Bilinmeyen kip: %s"
msgid "--strategy requires --merge or --interactive"
msgstr "--strategy, --merge veya --interactive gerektiriyor"
-msgid "apply options and merge options cannot be used together"
-msgstr "uygulama seçenekleri ve birleştirme seçenekleri birlikte kullanılamaz"
+msgid ""
+"apply options are incompatible with rebase.autosquash. Consider adding --no-"
+"autosquash"
+msgstr ""
+"uygulama seçenekleri, rebase.autosquash ile uyumlu değil. --no-autosquash "
+"eklemeyi düşünün"
+
+msgid ""
+"apply options are incompatible with rebase.updateRefs. Consider adding --no-"
+"update-refs"
+msgstr ""
+"uygulama seçenekleri, rebase.updateRefs ile uyumlu değil. --no-update-refs "
+"eklemeyi düşünün"
#, c-format
msgid "Unknown rebase backend: %s"
@@ -10186,8 +10286,8 @@ msgstr "böyle bir dal/işleme yok: '%s'"
msgid "No such ref: %s"
msgstr "Böyle bir başvuru yok: %s"
-msgid "Could not resolve HEAD to a revision"
-msgstr "HEAD bir revizyona çözülemedi"
+msgid "Could not resolve HEAD to a commit"
+msgstr "HEAD, bir işlemeye çözülemedi"
#, c-format
msgid "'%s': need exactly one merge base with branch"
@@ -10849,6 +10949,10 @@ msgstr "geçici dosya '%s', yazma için açılamadı"
msgid "could not close refs snapshot tempfile"
msgstr "başvurular anlık görüntü geçici dosyası kapatılamadı"
+#, c-format
+msgid "could not remove stale bitmap: %s"
+msgstr "eskimiş biteşlem kaldırılamadı: %s"
+
msgid "pack everything in a single pack"
msgstr "her şeyi tek bir pakete sığdır"
@@ -10921,6 +11025,9 @@ msgstr "<N> faktörlü bir geometrik ilerleme bul"
msgid "write a multi-pack index of the resulting packs"
msgstr "ortaya çıkan paketlerin bir çoklu paket indeksini yaz"
+msgid "pack prefix to store a pack containing pruned objects"
+msgstr "budanan nesneler içeren paketi depolamak için paket öneki"
+
msgid "cannot delete packs in a precious-objects repo"
msgstr "bir precious-objects deposundaki paketler silinemiyor"
@@ -10932,8 +11039,12 @@ msgid "pack prefix %s does not begin with objdir %s"
msgstr "paket öneki %s, nesne dizini %s ile başlamıyor"
#, c-format
-msgid "missing required file: %s"
-msgstr "gereken dosya eksik: %s"
+msgid "renaming pack to '%s' failed"
+msgstr "paketi '%s' olarak yeniden adlandırma başarısız"
+
+#, c-format
+msgid "pack-objects did not write a '%s' file for pack %s-%s"
+msgstr "pack-objects, şu paket için bir '%s' dosyası yazmadı: %s-%s"
#, c-format
msgid "could not unlink: %s"
@@ -11127,8 +11238,10 @@ msgstr "--convert-graft-file argüman almaz"
msgid "only one pattern can be given with -l"
msgstr "-l ile yalnızca bir dizgi verilebilir"
-msgid "git rerere [clear | forget <path>... | status | remaining | diff | gc]"
-msgstr "git rerere [clear | forget <yol>... | status | remaining | diff | gc]"
+msgid ""
+"git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
+msgstr ""
+"git rerere [clear | forget <yol-blrtç>... | diff | status | remaining | gc]"
msgid "register clean resolutions in index"
msgstr "indeksteki temiz çözümlerin kaydını yap"
@@ -11333,6 +11446,15 @@ msgstr "--prefix bir argüman gerektiriyor"
msgid "unknown mode for --abbrev-ref: %s"
msgstr "--abbrev-ref için bilinmeyen kip: %s"
+msgid "--exclude-hidden cannot be used together with --branches"
+msgstr "--exclude-hidden, --branches ile birlikte kullanılamıyor"
+
+msgid "--exclude-hidden cannot be used together with --tags"
+msgstr "--exclude-hidden, --tags ile birlikte kullanılamıyor"
+
+msgid "--exclude-hidden cannot be used together with --remotes"
+msgstr "--exclude-hidden, --remotes ile birlikte kullanılamıyor"
+
msgid "this operation must be run in a work tree"
msgstr "bu işlem bir çalışma ağacı içinde çalıştırılmalı"
@@ -11340,17 +11462,25 @@ msgstr "bu işlem bir çalışma ağacı içinde çalıştırılmalı"
msgid "unknown mode for --show-object-format: %s"
msgstr "--show-object-format için bilinmeyen kip: %s"
-msgid "git revert [<options>] <commit-ish>..."
-msgstr "git revert [<seçenekler>] <işlememsi>..."
+msgid ""
+"git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] "
+"<commit>..."
+msgstr ""
+"git revert [--[no-]edit] [-n] [-m <üst-öge-numarası>] [-s] [-S[<anahtar-"
+"kimliÄŸi>]] <iÅŸleme>..."
-msgid "git revert <subcommand>"
-msgstr "git revert <altkomut>"
+msgid "git revert (--continue | --skip | --abort | --quit)"
+msgstr "git revert (--continue | --skip | --abort | --quit)"
-msgid "git cherry-pick [<options>] <commit-ish>..."
-msgstr "git cherry-pick [<seçenekler>] <işlememsi>..."
+msgid ""
+"git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n"
+" [-S[<keyid>]] <commit>..."
+msgstr ""
+"git cherry-pick [--edit] [-n] [-m <üst-öge-numarası>] [-s] [-x] [--ff]\n"
+" [-S[<anahtar-kimliÄŸi>]] <iÅŸleme>..."
-msgid "git cherry-pick <subcommand>"
-msgstr "git cherry-pick <altkomut>"
+msgid "git cherry-pick (--continue | --skip | --abort | --quit)"
+msgstr "git cherry-pick (--continue | --skip | --abort | --quit)"
#, c-format
msgid "option `%s' expects a number greater than zero"
@@ -11411,8 +11541,14 @@ msgstr "geri al başarısız"
msgid "cherry-pick failed"
msgstr "seç-al başarısız"
-msgid "git rm [<options>] [--] <file>..."
-msgstr "git rm [<seçenekler>] [--] <dosya>..."
+msgid ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<dosya> [--pathspec-file-nul]]\n"
+" [--] [<yol-blrtç>...]"
msgid ""
"the following file has staged content different from both the\n"
@@ -11486,12 +11622,14 @@ msgid ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<host>:]<directory> (--all | <ref>...)"
msgstr ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
-" [--receive-pack=<git-receive-pack>]\n"
+" [--receive-pack=<git-paket-al>]\n"
" [--verbose] [--thin] [--atomic]\n"
-" [<makine>:]<dizin> (--all | <baÅŸvurular>...)"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
+" [<makine>:]<dizin> (--all | <baÅŸvuru>...)"
msgid "remote name"
msgstr "uzak konum adı"
@@ -11514,8 +11652,9 @@ msgstr "git log --pretty=short | git shortlog [<seçenekler>]"
msgid "using multiple --group options with stdin is not supported"
msgstr "stdin ile çoklu --group seçenekleri kullanımı desteklenmiyor"
-msgid "using --group=trailer with stdin is not supported"
-msgstr "stdin ile --group=trailer kullanımı desteklenmiyor"
+#, c-format
+msgid "using %s with stdin is not supported"
+msgstr "stdin ile %s kullanma desteklenmiyor"
#, c-format
msgid "unknown group type: %s"
@@ -11546,18 +11685,20 @@ msgid "group by field"
msgstr "alan ile grupla"
msgid "too many arguments given outside repository"
-msgstr "depo dışında çok fazla argüman verildi"
+msgstr "depo dışında pek fazla argüman verildi"
msgid ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<when>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<rev> | <glob>)...]"
msgstr ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
-" [--current] [--color[=<nezaman>] | --no-color] [--sparse]\n"
+" [--current] [--color[=<ne-zaman>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<bÅŸvr> | <glob>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<rev> | <glob>)...]"
msgid "git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]"
msgstr "git show-branch (-g | --reflog)[=<n>[,<temel>]] [--list] [<baÅŸvuru>]"
@@ -11657,11 +11798,13 @@ msgid "Unknown hash algorithm"
msgstr "bilinmeyen sağlama algoritması '%s'"
msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<pattern>...]"
msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<dizgi>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<dizgi>...]"
msgid "git show-ref --exclude-existing[=<pattern>]"
msgstr "git show-ref --exclude-existing[=<dizgi>]"
@@ -11690,8 +11833,10 @@ msgstr "sonuçları stdout'a yazdırma (--verify ile birlikte kullanışlı)"
msgid "show refs from stdin that aren't in local repository"
msgstr "stdin'den yerel bir depoda olmayan başvuruları göster"
-msgid "git sparse-checkout (init|list|set|add|reapply|disable) <options>"
-msgstr "git sparse-checkout (init|list|set|add|reapply|disable) <seçenekler>"
+msgid ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<options>]"
+msgstr ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<sçnklr>]"
msgid "this worktree is not sparse"
msgstr "bu çalışma ağacı aralıklı değil"
@@ -11813,67 +11958,56 @@ msgstr ""
msgid "error while refreshing working directory"
msgstr "çalışma dizini yenilenirken hata"
-msgid "git stash list [<options>]"
-msgstr "git stash list [<seçenekler>]"
+msgid "git stash list [<log-options>]"
+msgstr "git stash list [<günlük-seçenekleri>]"
-msgid "git stash show [<options>] [<stash>]"
-msgstr "git stash show [<seçenekler>] [<zula>]"
+msgid ""
+"git stash show [-u | --include-untracked | --only-untracked] [<diff-"
+"options>] [<stash>]"
+msgstr ""
+"git stash show [-u | --include-untracked | --only-untracked] [<diff-"
+"seçenekleri>] [<zula>]"
-msgid "git stash drop [-q|--quiet] [<stash>]"
-msgstr "git stash drop [-q|--quiet] [<zula>]"
+msgid "git stash drop [-q | --quiet] [<stash>]"
+msgstr "git stash drop [-q | --quiet] [<zula>]"
-msgid "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash ( pop | apply ) [--index] [-q|--quiet] [<zula>]"
+msgid "git stash pop [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash pop [--index] [-q | --quiet] [<zula>]"
+
+msgid "git stash apply [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash apply [--index] [-q | --quiet] [<zula>]"
msgid "git stash branch <branchname> [<stash>]"
msgstr "git stash branch <dal-adı> [<zula>]"
+msgid "git stash store [(-m | --message) <message>] [-q | --quiet] <commit>"
+msgstr "git stash store [(-m | --message) <ileti>] [-q | --quiet] <iÅŸleme>"
+
msgid ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"<message>]\n"
" [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
" [--] [<pathspec>...]]"
msgstr ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <ileti>]\n"
-" [--pathspec-from-file=<dosya> [--pathspec-file-nul]]\n"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q\n"
+" | --quiet] [-u | --include-untracked] [-a | --all] [(-m | --"
+"message)\n"
+" <ileti>] [--pathspec-from-file=<dosya> [--pathspec-file-nul]]\n"
" [--] [<yol-blrtç>...]]"
msgid ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<ileti>]"
-
-msgid "git stash pop [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash pop [--index] [-q|--quiet] [<zula>]"
-
-msgid "git stash apply [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash apply [--index] [-q|--quiet] [<zula>]"
-
-msgid "git stash store [-m|--message <message>] [-q|--quiet] <commit>"
-msgstr "git stash store [-m|--message <ileti>] [-q|--quiet] <iÅŸleme>"
-
-msgid ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
-" [--] [<pathspec>...]]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<message>]"
msgstr ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <ileti>]\n"
-" [--] [<yol-blrtç>...]]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"|\n"
+" --quiet] [-u | --include-untracked] [-a | --all] [<ileti>]"
-msgid ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<ileti>]"
+msgid "git stash create [<message>]"
+msgstr "git stash create [<ileti>]"
#, c-format
msgid "'%s' is not a stash-like commit"
@@ -12359,7 +12493,7 @@ msgstr "Şu altmodül yolunda '%s' birleştirilemedi: '%s'"
#, c-format
msgid "Execution of '%s %s' failed in submodule path '%s'"
-msgstr "Şu altmodül yolunda '%s %s' çalıştırılamadı: '%s'"
+msgstr "Şu altmodül yolunda '%s %s' yürütülemedi: '%s'"
#, c-format
msgid "Submodule path '%s': checked out '%s'\n"
@@ -12434,9 +12568,6 @@ msgstr "altmodülleri özyineli basamaklandır"
msgid "don't fetch new objects from the remote site"
msgstr "yeni nesneleri uzak konumdan getirme"
-msgid "path into the working tree"
-msgstr "çalışma ağacına giden yol"
-
msgid "use the 'checkout' update strategy (default)"
msgstr "'checkout' güncelleme stratejisini kullan (öntanımlı)"
@@ -12472,27 +12603,9 @@ msgstr ""
"shallow] [--reference <depo>] [--recursive] [--[no-]single-branch] [--] "
"[<yol>...]"
-msgid "recurse into submodules"
-msgstr "altmodüllere özyinele"
-
msgid "git submodule absorbgitdirs [<options>] [<path>...]"
msgstr "git submodule absorbgitdirs [<seçenekler>] [<yol>...]"
-msgid "check if it is safe to write to the .gitmodules file"
-msgstr ".gitmodules dosyasına yazım güvenli mi değil mi denetle"
-
-msgid "unset the config in the .gitmodules file"
-msgstr ".gitmodules dosyasındaki yapılandırmayı kaldır"
-
-msgid "git submodule--helper config <name> [<value>]"
-msgstr "git submodule--helper config <ad> [<deÄŸer>]"
-
-msgid "git submodule--helper config --unset <name>"
-msgstr "git submodule--helper config --unset <ad>"
-
-msgid "please make sure that the .gitmodules file is in the working tree"
-msgstr ".gitmodules dosyasının çalışma ağacında olduğundan lütfen emin ol"
-
msgid "suppress output for setting url of a submodule"
msgstr "bir altmodül url ayarlanması çıktısını gizle"
@@ -12570,6 +12683,9 @@ msgstr "'%s' altmodülü için yerel git dizini yeniden etkinleştiriliyor\n"
msgid "unable to checkout submodule '%s'"
msgstr "'%s' altmodülü çıkış yapılamıyor"
+msgid "please make sure that the .gitmodules file is in the working tree"
+msgstr ".gitmodules dosyasının çalışma ağacında olduğundan lütfen emin ol"
+
#, c-format
msgid "Failed to add submodule '%s'"
msgstr "'%s' altmodülü eklenemedi"
@@ -12620,19 +12736,17 @@ msgstr "depo URL'si: '%s' mutlak olmalı veya ./|../ ile başlamalıdır"
msgid "'%s' is not a valid submodule name"
msgstr "'%s' geçerli bir altmodül adı değil"
-#, c-format
-msgid "%s doesn't support --super-prefix"
-msgstr "%s, --super-prefix desteklemiyor"
+msgid "git submodule--helper <command>"
+msgstr "git submodule--helper <komut>"
-#, c-format
-msgid "'%s' is not a valid submodule--helper subcommand"
-msgstr "'%s' geçerli bir submodule--helper altkomutu değil"
+msgid "git symbolic-ref [-m <reason>] <name> <ref>"
+msgstr "git symbolic-ref [-m <neden>] <ad> <baÅŸvuru>"
-msgid "git symbolic-ref [<options>] <name> [<ref>]"
-msgstr "git symbolic-ref [<seçenekler>] <ad> [<başvuru>]"
+msgid "git symbolic-ref [-q] [--short] [--no-recurse] <name>"
+msgstr "git symbolic-ref [-q] [--short] [--no-recurse] <ad>"
-msgid "git symbolic-ref -d [-q] <name>"
-msgstr "git symbolic-ref -d [-q] <ad>"
+msgid "git symbolic-ref --delete [-q] <name>"
+msgstr "git symbolic-ref --delete [-q] <ad>"
msgid "suppress error message for non-symbolic (detached) refs"
msgstr "sembolik olmayan (ayrık) başvurular için hata iletisini gizle"
@@ -12643,6 +12757,9 @@ msgstr "sembolik baÅŸvuruyu sil"
msgid "shorten ref output"
msgstr "başvuru çıktısını kısalt"
+msgid "recursively dereference (default)"
+msgstr "başvuruyu özyineli olarak kaldır (öntanımlı)"
+
msgid "reason"
msgstr "neden"
@@ -12650,24 +12767,26 @@ msgid "reason of the update"
msgstr "güncelleme nedeni"
msgid ""
-"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]\n"
-" <tagname> [<head>]"
+"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n"
+" <tagname> [<commit> | <object>]"
msgstr ""
-"git tag [-a | -s | -u <anahtar-kimliÄŸi>] [-f] [-m <ileti> | -F <dosya>]\n"
-" <etiket-adı> [<head>]"
+"git tag [-a | -s | -u <anahtar-kimliÄŸi>] [-f] [-m <ileti> | -F <dosya>] [-"
+"e]\n"
+" <etiket-adı> [<işleme> | <nesne>]"
msgid "git tag -d <tagname>..."
msgstr "git tag -d <etiket-adı>..."
msgid ""
-"git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--"
-"points-at <object>]\n"
-" [--format=<format>] [--merged <commit>] [--no-merged <commit>] "
-"[<pattern>...]"
+"git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]\n"
+" [--points-at <object>] [--column[=<options>] | --no-column]\n"
+" [--create-reflog] [--sort=<key>] [--format=<format>]\n"
+" [--merged <commit>] [--no-merged <commit>] [<pattern>...]"
msgstr ""
-"git tag -l [-n[<sayı>]] [--contains <işleme>] [--no-contains <işleme>]\n"
-" [-- points-at <nesne>] [--format=<biçim>] [--merged <işleme>]\n"
-" [--no-merged <iÅŸleme>] [<dizgi>...]"
+"git tag [-n[<sayı>]] -l [--contains <işleme>] [--no-contains <işleme>]\n"
+" [--points-at <nesne>] [--column[=<seçenekler>] | --no-column]\n"
+" [--create-reflog] [--sort=<anahtar>] [--format=<biçim>]\n"
+" [--merged <iÅŸleme>] [--no-merged <iÅŸleme>] [<dizgi>...]"
msgid "git tag -v [--format=<format>] <tagname>..."
msgstr "git tag -v [--format=<biçim>] <etiket-adı>..."
@@ -13043,8 +13162,12 @@ msgstr "güncellemeleri stdin'den oku"
msgid "update the info files from scratch"
msgstr "bilgi dosyalarını en baştan güncelle"
-msgid "git upload-pack [<options>] <dir>"
-msgstr "git upload-pack [<seçenekler>] <dizin>"
+msgid ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <directory>"
+msgstr ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <dizin>"
msgid "quit after a single request/response exchange"
msgstr "tek bir istek/yanıt değiş tokuşundan sonra çık"
@@ -13058,8 +13181,8 @@ msgstr "eÄŸer <dizin> bir Git dizini deÄŸilse <dizin>/.git/ deneme"
msgid "interrupt transfer after <n> seconds of inactivity"
msgstr "aktarımı <n> saniye hareketsizlikten sonra kes"
-msgid "git verify-commit [-v | --verbose] <commit>..."
-msgstr "git verify-commit [-v | --verbose] <iÅŸleme>..."
+msgid "git verify-commit [-v | --verbose] [--raw] <commit>..."
+msgstr "git verify-commit [-v | --verbose] [--raw] <iÅŸleme>..."
msgid "print commit contents"
msgstr "işleme içeriğini yazdır"
@@ -13067,8 +13190,9 @@ msgstr "işleme içeriğini yazdır"
msgid "print raw gpg status output"
msgstr "ham gpg durum çıktısını yazdır"
-msgid "git verify-pack [-v | --verbose] [-s | --stat-only] <pack>..."
-msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] <paket>..."
+msgid "git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pack>.idx..."
+msgstr ""
+"git verify-pack [-v | --verbose] [-s | --stat-only] [--] <paket>.idx..."
msgid "verbose"
msgstr "ayrıntılı anlatım"
@@ -13076,35 +13200,39 @@ msgstr "ayrıntılı anlatım"
msgid "show statistics only"
msgstr "yalnızca istatistikleri göster"
-msgid "git verify-tag [-v | --verbose] [--format=<format>] <tag>..."
-msgstr "git verify-tag [-v | --verbose] [--format=<biçim>] <etiket>..."
+msgid "git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."
+msgstr "git verify-tag [-v | --verbose] [--format=<biçim>] [--raw] <etiket>..."
msgid "print tag contents"
msgstr "etiket içeriğini yazdır"
-msgid "git worktree add [<options>] <path> [<commit-ish>]"
-msgstr "git worktree add [<seçenekler>] <yol> [<işlememsi>]"
+msgid ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]\n"
+" [-b <new-branch>] <path> [<commit-ish>]"
+msgstr ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <dizi>]]\n"
+" [-b <yeni-dal>] <yol> [<iÅŸlememsi>]"
-msgid "git worktree list [<options>]"
-msgstr "git worktree list [<seçenekler>]"
+msgid "git worktree list [-v | --porcelain [-z]]"
+msgstr "git worktree list [-v | --porcelain [-z]]"
-msgid "git worktree lock [<options>] <path>"
-msgstr "git worktree lock [<seçenekler>] <yol>"
+msgid "git worktree lock [--reason <string>] <worktree>"
+msgstr "git worktree lock [--reason <dizi>] <çalışma-ağacı>"
msgid "git worktree move <worktree> <new-path>"
msgstr "git worktree move <ç-ağacı> <yeni-yol>"
-msgid "git worktree prune [<options>]"
-msgstr "git worktree prune [<seçenekler>]"
+msgid "git worktree prune [-n] [-v] [--expire <expire>]"
+msgstr "git worktree prune [-n] [-v] [--expire <süre-dolum>]"
-msgid "git worktree remove [<options>] <worktree>"
-msgstr "git worktree remove [<seçenekler>] <ç-ağacı>"
+msgid "git worktree remove [-f] <worktree>"
+msgstr "git worktree remove [-f] <çalışma-ağacı>"
msgid "git worktree repair [<path>...]"
msgstr "git worktree repair [<yol>...]"
-msgid "git worktree unlock <path>"
-msgstr "git worktree unlock <yol>"
+msgid "git worktree unlock <worktree>"
+msgstr "git worktree unlock <çalışma-ağacı>"
#, c-format
msgid "Removing %s/%s: %s"
@@ -13334,6 +13462,14 @@ msgstr "yalnızca hata ayıklama için yararlı"
msgid "core.fsyncMethod = batch is unsupported on this platform"
msgstr "core.fsyncMethod = batch, bu platformda desteklenmiyor"
+#, c-format
+msgid "could not parse bundle list key %s with value '%s'"
+msgstr "demet liste anahtarı %s ile '%s' değeri ayrıştırılamıyor"
+
+#, c-format
+msgid "bundle list at '%s' has no mode"
+msgstr "'%s' konumundaki demet listesinin kipi yok"
+
msgid "failed to create temporary file"
msgstr "geçici dosya oluşturulamadı"
@@ -13341,16 +13477,43 @@ msgid "insufficient capabilities"
msgstr "yetersiz yetenekler"
#, c-format
+msgid "file downloaded from '%s' is not a bundle"
+msgstr "'%s' konumundan indirilen dosya bir demet deÄŸil"
+
+msgid "failed to store maximum creation token"
+msgstr "en büyük oluşturma jetonu depolanamadı"
+
+#, c-format
+msgid "unrecognized bundle mode from URI '%s'"
+msgstr "'%s' URI'sinden tanımlanamayan demet kipi"
+
+#, c-format
+msgid "exceeded bundle URI recursion limit (%d)"
+msgstr "demet URI özyineleme sınırı aşıldı (%d)"
+
+#, c-format
msgid "failed to download bundle from URI '%s'"
msgstr "'%s' URI'sinden demet indirilemedi"
#, c-format
-msgid "file at URI '%s' is not a bundle"
-msgstr "'%s' URI'sindeki dosya bir demet deÄŸil"
+msgid "file at URI '%s' is not a bundle or bundle list"
+msgstr "'%s' URI'sindeki dosya bir demet veya demet listesi deÄŸil"
#, c-format
-msgid "failed to unbundle bundle from URI '%s'"
-msgstr "'%s' URI'sindeki demet çözülemedi"
+msgid "bundle-uri: unexpected argument: '%s'"
+msgstr "bundle-uri: beklenmedik argüman: '%s'"
+
+msgid "bundle-uri: expected flush after arguments"
+msgstr "bundle-uri: argümanlardan sonra floş bekleniyordu"
+
+msgid "bundle-uri: got an empty line"
+msgstr "bundle-uri: boş bir satır alındı"
+
+msgid "bundle-uri: line is not of the form 'key=value'"
+msgstr "bundle-uri: satır, 'anahtar=değer' olarak biçimlenmemiş"
+
+msgid "bundle-uri: line has empty key or value"
+msgstr "bundle-uri: satırda boş anahtar veya değer var"
#, c-format
msgid "unrecognized bundle hash algorithm: %s"
@@ -13374,6 +13537,13 @@ msgstr "Depo aşağıdaki önkoşul işlemelere iye değil:"
msgid "need a repository to verify a bundle"
msgstr "bir demeti doğrulamak için bir depo gerekiyor"
+msgid ""
+"some prerequisite commits exist in the object store, but are not connected "
+"to the repository's history"
+msgstr ""
+"nesne deposunda bazı önkoşul işlemeleri var; ancak deponun geçmişine bağlı "
+"deÄŸiller"
+
#, c-format
msgid "The bundle contains this ref:"
msgid_plural "The bundle contains these %<PRIuMAX> refs:"
@@ -13920,8 +14090,8 @@ msgstr "Demet dosya biçimi"
msgid "Chunk-based file formats"
msgstr "geçersiz gitfile biçimi: %s"
-msgid "Git commit graph format"
-msgstr "Git işleme grafiği biçimi"
+msgid "Git commit-graph format"
+msgstr "Git commit-graph biçimi"
msgid "Git index format"
msgstr "Git indeks biçimi"
@@ -14115,7 +14285,7 @@ msgstr ""
"bir commit-graph yazılmaya çalışılıyor; ancak 'core.commitGraph' devre dışı"
msgid "too many commits to write graph"
-msgstr "grafik yazımı için çok fazla işleme"
+msgstr "grafik yazımı için pek fazla işleme"
msgid "the commit-graph file has incorrect checksum and is likely corrupt"
msgstr ""
@@ -14269,6 +14439,10 @@ msgstr "'has_worktree_moved' içinde işlenmemiş senaryo: %d"
msgid "health thread wait failed [GLE %ld]"
msgstr "sağlık iş parçacığı bekleme başarısız oldu [GLE %ld]"
+#, c-format
+msgid "Invalid path: %s"
+msgstr "Geçersiz yol %s"
+
msgid "Unable to create FSEventStream."
msgstr "FSEventStream oluşturulamadı."
@@ -14300,6 +14474,22 @@ msgid "could not read directory changes [GLE %ld]"
msgstr "dizin değişiklikleri okunamadı [GLE %ld]"
#, c-format
+msgid "opendir('%s') failed"
+msgstr "opendir('%s') başarısız oldu"
+
+#, c-format
+msgid "lstat('%s') failed"
+msgstr "lstat('%s') başarısız oldu"
+
+#, c-format
+msgid "strbuf_readlink('%s') failed"
+msgstr "strbuf_readlink('%s') başarısız oldu"
+
+#, c-format
+msgid "closedir('%s') failed"
+msgstr "closedir('%s') başarısız oldu"
+
+#, c-format
msgid "[GLE %ld] unable to open for read '%ls'"
msgstr "[GLE %ld] '%ls', okuma için açılamıyor"
@@ -14484,7 +14674,7 @@ msgstr "%s içinde düzmece sayım"
#, c-format
msgid "too many entries in %s"
-msgstr "%s içinde çok fazla girdi"
+msgstr "%s içinde pek fazla girdi"
#, c-format
msgid "missing config key %s"
@@ -14754,21 +14944,28 @@ msgid "unknown object format '%s' specified by server"
msgstr "sunucu tarafından bilinmeyen nesne biçimi '%s' belirtildi"
#, c-format
+msgid "error on bundle-uri response line %d: %s"
+msgstr "bundle-uri %d. yanıt satırında hata: %s"
+
+msgid "expected flush after bundle-uri listing"
+msgstr "bundle-uri listelemesinden sonra floÅŸ bekleniyordu"
+
+msgid "expected response end packet after ref listing"
+msgstr "başvuru listelemesinden sonra yanıt sonu paketi bekleniyordu"
+
+#, c-format
msgid "invalid ls-refs response: %s"
msgstr "geçersiz ls-refs yanıtı: %s"
msgid "expected flush after ref listing"
msgstr "baÅŸvuru listelemesinden sonra floÅŸ bekleniyordu"
-msgid "expected response end packet after ref listing"
-msgstr "başvuru listelemesinden sonra yanıt sonu paketi bekleniyordu"
-
#, c-format
msgid "protocol '%s' is not supported"
msgstr "'%s' protokolü desteklenmiyor"
msgid "unable to set SO_KEEPALIVE on socket"
-msgstr "soket üzerinde SO_KEEPALIVE ayarlanamıyor"
+msgstr "yuva üzerinde SO_KEEPALIVE ayarlanamıyor"
#, c-format
msgid "Looking up %s ... "
@@ -15049,7 +15246,7 @@ msgstr "'%s' için delta adası düzenli ifadesi yüklenemedi: %s"
#, c-format
msgid "island regex from config has too many capture groups (max=%d)"
msgstr ""
-"yapılandırmanın delta adası düzenli ifadesinde çok fazla yakalama grubu var "
+"yapılandırmanın delta adası düzenli ifadesinde pek fazla yakalama grubu var "
"(en çok %d)"
#, c-format
@@ -15504,7 +15701,7 @@ msgid "disable all output of the program"
msgstr "tüm program çıktısını devre dışı bırak"
msgid "allow an external diff helper to be executed"
-msgstr "bir dış diff yardımcısının çalıştırılmasına izin ver"
+msgstr "bir dış diff yardımcısının yürütülmesine izin ver"
msgid "run external text conversion filters when comparing binary files"
msgstr ""
@@ -15581,7 +15778,7 @@ msgstr "belirli bir dosyaya çıktıla"
msgid "exhaustive rename detection was skipped due to too many files."
msgstr ""
-"Geniş kapsamlı yeniden adlandırma algılaması çok fazla dosya olmasından "
+"Geniş kapsamlı yeniden adlandırma algılaması pek fazla dosya olmasından "
"dolayı atlandı."
msgid "only found copies from modified paths due to too many files."
@@ -15672,7 +15869,7 @@ msgstr "hatalı git ad alanı yolu \"%s\""
#, c-format
msgid "too many args to run %s"
-msgstr "%s çalıştırmak için çok fazla argüman"
+msgstr "%s çalıştırmak için pek fazla argüman"
msgid "git fetch-pack: expected shallow list"
msgstr "git fetch-pack: sığ bir liste bekleniyordu"
@@ -15902,9 +16099,10 @@ msgstr "sanal depo '%s', fsmonitor ile uyumsuz"
#, c-format
msgid ""
-"repository '%s' is incompatible with fsmonitor due to lack of Unix sockets"
+"socket directory '%s' is incompatible with fsmonitor due to lack of Unix "
+"sockets support"
msgstr ""
-"Unix soketleri eksik olduğundan dolayı; '%s' deposu, fsmonitor ile uyumsuz"
+"yuva dizini '%s', Unix yuva dasteği olmadığından dolayı fsmonitor ile uyumsuz"
msgid ""
"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n"
@@ -15912,16 +16110,14 @@ msgid ""
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
-" [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n"
-" <command> [<args>]"
+" [--config-env=<name>=<envvar>] <command> [<args>]"
msgstr ""
"git [-v | --version] [-h | --help] [-C <yol>] [-c <ad>=<deÄŸer>]\n"
" [--exec-path[=<yol>]] [--html-path] [--man-path] [--info-path]\n"
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<yol>] [--work-tree=<yol>] [--namespace=<ad>]\n"
-" [--super-prefix=<yol>] [--config-env=<ad>=<çevredeğişkeni>]\n"
-" <komut> [<argümanlar>]"
+" [--config-env=<ad>=<çevre-değişkeni>] <komut> [<argümanlar>]"
msgid ""
"'git help -a' and 'git help -g' list available subcommands and some\n"
@@ -15947,10 +16143,6 @@ msgid "no namespace given for --namespace\n"
msgstr "--namespace için ad alanı verilmedi\n"
#, c-format
-msgid "no prefix given for --super-prefix\n"
-msgstr "--super-prefix için önek verilmedi\n"
-
-#, c-format
msgid "-c expects a configuration string\n"
msgstr "-c bir yapılandırma dizisi bekliyor\n"
@@ -16065,8 +16257,13 @@ msgstr ""
msgid "gpg.ssh.defaultKeyCommand failed: %s %s"
msgstr "gpg.ssh.defaultKeyCommand başarısız oldu: %s %s"
-msgid "gpg failed to sign the data"
-msgstr "gpg veriyi imzalayamadı"
+#, c-format
+msgid ""
+"gpg failed to sign the data:\n"
+"%s"
+msgstr ""
+"gpg veriyi imzalayamadı:\n"
+"%s"
msgid "user.signingKey needs to be set for ssh signing"
msgstr "user.signingKey'in ssh imzalaması için ayarlanması gerekiyor"
@@ -16189,7 +16386,7 @@ msgid ""
"able to execute it. Maybe git-%s is broken?"
msgstr ""
"'%s' bir git komutu gibi görünüyor; ancak biz onu\n"
-"çalıştıramadık. git-%s bozuk olabilir mi?"
+"yürütemedik. git-%s bozuk olabilir mi?"
#, c-format
msgid "git: '%s' is not a git command. See 'git --help'."
@@ -16228,8 +16425,8 @@ msgstr[1] ""
"\n"
"Buna en yakın komutlar:"
-msgid "git version [<options>]"
-msgstr "git version [<seçenekler>]"
+msgid "git version [--build-options]"
+msgstr "git version [--build-options]"
#, c-format
msgid "%s: %s - %s"
@@ -16253,7 +16450,7 @@ msgid ""
"The '%s' hook was ignored because it's not set as executable.\n"
"You can disable this warning with `git config advice.ignoredHook false`."
msgstr ""
-"'%s' kancası yok sayıldı; çünkü bir çalıştırılabilir olarak ayarlanmamış.\n"
+"'%s' kancası yok sayıldı; çünkü bir yürütülebilir olarak ayarlanmamış.\n"
"Bu uyarıyı 'git config advice.ignoredHook false' ile kapatabilirsiniz."
#, c-format
@@ -16479,7 +16676,7 @@ msgstr ""
"%s"
msgid "Failed to execute internal merge"
-msgstr "İç birleştirme çalıştırılamadı"
+msgstr "İç birleştirme yürütülemedi"
#, c-format
msgid "Unable to add %s to database"
@@ -16833,8 +17030,8 @@ msgstr ""
#, c-format
msgid ""
-"CONFLICT (rename/rename): Rename \"%s\"->\"%s\" in branch \"%s\" rename \"%s"
-"\"->\"%s\" in \"%s\"%s"
+"CONFLICT (rename/rename): Rename \"%s\"->\"%s\" in branch \"%s\" rename "
+"\"%s\"->\"%s\" in \"%s\"%s"
msgstr ""
"ÇAKIŞMA (y. adlandır/y. adlandır): \"%s\"->\"%s\" olarak adlandır (\"%s\" "
"dalında), \"%s\"->\"%s\" olarak adlandır (\"%s\"%s içinde)"
@@ -16845,8 +17042,8 @@ msgstr " (çözülmeden bırakıldı)"
#, c-format
msgid "CONFLICT (rename/rename): Rename %s->%s in %s. Rename %s->%s in %s"
msgstr ""
-"ÇAKIŞMA (y. adlandır/y. adlandır): %s->%s olarak adlandır (%s içinde). %s->"
-"%s olarak adlandır (%s içinde)"
+"ÇAKIŞMA (y. adlandır/y. adlandır): %s->%s olarak adlandır (%s içinde). %s-"
+">%s olarak adlandır (%s içinde)"
#, c-format
msgid ""
@@ -17148,10 +17345,6 @@ msgstr "alternatif nesne yolu olağanlaştırılamıyor: %s"
msgid "%s: ignoring alternate object stores, nesting too deep"
msgstr "%s: alternatif nesne depoları yok sayılıyor, iç içe geçme pek derin"
-#, c-format
-msgid "unable to normalize object directory: %s"
-msgstr "nesne dizini olağanlaştırılamıyor: %s"
-
msgid "unable to fdopen alternates lockfile"
msgstr "alternatifler kilit dosyası fdopen yapılamıyor"
@@ -17211,6 +17404,10 @@ msgid "garbage at end of loose object '%s'"
msgstr "gevşek nesne '%s' sonunda anlamsız veri"
#, c-format
+msgid "unable to open loose object %s"
+msgstr "gevşek nesne %s açılamıyor"
+
+#, c-format
msgid "unable to parse %s header"
msgstr "%s üstbilgisi ayrıştırılamıyor"
@@ -17226,18 +17423,14 @@ msgid "header for %s too long, exceeds %d bytes"
msgstr "%s üstbilgisi pek uzun, %d bayt'ı aşıyor"
#, c-format
-msgid "failed to read object %s"
-msgstr "%s nesnesi okunamadı"
+msgid "loose object %s (stored in %s) is corrupt"
+msgstr "%s gevşek nesnesi (%s içinde depolanıyor) hasarlı"
#, c-format
msgid "replacement %s not found for %s"
msgstr "%s yedeği %s için bulunamadı"
#, c-format
-msgid "loose object %s (stored in %s) is corrupt"
-msgstr "%s gevşek nesnesi (%s içinde depolanıyor) hasarlı"
-
-#, c-format
msgid "packed object %s (stored in %s) is corrupt"
msgstr "paketlenmiş nesne %s (%s içinde depolanıyor) hasarlı"
@@ -17249,9 +17442,6 @@ msgstr "%s dosyası yazılamıyor"
msgid "unable to set permission to '%s'"
msgstr "'%s' ögesine izin ayarlanamıyor"
-msgid "file write error"
-msgstr "dosya yazım hatası"
-
msgid "error when closing loose object file"
msgstr "gevşek nesne dosyası kapatılırken hata"
@@ -17297,11 +17487,12 @@ msgstr "%s dizini oluşturulamıyor"
msgid "cannot read object for %s"
msgstr "%s için nesne okunamıyor"
-msgid "corrupt commit"
-msgstr "hasarlı işleme"
+#, c-format
+msgid "object fails fsck: %s"
+msgstr "nesne fsck'yi başarısız ediyor: %s"
-msgid "corrupt tag"
-msgstr "hasarlı etiket"
+msgid "refusing to create malformed object"
+msgstr "hatalı oluşturulmuş nesne oluşturma reddediliyor"
#, c-format
msgid "read error while indexing %s"
@@ -17565,10 +17756,6 @@ msgstr "biteşlem paket indeksinde geçersi XOR ofseti"
msgid "cannot fstat bitmap file"
msgstr "biteşlem dosyası fstat yapılamıyor"
-#, c-format
-msgid "ignoring extra bitmap file: '%s'"
-msgstr "ek biteşlem dosyası yok sayılıyor: '%s'"
-
msgid "checksum doesn't match in MIDX and bitmap"
msgstr "sağlama toplamı, MIDX ve biteşlem içinde uymuyor"
@@ -17831,6 +18018,9 @@ msgstr "daha sessiz ol"
msgid "use <n> digits to display object names"
msgstr "nesne adlarını görüntülemek için <n> basamak kullan"
+msgid "prefixed path to initial superproject"
+msgstr "yol, ilk üst projeye öneklendi"
+
msgid "how to strip spaces and #comments from message"
msgstr "iletiden boşlukları ve #yorumları çıkart"
@@ -17974,6 +18164,10 @@ msgstr "promisor-remote: alt sürecine getirmek için stdin kapatılamıyor"
msgid "promisor remote name cannot begin with '/': %s"
msgstr "vaatçi uzak konum adı '/' ile başlayamaz: %s"
+#, c-format
+msgid "could not fetch %s from promisor remote"
+msgstr "vaatçi uzak konumundan %s getirilemedi"
+
msgid "object-info: expected flush after arguments"
msgstr "object-info: argümanlardan sonra floş bekleniyordu"
@@ -18225,7 +18419,7 @@ msgstr ""
" bir yer tutucu izle. <baÅŸ>, yeniden temellendirmenin\n"
" sonunda güncellenir\n"
"\n"
-"Bu satırlar yeniden sıralanabilirler, yukarıdan aşağıya çalıştırılırlar.\n"
+"Bu satırlar yeniden sıralanabilirler, yukarıdan aşağıya yürütülürler.\n"
#, c-format
msgid "Rebase %s onto %s (%d command)"
@@ -18319,6 +18513,14 @@ msgid "ahead %d, behind %d"
msgstr "%d önünde, %d arkasında"
#, c-format
+msgid "%%(%.*s) does not take arguments"
+msgstr "%%(%.*s) argüman almıyor"
+
+#, c-format
+msgid "unrecognized %%(%.*s) argument: %s"
+msgstr "tanımlanamayan %%(%.*s) argümanı: %s"
+
+#, c-format
msgid "expected format: %%(color:<color>)"
msgstr "beklenen biçim: %%(color:<renk>)"
@@ -18335,22 +18537,6 @@ msgid "Integer value expected refname:rstrip=%s"
msgstr "Tamsayı değeri şunu bekliyordu: refname:rstrip=%s"
#, c-format
-msgid "unrecognized %%(%s) argument: %s"
-msgstr "tanımlanamayan %%(%s) argümanı: %s"
-
-#, c-format
-msgid "%%(objecttype) does not take arguments"
-msgstr "%%(objecttype) argüman almıyor"
-
-#, c-format
-msgid "%%(deltabase) does not take arguments"
-msgstr "%%(deltabase) argüman almıyor"
-
-#, c-format
-msgid "%%(body) does not take arguments"
-msgstr "%%(body) argüman almıyor"
-
-#, c-format
msgid "expected %%(trailers:key=<value>)"
msgstr "%%(trailers:key=<deÄŸer>) bekleniyordu"
@@ -18367,10 +18553,6 @@ msgid "positive value expected '%s' in %%(%s)"
msgstr "pozitif deÄŸer ÅŸurada '%s' bekliyordu: %%(%s)"
#, c-format
-msgid "unrecognized email option: %s"
-msgstr "tanımlanamayan e-posta seçeneği: %s"
-
-#, c-format
msgid "expected format: %%(align:<width>,<position>)"
msgstr "beklenen biçim: %%(align:<genişlik>,<konum>)"
@@ -18383,12 +18565,12 @@ msgid "unrecognized width:%s"
msgstr "tanımlanamayan genişlik:%s"
#, c-format
-msgid "positive width expected with the %%(align) atom"
-msgstr "pozitif genişlik %%(align) ögeciği ile birlikte bekleniyordu"
+msgid "unrecognized %%(%s) argument: %s"
+msgstr "tanımlanamayan %%(%s) argümanı: %s"
#, c-format
-msgid "%%(rest) does not take arguments"
-msgstr "%%(rest) argüman almıyor"
+msgid "positive width expected with the %%(align) atom"
+msgstr "pozitif genişlik %%(align) ögeciği ile birlikte bekleniyordu"
#, c-format
msgid "malformed field name: %.*s"
@@ -19038,6 +19220,13 @@ msgid "failed to find tree of %s"
msgstr "%s ögesinin ağacı bulunamadı"
#, c-format
+msgid "unsupported section for hidden refs: %s"
+msgstr "gizli başvurular için desteklenmeyen bölüm: %s"
+
+msgid "--exclude-hidden= passed more than once"
+msgstr "--exclude-hidden=, birden çok kez geçirildi"
+
+#, c-format
msgid "resolve-undo records `%s` which is missing"
msgstr "resolve-undo, kayıp olan '%s' ögesini kaydetmiş"
@@ -19181,6 +19370,14 @@ msgid "--all or <enlistment>, but not both"
msgstr "--all veya <gönüllükayıt>; ancak ikisi değil"
#, c-format
+msgid "could not remove stale scalar.repo '%s'"
+msgstr "eskimiş scalar.repo '%s' kaldırılamadı"
+
+#, c-format
+msgid "removing stale scalar.repo '%s'"
+msgstr "eskimiş scalar.repo '%s' kaldırılıyor"
+
+#, c-format
msgid "git repository gone in '%s'"
msgstr "git deposu '%s' içinde gitti"
@@ -19611,6 +19808,23 @@ msgid "git %s: failed to refresh the index"
msgstr "git %s: indeks yenilenemedi"
#, c-format
+msgid "'%s' is not a valid label"
+msgstr "'%s', geçerli bir etiket değil"
+
+#, c-format
+msgid "'%s' is not a valid refname"
+msgstr "'%s', geçerli bir başvuru adı değil"
+
+#, c-format
+msgid "update-ref requires a fully qualified refname e.g. refs/heads/%s"
+msgstr ""
+"update-ref, tümüyle kalifiye bir başvuru adı gerektiriyor; örn. refs/heads/%s"
+
+#, c-format
+msgid "invalid command '%.*s'"
+msgstr "geçersiz komut %.*s"
+
+#, c-format
msgid "%s does not accept arguments: '%s'"
msgstr "%s argüman kabul etmiyor: '%s'"
@@ -19761,7 +19975,7 @@ msgstr "%.*s birleÅŸtirilemedi"
#, c-format
msgid "Executing: %s\n"
-msgstr "Çalıştırılıyor: %s\n"
+msgstr "Yürütülüyor: %s\n"
#, c-format
msgid ""
@@ -19771,7 +19985,7 @@ msgid ""
" git rebase --continue\n"
"\n"
msgstr ""
-"Çalıştırma başarısız: %s\n"
+"Yürütme başarısız: %s\n"
"%sSorunu çözüp sürdürmek için şunu çalıştırın:\n"
"\n"
"\tgit rebase --continue\n"
@@ -19789,7 +20003,7 @@ msgid ""
" git rebase --continue\n"
"\n"
msgstr ""
-"Çalıştırma başarılı oldu: %s,\n"
+"Yürütme başarılı oldu: %s,\n"
"ancak indeksinize ve/veya çalışma ağacınıza değişiklikler bıraktı\n"
"Değişikliklerinizi işleyin veya zulalayın, ardından şunu çalıştırın:\n"
"\n"
@@ -19800,16 +20014,16 @@ msgstr ""
msgid "illegal label name: '%.*s'"
msgstr "izin verilmeyen etiket adı: '%.*s'"
+#, c-format
+msgid "could not resolve '%s'"
+msgstr "'%s' çözülemedi"
+
msgid "writing fake root commit"
msgstr "sahte kök işlemesi yazılıyor"
msgid "writing squash-onto"
msgstr "squash-onto yazılıyor"
-#, c-format
-msgid "could not resolve '%s'"
-msgstr "'%s' çözülemedi"
-
msgid "cannot merge without a current revision"
msgstr "güncel bir revizyon olmadan birleştirilemiyor"
@@ -19822,7 +20036,7 @@ msgid "nothing to merge: '%.*s'"
msgstr "birleÅŸtirilecek bir ÅŸey yok: '%.*s'"
msgid "octopus merge cannot be executed on top of a [new root]"
-msgstr "ahtapot birleştirmesi bir [yeni kök]ün üzerinde çalıştırılamaz"
+msgstr "ahtapot birleştirmesi bir [yeni kök]ün üzerinde yürütülemez"
#, c-format
msgid "could not get commit message of '%s'"
@@ -19920,7 +20134,7 @@ msgid ""
" git rebase --edit-todo\n"
" git rebase --continue\n"
msgstr ""
-"todo komutu çalıştırılamadı.\n"
+"todo komutu yürütülemedi.\n"
"\n"
"\t%.*s\n"
"Yeniden zamanlandı; sürdürmeden önce komutu düzenlemek için lütfen\n"
@@ -20405,6 +20619,25 @@ msgstr "ls-tree beklenmedik bir biçimde %d kodu ile çıktı"
msgid "failed to lstat '%s'"
msgstr "'%s', lstat yapılamadı"
+msgid "no remote configured to get bundle URIs from"
+msgstr "demet URI'lerini almak için bir uzak konum yapılandırılmamış"
+
+#, c-format
+msgid "remote '%s' has no configured URL"
+msgstr "'%s' uzak konumunun yapılandırılmış bir URL'si yok"
+
+msgid "could not get the bundle-uri list"
+msgstr "bundle-uri listesi alınamadı"
+
+msgid "test-tool cache-tree <options> (control|prime|update)"
+msgstr "test-tool cache-tree <seçenekler> (control|prime|update)"
+
+msgid "clear the cache tree before each iteration"
+msgstr "her bir yinelemeden önce önbellek ağacını temizle"
+
+msgid "number of entries in the cache tree to invalidate (default 0)"
+msgstr "önbellek ağacındaki geçersizleştirilecek girdi sayısı (öntanımlı 0)"
+
msgid "unhandled options"
msgstr "beklenmeyen seçenekler"
@@ -20416,7 +20649,7 @@ msgid "commit %s is not marked reachable"
msgstr "%s işlemesi ulaşılabilir olarak imlenmedi"
msgid "too many commits marked reachable"
-msgstr "çok fazla işleme ulaşılabilir olarak imlenmiş"
+msgstr "pek fazla işleme ulaşılabilir olarak imlenmiş"
msgid "test-tool serve-v2 [<options>]"
msgstr "test-tool serve-v2 [<seçenekler>]"
@@ -20747,6 +20980,12 @@ msgstr "Ä°ptal ediliyor."
msgid "failed to push all needed submodules"
msgstr "gereken tüm altmodüller itilemedi"
+msgid "bundle-uri operation not supported by protocol"
+msgstr "bundle-uri işlemi protokol tarafından desteklenmiyor"
+
+msgid "could not retrieve server-advertised bundle-uri list"
+msgstr "sunucu tarafından tanıtılan bundle-uri listesi alınamadı"
+
msgid "too-short tree object"
msgstr "ağaç nesnesi çok kısa"
@@ -21175,8 +21414,8 @@ msgstr " (işlenecekleri güncellemek için \"git add/rm <dosya>...\" kullanın
msgid ""
" (use \"git restore <file>...\" to discard changes in working directory)"
msgstr ""
-" (çalışma dizinindeki değişiklikleri atmak için \"git restore <dosya>...\" "
-"kullanın)"
+" (çalışma dizinindeki değişiklikleri atmak için\n"
+" \"git restore <dosya>...\" kullanın)"
msgid " (commit or discard the untracked or modified content in submodules)"
msgstr " (altmodüllerdeki izlenmeyen/değiştirilen içeriği gönder veya at)"
@@ -21476,13 +21715,18 @@ msgstr "Yok sayılan dosyalar"
#, c-format
msgid ""
-"It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
-"may speed it up, but you have to be careful not to forget to add\n"
-"new files yourself (see 'git help status')."
+"It took %.2f seconds to enumerate untracked files,\n"
+"but the results were cached, and subsequent runs may be faster."
msgstr ""
-"İzlenmeyen dosyaların ortaya dökülmesi %.2f saniye sürdü. 'status -uno'\n"
-"bunu hızlandırabilir; ancak yeni dosyaları eklemeyi unutmamanız\n"
-"konusunda dikkatli olmalısınız (ek bilgi için 'git help status')."
+"İzlenmeyen dosyaları ortaya dökme %.2f saniye sürdü;\n"
+"ancak sonuçlar önbelleğe alındı ve sonrakiler daha hızlı olabilir."
+
+#, c-format
+msgid "It took %.2f seconds to enumerate untracked files."
+msgstr "İzlenmeyen dosyaları ortaya dökme %.2f saniye sürdü."
+
+msgid "See 'git help status' for information on how to improve this."
+msgstr "Bunu iyileştirme üzerine bilgi için 'git help status'a bakın."
#, c-format
msgid "Untracked files not listed%s"
@@ -21509,8 +21753,8 @@ msgid ""
"nothing added to commit but untracked files present (use \"git add\" to "
"track)\n"
msgstr ""
-"işlemeye bir şey eklenmedi; ancak izlenmeyen dosyalar var (izlemek için "
-"\"git add\" kullanın)\n"
+"iÅŸlemeye bir ÅŸey eklenmedi; ancak izlenmeyen dosyalar var\n"
+" (izlemek için \"git add\" kullanın)\n"
#, c-format
msgid "nothing added to commit but untracked files present\n"
@@ -21519,8 +21763,8 @@ msgstr "iÅŸlemeye bir ÅŸey eklenmedi; ancak izlenmeyen dosyalar var\n"
#, c-format
msgid "nothing to commit (create/copy files and use \"git add\" to track)\n"
msgstr ""
-"İşlenecek bir şey yok (dosyalar oluşturun/kopyalayın ve izlemek için \"git "
-"add\" kullanın)\n"
+"Ä°ÅŸlenecek bir ÅŸey yok\n"
+" (dosyalar oluşturun/kopyalayın ve izlemek için \"git add\" kullanın)\n"
#, c-format
msgid "nothing to commit\n"
@@ -21626,275 +21870,6 @@ msgstr "Bu komutu çalışma ağacının en üst düzeyinden çalıştırmanız
msgid "Unable to determine absolute path of git directory"
msgstr "Git dizininin kesin yolu algılanamıyor"
-#. TRANSLATORS: you can adjust this to align "git add -i" status menu
-#, perl-format
-msgid "%12s %12s %s"
-msgstr "%12s %12s %s"
-
-#, perl-format
-msgid "touched %d path\n"
-msgid_plural "touched %d paths\n"
-msgstr[0] "%d yola dokunuldu\n"
-msgstr[1] "%d yola dokunuldu\n"
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for staging."
-msgstr ""
-"Eğer yama sorunsuzca uygulanırsa düzenlenen parça derhal hazırlama\n"
-"için imlenecektir."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for stashing."
-msgstr ""
-"Eğer yama sorunsuzca uygulanırsa düzenlenen parça derhal zulalama\n"
-"için imlenecektir."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for unstaging."
-msgstr ""
-"Eğer yama sorunsuzca uygulanırsa, düzenlenen parça derhal hazırlıktan\n"
-"çıkarılma için imlenecektir."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for applying."
-msgstr ""
-"Eğer yama sorunsuzca uygulanırsa düzenlenen parça derhal uygulama\n"
-"için imlenecektir."
-
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for discarding."
-msgstr ""
-"Eğer yama sorunsuzca uygulanırsa düzenlenen parça derhal ıskartaya\n"
-"çıkarım için imlenecektir."
-
-#, perl-format
-msgid "failed to open hunk edit file for writing: %s"
-msgstr "parça düzenleme dosyası yazım için açılamadı: %s"
-
-#, perl-format
-msgid ""
-"---\n"
-"To remove '%s' lines, make them ' ' lines (context).\n"
-"To remove '%s' lines, delete them.\n"
-"Lines starting with %s will be removed.\n"
-msgstr ""
-"---\n"
-"'%s' satır kaldırmak için onları ' ' satır yapın (bağlam).\n"
-"'%s' satır kaldırmak için onları silin.\n"
-"%s ile başlayan satırlar kaldırılacaktır.\n"
-
-#, perl-format
-msgid "failed to open hunk edit file for reading: %s"
-msgstr "parça düzenleme dosyası okuma için açılamadı: %s"
-
-msgid ""
-"y - stage this hunk\n"
-"n - do not stage this hunk\n"
-"q - quit; do not stage this hunk or any of the remaining ones\n"
-"a - stage this hunk and all later hunks in the file\n"
-"d - do not stage this hunk or any of the later hunks in the file"
-msgstr ""
-"y - bu parçayı hazırla\n"
-"n - bu parçayı hazırlama\n"
-"q - çık; bu parçayı veya kalanlardan herhangi birini hazırlama\n"
-"a - bu parçayı ve sonraki tüm parçaları hazırla\n"
-"d - bu parçayı veya sonraki parçalardan herhangi birini hazırlama"
-
-msgid ""
-"y - stash this hunk\n"
-"n - do not stash this hunk\n"
-"q - quit; do not stash this hunk or any of the remaining ones\n"
-"a - stash this hunk and all later hunks in the file\n"
-"d - do not stash this hunk or any of the later hunks in the file"
-msgstr ""
-"y - bu parçayı zulala\n"
-"n - bu parçayı zulalama\n"
-"q - çık; bu parçayı veya kalanlardan herhangi birini zulalama\n"
-"a - bu parçayı ve sonraki tüm parçaları zulala\n"
-"d - bu parçayı veya sonraki parçalardan herhangi birini zulalama"
-
-msgid ""
-"y - unstage this hunk\n"
-"n - do not unstage this hunk\n"
-"q - quit; do not unstage this hunk or any of the remaining ones\n"
-"a - unstage this hunk and all later hunks in the file\n"
-"d - do not unstage this hunk or any of the later hunks in the file"
-msgstr ""
-"y - bu parçayı hazırlıktan çıkar\n"
-"n - bu parçayı hazırlıktan çıkarma\n"
-"q - çık; bu parçayı veya kalanlardan herhangi birini hazırlıktan çıkarma\n"
-"a - bu parçayı ve sonraki tüm parçaları hazırlıktan çıkar\n"
-"d - bu parçayı veya sonraki parçalardan herhangi birini hazırlıktan çıkarma"
-
-msgid ""
-"y - apply this hunk to index\n"
-"n - do not apply this hunk to index\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - bu parçayı indekse uygula\n"
-"n - bu parçayı indekse uygulama\n"
-"q - çık; bu parçayı veya kalanlardan herhangi birini uygulama\n"
-"a - bu parçayı ve sonraki tüm parçaları uygula\n"
-"d - bu parçayı veya sonraki parçalardan herhangi birini uygulama"
-
-msgid ""
-"y - discard this hunk from worktree\n"
-"n - do not discard this hunk from worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-"y - bu parçayı çalışma ağacından at\n"
-"n - bu parçayı çalışma ağacından atma\n"
-"q - çık; bu parçayı veya kalanlardan herhangi birini atma\n"
-"a - bu parçayı ve sonraki tüm parçaları at\n"
-"d - bu parçayı veya sonraki parçalardan herhangi birini atma"
-
-msgid ""
-"y - discard this hunk from index and worktree\n"
-"n - do not discard this hunk from index and worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-"y - bu parçayı çalışma ağacından ve indeksten at\n"
-"n - bu parçayı çalışma ağacından ve indeksten atma\n"
-"q - çık; bu parçayı veya kalanlardan herhangi birini atma\n"
-"a - bu parçayı ve sonraki tüm parçaları at\n"
-"d - bu parçayı veya sonraki parçalardan herhangi birini atma"
-
-msgid ""
-"y - apply this hunk to index and worktree\n"
-"n - do not apply this hunk to index and worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - bu parçayı indekse ve çalışma ağacına uygula\n"
-"n - bu parçayı indekse ve çalışma ağacına uygulama\n"
-"q - çık; bu parçayı veya kalanlardan herhangi birini uygulama\n"
-"a - bu parçayı ve sonraki tüm parçaları uygula\n"
-"d - bu parçayı veya sonraki parçalardan herhangi birini uygulama"
-
-msgid ""
-"y - apply this hunk to worktree\n"
-"n - do not apply this hunk to worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - bu parçayı çalışma ağacına uygula\n"
-"n - bu parçayı çalışma ağacına uygulama\n"
-"q - çık; bu parçayı veya kalanlardan herhangi birini uygulama\n"
-"a - bu parçayı ve sonraki tüm parçaları uygula\n"
-"d - bu parçayı veya sonraki parçalardan herhangi birini uygulama"
-
-msgid ""
-"g - select a hunk to go to\n"
-"/ - search for a hunk matching the given regex\n"
-"j - leave this hunk undecided, see next undecided hunk\n"
-"J - leave this hunk undecided, see next hunk\n"
-"k - leave this hunk undecided, see previous undecided hunk\n"
-"K - leave this hunk undecided, see previous hunk\n"
-"s - split the current hunk into smaller hunks\n"
-"e - manually edit the current hunk\n"
-"? - print help\n"
-msgstr ""
-"g - gidilecek bir parça seç\n"
-"/ - verilen düzenli ifade ile eşleşen bir parça ara\n"
-"j - bu parça için sonra karar ver, bir sonraki karar verilmemiş parçayı gör\n"
-"J - bu parça için sonra karar ver, bir sonraki parçayı gör\n"
-"k - bu parça için sonra karar ver, bir önceki karar verilmemiş parçayı gör\n"
-"K - bu parça için sonra karar ver, bir önceki parçayı gör\n"
-"s - geçerli parçayı daha ufak parçalara böl\n"
-"e - geçerli parçayı el ile düzenle\n"
-"? - yardımı yazdır\n"
-
-msgid "The selected hunks do not apply to the index!\n"
-msgstr "Seçili parçalar indekse uygulanamıyor!\n"
-
-#, perl-format
-msgid "ignoring unmerged: %s\n"
-msgstr "birleştirilmeyenler yok sayılıyor: %s\n"
-
-msgid "No other hunks to goto\n"
-msgstr "Gidilecek başka parça yok\n"
-
-#, perl-format
-msgid "Invalid number: '%s'\n"
-msgstr "Geçersiz sayı: '%s'\n"
-
-#, perl-format
-msgid "Sorry, only %d hunk available.\n"
-msgid_plural "Sorry, only %d hunks available.\n"
-msgstr[0] "Üzgünüm, yalnızca %d parça kullanılabilir.\n"
-msgstr[1] "Üzgünüm, yalnızca %d parça kullanılabilir.\n"
-
-msgid "No other hunks to search\n"
-msgstr "Aranacak başka parça yok\n"
-
-#, perl-format
-msgid "Malformed search regexp %s: %s\n"
-msgstr "Hatalı oluşturulmuş arama düzenli ifadesi %s: %s\n"
-
-msgid "No hunk matches the given pattern\n"
-msgstr "Verilen dizgi ile hiçbir parça eşleşmiyor\n"
-
-msgid "No previous hunk\n"
-msgstr "Öncesinde parça yok\n"
-
-msgid "No next hunk\n"
-msgstr "Sonrasında parça yok\n"
-
-msgid "Sorry, cannot split this hunk\n"
-msgstr "Üzgünüm, bu parça bölünemiyor\n"
-
-#, perl-format
-msgid "Split into %d hunk.\n"
-msgid_plural "Split into %d hunks.\n"
-msgstr[0] "%d parçaya bölündü.\n"
-msgstr[1] "%d parçaya bölündü.\n"
-
-msgid "Sorry, cannot edit this hunk\n"
-msgstr "Üzgünüm, bu parça düzenlenemiyor\n"
-
-#. TRANSLATORS: please do not translate the command names
-#. 'status', 'update', 'revert', etc.
-msgid ""
-"status - show paths with changes\n"
-"update - add working tree state to the staged set of changes\n"
-"revert - revert staged set of changes back to the HEAD version\n"
-"patch - pick hunks and update selectively\n"
-"diff - view diff between HEAD and index\n"
-"add untracked - add contents of untracked files to the staged set of "
-"changes\n"
-msgstr ""
-"status - değişiklik içeren yolları göster\n"
-"update - çalışma ağacı durumunu hazırlanan değişiklik setine ekle\n"
-"revert - hazırlanan değişiklik setini HEAD sürümüne geri al\n"
-"patch - parçaları seç ve seçici olarak güncelle\n"
-"diff - HEAD ve indeks arasındaki diff'i (ayrımları) görüntüle\n"
-"add untracked - izlenmeyen dosyaların içeriğini hazırlanan değişiklik setine "
-"ekle\n"
-
-msgid "missing --"
-msgstr "-- eksik"
-
-#, perl-format
-msgid "unknown --patch mode: %s"
-msgstr "bilinmeyen --patch kipi: %s"
-
-#, perl-format
-msgid "invalid argument %s, expecting --"
-msgstr "geçersiz argüman %s, -- bekleniyor"
-
msgid "local zone differs from GMT by a non-minute interval\n"
msgstr "yerel dilim GMT'den bir dakikadan az bir aralıkla ayrımlı\n"
@@ -22169,7 +22144,7 @@ msgstr "(body) Cc: %s, '%s' satırından ekleniyor\n"
#, perl-format
msgid "(%s) Could not execute '%s'"
-msgstr "(%s) '%s' çalıştırılamadı"
+msgstr "(%s) '%s' yürütülemedi"
#, perl-format
msgid "(%s) Adding %s: %s from: '%s'\n"
diff --git a/po/zh_CN.po b/po/zh_CN.po
index b0832be695..2b88f9b781 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -119,6 +119,7 @@
# smart HTTP protocol | 智能 HTTP åè®®
# squash | 挤压
# stage | n. 暂存区(å³ç´¢å¼•ï¼‰; v. æš‚å­˜
+# stale | 过期的
# stash | n. è´®è—区; v. è´®è—
# submodule | å­æ¨¡ç»„
# symref | 符å·å¼•ç”¨
@@ -138,14 +139,14 @@
# upstream | 上游
# upstream branch | 上游分支
# working tree | 工作区
-# Fangyi Zhou <me@fangyi.io>, 2021-2022.
+# Fangyi Zhou <me@fangyi.io>, 2021-2023.
#
msgid ""
msgstr ""
"Project-Id-Version: Git\n"
"Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2022-09-28 15:50+0100\n"
-"PO-Revision-Date: 2022-09-23 14:53+0100\n"
+"POT-Creation-Date: 2023-03-07 23:37+0000\n"
+"PO-Revision-Date: 2023-03-07 23:40+0000\n"
"Last-Translator: Fangyi Zhou <me@fangyi.io>\n"
"Language-Team: GitHub <https://github.com/fangyi-zhou/git-po/>\n"
"Language: zh_CN\n"
@@ -164,19 +165,19 @@ msgstr "嗯(%s)?"
msgid "could not read index"
msgstr "ä¸èƒ½è¯»å–索引"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "binary"
msgstr "二进制"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "nothing"
msgstr "æ— "
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "unchanged"
msgstr "没有修改"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "Update"
msgstr "æ›´æ–°"
@@ -189,15 +190,15 @@ msgstr "ä¸èƒ½æš‚å­˜ '%s'"
msgid "could not write index"
msgstr "ä¸èƒ½å†™å…¥ç´¢å¼•"
-#: add-interactive.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-interactive.c
+#, c-format
msgid "updated %d path\n"
msgid_plural "updated %d paths\n"
msgstr[0] "更新了 %d 个路径\n"
msgstr[1] "更新了 %d 个路径\n"
-#: add-interactive.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-interactive.c
+#, c-format
msgid "note: %s is untracked now.\n"
msgstr "说明:%s 现已æˆä¸ºæœªè·Ÿè¸ªçš„。\n"
@@ -206,7 +207,7 @@ msgstr "说明:%s 现已æˆä¸ºæœªè·Ÿè¸ªçš„。\n"
msgid "make_cache_entry failed for path '%s'"
msgstr "对路径 '%s' çš„ make_cache_entry æ“作失败"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "Revert"
msgstr "还原"
@@ -214,24 +215,24 @@ msgstr "还原"
msgid "Could not parse HEAD^{tree}"
msgstr "ä¸èƒ½è§£æž HEAD^{tree}"
-#: add-interactive.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-interactive.c
+#, c-format
msgid "reverted %d path\n"
msgid_plural "reverted %d paths\n"
msgstr[0] "还原了 %d 个路径\n"
msgstr[1] "还原了 %d 个路径\n"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
#, c-format
msgid "No untracked files.\n"
msgstr "没有未跟踪的文件。\n"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "Add untracked"
msgstr "添加未跟踪的"
-#: add-interactive.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-interactive.c
+#, c-format
msgid "added %d path\n"
msgid_plural "added %d paths\n"
msgstr[0] "增加了 %d 个路径\n"
@@ -242,21 +243,21 @@ msgstr[1] "增加了 %d 个路径\n"
msgid "ignoring unmerged: %s"
msgstr "忽略未åˆå…¥çš„:%s"
-#: add-interactive.c add-patch.c git-add--interactive.perl
+#: add-interactive.c add-patch.c
#, c-format
msgid "Only binary files changed.\n"
msgstr "åªæœ‰äºŒè¿›åˆ¶æ–‡ä»¶è¢«ä¿®æ”¹ã€‚\n"
-#: add-interactive.c add-patch.c git-add--interactive.perl
+#: add-interactive.c add-patch.c
#, c-format
msgid "No changes.\n"
msgstr "没有修改。\n"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "Patch update"
msgstr "è¡¥ä¸æ›´æ–°"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "Review diff"
msgstr "检视 diff"
@@ -324,25 +325,25 @@ msgstr "选择一个编å·æ¡ç›®"
msgid "(empty) select nothing"
msgstr "(空)ä¸é€‰æ‹©ä»»ä½•å†…容"
-#: add-interactive.c builtin/clean.c git-add--interactive.perl
+#: add-interactive.c builtin/clean.c
msgid "*** Commands ***"
msgstr "*** 命令 ***"
-#: add-interactive.c builtin/clean.c git-add--interactive.perl
+#: add-interactive.c builtin/clean.c
msgid "What now"
msgstr "请选择"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "staged"
msgstr "缓存"
-#: add-interactive.c git-add--interactive.perl
+#: add-interactive.c
msgid "unstaged"
msgstr "未缓存"
#: add-interactive.c apply.c builtin/am.c builtin/bugreport.c builtin/clone.c
-#: builtin/diagnose.c builtin/fetch.c builtin/merge.c builtin/pull.c
-#: builtin/submodule--helper.c git-add--interactive.perl
+#: builtin/diagnose.c builtin/fetch.c builtin/hook.c builtin/merge.c
+#: builtin/pull.c builtin/submodule--helper.c
msgid "path"
msgstr "路径"
@@ -350,28 +351,28 @@ msgstr "路径"
msgid "could not refresh index"
msgstr "ä¸èƒ½åˆ·æ–°ç´¢å¼•"
-#: add-interactive.c builtin/clean.c git-add--interactive.perl
+#: add-interactive.c builtin/clean.c
#, c-format
msgid "Bye.\n"
msgstr "å†è§ã€‚\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stage mode change [y,n,q,a,d%s,?]? "
msgstr "暂存模å¼å˜æ›´ [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stage deletion [y,n,q,a,d%s,?]? "
msgstr "暂存删除动作 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stage addition [y,n,q,a,d%s,?]? "
msgstr "暂存添加动作 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stage this hunk [y,n,q,a,d%s,?]? "
msgstr "æš‚å­˜è¯¥å— [y,n,q,a,d%s,?]? "
@@ -395,23 +396,23 @@ msgstr ""
"a - 暂存该å—和本文件中åŽé¢çš„全部å—\n"
"d - ä¸æš‚存该å—和本文件中åŽé¢çš„全部å—\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stash mode change [y,n,q,a,d%s,?]? "
msgstr "è´®è—模å¼å˜æ›´ [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stash deletion [y,n,q,a,d%s,?]? "
msgstr "è´®è—删除动作 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stash addition [y,n,q,a,d%s,?]? "
msgstr "è´®è—添加动作 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Stash this hunk [y,n,q,a,d%s,?]? "
msgstr "è´®è—è¯¥å— [y,n,q,a,d%s,?]? "
@@ -435,23 +436,23 @@ msgstr ""
"a - è´®è—该å—和本文件中åŽé¢çš„全部å—\n"
"d - ä¸è´®è—该å—和本文件中åŽé¢çš„全部å—\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Unstage mode change [y,n,q,a,d%s,?]? "
msgstr "å–消暂存模å¼å˜æ›´ [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Unstage deletion [y,n,q,a,d%s,?]? "
msgstr "å–消暂存删除动作 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Unstage addition [y,n,q,a,d%s,?]? "
msgstr "å–消暂存添加动作 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Unstage this hunk [y,n,q,a,d%s,?]? "
msgstr "å–æ¶ˆæš‚å­˜è¯¥å— [y,n,q,a,d%s,?]? "
@@ -475,23 +476,23 @@ msgstr ""
"a - å–消暂存该å—和本文件中åŽé¢çš„全部å—\n"
"d - ä¸è¦å–消暂存该å—和本文件中åŽé¢çš„全部å—\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply mode change to index [y,n,q,a,d%s,?]? "
msgstr "将模å¼å˜æ›´åº”用到索引 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply deletion to index [y,n,q,a,d%s,?]? "
msgstr "将删除æ“作应用到索引 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply addition to index [y,n,q,a,d%s,?]? "
msgstr "将添加æ“作应用到索引 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply this hunk to index [y,n,q,a,d%s,?]? "
msgstr "将该å—应用到索引 [y,n,q,a,d%s,?]? "
@@ -515,23 +516,23 @@ msgstr ""
"a - 应用该å—和本文件中åŽé¢çš„全部å—\n"
"d - ä¸è¦åº”用该å—和本文件中åŽé¢çš„全部å—\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard mode change from worktree [y,n,q,a,d%s,?]? "
msgstr "从工作区中丢弃模å¼å˜æ›´ [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard deletion from worktree [y,n,q,a,d%s,?]? "
msgstr "从工作区中丢弃删除动作 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard addition from worktree [y,n,q,a,d%s,?]? "
msgstr "从工作区中丢弃添加动作 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard this hunk from worktree [y,n,q,a,d%s,?]? "
msgstr "ä»Žå·¥ä½œåŒºä¸­ä¸¢å¼ƒè¯¥å— [y,n,q,a,d%s,?]? "
@@ -555,23 +556,23 @@ msgstr ""
"a - 丢弃该å—和本文件中åŽé¢çš„全部å—\n"
"d - ä¸è¦ä¸¢å¼ƒè¯¥å—和本文件中åŽé¢çš„全部å—\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard mode change from index and worktree [y,n,q,a,d%s,?]? "
msgstr "从索引和工作区中丢弃模å¼å˜æ›´ [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard deletion from index and worktree [y,n,q,a,d%s,?]? "
msgstr "从索引和工作区中丢弃删除动作 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard addition from index and worktree [y,n,q,a,d%s,?]? "
msgstr "从索引和工作区中丢弃添加动作 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Discard this hunk from index and worktree [y,n,q,a,d%s,?]? "
msgstr "ä»Žç´¢å¼•å’Œå·¥ä½œåŒºä¸­ä¸¢å¼ƒè¯¥å— [y,n,q,a,d%s,?]? "
@@ -589,23 +590,23 @@ msgstr ""
"a - 丢弃该å—和本文件中åŽé¢çš„全部å—\n"
"d - ä¸è¦ä¸¢å¼ƒè¯¥å—和本文件中åŽé¢çš„全部å—\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply mode change to index and worktree [y,n,q,a,d%s,?]? "
msgstr "将模å¼å˜æ›´åº”用到索引和工作区 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply deletion to index and worktree [y,n,q,a,d%s,?]? "
msgstr "将删除æ“作应用到索引和工作区 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply addition to index and worktree [y,n,q,a,d%s,?]? "
msgstr "将添加æ“作应用到索引和工作区 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply this hunk to index and worktree [y,n,q,a,d%s,?]? "
msgstr "将该å—应用到索引和工作区 [y,n,q,a,d%s,?]? "
@@ -623,23 +624,23 @@ msgstr ""
"a - 应用该å—和本文件中åŽé¢çš„全部å—\n"
"d - ä¸è¦åº”用该å—和本文件中åŽé¢çš„全部å—\n"
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply mode change to worktree [y,n,q,a,d%s,?]? "
msgstr "将模å¼å˜æ›´åº”用到工作区 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply deletion to worktree [y,n,q,a,d%s,?]? "
msgstr "将删除æ“作应用到工作区 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply addition to worktree [y,n,q,a,d%s,?]? "
msgstr "将添加æ“作应用到工作区 [y,n,q,a,d%s,?]? "
-#: add-patch.c git-add--interactive.perl
-#, c-format, perl-format
+#: add-patch.c
+#, c-format
msgid "Apply this hunk to worktree [y,n,q,a,d%s,?]? "
msgstr "将该å—应用到工作区 [y,n,q,a,d%s,?]? "
@@ -707,7 +708,7 @@ msgstr ""
"\tä¸æ˜¯ç»“尾于:\n"
"%.*s"
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid "Manual hunk edit mode -- see bottom for a quick guide.\n"
msgstr "手动å—ç¼–è¾‘æ¨¡å¼ -- 查看底部的快速指å—。\n"
@@ -724,9 +725,7 @@ msgstr ""
"è¦åˆ é™¤ '%c' 开始的行,删除它们。\n"
"以 %c 开始的行将被删除。\n"
-#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
-#. TRANSLATORS: 'it' refers to the patch mentioned in the previous messages.
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid ""
"If it does not apply cleanly, you will be given an opportunity to\n"
"edit again. If all lines of the hunk are removed, then the edit is\n"
@@ -743,21 +742,13 @@ msgstr "无法解æžæ•°æ®å—头信æ¯"
msgid "'git apply --cached' failed"
msgstr "'git apply --cached' 失败"
-#. #-#-#-#-# add-patch.c.po #-#-#-#-#
#. TRANSLATORS: do not translate [y/n]
#. The program will only accept that input at this point.
#. Consider translating (saying "no" discards!) as
#. (saying "n" for "no" discards!) if the translation
#. of the word "no" does not start with n.
#.
-#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
-#. TRANSLATORS: do not translate [y/n]
-#. The program will only accept that input
-#. at this point.
-#. Consider translating (saying "no" discards!) as
-#. (saying "n" for "no" discards!) if the translation
-#. of the word "no" does not start with n.
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid ""
"Your edited hunk does not apply. Edit again (saying \"no\" discards!) [y/n]? "
msgstr "您的编辑å—ä¸èƒ½è¢«åº”用。é‡æ–°ç¼–辑(选择 \"no\" 丢弃ï¼ï¼‰ [y/n]? "
@@ -766,11 +757,11 @@ msgstr "您的编辑å—ä¸èƒ½è¢«åº”用。é‡æ–°ç¼–辑(选择 \"no\" 丢弃ï¼ï
msgid "The selected hunks do not apply to the index!"
msgstr "选中的å—ä¸èƒ½åº”用到索引ï¼"
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid "Apply them to the worktree anyway? "
msgstr "无论如何都è¦åº”用到工作区么?"
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid "Nothing was applied.\n"
msgstr "未应用。\n"
@@ -808,11 +799,11 @@ msgstr "没有下一个å—"
msgid "No other hunks to goto"
msgstr "没有其它å¯ä¾›è·³è½¬çš„å—"
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid "go to which hunk (<ret> to see more)? "
msgstr "跳转到哪个å—(<回车> 查看更多)? "
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid "go to which hunk? "
msgstr "跳转到哪个å—?"
@@ -832,7 +823,7 @@ msgstr[1] "对ä¸èµ·ï¼Œåªæœ‰ %d 个å¯ç”¨å—。"
msgid "No other hunks to search"
msgstr "没有其它å¯ä¾›æŸ¥æ‰¾çš„å—"
-#: add-patch.c git-add--interactive.perl
+#: add-patch.c
msgid "search for regex? "
msgstr "使用正则表达å¼æœç´¢ï¼Ÿ"
@@ -1016,6 +1007,11 @@ msgstr "命令行以 \\ 结尾"
msgid "unclosed quote"
msgstr "未关闭的引å·"
+#: alias.c builtin/cat-file.c builtin/notes.c builtin/prune-packed.c
+#: builtin/receive-pack.c builtin/tag.c
+msgid "too many arguments"
+msgstr "太多å‚æ•°"
+
#: apply.c
#, c-format
msgid "unrecognized whitespace option '%s'"
@@ -1407,7 +1403,7 @@ msgstr "ä¸èƒ½ä¸ºæ–°å»ºæ–‡ä»¶ %s 创建åŽç«¯å­˜å‚¨"
msgid "unable to add cache entry for %s"
msgstr "无法为 %s 添加缓存æ¡ç›®"
-#: apply.c builtin/bisect--helper.c builtin/gc.c
+#: apply.c builtin/bisect.c builtin/gc.c
#, c-format
msgid "failed to write to '%s'"
msgstr "无法写入 '%s'"
@@ -1467,7 +1463,7 @@ msgstr "ç•¥è¿‡è¡¥ä¸ '%s'。"
msgid "No valid patches in input (allow with \"--allow-empty\")"
msgstr "输入中没有åˆæ³•çš„è¡¥ä¸ ï¼ˆä½¿ç”¨ \"--allow-empty\" æ¥å…许)"
-#: apply.c
+#: apply.c t/helper/test-cache-tree.c
msgid "unable to read index file"
msgstr "无法读å–索引文件"
@@ -1700,7 +1696,7 @@ msgstr "无此引用:%.*s"
msgid "not a valid object name: %s"
msgstr "ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„对象å:%s"
-#: archive.c
+#: archive.c t/helper/test-cache-tree.c
#, c-format
msgid "not a tree object: %s"
msgstr "ä¸æ˜¯ä¸€ä¸ªæ ‘对象:%s"
@@ -1742,7 +1738,7 @@ msgstr "æ ¼å¼"
msgid "archive format"
msgstr "归档格å¼"
-#: archive.c builtin/log.c
+#: archive.c builtin/log.c parse-options.h
msgid "prefix"
msgstr "å‰ç¼€"
@@ -1751,7 +1747,7 @@ msgid "prepend prefix to each pathname in the archive"
msgstr "为归档中æ¯ä¸ªè·¯å¾„å加上å‰ç¼€"
#: archive.c builtin/blame.c builtin/commit-tree.c builtin/config.c
-#: builtin/fast-export.c builtin/grep.c builtin/hash-object.c
+#: builtin/fast-export.c builtin/gc.c builtin/grep.c builtin/hash-object.c
#: builtin/ls-files.c builtin/notes.c builtin/read-tree.c parse-options.h
msgid "file"
msgstr "文件"
@@ -1776,6 +1772,15 @@ msgstr "读å–工作区中的 .gitattributes"
msgid "report archived files on stderr"
msgstr "在标准错误上报告归档文件"
+#: archive.c builtin/clone.c builtin/fetch.c builtin/pack-objects.c
+#: builtin/pull.c
+msgid "time"
+msgstr "时间"
+
+#: archive.c
+msgid "set modification time of archive entries"
+msgstr "设置归档æ¡ç›®çš„修改时间"
+
#: archive.c
msgid "set compression level"
msgstr "设置压缩级别"
@@ -1832,6 +1837,15 @@ msgid "%.*s is not a valid attribute name"
msgstr "%.*s ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„属性å"
#: attr.c
+msgid "unable to add additional attribute"
+msgstr "ä¸èƒ½æ·»åŠ é¢å¤–属性"
+
+#: attr.c
+#, c-format
+msgid "ignoring overly long attributes line %d"
+msgstr "忽略过长的属性行 %d"
+
+#: attr.c
#, c-format
msgid "%s not allowed: %s:%d"
msgstr "ä¸å…许 %s:%s:%d"
@@ -1844,6 +1858,21 @@ msgstr ""
"负值模版在 git attributes 中被忽略\n"
"当字符串确实è¦ä»¥æ„Ÿå¹å·å¼€å§‹æ—¶ï¼Œä½¿ç”¨ '\\!'。"
+#: attr.c
+#, c-format
+msgid "cannot fstat gitattributes file '%s'"
+msgstr "无法 fstat gitattributes 文件 '%s'"
+
+#: attr.c
+#, c-format
+msgid "ignoring overly large gitattributes file '%s'"
+msgstr "忽略过大的 gitattributes 文件 '%s'"
+
+#: attr.c
+#, c-format
+msgid "ignoring overly large gitattributes blob '%s'"
+msgstr "忽略过大的 gitattributes æ•°æ®å¯¹è±¡ '%s'"
+
#: bisect.c
#, c-format
msgid "Badly quoted content in file '%s': %s"
@@ -1976,8 +2005,8 @@ msgid "--reverse and --first-parent together require specified latest commit"
msgstr "--reverse å’Œ --first-parent 共用,需è¦æŒ‡å®šæœ€æ–°çš„æ交"
#: blame.c builtin/commit.c builtin/log.c builtin/merge.c
-#: builtin/pack-objects.c builtin/shortlog.c bundle.c midx.c pack-bitmap.c
-#: ref-filter.c remote.c sequencer.c submodule.c
+#: builtin/pack-objects.c builtin/shortlog.c midx.c pack-bitmap.c ref-filter.c
+#: remote.c sequencer.c submodule.c
msgid "revision walk setup failed"
msgstr "版本é历åˆå§‹åŒ–失败"
@@ -2155,10 +2184,11 @@ msgstr "å­æ¨¡ç»„ '%s':无法找到å­æ¨¡ç»„"
#: branch.c
#, c-format
msgid ""
-"You may try updating the submodules using 'git checkout %s && git submodule "
-"update --init'"
+"You may try updating the submodules using 'git checkout --no-recurse-"
+"submodules %s && git submodule update --init'"
msgstr ""
-"ä½ å¯ä»¥ç”¨ 'git checkout %s && git submodule update --init' æ¥å°è¯•æ›´æ–°å­æ¨¡ç»„"
+"ä½ å¯ä»¥ç”¨ 'git checkout --no-recurse-submodules %s && git submodule update --"
+"init' æ¥å°è¯•æ›´æ–°å­æ¨¡ç»„"
#: branch.c
#, c-format
@@ -2202,6 +2232,14 @@ msgstr "删除 '%s'\n"
msgid "Unstaged changes after refreshing the index:"
msgstr "刷新索引之åŽå°šæœªè¢«æš‚存的å˜æ›´ï¼š"
+#: builtin/add.c
+msgid ""
+"the add.interactive.useBuiltin setting has been removed!\n"
+"See its entry in 'git help config' for details."
+msgstr ""
+"设置 add.interactive.useBuiltin å·²ç»è¢«ç§»é™¤ï¼\n"
+"查看 'git help config' 中的相关æ¡ç›®ä»¥èŽ·å–更多信æ¯ã€‚"
+
#: builtin/add.c builtin/rev-parse.c
msgid "Could not read the index"
msgstr "ä¸èƒ½è¯»å–索引"
@@ -2653,7 +2691,7 @@ msgid ""
"Not rewinding to ORIG_HEAD"
msgstr "您好åƒåœ¨ä¸Šä¸€æ¬¡ 'am' 失败åŽç§»åŠ¨äº† HEAD。未回退至 ORIG_HEAD"
-#: builtin/am.c builtin/bisect--helper.c worktree.c
+#: builtin/am.c builtin/bisect.c worktree.c
#, c-format
msgid "failed to read '%s'"
msgstr "æ— æ³•è¯»å– '%s'"
@@ -2676,6 +2714,10 @@ msgid "run interactively"
msgstr "以交互å¼æ–¹å¼è¿è¡Œ"
#: builtin/am.c
+msgid "bypass pre-applypatch and applypatch-msg hooks"
+msgstr "绕过 pre-applypatch å’Œ applypatch-msg é’©å­"
+
+#: builtin/am.c
msgid "historical option -- no-op"
msgstr "è€çš„å‚æ•° —— 无作用"
@@ -2864,110 +2906,105 @@ msgstr "git archive:å议错误"
msgid "git archive: expected a flush"
msgstr "git archive:应有一个 flush 包"
-#: builtin/bisect--helper.c
-msgid "git bisect--helper --bisect-reset [<commit>]"
-msgstr "git bisect--helper --bisect-reset [<æ交>]"
-
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}"
-"=<term>] [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] "
-"[<paths>...]"
+"git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>] [--no-"
+"checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]"
msgstr ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<术语> --term-{old,good}"
-"=<术语>] [--no-checkout] [--first-parent] [<å> [<好>...]] [--] [<路径>...]"
+"git bisect start [--term-{new,bad}=<术语> --term-{old,good}=<术语>] [--no-"
+"checkout] [--first-parent] [<å> [<好>...]] [--] [<路径规格>...]"
-#: builtin/bisect--helper.c
-msgid "git bisect--helper --bisect-state (bad|new) [<rev>]"
-msgstr "git bisect--helper --bisect-state (bad|new) [<版本>]"
+#: builtin/bisect.c
+msgid "git bisect (good|bad) [<rev>...]"
+msgstr "git bisect (good|bad) [<版本>...]"
-#: builtin/bisect--helper.c
-msgid "git bisect--helper --bisect-state (good|old) [<rev>...]"
-msgstr "git bisect--helper --bisect-state (good|old) [<版本>...]"
+#: builtin/bisect.c
+msgid "git bisect skip [(<rev>|<range>)...]"
+msgstr "git bisect skip [(<版本>|<范围>)...]"
-#: builtin/bisect--helper.c
-msgid "git bisect--helper --bisect-replay <filename>"
-msgstr "git bisect--helper --bisect-replay <文件>"
+#: builtin/bisect.c
+msgid "git bisect reset [<commit>]"
+msgstr "git bisect reset [<æ交>]"
-#: builtin/bisect--helper.c
-msgid "git bisect--helper --bisect-skip [(<rev>|<range>)...]"
-msgstr "git bisect--helper --bisect-skip [(<版本>|<范围>)...]"
+#: builtin/bisect.c
+msgid "git bisect replay <logfile>"
+msgstr "git bisect replay <日志文件>"
-#: builtin/bisect--helper.c
-msgid "git bisect--helper --bisect-run <cmd>..."
-msgstr "git bisect--helper --bisect-run <命令>..."
+#: builtin/bisect.c
+msgid "git bisect run <cmd>..."
+msgstr "git bisect run <命令>..."
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "cannot open file '%s' in mode '%s'"
msgstr "ä¸èƒ½ä»¥ '%2$s' 模å¼æ‰“开文件 '%1$s'"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "could not write to file '%s'"
msgstr "ä¸èƒ½å†™å…¥æ–‡ä»¶ '%s'"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "cannot open file '%s' for reading"
msgstr "ä¸èƒ½æ‰“开文件 '%s' æ¥è¯»å–"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "'%s' is not a valid term"
msgstr "'%s' ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„术语"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "can't use the builtin command '%s' as a term"
msgstr "ä¸èƒ½ä½¿ç”¨å†…置命令 '%s' 作为术语"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "can't change the meaning of the term '%s'"
msgstr "ä¸èƒ½ä¿®æ”¹æœ¯è¯­ '%s' çš„å«ä¹‰"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "please use two different terms"
msgstr "请使用两个ä¸åŒçš„术语"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "We are not bisecting.\n"
msgstr "我们没有在二分查找。\n"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "'%s' is not a valid commit"
msgstr "'%s' ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„æ交"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid ""
"could not check out original HEAD '%s'. Try 'git bisect reset <commit>'."
msgstr "ä¸èƒ½æ£€å‡ºåŽŸå§‹ HEAD '%s'。å°è¯• 'git bisect reset <æ交>'。"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "Bad bisect_write argument: %s"
msgstr "åçš„ bisect_write å‚数:%s"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "couldn't get the oid of the rev '%s'"
msgstr "无法获å–版本 '%s' 的对象 ID"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "couldn't open the file '%s'"
msgstr "无法打开文件 '%s'"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "Invalid command: you're currently in a %s/%s bisect"
msgstr "无效的命令:您当å‰æ­£å¤„于一个 %s/%s 二分查找中"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid ""
"You need to give me at least one %s and %s revision.\n"
@@ -2976,7 +3013,7 @@ msgstr ""
"您需è¦ç»™æˆ‘至少一个 %s 和一个 %s 版本。\n"
"为此您å¯ä»¥ç”¨ \"git bisect %s\" å’Œ \"git bisect %s\"。"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid ""
"You need to start by \"git bisect start\".\n"
@@ -2987,7 +3024,7 @@ msgstr ""
"然åŽéœ€è¦æ供我至少一个 %s 和一个 %s 版本。\n"
"为此您å¯ä»¥ç”¨ \"git bisect %s\" å’Œ \"git bisect %s\" 命令。"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "bisecting only with a %s commit"
msgstr "在åªæœ‰ä¸€ä¸ª %s æ交的情况下二分查找"
@@ -2996,37 +3033,37 @@ msgstr "在åªæœ‰ä¸€ä¸ª %s æ交的情况下二分查找"
#. translation. The program will only accept English input
#. at this point.
#.
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "Are you sure [Y/n]? "
msgstr "您确认么[Y/n]? "
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "status: waiting for both good and bad commits\n"
msgstr "状æ€ï¼šæ­£åœ¨ç­‰å¾…好的和åçš„æ交\n"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "status: waiting for bad commit, %d good commit known\n"
msgid_plural "status: waiting for bad commit, %d good commits known\n"
msgstr[0] "状æ€ï¼šæ­£åœ¨ç­‰å¾…åçš„æ交,已知 %d 个好的æ交\n"
msgstr[1] "状æ€ï¼šæ­£åœ¨ç­‰å¾…åçš„æ交,已知 %d 个好的æ交\n"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "status: waiting for good commit(s), bad commit known\n"
msgstr "状æ€ï¼šæ­£åœ¨ç­‰å¾…好的æ交,已知åçš„æ交\n"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "no terms defined"
msgstr "未定义术语"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid ""
"Your current terms are %s for the old state\n"
"and %s for the new state.\n"
msgstr "您当å‰é’ˆå¯¹æ—§çŠ¶æ€çš„术语是 %s,对新状æ€çš„术语是 %s。\n"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid ""
"invalid argument %s for 'git bisect terms'.\n"
@@ -3035,52 +3072,48 @@ msgstr ""
"命令 'git bisect terms' çš„å‚æ•° %s 无效。\n"
"支æŒçš„选项有:--term-good|--term-old å’Œ --term-bad|--term-new。"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "revision walk setup failed\n"
msgstr "版本é历设置失败\n"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "could not open '%s' for appending"
msgstr "无法打开 '%s' 进行追加"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "'' is not a valid term"
msgstr "'' ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„术语"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "unrecognized option: '%s'"
msgstr "未识别的选项:'%s'"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "'%s' does not appear to be a valid revision"
msgstr "'%s' 看起æ¥ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„版本"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "bad HEAD - I need a HEAD"
msgstr "åçš„ HEAD - 我需è¦ä¸€ä¸ª HEAD"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "checking out '%s' failed. Try 'git bisect start <valid-branch>'."
msgstr "检出 '%s' 失败。å°è¯• 'git bisect start <有效分支>'。"
-#: builtin/bisect--helper.c
-msgid "won't bisect on cg-seek'ed tree"
-msgstr "ä¸ä¼šåœ¨åšäº† cg-seek 的树上åšäºŒåˆ†æŸ¥æ‰¾"
-
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "bad HEAD - strange symbolic ref"
msgstr "åçš„ HEAD - 奇怪的符å·å¼•ç”¨"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "invalid ref: '%s'"
msgstr "无效的引用:'%s'"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "You need to start by \"git bisect start\"\n"
msgstr "您需è¦æ‰§è¡Œ \"git bisect start\" æ¥å¼€å§‹\n"
@@ -3088,166 +3121,131 @@ msgstr "您需è¦æ‰§è¡Œ \"git bisect start\" æ¥å¼€å§‹\n"
#. translation. The program will only accept English input
#. at this point.
#.
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "Do you want me to do it for you [Y/n]? "
msgstr "您想让我为您这样åšä¹ˆ[Y/n]? "
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "Please call `--bisect-state` with at least one argument"
msgstr "请使用至少一个å‚数调用 `--bisect-state`"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "'git bisect %s' can take only one argument."
msgstr "'git bisect %s' åªèƒ½å¸¦ä¸€ä¸ªå‚数。"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "Bad rev input: %s"
msgstr "å的版本输入:%s"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "Bad rev input (not a commit): %s"
msgstr "å的版本输入(ä¸æ˜¯æ交):%s"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "We are not bisecting."
msgstr "我们没有在二分查找。"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "'%s'?? what are you talking about?"
msgstr "'%s'?? 您在说什么?"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "cannot read file '%s' for replaying"
msgstr "ä¸èƒ½è¯»å–文件 '%s' æ¥é‡æ”¾"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "running %s\n"
msgstr "正在执行 %s\n"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "bisect run failed: no command provided."
msgstr "二分查找è¿è¡Œå¤±è´¥ï¼šæ²¡æœ‰æ供命令。"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
-msgid "unable to verify '%s' on good revision"
-msgstr "æ— æ³•åœ¨å¥½ç‰ˆæœ¬ä¸­éªŒè¯ '%s'"
+msgid "unable to verify %s on good revision"
+msgstr "æ— æ³•åœ¨å¥½ç‰ˆæœ¬ä¸­éªŒè¯ %s"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "bogus exit code %d for good revision"
msgstr "å¥½ç‰ˆæœ¬è¿”å›žé”™è¯¯çš„é€€å‡ºç  %d"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
-msgid "bisect run failed: exit code %d from '%s' is < 0 or >= 128"
-msgstr "二分查找è¿è¡Œå¤±è´¥ï¼šå‘½ä»¤ '%2$s' çš„é€€å‡ºç  %1$d < 0 或 >= 128"
+msgid "bisect run failed: exit code %d from %s is < 0 or >= 128"
+msgstr "二分查找è¿è¡Œå¤±è´¥ï¼šå‘½ä»¤ %2$s çš„é€€å‡ºç  %1$d < 0 或 >= 128"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
msgid "cannot open file '%s' for writing"
msgstr "无法打开文件 '%s' 进行写入"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
msgid "bisect run cannot continue any more"
msgstr "二分查找ä¸èƒ½ç»§ç»­è¿è¡Œ"
-#: builtin/bisect--helper.c
-#, c-format
+#: builtin/bisect.c
msgid "bisect run success"
msgstr "二分查找è¿è¡ŒæˆåŠŸ"
-#: builtin/bisect--helper.c
-#, c-format
+#: builtin/bisect.c
msgid "bisect found first bad commit"
msgstr "二分查找找到了第一个åçš„æ交"
-#: builtin/bisect--helper.c
+#: builtin/bisect.c
#, c-format
-msgid ""
-"bisect run failed: 'git bisect--helper --bisect-state %s' exited with error "
-"code %d"
-msgstr "二分查找è¿è¡Œå¤±è´¥ï¼š'git bisect--helper --bisect-state %s' 退出ç ä¸º %d"
-
-#: builtin/bisect--helper.c
-msgid "reset the bisection state"
-msgstr "清除二分查找状æ€"
-
-#: builtin/bisect--helper.c
-msgid "check whether bad or good terms exist"
-msgstr "检查å的或好的术语是å¦å­˜åœ¨"
-
-#: builtin/bisect--helper.c
-msgid "print out the bisect terms"
-msgstr "打å°äºŒåˆ†æŸ¥æ‰¾æœ¯è¯­"
-
-#: builtin/bisect--helper.c
-msgid "start the bisect session"
-msgstr "å¯åŠ¨äºŒåˆ†æŸ¥æ‰¾è¿‡ç¨‹"
-
-#: builtin/bisect--helper.c
-msgid "find the next bisection commit"
-msgstr "查询下一个二分查找æ交"
-
-#: builtin/bisect--helper.c
-msgid "mark the state of ref (or refs)"
-msgstr "标记引用的状æ€"
-
-#: builtin/bisect--helper.c
-msgid "list the bisection steps so far"
-msgstr "列出到目å‰ä¸ºæ­¢çš„二分查找步骤"
-
-#: builtin/bisect--helper.c
-msgid "replay the bisection process from the given file"
-msgstr "从给定文件é‡æ”¾äºŒåˆ†æŸ¥æ‰¾è¿›ç¨‹"
-
-#: builtin/bisect--helper.c
-msgid "skip some commits for checkout"
-msgstr "跳过è¦æ£€å‡ºçš„一些æ交"
-
-#: builtin/bisect--helper.c
-msgid "visualize the bisection"
-msgstr "å¯è§†åŒ–二分查找过程"
+msgid "bisect run failed: 'git bisect %s' exited with error code %d"
+msgstr "二分查找è¿è¡Œå¤±è´¥ï¼š'git bisect %s' 退出ç ä¸º %d"
-#: builtin/bisect--helper.c
-msgid "use <cmd>... to automatically bisect"
-msgstr "使用 <命令>... æ¥è‡ªåŠ¨äºŒåˆ†æŸ¥æ‰¾"
+#: builtin/bisect.c
+#, c-format
+msgid "'%s' requires either no argument or a commit"
+msgstr "'%s' 无需å‚数或者需è¦ä¸€ä¸ªæ交"
-#: builtin/bisect--helper.c
-msgid "no log for BISECT_WRITE"
-msgstr "BISECT_WRITE 无日志"
+#: builtin/bisect.c
+#, c-format
+msgid "'%s' requires 0 or 1 argument"
+msgstr "'%s' 无需å‚数或者需è¦ä¸€ä¸ªå‚æ•°"
-#: builtin/bisect--helper.c
-msgid "--bisect-reset requires either no argument or a commit"
-msgstr "--bisect-reset 无需å‚数或者需è¦ä¸€ä¸ªæ交"
+#: builtin/bisect.c
+#, c-format
+msgid "'%s' requires 0 arguments"
+msgstr "'%s' 无需å‚æ•°"
-#: builtin/bisect--helper.c
-msgid "--bisect-terms requires 0 or 1 argument"
-msgstr "--bisect-terms éœ€è¦ 0 或 1 个å‚æ•°"
+#: builtin/bisect.c
+msgid "no logfile given"
+msgstr "未æ供日志文件"
-#: builtin/bisect--helper.c
-msgid "--bisect-next requires 0 arguments"
-msgstr "--bisect-next éœ€è¦ 0 个å‚æ•°"
+#: builtin/bisect.c
+#, c-format
+msgid "'%s' failed: no command provided."
+msgstr "'%s' è¿è¡Œå¤±è´¥ï¼šæ²¡æœ‰æ供命令。"
-#: builtin/bisect--helper.c
-msgid "--bisect-log requires 0 arguments"
-msgstr "--bisect-log éœ€è¦ 0 个å‚æ•°"
+#: builtin/bisect.c
+msgid "need a command"
+msgstr "需è¦ä¸€ä¸ªå‘½ä»¤"
-#: builtin/bisect--helper.c
-msgid "no logfile given"
-msgstr "未æ供日志文件"
+#: builtin/bisect.c builtin/cat-file.c
+#, c-format
+msgid "unknown command: '%s'"
+msgstr "未知命令:'%s'"
#: builtin/blame.c
msgid "git blame [<options>] [<rev-opts>] [<rev>] [--] <file>"
msgstr "git blame [<选项>] [<版本选项>] [<版本>] [--] <文件>"
#: builtin/blame.c
+msgid "git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>"
+msgstr "git annotate [<选项>] [<版本选项>] [<版本>] [--] <文件>"
+
+#: builtin/blame.c
msgid "<rev-opts> are documented in git-rev-list(1)"
msgstr "<版本选项> 的文档记录在 git-rev-list(1) 中"
@@ -3487,10 +3485,6 @@ msgid "cannot use -a with -d"
msgstr "ä¸èƒ½å°† -a å’Œ -d åŒæ—¶ä½¿ç”¨"
#: builtin/branch.c
-msgid "Couldn't look up commit object for HEAD"
-msgstr "无法查询 HEAD 指å‘çš„æ交对象"
-
-#: builtin/branch.c
#, c-format
msgid "Cannot delete branch '%s' checked out at '%s'"
msgstr "无法删除检出于 '%2$s' 的分支 '%1$s'。"
@@ -3539,17 +3533,19 @@ msgid "Branch %s is being bisected at %s"
msgstr "分支 %s 正被二分查找于 %s"
#: builtin/branch.c
-msgid "cannot copy the current branch while not on any."
-msgstr "无法拷è´å½“å‰åˆ†æ”¯å› ä¸ºä¸å¤„于任何分支上。"
+#, c-format
+msgid "Invalid branch name: '%s'"
+msgstr "无效的分支å:'%s'"
#: builtin/branch.c
-msgid "cannot rename the current branch while not on any."
-msgstr "无法é‡å‘½å当å‰åˆ†æ”¯å› ä¸ºä¸å¤„于任何分支上。"
+#, c-format
+msgid "No commit on branch '%s' yet."
+msgstr "分支 '%s' å°šæ— æ交。"
#: builtin/branch.c
#, c-format
-msgid "Invalid branch name: '%s'"
-msgstr "无效的分支å:'%s'"
+msgid "No branch named '%s'."
+msgstr "没有分支 '%s'。"
#: builtin/branch.c
msgid "Branch rename failed"
@@ -3758,14 +3754,12 @@ msgid "cannot edit description of more than one branch"
msgstr "ä¸èƒ½ä¸ºä¸€ä¸ªä»¥ä¸Šçš„分支编辑æè¿°"
#: builtin/branch.c
-#, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "分支 '%s' å°šæ— æ交。"
+msgid "cannot copy the current branch while not on any."
+msgstr "ä¸å¤„于任何分支上,无法拷è´å½“å‰åˆ†æ”¯ã€‚"
#: builtin/branch.c
-#, c-format
-msgid "No branch named '%s'."
-msgstr "没有分支 '%s'。"
+msgid "cannot rename the current branch while not on any."
+msgstr "ä¸å¤„于任何分支上,无法é‡å‘½å当å‰åˆ†æ”¯ã€‚"
#: builtin/branch.c
msgid "too many branches for a copy operation"
@@ -3846,11 +3840,11 @@ msgstr "ä¸æ˜¯åœ¨ git 仓库中执行 - 没有å¯æ˜¾ç¤ºçš„é’©å­\n"
#: builtin/bugreport.c
msgid ""
-"git bugreport [-o|--output-directory <file>] [-s|--suffix <format>] [--"
-"diagnose[=<mode>]"
+"git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--diagnose[=<mode>]]"
msgstr ""
-"git bugreport [-o|--output-directory <文件>] [-s|--suffix <æ ¼å¼>] [--"
-"diagnose[=<模å¼>]"
+"git bugreport [-o|--output-directory <文件>] [(-s|--suffix) <æ ¼å¼>]\n"
+" [--diagnose[=<模å¼>]"
#: builtin/bugreport.c
msgid ""
@@ -3933,20 +3927,30 @@ msgid "Created new report at '%s'.\n"
msgstr "在 '%s' 创建了新报告。\n"
#: builtin/bundle.c
-msgid "git bundle create [<options>] <file> <git-rev-list args>"
-msgstr "git bundle create [<选项>] <文件> <git-rev-list å‚æ•°>"
+msgid ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<version>] <file> <git-rev-list-args>"
+msgstr ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<版本>] <文件> <git-rev-list-å‚æ•°>"
#: builtin/bundle.c
-msgid "git bundle verify [<options>] <file>"
-msgstr "git bundle verify [<选项>] <文件>"
+msgid "git bundle verify [-q | --quiet] <file>"
+msgstr "git bundle verify [-q | --quiet] <文件>"
#: builtin/bundle.c
msgid "git bundle list-heads <file> [<refname>...]"
msgstr "git bundle list-heads <文件> [<引用å>...]"
#: builtin/bundle.c
-msgid "git bundle unbundle <file> [<refname>...]"
-msgstr "git bundle unbundle <文件> [<引用å>...]"
+msgid "git bundle unbundle [--progress] <file> [<refname>...]"
+msgstr "git bundle unbundle [--progress] <文件> [<引用å>...]"
+
+#: builtin/bundle.c
+msgid "need a <file> argument"
+msgstr "需è¦ä¸€ä¸ª <文件> å‚æ•°"
#: builtin/bundle.c builtin/pack-objects.c
msgid "do not show progress meter"
@@ -4018,11 +4022,6 @@ msgid "%s takes no arguments"
msgstr "%s ä¸éœ€è¦å‚æ•°"
#: builtin/cat-file.c
-#, c-format
-msgid "unknown command: '%s'"
-msgstr "未知命令:'%s'"
-
-#: builtin/cat-file.c
msgid "only one batch option may be specified"
msgstr "åªèƒ½æŒ‡å®šä¸€ä¸ªæ‰¹å¤„ç†é€‰é¡¹"
@@ -4043,12 +4042,12 @@ msgid ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgstr ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
#: builtin/cat-file.c
msgid ""
@@ -4185,23 +4184,23 @@ msgstr "'%s' éœ€è¦ <版本>"
msgid "<object> required with '-%c'"
msgstr "'-%c' éœ€è¦ <对象>"
-#: builtin/cat-file.c builtin/notes.c builtin/prune-packed.c
-#: builtin/receive-pack.c builtin/tag.c
-msgid "too many arguments"
-msgstr "太多å‚æ•°"
-
#: builtin/cat-file.c
#, c-format
msgid "only two arguments allowed in <type> <object> mode, not %d"
msgstr "<类型> <对象> 模å¼åªå…许两个å‚数,而ä¸æ˜¯ %d 个"
#: builtin/check-attr.c
-msgid "git check-attr [-a | --all | <attr>...] [--] <pathname>..."
-msgstr "git check-attr [-a | --all | <属性>...] [--] <路径å>..."
+msgid ""
+"git check-attr [--source <tree-ish>] [-a | --all | <attr>...] [--] "
+"<pathname>..."
+msgstr ""
+"git check-attr [--source <树对象>] [-a | --all | <属性>...] [--] <路径å>..."
#: builtin/check-attr.c
-msgid "git check-attr --stdin [-z] [-a | --all | <attr>...]"
-msgstr "git check-attr --stdin [-z] [-a | --all | <属性>...]"
+msgid ""
+"git check-attr --stdin [-z] [--source <tree-ish>] [-a | --all | <attr>...]"
+msgstr ""
+"git check-attr --stdin [-z] [--source <树对象>] [-a | --all | <属性>...]"
#: builtin/check-attr.c
msgid "report all attributes set on file"
@@ -4219,6 +4218,14 @@ msgstr "从标准输入读出文件å"
msgid "terminate input and output records by a NUL character"
msgstr "输入和输出的记录使用 NUL 字符终结"
+#: builtin/check-attr.c
+msgid "<tree-ish>"
+msgstr "<树对象>"
+
+#: builtin/check-attr.c
+msgid "which tree-ish to check attributes at"
+msgstr "è¦ç”¨å“ªä¸€ä¸ªæ ‘对象æ¥æ£€æŸ¥å±žæ€§"
+
#: builtin/check-ignore.c builtin/checkout.c builtin/gc.c builtin/worktree.c
msgid "suppress progress reporting"
msgstr "ä¸æ˜¾ç¤ºè¿›åº¦æŠ¥å‘Š"
@@ -4847,9 +4854,10 @@ msgstr "使用å åŠ æ¨¡å¼"
#: builtin/clean.c
msgid ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] "
+"[<pathspec>...]"
msgstr ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <模å¼>] [-x | -X] [--] <路径>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <模å¼>] [-x | -X] [--] <路径规格>..."
#: builtin/clean.c
#, c-format
@@ -4889,7 +4897,7 @@ msgstr "æ‹’ç»åˆ é™¤å½“å‰å·¥ä½œç›®å½•\n"
msgid "Would refuse to remove current working directory\n"
msgstr "将拒ç»åˆ é™¤å½“å‰å·¥ä½œç›®å½•\n"
-#: builtin/clean.c git-add--interactive.perl
+#: builtin/clean.c
#, c-format
msgid ""
"Prompt help:\n"
@@ -4902,7 +4910,7 @@ msgstr ""
"foo - 通过唯一å‰ç¼€é€‰æ‹©ä¸€ä¸ªé€‰é¡¹\n"
" - (空)什么也ä¸é€‰æ‹©\n"
-#: builtin/clean.c git-add--interactive.perl
+#: builtin/clean.c
#, c-format
msgid ""
"Prompt help:\n"
@@ -4923,8 +4931,8 @@ msgstr ""
"* - 选择所有选项\n"
" - (空)结æŸé€‰æ‹©\n"
-#: builtin/clean.c git-add--interactive.perl
-#, c-format, perl-format
+#: builtin/clean.c
+#, c-format
msgid "Huh (%s)?\n"
msgstr "嗯(%s)?\n"
@@ -5113,10 +5121,6 @@ msgstr "深度"
msgid "create a shallow clone of that depth"
msgstr "创建一个指定深度的浅克隆"
-#: builtin/clone.c builtin/fetch.c builtin/pack-objects.c builtin/pull.c
-msgid "time"
-msgstr "时间"
-
#: builtin/clone.c
msgid "create a shallow clone since a specific time"
msgstr "从一个特定时间创建一个浅克隆"
@@ -5215,6 +5219,11 @@ msgstr "%s 存在且ä¸æ˜¯ä¸€ä¸ªç›®å½•"
msgid "failed to start iterator over '%s'"
msgstr "无法在 '%s' 上å¯åŠ¨è¿­ä»£å™¨"
+#: builtin/clone.c
+#, c-format
+msgid "symlink '%s' exists, refusing to clone with --local"
+msgstr "符å·é“¾æŽ¥ '%s' 存在,拒ç»ç”¨ --local 克隆"
+
#: builtin/clone.c compat/precompose_utf8.c
#, c-format
msgid "failed to unlink '%s'"
@@ -5297,11 +5306,6 @@ msgid "You must specify a repository to clone."
msgstr "您必须指定一个仓库æ¥å…‹éš†ã€‚"
#: builtin/clone.c
-#, c-format
-msgid "options '%s' and '%s %s' cannot be used together"
-msgstr "选项 '%s' å’Œ '%s %s' ä¸èƒ½åŒæ—¶ä½¿ç”¨"
-
-#: builtin/clone.c
msgid ""
"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
"exclude"
@@ -5405,6 +5409,10 @@ msgid "failed to fetch objects from bundle URI '%s'"
msgstr "无法从归档包 URI '%s' 获å–对象"
#: builtin/clone.c
+msgid "failed to fetch advertised bundles"
+msgstr "无法获å–公布的归档包"
+
+#: builtin/clone.c
msgid "remote transport reported error"
msgstr "远程传输报告错误"
@@ -5451,22 +5459,27 @@ msgstr "--command 必须是第一个å‚æ•°"
#: builtin/commit-graph.c
msgid ""
-"git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"
+"git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]"
msgstr ""
-"git commit-graph verify [--object-dir <对象目录>] [--shallow] [--"
-"[no-]progress]"
+"git commit-graph verify [--object-dir <目录>] [--shallow] [--[no-]progress]"
#: builtin/commit-graph.c
msgid ""
-"git commit-graph write [--object-dir <objdir>] [--append] [--"
-"split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] <split options>"
-msgstr ""
-"git commit-graph write [--object-dir <对象目录>] [--append] [--split[=<策略"
-">]] [--reachable|--stdin-packs|--stdin-commits] [--changed-paths] [--"
-"[no-]max-new-filters <n>] [--[no-]progress] <切分选项>"
-
-#: builtin/commit-graph.c builtin/fetch.c builtin/log.c
+"git commit-graph write [--object-dir <dir>] [--append]\n"
+" [--split[=<strategy>]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <split options>"
+msgstr ""
+"git commit-graph write [--object-dir <目录>] [--append]\n"
+" [--split[=<ç­–ç•¥>]] [--reachable | --stdin-packs | --"
+"stdin-commits] \n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <切分选项>"
+
+#: builtin/commit-graph.c builtin/fetch.c builtin/log.c builtin/repack.c
msgid "dir"
msgstr "目录"
@@ -5552,12 +5565,16 @@ msgid "Collecting commits from input"
msgstr "正从标准输入收集æ交"
#: builtin/commit-tree.c
+msgid "git commit-tree <tree> [(-p <parent>)...]"
+msgstr "git commit-tree <æ ‘> [(-p <父æ交>)...]"
+
+#: builtin/commit-tree.c
msgid ""
-"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...] [(-F "
-"<file>)...] <tree>"
+"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n"
+" [(-F <file>)...] <tree>"
msgstr ""
-"git commit-tree [(-p <父æ交>)...] [-S[<keyid>]] [(-m <消æ¯>)...] [(-F <文件"
-">)...] <æ ‘>"
+"git commit-tree [(-p <父æ交>)...] [-S[<ç§é’¥ ID>]] [(-m <消æ¯>)...]\n"
+" [(-F <文件>)...] <树>"
#: builtin/commit-tree.c
#, c-format
@@ -5614,12 +5631,30 @@ msgid "git commit-tree: failed to read"
msgstr "git commit-tree:无法读å–"
#: builtin/commit.c
-msgid "git commit [<options>] [--] <pathspec>..."
-msgstr "git commit [<选项>] [--] <路径规格>..."
+msgid ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|"
+"reword):]<commit>)]\n"
+" [-F <file> | -m <msg>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n"
+" [--date=<date>] [--cleanup=<mode>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<模å¼>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <æ交> | --fixup [(amend|"
+"reword):]<æ交>)]\n"
+" [-F <文件> | -m <消æ¯>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<作者>]\n"
+" [--date=<日期>] [--cleanup=<模å¼>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<文件> [--pathspec-file-nul]]\n"
+" [(--trailer <é”®>[(=|:)<值>])...] [-S[<ç§é’¥ ID>]]\n"
+" [--] [<路径规格>...]"
#: builtin/commit.c
-msgid "git status [<options>] [--] <pathspec>..."
-msgstr "git status [<选项>] [--] <路径规格>..."
+msgid "git status [<options>] [--] [<pathspec>...]"
+msgstr "git status [<选项>] [--] [<路径规格>...]"
#: builtin/commit.c
msgid ""
@@ -5746,7 +5781,7 @@ msgid ""
"in the current commit message"
msgstr "无法选择一个未被当å‰æ交说明使用的注释字符"
-#: builtin/commit.c
+#: builtin/commit.c builtin/merge-tree.c
#, c-format
msgid "could not lookup commit %s"
msgstr "ä¸èƒ½æŸ¥è¯¢æ交 %s"
@@ -6048,7 +6083,7 @@ msgstr "日期"
msgid "override date for commit"
msgstr "æ交时覆盖日期"
-#: builtin/commit.c parse-options.h ref-filter.h
+#: builtin/commit.c builtin/merge-tree.c parse-options.h ref-filter.h
msgid "commit"
msgstr "æ交"
@@ -6199,7 +6234,7 @@ msgstr ""
msgid "git config [<options>]"
msgstr "git config [<选项>]"
-#: builtin/config.c builtin/env--helper.c
+#: builtin/config.c
#, c-format
msgid "unrecognized --type argument, %s"
msgstr "未能识别的 --type å‚数,%s"
@@ -6228,7 +6263,7 @@ msgstr "使用仓库级é…置文件"
msgid "use per-worktree config file"
msgstr "使用工作区级别的é…置文件"
-#: builtin/config.c
+#: builtin/config.c builtin/gc.c
msgid "use given config file"
msgstr "使用指定的é…置文件"
@@ -6308,11 +6343,11 @@ msgstr "获得颜色设置:é…ç½® [stdout-is-tty]"
msgid "Type"
msgstr "类型"
-#: builtin/config.c builtin/env--helper.c builtin/hash-object.c
+#: builtin/config.c builtin/hash-object.c
msgid "type"
msgstr "类型"
-#: builtin/config.c builtin/env--helper.c
+#: builtin/config.c
msgid "value is given this type"
msgstr "å–值为该类型"
@@ -6364,7 +6399,7 @@ msgstr "显示é…置的æ¥æºï¼ˆæ–‡ä»¶ã€æ ‡å‡†è¾“å…¥ã€æ•°æ®å¯¹è±¡ï¼Œæˆ–命令
msgid "show scope of config (worktree, local, global, system, command)"
msgstr "显示é…置的作用域(工作区ã€æœ¬åœ°ã€å…¨å±€ã€ç³»ç»Ÿã€å‘½ä»¤ï¼‰"
-#: builtin/config.c builtin/env--helper.c
+#: builtin/config.c
msgid "value"
msgstr "å–值"
@@ -6449,7 +6484,7 @@ msgstr "--blob åªèƒ½åœ¨ git 仓库内使用"
msgid "--worktree can only be used inside a git repository"
msgstr "--worktree åªèƒ½åœ¨ git 仓库内使用"
-#: builtin/config.c
+#: builtin/config.c builtin/gc.c
msgid "$HOME not set"
msgstr "$HOME 未设置"
@@ -6559,12 +6594,20 @@ msgid "unable to get credential storage lock in %d ms"
msgstr "无法在 %d ms 获得凭è¯å­˜å‚¨é”"
#: builtin/describe.c
-msgid "git describe [<options>] [<commit-ish>...]"
-msgstr "git describe [<选项>] [<æ交å·>...]"
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<æ交å·>...]"
+
+#: builtin/describe.c
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<标记>]"
#: builtin/describe.c
-msgid "git describe [<options>] --dirty"
-msgstr "git describe [<选项>] --dirty"
+msgid "git describe <blob>"
+msgstr "git describe <æ•°æ®å¯¹è±¡>"
#: builtin/describe.c
msgid "head"
@@ -6717,11 +6760,11 @@ msgstr "选项 '%s' å’Œæ交å·ä¸èƒ½åŒæ—¶ä½¿ç”¨"
#: builtin/diagnose.c
msgid ""
-"git diagnose [-o|--output-directory <path>] [-s|--suffix <format>] [--"
-"mode=<mode>]"
+"git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--mode=<mode>]"
msgstr ""
-"git diagnose [-o|--output-directory <文件>] [-s|--suffix <æ ¼å¼>] [--mode=<模"
-"å¼>]"
+"git diagnose [(-o | --output-directory) <路径>] [(-s | --suffix) <æ ¼å¼>]\n"
+" [--mode=<模å¼>]"
#: builtin/diagnose.c
msgid "specify a destination for the diagnostics archive"
@@ -6745,6 +6788,10 @@ msgid "'%s': not a regular file or symlink"
msgstr "'%s':ä¸æ˜¯ä¸€ä¸ªæ­£è§„文件或符å·é“¾æŽ¥"
#: builtin/diff.c
+msgid "no merge given, only parents."
+msgstr "没有给出åˆå¹¶ï¼Œåªæœ‰çˆ¶æ交。"
+
+#: builtin/diff.c
#, c-format
msgid "invalid option: %s"
msgstr "无效选项:%s"
@@ -6887,30 +6934,6 @@ msgstr "没有为 --tool=<工具> å‚æ•°æä¾› <工具>"
msgid "no <cmd> given for --extcmd=<cmd>"
msgstr "没有为 --extcmd=<命令> å‚æ•°æä¾› <命令>"
-#: builtin/env--helper.c
-msgid "git env--helper --type=[bool|ulong] <options> <env-var>"
-msgstr "git env--helper --type=[bool|ulong] <选项> <环境å˜é‡>"
-
-#: builtin/env--helper.c
-msgid "default for git_env_*(...) to fall back on"
-msgstr "git_env_*(...) 的默认值"
-
-#: builtin/env--helper.c
-msgid "be quiet only use git_env_*() value as exit code"
-msgstr "安é™æ¨¡å¼ï¼Œåªä½¿ç”¨ git_env_*() 的值作为退出ç "
-
-#: builtin/env--helper.c
-#, c-format
-msgid "option `--default' expects a boolean value with `--type=bool`, not `%s`"
-msgstr "选项 `--default' å’Œ `--type=bool` 期望一个布尔值,ä¸æ˜¯ `%s`"
-
-#: builtin/env--helper.c
-#, c-format
-msgid ""
-"option `--default' expects an unsigned long value with `--type=ulong`, not "
-"`%s`"
-msgstr "选项 `--default' å’Œ `--type=ulong` 期望一个无符å·é•¿æ•´åž‹ï¼Œä¸æ˜¯ `%s`"
-
#: builtin/fast-export.c
msgid "git fast-export [<rev-list-opts>]"
msgstr "git fast-export [<rev-list 选项>]"
@@ -7405,6 +7428,11 @@ msgid "--unshallow on a complete repository does not make sense"
msgstr "对于一个完整的仓库,å‚æ•° --unshallow 没有æ„义"
#: builtin/fetch.c
+#, c-format
+msgid "failed to fetch bundles from '%s'"
+msgstr "无法从 '%s' 获å–归档包"
+
+#: builtin/fetch.c
msgid "fetch --all does not take a repository argument"
msgstr "fetch --all ä¸èƒ½å¸¦ä¸€ä¸ªä»“库å‚æ•°"
@@ -7533,8 +7561,8 @@ msgid "print only refs which don't contain the commit"
msgstr "åªæ‰“å°ä¸åŒ…å«è¯¥æ交的引用"
#: builtin/for-each-repo.c
-msgid "git for-each-repo --config=<config> <command-args>"
-msgstr "git for-each-repo --config=<é…ç½®> <命令å‚æ•°>"
+msgid "git for-each-repo --config=<config> [--] <arguments>"
+msgstr "git for-each-repo --config=<é…ç½®> [--] <命令å‚æ•°>"
#: builtin/for-each-repo.c
msgid "config"
@@ -7751,8 +7779,16 @@ msgid "%s: invalid sha1 pointer in resolve-undo"
msgstr "%s:resolve-undo 中无效的 sha1 指针"
#: builtin/fsck.c
-msgid "git fsck [<options>] [<object>...]"
-msgstr "git fsck [<选项>] [<对象>...]"
+msgid ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<object>...]"
+msgstr ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<对象>...]"
#: builtin/fsck.c
msgid "show unreachable objects"
@@ -7825,14 +7861,6 @@ msgid "git fsmonitor--daemon run [<options>]"
msgstr "git fsmonitor--daemon run [<选项>]"
#: builtin/fsmonitor--daemon.c
-msgid "git fsmonitor--daemon stop"
-msgstr "git fsmonitor--daemon stop"
-
-#: builtin/fsmonitor--daemon.c
-msgid "git fsmonitor--daemon status"
-msgstr "git fsmonitor--daemon status"
-
-#: builtin/fsmonitor--daemon.c
#, c-format
msgid "value of '%s' out of range: %d"
msgstr "'%s' 的值超出范围:%d"
@@ -7932,7 +7960,7 @@ msgstr "等待守护进程å¯åŠ¨çš„最大秒数"
msgid "invalid 'ipc-threads' value (%d)"
msgstr "无效的 'ipc-threads' 值(%d)"
-#: builtin/fsmonitor--daemon.c
+#: builtin/fsmonitor--daemon.c t/helper/test-cache-tree.c
#, c-format
msgid "Unhandled subcommand '%s'"
msgstr "未处ç†çš„å­å‘½ä»¤ '%s'"
@@ -8132,8 +8160,23 @@ msgid "use at most one of --auto and --schedule=<frequency>"
msgstr "最多使用 --auto 和 --schedule=<频率> 其中之一"
#: builtin/gc.c
-msgid "failed to run 'git config'"
-msgstr "无法è¿è¡Œ 'git config'"
+#, c-format
+msgid "unable to add '%s' value of '%s'"
+msgstr "无法添加 '%2$s' 的 '%1$s' 值"
+
+#: builtin/gc.c
+msgid "return success even if repository was not registered"
+msgstr "å³ä¾¿ä»“库éžæ³¨å†Œä»ç„¶è¿”回æˆåŠŸ"
+
+#: builtin/gc.c
+#, c-format
+msgid "unable to unset '%s' value of '%s'"
+msgstr "无法å–消设置 '%2$s' çš„ '%1$s' 值"
+
+#: builtin/gc.c
+#, c-format
+msgid "repository '%s' is not registered"
+msgstr "仓库 '%s' 未注册"
#: builtin/gc.c
#, c-format
@@ -8509,11 +8552,15 @@ msgstr "åŒæ—¶ç»™å‡ºäº† --cached 和树对象"
#: builtin/hash-object.c
msgid ""
-"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters] [--stdin] "
-"[--] <file>..."
+"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]\n"
+" [--stdin [--literally]] [--] <file>..."
msgstr ""
-"git hash-object [-t <类型>] [-w] [--path=<文件> | --no-filters] [--stdin] "
-"[--] <文件>..."
+"git hash-object [-t <类型>] [-w] [--path=<文件> | --no-filters]\n"
+" [--stdin [--literally]] [--] <文件>..."
+
+#: builtin/hash-object.c
+msgid "git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]"
+msgstr "git hash-object [-t <类型>] [-w] --stdin-paths [--no-filters]"
#: builtin/hash-object.c
msgid "object type"
@@ -8676,13 +8723,21 @@ msgid "'git help config' for more information"
msgstr "'git help config' 获å–更多信æ¯"
#: builtin/hook.c
-msgid "git hook run [--ignore-missing] <hook-name> [-- <hook-args>]"
-msgstr "git hook run [--ignore-missing] <é’©å­å称> [-- <é’©å­å‚æ•°>]"
+msgid ""
+"git hook run [--ignore-missing] [--to-stdin=<path>] <hook-name> [-- <hook-"
+"args>]"
+msgstr ""
+"git hook run [--ignore-missing] [--to-stdin=<路径>] <é’©å­å称> [-- <é’©å­å‚æ•°"
+">]"
#: builtin/hook.c
msgid "silently ignore missing requested <hook-name>"
msgstr "é™é»˜åœ°å¿½ç•¥ç¼ºå¤±çš„ <é’©å­å称>"
+#: builtin/hook.c
+msgid "file to read into hooks' stdin"
+msgstr "读å–至钩å­æ ‡å‡†è¾“入的文件"
+
#: builtin/index-pack.c
#, c-format
msgid "object type mismatch at %s"
@@ -9047,11 +9102,15 @@ msgstr "å·²åˆå§‹åŒ–空的 Git 仓库于 %s%s\n"
#: builtin/init-db.c
msgid ""
-"git init [-q | --quiet] [--bare] [--template=<template-directory>] [--"
-"shared[=<permissions>]] [<directory>]"
+"git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
+" [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+" [-b <branch-name> | --initial-branch=<branch-name>]\n"
+" [--shared[=<permissions>]] [<directory>]"
msgstr ""
-"git init [-q | --quiet] [--bare] [--template=<模æ¿ç›®å½•>] [--shared[=<æƒé™>]] "
-"[<目录>]"
+"git init [-q | --quiet] [--bare] [--template=<模æ¿ç›®å½•>]\n"
+" [--separate-git-dir <git 目录>] [--object-format=<æ ¼å¼>]\n"
+" [-b <分支å> | --initial-branch=<分支å>]\n"
+" [--shared[=<æƒé™>]] [<目录>]"
#: builtin/init-db.c
msgid "permissions"
@@ -9101,11 +9160,13 @@ msgstr "--separate-git-dir ä¸èƒ½ç”¨äºŽçº¯ä»“库"
#: builtin/interpret-trailers.c
msgid ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<token>[(=|:)<value>])...] [<file>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <token>[(=|:)<value>])...]\n"
+" [--parse] [<file>...]"
msgstr ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer <键>[(=|:)<值"
-">])...] [<文件>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <键>[(=|:)<值>])...]\n"
+" [--parse] [<文件>...]"
#: builtin/interpret-trailers.c
msgid "edit files in place"
@@ -9724,12 +9785,12 @@ msgstr ""
#: builtin/ls-remote.c
msgid ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<repository> [<refs>...]]"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n"
+" [--symref] [<repository> [<patterns>...]]"
msgstr ""
-"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<仓库> [<引用>...]]"
+"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<å¯æ‰§è¡Œæ–‡ä»¶>]\n"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<é”®>]\n"
+" [--symref] [<仓库> [<模å¼>...]]"
#: builtin/ls-remote.c
msgid "do not print remote URL"
@@ -9898,14 +9959,14 @@ msgid "git merge-base [-a | --all] --octopus <commit>..."
msgstr "git merge-base [-a | --all] --octopus <æ交>..."
#: builtin/merge-base.c
-msgid "git merge-base --independent <commit>..."
-msgstr "git merge-base --independent <æ交>..."
-
-#: builtin/merge-base.c
msgid "git merge-base --is-ancestor <commit> <commit>"
msgstr "git merge-base --is-ancestor <æ交> <æ交>"
#: builtin/merge-base.c
+msgid "git merge-base --independent <commit>..."
+msgstr "git merge-base --independent <æ交>..."
+
+#: builtin/merge-base.c
msgid "git merge-base --fork-point <ref> [<commit>]"
msgstr "git merge-base --fork-point <引用> [<æ交>]"
@@ -10045,9 +10106,31 @@ msgid "allow merging unrelated histories"
msgstr "å…许åˆå¹¶ä¸ç›¸å…³çš„历å²"
#: builtin/merge-tree.c
+msgid "perform multiple merges, one per line of input"
+msgstr "实施多个åˆå¹¶ï¼Œæ¯è¾“入行一个"
+
+#: builtin/merge-tree.c
+msgid "specify a merge-base for the merge"
+msgstr "指定用于åˆå¹¶çš„åˆå¹¶åŸºçº¿"
+
+#: builtin/merge-tree.c
msgid "--trivial-merge is incompatible with all other options"
msgstr "--trivial-merge 与其他所有选项ä¸å…¼å®¹"
+#: builtin/merge-tree.c
+msgid "--merge-base is incompatible with --stdin"
+msgstr "--merge-base 与 --stdin ä¸å…¼å®¹"
+
+#: builtin/merge-tree.c builtin/notes.c
+#, c-format
+msgid "malformed input line: '%s'."
+msgstr "æ ¼å¼é”™è¯¯çš„输入行:'%s'。"
+
+#: builtin/merge-tree.c
+#, c-format
+msgid "merging cannot continue; got unclean result of %d"
+msgstr "åˆå¹¶æ— æ³•ç»§ç»­ï¼›å¾—到ä¸å¹²å‡€çš„结果 %d"
+
#: builtin/merge.c
msgid "git merge [<options>] [<commit>...]"
msgstr "git merge [<选项>] [<æ交>...]"
@@ -10620,7 +10703,7 @@ msgstr "%s,æº=%s,目标=%s"
msgid "Renaming %s to %s\n"
msgstr "é‡å‘½å %s 至 %s\n"
-#: builtin/mv.c builtin/remote.c builtin/repack.c
+#: builtin/mv.c builtin/remote.c
#, c-format
msgid "renaming '%s' failed"
msgstr "é‡å‘½å '%s' 失败"
@@ -10823,11 +10906,6 @@ msgstr "ä¸èƒ½ä»Žéžæ•°æ®å¯¹è±¡ '%s' 中读å–注解数æ®ã€‚"
#: builtin/notes.c
#, c-format
-msgid "malformed input line: '%s'."
-msgstr "æ ¼å¼é”™è¯¯çš„输入行:'%s'。"
-
-#: builtin/notes.c
-#, c-format
msgid "failed to copy notes from '%s' to '%s'"
msgstr "无法把注解从 '%s' æ‹·è´åˆ° '%s'"
@@ -11058,14 +11136,13 @@ msgid "unknown subcommand: `%s'"
msgstr "未知å­å‘½ä»¤ï¼š`%s'"
#: builtin/pack-objects.c
-msgid ""
-"git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"
-msgstr "git pack-objects --stdout [<选项>...] [< <引用列表> | < <对象列表>]"
+msgid "git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"
+msgstr "git pack-objects --stdout [<选项>] [< <引用列表> | < <对象列表>]"
#: builtin/pack-objects.c
msgid ""
-"git pack-objects [<options>...] <base-name> [< <ref-list> | < <object-list>]"
-msgstr "git pack-objects [<选项>...] <å‰ç¼€å称> [< <引用列表> | < <对象列表>]"
+"git pack-objects [<options>] <base-name> [< <ref-list> | < <object-list>]"
+msgstr "git pack-objects [<选项>] <å‰ç¼€å称> [< <引用列表> | < <对象列表>]"
#: builtin/pack-objects.c
#, c-format
@@ -11535,8 +11612,8 @@ msgstr ""
"使用它。 谢谢。\n"
#: builtin/pack-refs.c
-msgid "git pack-refs [<options>]"
-msgstr "git pack-refs [<选项>]"
+msgid "git pack-refs [--all] [--no-prune]"
+msgstr "git pack-refs [--all] [--no-prune]"
#: builtin/pack-refs.c
msgid "pack everything"
@@ -11546,6 +11623,22 @@ msgstr "打包一切"
msgid "prune loose refs (default)"
msgstr "清除æ¾æ•£çš„引用(默认)"
+#: builtin/patch-id.c
+msgid "git patch-id [--stable | --unstable | --verbatim]"
+msgstr "git patch-id [--stable | --unstable | --verbatim]"
+
+#: builtin/patch-id.c
+msgid "use the unstable patch-id algorithm"
+msgstr "使用ä¸ç¨³å®šçš„ patch-id 算法"
+
+#: builtin/patch-id.c
+msgid "use the stable patch-id algorithm"
+msgstr "使用稳定的 patch-id 算法"
+
+#: builtin/patch-id.c
+msgid "don't strip whitespace from the patch"
+msgstr "ä¸è¦ä»Žè¡¥ä¸ä¸­åˆ é™¤ç©ºç™½å­—符"
+
#: builtin/prune.c
msgid "git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]"
msgstr "git prune [-n] [-v] [--progress] [--expire <时间>] [--] [<head>...]"
@@ -11793,9 +11886,8 @@ msgstr ""
#: builtin/push.c
msgid ""
"\n"
-"To avoid automatically configuring upstream branches when their name\n"
-"doesn't match the local branch, see option 'simple' of branch."
-"autoSetupMerge\n"
+"To avoid automatically configuring an upstream branch when its name\n"
+"won't match the local branch, see option 'simple' of branch.autoSetupMerge\n"
"in 'git help config'.\n"
msgstr ""
"\n"
@@ -11953,6 +12045,13 @@ msgstr "推é€åˆ° %s\n"
msgid "failed to push some refs to '%s'"
msgstr "无法推é€ä¸€äº›å¼•ç”¨åˆ° '%s'"
+#: builtin/push.c
+msgid ""
+"recursing into submodule with push.recurseSubmodules=only; using on-demand "
+"instead"
+msgstr ""
+"在 push.recurseSubmodules=only 时递归进入å­æ¨¡ç»„ï¼›å–而代之使用 on-demand"
+
#: builtin/push.c builtin/send-pack.c submodule-config.c
#, c-format
msgid "invalid value for '%s'"
@@ -12034,7 +12133,7 @@ msgstr "需è¦è¿œç«¯æ”¯æŒåŽŸå­äº‹åŠ¡"
msgid "--delete doesn't make sense without any refs"
msgstr "--delete 未接任何引用没有æ„义"
-#: builtin/push.c
+#: builtin/push.c t/helper/test-bundle-uri.c
#, c-format
msgid "bad repository '%s'"
msgstr "å的仓库 '%s'"
@@ -12125,13 +12224,14 @@ msgstr "需è¦ä¸¤ä¸ªæ交范围"
#: builtin/read-tree.c
msgid ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>) "
-"[-u | -i]] [--no-sparse-checkout] [--index-output=<file>] (--empty | <tree-"
-"ish1> [<tree-ish2> [<tree-ish3>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
+"prefix=<prefix>)\n"
+" [-u | -i]] [--index-output=<file>] [--no-sparse-checkout]\n"
+" (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"
msgstr ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<å‰ç¼€>) [-"
-"u | -i]] [--no-sparse-checkout] [--index-output=<文件>] (--empty | <树对象一"
-"> [<树对象二> [<树对象三>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<å‰ç¼€>)\n"
+" [-u | -i]] [--index-output=<文件>] [--no-sparse-checkout]\n"
+" (--empty | <树对象一> [<树对象二> [<树对象三>]])"
#: builtin/read-tree.c
msgid "write resulting index to <file>"
@@ -12248,8 +12348,8 @@ msgstr "%s 需è¦åˆå¹¶åŽç«¯"
#: builtin/rebase.c
#, c-format
-msgid "could not get 'onto': '%s'"
-msgstr "æ— æ³•èŽ·å– 'onto':'%s'"
+msgid "invalid onto: '%s'"
+msgstr "无效新基线:'%s'"
#: builtin/rebase.c
#, c-format
@@ -12303,6 +12403,10 @@ msgid "could not switch to %s"
msgstr "无法切æ¢åˆ° %s"
#: builtin/rebase.c
+msgid "apply options and merge options cannot be used together"
+msgstr "应用选项和åˆå¹¶é€‰é¡¹ä¸èƒ½åŒæ—¶ä½¿ç”¨"
+
+#: builtin/rebase.c
#, c-format
msgid ""
"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and "
@@ -12581,8 +12685,16 @@ msgid "--strategy requires --merge or --interactive"
msgstr "--strategy éœ€è¦ --merge 或 --interactive"
#: builtin/rebase.c
-msgid "apply options and merge options cannot be used together"
-msgstr "应用选项和åˆå¹¶é€‰é¡¹ä¸èƒ½åŒæ—¶ä½¿ç”¨"
+msgid ""
+"apply options are incompatible with rebase.autosquash. Consider adding --no-"
+"autosquash"
+msgstr "应用的选项与 rebase.autosquash ä¸å…¼å®¹ã€‚考虑加上 --no-autosquash"
+
+#: builtin/rebase.c
+msgid ""
+"apply options are incompatible with rebase.updateRefs. Consider adding --no-"
+"update-refs"
+msgstr "应用的选项与 rebase.updateRefs ä¸å…¼å®¹ã€‚考虑加上 --no-update-refs"
#: builtin/rebase.c
#, c-format
@@ -12613,8 +12725,8 @@ msgid "No such ref: %s"
msgstr "没有这样的引用:%s"
#: builtin/rebase.c
-msgid "Could not resolve HEAD to a revision"
-msgstr "无法将 HEAD 解æžä¸ºä¸€ä¸ªç‰ˆæœ¬"
+msgid "Could not resolve HEAD to a commit"
+msgstr "ä¸èƒ½è§£æž HEAD 至一个æ交"
#: builtin/rebase.c
#, c-format
@@ -13084,7 +13196,7 @@ msgstr " 已跳过"
#: builtin/remote.c
msgid " stale (use 'git remote prune' to remove)"
-msgstr " 过时(使用 'git remote prune' æ¥ç§»é™¤ï¼‰"
+msgstr " 已过期(使用 'git remote prune' æ¥ç§»é™¤ï¼‰"
#: builtin/remote.c
msgid " ???"
@@ -13416,6 +13528,11 @@ msgid "could not close refs snapshot tempfile"
msgstr "ä¸èƒ½å…³é—­å¼•ç”¨å¿«ç…§ä¸´æ—¶æ–‡ä»¶"
#: builtin/repack.c
+#, c-format
+msgid "could not remove stale bitmap: %s"
+msgstr "无法删除过期的ä½å›¾ï¼š %s"
+
+#: builtin/repack.c
msgid "pack everything in a single pack"
msgstr "所有内容打包到一个包文件中"
@@ -13512,6 +13629,10 @@ msgid "write a multi-pack index of the resulting packs"
msgstr "写入结果包的多包索引"
#: builtin/repack.c
+msgid "pack prefix to store a pack containing pruned objects"
+msgstr "储存被清除的对象的包的å‰ç¼€"
+
+#: builtin/repack.c
msgid "cannot delete packs in a precious-objects repo"
msgstr "ä¸èƒ½åˆ é™¤çå“仓库中的打包文件"
@@ -13526,11 +13647,16 @@ msgstr "包å‰ç¼€ %s 没有以对象目录 .%s 开始"
#: builtin/repack.c
#, c-format
-msgid "missing required file: %s"
-msgstr "缺少需è¦çš„文件:%s"
+msgid "renaming pack to '%s' failed"
+msgstr "é‡å‘½å包至 '%s' 失败"
#: builtin/repack.c
#, c-format
+msgid "pack-objects did not write a '%s' file for pack %s-%s"
+msgstr "pack-objects 未为包 %2$s-%3$s 写入 '%1$s' 文件"
+
+#: builtin/repack.c sequencer.c
+#, c-format
msgid "could not unlink: %s"
msgstr "ä¸èƒ½åˆ é™¤ï¼š%s"
@@ -13771,8 +13897,10 @@ msgid "only one pattern can be given with -l"
msgstr "åªèƒ½ä¸º -l æ供一个模å¼"
#: builtin/rerere.c
-msgid "git rerere [clear | forget <path>... | status | remaining | diff | gc]"
-msgstr "git rerere [clear | forget <路径>... | status | remaining | diff | gc]"
+msgid ""
+"git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
+msgstr ""
+"git rerere [clear | forget <路径规格>... | diff | status | remaining | gc]"
#: builtin/rerere.c
msgid "register clean resolutions in index"
@@ -14027,6 +14155,18 @@ msgstr "--prefix 需è¦ä¸€ä¸ªå‚æ•°"
msgid "unknown mode for --abbrev-ref: %s"
msgstr "未知的 --abbrev-ref 模å¼ï¼š%s"
+#: builtin/rev-parse.c revision.c
+msgid "--exclude-hidden cannot be used together with --branches"
+msgstr "--exclude-hidden ä¸èƒ½ä¸Ž --branches 一起使用"
+
+#: builtin/rev-parse.c revision.c
+msgid "--exclude-hidden cannot be used together with --tags"
+msgstr "--exclude-hidden ä¸èƒ½ä¸Ž --tags 一起使用"
+
+#: builtin/rev-parse.c revision.c
+msgid "--exclude-hidden cannot be used together with --remotes"
+msgstr "--exclude-hidden ä¸èƒ½ä¸Ž --remotes 一起使用"
+
#: builtin/rev-parse.c setup.c
msgid "this operation must be run in a work tree"
msgstr "该æ“作必须在一个工作区中è¿è¡Œ"
@@ -14037,20 +14177,27 @@ msgid "unknown mode for --show-object-format: %s"
msgstr "未知的 --show-object-format 模å¼ï¼š%s"
#: builtin/revert.c
-msgid "git revert [<options>] <commit-ish>..."
-msgstr "git revert [<选项>] <æ交å·>..."
+msgid ""
+"git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] "
+"<commit>..."
+msgstr ""
+"git revert [--[no-]edit] [-n] [-m <父编å·>] [-s] [-S[<ç§é’¥ ID>]] <æ交>..."
#: builtin/revert.c
-msgid "git revert <subcommand>"
-msgstr "git revert <å­å‘½ä»¤>"
+msgid "git revert (--continue | --skip | --abort | --quit)"
+msgstr "git revert (--continue | --skip | --abort | --quit)"
#: builtin/revert.c
-msgid "git cherry-pick [<options>] <commit-ish>..."
-msgstr "git cherry-pick [<选项>] <æ交å·>..."
+msgid ""
+"git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n"
+" [-S[<keyid>]] <commit>..."
+msgstr ""
+"git cherry-pick [--edit] [-n] [-m <父编å·>] [-s] [-x] [--ff]\n"
+" [-S[<ç§é’¥ ID>]] <æ交>..."
#: builtin/revert.c
-msgid "git cherry-pick <subcommand>"
-msgstr "git cherry-pick <å­å‘½ä»¤>"
+msgid "git cherry-pick (--continue | --skip | --abort | --quit)"
+msgstr "git cherry-pick (--continue | --skip | --abort | --quit)"
#: builtin/revert.c
#, c-format
@@ -14131,8 +14278,14 @@ msgid "cherry-pick failed"
msgstr "拣选失败"
#: builtin/rm.c
-msgid "git rm [<options>] [--] <file>..."
-msgstr "git rm [<选项>] [--] <文件>..."
+msgid ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<文件> [--pathspec-file-nul]]\n"
+" [--] [<路径规格>...]"
#: builtin/rm.c
msgid ""
@@ -14215,11 +14368,13 @@ msgid ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<host>:]<directory> (--all | <ref>...)"
msgstr ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<主机>:]<目录> (--all | <引用>...)"
#: builtin/send-pack.c
@@ -14251,8 +14406,9 @@ msgid "using multiple --group options with stdin is not supported"
msgstr "ä¸æ”¯æŒå’Œæ ‡å‡†è¾“入一起使用多个 --group 选项"
#: builtin/shortlog.c
-msgid "using --group=trailer with stdin is not supported"
-msgstr "ä¸æ”¯æŒå’Œæ ‡å‡†è¾“入一起使用 --group=trailer"
+#, c-format
+msgid "using %s with stdin is not supported"
+msgstr "ä¸æ”¯æŒå¯¹ %s 使用标准输入"
#: builtin/shortlog.c
#, c-format
@@ -14300,12 +14456,14 @@ msgid ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<when>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<rev> | <glob>)...]"
msgstr ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<何时>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<版本> | <通é…符>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<版本> | <通é…符>)...]"
#: builtin/show-branch.c
msgid "git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]"
@@ -14434,11 +14592,13 @@ msgstr "未知的哈希算法"
#: builtin/show-ref.c
msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<pattern>...]"
msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<模å¼>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<模å¼>...]"
#: builtin/show-ref.c
msgid "git show-ref --exclude-existing[=<pattern>]"
@@ -14477,8 +14637,10 @@ msgid "show refs from stdin that aren't in local repository"
msgstr "显示从标准输入中读入的ä¸åœ¨æœ¬åœ°ä»“库中的引用"
#: builtin/sparse-checkout.c
-msgid "git sparse-checkout (init|list|set|add|reapply|disable) <options>"
-msgstr "git sparse-checkout (init|list|set|add|reapply|disable) <选项>"
+msgid ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<options>]"
+msgstr ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<选项>]"
#: builtin/sparse-checkout.c
msgid "this worktree is not sparse"
@@ -14619,78 +14781,65 @@ msgid "error while refreshing working directory"
msgstr "刷新工作目录时出错"
#: builtin/stash.c
-msgid "git stash list [<options>]"
-msgstr "git stash list [<选项>]"
+msgid "git stash list [<log-options>]"
+msgstr "git stash list [<日志选项>]"
#: builtin/stash.c
-msgid "git stash show [<options>] [<stash>]"
-msgstr "git stash show [<选项>] [<stash>]"
+msgid ""
+"git stash show [-u | --include-untracked | --only-untracked] [<diff-"
+"options>] [<stash>]"
+msgstr ""
+"git stash show [-u | --include-untracked | --only-untracked] [<差异选项>] [<"
+"贮存>]"
#: builtin/stash.c
-msgid "git stash drop [-q|--quiet] [<stash>]"
-msgstr "git stash drop [-q|--quiet] [<stash>]"
+msgid "git stash drop [-q | --quiet] [<stash>]"
+msgstr "git stash drop [-q | --quiet] [<贮存>]"
#: builtin/stash.c
-msgid "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
+msgid "git stash pop [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash pop [--index] [-q | --quiet] [<贮存>]"
+
+#: builtin/stash.c
+msgid "git stash apply [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash apply [--index] [-q | --quiet] [<贮存>]"
#: builtin/stash.c
msgid "git stash branch <branchname> [<stash>]"
msgstr "git stash branch <分支å> [<stash>]"
#: builtin/stash.c
+msgid "git stash store [(-m | --message) <message>] [-q | --quiet] <commit>"
+msgstr "git stash store [(-m | --message) <消æ¯>] [-q | --quiet] <æ交>"
+
+#: builtin/stash.c
msgid ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"<message>]\n"
" [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
" [--] [<pathspec>...]]"
msgstr ""
-"git stash [push [-p|--patch] [[-S|--staged] -k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <消æ¯>]\n"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message <消æ¯>]\n"
" [--pathspec-from-file=<文件> [--pathspec-file-nul]]\n"
" [--] [<路径规格>...]]"
#: builtin/stash.c
msgid ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<message>]"
msgstr ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<消æ¯>]"
-
-#: builtin/stash.c
-msgid "git stash pop [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash pop [--index] [-q|--quiet] [<stash>]"
-
-#: builtin/stash.c
-msgid "git stash apply [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash apply [--index] [-q|--quiet] [<stash>]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<消æ¯>]"
#: builtin/stash.c
-msgid "git stash store [-m|--message <message>] [-q|--quiet] <commit>"
-msgstr "git stash store [-m|--message <消æ¯>] [-q|--quiet] <æ交>"
-
-#: builtin/stash.c
-msgid ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
-" [--] [<pathspec>...]]"
-msgstr ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <消æ¯>]\n"
-" [--] [<路径规格>...]]"
-
-#: builtin/stash.c
-msgid ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<消æ¯>]"
+msgid "git stash create [<message>]"
+msgstr "git stash create [<消æ¯>]"
#: builtin/stash.c
#, c-format
@@ -15379,10 +15528,6 @@ msgid "don't fetch new objects from the remote site"
msgstr "ä¸è¦ä»Žè¿œç¨‹åœ°å€èŽ·å–新对象"
#: builtin/submodule--helper.c
-msgid "path into the working tree"
-msgstr "到工作区的路径"
-
-#: builtin/submodule--helper.c
msgid "use the 'checkout' update strategy (default)"
msgstr "使用 'checkout' 更新策略(默认)"
@@ -15427,34 +15572,10 @@ msgstr ""
"径>...]"
#: builtin/submodule--helper.c
-msgid "recurse into submodules"
-msgstr "在å­æ¨¡ç»„中递归"
-
-#: builtin/submodule--helper.c
msgid "git submodule absorbgitdirs [<options>] [<path>...]"
msgstr "git submodule absorbgitdirs [<选项>] [<路径>...]"
#: builtin/submodule--helper.c
-msgid "check if it is safe to write to the .gitmodules file"
-msgstr "检查写入 .gitmodules 文件是å¦å®‰å…¨"
-
-#: builtin/submodule--helper.c
-msgid "unset the config in the .gitmodules file"
-msgstr "å–消 .gitmodules 文件中的设置"
-
-#: builtin/submodule--helper.c
-msgid "git submodule--helper config <name> [<value>]"
-msgstr "git submodule--helper config <å称> [<值>]"
-
-#: builtin/submodule--helper.c
-msgid "git submodule--helper config --unset <name>"
-msgstr "git submodule--helper config --unset <å称>"
-
-#: builtin/submodule--helper.c
-msgid "please make sure that the .gitmodules file is in the working tree"
-msgstr "请确认 .gitmodules 文件在工作区里"
-
-#: builtin/submodule--helper.c
msgid "suppress output for setting url of a submodule"
msgstr "抑制设置å­æ¨¡ç»„ URL 的输出"
@@ -15548,6 +15669,10 @@ msgid "unable to checkout submodule '%s'"
msgstr "无法检出å­æ¨¡ç»„ '%s'"
#: builtin/submodule--helper.c
+msgid "please make sure that the .gitmodules file is in the working tree"
+msgstr "请确认 .gitmodules 文件在工作区里"
+
+#: builtin/submodule--helper.c
#, c-format
msgid "Failed to add submodule '%s'"
msgstr "无法添加å­æ¨¡ç»„ '%s'"
@@ -15608,23 +15733,21 @@ msgstr "仓库 URL:'%s' 必须是ç»å¯¹è·¯å¾„或以 ./|../ 起始"
msgid "'%s' is not a valid submodule name"
msgstr "'%s' ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„å­æ¨¡ç»„å称"
-#: builtin/submodule--helper.c git.c
-#, c-format
-msgid "%s doesn't support --super-prefix"
-msgstr "%s ä¸æ”¯æŒ --super-prefix"
-
#: builtin/submodule--helper.c
-#, c-format
-msgid "'%s' is not a valid submodule--helper subcommand"
-msgstr "'%s' ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„ submodule--helper å­å‘½ä»¤"
+msgid "git submodule--helper <command>"
+msgstr "git submodule--helper <命令>"
+
+#: builtin/symbolic-ref.c
+msgid "git symbolic-ref [-m <reason>] <name> <ref>"
+msgstr "git symbolic-ref [-m <ç†ç”±>] <å称> <引用>"
#: builtin/symbolic-ref.c
-msgid "git symbolic-ref [<options>] <name> [<ref>]"
-msgstr "git symbolic-ref [<选项>] <å称> [<引用>]"
+msgid "git symbolic-ref [-q] [--short] [--no-recurse] <name>"
+msgstr "git symbolic-ref [-q] [--short] [--no-recurse] <å称>"
#: builtin/symbolic-ref.c
-msgid "git symbolic-ref -d [-q] <name>"
-msgstr "git symbolic-ref -d [-q] <å称>"
+msgid "git symbolic-ref --delete [-q] <name>"
+msgstr "git symbolic-ref --delete [-q] <å称>"
#: builtin/symbolic-ref.c
msgid "suppress error message for non-symbolic (detached) refs"
@@ -15638,6 +15761,10 @@ msgstr "删除符å·å¼•ç”¨"
msgid "shorten ref output"
msgstr "缩短引用输出"
+#: builtin/symbolic-ref.c
+msgid "recursively dereference (default)"
+msgstr "递归解引用(默认)"
+
#: builtin/symbolic-ref.c builtin/update-ref.c
msgid "reason"
msgstr "原因"
@@ -15648,11 +15775,11 @@ msgstr "更新的原因"
#: builtin/tag.c
msgid ""
-"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]\n"
-" <tagname> [<head>]"
+"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n"
+" <tagname> [<commit> | <object>]"
msgstr ""
-"git tag [-a | -s | -u <key-id>] [-f] [-m <消æ¯> | -F <文件>]\n"
-" <标签å> [<头>]"
+"git tag [-a | -s | -u <ç§é’¥ ID>] [-f] [-m <消æ¯> | -F <文件>] [-e]\n"
+" <标签å> [<æ交> | <对象>]"
#: builtin/tag.c
msgid "git tag -d <tagname>..."
@@ -15660,14 +15787,15 @@ msgstr "git tag -d <标签å>..."
#: builtin/tag.c
msgid ""
-"git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--"
-"points-at <object>]\n"
-" [--format=<format>] [--merged <commit>] [--no-merged <commit>] "
-"[<pattern>...]"
+"git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]\n"
+" [--points-at <object>] [--column[=<options>] | --no-column]\n"
+" [--create-reflog] [--sort=<key>] [--format=<format>]\n"
+" [--merged <commit>] [--no-merged <commit>] [<pattern>...]"
msgstr ""
-"git tag -l [-n[<æ•°å­—>]] [--contains <æ交>] [--no-contains <æ交>] [--points-"
-"at <对象>]\n"
-" [--format=<æ ¼å¼>] [--merged <æ交>] [--no-merged <æ交>] [<模å¼>...]"
+"git tag [-n[<æ•°å­—>]] -l [--contains <æ交>] [--no-contains <æ交>]\n"
+" [--points-at <对象>] [--column[=<选项>] | --no-column]\n"
+" [--create-reflog] [--sort=<é”®>] [--format=<æ ¼å¼>]\n"
+" [--merged <æ交>] [--no-merged <æ交>] [<模å¼>...]"
#: builtin/tag.c
msgid "git tag -v [--format=<format>] <tagname>..."
@@ -16139,8 +16267,12 @@ msgid "update the info files from scratch"
msgstr "从头开始更新文件信æ¯"
#: builtin/upload-pack.c
-msgid "git upload-pack [<options>] <dir>"
-msgstr "git upload-pack [<选项>] <目录>"
+msgid ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <directory>"
+msgstr ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <目录>"
#: builtin/upload-pack.c t/helper/test-serve-v2.c
msgid "quit after a single request/response exchange"
@@ -16159,8 +16291,8 @@ msgid "interrupt transfer after <n> seconds of inactivity"
msgstr "ä¸æ´»åŠ¨ <n> 秒钟åŽç»ˆæ­¢ä¼ è¾“"
#: builtin/verify-commit.c
-msgid "git verify-commit [-v | --verbose] <commit>..."
-msgstr "git verify-commit [-v | --verbose] <æ交>..."
+msgid "git verify-commit [-v | --verbose] [--raw] <commit>..."
+msgstr "git verify-commit [-v | --verbose] [--raw] <æ交>..."
#: builtin/verify-commit.c
msgid "print commit contents"
@@ -16171,8 +16303,8 @@ msgid "print raw gpg status output"
msgstr "打å°åŽŸå§‹ gpg 状æ€è¾“出"
#: builtin/verify-pack.c
-msgid "git verify-pack [-v | --verbose] [-s | --stat-only] <pack>..."
-msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] <包>..."
+msgid "git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pack>.idx..."
+msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] [--] <包>.idx..."
#: builtin/verify-pack.c
msgid "verbose"
@@ -16183,44 +16315,48 @@ msgid "show statistics only"
msgstr "åªæ˜¾ç¤ºç»Ÿè®¡"
#: builtin/verify-tag.c
-msgid "git verify-tag [-v | --verbose] [--format=<format>] <tag>..."
-msgstr "git verify-tag [-v | --verbose] [--format=<æ ¼å¼>] <标签>..."
+msgid "git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."
+msgstr "git verify-tag [-v | --verbose] [--format=<æ ¼å¼>] [--raw] <标签>..."
#: builtin/verify-tag.c
msgid "print tag contents"
msgstr "打å°æ ‡ç­¾å†…容"
#: builtin/worktree.c
-msgid "git worktree add [<options>] <path> [<commit-ish>]"
-msgstr "git worktree add [<选项>] <路径> [<æ交>]"
+msgid ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]\n"
+" [-b <new-branch>] <path> [<commit-ish>]"
+msgstr ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <字符串>]]\n"
+" [-b <新分支>] <路径> [<æ交å·>]"
#: builtin/worktree.c
-msgid "git worktree list [<options>]"
-msgstr "git worktree list [<选项>]"
+msgid "git worktree list [-v | --porcelain [-z]]"
+msgstr "git worktree list [-v | --porcelain [-z]]"
#: builtin/worktree.c
-msgid "git worktree lock [<options>] <path>"
-msgstr "git worktree lock [<选项>] <路径>"
+msgid "git worktree lock [--reason <string>] <worktree>"
+msgstr "git worktree lock [--reason <字符串>] <工作区>"
#: builtin/worktree.c
msgid "git worktree move <worktree> <new-path>"
msgstr "git worktree move <工作区> <新路径>"
#: builtin/worktree.c
-msgid "git worktree prune [<options>]"
-msgstr "git worktree prune [<选项>]"
+msgid "git worktree prune [-n] [-v] [--expire <expire>]"
+msgstr "git worktree prune [-n] [-v] [--expire <过期>]"
#: builtin/worktree.c
-msgid "git worktree remove [<options>] <worktree>"
-msgstr "git worktree remove [<选项>] <工作区>"
+msgid "git worktree remove [-f] <worktree>"
+msgstr "git worktree remove [-f] <工作区>"
#: builtin/worktree.c
msgid "git worktree repair [<path>...]"
msgstr "git worktree repair [<路径>...]"
#: builtin/worktree.c
-msgid "git worktree unlock <path>"
-msgstr "git worktree unlock <路径>"
+msgid "git worktree unlock <worktree>"
+msgstr "git worktree unlock <工作区>"
#: builtin/worktree.c
#, c-format
@@ -16505,6 +16641,16 @@ msgid "core.fsyncMethod = batch is unsupported on this platform"
msgstr "core.fsyncMethod = batch ä¸æ”¯æŒæœ¬å¹³å°"
#: bundle-uri.c
+#, c-format
+msgid "could not parse bundle list key %s with value '%s'"
+msgstr "ä¸èƒ½è§£æžå½’档包列表键 %s 的值 '%s'"
+
+#: bundle-uri.c
+#, c-format
+msgid "bundle list at '%s' has no mode"
+msgstr "在 '%s' 的归档包列表没有模å¼"
+
+#: bundle-uri.c
msgid "failed to create temporary file"
msgstr "无法创建临时文件"
@@ -16514,18 +16660,53 @@ msgstr "缺ä¹èƒ½åŠ›"
#: bundle-uri.c
#, c-format
+msgid "file downloaded from '%s' is not a bundle"
+msgstr "下载自 '%s' 的文件ä¸æ˜¯å½’档包"
+
+#: bundle-uri.c
+msgid "failed to store maximum creation token"
+msgstr "无法储存最大的创建令牌"
+
+#: bundle-uri.c
+#, c-format
+msgid "unrecognized bundle mode from URI '%s'"
+msgstr "ä¸å¯è¾¨è®¤çš„归档包模å¼æ¥è‡ª URI '%s'"
+
+#: bundle-uri.c
+#, c-format
+msgid "exceeded bundle URI recursion limit (%d)"
+msgstr "超过了 URI 递归é™åˆ¶ (%d)"
+
+#: bundle-uri.c
+#, c-format
msgid "failed to download bundle from URI '%s'"
msgstr "无法从 URI '%s' 下载归档包"
#: bundle-uri.c
#, c-format
-msgid "file at URI '%s' is not a bundle"
-msgstr "ä½äºŽ URI '%s' 的文件ä¸æ˜¯å½’档包"
+msgid "file at URI '%s' is not a bundle or bundle list"
+msgstr "ä½äºŽ URI '%s' 的文件ä¸æ˜¯å½’档包或归档包列表"
#: bundle-uri.c
#, c-format
-msgid "failed to unbundle bundle from URI '%s'"
-msgstr "无法从 URI '%s' 解开归档包"
+msgid "bundle-uri: unexpected argument: '%s'"
+msgstr "bundle-uri: æ„外的å‚数:'%s'"
+
+#: bundle-uri.c
+msgid "bundle-uri: expected flush after arguments"
+msgstr "bundle-uri: 在å‚数之åŽåº”有一个 flush"
+
+#: bundle-uri.c
+msgid "bundle-uri: got an empty line"
+msgstr "bundle-uri: 获得了空行"
+
+#: bundle-uri.c
+msgid "bundle-uri: line is not of the form 'key=value'"
+msgstr "bundle-uri: è¡Œä¸æ˜¯ä»¥ 'key=value' æ ¼å¼"
+
+#: bundle-uri.c
+msgid "bundle-uri: line has empty key or value"
+msgstr "bundle-uri: 行有空的键或值"
#: bundle.c
#, c-format
@@ -16556,6 +16737,12 @@ msgid "need a repository to verify a bundle"
msgstr "需è¦ä¸€ä¸ªä»“库æ¥æ ¡éªŒä¸€ä¸ªå½’档包"
#: bundle.c
+msgid ""
+"some prerequisite commits exist in the object store, but are not connected "
+"to the repository's history"
+msgstr "一些å‰ç½®æ交存在于对象储存中,但未连接于本仓库的历å²"
+
+#: bundle.c
#, c-format
msgid "The bundle contains this ref:"
msgid_plural "The bundle contains these %<PRIuMAX> refs:"
@@ -17280,7 +17467,7 @@ msgid "Chunk-based file formats"
msgstr "å—å¼æ–‡ä»¶æ ¼å¼"
#: command-list.h
-msgid "Git commit graph format"
+msgid "Git commit-graph format"
msgstr "Git æ交图格å¼"
#: command-list.h
@@ -17707,6 +17894,11 @@ msgstr "'has_worktree_moved' 中未处ç†çš„情况:%d"
msgid "health thread wait failed [GLE %ld]"
msgstr "å¥åº·ç›‘测线程等待失败 [GLE %ld]"
+#: compat/fsmonitor/fsm-ipc-darwin.c
+#, c-format
+msgid "Invalid path: %s"
+msgstr "无效路径: %s"
+
#: compat/fsmonitor/fsm-listen-darwin.c
msgid "Unable to create FSEventStream."
msgstr "无法创建 FSEventStream。"
@@ -17745,12 +17937,32 @@ msgstr "GetOverlappedResult 失败于 '%s' [GLE %ld]"
msgid "could not read directory changes [GLE %ld]"
msgstr "无法获å–目录å˜æ›´ [GLE %ld]"
-#: compat/fsmonitor/fsm-settings-win32.c
+#: compat/fsmonitor/fsm-path-utils-darwin.c
+#, c-format
+msgid "opendir('%s') failed"
+msgstr "opendir('%s') 失败"
+
+#: compat/fsmonitor/fsm-path-utils-darwin.c
+#, c-format
+msgid "lstat('%s') failed"
+msgstr "lstat('%s') 失败"
+
+#: compat/fsmonitor/fsm-path-utils-darwin.c
+#, c-format
+msgid "strbuf_readlink('%s') failed"
+msgstr "strbuf_readlink('%s') 失败"
+
+#: compat/fsmonitor/fsm-path-utils-darwin.c
+#, c-format
+msgid "closedir('%s') failed"
+msgstr "closedir('%s') 失败"
+
+#: compat/fsmonitor/fsm-path-utils-win32.c
#, c-format
msgid "[GLE %ld] unable to open for read '%ls'"
msgstr "[GLE %ld] 无法打开è¦è¯»å–çš„ '%ls'"
-#: compat/fsmonitor/fsm-settings-win32.c
+#: compat/fsmonitor/fsm-path-utils-win32.c
#, c-format
msgid "[GLE %ld] unable to get protocol information for '%ls'"
msgstr "[GLE %ld] æ— æ³•èŽ·å– '%ls' çš„åè®®ä¿¡æ¯ "
@@ -18308,12 +18520,12 @@ msgstr "æœåŠ¡å™¨ç»™å‡ºæœªçŸ¥çš„å¯¹è±¡æ ¼å¼ '%s'"
#: connect.c
#, c-format
-msgid "invalid ls-refs response: %s"
-msgstr "无效的 ls-refs å“应:%s"
+msgid "error on bundle-uri response line %d: %s"
+msgstr "于 bundle-uri å“应行 %d å‘生错误:%s"
#: connect.c
-msgid "expected flush after ref listing"
-msgstr "在引用列表之åŽåº”该有一个 flush 包"
+msgid "expected flush after bundle-uri listing"
+msgstr "在 bundle-uri 列表之åŽåº”该有一个 flush 包"
#: connect.c
msgid "expected response end packet after ref listing"
@@ -18321,6 +18533,15 @@ msgstr "在引用列表之åŽåº”该有å“应结æŸåŒ…"
#: connect.c
#, c-format
+msgid "invalid ls-refs response: %s"
+msgstr "无效的 ls-refs å“应:%s"
+
+#: connect.c
+msgid "expected flush after ref listing"
+msgstr "在引用列表之åŽåº”该有一个 flush 包"
+
+#: connect.c
+#, c-format
msgid "protocol '%s' is not supported"
msgstr "ä¸æ”¯æŒ '%s' åè®®"
@@ -19719,8 +19940,9 @@ msgstr "虚拟仓库 '%s' 与 fsmonitor ä¸å…¼å®¹"
#: fsmonitor-settings.c
#, c-format
msgid ""
-"repository '%s' is incompatible with fsmonitor due to lack of Unix sockets"
-msgstr "因为缺少 Unix 套接字,仓库 '%s' 与 fsmonitor ä¸å…¼å®¹"
+"socket directory '%s' is incompatible with fsmonitor due to lack of Unix "
+"sockets support"
+msgstr "因为缺少 Unix 套接字支æŒï¼Œå¥—接字目录 '%s' 与 fsmonitor ä¸å…¼å®¹"
#: git.c
msgid ""
@@ -19729,16 +19951,14 @@ msgid ""
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
-" [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n"
-" <command> [<args>]"
+" [--config-env=<name>=<envvar>] <command> [<args>]"
msgstr ""
-"git [-v | --version] [--help] [-C <路径>] [-c <å称>=<å–值>]\n"
+"git [-v | --version] [-h | --help] [-C <路径>] [-c <å称>=<å–值>]\n"
" [--exec-path[=<路径>]] [--html-path] [--man-path] [--info-path]\n"
" [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
"bare]\n"
" [--git-dir=<路径>] [--work-tree=<路径>] [--namespace=<å称>]\n"
-" [--super-prefix=<路径>] [--config-env=<å称>=<环境å˜é‡>]\n"
-" <命令> [<å‚æ•°>]"
+" [--config-env=<å称>=<环境å˜é‡>] <命令> [<å‚æ•°>]"
#: git.c
msgid ""
@@ -19769,11 +19989,6 @@ msgstr "没有为 --namespace æ供命å空间\n"
#: git.c
#, c-format
-msgid "no prefix given for --super-prefix\n"
-msgstr "没有为 --super-prefix æä¾›å‰ç¼€\n"
-
-#: git.c
-#, c-format
msgid "-c expects a configuration string\n"
msgstr "应为 -c æ供一个é…置字符串\n"
@@ -19906,8 +20121,13 @@ msgid "gpg.ssh.defaultKeyCommand failed: %s %s"
msgstr "gpg.ssh.defaultKeyCommand 失败:%s %s"
#: gpg-interface.c
-msgid "gpg failed to sign the data"
-msgstr "gpg 无法为数æ®ç­¾å"
+#, c-format
+msgid ""
+"gpg failed to sign the data:\n"
+"%s"
+msgstr ""
+"gpg 无法为数æ®ç­¾å:\n"
+"%s"
#: gpg-interface.c
msgid "user.signingKey needs to be set for ssh signing"
@@ -20107,8 +20327,8 @@ msgstr[1] ""
"最相似的命令是"
#: help.c
-msgid "git version [<options>]"
-msgstr "git version [<选项>]"
+msgid "git version [--build-options]"
+msgstr "git version [--build-options]"
#: help.c
#, c-format
@@ -21181,11 +21401,6 @@ msgid "%s: ignoring alternate object stores, nesting too deep"
msgstr "%s:忽略备用对象库,嵌套太深"
#: object-file.c
-#, c-format
-msgid "unable to normalize object directory: %s"
-msgstr "无法规范化对象目录: %s"
-
-#: object-file.c
msgid "unable to fdopen alternates lockfile"
msgstr "无法 fdopen 替æ¢é”文件"
@@ -21259,6 +21474,11 @@ msgstr "æ¾æ•£å¯¹è±¡ '%s' åŽé¢æœ‰åžƒåœ¾æ•°æ®"
#: object-file.c
#, c-format
+msgid "unable to open loose object %s"
+msgstr "无法打开æ¾æ•£å¯¹è±¡ %s"
+
+#: object-file.c
+#, c-format
msgid "unable to parse %s header"
msgstr "æ— æ³•è§£æž %s 头部"
@@ -21278,8 +21498,8 @@ msgstr "%s 的头部太长,超出了 %d 字节"
#: object-file.c
#, c-format
-msgid "failed to read object %s"
-msgstr "无法读å–对象 %s"
+msgid "loose object %s (stored in %s) is corrupt"
+msgstr "æ¾æ•£å¯¹è±¡ %s(ä¿å­˜åœ¨ %s)已æŸå"
#: object-file.c
#, c-format
@@ -21288,11 +21508,6 @@ msgstr "找ä¸åˆ° %2$s 的替代 %1$s"
#: object-file.c
#, c-format
-msgid "loose object %s (stored in %s) is corrupt"
-msgstr "æ¾æ•£å¯¹è±¡ %s(ä¿å­˜åœ¨ %s)已æŸå"
-
-#: object-file.c
-#, c-format
msgid "packed object %s (stored in %s) is corrupt"
msgstr "打包对象 %s(ä¿å­˜åœ¨ %s)已æŸå"
@@ -21307,10 +21522,6 @@ msgid "unable to set permission to '%s'"
msgstr "无法为 '%s' 设置æƒé™"
#: object-file.c
-msgid "file write error"
-msgstr "文件写错误"
-
-#: object-file.c
msgid "error when closing loose object file"
msgstr "关闭æ¾æ•£å¯¹è±¡æ–‡ä»¶æ—¶å‡ºé”™"
@@ -21368,12 +21579,13 @@ msgid "cannot read object for %s"
msgstr "ä¸èƒ½è¯»å–对象 %s"
#: object-file.c
-msgid "corrupt commit"
-msgstr "æŸåçš„æ交"
+#, c-format
+msgid "object fails fsck: %s"
+msgstr "对象 fsck 失败:%s"
#: object-file.c
-msgid "corrupt tag"
-msgstr "æŸå的标签"
+msgid "refusing to create malformed object"
+msgstr "æ‹’ç»åˆ›å»ºæ ¼å¼é”™è¯¯çš„对象"
#: object-file.c
#, c-format
@@ -21684,11 +21896,6 @@ msgid "cannot fstat bitmap file"
msgstr "ä¸èƒ½å¯¹ä½å›¾æ–‡ä»¶è°ƒç”¨ fstat"
#: pack-bitmap.c
-#, c-format
-msgid "ignoring extra bitmap file: '%s'"
-msgstr "忽略é¢å¤–çš„ä½å›¾æ–‡ä»¶ï¼š'%s'"
-
-#: pack-bitmap.c
msgid "checksum doesn't match in MIDX and bitmap"
msgstr "MIDX å’Œä½å›¾ä¸­çš„校验ç ä¸åŒ¹é…"
@@ -22015,6 +22222,10 @@ msgid "use <n> digits to display object names"
msgstr "用 <n> ä½æ•°å­—显示对象å"
#: parse-options.h
+msgid "prefixed path to initial superproject"
+msgstr "用æ¥åˆå§‹åŒ–父项目的å‰ç¼€è·¯å¾„"
+
+#: parse-options.h
msgid "how to strip spaces and #comments from message"
msgstr "设置如何删除æ交说明里的空格和#注释"
@@ -22194,6 +22405,11 @@ msgstr "promisor-remote:无法关闭至 fetch å­è¿›ç¨‹çš„标准输入"
msgid "promisor remote name cannot begin with '/': %s"
msgstr "promisor 远程å称ä¸èƒ½ä»¥ '/' 开始:%s"
+#: promisor-remote.c
+#, c-format
+msgid "could not fetch %s from promisor remote"
+msgstr "æ— æ³•ä»Žæ‰¿è¯ºè€…è¿œç¨‹èŽ·å– %s"
+
#: protocol-caps.c
msgid "object-info: expected flush after arguments"
msgstr "object-info:在å‚数之åŽåº”有一个 flush"
@@ -22593,6 +22809,16 @@ msgstr "领先 %d,è½åŽ %d"
#: ref-filter.c
#, c-format
+msgid "%%(%.*s) does not take arguments"
+msgstr "%%(%.*s) ä¸å¸¦å‚æ•°"
+
+#: ref-filter.c
+#, c-format
+msgid "unrecognized %%(%.*s) argument: %s"
+msgstr "未能识别的 %%(%.*s) å‚数:%s"
+
+#: ref-filter.c
+#, c-format
msgid "expected format: %%(color:<color>)"
msgstr "期望的格å¼ï¼š%%(color:<颜色>)"
@@ -22613,26 +22839,6 @@ msgstr "期望整数值 refname:rstrip=%s"
#: ref-filter.c
#, c-format
-msgid "unrecognized %%(%s) argument: %s"
-msgstr "未能识别的 %%(%s) å‚数:%s"
-
-#: ref-filter.c
-#, c-format
-msgid "%%(objecttype) does not take arguments"
-msgstr "%%(objecttype) ä¸å¸¦å‚æ•°"
-
-#: ref-filter.c
-#, c-format
-msgid "%%(deltabase) does not take arguments"
-msgstr "%%(deltabase) ä¸å¸¦å‚æ•°"
-
-#: ref-filter.c
-#, c-format
-msgid "%%(body) does not take arguments"
-msgstr "%%(body) ä¸å¸¦å‚æ•°"
-
-#: ref-filter.c
-#, c-format
msgid "expected %%(trailers:key=<value>)"
msgstr "预期 %%(trailers:key=<值>)"
@@ -22653,11 +22859,6 @@ msgstr "期望 %%(%2$s) 中的 '%1$s' 是一个正数"
#: ref-filter.c
#, c-format
-msgid "unrecognized email option: %s"
-msgstr "未识别的邮件选项:%s"
-
-#: ref-filter.c
-#, c-format
msgid "expected format: %%(align:<width>,<position>)"
msgstr "期望的格å¼ï¼š%%(align:<宽度>,<ä½ç½®>)"
@@ -22673,13 +22874,13 @@ msgstr "未能识别的宽度:%s"
#: ref-filter.c
#, c-format
-msgid "positive width expected with the %%(align) atom"
-msgstr "元素 %%(align) 需è¦ä¸€ä¸ªæ­£æ•°çš„宽度"
+msgid "unrecognized %%(%s) argument: %s"
+msgstr "未能识别的 %%(%s) å‚数:%s"
#: ref-filter.c
#, c-format
-msgid "%%(rest) does not take arguments"
-msgstr "%%(rest) ä¸å¸¦å‚æ•°"
+msgid "positive width expected with the %%(align) atom"
+msgstr "元素 %%(align) 需è¦ä¸€ä¸ªæ­£æ•°çš„宽度"
#: ref-filter.c
#, c-format
@@ -23468,6 +23669,15 @@ msgstr "无法找到 %s 指å‘çš„æ ‘"
#: revision.c
#, c-format
+msgid "unsupported section for hidden refs: %s"
+msgstr "ä¸æ”¯æŒçš„éšè—引用片段: %s"
+
+#: revision.c
+msgid "--exclude-hidden= passed more than once"
+msgstr "--exclude-hidden= 传递了ä¸æ­¢ä¸€æ¬¡"
+
+#: revision.c
+#, c-format
msgid "resolve-undo records `%s` which is missing"
msgstr "resolve-undo 记录 `%s`,现缺失"
@@ -23653,6 +23863,16 @@ msgstr "--all 或者 <登记>,而ä¸æ˜¯ä¸¤ä¸ªä¸€èµ·"
#: scalar.c
#, c-format
+msgid "could not remove stale scalar.repo '%s'"
+msgstr "无法删除过期的 scalar.repo '%s'"
+
+#: scalar.c
+#, c-format
+msgid "removing stale scalar.repo '%s'"
+msgstr "正在删除过期的 scalar.repo '%s'"
+
+#: scalar.c
+#, c-format
msgid "git repository gone in '%s'"
msgstr "在 '%s' 的 git 仓库已消失"
@@ -24166,6 +24386,26 @@ msgstr "git %s:无法刷新索引"
#: sequencer.c
#, c-format
+msgid "'%s' is not a valid label"
+msgstr "'%s' ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„标签"
+
+#: sequencer.c
+#, c-format
+msgid "'%s' is not a valid refname"
+msgstr "'%s' ä¸æ˜¯ä¸€ä¸ªæœ‰æ•ˆçš„引用å"
+
+#: sequencer.c
+#, c-format
+msgid "update-ref requires a fully qualified refname e.g. refs/heads/%s"
+msgstr "update-ref 需è¦ä¸€ä¸ªå®Œæ•´çš„引用å,例如:refs/heads/%s"
+
+#: sequencer.c
+#, c-format
+msgid "invalid command '%.*s'"
+msgstr "无效命令 '%.*s'"
+
+#: sequencer.c
+#, c-format
msgid "%s does not accept arguments: '%s'"
msgstr "%s ä¸æŽ¥å—å‚数:'%s'"
@@ -24398,6 +24638,11 @@ msgid "illegal label name: '%.*s'"
msgstr "éžæ³•çš„标签å称:'%.*s'"
#: sequencer.c
+#, c-format
+msgid "could not resolve '%s'"
+msgstr "æ— æ³•è§£æž '%s'"
+
+#: sequencer.c
msgid "writing fake root commit"
msgstr "写伪根æ交"
@@ -24406,11 +24651,6 @@ msgid "writing squash-onto"
msgstr "写入 squash-onto"
#: sequencer.c
-#, c-format
-msgid "could not resolve '%s'"
-msgstr "æ— æ³•è§£æž '%s'"
-
-#: sequencer.c
msgid "cannot merge without a current revision"
msgstr "没有当å‰ç‰ˆæœ¬ä¸èƒ½åˆå¹¶"
@@ -25123,6 +25363,31 @@ msgstr "ls-tree 返回未知返回值 %d"
msgid "failed to lstat '%s'"
msgstr "无法执行 lstat '%s'"
+#: t/helper/test-bundle-uri.c
+msgid "no remote configured to get bundle URIs from"
+msgstr "没有远程被设置为å¯ä»¥èŽ·å–归档包 URI"
+
+#: t/helper/test-bundle-uri.c
+#, c-format
+msgid "remote '%s' has no configured URL"
+msgstr "远程 '%s' 没有设置 URL"
+
+#: t/helper/test-bundle-uri.c
+msgid "could not get the bundle-uri list"
+msgstr "æ— æ³•èŽ·å– bundle-uri 列表"
+
+#: t/helper/test-cache-tree.c
+msgid "test-tool cache-tree <options> (control|prime|update)"
+msgstr "test-tool cache-tree <选项> (control|prime|update)"
+
+#: t/helper/test-cache-tree.c
+msgid "clear the cache tree before each iteration"
+msgstr "在æ¯æ¬¡è¿­ä»£å‰æ¸…除缓存树"
+
+#: t/helper/test-cache-tree.c
+msgid "number of entries in the cache tree to invalidate (default 0)"
+msgstr "缓存树中无效化的æ¡ç›®æ•°é‡ï¼ˆé»˜è®¤ 0)"
+
#: t/helper/test-fast-rebase.c
msgid "unhandled options"
msgstr "未处ç†çš„选项"
@@ -25547,6 +25812,14 @@ msgstr "正在终止。"
msgid "failed to push all needed submodules"
msgstr "ä¸èƒ½æŽ¨é€å…¨éƒ¨éœ€è¦çš„å­æ¨¡ç»„"
+#: transport.c
+msgid "bundle-uri operation not supported by protocol"
+msgstr "åè®®ä¸æ”¯æŒ bundle-uri æ“作"
+
+#: transport.c
+msgid "could not retrieve server-advertised bundle-uri list"
+msgstr "无法获å–æœåŠ¡å™¨å…¬å¸ƒçš„ bundle-uri 列表"
+
#: tree-walk.c
msgid "too-short tree object"
msgstr "太短的树对象"
@@ -26464,12 +26737,20 @@ msgstr "忽略的文件"
#: wt-status.c
#, c-format
msgid ""
-"It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
-"may speed it up, but you have to be careful not to forget to add\n"
-"new files yourself (see 'git help status')."
+"It took %.2f seconds to enumerate untracked files,\n"
+"but the results were cached, and subsequent runs may be faster."
msgstr ""
-"耗费了 %.2f 秒以枚举未跟踪的文件。'status -uno' 也许能æ高速度,\n"
-"但您需è¦å°å¿ƒä¸è¦å¿˜äº†æ·»åŠ æ–°æ–‡ä»¶ï¼ˆå‚è§ 'git help status')。"
+"枚举未追踪的文件花了 %.2f 秒,\n"
+"结果已被缓存,åŽç»­çš„执行会更快。"
+
+#: wt-status.c
+#, c-format
+msgid "It took %.2f seconds to enumerate untracked files."
+msgstr "枚举未追踪的文件花了 %.2f 秒。"
+
+#: wt-status.c
+msgid "See 'git help status' for information on how to improve this."
+msgstr "å‚è§ 'git help status' æ¥èŽ·å–如何改善的信æ¯ã€‚"
#: wt-status.c
#, c-format
@@ -26642,300 +26923,6 @@ msgstr "您需è¦åœ¨å·¥ä½œåŒºçš„顶级目录中è¿è¡Œè¿™ä¸ªå‘½ä»¤ã€‚"
msgid "Unable to determine absolute path of git directory"
msgstr "ä¸èƒ½ç¡®å®š git 目录的ç»å¯¹è·¯å¾„"
-#. TRANSLATORS: you can adjust this to align "git add -i" status menu
-#: git-add--interactive.perl
-#, perl-format
-msgid "%12s %12s %s"
-msgstr "%12s %12s %s"
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "touched %d path\n"
-msgid_plural "touched %d paths\n"
-msgstr[0] "触碰了 %d 个路径\n"
-msgstr[1] "触碰了 %d 个路径\n"
-
-#: git-add--interactive.perl
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for staging."
-msgstr "如果补ä¸èƒ½å¹²å‡€åœ°åº”用,编辑å—将立å³æ ‡è®°ä¸ºæš‚存。"
-
-#: git-add--interactive.perl
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for stashing."
-msgstr "如果补ä¸èƒ½å¹²å‡€åœ°åº”用,编辑å—将立å³æ ‡è®°ä¸ºè´®è—。"
-
-#: git-add--interactive.perl
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for unstaging."
-msgstr "如果补ä¸èƒ½å¹²å‡€åœ°åº”用,编辑å—将立å³æ ‡è®°ä¸ºæœªæš‚存。"
-
-#: git-add--interactive.perl
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for applying."
-msgstr "如果补ä¸èƒ½å¹²å‡€åœ°åº”用,编辑å—将立å³æ ‡è®°ä¸ºåº”用。"
-
-#: git-add--interactive.perl
-msgid ""
-"If the patch applies cleanly, the edited hunk will immediately be\n"
-"marked for discarding."
-msgstr "如果补ä¸èƒ½å¹²å‡€åœ°åº”用,编辑å—将立å³æ ‡è®°ä¸ºä¸¢å¼ƒã€‚"
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "failed to open hunk edit file for writing: %s"
-msgstr "无法为写入打开å—编辑文件:%s"
-
-#: git-add--interactive.perl
-#, perl-format
-msgid ""
-"---\n"
-"To remove '%s' lines, make them ' ' lines (context).\n"
-"To remove '%s' lines, delete them.\n"
-"Lines starting with %s will be removed.\n"
-msgstr ""
-"---\n"
-"è¦åˆ é™¤ '%s' 开始的行,使其æˆä¸º ' ' 开始的行(上下文)。\n"
-"è¦åˆ é™¤ '%s' 开始的行,删除它们。\n"
-"以 %s 开始的行将被删除。\n"
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "failed to open hunk edit file for reading: %s"
-msgstr "无法读å–å—编辑文件:%s"
-
-#: git-add--interactive.perl
-msgid ""
-"y - stage this hunk\n"
-"n - do not stage this hunk\n"
-"q - quit; do not stage this hunk or any of the remaining ones\n"
-"a - stage this hunk and all later hunks in the file\n"
-"d - do not stage this hunk or any of the later hunks in the file"
-msgstr ""
-"y - 暂存该å—\n"
-"n - ä¸è¦æš‚存该å—\n"
-"q - 退出。ä¸æš‚存该å—åŠåŽé¢çš„全部å—\n"
-"a - 暂存该å—和本文件中åŽé¢çš„全部å—\n"
-"d - ä¸æš‚存该å—和本文件中åŽé¢çš„全部å—"
-
-#: git-add--interactive.perl
-msgid ""
-"y - stash this hunk\n"
-"n - do not stash this hunk\n"
-"q - quit; do not stash this hunk or any of the remaining ones\n"
-"a - stash this hunk and all later hunks in the file\n"
-"d - do not stash this hunk or any of the later hunks in the file"
-msgstr ""
-"y - è´®è—该å—\n"
-"n - ä¸è¦è´®è—该å—\n"
-"q - 退出。ä¸è´®è—该å—åŠåŽé¢çš„全部å—\n"
-"a - è´®è—该å—和本文件中åŽé¢çš„全部å—\n"
-"d - ä¸è´®è—该å—和本文件中åŽé¢çš„全部å—"
-
-#: git-add--interactive.perl
-msgid ""
-"y - unstage this hunk\n"
-"n - do not unstage this hunk\n"
-"q - quit; do not unstage this hunk or any of the remaining ones\n"
-"a - unstage this hunk and all later hunks in the file\n"
-"d - do not unstage this hunk or any of the later hunks in the file"
-msgstr ""
-"y - ä¸æš‚存该å—\n"
-"n - ä¸è¦ä¸æš‚存该å—\n"
-"q - 退出。ä¸è¦ä¸æš‚存该å—åŠåŽé¢çš„全部å—\n"
-"a - ä¸æš‚存该å—和本文件中åŽé¢çš„全部å—\n"
-"d - ä¸è¦ä¸æš‚存该å—和本文件中åŽé¢çš„全部å—"
-
-#: git-add--interactive.perl
-msgid ""
-"y - apply this hunk to index\n"
-"n - do not apply this hunk to index\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - 在索引中应用该å—\n"
-"n - ä¸è¦åœ¨ç´¢å¼•ä¸­åº”用该å—\n"
-"q - 退出。ä¸è¦åº”用该å—åŠåŽé¢çš„全部å—\n"
-"a - 应用该å—和本文件中åŽé¢çš„全部å—\n"
-"d - ä¸è¦åº”用该å—和本文件中åŽé¢çš„全部å—"
-
-#: git-add--interactive.perl
-msgid ""
-"y - discard this hunk from worktree\n"
-"n - do not discard this hunk from worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-"y - 在工作区中丢弃该å—\n"
-"n - ä¸è¦åœ¨å·¥ä½œåŒºä¸­ä¸¢å¼ƒè¯¥å—\n"
-"q - 退出。ä¸è¦ä¸¢å¼ƒè¯¥å—åŠåŽé¢çš„全部å—\n"
-"a - 丢弃该å—和本文件中åŽé¢çš„全部å—\n"
-"d - ä¸è¦ä¸¢å¼ƒè¯¥å—和本文件中åŽé¢çš„全部å—"
-
-#: git-add--interactive.perl
-msgid ""
-"y - discard this hunk from index and worktree\n"
-"n - do not discard this hunk from index and worktree\n"
-"q - quit; do not discard this hunk or any of the remaining ones\n"
-"a - discard this hunk and all later hunks in the file\n"
-"d - do not discard this hunk or any of the later hunks in the file"
-msgstr ""
-"y - 在索引和工作区中丢弃该å—\n"
-"n - ä¸è¦åœ¨ç´¢å¼•å’Œå·¥ä½œåŒºä¸­ä¸¢å¼ƒè¯¥å—\n"
-"q - 退出。ä¸è¦ä¸¢å¼ƒè¯¥å—åŠåŽé¢çš„全部å—\n"
-"a - 丢弃该å—和本文件中åŽé¢çš„全部å—\n"
-"d - ä¸è¦ä¸¢å¼ƒè¯¥å—和本文件中åŽé¢çš„全部å—"
-
-#: git-add--interactive.perl
-msgid ""
-"y - apply this hunk to index and worktree\n"
-"n - do not apply this hunk to index and worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - 在索引和工作区中应用该å—\n"
-"n - ä¸è¦åœ¨ç´¢å¼•å’Œå·¥ä½œåŒºä¸­åº”用该å—\n"
-"q - 退出。ä¸è¦åº”用该å—åŠåŽé¢çš„全部å—\n"
-"a - 应用该å—和本文件中åŽé¢çš„全部å—\n"
-"d - ä¸è¦åº”用该å—和本文件中åŽé¢çš„全部å—"
-
-#: git-add--interactive.perl
-msgid ""
-"y - apply this hunk to worktree\n"
-"n - do not apply this hunk to worktree\n"
-"q - quit; do not apply this hunk or any of the remaining ones\n"
-"a - apply this hunk and all later hunks in the file\n"
-"d - do not apply this hunk or any of the later hunks in the file"
-msgstr ""
-"y - 在工作区中应用该å—\n"
-"n - ä¸è¦åœ¨å·¥ä½œåŒºä¸­åº”用该å—\n"
-"q - 退出。ä¸è¦åº”用该å—åŠåŽé¢çš„全部å—\n"
-"a - 应用该å—和本文件中åŽé¢çš„全部å—\n"
-"d - ä¸è¦åº”用该å—和本文件中åŽé¢çš„全部å—"
-
-#: git-add--interactive.perl
-msgid ""
-"g - select a hunk to go to\n"
-"/ - search for a hunk matching the given regex\n"
-"j - leave this hunk undecided, see next undecided hunk\n"
-"J - leave this hunk undecided, see next hunk\n"
-"k - leave this hunk undecided, see previous undecided hunk\n"
-"K - leave this hunk undecided, see previous hunk\n"
-"s - split the current hunk into smaller hunks\n"
-"e - manually edit the current hunk\n"
-"? - print help\n"
-msgstr ""
-"g - 选择跳转到一个å—\n"
-"/ - 查找和给定正则表达å¼åŒ¹é…çš„å—\n"
-"j - ç»´æŒè¯¥å—未决状æ€ï¼ŒæŸ¥çœ‹ä¸‹ä¸€ä¸ªæœªå†³å—\n"
-"J - ç»´æŒè¯¥å—未决状æ€ï¼ŒæŸ¥çœ‹ä¸‹ä¸€ä¸ªå—\n"
-"k - ç»´æŒè¯¥å—未决状æ€ï¼ŒæŸ¥çœ‹ä¸Šä¸€ä¸ªæœªå†³å—\n"
-"K - ç»´æŒè¯¥å—未决状æ€ï¼ŒæŸ¥çœ‹ä¸Šä¸€ä¸ªå—\n"
-"s - 拆分当å‰å—为更å°çš„å—\n"
-"e - 手动编辑当å‰å—\n"
-"? - 显示帮助\n"
-
-#: git-add--interactive.perl
-msgid "The selected hunks do not apply to the index!\n"
-msgstr "选中的å—ä¸èƒ½åº”用到索引ï¼\n"
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "ignoring unmerged: %s\n"
-msgstr "忽略未åˆå…¥çš„:%s\n"
-
-#: git-add--interactive.perl
-msgid "No other hunks to goto\n"
-msgstr "没有其它å¯ä¾›è·³è½¬çš„å—\n"
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "Invalid number: '%s'\n"
-msgstr "无效数字:'%s'\n"
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "Sorry, only %d hunk available.\n"
-msgid_plural "Sorry, only %d hunks available.\n"
-msgstr[0] "对ä¸èµ·ï¼Œåªæœ‰ %d 个å¯ç”¨å—。\n"
-msgstr[1] "对ä¸èµ·ï¼Œåªæœ‰ %d 个å¯ç”¨å—。\n"
-
-#: git-add--interactive.perl
-msgid "No other hunks to search\n"
-msgstr "没有其它å¯ä¾›æŸ¥æ‰¾çš„å—\n"
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "Malformed search regexp %s: %s\n"
-msgstr "é”™è¯¯çš„æ­£åˆ™è¡¨è¾¾å¼ %s:%s\n"
-
-#: git-add--interactive.perl
-msgid "No hunk matches the given pattern\n"
-msgstr "没有和给定模å¼ç›¸åŒ¹é…çš„å—\n"
-
-#: git-add--interactive.perl
-msgid "No previous hunk\n"
-msgstr "没有å‰ä¸€ä¸ªå—\n"
-
-#: git-add--interactive.perl
-msgid "No next hunk\n"
-msgstr "没有下一个å—\n"
-
-#: git-add--interactive.perl
-msgid "Sorry, cannot split this hunk\n"
-msgstr "对ä¸èµ·ï¼Œä¸èƒ½æ‹†åˆ†è¿™ä¸ªå—\n"
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "Split into %d hunk.\n"
-msgid_plural "Split into %d hunks.\n"
-msgstr[0] "拆分为 %d å—。\n"
-msgstr[1] "拆分为 %d å—。\n"
-
-#: git-add--interactive.perl
-msgid "Sorry, cannot edit this hunk\n"
-msgstr "对ä¸èµ·ï¼Œä¸èƒ½ç¼–辑这个å—\n"
-
-#. TRANSLATORS: please do not translate the command names
-#. 'status', 'update', 'revert', etc.
-#: git-add--interactive.perl
-msgid ""
-"status - show paths with changes\n"
-"update - add working tree state to the staged set of changes\n"
-"revert - revert staged set of changes back to the HEAD version\n"
-"patch - pick hunks and update selectively\n"
-"diff - view diff between HEAD and index\n"
-"add untracked - add contents of untracked files to the staged set of "
-"changes\n"
-msgstr ""
-"status - 显示å«å˜æ›´çš„路径\n"
-"update - 添加工作区状æ€è‡³æš‚存列表\n"
-"revert - 还原修改的暂存集至 HEAD 版本\n"
-"patch - 挑选å—并且有选择地更新\n"
-"diff - 显示 HEAD 和索引间差异\n"
-"add untracked - 添加未跟踪文件的内容至暂存列表\n"
-
-#: git-add--interactive.perl
-msgid "missing --"
-msgstr "缺失 --"
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "unknown --patch mode: %s"
-msgstr "未知的 --patch 模å¼ï¼š%s"
-
-#: git-add--interactive.perl
-#, perl-format
-msgid "invalid argument %s, expecting --"
-msgstr "无效的å‚æ•° %s,期望是 --"
-
#: git-send-email.perl
msgid "local zone differs from GMT by a non-minute interval\n"
msgstr "本地时间和 GMT 有ä¸åˆ°ä¸€åˆ†é’Ÿé—´éš”\n"
diff --git a/po/zh_TW.po b/po/zh_TW.po
index 29b8089141..aa59a8e933 100644
--- a/po/zh_TW.po
+++ b/po/zh_TW.po
@@ -1,9 +1,11 @@
# Chinese (traditional) translations for Git package
# Git 套è£è»Ÿé«”çš„ç¹é«”中文翻譯。
# Copyright (C) 2012-2021 Jiang Xin <worldhello.net AT gmail.com>
-# Copyright (C) 2019-2021 Yi-Jyun Pan <pan93412@gmail.com>
+# Copyright (C) 2019-2022 Yi-Jyun Pan <pan93412@gmail.com>
# This file is distributed under the same license as the Git package.
#
+# The glossary can be found on https://github.com/l10n-tw/git-glossary
+#
# Contributors (CN):
# - Fangyi Zhou <me AT fangyi.io>
# - Jiang Xin <worldhello.net AT gmail.com>
@@ -18,12 +20,13 @@
# - Zhuang Ya <zhuangya AT me.com>
#
# Yi-Jyun Pan <pan93412@gmail.com>, 2021, 2022.
+# Kaiyang Wu <self@origincode.me>, 2022.
msgid ""
msgstr ""
"Project-Id-Version: Git\n"
"Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2022-09-23 21:57+0000\n"
-"PO-Revision-Date: 2022-10-01 19:02+0800\n"
+"POT-Creation-Date: 2022-12-11 00:28+0800\n"
+"PO-Revision-Date: 2022-12-10 17:12+0000\n"
"Last-Translator: Yi-Jyun Pan <pan93412@gmail.com>\n"
"Language-Team: Chinese (Traditional) <http://weblate.slat.org/projects/git-"
"po/git-cli/zh_Hant/>\n"
@@ -32,7 +35,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
-"X-Generator: Poedit 3.1.1\n"
+"X-Generator: Weblate 4.14.2\n"
"X-ZhConverter: ç¹åŒ–姬 dict-f4bc617e-r910 @ 2019/11/16 20:23:12 | https://"
"zhconvert.org\n"
@@ -64,7 +67,7 @@ msgstr "æ›´æ–°"
#: add-interactive.c
#, c-format
msgid "could not stage '%s'"
-msgstr "無法暫存「%sã€"
+msgstr "無法暫存 “%sâ€"
#: add-interactive.c builtin/stash.c reset.c sequencer.c
msgid "could not write index"
@@ -79,12 +82,12 @@ msgstr[0] "已更新 %d 個路徑\n"
#: add-interactive.c git-add--interactive.perl
#, c-format, perl-format
msgid "note: %s is untracked now.\n"
-msgstr "注æ„:%s ç¾å·²ä¸å†è¿½è¹¤ã€‚\n"
+msgstr "註:ç¾å·²ä¸å†è¿½è¹¤ %s。\n"
#: add-interactive.c apply.c builtin/checkout.c builtin/reset.c
#, c-format
msgid "make_cache_entry failed for path '%s'"
-msgstr "「%sã€è·¯å¾‘執行 make_cache_entry 失敗"
+msgstr "å° â€œ%s†路徑執行 make_cache_entry 失敗"
#: add-interactive.c git-add--interactive.perl
msgid "Revert"
@@ -92,13 +95,13 @@ msgstr "還原"
#: add-interactive.c
msgid "Could not parse HEAD^{tree}"
-msgstr "ä¸èƒ½è§£æž HEAD^{樹}"
+msgstr "ç„¡æ³•è§£æž HEAD^{tree}"
#: add-interactive.c git-add--interactive.perl
#, c-format, perl-format
msgid "reverted %d path\n"
msgid_plural "reverted %d paths\n"
-msgstr[0] "還原了 %d 個路徑\n"
+msgstr[0] "已還原 %d 個路徑\n"
#: add-interactive.c git-add--interactive.perl
#, c-format
@@ -107,28 +110,28 @@ msgstr "沒有未追蹤的檔案。\n"
#: add-interactive.c git-add--interactive.perl
msgid "Add untracked"
-msgstr "新增未追蹤的"
+msgstr "加入未追蹤項目"
#: add-interactive.c git-add--interactive.perl
#, c-format, perl-format
msgid "added %d path\n"
msgid_plural "added %d paths\n"
-msgstr[0] "增加了 %d 個路徑\n"
+msgstr[0] "已加入 %d 個路徑\n"
#: add-interactive.c
#, c-format
msgid "ignoring unmerged: %s"
-msgstr "忽略未åˆä½µï¼š%s"
+msgstr "忽略未åˆä½µé …目:%s"
#: add-interactive.c add-patch.c git-add--interactive.perl
#, c-format
msgid "Only binary files changed.\n"
-msgstr "åªæœ‰äºŒé€²ä½æª”案被修改。\n"
+msgstr "åªè®Šæ›´äºŒé€²ä½æª”案。\n"
#: add-interactive.c add-patch.c git-add--interactive.perl
#, c-format
msgid "No changes.\n"
-msgstr "沒有修改。\n"
+msgstr "沒有更動。\n"
#: add-interactive.c git-add--interactive.perl
msgid "Patch update"
@@ -136,19 +139,19 @@ msgstr "修補檔更新"
#: add-interactive.c git-add--interactive.perl
msgid "Review diff"
-msgstr "檢視 diff"
+msgstr "檢閱差異"
#: add-interactive.c
msgid "show paths with changes"
-msgstr "顯示有變更的路徑"
+msgstr "顯示有更動的路徑"
#: add-interactive.c
msgid "add working tree state to the staged set of changes"
-msgstr "加入工作å€ç‹€æ…‹è‡³æš«å­˜åˆ—表"
+msgstr "將工作å€ç‹€æ…‹åŠ å…¥è‡³æš«å­˜æ›´å‹•é›†"
#: add-interactive.c
msgid "revert staged set of changes back to the HEAD version"
-msgstr "還原修改的暫存集至 HEAD 版本"
+msgstr "將暫存的更動集還原回 HEAD 版本"
#: add-interactive.c
msgid "pick hunks and update selectively"
@@ -160,7 +163,7 @@ msgstr "檢視 HEAD åŠç´¢å¼•ä¹‹é–“的差異"
#: add-interactive.c
msgid "add contents of untracked files to the staged set of changes"
-msgstr "加入未追蹤檔案的內容至暫存列表"
+msgstr "將未追蹤檔案的內容加入至更動暫存集"
#: add-interactive.c
msgid "Prompt help:"
@@ -168,23 +171,23 @@ msgstr "æ示說明:"
#: add-interactive.c
msgid "select a single item"
-msgstr "é¸æ“‡å–®ä¸€é …ç›®"
+msgstr "é¸å–一個項目"
#: add-interactive.c
msgid "select a range of items"
-msgstr "é¸æ“‡é …目範åœ"
+msgstr "é¸å–範åœä¸­é …ç›®"
#: add-interactive.c
msgid "select multiple ranges"
-msgstr "é¸æ“‡å¤šå€‹ç¯„åœ"
+msgstr "é¸å–多個範åœ"
#: add-interactive.c
msgid "select item based on unique prefix"
-msgstr "基於唯一å‰ç¶´é¸æ“‡é …ç›®"
+msgstr "根據ç¨ç‰¹å‰ç¶´é¸å–é …ç›®"
#: add-interactive.c
msgid "unselect specified items"
-msgstr "å–消é¸æ“‡æŒ‡å®šé …ç›®"
+msgstr "å–消é¸å–指定項目"
#: add-interactive.c
msgid "choose all items"
@@ -196,15 +199,15 @@ msgstr "(空)完æˆé¸å–"
#: add-interactive.c
msgid "select a numbered item"
-msgstr "é¸æ“‡ç·¨è™ŸéŽçš„é …ç›®"
+msgstr "é¸å–編號éŽçš„é …ç›®"
#: add-interactive.c
msgid "(empty) select nothing"
-msgstr "(空)全ä¸é¸å–"
+msgstr "(空)全部ä¸é¸å–"
#: add-interactive.c builtin/clean.c git-add--interactive.perl
msgid "*** Commands ***"
-msgstr "*** 指令 ***"
+msgstr "*** 命令 ***"
#: add-interactive.c builtin/clean.c git-add--interactive.perl
msgid "What now"
@@ -212,11 +215,11 @@ msgstr "è«‹é¸æ“‡"
#: add-interactive.c git-add--interactive.perl
msgid "staged"
-msgstr "å¿«å–"
+msgstr "已暫存"
#: add-interactive.c git-add--interactive.perl
msgid "unstaged"
-msgstr "未快å–"
+msgstr "未暫存"
#: add-interactive.c apply.c builtin/am.c builtin/bugreport.c builtin/clone.c
#: builtin/diagnose.c builtin/fetch.c builtin/merge.c builtin/pull.c
@@ -236,17 +239,17 @@ msgstr "å†è¦‹ã€‚\n"
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Stage mode change [y,n,q,a,d%s,?]? "
-msgstr "暫存模å¼è®Šæ›´ [y,n,q,a,d%s,?]? "
+msgstr "暫存模å¼æ›´å‹• [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Stage deletion [y,n,q,a,d%s,?]? "
-msgstr "暫存刪除變更 [y,n,q,a,d%s,?]? "
+msgstr "暫存刪除動作 [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Stage addition [y,n,q,a,d%s,?]? "
-msgstr "暫存新增變更 [y,n,q,a,d%s,?]? "
+msgstr "暫存加入動作 [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
@@ -257,7 +260,7 @@ msgstr "暫存此å€å¡Š [y,n,q,a,d%s,?]? "
msgid ""
"If the patch applies cleanly, the edited hunk will immediately be marked for "
"staging."
-msgstr "如果修補檔能乾淨地套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºæš«å­˜ã€‚"
+msgstr "如果修補檔能完全套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºæš«å­˜ã€‚"
#: add-patch.c
msgid ""
@@ -276,28 +279,28 @@ msgstr ""
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Stash mode change [y,n,q,a,d%s,?]? "
-msgstr "儲è—模å¼è®Šæ›´ [y,n,q,a,d%s,?]? "
+msgstr "貯存模å¼æ›´å‹• [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Stash deletion [y,n,q,a,d%s,?]? "
-msgstr "儲è—刪除變更 [y,n,q,a,d%s,?]? "
+msgstr "貯存刪除動作 [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Stash addition [y,n,q,a,d%s,?]? "
-msgstr "儲è—新增變更 [y,n,q,a,d%s,?]? "
+msgstr "貯存加入動作 [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Stash this hunk [y,n,q,a,d%s,?]? "
-msgstr "儲è—æ­¤å€å¡Š [y,n,q,a,d%s,?]? "
+msgstr "貯存此å€å¡Š [y,n,q,a,d%s,?]? "
#: add-patch.c
msgid ""
"If the patch applies cleanly, the edited hunk will immediately be marked for "
"stashing."
-msgstr "如果修補檔能乾淨地套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºå„²è—。"
+msgstr "如果修補檔能完全套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºè²¯å­˜ã€‚"
#: add-patch.c
msgid ""
@@ -307,26 +310,26 @@ msgid ""
"a - stash this hunk and all later hunks in the file\n"
"d - do not stash this hunk or any of the later hunks in the file\n"
msgstr ""
-"y - 儲è—æ­¤å€å¡Š\n"
-"n - ä¸è¦å„²è—æ­¤å€å¡Š\n"
-"q - 離開。ä¸å„²è—æ­¤å€å¡ŠåŠå¾Œé¢çš„全部å€å¡Š\n"
-"a - 儲è—æ­¤å€å¡Šå’Œæœ¬æª”案中後é¢çš„全部å€å¡Š\n"
-"d - ä¸å„²è—æ­¤å€å¡Šå’Œæœ¬æª”案中後é¢çš„全部å€å¡Š\n"
+"y - 貯存此å€å¡Š\n"
+"n - ä¸è¦è²¯å­˜æ­¤å€å¡Š\n"
+"q - 離開。ä¸è²¯å­˜æ­¤å€å¡ŠåŠå¾Œé¢çš„全部å€å¡Š\n"
+"a - 貯存此å€å¡Šå’Œæœ¬æª”案中後é¢çš„全部å€å¡Š\n"
+"d - ä¸è²¯å­˜æ­¤å€å¡Šå’Œæœ¬æª”案中後é¢çš„全部å€å¡Š\n"
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Unstage mode change [y,n,q,a,d%s,?]? "
-msgstr "å–消暫存模å¼è®Šæ›´ [y,n,q,a,d%s,?]? "
+msgstr "å–消暫存模å¼æ›´å‹• [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Unstage deletion [y,n,q,a,d%s,?]? "
-msgstr "å–消暫存刪除變更 [y,n,q,a,d%s,?]? "
+msgstr "å–消暫存刪除動作 [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Unstage addition [y,n,q,a,d%s,?]? "
-msgstr "å–消暫存新增變更 [y,n,q,a,d%s,?]? "
+msgstr "å–消暫存加入動作 [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
@@ -337,7 +340,7 @@ msgstr "å–消暫存此å€å¡Š [y,n,q,a,d%s,?]? "
msgid ""
"If the patch applies cleanly, the edited hunk will immediately be marked for "
"unstaging."
-msgstr "如果修補檔能乾淨地套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºæœªæš«å­˜ã€‚"
+msgstr "如果修補檔能完全套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºæœªæš«å­˜ã€‚"
#: add-patch.c
msgid ""
@@ -356,17 +359,17 @@ msgstr ""
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Apply mode change to index [y,n,q,a,d%s,?]? "
-msgstr "將模å¼è®Šæ›´å¥—用到索引 [y,n,q,a,d%s,?]? "
+msgstr "將模å¼æ›´å‹•å¥—用到索引 [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Apply deletion to index [y,n,q,a,d%s,?]? "
-msgstr "將刪除變更套用到索引 [y,n,q,a,d%s,?]? "
+msgstr "將刪除動作套用至索引 [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Apply addition to index [y,n,q,a,d%s,?]? "
-msgstr "套用新增變更至索引 [y,n,q,a,d%s,?]? "
+msgstr "將加入動作套用至索引 [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
@@ -377,7 +380,7 @@ msgstr "將此å€å¡Šå¥—用到索引 [y,n,q,a,d%s,?]? "
msgid ""
"If the patch applies cleanly, the edited hunk will immediately be marked for "
"applying."
-msgstr "如果修補檔能乾淨地套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºå¥—用。"
+msgstr "如果修補檔能完全套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºå¥—用。"
#: add-patch.c
msgid ""
@@ -396,28 +399,28 @@ msgstr ""
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Discard mode change from worktree [y,n,q,a,d%s,?]? "
-msgstr "從工作å€ä¸­æ¨æ£„模å¼è®Šæ›´ [y,n,q,a,d%s,?]? "
+msgstr "從工作å€æ¨æ£„模å¼æ›´å‹• [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Discard deletion from worktree [y,n,q,a,d%s,?]? "
-msgstr "從工作å€ä¸­æ¨æ£„刪除變更 [y,n,q,a,d%s,?]? "
+msgstr "從工作å€æ¨æ£„刪除動作 [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Discard addition from worktree [y,n,q,a,d%s,?]? "
-msgstr "放棄工作目錄的新增變更 [y,n,q,a,d%s,?]? "
+msgstr "從工作å€æ¨æ£„加入動作 [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Discard this hunk from worktree [y,n,q,a,d%s,?]? "
-msgstr "從工作å€ä¸­æ¨æ£„æ­¤å€å¡Š [y,n,q,a,d%s,?]? "
+msgstr "從工作å€æ¨æ£„æ­¤å€å¡Š [y,n,q,a,d%s,?]? "
#: add-patch.c
msgid ""
"If the patch applies cleanly, the edited hunk will immediately be marked for "
"discarding."
-msgstr "如果修補檔能乾淨地套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºæ¨æ£„。"
+msgstr "如果修補檔能完全套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºæ¨æ£„。"
#: add-patch.c
msgid ""
@@ -436,22 +439,22 @@ msgstr ""
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Discard mode change from index and worktree [y,n,q,a,d%s,?]? "
-msgstr "從索引和工作å€ä¸­æ¨æ£„模å¼è®Šæ›´ [y,n,q,a,d%s,?]? "
+msgstr "從索引和工作å€æ¨æ£„模å¼æ›´å‹• [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Discard deletion from index and worktree [y,n,q,a,d%s,?]? "
-msgstr "從索引和工作å€ä¸­æ¨æ£„刪除 [y,n,q,a,d%s,?]? "
+msgstr "從索引和工作å€æ¨æ£„刪除 [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Discard addition from index and worktree [y,n,q,a,d%s,?]? "
-msgstr "放棄索引åŠå·¥ä½œç›®éŒ„的新增變更 [y,n,q,a,d%s,?]? "
+msgstr "從索引和工作å€æ¨æ£„加入動作 [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Discard this hunk from index and worktree [y,n,q,a,d%s,?]? "
-msgstr "從索引和工作å€ä¸­æ¨æ£„æ­¤å€å¡Š [y,n,q,a,d%s,?]? "
+msgstr "從索引和工作å€æ¨æ£„æ­¤å€å¡Š [y,n,q,a,d%s,?]? "
#: add-patch.c
msgid ""
@@ -470,17 +473,17 @@ msgstr ""
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Apply mode change to index and worktree [y,n,q,a,d%s,?]? "
-msgstr "將模å¼è®Šæ›´å¥—ç”¨åˆ°ç´¢å¼•å’Œå·¥ä½œå€ [y,n,q,a,d%s,?]? "
+msgstr "將模å¼æ›´å‹•å¥—ç”¨åˆ°ç´¢å¼•å’Œå·¥ä½œå€ [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Apply deletion to index and worktree [y,n,q,a,d%s,?]? "
-msgstr "å°‡åˆªé™¤è®Šæ›´å¥—ç”¨åˆ°ç´¢å¼•å’Œå·¥ä½œå€ [y,n,q,a,d%s,?]? "
+msgstr "å°‡åˆªé™¤å‹•ä½œå¥—ç”¨åˆ°ç´¢å¼•å’Œå·¥ä½œå€ [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Apply addition to index and worktree [y,n,q,a,d%s,?]? "
-msgstr "套用索引åŠå·¥ä½œç›®éŒ„的新增變更 [y,n,q,a,d%s,?]? "
+msgstr "å°‡åŠ å…¥å‹•ä½œå¥—ç”¨åˆ°ç´¢å¼•å’Œå·¥ä½œå€ [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
@@ -504,17 +507,17 @@ msgstr ""
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Apply mode change to worktree [y,n,q,a,d%s,?]? "
-msgstr "將模å¼è®Šæ›´å¥—ç”¨åˆ°å·¥ä½œå€ [y,n,q,a,d%s,?]? "
+msgstr "將模å¼æ›´å‹•å¥—ç”¨åˆ°å·¥ä½œå€ [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Apply deletion to worktree [y,n,q,a,d%s,?]? "
-msgstr "å°‡åˆªé™¤è®Šæ›´å¥—ç”¨åˆ°å·¥ä½œå€ [y,n,q,a,d%s,?]? "
+msgstr "å°‡åˆªé™¤å‹•ä½œå¥—ç”¨åˆ°å·¥ä½œå€ [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
msgid "Apply addition to worktree [y,n,q,a,d%s,?]? "
-msgstr "å°‡æ–°å¢žè®Šæ›´å¥—ç”¨åˆ°å·¥ä½œå€ [y,n,q,a,d%s,?]? "
+msgstr "å°‡åŠ å…¥å‹•ä½œå¥—ç”¨åˆ°å·¥ä½œå€ [y,n,q,a,d%s,?]? "
#: add-patch.c git-add--interactive.perl
#, c-format, perl-format
@@ -538,20 +541,20 @@ msgstr ""
#: add-patch.c
#, c-format
msgid "could not parse hunk header '%.*s'"
-msgstr "無法解æžå€å¡Šæ¨™é ­ '%.*s'"
+msgstr "無法解æžå€å¡Šæ¨™é ­ “%.*sâ€"
#: add-patch.c
msgid "could not parse diff"
-msgstr "無法解æžå·®ç•° (diff)"
+msgstr "無法解æžå·®ç•°"
#: add-patch.c
msgid "could not parse colored diff"
-msgstr "無法解æžä¸Šè‰²éŽçš„差異 (diff)"
+msgstr "無法解æžä¸Šè‰²éŽçš„差異"
#: add-patch.c
#, c-format
msgid "failed to run '%s'"
-msgstr "無法執行 '%s'"
+msgstr "無法執行 “%sâ€"
#: add-patch.c
msgid "mismatched output from interactive.diffFilter"
@@ -562,7 +565,7 @@ msgid ""
"Your filter must maintain a one-to-one correspondence\n"
"between its input and output lines."
msgstr ""
-"您的éŽæ¿¾å™¨å¿…須在其輸入åŠè¼¸å‡ºè¡Œ\n"
+"您的éŽæ¿¾å™¨å¿…須在其輸入åŠè¼¸å‡ºåˆ—\n"
"維æŒä¸€å°ä¸€çš„å°æ‡‰é—œä¿‚。"
#: add-patch.c
@@ -571,7 +574,7 @@ msgid ""
"expected context line #%d in\n"
"%.*s"
msgstr ""
-"應有上下文行 #%d 於\n"
+"é æœŸåœ¨ä¸‹è¿°ä½ç½®æœ‰ä¸Šä¸‹æ–‡åˆ— #%d:\n"
"%.*s"
#: add-patch.c
@@ -584,12 +587,12 @@ msgid ""
msgstr ""
"å€å¡Šæœªé‡ç–Šï¼š\n"
"%.*s\n"
-"\tä¸ä»¥ä¸‹è¿°çµå°¾ï¼š\n"
+"\tçµå°¾ä¸æ˜¯ï¼š\n"
"%.*s"
#: add-patch.c git-add--interactive.perl
msgid "Manual hunk edit mode -- see bottom for a quick guide.\n"
-msgstr "手動å€å¡Šç·¨è¼¯æ¨¡å¼ -- 檢視底部的快速指å—。\n"
+msgstr "手動å€å¡Šç·¨è¼¯æ¨¡å¼â€”—檢視底部的快速指引。\n"
#: add-patch.c
#, c-format
@@ -600,9 +603,9 @@ msgid ""
"Lines starting with %c will be removed.\n"
msgstr ""
"---\n"
-"è¦åˆªé™¤ '%c' 開始的行,使其æˆç‚º ' ' 開始的行(上下文)。\n"
-"è¦åˆªé™¤ '%c' 開始的行,刪除它們。\n"
-"以 %c 開始的行將被刪除。\n"
+"è¦åˆªé™¤ “%c†開頭的列,請將列首(上下文)改æˆç©ºç™½ã€‚\n"
+"è¦åˆªé™¤ “%c†開頭的列,請直接刪除。\n"
+"開頭是 %c 的列將會被移除。\n"
#. #-#-#-#-# git-add--interactive.perl.po #-#-#-#-#
#. TRANSLATORS: 'it' refers to the patch mentioned in the previous messages.
@@ -612,9 +615,9 @@ msgid ""
"edit again. If all lines of the hunk are removed, then the edit is\n"
"aborted and the hunk is left unchanged.\n"
msgstr ""
-"如果未乾淨套用,您就有機會é‡æ–°ç·¨è¼¯ã€‚\n"
-"若刪掉此å€å¡Šçš„全部內容,則會中止\n"
-"本次編輯,å€å¡Šå‰‡ä¸æœƒè¢«ä¿®æ”¹ã€‚\n"
+"如果沒有完全套用,您å¯ä»¥å†æ¬¡ç·¨è¼¯ã€‚\n"
+"若刪掉此å€å¡Šçš„所有內容,則會中止編輯,\n"
+"å€å¡Šå‰‡ä¸æœƒè®Šæ›´ã€‚\n"
#: add-patch.c
msgid "could not parse hunk header"
@@ -622,7 +625,7 @@ msgstr "無法解æžå€å¡Šæ¨™é ­"
#: add-patch.c
msgid "'git apply --cached' failed"
-msgstr "「git apply --cachedã€å¤±æ•—"
+msgstr "“git apply --cached†失敗"
#. #-#-#-#-# add-patch.c.po #-#-#-#-#
#. TRANSLATORS: do not translate [y/n]
@@ -641,15 +644,15 @@ msgstr "「git apply --cachedã€å¤±æ•—"
#: add-patch.c git-add--interactive.perl
msgid ""
"Your edited hunk does not apply. Edit again (saying \"no\" discards!) [y/n]? "
-msgstr "未套用編輯å€å¡Šã€‚是å¦é‡æ–°ç·¨è¼¯ï¼ˆè¼¸å…¥ “no†æ¨æ£„ï¼ï¼‰ [y/n]? "
+msgstr "未套用您編輯的å€å¡Šã€‚是å¦é‡æ–°ç·¨è¼¯ï¼ˆè¼¸å…¥ “no†æ¨æ£„ï¼ï¼‰ [y/n]? "
#: add-patch.c
msgid "The selected hunks do not apply to the index!"
-msgstr "é¸å–çš„å€å¡Šä¸æœƒå¥—用進索引ï¼"
+msgstr "é¸å–çš„å€å¡Šç„¡æ³•å¥—用至索引ï¼"
#: add-patch.c git-add--interactive.perl
msgid "Apply them to the worktree anyway? "
-msgstr "無論如何都è¦å¥—用到工作å€å—Žï¼Ÿ "
+msgstr "無論如何都è¦å¥—用到工作å€å—Ž? "
#: add-patch.c git-add--interactive.perl
msgid "Nothing was applied.\n"
@@ -687,20 +690,20 @@ msgstr "沒有下一個å€å¡Š"
#: add-patch.c
msgid "No other hunks to goto"
-msgstr "沒有其它å¯ä¾›è·³è½‰çš„å€å¡Š"
+msgstr "沒有其它å¯ä»¥è·³è½‰çš„å€å¡Š"
#: add-patch.c git-add--interactive.perl
msgid "go to which hunk (<ret> to see more)? "
-msgstr "è¦è·³è½‰åˆ°å“ªå€‹å€å¡Šï¼ˆ<Enter> 檢視更多)? "
+msgstr "è¦è·³è½‰åˆ°å“ªå€‹å€å¡Šï¼ˆ<ret> 檢視更多)? "
#: add-patch.c git-add--interactive.perl
msgid "go to which hunk? "
-msgstr "跳轉到哪個å€å¡Šï¼Ÿ "
+msgstr "跳轉到哪個å€å¡Š? "
#: add-patch.c
#, c-format
msgid "Invalid number: '%s'"
-msgstr "無效數字:'%s'"
+msgstr "無效數字:“%sâ€"
#: add-patch.c
#, c-format
@@ -710,20 +713,20 @@ msgstr[0] "å°ä¸èµ·ï¼Œåªæœ‰ %d 個å¯ç”¨å€å¡Šã€‚"
#: add-patch.c
msgid "No other hunks to search"
-msgstr "沒有其它å¯ä¾›å°‹æ‰¾çš„å€å¡Š"
+msgstr "沒有其它å¯ä»¥å°‹æ‰¾çš„å€å¡Š"
#: add-patch.c git-add--interactive.perl
msgid "search for regex? "
-msgstr "使用常è¦è¡¨ç¤ºå¼æœå°‹ï¼Ÿ "
+msgstr "使用常è¦è¡¨ç¤ºå¼æœå°‹? "
#: add-patch.c
#, c-format
msgid "Malformed search regexp %s: %s"
-msgstr "錯誤的常è¦è¡¨ç¤ºå¼ %s:%s"
+msgstr "æ ¼å¼éŒ¯èª¤çš„常è¦è¡¨ç¤ºå¼ %s:%s"
#: add-patch.c
msgid "No hunk matches the given pattern"
-msgstr "沒有和æ供模å¼ç›¸ç¬¦åˆçš„å€å¡Š"
+msgstr "沒有符åˆæ供模å¼çš„å€å¡Š"
#: add-patch.c
msgid "Sorry, cannot split this hunk"
@@ -736,11 +739,11 @@ msgstr "分割為 %d 個å€å¡Šã€‚"
#: add-patch.c
msgid "Sorry, cannot edit this hunk"
-msgstr "å°ä¸èµ·ï¼Œä¸èƒ½ç·¨è¼¯é€™å€‹å€å¡Š"
+msgstr "å°ä¸èµ·ï¼Œç„¡æ³•ç·¨è¼¯é€™å€‹å€å¡Š"
#: add-patch.c
msgid "'git apply' failed"
-msgstr "'git apply' 失敗"
+msgstr "“git apply†失敗"
#: advice.c
#, c-format
@@ -749,7 +752,7 @@ msgid ""
"Disable this message with \"git config advice.%s false\""
msgstr ""
"\n"
-"請使用「git config advice.%s falseã€ä¾†åœç”¨æ­¤è¨Šæ¯"
+"請使用 “git config advice.%s false†åœç”¨æ­¤è¨Šæ¯"
#: advice.c
#, c-format
@@ -758,56 +761,56 @@ msgstr "%sæ示:%.*s%s\n"
#: advice.c
msgid "Cherry-picking is not possible because you have unmerged files."
-msgstr "無法æ€é¸ï¼Œå› ç‚ºæ‚¨æœ‰æœªåˆä½µçš„檔案。"
+msgstr "無法æ€é¸ï¼Œæœ‰æœªåˆä½µçš„檔案。"
#: advice.c
msgid "Committing is not possible because you have unmerged files."
-msgstr "無法æ交,因為您有未åˆä½µçš„檔案。"
+msgstr "無法æ交,有未åˆä½µçš„檔案。"
#: advice.c
msgid "Merging is not possible because you have unmerged files."
-msgstr "無法åˆä½µï¼Œå› ç‚ºæ‚¨æœ‰æœªåˆä½µçš„檔案。"
+msgstr "無法åˆä½µï¼Œæœ‰æœªåˆä½µçš„檔案。"
#: advice.c
msgid "Pulling is not possible because you have unmerged files."
-msgstr "無法拉å–,因為您有未åˆä½µçš„檔案。"
+msgstr "無法拉å–,有未åˆä½µçš„檔案。"
#: advice.c
msgid "Reverting is not possible because you have unmerged files."
-msgstr "無法還原æ交,因為您有未åˆä½µçš„檔案。"
+msgstr "無法還原æ交,有未åˆä½µçš„檔案。"
#: advice.c
#, c-format
msgid "It is not possible to %s because you have unmerged files."
-msgstr "無法 %s,因為您有未åˆä½µçš„檔案。"
+msgstr "無法 %s,有未åˆä½µçš„檔案。"
#: advice.c
msgid ""
"Fix them up in the work tree, and then use 'git add/rm <file>'\n"
"as appropriate to mark resolution and make a commit."
msgstr ""
-"請在工作å€æ”¹æ­£æª”案,然後酌情使用 'git add/rm <檔案>' 指令標記\n"
-"解決方案並æ交。"
+"請在工作å€ä¿®æ­£æª”案,然後視情æ³ä½¿ç”¨ “git add/rm <file>â€\n"
+"命令標記解決方案並æ交。"
#: advice.c
msgid "Exiting because of an unresolved conflict."
-msgstr "因為存在未解決的è¡çªè€Œé›¢é–‹ã€‚"
+msgstr "存在未解決的è¡çªï¼Œé›¢é–‹ã€‚"
#: advice.c builtin/merge.c
msgid "You have not concluded your merge (MERGE_HEAD exists)."
-msgstr "您尚未çµæŸæ‚¨çš„åˆä½µï¼ˆå­˜åœ¨ MERGE_HEAD)。"
+msgstr "åˆä½µå°šæœªçµæŸï¼ˆæœ‰ MERGE_HEAD)。"
#: advice.c
msgid "Please, commit your changes before merging."
-msgstr "請在åˆä½µå‰å…ˆæ交您的修改。"
+msgstr "請在åˆä½µå‰å…ˆæ交您的更動。"
#: advice.c
msgid "Exiting because of unfinished merge."
-msgstr "因為存在未完æˆçš„åˆä½µè€Œé›¢é–‹ã€‚"
+msgstr "存在未完æˆçš„åˆä½µï¼Œé›¢é–‹ã€‚"
#: advice.c
msgid "Not possible to fast-forward, aborting."
-msgstr "無法快轉,終止。"
+msgstr "無法快轉,中止。"
#: advice.c
#, c-format
@@ -852,18 +855,18 @@ msgid ""
"false\n"
"\n"
msgstr ""
-"注æ„:正在切æ›åˆ° '%s'。\n"
+"註:切æ›è‡³ “%sâ€ã€‚\n"
"\n"
-"您正處於分離開頭指標狀態。您å¯ä»¥æª¢è¦–ã€é€²è¡Œå¯¦é©—性修改並æ交,\n"
-"而且您å¯ä»¥åœ¨åˆ‡æ›å›žä¸€å€‹åˆ†æ”¯æ™‚,\n"
-"æ¨æ£„在此狀態下所åšçš„æ交而ä¸å°åˆ†æ”¯é€ æˆå½±éŸ¿ã€‚\n"
+"您正處於「分離 HEADã€ç‹€æ…‹ã€‚您å¯ä»¥æª¢è¦–ã€é€²è¡Œå¯¦é©—性修改並æ交,\n"
+"而且您å¯ä»¥åœ¨åˆ‡å›žåˆ†æ”¯æ™‚,æ¨æ£„在此狀態下所åšçš„æ交\n"
+"而ä¸å°åˆ†æ”¯é€ æˆå½±éŸ¿ã€‚\n"
"\n"
"如果您想è¦é€éŽå»ºç«‹åˆ†æ”¯ä¾†ä¿ç•™åœ¨æ­¤ç‹€æ…‹ä¸‹æ‰€åšçš„æ交,\n"
"您å¯ä»¥ç¾åœ¨æˆ–ç¨å¾Œåœ¨ switch 指令使用 -c é¸é …。例如:\n"
"\n"
" git switch -c <新分支å稱>\n"
"\n"
-"或者是復原此動作:\n"
+"或者是使用下述命令復原此動作:\n"
"\n"
" git switch -\n"
"\n"
@@ -887,26 +890,31 @@ msgid ""
"* Use \"git sparse-checkout reapply\" to apply the sparsity rules"
msgstr ""
"è‹¥è¦æ›´æ­£é€™äº›è·¯å¾‘的稀ç–狀態,請:\n"
-"* 使用 `git add --sparse <路徑>` 更新索引\n"
-"* 使用 `git sparse-checkout reapply` 套用稀ç–è¦å‰‡"
+"* 使用 “git add --sparse <路徑†更新索引\n"
+"* 使用 “git sparse-checkout reapply†套用稀ç–è¦å‰‡"
#: alias.c
msgid "cmdline ends with \\"
-msgstr "指令列以 \\ çµå°¾"
+msgstr "命令列以 \\ çµå°¾"
#: alias.c
msgid "unclosed quote"
msgstr "未閉åˆçš„引號"
+#: alias.c builtin/cat-file.c builtin/notes.c builtin/prune-packed.c
+#: builtin/receive-pack.c builtin/tag.c
+msgid "too many arguments"
+msgstr "引數éŽå¤š"
+
#: apply.c
#, c-format
msgid "unrecognized whitespace option '%s'"
-msgstr "無法識別的空白字元é¸é … '%s'"
+msgstr "空白字元é¸é … “%s†無法識別"
#: apply.c
#, c-format
msgid "unrecognized whitespace ignore option '%s'"
-msgstr "無法識別的空白字元忽略é¸é … '%s'"
+msgstr "空白字元忽略é¸é … “%s†無法識別"
#: apply.c archive.c builtin/add.c builtin/branch.c builtin/checkout.c
#: builtin/clone.c builtin/commit.c builtin/describe.c builtin/diff-tree.c
@@ -918,12 +926,12 @@ msgstr "無法識別的空白字元忽略é¸é … '%s'"
#: builtin/tag.c builtin/worktree.c parse-options.c range-diff.c revision.c
#, c-format
msgid "options '%s' and '%s' cannot be used together"
-msgstr "ä¸èƒ½åŒæ™‚使用 '%s' å’Œ '%s' é¸é …"
+msgstr "無法åŒæ™‚使用 “%s†和 “%s†é¸é …"
#: apply.c
#, c-format
msgid "'%s' outside a repository"
-msgstr "'%s' 在版本庫之外"
+msgstr "“%s†在版本庫之外"
#: apply.c
#, c-format
@@ -933,42 +941,42 @@ msgstr "無法準備時間戳常è¦è¡¨ç¤ºå¼ %s"
#: apply.c
#, c-format
msgid "regexec returned %d for input: %s"
-msgstr "regexec 返回 %d,輸入為:%s"
+msgstr "regexec 回傳 %d,輸入為:%s"
#: apply.c
#, c-format
msgid "unable to find filename in patch at line %d"
-msgstr "ä¸èƒ½åœ¨ä¿®è£œæª”的第 %d 行找到檔案å"
+msgstr "無法在修補檔的第 %d 列找到檔案å稱"
#: apply.c
#, c-format
msgid "git apply: bad git-diff - expected /dev/null, got %s on line %d"
-msgstr "git apply:錯誤的 git-diff - 應為 /dev/null,但在第 %2$d 行得到 %1$s"
+msgstr "git apply:無效的 git-diff — 應為 /dev/null,但在第 %2$d 列得到 %1$s"
#: apply.c
#, c-format
msgid "git apply: bad git-diff - inconsistent new filename on line %d"
-msgstr "git apply:錯誤的 git-diff - 第 %d 行上新檔案åä¸ä¸€è‡´"
+msgstr "git apply:無效的 git-diff — 第 %d 列的新檔案å稱ä¸ä¸€è‡´"
#: apply.c
#, c-format
msgid "git apply: bad git-diff - inconsistent old filename on line %d"
-msgstr "git apply:錯誤的 git-diff - 第 %d 行上舊檔案åä¸ä¸€è‡´"
+msgstr "git apply:無效的 git-diff — 第 %d 列上舊檔案å稱ä¸ä¸€è‡´"
#: apply.c
#, c-format
msgid "git apply: bad git-diff - expected /dev/null on line %d"
-msgstr "git apply:錯誤的 git-diff - 第 %d 行處應為 /dev/null"
+msgstr "git apply:無效的 git-diff — 第 %d 列處é æœŸæ˜¯ /dev/null"
#: apply.c
#, c-format
msgid "invalid mode on line %d: %s"
-msgstr "第 %d 行包å«ç„¡æ•ˆæª”案模å¼ï¼š%s"
+msgstr "第 %d 列包å«ç„¡æ•ˆæª”案模å¼ï¼š%s"
#: apply.c
#, c-format
msgid "inconsistent header lines %d and %d"
-msgstr "ä¸ä¸€è‡´çš„檔案頭,%d 行和 %d è¡Œ"
+msgstr "ä¸ä¸€è‡´çš„檔案標頭(%d 列和 %d 列)"
#: apply.c
#, c-format
@@ -978,22 +986,22 @@ msgid ""
msgid_plural ""
"git diff header lacks filename information when removing %d leading pathname "
"components (line %d)"
-msgstr[0] "當移除 %d 個å‰å°Žè·¯å¾‘後 git diff 頭缺ä¹æª”案å訊æ¯ï¼ˆç¬¬ %d 行)"
+msgstr[0] "移除 %d 個å‰å°Žè·¯å¾‘部分後,git diff 標頭缺少檔案å稱資訊(第 %d 列)"
#: apply.c
#, c-format
msgid "git diff header lacks filename information (line %d)"
-msgstr "git diff 的標頭訊æ¯ä¸­ç¼ºä¹æª”案å訊æ¯ï¼ˆç¬¬ %d 行)"
+msgstr "git diff 標頭缺少檔案å稱資訊(第 %d 列)"
#: apply.c
#, c-format
msgid "recount: unexpected line: %.*s"
-msgstr "recount:æ„外的行:%.*s"
+msgstr "recount:é‡åˆ°éžé æœŸçš„列:%.*s"
#: apply.c
#, c-format
msgid "patch fragment without header at line %d: %.*s"
-msgstr "第 %d 行的修補檔å€å¡Šæ²’有標頭訊æ¯ï¼š%.*s"
+msgstr "第 %d 列的修補檔å€æ®µæ²’有標頭:%.*s"
#: apply.c
msgid "new file depends on old contents"
@@ -1006,7 +1014,7 @@ msgstr "刪除的檔案ä»æœ‰å…§å®¹"
#: apply.c
#, c-format
msgid "corrupt patch at line %d"
-msgstr "修補檔在第 %d 行發ç¾æ壞"
+msgstr "修補檔在第 %d 列發ç¾æ壞"
#: apply.c
#, c-format
@@ -1026,17 +1034,17 @@ msgstr "** 警告:檔案 %s æˆç‚ºç©ºæª”案但並未刪除"
#: apply.c
#, c-format
msgid "corrupt binary patch at line %d: %.*s"
-msgstr "二進ä½ä¿®è£œæª”在第 %d è¡Œæ壞:%.*s"
+msgstr "二進ä½ä¿®è£œæª”在第 %d 列æ壞:%.*s"
#: apply.c
#, c-format
msgid "unrecognized binary patch at line %d"
-msgstr "無法識別的二進ä½ä¿®è£œæª”ä½æ–¼ç¬¬ %d è¡Œ"
+msgstr "第 %d 列的二進ä½ä¿®è£œæª”無法識別"
#: apply.c
#, c-format
msgid "patch with only garbage at line %d"
-msgstr "修補檔案的第 %d è¡Œåªæœ‰åžƒåœ¾è³‡æ–™"
+msgstr "修補檔案的第 %d 列åªæœ‰åžƒåœ¾è³‡æ–™"
#: apply.c
#, c-format
@@ -1046,23 +1054,23 @@ msgstr "無法讀å–ç¬¦è™Ÿé€£çµ %s"
#: apply.c
#, c-format
msgid "unable to open or read %s"
-msgstr "ä¸èƒ½é–‹å•Ÿæˆ–è®€å– %s"
+msgstr "ç„¡æ³•é–‹å•Ÿæˆ–è®€å– %s"
#: apply.c
#, c-format
msgid "invalid start of line: '%c'"
-msgstr "無效的行首字元:'%c'"
+msgstr "無效的列首字元:“%câ€"
#: apply.c
#, c-format
msgid "Hunk #%d succeeded at %d (offset %d line)."
msgid_plural "Hunk #%d succeeded at %d (offset %d lines)."
-msgstr[0] "å€å¡Š #%d æˆåŠŸå¥—用於 %d(ä½ç§» %d 行)。"
+msgstr[0] "å€å¡Š #%d æˆåŠŸå¥—用於 %d(å移 %d 列)。"
#: apply.c
#, c-format
msgid "Context reduced to (%ld/%ld) to apply fragment at %d"
-msgstr "上下文減少到(%ld/%ld)以在第 %d 行套用修補檔å€å¡Š"
+msgstr "上下文減少到(%ld/%ld)以在第 %d 列套用修補檔å€å¡Š"
#: apply.c
#, c-format
@@ -1076,53 +1084,53 @@ msgstr ""
#: apply.c
#, c-format
msgid "missing binary patch data for '%s'"
-msgstr "缺少 '%s' 的二進ä½ä¿®è£œæª”資料"
+msgstr "缺少 “%s†的二進ä½ä¿®è£œæª”資料"
#: apply.c
#, c-format
msgid "cannot reverse-apply a binary patch without the reverse hunk to '%s'"
-msgstr "ä¸èƒ½åå‘套用一個缺少到 '%s' çš„åå‘資料å€å¡Šçš„二進ä½ä¿®è£œæª”"
+msgstr "無法åå‘套用一個缺少至 “%s†的åå‘資料å€å¡Šçš„二進ä½ä¿®è£œæª”"
#: apply.c
#, c-format
msgid "cannot apply binary patch to '%s' without full index line"
-msgstr "ä¸èƒ½åœ¨ '%s' 上套用沒有完整索引行的二進ä½ä¿®è£œæª”"
+msgstr "無法在 “%s†上套用沒有完整索引列的二進ä½ä¿®è£œæª”"
#: apply.c
#, c-format
msgid ""
"the patch applies to '%s' (%s), which does not match the current contents."
-msgstr "修補檔套用到 '%s'(%s),但是和目å‰å…§å®¹ä¸ç¬¦åˆã€‚"
+msgstr "修補檔è¦å¥—用到 “%sâ€ï¼ˆ%s),但與目å‰å…§å®¹ä¸ç¬¦ã€‚"
#: apply.c
#, c-format
msgid "the patch applies to an empty '%s' but it is not empty"
-msgstr "修補檔套用到空檔案 '%s',但其並éžç©ºæª”案"
+msgstr "修補檔è¦å¥—用至空檔案 “%sâ€ï¼Œä½†å…¶éžç©ºæª”案"
#: apply.c
#, c-format
msgid "the necessary postimage %s for '%s' cannot be read"
-msgstr "ç„¡æ³•è®€å– '%2$s' 必需的目標檔案 %1$s"
+msgstr "ç„¡æ³•è®€å– â€œ%2$s†必須的目標檔案 %1$s"
#: apply.c
#, c-format
msgid "binary patch does not apply to '%s'"
-msgstr "二進ä½ä¿®è£œæª”未套用到 '%s'"
+msgstr "二進ä½ä¿®è£œæª”未套用到 “%sâ€"
#: apply.c
#, c-format
msgid "binary patch to '%s' creates incorrect result (expecting %s, got %s)"
-msgstr "到 '%s' 的二進ä½ä¿®è£œæª”產生了ä¸æ­£ç¢ºçš„çµæžœï¼ˆæ‡‰ç‚º %s,å»ç‚º %s)"
+msgstr "修補 “%s†的二進ä½ä¿®è£œæª”,產生了ä¸æ­£ç¢ºçš„çµæžœï¼ˆé æœŸ %s,å»ç‚º %s)"
#: apply.c
#, c-format
msgid "patch failed: %s:%ld"
-msgstr "打修補檔失敗:%s:%ld"
+msgstr "修補失敗:%s:%ld"
#: apply.c builtin/mv.c
#, c-format
msgid "cannot checkout %s"
-msgstr "ä¸èƒ½ç°½å‡º %s"
+msgstr "無法簽出 %s"
#: apply.c midx.c pack-mtimes.c pack-revindex.c setup.c
#, c-format
@@ -1132,51 +1140,51 @@ msgstr "ç„¡æ³•è®€å– %s"
#: apply.c
#, c-format
msgid "reading from '%s' beyond a symbolic link"
-msgstr "讀å–ä½æ–¼ç¬¦è™Ÿé€£çµä¸­çš„ '%s'"
+msgstr "讀å–符號連çµèƒŒå¾Œçš„ “%sâ€"
#: apply.c
#, c-format
msgid "path %s has been renamed/deleted"
-msgstr "路徑 %s 已經被é‡æ–°å‘½å/刪除"
+msgstr "路徑 %s 已被é‡æ–°å‘½å或刪除"
#: apply.c
#, c-format
msgid "%s: does not exist in index"
-msgstr "%s:ä¸å­˜åœ¨æ–¼ç´¢å¼•ä¸­"
+msgstr "%s:ä¸åœ¨ç´¢å¼•ä¸­"
#: apply.c
#, c-format
msgid "%s: does not match index"
-msgstr "%s:和索引ä¸ç¬¦åˆ"
+msgstr "%s:與索引ä¸ç¬¦"
#: apply.c
msgid "repository lacks the necessary blob to perform 3-way merge."
-msgstr "版本庫缺少用來進行三方åˆä½µæ‰€éœ€è¦çš„資料物件。"
+msgstr "版本庫缺少用來進行三方åˆä½µï¼Œæ‰€éœ€è¦çš„資料物件。"
#: apply.c
#, c-format
msgid "Performing three-way merge...\n"
-msgstr "正在進行三方åˆä½µâ‹¯â‹¯\n"
+msgstr "正在進行三方åˆä½µâ€¦â€¦\n"
#: apply.c
#, c-format
msgid "cannot read the current contents of '%s'"
-msgstr "ç„¡æ³•è®€å– '%s' çš„ç›®å‰å…§å®¹"
+msgstr "ç„¡æ³•è®€å– â€œ%s†目å‰çš„內容"
#: apply.c
#, c-format
msgid "Failed to perform three-way merge...\n"
-msgstr "無法進行三方åˆä½µâ‹¯â‹¯\n"
+msgstr "無法進行三方åˆä½µâ€¦â€¦\n"
#: apply.c
#, c-format
msgid "Applied patch to '%s' with conflicts.\n"
-msgstr "套用修補檔到 '%s' 存在è¡çªã€‚\n"
+msgstr "å·²å¥—ç”¨å° â€œ%s†的修補檔,但有è¡çªã€‚\n"
#: apply.c
#, c-format
msgid "Applied patch to '%s' cleanly.\n"
-msgstr "æˆåŠŸå¥—用修補檔到 '%s'。\n"
+msgstr "å·²å®Œå…¨å¥—ç”¨å° â€œ%s†的修補檔。\n"
#: apply.c
#, c-format
@@ -1185,7 +1193,7 @@ msgstr "回復至直接套用模å¼â‹¯â‹¯\n"
#: apply.c
msgid "removal patch leaves file contents"
-msgstr "移除修補檔ä»ç•™ä¸‹äº†æª”案內容"
+msgstr "移除性的修補檔ä»æœ‰ç•™ä¸‹æª”案內容"
#: apply.c
#, c-format
@@ -1195,117 +1203,117 @@ msgstr "%s:錯誤類型"
#: apply.c
#, c-format
msgid "%s has type %o, expected %o"
-msgstr "%s 的類型是 %o,應為 %o"
+msgstr "%s 的類型是 %o,é æœŸæ˜¯ %o"
#: apply.c read-cache.c
#, c-format
msgid "invalid path '%s'"
-msgstr "無效路徑 '%s'"
+msgstr "路徑 “%s†無效"
#: apply.c
#, c-format
msgid "%s: already exists in index"
-msgstr "%s:已經存在於索引中"
+msgstr "%s:已存在於索引中"
#: apply.c
#, c-format
msgid "%s: already exists in working directory"
-msgstr "%s:已經存在於工作å€ä¸­"
+msgstr "%s:已存在於工作å€ä¸­"
#: apply.c
#, c-format
msgid "new mode (%o) of %s does not match old mode (%o)"
-msgstr "%2$s 的新模å¼ï¼ˆ%1$o)和舊模å¼ï¼ˆ%3$o)ä¸ç¬¦åˆ"
+msgstr "%2$s çš„æ–°æ¨¡å¼ (%1$o) å’ŒèˆŠæ¨¡å¼ (%3$o) ä¸ç¬¦"
#: apply.c
#, c-format
msgid "new mode (%o) of %s does not match old mode (%o) of %s"
-msgstr "%2$s 的新模å¼ï¼ˆ%1$o)和 %4$s 的舊模å¼ï¼ˆ%3$o)ä¸ç¬¦åˆ"
+msgstr "%2$s çš„æ–°æ¨¡å¼ (%1$o) å’Œ %4$s çš„èˆŠæ¨¡å¼ (%3$o) ä¸ç¬¦"
#: apply.c
#, c-format
msgid "affected file '%s' is beyond a symbolic link"
-msgstr "å—影響的檔案 '%s' ä½æ–¼ç¬¦è™Ÿé€£çµä¸­"
+msgstr "å—影響的檔案 “%s†在符號連çµå¾Œ"
#: apply.c
#, c-format
msgid "%s: patch does not apply"
-msgstr "%s:修補檔未套用"
+msgstr "%s:未套用修補檔"
#: apply.c
#, c-format
msgid "Checking patch %s..."
-msgstr "正在檢查修補檔 %s..."
+msgstr "正在檢查修補檔 %s……"
#: apply.c
#, c-format
msgid "sha1 information is lacking or useless for submodule %s"
-msgstr "å­æ¨¡çµ„ %s çš„ sha1 訊æ¯ç¼ºå°‘或無效"
+msgstr "%s å­æ¨¡çµ„缺少 sha1 資訊或沒有幫助"
#: apply.c
#, c-format
msgid "mode change for %s, which is not in current HEAD"
-msgstr "%s 的模å¼è®Šæ›´ï¼Œä½†å®ƒä¸åœ¨ç›®å‰ HEAD 中"
+msgstr "%s 的模å¼æœ‰æ›´å‹•ï¼Œä½†å…¶ä¸åœ¨ç›®å‰ HEAD 中"
#: apply.c
#, c-format
msgid "sha1 information is lacking or useless (%s)."
-msgstr "sha1 訊æ¯ç¼ºå°‘或無效(%s)。"
+msgstr "缺少 sha1 資訊或沒有幫助 (%s)。"
#: apply.c
#, c-format
msgid "could not add %s to temporary index"
-msgstr "ä¸èƒ½åœ¨æš«æ™‚索引中新增 %s"
+msgstr "無法將 %s 加進暫存索引"
#: apply.c
#, c-format
msgid "could not write temporary index to %s"
-msgstr "ä¸èƒ½æŠŠæš«æ™‚索引寫入到 %s"
+msgstr "無法將暫存索引寫入 %s"
#: apply.c
#, c-format
msgid "unable to remove %s from index"
-msgstr "ä¸èƒ½å¾žç´¢å¼•ä¸­ç§»é™¤ %s"
+msgstr "無法從索引移除 %s"
#: apply.c
#, c-format
msgid "corrupt patch for submodule %s"
-msgstr "å­æ¨¡çµ„ %s æ壞的修補檔"
+msgstr "修補 %s å­æ¨¡çµ„的修補檔æ壞"
#: apply.c
#, c-format
msgid "unable to stat newly created file '%s'"
-msgstr "ä¸èƒ½å°å»ºç«‹æª”案 '%s' å‘¼å« stat"
+msgstr "無法å°å‰›å»ºç«‹çš„檔案 “%s†執行 stat"
#: apply.c
#, c-format
msgid "unable to create backing store for newly created file %s"
-msgstr "ä¸èƒ½ç‚ºå»ºç«‹æª”案 %s 建立後端儲存"
+msgstr "無法å°å‰›å»ºç«‹çš„檔案 %s 建立後端儲存"
#: apply.c
#, c-format
msgid "unable to add cache entry for %s"
-msgstr "無法為 %s 新增快å–æ¢ç›®"
+msgstr "無法為 %s 加入快å–é …ç›®"
#: apply.c builtin/bisect--helper.c builtin/gc.c
#, c-format
msgid "failed to write to '%s'"
-msgstr "寫入 '%s' 失敗"
+msgstr "無法寫入 “%sâ€"
#: apply.c
#, c-format
msgid "closing file '%s'"
-msgstr "關閉檔案 '%s'"
+msgstr "關閉檔案 “%sâ€"
#: apply.c
#, c-format
msgid "unable to write file '%s' mode %o"
-msgstr "ä¸èƒ½å¯«å…¥æª”案 '%s' æ¬Šé™ %o"
+msgstr "ç„¡æ³•ä»¥æ¨¡å¼ %2$o 寫入 “%1$s†檔案"
#: apply.c
#, c-format
msgid "Applied patch %s cleanly."
-msgstr "æˆåŠŸå¥—用修補檔 %s。"
+msgstr "已完全套用 %s 修補檔。"
#: apply.c
msgid "internal error"
@@ -1315,22 +1323,22 @@ msgstr "內部錯誤"
#, c-format
msgid "Applying patch %%s with %d reject..."
msgid_plural "Applying patch %%s with %d rejects..."
-msgstr[0] "套用 %%s 個修補檔,其中 %d 個被拒絕..."
+msgstr[0] "套用 %%s 個修補檔,其中 %d 個被拒絕……"
#: apply.c
#, c-format
msgid "truncating .rej filename to %.*s.rej"
-msgstr "截短 .rej 檔案å為 %.*s.rej"
+msgstr "正在將 .rej 檔案å稱截短為 %.*s.rej"
#: apply.c
#, c-format
msgid "cannot open %s"
-msgstr "ä¸èƒ½é–‹å•Ÿ %s"
+msgstr "無法開啟 %s"
#: apply.c
#, c-format
msgid "Hunk #%d applied cleanly."
-msgstr "æˆåŠŸå¥—用第 #%d 個å€å¡Šã€‚"
+msgstr "æˆåŠŸå®Œå…¨å¥—用第 #%d 個å€å¡Šã€‚"
#: apply.c
#, c-format
@@ -1340,20 +1348,20 @@ msgstr "拒絕第 #%d 個å€å¡Šã€‚"
#: apply.c
#, c-format
msgid "Skipped patch '%s'."
-msgstr "ç•¥éŽä¿®è£œæª” '%s'。"
+msgstr "ç•¥éŽä¿®è£œæª” “%sâ€ã€‚"
#: apply.c
msgid "No valid patches in input (allow with \"--allow-empty\")"
-msgstr "輸入中沒有有效的修補檔內容(傳入「--allow-emptyã€å…許)"
+msgstr "輸入沒有有效的修補檔內容(傳入 “--allow-empty†å…許此行為)"
-#: apply.c
+#: apply.c t/helper/test-cache-tree.c
msgid "unable to read index file"
msgstr "無法讀å–索引檔案"
#: apply.c
#, c-format
msgid "can't open patch '%s': %s"
-msgstr "ä¸èƒ½é–‹å•Ÿä¿®è£œæª” '%s':%s"
+msgstr "無法開啟修補檔 “%sâ€ï¼š%s"
#: apply.c
#, c-format
@@ -1365,13 +1373,13 @@ msgstr[0] "抑制下ä»æœ‰ %d 個空白字元誤用"
#, c-format
msgid "%d line adds whitespace errors."
msgid_plural "%d lines add whitespace errors."
-msgstr[0] "%d 行新增了空白字元誤用。"
+msgstr[0] "%d 列加入了空白字元誤用。"
#: apply.c
#, c-format
msgid "%d line applied after fixing whitespace errors."
msgid_plural "%d lines applied after fixing whitespace errors."
-msgstr[0] "修復空白錯誤後,套用了 %d 行。"
+msgstr[0] "修正空白誤用後,套用了 %d 列。"
#: apply.c builtin/add.c builtin/mv.c builtin/rm.c
msgid "Unable to write new index file"
@@ -1379,11 +1387,11 @@ msgstr "無法寫入新索引檔案"
#: apply.c
msgid "don't apply changes matching the given path"
-msgstr "ä¸è¦å¥—用符åˆæ供路徑的變更"
+msgstr "ä¸è¦å¥—用符åˆæ供路徑的更動"
#: apply.c
msgid "apply changes matching the given path"
-msgstr "套用符åˆæ供路徑的變更"
+msgstr "套用符åˆæ供路徑的更動"
#: apply.c builtin/am.c
msgid "num"
@@ -1391,19 +1399,19 @@ msgstr "數字"
#: apply.c
msgid "remove <num> leading slashes from traditional diff paths"
-msgstr "從傳統的 diff 路徑中移除指定數é‡çš„å‰å°Žæ–œç·š"
+msgstr "從傳統的 diff 路徑中移除 <num> 個å‰å°Žæ–œç·š"
#: apply.c
msgid "ignore additions made by the patch"
-msgstr "忽略修補檔中的新增的檔案"
+msgstr "忽略修補檔中的加入內容"
#: apply.c
msgid "instead of applying the patch, output diffstat for the input"
-msgstr "ä¸å¥—用修補檔,而是顯示輸入的差異統計(diffstat)"
+msgstr "ä¸å¥—用修補檔,而是顯示輸入的差異統計 (diffstat)"
#: apply.c
msgid "show number of added and deleted lines in decimal notation"
-msgstr "以å進ä½æ•¸é¡¯ç¤ºæ–°å¢žå’Œåˆªé™¤çš„行數"
+msgstr "以å進ä½æ•¸å­—,顯示加入和刪除的列數"
#: apply.c
msgid "instead of applying the patch, output a summary for the input"
@@ -1419,7 +1427,7 @@ msgstr "確èªä¿®è£œæª”å¯ä»¥å¥—用到目å‰ç´¢å¼•"
#: apply.c
msgid "mark new files with `git add --intent-to-add`"
-msgstr "使用指令 `git add --intent-to-add` 標記新增檔案"
+msgstr "使用 `git add --intent-to-add` 命令標記新檔案"
#: apply.c
msgid "apply a patch without touching the working tree"
@@ -1431,15 +1439,15 @@ msgstr "接å—修改工作å€ä¹‹å¤–檔案的修補檔"
#: apply.c
msgid "also apply the patch (use with --stat/--summary/--check)"
-msgstr "還套用此修補檔(與 --stat/--summary/--check é¸é …åŒæ™‚使用)"
+msgstr "亦套用修補檔(與 --stat/--summary/--check é¸é …åŒæ™‚使用)"
#: apply.c
msgid "attempt three-way merge, fall back on normal patch if that fails"
-msgstr "嘗試三方åˆä½µã€‚如果失敗,則回到正常修補檔 (patch) 模å¼"
+msgstr "嘗試三方åˆä½µï¼Œè‹¥å¤±æ•—則回到正常修補模å¼"
#: apply.c
msgid "build a temporary index based on embedded index information"
-msgstr "建立一個暫時索引基於嵌入的索引訊æ¯"
+msgstr "組建以嵌入索引資訊為基礎的暫存索引"
#: apply.c builtin/checkout-index.c
msgid "paths are separated with NUL character"
@@ -1447,7 +1455,7 @@ msgstr "路徑以 NUL 字元分隔"
#: apply.c
msgid "ensure at least <n> lines of context match"
-msgstr "確ä¿è‡³å°‘ç¬¦åˆ <n> 行上下文"
+msgstr "確ä¿è‡³å°‘ç¬¦åˆ <n> 列上下文"
#: apply.c builtin/am.c builtin/interpret-trailers.c builtin/pack-objects.c
#: builtin/rebase.c
@@ -1456,11 +1464,11 @@ msgstr "動作"
#: apply.c
msgid "detect new or modified lines that have whitespace errors"
-msgstr "檢查新增和修改的行中間的空白字元濫用"
+msgstr "檢查新增和修改的列中間,是å¦æœ‰ç©ºç™½å­—元誤用"
#: apply.c
msgid "ignore changes in whitespace when finding context"
-msgstr "尋找上下文時忽略空白字元的變更"
+msgstr "尋找上下文時忽略空白字元更動"
#: apply.c
msgid "apply the patch in reverse"
@@ -1468,23 +1476,23 @@ msgstr "åå‘套用修補檔"
#: apply.c
msgid "don't expect at least one line of context"
-msgstr "無需至少一行上下文"
+msgstr "無需至少一列上下文"
#: apply.c
msgid "leave the rejected hunks in corresponding *.rej files"
-msgstr "將拒絕的修補檔å€å¡Šå„²å­˜åœ¨å°æ‡‰çš„ *.rej 檔案中"
+msgstr "將拒絕的修補檔å€å¡Šï¼Œç•™åœ¨å°æ‡‰çš„ *.rej 檔案中"
#: apply.c
msgid "allow overlapping hunks"
-msgstr "å…許é‡ç–Šçš„修補檔å€å¡Š"
+msgstr "å…許é‡ç–Šå€å¡Š"
#: apply.c
msgid "tolerate incorrectly detected missing new-line at the end of file"
-msgstr "å…許ä¸æ­£ç¢ºçš„檔案末尾æ›è¡Œç¬¦è™Ÿ"
+msgstr "å…許ä¸æ­£ç¢ºçš„檔案末尾æ›åˆ—符號"
#: apply.c
msgid "do not trust the line counts in the hunk headers"
-msgstr "ä¸ä¿¡ä»»ä¿®è£œæª”å€å¡Šçš„標頭訊æ¯ä¸­çš„行號"
+msgstr "ä¸ä¿¡ä»»å€å¡Šæ¨™é ­ä¸­çš„列號"
#: apply.c builtin/am.c
msgid "root"
@@ -1492,21 +1500,21 @@ msgstr "根目錄"
#: apply.c
msgid "prepend <root> to all filenames"
-msgstr "為所有檔案åå‰æ–°å¢ž <根目錄>"
+msgstr "在所有檔案å稱å‰åŠ ä¸Š <root>"
#: apply.c
msgid "don't return error for empty patches"
-msgstr "é‡åˆ°ç©ºç™½ä¿®è£œæª”時ä¸å›žå‚³éŒ¯èª¤"
+msgstr "é‡åˆ°ç©ºç™½ä¿®è£œæª”時,ä¸å›žå‚³éŒ¯èª¤"
#: archive-tar.c archive-zip.c
#, c-format
msgid "cannot stream blob %s"
-msgstr "ä¸èƒ½é–‹å•Ÿè³‡æ–™ç‰©ä»¶ %s"
+msgstr "無法串æµè³‡æ–™ç‰©ä»¶ %s"
#: archive-tar.c archive-zip.c
#, c-format
msgid "unsupported file mode: 0%o (SHA1: %s)"
-msgstr "ä¸æ”¯æ´çš„檔案模å¼ï¼š0%o (SHA1: %s)"
+msgstr "ä¸æ”¯æ´çš„檔案模å¼ï¼š0%o (SHA1:%s)"
#: archive-tar.c archive-zip.c builtin/pack-objects.c
#, c-format
@@ -1516,16 +1524,16 @@ msgstr "壓縮錯誤 (%d)"
#: archive-tar.c
#, c-format
msgid "unable to start '%s' filter"
-msgstr "無法啟動 '%s' éŽæ¿¾å™¨"
+msgstr "無法啟動 “%s†éŽæ¿¾å™¨"
#: archive-tar.c
msgid "unable to redirect descriptor"
-msgstr "無法é‡å®šå‘æ述符"
+msgstr "無法é‡æ–°å°Žå‘æè¿°å…ƒ"
#: archive-tar.c
#, c-format
msgid "'%s' filter reported error"
-msgstr "'%s' éŽæ¿¾å™¨å ±å‘Šäº†éŒ¯èª¤"
+msgstr "“%s†éŽæ¿¾å™¨å›žå ±éŒ¯èª¤"
#: archive-zip.c
#, c-format
@@ -1535,36 +1543,36 @@ msgstr "路徑ä¸æ˜¯æœ‰æ•ˆçš„ UTF-8:%s"
#: archive-zip.c
#, c-format
msgid "path too long (%d chars, SHA1: %s): %s"
-msgstr "路徑太長(%d 字元,SHA1:%s):%s"
+msgstr "路徑太長(%d 個字元,SHA1:%s):%s"
#: archive-zip.c
#, c-format
msgid "timestamp too large for this system: %<PRIuMAX>"
-msgstr "å°æ–¼æœ¬ç³»çµ±æ™‚間戳太大:%<PRIuMAX>"
+msgstr "å°æœ¬ç³»çµ±è€Œè¨€æ™‚間戳太大:%<PRIuMAX>"
#: archive.c
msgid "git archive [<options>] <tree-ish> [<path>...]"
-msgstr "git archive [<é¸é …>] <樹或æ交> [<路徑>...]"
+msgstr "git archive [<options>] <tree-ish> [<path>...]"
#: archive.c
msgid ""
"git archive --remote <repo> [--exec <cmd>] [<options>] <tree-ish> [<path>...]"
msgstr ""
-"git archive --remote <版本庫> [--exec <命令>] [<é¸é …>] <樹或æ交> [<路徑>...]"
+"git archive --remote <repo> [--exec <cmd>] [<options>] <tree-ish> [<path>...]"
#: archive.c
msgid "git archive --remote <repo> [--exec <cmd>] --list"
-msgstr "git archive --remote <版本庫> [--exec <命令>] --list"
+msgstr "git archive --remote <repo> [--exec <cmd>] --list"
#: archive.c builtin/gc.c builtin/notes.c builtin/tag.c
#, c-format
msgid "cannot read '%s'"
-msgstr "ä¸èƒ½è®€å– '%s'"
+msgstr "ç„¡æ³•è®€å– â€œ%sâ€"
#: archive.c builtin/add.c builtin/rm.c
#, c-format
msgid "pathspec '%s' did not match any files"
-msgstr "路徑è¦æ ¼ '%s' 未符åˆä»»ä½•æª”案"
+msgstr "路徑è¦æ ¼ “%s†未符åˆä»»ä½•æª”案"
#: archive.c
#, c-format
@@ -1574,16 +1582,16 @@ msgstr "無此引用:%.*s"
#: archive.c
#, c-format
msgid "not a valid object name: %s"
-msgstr "ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„物件å:%s"
+msgstr "éžæœ‰æ•ˆç‰©ä»¶å稱:%s"
-#: archive.c
+#: archive.c t/helper/test-cache-tree.c
#, c-format
msgid "not a tree object: %s"
-msgstr "ä¸æ˜¯ä¸€å€‹æ¨¹ç‹€ç‰©ä»¶ï¼š%s"
+msgstr "éžæ¨¹ç‹€ç‰©ä»¶ï¼š%s"
#: archive.c
msgid "current working directory is untracked"
-msgstr "ç›®å‰å·¥ä½œç›®éŒ„未被追蹤"
+msgstr "尚未追蹤目å‰çš„工作目錄"
#: archive.c
#, c-format
@@ -1598,25 +1606,25 @@ msgstr "ä¸æ˜¯ä¸€èˆ¬æª”案:%s"
#: archive.c
#, c-format
msgid "unclosed quote: '%s'"
-msgstr "未閉åˆçš„引號:「%sã€"
+msgstr "未閉åˆçš„引號:“%sâ€"
#: archive.c
#, c-format
msgid "missing colon: '%s'"
-msgstr "缺少冒號:「%sã€"
+msgstr "缺少冒號:“%sâ€"
#: archive.c
#, c-format
msgid "empty file name: '%s'"
-msgstr "檔案å稱空白:「%sã€"
+msgstr "檔案å稱空白:“%sâ€"
#: archive.c
msgid "fmt"
-msgstr "æ ¼å¼"
+msgstr "fmt"
#: archive.c
msgid "archive format"
-msgstr "歸檔格å¼"
+msgstr "å°å­˜æ ¼å¼"
#: archive.c builtin/log.c
msgid "prefix"
@@ -1624,33 +1632,33 @@ msgstr "å‰ç¶´"
#: archive.c
msgid "prepend prefix to each pathname in the archive"
-msgstr "為歸檔中æ¯å€‹è·¯å¾‘å加上å‰ç¶´"
+msgstr "為å°å­˜ä¸­çš„æ¯å€‹è·¯å¾‘å稱加上å‰ç¶´"
#: archive.c builtin/blame.c builtin/commit-tree.c builtin/config.c
-#: builtin/fast-export.c builtin/grep.c builtin/hash-object.c
+#: builtin/fast-export.c builtin/gc.c builtin/grep.c builtin/hash-object.c
#: builtin/ls-files.c builtin/notes.c builtin/read-tree.c parse-options.h
msgid "file"
-msgstr "檔案"
+msgstr "file"
#: archive.c
msgid "add untracked file to archive"
-msgstr "將未追蹤檔案加入歸檔"
+msgstr "將未追蹤檔案加進å°å­˜"
#: archive.c
msgid "path:content"
-msgstr "路徑:內容"
+msgstr "path:content"
#: archive.c builtin/archive.c
msgid "write the archive to this file"
-msgstr "歸檔寫入此檔案"
+msgstr "å°‡å°å­˜å¯«å…¥æ­¤æª”案"
#: archive.c
msgid "read .gitattributes in working directory"
-msgstr "讀å–工作å€ä¸­çš„ .gitattributes"
+msgstr "讀å–工作目錄中的 .gitattributes"
#: archive.c
msgid "report archived files on stderr"
-msgstr "在標準錯誤上報告歸檔檔案"
+msgstr "在 stderr 上回報å°å­˜çš„檔案"
#: archive.c
msgid "set compression level"
@@ -1658,27 +1666,27 @@ msgstr "設定壓縮級別"
#: archive.c
msgid "list supported archive formats"
-msgstr "列出支æ´çš„歸檔格å¼"
+msgstr "列出支æ´çš„å°å­˜æ ¼å¼"
#: archive.c builtin/archive.c builtin/clone.c builtin/submodule--helper.c
msgid "repo"
-msgstr "版本庫"
+msgstr "repo"
#: archive.c builtin/archive.c
msgid "retrieve the archive from remote repository <repo>"
-msgstr "從é ç«¯ç‰ˆæœ¬åº«ï¼ˆ<版本庫>)擷å–歸檔檔案"
+msgstr "從é ç«¯ç‰ˆæœ¬åº« <repo> æ“·å–å°å­˜æª”案"
#: archive.c builtin/archive.c builtin/difftool.c builtin/notes.c
msgid "command"
-msgstr "指令"
+msgstr "command"
#: archive.c builtin/archive.c
msgid "path to the remote git-upload-archive command"
-msgstr "é ç«¯ git-upload-archive 指令的路徑"
+msgstr "é ç«¯ git-upload-archive 命令的路徑"
#: archive.c
msgid "Unexpected option --remote"
-msgstr "未知åƒæ•¸ --remote"
+msgstr "éžé æœŸé¸é … --remote"
#: archive.c builtin/add.c builtin/checkout.c builtin/clone.c builtin/commit.c
#: builtin/fast-export.c builtin/index-pack.c builtin/log.c builtin/reset.c
@@ -1686,26 +1694,26 @@ msgstr "未知åƒæ•¸ --remote"
#: revision.c
#, c-format
msgid "the option '%s' requires '%s'"
-msgstr "「%sã€é¸é …需è¦ã€Œ%sã€"
+msgstr "“%s†é¸é …éœ€è¦ â€œ%sâ€"
#: archive.c
msgid "Unexpected option --output"
-msgstr "未知åƒæ•¸ --output"
+msgstr "éžé æœŸé¸é … --output"
#: archive.c
#, c-format
msgid "Unknown archive format '%s'"
-msgstr "æœªçŸ¥æ­¸æª”æ ¼å¼ '%s'"
+msgstr "å°å­˜æ ¼å¼ “%s†未知"
#: archive.c
#, c-format
msgid "Argument not supported for format '%s': -%d"
-msgstr "åƒæ•¸ä¸æ”¯æ´æ­¤æ ¼å¼ '%s':-%d"
+msgstr "引數ä¸æ”¯æ´ “%s†格å¼ï¼š-%d"
#: attr.c
#, c-format
msgid "%.*s is not a valid attribute name"
-msgstr "%.*s ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„屬性å"
+msgstr "%.*s ä¸æ˜¯æœ‰æ•ˆçš„屬性å稱"
#: attr.c
#, c-format
@@ -1717,23 +1725,23 @@ msgid ""
"Negative patterns are ignored in git attributes\n"
"Use '\\!' for literal leading exclamation."
msgstr ""
-"åå‘模å¼åœ¨ git attributes 中被忽略\n"
-"當字串確定è¦ä»¥é©šå˜†è™Ÿé–‹å§‹æ™‚,使用 '\\!'。"
+"git attributes 會忽略åå‘模å¼\n"
+"當字串確定è¦ä»¥é©šå˜†è™Ÿé–‹å§‹æ™‚,請使用 “\\!â€ã€‚"
#: bisect.c
#, c-format
msgid "Badly quoted content in file '%s': %s"
-msgstr "檔案 '%s' 包å«éŒ¯èª¤çš„引用格å¼ï¼š%s"
+msgstr "檔案 “%s†包å«ç„¡æ•ˆçš„引用內容:%s"
#: bisect.c
#, c-format
msgid "We cannot bisect more!\n"
-msgstr "我們無法進行更多的二分æœå°‹ï¼\n"
+msgstr "已經無法繼續二分æœå°‹ï¼\n"
#: bisect.c
#, c-format
msgid "Not a valid commit name %s"
-msgstr "ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„æ交å %s"
+msgstr "%s ä¸æ˜¯æœ‰æ•ˆçš„æ交å稱"
#: bisect.c
#, c-format
@@ -1742,7 +1750,7 @@ msgid ""
"This means the bug has been fixed between %s and [%s].\n"
msgstr ""
"åˆä½µåŸºç¤Ž %s 是壞的。\n"
-"這æ„味著介於 %s å’Œ [%s] 之間的 bug 已經被修復。\n"
+"這æ„味著 bug 已經在 %s å’Œ [%s] 之間被修正。\n"
#: bisect.c
#, c-format
@@ -1751,7 +1759,7 @@ msgid ""
"The property has changed between %s and [%s].\n"
msgstr ""
"åˆä½µåŸºç¤Ž %s 是新的。\n"
-"介於 %s 和 [%s] 之間的屬性已經被修改。\n"
+"介於 %s 和 [%s] 之間的屬性已被修改。\n"
#: bisect.c
#, c-format
@@ -1760,7 +1768,7 @@ msgid ""
"This means the first '%s' commit is between %s and [%s].\n"
msgstr ""
"åˆä½µåŸºç¤Ž %s 是 %s。\n"
-"這æ„味著第一個 '%s' æ交ä½æ–¼ %s å’Œ [%s] 之間。\n"
+"這æ„味著第一個 “%s†æ交ä½æ–¼ %s å’Œ [%s] 之間。\n"
#: bisect.c
#, c-format
@@ -1769,9 +1777,9 @@ msgid ""
"git bisect cannot work properly in this case.\n"
"Maybe you mistook %s and %s revs?\n"
msgstr ""
-"一些 %s 版本ä¸æ˜¯ %s 版本的祖先。\n"
-"這種情æ³ä¸‹ git 二分æœå°‹ç„¡æ³•æ­£å¸¸å·¥ä½œã€‚\n"
-"您å¯èƒ½å¼„錯了 %s å’Œ %s 版本?\n"
+"部分 %s 修訂版ä¸æ˜¯ %s 修訂版的祖先。\n"
+"這種情æ³ä¸‹ git bisect 無法正常é‹ä½œã€‚\n"
+"您å¯èƒ½å¼„錯了 %s å’Œ %s 修訂版?\n"
#: bisect.c
#, c-format
@@ -1780,33 +1788,33 @@ msgid ""
"So we cannot be sure the first %s commit is between %s and %s.\n"
"We continue anyway."
msgstr ""
-"介於 %s å’Œ [%s] çš„åˆä½µåŸºç¤Žä¸€å®šè¢«å¿½ç•¥äº†ã€‚\n"
+"介於 %s å’Œ [%s] çš„åˆä½µåŸºç¤Žä¸€å®šè¢«ç•¥éŽäº†ã€‚\n"
"所以我們無法確èªç¬¬ä¸€å€‹ %s æ交是å¦ä»‹æ–¼ %s å’Œ %s 之間。\n"
"我們ä»èˆŠç¹¼çºŒã€‚"
#: bisect.c
#, c-format
msgid "Bisecting: a merge base must be tested\n"
-msgstr "二分æœå°‹ä¸­ï¼šåˆä½µåŸºç¤Žå¿…須是經éŽæ¸¬è©¦çš„\n"
+msgstr "二分æœå°‹ä¸­ï¼šåˆä½µåŸºç¤Žå¿…須經éŽæ¸¬è©¦\n"
#: bisect.c
#, c-format
msgid "a %s revision is needed"
-msgstr "需è¦ä¸€å€‹ %s 版本"
+msgstr "需è¦ä¸€å€‹ %s 修訂版"
#: bisect.c
#, c-format
msgid "could not create file '%s'"
-msgstr "ä¸èƒ½å»ºç«‹æª”案 '%s'"
+msgstr "無法建立 “%s†檔案"
#: bisect.c builtin/merge.c
#, c-format
msgid "could not read file '%s'"
-msgstr "ä¸èƒ½è®€å–檔案 '%s'"
+msgstr "ç„¡æ³•è®€å– â€œ%s†檔案"
#: bisect.c
msgid "reading bisect refs failed"
-msgstr "讀å–二分æœå°‹å¼•ç”¨å¤±æ•—"
+msgstr "無法讀å–二分æœå°‹çš„引用"
#: bisect.c
#, c-format
@@ -1820,13 +1828,13 @@ msgid ""
"Maybe you started with bad path arguments?\n"
msgstr ""
"沒找到能夠測試的æ交。\n"
-"å¯èƒ½æ˜¯åŸ·è¡Œå‚³å…¥çš„路徑引數是錯誤的?\n"
+"å¯èƒ½æ˜¯å‚³å…¥çš„路徑引數有誤?\n"
#: bisect.c
#, c-format
msgid "(roughly %d step)"
msgid_plural "(roughly %d steps)"
-msgstr[0] "(大概 %d 步)"
+msgstr[0] "(大約 %d 步)"
#. TRANSLATORS: the last %s will be replaced with "(roughly %d
#. steps)" translation.
@@ -1835,7 +1843,7 @@ msgstr[0] "(大概 %d 步)"
#, c-format
msgid "Bisecting: %d revision left to test after this %s\n"
msgid_plural "Bisecting: %d revisions left to test after this %s\n"
-msgstr[0] "二分æœå°‹ä¸­ï¼šåœ¨æ­¤ä¹‹å¾Œï¼Œé‚„剩 %d 個版本待測試 %s\n"
+msgstr[0] "二分æœå°‹ä¸­ï¼šåœ¨æ­¤ (%2$s) 之後,尚餘 %1$d 個版本待測試\n"
#: blame.c
msgid "--contents and --reverse do not blend well."
@@ -1843,7 +1851,7 @@ msgstr "--contents å’Œ --reverse ä¸èƒ½æ··ç”¨ã€‚"
#: blame.c
msgid "cannot use --contents with final commit object name"
-msgstr "ä¸èƒ½å°‡ --contents 和最終的æ交物件å共用"
+msgstr "無法將 --contents 與最終的æ交物件å稱共用"
#: blame.c
msgid "--reverse and --first-parent together require specified latest commit"
@@ -1853,48 +1861,48 @@ msgstr "--reverse å’Œ --first-parent 共用,需è¦æŒ‡å®šæœ€æ–°çš„æ交"
#: builtin/pack-objects.c builtin/shortlog.c bundle.c midx.c pack-bitmap.c
#: ref-filter.c remote.c sequencer.c submodule.c
msgid "revision walk setup failed"
-msgstr "版本é歷設定失敗"
+msgstr "修訂版é歷設定失敗"
#: blame.c
msgid ""
"--reverse --first-parent together require range along first-parent chain"
-msgstr "--reverse å’Œ --first-parent 共用,需è¦ç¬¬ä¸€ç¥–å…ˆéˆä¸Šçš„æ交範åœ"
+msgstr "--reverse å’Œ --first-parent 共用,需è¦ç¬¬ä¸€ä¸Šç´šéˆçš„æ交範åœ"
#: blame.c
#, c-format
msgid "no such path %s in %s"
-msgstr "在 %2$s 中無此路徑 %1$s"
+msgstr "在 %2$s 中,沒有路徑 %1$s"
#: blame.c
#, c-format
msgid "cannot read blob %s for path %s"
-msgstr "ä¸èƒ½ç‚ºè·¯å¾‘ %2$s 讀å–資料物件 %1$s"
+msgstr "無法為 %2$s 路徑讀å–資料物件 %1$s"
#: branch.c
msgid ""
"cannot inherit upstream tracking configuration of multiple refs when "
"rebasing is requested"
-msgstr "請求é‡å®šåŸºåº•æ™‚,無法繼承多個åƒç…§çš„上游追蹤設定"
+msgstr "請求é‡å®šåŸºåº•æ™‚,無法繼承多個引用的上游追蹤設定"
#: branch.c
#, c-format
msgid "not setting branch '%s' as its own upstream"
-msgstr "未將「%sã€åˆ†æ”¯è¨­å®šç‚ºå…¶è‡ªå·±çš„上游"
+msgstr "未將 “%s†分支設為其自己的上游"
#: branch.c
#, c-format
msgid "branch '%s' set up to track '%s' by rebasing."
-msgstr "已將「%sã€åˆ†æ”¯è¨­å®šç‚ºé€éŽé‡å®šåŸºåº•è¿½è¹¤ã€Œ%sã€ã€‚"
+msgstr "已藉由é‡è¨‚基底,將 “%s†分支設定為追蹤 “%sâ€ã€‚"
#: branch.c
#, c-format
msgid "branch '%s' set up to track '%s'."
-msgstr "已將「%sã€åˆ†æ”¯è¨­å®šç‚ºè¿½è¹¤ã€Œ%sã€ã€‚"
+msgstr "已將 “%s†分支設定為追蹤 “%sâ€ã€‚"
#: branch.c
#, c-format
msgid "branch '%s' set up to track:"
-msgstr "「%sã€åˆ†æ”¯å·²è¨­å®šè¿½è¹¤ï¼š"
+msgstr "“%s†分支已設定追蹤:"
#: branch.c
msgid "unable to write upstream branch configuration"
@@ -1907,23 +1915,23 @@ msgid ""
"the remote tracking information by invoking:"
msgstr ""
"\n"
-"修正錯誤後,您å¯ä»¥åŸ·è¡Œä¸‹è¿°å‘½ä»¤\n"
-"命令修正é ç«¯è¿½è¹¤è³‡è¨Šï¼š"
+"修正病ç¶å¾Œï¼Œæ‚¨å¯ä»¥åŸ·è¡Œä¸‹è¿°å‘½ä»¤\n"
+"修正é ç«¯è¿½è¹¤è³‡è¨Šï¼š"
#: branch.c
#, c-format
msgid "asked to inherit tracking from '%s', but no remote is set"
-msgstr "請求繼承「%sã€çš„追蹤設定,但未設定é ç«¯"
+msgstr "請求繼承 “%s†的追蹤設定,但未設定é ç«¯"
#: branch.c
#, c-format
msgid "asked to inherit tracking from '%s', but no merge configuration is set"
-msgstr "請求繼承「%sã€çš„追蹤設定,但未設定åˆä½µè¨­å®š"
+msgstr "請求繼承 “%s†的追蹤設定,但未設定åˆä½µè¨­å®š"
#: branch.c
#, c-format
msgid "not tracking: ambiguous information for ref '%s'"
-msgstr "未追蹤:「%sã€å¼•ç”¨æœ‰æ­§ç¾©"
+msgstr "未追蹤:“%s†引用有歧義"
# 譯者:為ä¿è­‰åœ¨è¼¸å‡ºä¸­å°é½Šï¼Œæ³¨æ„調整å¥ä¸­ç©ºæ ¼ï¼
#. #-#-#-#-# branch.c.po #-#-#-#-#
@@ -1957,37 +1965,38 @@ msgid ""
"different remotes' fetch refspecs map into different\n"
"tracking namespaces."
msgstr ""
-"有多個é ç«¯çš„抓å–引用è¦æ ¼æ˜ å°„到é ç«¯è¿½è¹¤å¼•ç”¨ã€Œ%sã€çš„è¦æ ¼ï¼š\n"
+"有多個é ç«¯çš„抓å–引用è¦æ ¼ï¼Œæ˜ å°„到\n"
+"é ç«¯è¿½è¹¤å¼•ç”¨ “%s†的è¦æ ¼ï¼š\n"
"%s\n"
"這通常是設定錯誤。\n"
"\n"
-"è‹¥è¦æ”¯æ´è¨­å®šè¿½è¹¤åˆ†æ”¯ï¼Œè«‹ç¢ºå®šä¸åŒé ç«¯çš„抓å–引用è¦æ ¼\n"
-"映射到ä¸åŒçš„追蹤命å空間。"
+"è‹¥è¦æ”¯æ´è¨­å®šè¿½è¹¤åˆ†æ”¯ï¼Œè«‹ç¢ºå®šä¸åŒé ç«¯çš„\n"
+"抓å–引用è¦æ ¼ï¼Œæ˜ å°„到ä¸åŒçš„追蹤命å空間。"
#: branch.c
#, c-format
msgid "'%s' is not a valid branch name"
-msgstr "「%sã€ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„分支å稱"
+msgstr "“%s†ä¸æ˜¯æœ‰æ•ˆçš„分支å稱"
#: branch.c
#, c-format
msgid "a branch named '%s' already exists"
-msgstr "已有åŒå「%sã€åˆ†æ”¯"
+msgstr "已有åŒå “%s†分支"
#: branch.c
#, c-format
msgid "cannot force update the branch '%s' checked out at '%s'"
-msgstr "無法強制更新在「%2$sã€ç°½å‡ºçš„「%1$sã€åˆ†æ”¯"
+msgstr "無法強制更新在 “%2$s†簽出的 “%1$s†分支"
#: branch.c
#, c-format
msgid "cannot set up tracking information; starting point '%s' is not a branch"
-msgstr "無法設定追蹤資訊:起始點「%sã€ä¸æ˜¯åˆ†æ”¯"
+msgstr "無法設定追蹤資訊:起始點 “%s†ä¸æ˜¯åˆ†æ”¯"
#: branch.c
#, c-format
msgid "the requested upstream branch '%s' does not exist"
-msgstr "請求的上游分支 '%s' ä¸å­˜åœ¨"
+msgstr "請求的上游分支 “%s†ä¸å­˜åœ¨"
#: branch.c
msgid ""
@@ -2002,31 +2011,31 @@ msgid ""
msgstr ""
"\n"
"如果您打算以é ç«¯ç¾å­˜çš„上游分支為基礎進行修改,\n"
-"您或許需è¦åŸ·è¡Œã€Œgit fetchã€å–得分支。\n"
+"您或許需è¦åŸ·è¡Œ `git fetch` å–得分支。\n"
"\n"
-"如果您打算將新建立的本機分支推é€è‡³å°æ‡‰çš„é ç«¯åˆ†æ”¯ï¼Œ\n"
-"且建立兩個分支間的追蹤關係,\n"
-"您å¯èƒ½éœ€è¦ä½¿ç”¨ã€Œgit push -uã€æŽ¨é€åˆ†æ”¯ä¸¦è¨­å®šå’Œä¸Šæ¸¸çš„é—œè¯ã€‚"
+"如果您打算將新建立的本機分支,推é€è‡³å°æ‡‰çš„é ç«¯åˆ†æ”¯ï¼Œ\n"
+"並建立兩個分支間的追蹤關係,您å¯èƒ½éœ€è¦ä½¿ç”¨ `git push -u`\n"
+"推é€åˆ†æ”¯ä¸¦è¨­å®šå’Œä¸Šæ¸¸çš„é—œè¯ã€‚"
#: branch.c builtin/replace.c
#, c-format
msgid "not a valid object name: '%s'"
-msgstr "ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„物件å:'%s'"
+msgstr "物件å稱無效:“%sâ€"
#: branch.c
#, c-format
msgid "ambiguous object name: '%s'"
-msgstr "物件å稱有歧義:「%sã€"
+msgstr "物件å稱有歧義:“%sâ€"
#: branch.c
#, c-format
msgid "not a valid branch point: '%s'"
-msgstr "無效的分支點:「%sã€"
+msgstr "分支點無效:“%sâ€"
#: branch.c
#, c-format
msgid "submodule '%s': unable to find submodule"
-msgstr "「%sã€å­æ¨¡çµ„:找ä¸åˆ°å­æ¨¡çµ„"
+msgstr "“%s†å­æ¨¡çµ„:找ä¸åˆ°å­æ¨¡çµ„"
#: branch.c
#, c-format
@@ -2034,37 +2043,37 @@ msgid ""
"You may try updating the submodules using 'git checkout %s && git submodule "
"update --init'"
msgstr ""
-"您å¯ä»¥å˜—試使用「git checkout %s && git submodule update --initã€å‘½ä»¤æ›´æ–°å­æ¨¡"
-"組"
+"您å¯ä»¥å˜—試使用 “git checkout %s && git submodule update --init†命令,更新å­"
+"模組"
#: branch.c
#, c-format
msgid "submodule '%s': cannot create branch '%s'"
-msgstr "「%sã€å­æ¨¡çµ„:無法建立「%sã€åˆ†æ”¯"
+msgstr "“%s†å­æ¨¡çµ„:無法建立 “%s†分支"
#: branch.c
#, c-format
msgid "'%s' is already checked out at '%s'"
-msgstr "'%s' 已經簽出到 '%s'"
+msgstr "“%s†已在 “%s†點簽出"
#: branch.c
#, c-format
msgid "HEAD of working tree %s is not updated"
-msgstr "å·¥ä½œå€ %s çš„ HEAD 指å‘沒有被更新"
+msgstr "%s 工作å€çš„ HEAD 指é‡æœªè¢«æ›´æ–°"
#: builtin/add.c
msgid "git add [<options>] [--] <pathspec>..."
-msgstr "git add [<é¸é …>] [--] <路徑è¦æ ¼>..."
+msgstr "git add [<options>] [--] <pathspec>..."
#: builtin/add.c
#, c-format
msgid "cannot chmod %cx '%s'"
-msgstr "無法 chmod %cx ‘%s’"
+msgstr "無法 chmod %cx '%s'"
#: builtin/add.c
#, c-format
msgid "unexpected diff status %c"
-msgstr "æ„外的差異狀態 %c"
+msgstr "éžé æœŸçš„ diff 狀態 %c"
#: builtin/add.c builtin/commit.c
msgid "updating files failed"
@@ -2073,19 +2082,19 @@ msgstr "更新檔案失敗"
#: builtin/add.c
#, c-format
msgid "remove '%s'\n"
-msgstr "刪除 '%s'\n"
+msgstr "移除 “%sâ€\n"
#: builtin/add.c
msgid "Unstaged changes after refreshing the index:"
-msgstr "é‡æ–°æ•´ç†ç´¢å¼•ä¹‹å¾Œå°šæœªè¢«æš«å­˜çš„變更:"
+msgstr "é‡æ–°æ•´ç†ç´¢å¼•ä¹‹å¾Œï¼Œå°šæœªè¢«æš«å­˜çš„更動:"
#: builtin/add.c builtin/rev-parse.c
msgid "Could not read the index"
-msgstr "ä¸èƒ½è®€å–索引"
+msgstr "無法讀å–索引"
#: builtin/add.c
msgid "Could not write patch"
-msgstr "ä¸èƒ½ç”Ÿæˆä¿®è£œæª”"
+msgstr "無法寫入修補檔"
#: builtin/add.c
msgid "editing patch failed"
@@ -2094,20 +2103,20 @@ msgstr "編輯修補檔失敗"
#: builtin/add.c
#, c-format
msgid "Could not stat '%s'"
-msgstr "ä¸èƒ½å° '%s' å‘¼å« stat"
+msgstr "ä¸èƒ½å° “%s†執行 stat"
#: builtin/add.c
msgid "Empty patch. Aborted."
-msgstr "空修補檔。異常終止。"
+msgstr "修補檔空白。中止。"
#: builtin/add.c
#, c-format
msgid "Could not apply '%s'"
-msgstr "ä¸èƒ½å¥—用 '%s'"
+msgstr "無法套用 “%sâ€"
#: builtin/add.c
msgid "The following paths are ignored by one of your .gitignore files:\n"
-msgstr "下列路徑根據您的一個 .gitignore 檔案而被忽略:\n"
+msgstr "下列路徑根據其中一個 .gitignore 檔案而被忽略:\n"
#: builtin/add.c builtin/clean.c builtin/fetch.c builtin/mv.c
#: builtin/prune-packed.c builtin/pull.c builtin/push.c builtin/remote.c
@@ -2123,11 +2132,11 @@ msgstr "詳細輸出"
#: builtin/add.c
msgid "interactive picking"
-msgstr "互動å¼æ€é¸"
+msgstr "互動å¼æŒ‘é¸"
#: builtin/add.c builtin/checkout.c builtin/reset.c
msgid "select hunks interactively"
-msgstr "互動å¼æŒ‘é¸è³‡æ–™å€å¡Š"
+msgstr "互動å¼é¸å–å€å¡Š"
#: builtin/add.c
msgid "edit current diff and apply"
@@ -2135,7 +2144,7 @@ msgstr "編輯目å‰å·®ç•°ä¸¦å¥—用"
#: builtin/add.c
msgid "allow adding otherwise ignored files"
-msgstr "å…許新增忽略的檔案"
+msgstr "å…許加入原先被忽略的檔案"
#: builtin/add.c
msgid "update tracked files"
@@ -2143,15 +2152,15 @@ msgstr "更新已追蹤的檔案"
#: builtin/add.c
msgid "renormalize EOL of tracked files (implies -u)"
-msgstr "å°å·²è¿½è¹¤æª”æ¡ˆï¼ˆéš±å« -u)é‡æ–°æ­¸ä¸€æ›è¡Œç¬¦è™Ÿ"
+msgstr "å°å·²è¿½è¹¤æª”æ¡ˆï¼ˆéš±å« -u)é‡æ–°æ¨™æº–化 EOL"
#: builtin/add.c
msgid "record only the fact that the path will be added later"
-msgstr "åªè¨˜éŒ„,該路徑ç¨å¾Œå†æ–°å¢ž"
+msgstr "åªè¨˜éŒ„「路徑ç¨å¾Œæœƒå†åŠ å…¥ã€"
#: builtin/add.c
msgid "add changes from all tracked and untracked files"
-msgstr "新增所有改變的已追蹤檔案和未追蹤檔案"
+msgstr "從所有已追蹤和未追蹤檔案加入更動"
#: builtin/add.c
msgid "ignore paths removed in the working tree (same as --no-all)"
@@ -2167,7 +2176,7 @@ msgstr "ç•¥éŽå› ç™¼ç”ŸéŒ¯èª¤ä¸èƒ½æ–°å¢žçš„檔案"
#: builtin/add.c
msgid "check if - even missing - files are ignored in dry run"
-msgstr "檢查在測試執行模å¼ä¸‹æª”案(å³ä½¿ä¸å­˜åœ¨ï¼‰æ˜¯å¦è¢«å¿½ç•¥"
+msgstr "檢查(å³ä½¿ä¸å­˜åœ¨çš„)檔案是å¦åœ¨æ¸¬è©¦åŸ·è¡Œæ¨¡å¼ä¸­è¢«å¿½ç•¥"
#: builtin/add.c builtin/mv.c builtin/rm.c
msgid "allow updating entries outside of the sparse-checkout cone"
@@ -2175,11 +2184,11 @@ msgstr "å…許更新稀ç–簽出 cone 外的項目"
#: builtin/add.c builtin/update-index.c
msgid "override the executable bit of the listed files"
-msgstr "覆蓋列表裡檔案的å¯åŸ·è¡Œä½"
+msgstr "覆寫列出檔案中的å¯åŸ·è¡Œä½å…ƒ"
#: builtin/add.c
msgid "warn when adding an embedded repository"
-msgstr "建立一個嵌入å¼ç‰ˆæœ¬åº«æ™‚給予警告"
+msgstr "嵌入版本庫時發出警告"
#: builtin/add.c
#, c-format
@@ -2198,22 +2207,24 @@ msgid ""
"\n"
"See \"git help submodule\" for more information."
msgstr ""
-"您在目å‰ç‰ˆæœ¬åº«ä¸­æ–°å¢žäº†å¦å¤–一個 Git 版本庫。複製外層的版本庫將ä¸åŒ…å«åµŒå…¥ç‰ˆæœ¬åº«"
-"的內容,並且ä¸çŸ¥é“該如何å–得它。\n"
-"如果您è¦æ–°å¢žä¸€å€‹å­æ¨¡çµ„,使用:\n"
+"您在目å‰çš„版本庫中加進å¦ä¸€å€‹ Git 版本庫。\n"
+"複製外層的版本庫,將ä¸åŒ…å«åµŒå…¥ç‰ˆæœ¬åº«çš„內容,\n"
+"並且ä¸åŒ…å«å–得此版本庫的方å¼ã€‚\n"
+"如果您è¦åŠ å…¥å­æ¨¡çµ„,請使用:\n"
"\n"
"\tgit submodule add <url> %s\n"
"\n"
-"如果您ä¸å°å¿ƒæ–°å¢žäº†é€™å€‹è·¯å¾‘,å¯ä»¥ç”¨ä¸‹é¢çš„指令將其從索引中刪除:\n"
+"如果您ä¸å°å¿ƒåŠ å…¥äº†é€™å€‹è·¯å¾‘,\n"
+"å¯ä»¥ç”¨ä¸‹é¢çš„命令,將其從索引中移除:\n"
"\n"
"\tgit rm --cached %s\n"
"\n"
-"åƒè¦‹ \"git help submodule\" å–得更多訊æ¯ã€‚"
+"åƒè¦‹ “git help submodule†深入了解。"
#: builtin/add.c
#, c-format
msgid "adding embedded git repository: %s"
-msgstr "æ­£åœ¨æ–°å¢žåµŒå…¥å¼ git 版本庫:%s"
+msgstr "æ­£åœ¨åŠ å…¥åµŒå…¥å¼ git 版本庫:%s"
#: builtin/add.c
msgid ""
@@ -2221,29 +2232,29 @@ msgid ""
"Turn this message off by running\n"
"\"git config advice.addIgnoredFile false\""
msgstr ""
-"如果您真的想加入,請使用 -f。\n"
+"若您真的想加入,請傳入 -f。\n"
"如è¦é—œé–‰æ­¤è¨Šæ¯ï¼Œè«‹åŸ·è¡Œ\n"
-"\"git config advice.addIgnoredFile false\""
+"“git config advice.addIgnoredFile falseâ€"
#: builtin/add.c
msgid "adding files failed"
-msgstr "新增檔案失敗"
+msgstr "加入檔案失敗"
#: builtin/add.c
#, c-format
msgid "--chmod param '%s' must be either -x or +x"
-msgstr "åƒæ•¸ --chmod å–值 '%s' 必須是 -x 或 +x"
+msgstr "--chmod çš„åƒæ•¸ “%s†必須是 -x 或 +x"
#: builtin/add.c builtin/checkout.c builtin/commit.c builtin/reset.c
#: builtin/rm.c builtin/stash.c
#, c-format
msgid "'%s' and pathspec arguments cannot be used together"
-msgstr "「%sã€å’Œè·¯å¾‘è¦æ ¼å¼•æ•¸ä¸å¾—åŒæ™‚使用"
+msgstr "“%s†和路徑è¦æ ¼å¼•æ•¸ä¸å¾—åŒæ™‚使用"
#: builtin/add.c
#, c-format
msgid "Nothing specified, nothing added.\n"
-msgstr "沒有指定檔案,也沒有檔案被新增。\n"
+msgstr "沒有指定,亦未加入檔案。\n"
#: builtin/add.c
msgid ""
@@ -2251,9 +2262,9 @@ msgid ""
"Turn this message off by running\n"
"\"git config advice.addEmptyPathspec false\""
msgstr ""
-"å¯èƒ½ä½ è¦åšçš„是 'git add .'?\n"
+"å¯èƒ½æ‚¨æƒ³åš “git add .â€ï¼Ÿ\n"
"如è¦é—œé–‰æ­¤è¨Šæ¯ï¼Œè«‹åŸ·è¡Œ\n"
-"\"git config advice.addEmptyPathspec false\""
+"“git config advice.addEmptyPathspec falseâ€"
#: builtin/add.c builtin/check-ignore.c builtin/checkout.c builtin/clean.c
#: builtin/commit.c builtin/diff-tree.c builtin/grep.c builtin/mv.c
@@ -2265,43 +2276,43 @@ msgstr "索引檔案æ壞"
#: builtin/am.c builtin/mailinfo.c mailinfo.c
#, c-format
msgid "bad action '%s' for '%s'"
-msgstr "「%sã€å‹•ä½œå°ã€Œ%sã€ç„¡æ•ˆ"
+msgstr "“%sâ€ å‹•ä½œå° â€œ%s†無效"
#: builtin/am.c builtin/blame.c builtin/fetch.c builtin/pack-objects.c
#: builtin/pull.c diff-merges.c gpg-interface.c ls-refs.c parallel-checkout.c
#: sequencer.c setup.c
#, c-format
msgid "invalid value for '%s': '%s'"
-msgstr "「%sã€çš„值無效:「%sã€"
+msgstr "“%s†的值無效:“%sâ€"
#: builtin/am.c builtin/commit.c builtin/merge.c sequencer.c
#, c-format
msgid "could not read '%s'"
-msgstr "ä¸èƒ½è®€å– '%s'"
+msgstr "ç„¡æ³•è®€å– â€œ%sâ€"
#: builtin/am.c
msgid "could not parse author script"
-msgstr "ä¸èƒ½è§£æžä½œè€…腳本"
+msgstr "無法解æžä½œè€…文稿"
#: builtin/am.c builtin/replace.c commit.c sequencer.c
#, c-format
msgid "could not parse %s"
-msgstr "ä¸èƒ½è§£æž %s"
+msgstr "ç„¡æ³•è§£æž %s"
#: builtin/am.c
#, c-format
msgid "'%s' was deleted by the applypatch-msg hook"
-msgstr "'%s' 被 applypatch-msg 掛鉤刪除"
+msgstr "“%s†被 applypatch-msg 掛鉤刪除"
#: builtin/am.c
#, c-format
msgid "Malformed input line: '%s'."
-msgstr "éžæ³•çš„輸入行:'%s'。"
+msgstr "æ ¼å¼éŒ¯èª¤çš„輸入列:“%sâ€ã€‚"
#: builtin/am.c
#, c-format
msgid "Failed to copy notes from '%s' to '%s'"
-msgstr "從 '%s' 複製註解到 '%s' 時失敗"
+msgstr "從 “%s†拷è²è¨»è§£åˆ° “%s†失敗"
#: builtin/am.c
msgid "fseek failed"
@@ -2310,21 +2321,21 @@ msgstr "fseek 失敗"
#: builtin/am.c builtin/rebase.c sequencer.c wrapper.c
#, c-format
msgid "could not open '%s' for reading"
-msgstr "無法開啟 '%s' 進行讀å–"
+msgstr "無法開啟 “%s†進行讀å–"
#: builtin/am.c builtin/rebase.c sequencer.c strbuf.c wrapper.c
#, c-format
msgid "could not open '%s' for writing"
-msgstr "無法開啟 '%s' 進行寫入"
+msgstr "無法開啟 “%s†進行寫入"
#: builtin/am.c
#, c-format
msgid "could not parse patch '%s'"
-msgstr "無法解æžä¿®è£œæª” '%s'"
+msgstr "無法解æžä¿®è£œæª” “%sâ€"
#: builtin/am.c
msgid "Only one StGIT patch series can be applied at once"
-msgstr "一次åªèƒ½æœ‰ä¸€å€‹ StGIT 修補檔佇列被套用"
+msgstr "一次åªèƒ½å¥—用一個 StGIT 修補檔åºåˆ—"
#: builtin/am.c
msgid "invalid timestamp"
@@ -2332,11 +2343,11 @@ msgstr "無效的時間戳"
#: builtin/am.c
msgid "invalid Date line"
-msgstr "無效的日期行"
+msgstr "無效的 Date 列"
#: builtin/am.c
msgid "invalid timezone offset"
-msgstr "無效的時å€ä½ç§»å€¼"
+msgstr "無效的時å€å移"
#: builtin/am.c
msgid "Patch format detection failed."
@@ -2345,74 +2356,74 @@ msgstr "修補檔格å¼åµæ¸¬å¤±æ•—。"
#: builtin/am.c builtin/clone.c
#, c-format
msgid "failed to create directory '%s'"
-msgstr "建立目錄 '%s' 失敗"
+msgstr "無法建立目錄 “%sâ€"
#: builtin/am.c
msgid "Failed to split patches."
-msgstr "分割修補檔失敗。"
+msgstr "無法切割修補檔。"
#: builtin/am.c
#, c-format
msgid "When you have resolved this problem, run \"%s --continue\"."
-msgstr "當您解決這一å•é¡Œï¼ŒåŸ·è¡Œ \"%s --continue\"。"
+msgstr "解決此å•é¡Œå¾Œï¼Œè«‹åŸ·è¡Œ “%s --continueâ€ã€‚"
#: builtin/am.c
#, c-format
msgid "If you prefer to skip this patch, run \"%s --skip\" instead."
-msgstr "如果您想è¦ç•¥éŽé€™ä¸€ä¿®è£œæª”,則執行 \"%s --skip\"。"
+msgstr "è‹¥è¦ç•¥éŽæ­¤ä¿®è£œï¼Œè«‹æ”¹åŸ·è¡Œ “%s --skipâ€ã€‚"
#: builtin/am.c
#, c-format
msgid "To record the empty patch as an empty commit, run \"%s --allow-empty\"."
-msgstr "è‹¥è¦å°‡ç©ºç™½ä¿®è£œæª”錄製為空白æ交,請執行「%s --allow-emptyã€ã€‚"
+msgstr "è‹¥è¦å°‡ç©ºç™½ä¿®è£œæª”錄入為空白æ交,請執行 “%s --allow-emptyâ€ã€‚"
#: builtin/am.c
#, c-format
msgid "To restore the original branch and stop patching, run \"%s --abort\"."
-msgstr "è‹¥è¦å¾©åŽŸè‡³åŽŸå§‹åˆ†æ”¯ä¸¦åœæ­¢ä¿®è£œå‹•ä½œï¼ŒåŸ·è¡Œ \"%s --abort\"。"
+msgstr "è‹¥è¦é‚„原至原始分支,並åœæ­¢ä¿®è£œå‹•ä½œï¼Œè«‹åŸ·è¡Œ “%s --abortâ€ã€‚"
#: builtin/am.c
msgid "Patch sent with format=flowed; space at the end of lines might be lost."
-msgstr "修補檔使用 format=flowed æ ¼å¼å‚³é€ï¼Œè¡Œå°¾çš„空格å¯èƒ½æœƒéºå¤±ã€‚"
+msgstr "修補檔使用 format=flowed æ ¼å¼å‚³é€ï¼šåˆ—尾的空格å¯èƒ½æœƒéºå¤±ã€‚"
#: builtin/am.c
#, c-format
msgid "missing author line in commit %s"
-msgstr "在æ交 %s 中缺少作者行"
+msgstr "在æ交 %s 中缺少作者列"
#: builtin/am.c
#, c-format
msgid "invalid ident line: %.*s"
-msgstr "無效的身份標記:%.*s"
+msgstr "ident 列無效:%.*s"
#: builtin/am.c builtin/checkout.c builtin/clone.c commit-graph.c
#, c-format
msgid "unable to parse commit %s"
-msgstr "ä¸èƒ½è§£æžæ交 %s"
+msgstr "ç„¡æ³•è§£æž %s æ交"
#: builtin/am.c
msgid "Repository lacks necessary blobs to fall back on 3-way merge."
-msgstr "版本庫缺ä¹å¿…è¦çš„資料物件以進行三方åˆä½µã€‚"
+msgstr "版本庫缺少必è¦çš„資料物件,無法進行三方åˆä½µã€‚"
#: builtin/am.c
msgid "Using index info to reconstruct a base tree..."
-msgstr "使用索引來é‡å»ºä¸€å€‹ï¼ˆä¸‰æ–¹åˆä½µçš„)基礎目錄樹..."
+msgstr "正在使用索引資訊é‡å»ºåŸºç¤Žæ¨¹â€¦â€¦"
#: builtin/am.c
msgid ""
"Did you hand edit your patch?\n"
"It does not apply to blobs recorded in its index."
msgstr ""
-"您是å¦æ›¾æ‰‹å‹•ç·¨è¼¯éŽæ‚¨çš„修補檔?\n"
-"無法套用修補檔到索引中的資料物件上。"
+"您是å¦æ›¾è‡ªè¡Œç·¨è¼¯éŽæ‚¨çš„修補檔?\n"
+"未能套用至索引錄入的資料物件。"
#: builtin/am.c
msgid "Falling back to patching base and 3-way merge..."
-msgstr "回è½åˆ°åŸºç¤Žç‰ˆæœ¬ä¸Šä¿®è£œåŠé€²è¡Œä¸‰æ–¹åˆä½µ..."
+msgstr "正在回復到修補基礎處,並進行三方åˆä½µâ€¦â€¦"
#: builtin/am.c
msgid "Failed to merge in the changes."
-msgstr "無法åˆä½µè®Šæ›´ã€‚"
+msgstr "無法åˆä½µæ›´å‹•ã€‚"
#: builtin/am.c builtin/merge.c sequencer.c
msgid "git write-tree failed to write a tree"
@@ -2420,12 +2431,12 @@ msgstr "git write-tree 無法寫入樹狀物件"
#: builtin/am.c
msgid "applying to an empty history"
-msgstr "正套用到一個空歷å²ä¸Š"
+msgstr "正在套用至空白歷å²è¨˜éŒ„上"
#: builtin/am.c builtin/commit.c builtin/merge.c sequencer.c
#: t/helper/test-fast-rebase.c
msgid "failed to write commit object"
-msgstr "寫æ交物件失敗"
+msgstr "無法寫入æ交物件"
#: builtin/am.c
#, c-format
@@ -2434,7 +2445,7 @@ msgstr "無法繼續:%s ä¸å­˜åœ¨ã€‚"
#: builtin/am.c
msgid "Commit Body is:"
-msgstr "æ交內容為:"
+msgstr "æ交內文為:"
# 譯者:請維æŒå¥å°¾ç©ºæ ¼
#. TRANSLATORS: Make sure to include [y], [n], [e], [v] and [a]
@@ -2444,7 +2455,7 @@ msgstr "æ交內容為:"
#: builtin/am.c
#, c-format
msgid "Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all: "
-msgstr "套用?是[y]/å¦[n]/編輯[e]/檢視修補檔[v]/全部接å—[a]: "
+msgstr "是å¦å¥—用?是[y]/å¦[n]/編輯[e]/檢視修補檔[v]/全部接å—[a]: "
#: builtin/am.c builtin/commit.c
msgid "unable to write index file"
@@ -2453,7 +2464,7 @@ msgstr "無法寫入索引檔案"
#: builtin/am.c
#, c-format
msgid "Dirty index: cannot apply patches (dirty: %s)"
-msgstr "髒索引:ä¸èƒ½å¥—用修補檔(髒檔案:%s)"
+msgstr "有異動索引:無法套用修補檔(異動處:%s)"
#: builtin/am.c
#, c-format
@@ -2467,7 +2478,7 @@ msgstr "建立空白æ交:%.*s"
#: builtin/am.c
msgid "Patch is empty."
-msgstr "修補檔為空。"
+msgstr "修補檔空白。"
#: builtin/am.c
#, c-format
@@ -2476,20 +2487,20 @@ msgstr "套用:%.*s"
#: builtin/am.c
msgid "No changes -- Patch already applied."
-msgstr "沒有變更——修補檔已經套用éŽã€‚"
+msgstr "沒有變更——修補檔已套用éŽã€‚"
#: builtin/am.c
#, c-format
msgid "Patch failed at %s %.*s"
-msgstr "打修補檔失敗於 %s %.*s"
+msgstr "在 %s %.*s 處修補失敗"
#: builtin/am.c
msgid "Use 'git am --show-current-patch=diff' to see the failed patch"
-msgstr "用 'git am --show-current-patch=diff' 命令檢視失敗的修補檔"
+msgstr "使用 “git am --show-current-patch=diff†命令檢視失敗的修補檔"
#: builtin/am.c
msgid "No changes - recorded it as an empty commit."
-msgstr "沒有變更 ï¼ å°‡å…¶éŒ„è£½ç‚ºç©ºç™½æ交。"
+msgstr "沒有變更:將其錄入為空白æ交。"
#: builtin/am.c
msgid ""
@@ -2497,9 +2508,9 @@ msgid ""
"If there is nothing left to stage, chances are that something else\n"
"already introduced the same changes; you might want to skip this patch."
msgstr ""
-"沒有變更 —— 您是ä¸æ˜¯å¿˜äº†åŸ·è¡Œ 'git add'?\n"
-"如果沒有什麼è¦æ–°å¢žåˆ°æš«å­˜å€çš„,則很å¯èƒ½æ˜¯å…¶å®ƒæ交已經引入了相åŒçš„變更。\n"
-"您也許想è¦ç•¥éŽé€™å€‹ä¿®è£œæª”。"
+"沒有變更:是å¦å¿˜è¨˜åŸ·è¡Œ “git addâ€ï¼Ÿ\n"
+"如果沒有其他è¦æ–°å¢žåˆ°æš«å­˜å€çš„,則很å¯èƒ½æ˜¯å…¶å®ƒæ交\n"
+"已經引入了相åŒçš„變更。您也許想è¦ç•¥éŽé€™å€‹ä¿®è£œæª”。"
#: builtin/am.c
msgid ""
@@ -2508,59 +2519,61 @@ msgid ""
"such.\n"
"You might run `git rm` on a file to accept \"deleted by them\" for it."
msgstr ""
-"在您的索引中ä»å­˜åœ¨æœªåˆä½µçš„路徑。\n"
-"您應該å°å·²ç¶“è¡çªè§£æ±ºçš„æ¯ä¸€å€‹æª”案執行 'git add' 來標記已經完æˆã€‚ \n"
-"ä½ å¯ä»¥å° \"由他們刪除\" 的檔案執行 `git rm` 指令。"
+"索引中ä»æœ‰æœªåˆä½µè·¯å¾‘。\n"
+"您應該å°å·²ç¶“解決è¡çªçš„æ¯ä¸€å€‹æª”案執行 `git add`,標記為已經完æˆã€‚\n"
+"ä½ å¯ä»¥å°ã€Œç”±ä»–們刪除ã€çš„檔案,執行 `git rm` 指令。"
#: builtin/am.c builtin/checkout.c builtin/clone.c builtin/stash.c merge.c
#: rerere.c
msgid "unable to write new index file"
-msgstr "無法寫新的索引檔案"
+msgstr "無法寫入新的索引檔案"
#: builtin/am.c builtin/reset.c
#, c-format
msgid "Could not parse object '%s'."
-msgstr "ä¸èƒ½è§£æžç‰©ä»¶ '%s'。"
+msgstr "ç„¡æ³•è§£æž â€œ%s†物件。"
#: builtin/am.c
msgid "failed to clean index"
-msgstr "清空索引失敗"
+msgstr "無法清除索引"
#: builtin/am.c
msgid ""
"You seem to have moved HEAD since the last 'am' failure.\n"
"Not rewinding to ORIG_HEAD"
-msgstr "您好åƒåœ¨ä¸Šä¸€æ¬¡ 'am' 失敗後移動了 HEAD。未還原至 ORIG_HEAD"
+msgstr ""
+"您似乎在上一次 “am†失敗後移動了 HEAD。\n"
+"未倒轉回 ORIG_HEAD"
#: builtin/am.c builtin/bisect--helper.c worktree.c
#, c-format
msgid "failed to read '%s'"
-msgstr "è®€å– '%s' 失敗"
+msgstr "ç„¡æ³•è®€å– â€œ%sâ€"
#: builtin/am.c
#, c-format
msgid "options '%s=%s' and '%s=%s' cannot be used together"
-msgstr "「%s=%sã€å’Œã€Œ%s=%sã€é¸é …ä¸å¾—åŒæ™‚使用"
+msgstr "“%s=%s†和 “%s=%s†é¸é …ä¸å¾—åŒæ™‚使用"
#: builtin/am.c
msgid "git am [<options>] [(<mbox> | <Maildir>)...]"
-msgstr "git am [<é¸é …>] [(<mbox> | <Maildir>)...]"
+msgstr "git am [<options>] [(<mbox> | <Maildir>)...]"
#: builtin/am.c
msgid "git am [<options>] (--continue | --skip | --abort)"
-msgstr "git am [<é¸é …>] (--continue | --skip | --abort)"
+msgstr "git am [<options>] (--continue | --skip | --abort)"
#: builtin/am.c
msgid "run interactively"
-msgstr "以互動å¼æ–¹å¼åŸ·è¡Œ"
+msgstr "互動å¼åŸ·è¡Œ"
#: builtin/am.c
msgid "historical option -- no-op"
-msgstr "è€çš„åƒæ•¸ —— 無作用"
+msgstr "æ­·å²éºç•™é¸é …——無作用"
#: builtin/am.c
msgid "allow fall back on 3way merging if needed"
-msgstr "如果必è¦ï¼Œå…許使用三方åˆä½µ"
+msgstr "å¿…è¦æ™‚å…許回復至三方åˆä½µ"
#: builtin/am.c builtin/init-db.c builtin/prune-packed.c builtin/repack.c
#: builtin/stash.c
@@ -2569,7 +2582,7 @@ msgstr "éœé»˜æ¨¡å¼"
#: builtin/am.c
msgid "add a Signed-off-by trailer to the commit message"
-msgstr "在æ交說明çµå°¾åŠ å…¥ Signed-off-by"
+msgstr "在æ交說明çµå°¾è™•åŠ å…¥ Signed-off-by"
#: builtin/am.c
msgid "recode into utf8 (default)"
@@ -2577,35 +2590,35 @@ msgstr "使用 utf8 字元集(é è¨­ï¼‰"
#: builtin/am.c
msgid "pass -k flag to git-mailinfo"
-msgstr "å‘ git-mailinfo å‚³éž -k åƒæ•¸"
+msgstr "å‘ git-mailinfo 傳入 -k åƒæ•¸"
#: builtin/am.c
msgid "pass -b flag to git-mailinfo"
-msgstr "å‘ git-mailinfo å‚³éž -b åƒæ•¸"
+msgstr "å‘ git-mailinfo 傳入 -b åƒæ•¸"
#: builtin/am.c
msgid "pass -m flag to git-mailinfo"
-msgstr "å‘ git-mailinfo å‚³éž -m åƒæ•¸"
+msgstr "å‘ git-mailinfo 傳入 -m åƒæ•¸"
#: builtin/am.c
msgid "pass --keep-cr flag to git-mailsplit for mbox format"
-msgstr "é‡å° mbox æ ¼å¼ï¼Œå‘ git-mailsplit å‚³éž --keep-cr åƒæ•¸"
+msgstr "若為 mbox æ ¼å¼ï¼Œå‘ git-mailsplit 傳入 --keep-cr 標記"
#: builtin/am.c
msgid "do not pass --keep-cr flag to git-mailsplit independent of am.keepcr"
-msgstr "ä¸å‘ git-mailsplit å‚³éž --keep-cr åƒæ•¸ï¼Œè¦†è“‹ am.keepcr 的設定"
+msgstr "ä¸å‘ git-mailsplit 傳入 --keep-cr 標記,無視 am.keepcr 的設定"
#: builtin/am.c
msgid "strip everything before a scissors line"
-msgstr "æ¨æ£„è£åˆ‡ç·šå‰çš„所有內容"
+msgstr "截掉è£åˆ‡ç·šå‰çš„所有內容"
#: builtin/am.c
msgid "pass it through git-mailinfo"
-msgstr "é€éŽ git-mailinfo 傳éž"
+msgstr "é€éŽ git-mailinfo 傳入"
#: builtin/am.c
msgid "pass it through git-apply"
-msgstr "傳éžçµ¦ git-apply"
+msgstr "é€éŽ git-apply 傳入"
#: builtin/am.c builtin/commit.c builtin/fmt-merge-msg.c builtin/grep.c
#: builtin/merge.c builtin/pull.c builtin/rebase.c builtin/repack.c
@@ -2617,7 +2630,7 @@ msgstr "n"
#: builtin/diagnose.c builtin/for-each-ref.c builtin/ls-files.c
#: builtin/ls-tree.c builtin/replace.c builtin/tag.c builtin/verify-tag.c
msgid "format"
-msgstr "æ ¼å¼"
+msgstr "format"
#: builtin/am.c
msgid "format the patch(es) are in"
@@ -2625,7 +2638,7 @@ msgstr "修補檔的格å¼"
#: builtin/am.c
msgid "override error message when patch failure occurs"
-msgstr "打修補檔失敗時顯示的錯誤訊æ¯"
+msgstr "覆蓋修補失敗時顯示的錯誤訊æ¯"
#: builtin/am.c
msgid "continue applying patches after resolving a conflict"
@@ -2645,7 +2658,7 @@ msgstr "還原原始分支並中止修補動作"
#: builtin/am.c
msgid "abort the patching operation but keep HEAD where it is"
-msgstr "終止修補動作但ä¿æŒ HEAD ä¸è®Š"
+msgstr "中止修補動作但ä¿æŒ HEAD ä¸è®Š"
#: builtin/am.c
msgid "show the patch being applied"
@@ -2653,15 +2666,15 @@ msgstr "顯示正在套用的修補檔"
#: builtin/am.c
msgid "record the empty patch as an empty commit"
-msgstr "將空白修補檔錄製為空白æ交"
+msgstr "將空白修補檔錄入為空白æ交"
#: builtin/am.c
msgid "lie about committer date"
-msgstr "將作者日期作為æ交日期"
+msgstr "將作者日期當作æ交日期"
#: builtin/am.c
msgid "use current timestamp for author date"
-msgstr "用目å‰æ™‚間作為作者日期"
+msgstr "把目å‰æ™‚間戳當作是作者日期"
#: builtin/am.c builtin/commit-tree.c builtin/commit.c builtin/merge.c
#: builtin/pull.c builtin/rebase.c builtin/revert.c builtin/tag.c
@@ -2685,8 +2698,8 @@ msgid ""
"The -b/--binary option has been a no-op for long time, and\n"
"it will be removed. Please do not use it anymore."
msgstr ""
-"åƒæ•¸ -b/--binary 已經很長時間ä¸åšä»»ä½•å¯¦è³ªå‹•ä½œäº†ï¼Œä¸¦ä¸”將被移除。\n"
-"è«‹ä¸è¦å†ä½¿ç”¨å®ƒäº†ã€‚"
+"-b/--binary é¸é …已經有很長時間ä¸åšä»»ä½•å¯¦è³ªå‹•ä½œäº†ï¼Œ\n"
+"並且將被移除。請ä¸è¦å†ä½¿ç”¨å®ƒäº†ã€‚"
#: builtin/am.c
msgid "failed to read the index"
@@ -2703,49 +2716,49 @@ msgid ""
"Stray %s directory found.\n"
"Use \"git am --abort\" to remove it."
msgstr ""
-"發ç¾äº†éŒ¯èª¤çš„ %s 目錄。\n"
-"使用 \"git am --abort\" 刪除它。"
+"發ç¾å¤±æ•£çš„ %s 目錄。\n"
+"使用 “git am --abort†移除。"
#: builtin/am.c
msgid "Resolve operation not in progress, we are not resuming."
-msgstr "解決動作未進行,我們ä¸æœƒç¹¼çºŒã€‚"
+msgstr "未在進行解決動作,ä¸æœƒç¹¼çºŒã€‚"
#: builtin/am.c
msgid "interactive mode requires patches on the command line"
-msgstr "互動å¼æ¨¡å¼éœ€è¦æŒ‡ä»¤åˆ—上æ供修補檔"
+msgstr "互動模å¼éœ€è¦å‘½ä»¤åˆ—上æ供修補檔"
#: builtin/apply.c
msgid "git apply [<options>] [<patch>...]"
-msgstr "git apply [<é¸é …>] [<修補檔>...]"
+msgstr "git apply [<options>] [<patch>...]"
#: builtin/archive.c diagnose.c
msgid "could not redirect output"
-msgstr "ä¸èƒ½é‡å®šå‘輸出"
+msgstr "無法é‡æ–°å°Žå‘輸出"
#: builtin/archive.c
msgid "git archive: Remote with no URL"
-msgstr "git archive:未æä¾›é ç«¯ URL"
+msgstr "git archive: 未æä¾›é ç«¯ URL"
#: builtin/archive.c
msgid "git archive: expected ACK/NAK, got a flush packet"
-msgstr "git archive:期望是 ACK/NAK,å»å¾—到 flush 包"
+msgstr "git archive:é æœŸæ˜¯ ACK/NAK,å»æ”¶åˆ° flush å°åŒ…"
#: builtin/archive.c
#, c-format
msgid "git archive: NACK %s"
-msgstr "git archive:NACK %s"
+msgstr "git archive: NACK %s"
#: builtin/archive.c
msgid "git archive: protocol error"
-msgstr "git archive:å”定錯誤"
+msgstr "git archive:通訊å”定錯誤"
#: builtin/archive.c
msgid "git archive: expected a flush"
-msgstr "git archive:應有一個 flush 包"
+msgstr "git archive:é æœŸæ”¶åˆ° flush å°åŒ…"
#: builtin/bisect--helper.c
msgid "git bisect--helper --bisect-reset [<commit>]"
-msgstr "git bisect--helper --bisect-reset [<æ交>]"
+msgstr "git bisect--helper --bisect-reset [<commit>]"
#: builtin/bisect--helper.c
msgid ""
@@ -2753,24 +2766,25 @@ msgid ""
"=<term>] [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] "
"[<paths>...]"
msgstr ""
-"git bisect--helper --bisect-start [--term-{new,bad}=<術語> --term-{old,good}"
-"=<術語>] [--no-checkout] [--first-parent] [<壞> [<好>...]] [--] [<路徑>...]"
+"git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}"
+"=<term>] [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] "
+"[<paths>...]"
#: builtin/bisect--helper.c
msgid "git bisect--helper --bisect-state (bad|new) [<rev>]"
-msgstr "git bisect--helper --bisect-state (bad|new) [<修訂版>]"
+msgstr "git bisect--helper --bisect-state (bad|new) [<rev>]"
#: builtin/bisect--helper.c
msgid "git bisect--helper --bisect-state (good|old) [<rev>...]"
-msgstr "git bisect--helper --bisect-state (good|old) [<修訂版>...]"
+msgstr "git bisect--helper --bisect-state (good|old) [<rev>...]"
#: builtin/bisect--helper.c
msgid "git bisect--helper --bisect-replay <filename>"
-msgstr "git bisect--helper --bisect-replay <檔å>"
+msgstr "git bisect--helper --bisect-replay <filename>"
#: builtin/bisect--helper.c
msgid "git bisect--helper --bisect-skip [(<rev>|<range>)...]"
-msgstr "git bisect--helper --bisect-skip [(<修訂版>|<範åœ>)...]"
+msgstr "git bisect--helper --bisect-skip [(<rev>|<range>)...]"
#: builtin/bisect--helper.c
msgid "git bisect--helper --bisect-run <cmd>..."
@@ -2779,32 +2793,32 @@ msgstr "git bisect--helper --bisect-run <cmd>..."
#: builtin/bisect--helper.c
#, c-format
msgid "cannot open file '%s' in mode '%s'"
-msgstr "無法以 '%2$s' 模å¼é–‹å•Ÿ '%1$s' 檔案"
+msgstr "無法以 “%2$s†模å¼é–‹å•Ÿ “%1$s†檔案"
#: builtin/bisect--helper.c
#, c-format
msgid "could not write to file '%s'"
-msgstr "無法寫入 '%s' 檔案"
+msgstr "無法寫入 “%s†檔案"
#: builtin/bisect--helper.c
#, c-format
msgid "cannot open file '%s' for reading"
-msgstr "無法開啟「%sã€æª”案進行讀å–"
+msgstr "無法開啟 “%s†檔案進行讀å–"
#: builtin/bisect--helper.c
#, c-format
msgid "'%s' is not a valid term"
-msgstr "'%s' ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„術語"
+msgstr "“%s†ä¸æ˜¯æœ‰æ•ˆè¡“語"
#: builtin/bisect--helper.c
#, c-format
msgid "can't use the builtin command '%s' as a term"
-msgstr "ä¸èƒ½ä½¿ç”¨å…§å»ºæŒ‡ä»¤ '%s' 作為術語"
+msgstr "ä¸èƒ½å°‡å…§å»ºå‘½ä»¤ “%s†當作術語使用"
#: builtin/bisect--helper.c
#, c-format
msgid "can't change the meaning of the term '%s'"
-msgstr "ä¸èƒ½ä¿®æ”¹è¡“語 '%s' çš„å«ç¾©"
+msgstr "ä¸èƒ½è®Šæ›´è¡“語 “%s†的å«ç¾©"
#: builtin/bisect--helper.c
msgid "please use two different terms"
@@ -2818,33 +2832,33 @@ msgstr "我們沒有在二分æœå°‹ã€‚\n"
#: builtin/bisect--helper.c
#, c-format
msgid "'%s' is not a valid commit"
-msgstr "'%s' ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„æ交"
+msgstr "“%s†ä¸æ˜¯æœ‰æ•ˆçš„æ交"
#: builtin/bisect--helper.c
#, c-format
msgid ""
"could not check out original HEAD '%s'. Try 'git bisect reset <commit>'."
-msgstr "ä¸èƒ½ç°½å‡ºåŽŸå§‹ HEAD '%s'。嘗試 'git bisect reset <æ交>'。"
+msgstr "ä¸èƒ½ç°½å‡ºåŽŸå§‹ HEAD “%sâ€ã€‚請嘗試 “git bisect reset <commit>â€ã€‚"
#: builtin/bisect--helper.c
#, c-format
msgid "Bad bisect_write argument: %s"
-msgstr "壞的 bisect_write åƒæ•¸ï¼š%s"
+msgstr "bisect_write 引數無效:%s"
#: builtin/bisect--helper.c
#, c-format
msgid "couldn't get the oid of the rev '%s'"
-msgstr "無法å–得版本 '%s' 的物件 ID"
+msgstr "無法å–得修訂版 “%s†的物件 ID"
#: builtin/bisect--helper.c
#, c-format
msgid "couldn't open the file '%s'"
-msgstr "無法開啟檔案 '%s'"
+msgstr "無法開啟檔案 “%sâ€"
#: builtin/bisect--helper.c
#, c-format
msgid "Invalid command: you're currently in a %s/%s bisect"
-msgstr "無效的指令:您目å‰æ­£è™•æ–¼ä¸€å€‹ %s/%s 二分æœå°‹ä¸­"
+msgstr "命令無效:您目å‰æ­£è™•æ–¼äºŒåˆ†æœå°‹ %s/%s 的狀態"
#: builtin/bisect--helper.c
#, c-format
@@ -2852,8 +2866,8 @@ msgid ""
"You need to give me at least one %s and %s revision.\n"
"You can use \"git bisect %s\" and \"git bisect %s\" for that."
msgstr ""
-"您需è¦çµ¦æˆ‘至少一個 %s 和一個 %s 版本。\n"
-"為此您å¯ä»¥ç”¨ \"git bisect %s\" å’Œ \"git bisect %s\"。"
+"需指定至少一個 %s 和一個 %s 修訂版。\n"
+"為此您å¯ä»¥ç”¨ “git bisect %s†和 “git bisect %sâ€ã€‚"
#: builtin/bisect--helper.c
#, c-format
@@ -2862,9 +2876,9 @@ msgid ""
"You then need to give me at least one %s and %s revision.\n"
"You can use \"git bisect %s\" and \"git bisect %s\" for that."
msgstr ""
-"您需è¦åŸ·è¡Œ \"git bisect start\" 來開始。\n"
-"然後需è¦æ供我至少一個 %s 和一個 %s 版本。\n"
-"為此您å¯ä»¥ç”¨ \"git bisect %s\" å’Œ \"git bisect %s\" 指令。"
+"è¦é–‹å§‹ï¼Œè«‹åŸ·è¡Œ “git bisect startâ€ã€‚\n"
+"接著æ供至少一個 %s 和一個 %s 修訂版。\n"
+"為此您å¯ä»¥ç”¨ “git bisect %s†和 “git bisect %sâ€ã€‚"
#: builtin/bisect--helper.c
#, c-format
@@ -2878,7 +2892,7 @@ msgstr "在åªæœ‰ä¸€å€‹ %s æ交的情æ³ä¸‹äºŒåˆ†æœå°‹"
#.
#: builtin/bisect--helper.c
msgid "Are you sure [Y/n]? "
-msgstr "您確èªå—Ž[Y/n]? "
+msgstr "是å¦ç¢ºå®š [Y/n]? "
#: builtin/bisect--helper.c
msgid "status: waiting for both good and bad commits\n"
@@ -2903,7 +2917,9 @@ msgstr "未定義術語"
msgid ""
"Your current terms are %s for the old state\n"
"and %s for the new state.\n"
-msgstr "您目å‰é‡å°èˆŠç‹€æ…‹çš„術語是 %s,å°æ–°ç‹€æ…‹çš„術語是 %s。\n"
+msgstr ""
+"您目å‰é‡å°èˆŠç‹€æ…‹çš„術語是 %sï¼›\n"
+"å°æ–°ç‹€æ…‹çš„術語是 %s。\n"
#: builtin/bisect--helper.c
#, c-format
@@ -2911,57 +2927,57 @@ msgid ""
"invalid argument %s for 'git bisect terms'.\n"
"Supported options are: --term-good|--term-old and --term-bad|--term-new."
msgstr ""
-"指令 'git bisect terms' çš„åƒæ•¸ %s 無效。\n"
+"傳入 “git bisect terms†的 %s 引數無效。\n"
"支æ´çš„é¸é …有:--term-good|--term-old å’Œ --term-bad|--term-new。"
#: builtin/bisect--helper.c
msgid "revision walk setup failed\n"
-msgstr "版本é歷設定失敗\n"
+msgstr "修訂版é歷設定失敗\n"
#: builtin/bisect--helper.c
#, c-format
msgid "could not open '%s' for appending"
-msgstr "無法開啟 '%s' 進行附加"
+msgstr "無法開啟 “%s†進行附加"
#: builtin/bisect--helper.c
msgid "'' is not a valid term"
-msgstr "'' ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„術語"
+msgstr "“ †ä¸æ˜¯æœ‰æ•ˆè¡“語"
#: builtin/bisect--helper.c
#, c-format
msgid "unrecognized option: '%s'"
-msgstr "未識別的é¸é …:'%s'"
+msgstr "無法識別é¸é …:“%sâ€"
#: builtin/bisect--helper.c
#, c-format
msgid "'%s' does not appear to be a valid revision"
-msgstr "'%s' 看起來ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„版本"
+msgstr "“%s†似乎ä¸æ˜¯æœ‰æ•ˆä¿®è¨‚版"
#: builtin/bisect--helper.c
msgid "bad HEAD - I need a HEAD"
-msgstr "壞的 HEAD - 我需è¦ä¸€å€‹ HEAD"
+msgstr "HEAD 無效 — 需è¦ä¸€å€‹ HEAD"
#: builtin/bisect--helper.c
#, c-format
msgid "checking out '%s' failed. Try 'git bisect start <valid-branch>'."
-msgstr "簽出 '%s' 失敗。嘗試 'git bisect start <有效分支>'。"
+msgstr "簽出 “%s†失敗。請嘗試 “git bisect start <valid-branch>â€ã€‚"
#: builtin/bisect--helper.c
msgid "won't bisect on cg-seek'ed tree"
-msgstr "ä¸æœƒåœ¨åšäº† cg-seek 的樹上åšäºŒåˆ†æœå°‹"
+msgstr "ä¸æœƒåœ¨åšäº† cg-seek 的樹狀物件上進行二分æœå°‹"
#: builtin/bisect--helper.c
msgid "bad HEAD - strange symbolic ref"
-msgstr "壞的 HEAD - 奇怪的符號引用"
+msgstr "HEAD 無效 — 異常符號引用"
#: builtin/bisect--helper.c
#, c-format
msgid "invalid ref: '%s'"
-msgstr "無效的引用:'%s'"
+msgstr "引用無效:“%sâ€"
#: builtin/bisect--helper.c
msgid "You need to start by \"git bisect start\"\n"
-msgstr "您需è¦åŸ·è¡Œ \"git bisect start\" 來開始\n"
+msgstr "è¦é–‹å§‹ï¼Œè«‹åŸ·è¡Œ “git bisect startâ€\n"
# 譯者:請維æŒå¥å°¾ç©ºæ ¼
#. TRANSLATORS: Make sure to include [Y] and [n] in your
@@ -2970,7 +2986,7 @@ msgstr "您需è¦åŸ·è¡Œ \"git bisect start\" 來開始\n"
#.
#: builtin/bisect--helper.c
msgid "Do you want me to do it for you [Y/n]? "
-msgstr "您想讓我為您這樣åšå—Ž[Y/n]? "
+msgstr "是å¦è¦é€™éº¼åš [Y/n]? "
#: builtin/bisect--helper.c
msgid "Please call `--bisect-state` with at least one argument"
@@ -2979,17 +2995,17 @@ msgstr "è¦å‘¼å« `--bisect-state`,請傳入一個以上的引數"
#: builtin/bisect--helper.c
#, c-format
msgid "'git bisect %s' can take only one argument."
-msgstr "'git bisect %s' åªèƒ½æœ‰ä¸€å€‹åƒæ•¸ã€‚"
+msgstr "“git bisect %s†åªå–一個引數。"
#: builtin/bisect--helper.c
#, c-format
msgid "Bad rev input: %s"
-msgstr "<修訂版> 輸入格å¼éŒ¯èª¤ï¼š%s"
+msgstr "rev 輸入格å¼éŒ¯èª¤ï¼š%s"
#: builtin/bisect--helper.c
#, c-format
msgid "Bad rev input (not a commit): %s"
-msgstr "修訂版輸入有誤(ä¸æ˜¯æ交):%s"
+msgstr "rev 輸入有誤(ä¸æ˜¯æ交):%s"
#: builtin/bisect--helper.c
msgid "We are not bisecting."
@@ -3003,7 +3019,7 @@ msgstr "「%sã€ï¼Ÿï¼Ÿæ‚¨åœ¨èªªä»€éº¼ï¼Ÿ"
#: builtin/bisect--helper.c
#, c-format
msgid "cannot read file '%s' for replaying"
-msgstr "無法讀å–「%sã€æª”案來é‡æ”¾"
+msgstr "無法讀å–「%sã€æª”案進行é‡æ”¾"
#: builtin/bisect--helper.c
#, c-format
@@ -3012,27 +3028,27 @@ msgstr "正在執行 %s\n"
#: builtin/bisect--helper.c
msgid "bisect run failed: no command provided."
-msgstr "二分æœå°‹åŸ·è¡Œå¤±æ•—:沒有æ供指令。"
+msgstr "二分æœå°‹åŸ·è¡Œå¤±æ•—:沒有æ供命令。"
#: builtin/bisect--helper.c
#, c-format
msgid "unable to verify '%s' on good revision"
-msgstr "無法在正確修訂版上驗證「%sã€"
+msgstr "無法在好的修訂版上驗證 “%sâ€"
#: builtin/bisect--helper.c
#, c-format
msgid "bogus exit code %d for good revision"
-msgstr "正確修訂版回傳å½é€ çš„錯誤代碼 %d"
+msgstr "好的修訂版回傳å½é€ çš„錯誤碼 %d"
#: builtin/bisect--helper.c
#, c-format
msgid "bisect run failed: exit code %d from '%s' is < 0 or >= 128"
-msgstr "二分æœå°‹åŸ·è¡Œå¤±æ•—:「%2$sã€è¿”回的離開碼 %1$d å°æ–¼ 0 或 >= 128"
+msgstr "二分æœå°‹åŸ·è¡Œå¤±æ•—:“%2$s†回傳的離開碼 %1$d å°æ–¼ 0 或 >= 128"
#: builtin/bisect--helper.c
#, c-format
msgid "cannot open file '%s' for writing"
-msgstr "無法開啟「%sã€æª”案進行寫入"
+msgstr "無法開啟 “%s†檔案進行寫入"
#: builtin/bisect--helper.c
msgid "bisect run cannot continue any more"
@@ -3054,63 +3070,15 @@ msgid ""
"bisect run failed: 'git bisect--helper --bisect-state %s' exited with error "
"code %d"
msgstr ""
-"二分æœå°‹åŸ·è¡Œå¤±æ•—:'git bisect--helper --bisect-state %s' 以錯誤代碼 %d 離開"
-
-#: builtin/bisect--helper.c
-msgid "reset the bisection state"
-msgstr "清除二分æœå°‹ç‹€æ…‹"
-
-#: builtin/bisect--helper.c
-msgid "check whether bad or good terms exist"
-msgstr "檢查壞的或好的術語是å¦å­˜åœ¨"
-
-#: builtin/bisect--helper.c
-msgid "print out the bisect terms"
-msgstr "列å°äºŒåˆ†æœå°‹è¡“語"
-
-#: builtin/bisect--helper.c
-msgid "start the bisect session"
-msgstr "啟動二分æœå°‹éŽç¨‹"
-
-#: builtin/bisect--helper.c
-msgid "find the next bisection commit"
-msgstr "尋找下一個二分æœå°‹æ交"
-
-#: builtin/bisect--helper.c
-msgid "mark the state of ref (or refs)"
-msgstr "標記 ref (或 refs) 的狀態"
-
-#: builtin/bisect--helper.c
-msgid "list the bisection steps so far"
-msgstr "列出迄今的二分æœå°‹æ­¥é©Ÿ"
-
-#: builtin/bisect--helper.c
-msgid "replay the bisection process from the given file"
-msgstr "從指定檔案é‡æ”¾äºŒåˆ†æœå°‹éŽç¨‹"
-
-#: builtin/bisect--helper.c
-msgid "skip some commits for checkout"
-msgstr "ç•¥éŽè¦ç°½å‡ºçš„部分æ交"
-
-#: builtin/bisect--helper.c
-msgid "visualize the bisection"
-msgstr "視覺化二分æœå°‹éŽç¨‹"
-
-#: builtin/bisect--helper.c
-msgid "use <cmd>... to automatically bisect"
-msgstr "使用 <cmd>... 自動進行二分æœå°‹"
-
-#: builtin/bisect--helper.c
-msgid "no log for BISECT_WRITE"
-msgstr "BISECT_WRITE 無日誌"
+"二分æœå°‹åŸ·è¡Œå¤±æ•—:“git bisect--helper --bisect-state %s†以錯誤碼 %d 離開"
#: builtin/bisect--helper.c
msgid "--bisect-reset requires either no argument or a commit"
-msgstr "--bisect-reset 無需åƒæ•¸æˆ–者需è¦ä¸€å€‹æ交"
+msgstr "--bisect-reset å¯ä»¥ä¸éœ€è¦å¼•æ•¸ï¼Œæˆ–者得傳入一個æ交"
#: builtin/bisect--helper.c
msgid "--bisect-terms requires 0 or 1 argument"
-msgstr "--bisect-terms éœ€è¦ 0 或 1 個åƒæ•¸"
+msgstr "--bisect-terms éœ€è¦ 0 或 1 個引數"
#: builtin/bisect--helper.c
msgid "--bisect-next requires 0 arguments"
@@ -3129,6 +3097,10 @@ msgid "git blame [<options>] [<rev-opts>] [<rev>] [--] <file>"
msgstr "git blame [<é¸é …>] [<版本é¸é …>] [<版本>] [--] <檔案>"
#: builtin/blame.c
+msgid "git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>"
+msgstr "git annotate [<é¸é …>] [<版本é¸é …>] [<版本>] [--] <檔案>"
+
+#: builtin/blame.c
msgid "<rev-opts> are documented in git-rev-list(1)"
msgstr "<版本é¸é …> 的檔案記錄在 git-rev-list(1) 中"
@@ -3367,10 +3339,6 @@ msgid "cannot use -a with -d"
msgstr "ä¸èƒ½å°‡ -a å’Œ -d åŒæ™‚使用"
#: builtin/branch.c
-msgid "Couldn't look up commit object for HEAD"
-msgstr "無法查詢 HEAD 指å‘çš„æ交物件"
-
-#: builtin/branch.c
#, c-format
msgid "Cannot delete branch '%s' checked out at '%s'"
msgstr "無法刪除在「%2$sã€ç°½å‡ºçš„「%1$sã€åˆ†æ”¯"
@@ -3419,17 +3387,19 @@ msgid "Branch %s is being bisected at %s"
msgstr "分支 %s 正被二分æœå°‹æ–¼ %s"
#: builtin/branch.c
-msgid "cannot copy the current branch while not on any."
-msgstr "無法複製目å‰åˆ†æ”¯å› ç‚ºä¸è™•æ–¼ä»»ä½•åˆ†æ”¯ä¸Šã€‚"
+#, c-format
+msgid "Invalid branch name: '%s'"
+msgstr "無效的分支å:'%s'"
#: builtin/branch.c
-msgid "cannot rename the current branch while not on any."
-msgstr "無法é‡æ–°å‘½åç›®å‰åˆ†æ”¯å› ç‚ºä¸è™•æ–¼ä»»ä½•åˆ†æ”¯ä¸Šã€‚"
+#, c-format
+msgid "No commit on branch '%s' yet."
+msgstr "分支 '%s' å°šç„¡æ交。"
#: builtin/branch.c
#, c-format
-msgid "Invalid branch name: '%s'"
-msgstr "無效的分支å:'%s'"
+msgid "No branch named '%s'."
+msgstr "沒有分支 '%s'。"
#: builtin/branch.c
msgid "Branch rename failed"
@@ -3638,14 +3608,12 @@ msgid "cannot edit description of more than one branch"
msgstr "ä¸èƒ½ç‚ºä¸€å€‹ä»¥ä¸Šçš„分支編輯æè¿°"
#: builtin/branch.c
-#, c-format
-msgid "No commit on branch '%s' yet."
-msgstr "分支 '%s' å°šç„¡æ交。"
+msgid "cannot copy the current branch while not on any."
+msgstr "無法複製目å‰åˆ†æ”¯å› ç‚ºä¸è™•æ–¼ä»»ä½•åˆ†æ”¯ä¸Šã€‚"
#: builtin/branch.c
-#, c-format
-msgid "No branch named '%s'."
-msgstr "沒有分支 '%s'。"
+msgid "cannot rename the current branch while not on any."
+msgstr "無法é‡æ–°å‘½åç›®å‰åˆ†æ”¯å› ç‚ºä¸è™•æ–¼ä»»ä½•åˆ†æ”¯ä¸Šã€‚"
#: builtin/branch.c
msgid "too many branches for a copy operation"
@@ -3726,11 +3694,11 @@ msgstr "ä¸æ˜¯å¾ž git 版本庫執行 - 沒有å¯é¡¯ç¤ºçš„掛鉤\n"
#: builtin/bugreport.c
msgid ""
-"git bugreport [-o|--output-directory <file>] [-s|--suffix <format>] [--"
-"diagnose[=<mode>]"
+"git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--diagnose[=<mode>]]"
msgstr ""
-"git bugreport [-o|--output-directory <file>] [-s|--suffix <format>] [--"
-"diagnose[=<mode>]"
+"git bugreport [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--diagnose[=<mode>]]"
#: builtin/bugreport.c
msgid ""
@@ -3778,7 +3746,7 @@ msgstr "建立詳細診斷資訊的é¡å¤– zip å°å­˜æª”案(é è¨­å€¼æ˜¯ “sta
#: builtin/bugreport.c
msgid "specify a destination for the bugreport file(s)"
-msgstr "指定錯誤報告檔案的目的地"
+msgstr "請指定臭蟲報告檔案的目的地"
#: builtin/bugreport.c
msgid "specify a strftime format suffix for the filename(s)"
@@ -3813,20 +3781,26 @@ msgid "Created new report at '%s'.\n"
msgstr "已在「%sã€å»ºç«‹æ–°å ±å‘Šã€‚\n"
#: builtin/bundle.c
-msgid "git bundle create [<options>] <file> <git-rev-list args>"
-msgstr "git bundle create [<é¸é …>] <檔案> <git-rev-list åƒæ•¸>"
+msgid ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<version>] <file> <git-rev-list-args>"
+msgstr ""
+"git bundle create [-q | --quiet | --progress | --all-progress] [--all-"
+"progress-implied]\n"
+" [--version=<version>] <file> <git-rev-list-args>"
#: builtin/bundle.c
-msgid "git bundle verify [<options>] <file>"
-msgstr "git bundle verify [<é¸é …>] <檔案>"
+msgid "git bundle verify [-q | --quiet] <file>"
+msgstr "git bundle verify [-q | --quiet] <file>"
#: builtin/bundle.c
msgid "git bundle list-heads <file> [<refname>...]"
msgstr "git bundle list-heads <檔案> [<引用å稱>...]"
#: builtin/bundle.c
-msgid "git bundle unbundle <file> [<refname>...]"
-msgstr "git bundle unbundle <檔案> [<引用å稱>...]"
+msgid "git bundle unbundle [--progress] <file> [<refname>...]"
+msgstr "git bundle unbundle [--progress] <file> [<refname>...]"
#: builtin/bundle.c builtin/pack-objects.c
msgid "do not show progress meter"
@@ -3846,15 +3820,15 @@ msgstr "當進度表顯示時類似於 --all-progress"
#: builtin/bundle.c
msgid "specify bundle format version"
-msgstr "指定套件的格å¼ç‰ˆæœ¬"
+msgstr "指定套件包的格å¼ç‰ˆæœ¬"
#: builtin/bundle.c
msgid "Need a repository to create a bundle."
-msgstr "需è¦ç‰ˆæœ¬åº«ä¾†å»ºç«‹å¥—件。"
+msgstr "需è¦ç‰ˆæœ¬åº«ä¾†å»ºç«‹å¥—件包。"
#: builtin/bundle.c
msgid "do not show bundle details"
-msgstr "ä¸é¡¯ç¤ºå¥—件詳細資訊"
+msgstr "ä¸é¡¯ç¤ºå¥—件包的詳細資訊"
#: builtin/bundle.c
#, c-format
@@ -3863,7 +3837,7 @@ msgstr "%s å¯ä»¥\n"
#: builtin/bundle.c
msgid "Need a repository to unbundle."
-msgstr "需è¦ç‰ˆæœ¬åº«æ‰èƒ½æ‹†åˆ†å¥—件。"
+msgstr "需è¦ç‰ˆæœ¬åº«æ‰èƒ½æ‹†åˆ†å¥—件包。"
#: builtin/bundle.c
msgid "Unbundling objects"
@@ -3923,12 +3897,12 @@ msgid ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
msgstr ""
"git cat-file (--batch | --batch-check | --batch-command) [--batch-all-"
"objects]\n"
" [--buffer] [--follow-symlinks] [--unordered]\n"
-" [--textconv | --filters]"
+" [--textconv | --filters] [-z]"
#: builtin/cat-file.c
msgid ""
@@ -3984,7 +3958,7 @@ msgstr "é¡žä¼¼ --batch 但ä¸è¼¸å‡º <contents>"
#: builtin/cat-file.c
msgid "stdin is NUL-terminated"
-msgstr "標準輸入的çµå°¾æ˜¯ NUL"
+msgstr "標準輸入以 NUL 字元終止"
#: builtin/cat-file.c
msgid "read commands from stdin"
@@ -4065,11 +4039,6 @@ msgstr "<rev> 需è¦æ­é…「%sã€"
msgid "<object> required with '-%c'"
msgstr "<object> 需è¦æ­é…「-%cã€"
-#: builtin/cat-file.c builtin/notes.c builtin/prune-packed.c
-#: builtin/receive-pack.c builtin/tag.c
-msgid "too many arguments"
-msgstr "太多åƒæ•¸"
-
#: builtin/cat-file.c
#, c-format
msgid "only two arguments allowed in <type> <object> mode, not %d"
@@ -4714,9 +4683,10 @@ msgstr "使用疊加模å¼"
#: builtin/clean.c
msgid ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <paths>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] "
+"[<pathspec>...]"
msgstr ""
-"git clean [-d] [-f] [-i] [-n] [-q] [-e <模å¼>] [-x | -X] [--] <路徑>..."
+"git clean [-d] [-f] [-i] [-n] [-q] [-e <模å¼>] [-x | -X] [--] [<路徑è¦æ ¼>...]"
#: builtin/clean.c
#, c-format
@@ -5059,7 +5029,7 @@ msgstr "uri"
#: builtin/clone.c
msgid "a URI for downloading bundles before fetching from origin remote"
-msgstr "在從 origin é ç«¯æŠ“å–å‰ï¼Œç”¨ä¾†ä¸‹è¼‰å¥—件的 URI"
+msgstr "在從 origin é ç«¯æŠ“å–å‰ï¼Œç”¨ä¾†ä¸‹è¼‰å¥—件包的 URI"
#: builtin/clone.c
#, c-format
@@ -5081,6 +5051,11 @@ msgstr "%s 存在且ä¸æ˜¯ä¸€å€‹ç›®éŒ„"
msgid "failed to start iterator over '%s'"
msgstr "無法在 '%s' 上啟動疊代器"
+#: builtin/clone.c
+#, c-format
+msgid "symlink '%s' exists, refusing to clone with --local"
+msgstr "「%sã€ç¬¦è™Ÿé€£çµå·²å­˜åœ¨ï¼Œæ‹’絕使用 --local 複製"
+
#: builtin/clone.c compat/precompose_utf8.c
#, c-format
msgid "failed to unlink '%s'"
@@ -5136,7 +5111,7 @@ msgstr "無法åˆå§‹åŒ–稀ç–簽出"
#: builtin/clone.c
msgid "remote HEAD refers to nonexistent ref, unable to checkout"
-msgstr "é ç«¯ HEAD 指å‘ä¸å­˜åœ¨çš„引用,無法簽出"
+msgstr "é ç«¯ HEAD 指å‘一個ä¸å­˜åœ¨çš„引用,無法簽出"
#: builtin/clone.c
msgid "unable to checkout working tree"
@@ -5163,11 +5138,6 @@ msgid "You must specify a repository to clone."
msgstr "您必須指定è¦è¤‡è£½çš„版本庫。"
#: builtin/clone.c
-#, c-format
-msgid "options '%s' and '%s %s' cannot be used together"
-msgstr "「%sã€å’Œã€Œ%s %sã€é¸é …ä¸å¾—åŒæ™‚使用"
-
-#: builtin/clone.c
msgid ""
"--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-"
"exclude"
@@ -5259,16 +5229,16 @@ msgstr "--local 被忽略"
#: builtin/clone.c
msgid "cannot clone from filtered bundle"
-msgstr "無法從éŽæ¿¾å¾Œçš„套件複製"
+msgstr "無法從éŽæ¿¾å¾Œçš„套件包複製"
#: builtin/clone.c
msgid "failed to initialize the repo, skipping bundle URI"
-msgstr "無法åˆå§‹åŒ–版本庫,略éŽå¥—件 URI"
+msgstr "無法åˆå§‹åŒ–版本庫,略éŽå¥—件包 URI"
#: builtin/clone.c
#, c-format
msgid "failed to fetch objects from bundle URI '%s'"
-msgstr "無法從套件 URL “%s†抓å–物件"
+msgstr "無法從套件包 URL “%s†抓å–物件"
#: builtin/clone.c
msgid "remote transport reported error"
@@ -5317,22 +5287,27 @@ msgstr "--command 必須是第一個åƒæ•¸"
#: builtin/commit-graph.c
msgid ""
-"git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress]"
+"git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]"
msgstr ""
-"git commit-graph verify [--object-dir <物件目錄>] [--shallow] [--"
-"[no-]progress]"
+"git commit-graph verify [--object-dir <目錄>] [--shallow] [--[no-]progress]"
#: builtin/commit-graph.c
msgid ""
-"git commit-graph write [--object-dir <objdir>] [--append] [--"
-"split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] <split options>"
-msgstr ""
-"git commit-graph write [--object-dir <objdir>] [--append] [--"
-"split[=<strategy>]] [--reachable|--stdin-packs|--stdin-commits] [--changed-"
-"paths] [--[no-]max-new-filters <n>] [--[no-]progress] <split options>"
-
-#: builtin/commit-graph.c builtin/fetch.c builtin/log.c
+"git commit-graph write [--object-dir <dir>] [--append]\n"
+" [--split[=<strategy>]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <split options>"
+msgstr ""
+"git commit-graph write [--object-dir <dir>] [--append]\n"
+" [--split[=<strategy>]] [--reachable | --stdin-packs | "
+"--stdin-commits]\n"
+" [--changed-paths] [--[no-]max-new-filters <n>] [--"
+"[no-]progress]\n"
+" <split options>"
+
+#: builtin/commit-graph.c builtin/fetch.c builtin/log.c builtin/repack.c
msgid "dir"
msgstr "目錄"
@@ -5418,12 +5393,16 @@ msgid "Collecting commits from input"
msgstr "正在從輸入收集æ交"
#: builtin/commit-tree.c
+msgid "git commit-tree <tree> [(-p <parent>)...]"
+msgstr "git commit-tree <tree> [(-p <parent>)...]"
+
+#: builtin/commit-tree.c
msgid ""
-"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...] [(-F "
-"<file>)...] <tree>"
+"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n"
+" [(-F <file>)...] <tree>"
msgstr ""
-"git commit-tree [(-p <父æ交>)...] [-S[<keyid>]] [(-m <消æ¯>)...] [(-F <檔案"
-">)...] <樹>"
+"git commit-tree [(-p <parent>)...] [-S[<keyid>]] [(-m <message>)...]\n"
+" [(-F <file>)...] <tree>"
#: builtin/commit-tree.c
#, c-format
@@ -5480,12 +5459,30 @@ msgid "git commit-tree: failed to read"
msgstr "git commit-tree:讀å–失敗"
#: builtin/commit.c
-msgid "git commit [<options>] [--] <pathspec>..."
-msgstr "git commit [<é¸é …>] [--] <路徑è¦æ ¼>..."
+msgid ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|"
+"reword):]<commit>)]\n"
+" [-F <file> | -m <msg>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n"
+" [--date=<date>] [--cleanup=<mode>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]\n"
+" [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|"
+"reword):]<commit>)]\n"
+" [-F <file> | -m <msg>] [--reset-author] [--allow-empty]\n"
+" [--allow-empty-message] [--no-verify] [-e] [--author=<author>]\n"
+" [--date=<date>] [--cleanup=<mode>] [--[no-]status]\n"
+" [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]\n"
+" [--] [<pathspec>...]"
#: builtin/commit.c
-msgid "git status [<options>] [--] <pathspec>..."
-msgstr "git status [<é¸é …>] [--] <路徑è¦æ ¼>..."
+msgid "git status [<options>] [--] [<pathspec>...]"
+msgstr "git status [<é¸é …>] [--] [<路徑è¦æ ¼>...]"
#: builtin/commit.c
msgid ""
@@ -5827,7 +5824,7 @@ msgstr "顯示分支訊æ¯"
#: builtin/commit.c
msgid "show stash information"
-msgstr "顯示儲è—å€è¨Šæ¯"
+msgstr "顯示貯存å€è¨Šæ¯"
#: builtin/commit.c
msgid "compute full ahead/behind values"
@@ -6100,7 +6097,7 @@ msgstr "使用版本庫級設定檔案"
msgid "use per-worktree config file"
msgstr "使用工作å€ç´šåˆ¥çš„設定檔案"
-#: builtin/config.c
+#: builtin/config.c builtin/gc.c
msgid "use given config file"
msgstr "使用指定的設定檔案"
@@ -6226,11 +6223,11 @@ msgstr "åªé¡¯ç¤ºè®Šæ•¸å"
#: builtin/config.c
msgid "respect include directives on lookup"
-msgstr "查詢時åƒç…§ include 指令éžè¿´å°‹æ‰¾"
+msgstr "查詢時引用 include 指令éžè¿´å°‹æ‰¾"
#: builtin/config.c
msgid "show origin of config (file, standard input, blob, command line)"
-msgstr "顯示設定的來æºï¼ˆæª”案ã€æ¨™æº–輸入ã€è³‡æ–™ç‰©ä»¶ï¼Œæˆ–指令列)"
+msgstr "顯示設定的來æºï¼ˆæª”案ã€æ¨™æº–輸入ã€è³‡æ–™ç‰©ä»¶ï¼Œæˆ–命令列)"
#: builtin/config.c
msgid "show scope of config (worktree, local, global, system, command)"
@@ -6323,7 +6320,7 @@ msgstr "--blob åªèƒ½åœ¨ä¸€å€‹ç‰ˆæœ¬åº«å…§ä½¿ç”¨"
msgid "--worktree can only be used inside a git repository"
msgstr "--worktree åªèƒ½åœ¨ git 版本庫中使用"
-#: builtin/config.c
+#: builtin/config.c builtin/gc.c
msgid "$HOME not set"
msgstr "$HOME 未設定"
@@ -6433,12 +6430,20 @@ msgid "unable to get credential storage lock in %d ms"
msgstr "無法在 %d 毫秒內å–得憑證儲存空間的鎖"
#: builtin/describe.c
-msgid "git describe [<options>] [<commit-ish>...]"
-msgstr "git describe [<é¸é …>] [<æ交號>...]"
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] [<commit-ish>...]"
+
+#: builtin/describe.c
+msgid ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]"
+msgstr ""
+"git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]"
#: builtin/describe.c
-msgid "git describe [<options>] --dirty"
-msgstr "git describe [<é¸é …>] --dirty"
+msgid "git describe <blob>"
+msgstr "git describe <blob>"
#: builtin/describe.c
msgid "head"
@@ -6591,15 +6596,15 @@ msgstr "「%sã€é¸é …å’Œæ交號ä¸å¾—åŒæ™‚使用"
#: builtin/diagnose.c
msgid ""
-"git diagnose [-o|--output-directory <path>] [-s|--suffix <format>] [--"
-"mode=<mode>]"
+"git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--mode=<mode>]"
msgstr ""
-"git diagnose [-o|--output-directory <path>] [-s|--suffix <format>] [--"
-"mode=<mode>]"
+"git diagnose [(-o | --output-directory) <path>] [(-s | --suffix) <format>]\n"
+" [--mode=<mode>]"
#: builtin/diagnose.c
msgid "specify a destination for the diagnostics archive"
-msgstr "指定診斷å°å­˜æª”的目的地"
+msgstr "請指定診斷å°å­˜æª”的目的地"
#: builtin/diagnose.c
msgid "specify a strftime format suffix for the filename"
@@ -6619,6 +6624,10 @@ msgid "'%s': not a regular file or symlink"
msgstr "'%s':ä¸æ˜¯ä¸€å€‹æ­£è¦æª”案或符號連çµ"
#: builtin/diff.c
+msgid "no merge given, only parents."
+msgstr "沒有æä¾›åˆä½µæ交,åªæœ‰æ供父æ交。"
+
+#: builtin/diff.c
#, c-format
msgid "invalid option: %s"
msgstr "無效é¸é …:%s"
@@ -6781,8 +6790,8 @@ msgstr "é¸é …「--defaultã€é æœŸæ”¶åˆ°ã€Œ--type=boolã€çš„布林值,而éžã
#: builtin/env--helper.c
#, c-format
msgid ""
-"option `--default' expects an unsigned long value with `--type=ulong`, not `"
-"%s`"
+"option `--default' expects an unsigned long value with `--type=ulong`, not "
+"`%s`"
msgstr "é¸é …「--defaultã€é æœŸæ”¶åˆ°ã€Œ--type=ulongã€çš„無號 long 數值,而éžã€Œ%sã€"
#: builtin/fast-export.c
@@ -7410,8 +7419,8 @@ msgid "print only refs which don't contain the commit"
msgstr "åªåˆ—å°ä¸åŒ…å«è©²æ交的引用"
#: builtin/for-each-repo.c
-msgid "git for-each-repo --config=<config> <command-args>"
-msgstr "git for-each-repo --config=<設定> <命令引數>"
+msgid "git for-each-repo --config=<config> [--] <arguments>"
+msgstr "git for-each-repo --config=<config> [--] <arguments>"
#: builtin/for-each-repo.c
msgid "config"
@@ -7628,8 +7637,16 @@ msgid "%s: invalid sha1 pointer in resolve-undo"
msgstr "%s:resolve-undo çš„ sha1 指é‡ç„¡æ•ˆ"
#: builtin/fsck.c
-msgid "git fsck [<options>] [<object>...]"
-msgstr "git fsck [<é¸é …>] [<物件>...]"
+msgid ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<object>...]"
+msgstr ""
+"git fsck [--tags] [--root] [--unreachable] [--cache] [--no-reflogs]\n"
+" [--[no-]full] [--strict] [--verbose] [--lost-found]\n"
+" [--[no-]dangling] [--[no-]progress] [--connectivity-only]\n"
+" [--[no-]name-objects] [<object>...]"
#: builtin/fsck.c
msgid "show unreachable objects"
@@ -7702,14 +7719,6 @@ msgid "git fsmonitor--daemon run [<options>]"
msgstr "git fsmonitor--daemon run [<options>]"
#: builtin/fsmonitor--daemon.c
-msgid "git fsmonitor--daemon stop"
-msgstr "git fsmonitor--daemon stop"
-
-#: builtin/fsmonitor--daemon.c
-msgid "git fsmonitor--daemon status"
-msgstr "git fsmonitor--daemon status"
-
-#: builtin/fsmonitor--daemon.c
#, c-format
msgid "value of '%s' out of range: %d"
msgstr "「%sã€çš„數值超出範åœï¼š%d"
@@ -7809,7 +7818,7 @@ msgstr "è¦ç­‰å¾…背景守護程å¼å•Ÿå‹•çš„最長秒數"
msgid "invalid 'ipc-threads' value (%d)"
msgstr "無效的「ipc-threadsã€æ•¸å€¼ï¼ˆ%d)"
-#: builtin/fsmonitor--daemon.c
+#: builtin/fsmonitor--daemon.c t/helper/test-cache-tree.c
#, c-format
msgid "Unhandled subcommand '%s'"
msgstr "未處ç†çš„å­å‘½ä»¤ã€Œ%sã€"
@@ -7857,7 +7866,7 @@ msgstr "清除未引用的物件"
#: builtin/gc.c
msgid "pack unreferenced objects separately"
-msgstr "ç¨ç«‹å°è£ç„¡åƒç…§ç‰©ä»¶"
+msgstr "ç¨ç«‹å°è£ç„¡å¼•ç”¨ç‰©ä»¶"
#: builtin/gc.c
msgid "be more thorough (increased runtime)"
@@ -8008,8 +8017,23 @@ msgid "use at most one of --auto and --schedule=<frequency>"
msgstr "--auto å’Œ --schedule=<頻率> è«‹ä»»é¸ä¸€"
#: builtin/gc.c
-msgid "failed to run 'git config'"
-msgstr "無法執行 ‘git config’"
+#, c-format
+msgid "unable to add '%s' value of '%s'"
+msgstr "無法為「%2$sã€çš„值加上「%1$sã€"
+
+#: builtin/gc.c
+msgid "return success even if repository was not registered"
+msgstr "å³ä¾¿ç‰ˆæœ¬åº«æœªè¨»å†Šä»å›žå‚³æˆåŠŸç‹€æ…‹"
+
+#: builtin/gc.c
+#, c-format
+msgid "unable to unset '%s' value of '%s'"
+msgstr "無法å–消設定「%2$sã€çš„「%1$sã€å€¼"
+
+#: builtin/gc.c
+#, c-format
+msgid "repository '%s' is not registered"
+msgstr "版本庫「%sã€æœªè¨»å†Š"
#: builtin/gc.c
#, c-format
@@ -8386,11 +8410,15 @@ msgstr "åŒæ™‚給出了 --cached 和樹狀物件"
#: builtin/hash-object.c
msgid ""
-"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters] [--stdin] "
-"[--] <file>..."
+"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]\n"
+" [--stdin [--literally]] [--] <file>..."
msgstr ""
-"git hash-object [-t <類型>] [-w] [--path=<檔案> | --no-filters] [--stdin] "
-"[--] <檔案>..."
+"git hash-object [-t <type>] [-w] [--path=<file> | --no-filters]\n"
+" [--stdin [--literally]] [--] <file>..."
+
+#: builtin/hash-object.c
+msgid "git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]"
+msgstr "git hash-object [-t <type>] [-w] --stdin-paths [--no-filters]"
#: builtin/hash-object.c
msgid "object type"
@@ -8918,11 +8946,15 @@ msgstr "å·²åˆå§‹åŒ–空的 Git 版本庫於 %s%s\n"
#: builtin/init-db.c
msgid ""
-"git init [-q | --quiet] [--bare] [--template=<template-directory>] [--"
-"shared[=<permissions>]] [<directory>]"
+"git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
+" [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+" [-b <branch-name> | --initial-branch=<branch-name>]\n"
+" [--shared[=<permissions>]] [<directory>]"
msgstr ""
-"git init [-q | --quiet] [--bare] [--template=<範本目錄>] [--shared[=<權é™>]] "
-"[<目錄>]"
+"git init [-q | --quiet] [--bare] [--template=<template-directory>]\n"
+" [--separate-git-dir <git-dir>] [--object-format=<format>]\n"
+" [-b <branch-name> | --initial-branch=<branch-name>]\n"
+" [--shared[=<permissions>]] [<directory>]"
#: builtin/init-db.c
msgid "permissions"
@@ -8972,11 +9004,13 @@ msgstr "--separate-git-dir 與純版本庫ä¸ç›¸å®¹"
#: builtin/interpret-trailers.c
msgid ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer "
-"<token>[(=|:)<value>])...] [<file>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <token>[(=|:)<value>])...]\n"
+" [--parse] [<file>...]"
msgstr ""
-"git interpret-trailers [--in-place] [--trim-empty] [(--trailer <éµ>[(=|:)<值"
-">])...] [<檔案>...]"
+"git interpret-trailers [--in-place] [--trim-empty]\n"
+" [(--trailer <token>[(=|:)<value>])...]\n"
+" [--parse] [<file>...]"
#: builtin/interpret-trailers.c
msgid "edit files in place"
@@ -9594,12 +9628,12 @@ msgstr ""
#: builtin/ls-remote.c
msgid ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n"
" [--symref] [<repository> [<refs>...]]"
msgstr ""
"git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
-" [-q | --quiet] [--exit-code] [--get-url]\n"
-" [--symref] [<版本庫> [<引用>...]]"
+" [-q | --quiet] [--exit-code] [--get-url] [--sort=<key>]\n"
+" [--symref] [<repository> [<refs>...]]"
#: builtin/ls-remote.c
msgid "do not print remote URL"
@@ -9752,7 +9786,7 @@ msgstr "在訊æ¯å…§æ–‡ä¸­ä½¿ç”¨æ¨™é ­"
#: builtin/mailsplit.c
msgid "reading patches from stdin/tty..."
-msgstr "正在從標準輸入或 tty 讀å–修補檔內容⋯⋯"
+msgstr "正在從標準輸入或 tty 讀å–修補檔內容……"
#: builtin/mailsplit.c
#, c-format
@@ -9768,14 +9802,14 @@ msgid "git merge-base [-a | --all] --octopus <commit>..."
msgstr "git merge-base [-a | --all] --octopus <æ交>..."
#: builtin/merge-base.c
-msgid "git merge-base --independent <commit>..."
-msgstr "git merge-base --independent <æ交>..."
-
-#: builtin/merge-base.c
msgid "git merge-base --is-ancestor <commit> <commit>"
msgstr "git merge-base --is-ancestor <æ交> <æ交>"
#: builtin/merge-base.c
+msgid "git merge-base --independent <commit>..."
+msgstr "git merge-base --independent <æ交>..."
+
+#: builtin/merge-base.c
msgid "git merge-base --fork-point <ref> [<commit>]"
msgstr "git merge-base --fork-point <引用> [<æ交>]"
@@ -9914,9 +9948,23 @@ msgid "allow merging unrelated histories"
msgstr "å…許åˆä¸¦ä¸ç›¸é—œçš„æ­·å²"
#: builtin/merge-tree.c
+msgid "perform multiple merges, one per line of input"
+msgstr "執行多次åˆä½µï¼Œä¸€æ¬¡åŸ·è¡Œè¼¸å…¥ä¸€åˆ—"
+
+#: builtin/merge-tree.c
msgid "--trivial-merge is incompatible with all other options"
msgstr "--trivial-merge 和其他所有é¸é …都ä¸ç›¸å®¹"
+#: builtin/merge-tree.c builtin/notes.c
+#, c-format
+msgid "malformed input line: '%s'."
+msgstr "æ ¼å¼éŒ¯èª¤çš„輸入行:'%s'。"
+
+#: builtin/merge-tree.c
+#, c-format
+msgid "merging cannot continue; got unclean result of %d"
+msgstr "無法繼續åˆä½µï¼šå¾ž %d 收到的çµæžœä¸ä¹¾æ·¨"
+
#: builtin/merge.c
msgid "git merge [<options>] [<commit>...]"
msgstr "git merge [<é¸é …>] [<æ交>...]"
@@ -10029,11 +10077,11 @@ msgstr "ç¹žéŽ pre-merge-commit å’Œ commit-msg 掛鉤"
#: builtin/merge.c
msgid "could not run stash."
-msgstr "ä¸èƒ½åŸ·è¡Œå„²è—。"
+msgstr "ä¸èƒ½åŸ·è¡Œè²¯å­˜ã€‚"
#: builtin/merge.c
msgid "stash failed"
-msgstr "儲è—失敗"
+msgstr "貯存失敗"
#: builtin/merge.c
#, c-format
@@ -10286,7 +10334,7 @@ msgstr "自動åˆä½µé€²å±•é †åˆ©ï¼ŒæŒ‰è¦æ±‚在æ交å‰åœæ­¢\n"
#: builtin/merge.c
#, c-format
msgid "When finished, apply stashed changes with `git stash pop`\n"
-msgstr "完æˆæ™‚,使用 `git stash pop` 套用儲è—更改\n"
+msgstr "完æˆæ™‚,使用 `git stash pop` 套用貯存更改\n"
#: builtin/mktag.c
#, c-format
@@ -10406,7 +10454,7 @@ msgstr "目錄 %s 在索引中並且ä¸æ˜¯å­æ¨¡çµ„?"
#: builtin/mv.c
msgid "Please stage your changes to .gitmodules or stash them to proceed"
-msgstr "請將您的修改暫存到 .gitmodules 中或儲è—後å†ç¹¼çºŒ"
+msgstr "請將您的修改暫存到 .gitmodules 中或貯存後å†ç¹¼çºŒ"
#: builtin/mv.c
#, c-format
@@ -10490,7 +10538,7 @@ msgstr "%s,來æº=%s,目的地=%s"
msgid "Renaming %s to %s\n"
msgstr "é‡æ–°å‘½å %s 至 %s\n"
-#: builtin/mv.c builtin/remote.c builtin/repack.c
+#: builtin/mv.c builtin/remote.c
#, c-format
msgid "renaming '%s' failed"
msgstr "é‡æ–°å‘½å '%s' 失敗"
@@ -10693,11 +10741,6 @@ msgstr "ä¸èƒ½å¾žéžè³‡æ–™ç‰©ä»¶ '%s' 中讀å–註解資料。"
#: builtin/notes.c
#, c-format
-msgid "malformed input line: '%s'."
-msgstr "æ ¼å¼éŒ¯èª¤çš„輸入行:'%s'。"
-
-#: builtin/notes.c
-#, c-format
msgid "failed to copy notes from '%s' to '%s'"
msgstr "從 '%s' 複製註解到 '%s' 時失敗"
@@ -10928,14 +10971,13 @@ msgid "unknown subcommand: `%s'"
msgstr "未知å­æŒ‡ä»¤ï¼šã€Œ%sã€"
#: builtin/pack-objects.c
-msgid ""
-"git pack-objects --stdout [<options>...] [< <ref-list> | < <object-list>]"
-msgstr "git pack-objects --stdout [<é¸é …>...] [< <引用列表> | < <物件列表>]"
+msgid "git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"
+msgstr "git pack-objects --stdout [<é¸é …>] [< <引用列表> | < <物件列表>]"
#: builtin/pack-objects.c
msgid ""
-"git pack-objects [<options>...] <base-name> [< <ref-list> | < <object-list>]"
-msgstr "git pack-objects [<é¸é …>...] <å‰ç¶´å稱> [< <引用列表> | < <物件列表>]"
+"git pack-objects [<options>] <base-name> [< <ref-list> | < <object-list>]"
+msgstr "git pack-objects [<é¸é …>] <å‰ç¶´å稱> [< <引用列表> | < <物件列表>]"
#: builtin/pack-objects.c
#, c-format
@@ -11406,8 +11448,8 @@ msgstr ""
"æ„Ÿè¬ã€‚\n"
#: builtin/pack-refs.c
-msgid "git pack-refs [<options>]"
-msgstr "git pack-refs [<é¸é …>]"
+msgid "git pack-refs [--all] [--no-prune]"
+msgstr "git pack-refs [--all] [--no-prune]"
#: builtin/pack-refs.c
msgid "pack everything"
@@ -11417,6 +11459,22 @@ msgstr "打包一切"
msgid "prune loose refs (default)"
msgstr "剪除鬆散引用(é è¨­ï¼‰"
+#: builtin/patch-id.c
+msgid "git patch-id [--stable | --unstable | --verbatim]"
+msgstr "git patch-id [--stable | --unstable | --verbatim]"
+
+#: builtin/patch-id.c
+msgid "use the unstable patch-id algorithm"
+msgstr "使用ä¸ç©©å®šçš„ patch-id 演算法"
+
+#: builtin/patch-id.c
+msgid "use the stable patch-id algorithm"
+msgstr "使用穩定的 patch-id 演算法"
+
+#: builtin/patch-id.c
+msgid "don't strip whitespace from the patch"
+msgstr "ä¸è¦åŽ»é™¤ä¿®è£œæª”的空白字元"
+
#: builtin/prune.c
msgid "git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]"
msgstr "git prune [-n] [-v] [--progress] [--expire <時間>] [--] [<head>...]"
@@ -11463,7 +11521,7 @@ msgstr "控制 pre-merge-commit 和 commit-msg 掛鉤的使用"
#: builtin/pull.c parse-options.h
msgid "automatically stash/stash pop before and after"
-msgstr "在動作å‰å¾ŒåŸ·è¡Œè‡ªå‹•å„²è—和彈出儲è—"
+msgstr "在動作å‰å¾ŒåŸ·è¡Œè‡ªå‹•è²¯å­˜å’Œå½ˆå‡ºè²¯å­˜"
#: builtin/pull.c
msgid "Options related to fetching"
@@ -11502,7 +11560,7 @@ msgid ""
"for your current branch, you must specify a branch on the command line."
msgstr ""
"您è¦æ±‚從é ç«¯ '%s' 拉å–,但是未指定一個分支。因為這ä¸æ˜¯ç›®å‰\n"
-"分支é è¨­çš„é ç«¯ç‰ˆæœ¬åº«ï¼Œæ‚¨å¿…須在指令列中指定一個分支å。"
+"分支é è¨­çš„é ç«¯ç‰ˆæœ¬åº«ï¼Œæ‚¨å¿…須在命令列中指定一個分支å。"
#: builtin/pull.c builtin/rebase.c
msgid "You are not currently on a branch."
@@ -11594,7 +11652,7 @@ msgstr "é‡å®šåŸºåº•å¼æ‹‰å–"
#: builtin/pull.c
msgid "please commit or stash them."
-msgstr "è«‹æ交或儲è—它們。"
+msgstr "è«‹æ交或貯存它們。"
#: builtin/pull.c
#, c-format
@@ -11666,14 +11724,14 @@ msgstr ""
#: builtin/push.c
msgid ""
"\n"
-"To avoid automatically configuring upstream branches when their name\n"
-"doesn't match the local branch, see option 'simple' of branch."
-"autoSetupMerge\n"
+"To avoid automatically configuring an upstream branch when its name\n"
+"won't match the local branch, see option 'simple' of branch.autoSetupMerge\n"
"in 'git help config'.\n"
msgstr ""
"\n"
-"為了é¿å…自動在上游分支的å稱與本機ä¸ç¬¦æ™‚,設定上游的分支,請åƒé–±\n"
-"“git help config†中 branch.autoSetupMerge çš„ “simple†é¸é …。\n"
+"è‹¥è¦é¿å…在å稱與本機分支ä¸åŒæ™‚自動設定上游分支,\n"
+"è«‹åƒé–± “git help config†中 branch.autoSetupMerge çš„\n"
+"“simple†é¸é …。\n"
#: builtin/push.c
#, c-format
@@ -11827,6 +11885,12 @@ msgstr "推é€åˆ° %s\n"
msgid "failed to push some refs to '%s'"
msgstr "推é€ä¸€äº›å¼•ç”¨åˆ° '%s' 失敗"
+#: builtin/push.c
+msgid ""
+"recursing into submodule with push.recurseSubmodules=only; using on-demand "
+"instead"
+msgstr "在有 push.recurseSubmodules=only; 的情æ³å˜—試éžè¿´å­æ¨¡çµ„;改用 on-demand"
+
#: builtin/push.c builtin/send-pack.c submodule-config.c
#, c-format
msgid "invalid value for '%s'"
@@ -11999,13 +12063,15 @@ msgstr "需è¦å…©å€‹æ交範åœ"
#: builtin/read-tree.c
msgid ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>) "
-"[-u | -i]] [--no-sparse-checkout] [--index-output=<file>] (--empty | <tree-"
-"ish1> [<tree-ish2> [<tree-ish3>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
+"prefix=<prefix>)\n"
+" [-u | -i]] [--index-output=<file>] [--no-sparse-checkout]\n"
+" (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"
msgstr ""
-"git read-tree [(-m [--trivial] [--aggressive] | --reset | --prefix=<å‰ç¶´>) [-"
-"u | -i]] [--no-sparse-checkout] [--index-output=<檔案>] (--empty | <樹狀物件"
-"1> [<樹狀物件2> [<樹狀物件3>]])"
+"git read-tree [(-m [--trivial] [--aggressive] | --reset | --"
+"prefix=<prefix>)\n"
+" [-u | -i]] [--index-output=<file>] [--no-sparse-checkout]\n"
+" (--empty | <tree-ish1> [<tree-ish2> [<tree-ish3>]])"
#: builtin/read-tree.c
msgid "write resulting index to <file>"
@@ -12122,8 +12188,8 @@ msgstr "%s 需è¦åˆä½µå¾Œç«¯"
#: builtin/rebase.c
#, c-format
-msgid "could not get 'onto': '%s'"
-msgstr "無法å–å¾— 'onto':'%s'"
+msgid "invalid onto: '%s'"
+msgstr "無效的 onto:「%sã€"
#: builtin/rebase.c
#, c-format
@@ -12179,8 +12245,8 @@ msgstr "無法切æ›åˆ° %s"
#: builtin/rebase.c
#, c-format
msgid ""
-"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and \"ask"
-"\"."
+"unrecognized empty type '%s'; valid values are \"drop\", \"keep\", and "
+"\"ask\"."
msgstr "無法識別的 '%s' 空類型;有效的數值有 \"drop\"ã€\"keep\" è·Ÿ \"ask\"。"
#: builtin/rebase.c
@@ -12488,8 +12554,8 @@ msgid "No such ref: %s"
msgstr "沒有這樣的引用:%s"
#: builtin/rebase.c
-msgid "Could not resolve HEAD to a revision"
-msgstr "無法將 HEAD 解æžç‚ºä¸€å€‹ç‰ˆæœ¬"
+msgid "Could not resolve HEAD to a commit"
+msgstr "無法將 HEAD 解æžæˆæ交"
#: builtin/rebase.c
#, c-format
@@ -12508,7 +12574,7 @@ msgstr "沒有指å‘一個有效的æ交 '%s'"
#: builtin/rebase.c
msgid "Please commit or stash them."
-msgstr "è«‹æ交或儲è—修改。"
+msgstr "è«‹æ交或貯存修改。"
#: builtin/rebase.c
msgid "HEAD is up to date."
@@ -13288,6 +13354,11 @@ msgid "could not close refs snapshot tempfile"
msgstr "無法關閉 refs 的快照暫存檔"
#: builtin/repack.c
+#, c-format
+msgid "could not remove stale bitmap: %s"
+msgstr "無法移除éŽæ™‚ä½åœ–:%s"
+
+#: builtin/repack.c
msgid "pack everything in a single pack"
msgstr "所有內容打包到一個包檔案中"
@@ -13384,6 +13455,10 @@ msgid "write a multi-pack index of the resulting packs"
msgstr "寫入çµæžœåŒ…的多包索引"
#: builtin/repack.c
+msgid "pack prefix to store a pack containing pruned objects"
+msgstr "å°è£å‰ç¶´ï¼Œå„²å­˜ç‚ºåŒ…å«éŽæ™‚物件的套件包"
+
+#: builtin/repack.c
msgid "cannot delete packs in a precious-objects repo"
msgstr "ä¸èƒ½åˆªé™¤çå“版本庫中的å°åŒ…"
@@ -13398,11 +13473,16 @@ msgstr "å°åŒ…å‰ç¶´ %s ä¸ä»¥ objdir %s é–‹é ­"
#: builtin/repack.c
#, c-format
-msgid "missing required file: %s"
-msgstr "缺少必è¦æª”案:%s"
+msgid "renaming pack to '%s' failed"
+msgstr "無法將包é‡æ–°å‘½å為「%sã€"
#: builtin/repack.c
#, c-format
+msgid "pack-objects did not write a '%s' file for pack %s-%s"
+msgstr "pack-objects 沒有為 %2$s-%3$s 套件包寫入 “%1$s†檔案"
+
+#: builtin/repack.c sequencer.c
+#, c-format
msgid "could not unlink: %s"
msgstr "無法å–消連çµï¼š%s"
@@ -13643,8 +13723,10 @@ msgid "only one pattern can be given with -l"
msgstr "åªèƒ½ç‚º -l æ供一個模å¼"
#: builtin/rerere.c
-msgid "git rerere [clear | forget <path>... | status | remaining | diff | gc]"
-msgstr "git rerere [clear | forget <路徑>... | status | remaining | diff | gc]"
+msgid ""
+"git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
+msgstr ""
+"git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"
#: builtin/rerere.c
msgid "register clean resolutions in index"
@@ -13902,6 +13984,18 @@ msgstr "--prefix éœ€è¦ 1 個引數"
msgid "unknown mode for --abbrev-ref: %s"
msgstr "--abbrev-ref 的模å¼æœªçŸ¥ï¼š%s"
+#: builtin/rev-parse.c revision.c
+msgid "--exclude-hidden cannot be used together with --branches"
+msgstr "--exclude-hidden 無法與 --branches åŒæ™‚使用"
+
+#: builtin/rev-parse.c revision.c
+msgid "--exclude-hidden cannot be used together with --tags"
+msgstr "--exclude-hidden 無法與 --tags åŒæ™‚使用"
+
+#: builtin/rev-parse.c revision.c
+msgid "--exclude-hidden cannot be used together with --remotes"
+msgstr "--exclude-hidden 無法與 --remotes åŒæ™‚使用"
+
#: builtin/rev-parse.c setup.c
msgid "this operation must be run in a work tree"
msgstr "該動作必須在一個工作å€ä¸­åŸ·è¡Œ"
@@ -13912,20 +14006,28 @@ msgid "unknown mode for --show-object-format: %s"
msgstr "--show-object-format 的模å¼æœªçŸ¥ï¼š%s"
#: builtin/revert.c
-msgid "git revert [<options>] <commit-ish>..."
-msgstr "git revert [<é¸é …>] <æ交號>..."
+msgid ""
+"git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] "
+"<commit>..."
+msgstr ""
+"git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] "
+"<commit>..."
#: builtin/revert.c
-msgid "git revert <subcommand>"
-msgstr "git revert <å­æŒ‡ä»¤>"
+msgid "git revert (--continue | --skip | --abort | --quit)"
+msgstr "git revert (--continue | --skip | --abort | --quit)"
#: builtin/revert.c
-msgid "git cherry-pick [<options>] <commit-ish>..."
-msgstr "git cherry-pick [<é¸é …>] <æ交號>..."
+msgid ""
+"git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n"
+" [-S[<keyid>]] <commit>..."
+msgstr ""
+"git cherry-pick [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]\n"
+" [-S[<keyid>]] <commit>..."
#: builtin/revert.c
-msgid "git cherry-pick <subcommand>"
-msgstr "git cherry-pick <å­æŒ‡ä»¤>"
+msgid "git cherry-pick (--continue | --skip | --abort | --quit)"
+msgstr "git cherry-pick (--continue | --skip | --abort | --quit)"
#: builtin/revert.c
#, c-format
@@ -14006,8 +14108,14 @@ msgid "cherry-pick failed"
msgstr "æ€é¸å¤±æ•—"
#: builtin/rm.c
-msgid "git rm [<options>] [--] <file>..."
-msgstr "git rm [<é¸é …>] [--] <檔案>..."
+msgid ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [--] [<pathspec>...]"
+msgstr ""
+"git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]\n"
+" [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [--] [<pathspec>...]"
#: builtin/rm.c
msgid ""
@@ -14070,7 +14178,7 @@ msgstr "沒有æ供路徑è¦æ ¼ã€‚我該移除哪個檔案?"
#: builtin/rm.c
msgid "please stage your changes to .gitmodules or stash them to proceed"
-msgstr "請將您的修改暫存到 .gitmodules 中或儲è—後å†ç¹¼çºŒ"
+msgstr "請將您的修改暫存到 .gitmodules 中或貯存後å†ç¹¼çºŒ"
#: builtin/rm.c
#, c-format
@@ -14087,12 +14195,14 @@ msgid ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
" [<host>:]<directory> (--all | <ref>...)"
msgstr ""
"git send-pack [--mirror] [--dry-run] [--force]\n"
" [--receive-pack=<git-receive-pack>]\n"
" [--verbose] [--thin] [--atomic]\n"
-" [<主機>:]<目錄> (--all | <引用>...)"
+" [--[no-]signed | --signed=(true|false|if-asked)]\n"
+" [<host>:]<directory> (--all | <ref>...)"
#: builtin/send-pack.c
msgid "remote name"
@@ -14123,8 +14233,9 @@ msgid "using multiple --group options with stdin is not supported"
msgstr "ä¸æ”¯æ´åœ¨æ¨™æº–輸入使用多個 --group é¸é …"
#: builtin/shortlog.c
-msgid "using --group=trailer with stdin is not supported"
-msgstr "ä¸æ”¯æ´åœ¨æ¨™æº–輸入使用 --group=trailer"
+#, c-format
+msgid "using %s with stdin is not supported"
+msgstr "ä¸æ”¯æ´å° %s 使用 stdin"
#: builtin/shortlog.c
#, c-format
@@ -14172,13 +14283,14 @@ msgid ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
" [--current] [--color[=<when>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<rev> | <glob>)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<rev> | <glob>)...]"
msgstr ""
"git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
-" [--current] [--color[=<何時>] | --no-color] [--sparse]\n"
+" [--current] [--color[=<when>] | --no-color] [--sparse]\n"
" [--more=<n> | --list | --independent | --merge-base]\n"
-" [--no-name | --sha1-name] [--topics] [(<版本> | <è¬ç”¨å­—å…ƒ"
-">)...]"
+" [--no-name | --sha1-name] [--topics]\n"
+" [(<rev> | <glob>)...]"
#: builtin/show-branch.c
msgid "git show-branch (-g | --reflog)[=<n>[,<base>]] [--list] [<ref>]"
@@ -14304,11 +14416,13 @@ msgstr "未知的雜湊算法"
#: builtin/show-ref.c
msgid ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<pattern>...]"
msgstr ""
-"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --"
-"hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<模å¼>...]"
+"git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference]\n"
+" [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]\n"
+" [--heads] [--] [<pattern>...]"
#: builtin/show-ref.c
msgid "git show-ref --exclude-existing[=<pattern>]"
@@ -14347,8 +14461,10 @@ msgid "show refs from stdin that aren't in local repository"
msgstr "顯示從標準輸入中讀入的ä¸åœ¨æœ¬æ©Ÿç‰ˆæœ¬åº«ä¸­çš„引用"
#: builtin/sparse-checkout.c
-msgid "git sparse-checkout (init|list|set|add|reapply|disable) <options>"
-msgstr "git sparse-checkout (init|list|set|add|reapply|disable) <é¸é …>"
+msgid ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<options>]"
+msgstr ""
+"git sparse-checkout (init | list | set | add | reapply | disable) [<options>]"
#: builtin/sparse-checkout.c
msgid "this worktree is not sparse"
@@ -14490,83 +14606,71 @@ msgid "error while refreshing working directory"
msgstr "é‡æ–°æ•´ç†å·¥ä½œç›®éŒ„時發生錯誤"
#: builtin/stash.c
-msgid "git stash list [<options>]"
-msgstr "git stash list [<é¸é …>]"
+msgid "git stash list [<log-options>]"
+msgstr "git stash list [<log-options>]"
#: builtin/stash.c
-msgid "git stash show [<options>] [<stash>]"
-msgstr "git stash show [<é¸é …>] [<stash>]"
+msgid ""
+"git stash show [-u | --include-untracked | --only-untracked] [<diff-"
+"options>] [<stash>]"
+msgstr ""
+"git stash show [-u | --include-untracked | --only-untracked] [<diff-"
+"options>] [<stash>]"
#: builtin/stash.c
-msgid "git stash drop [-q|--quiet] [<stash>]"
-msgstr "git stash drop [-q|--quiet] [<stash>]"
+msgid "git stash drop [-q | --quiet] [<stash>]"
+msgstr "git stash drop [-q | --quiet] [<stash>]"
#: builtin/stash.c
-msgid "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
+msgid "git stash pop [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash pop [--index] [-q | --quiet] [<stash>]"
+
+#: builtin/stash.c
+msgid "git stash apply [--index] [-q | --quiet] [<stash>]"
+msgstr "git stash apply [--index] [-q | --quiet] [<stash>]"
#: builtin/stash.c
msgid "git stash branch <branchname> [<stash>]"
msgstr "git stash branch <分支å> [<stash>]"
#: builtin/stash.c
-msgid ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
-" [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
-" [--] [<pathspec>...]]"
-msgstr ""
-"git stash [push [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <訊æ¯>]\n"
-" [--pathspec-from-file=<檔案> [--pathspec-file-nul]]\n"
-" [--] [<路徑è¦æ ¼>...]]"
+msgid "git stash store [(-m | --message) <message>] [-q | --quiet] <commit>"
+msgstr "git stash store [(-m | --message) <message>] [-q | --quiet] <commit>"
#: builtin/stash.c
msgid ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"<message>]\n"
+" [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [--] [<pathspec>...]]"
msgstr ""
-"git stash save [-p|--patch] [-S|--staged] [-k|--[no-]keep-index] [-q|--"
-"quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<訊æ¯>]"
-
-#: builtin/stash.c
-msgid "git stash pop [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash pop [--index] [-q|--quiet] [<stash>]"
-
-#: builtin/stash.c
-msgid "git stash apply [--index] [-q|--quiet] [<stash>]"
-msgstr "git stash apply [--index] [-q|--quiet] [<stash>]"
-
-#: builtin/stash.c
-msgid "git stash store [-m|--message <message>] [-q|--quiet] <commit>"
-msgstr "git stash store [-m|--message <消æ¯>] [-q|--quiet] <æ交>"
+"git stash [push [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q "
+"| --quiet]\n"
+" [-u | --include-untracked] [-a | --all] [(-m | --message) "
+"<message>]\n"
+" [--pathspec-from-file=<file> [--pathspec-file-nul]]\n"
+" [--] [<pathspec>...]]"
#: builtin/stash.c
msgid ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
-" [--] [<pathspec>...]]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<message>]"
msgstr ""
-"git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [-m|--message <消æ¯>]\n"
-" [--] [<路徑è¦æ ¼>...]]"
+"git stash save [-p | --patch] [-S | --staged] [-k | --[no-]keep-index] [-q | "
+"--quiet]\n"
+" [-u | --include-untracked] [-a | --all] [<message>]"
#: builtin/stash.c
-msgid ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<message>]"
-msgstr ""
-"git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
-" [-u|--include-untracked] [-a|--all] [<消æ¯>]"
+msgid "git stash create [<message>]"
+msgstr "git stash create [<message>]"
#: builtin/stash.c
#, c-format
msgid "'%s' is not a stash-like commit"
-msgstr "'%s' ä¸åƒæ˜¯ä¸€å€‹å„²è—æ交"
+msgstr "'%s' ä¸åƒæ˜¯ä¸€å€‹è²¯å­˜æ交"
#: builtin/stash.c
#, c-format
@@ -14575,7 +14679,7 @@ msgstr "指定了太多的版本:%s"
#: builtin/stash.c
msgid "No stash entries found."
-msgstr "未發ç¾å„²è—æ¢ç›®ã€‚"
+msgstr "未發ç¾è²¯å­˜æ¢ç›®ã€‚"
#: builtin/stash.c
#, c-format
@@ -14599,7 +14703,7 @@ msgstr ""
#: builtin/stash.c
msgid "cannot apply a stash in the middle of a merge"
-msgstr "無法在åˆä½µéŽç¨‹å¥—用儲è—"
+msgstr "無法在åˆä½µéŽç¨‹å¥—用貯存"
#: builtin/stash.c
#, c-format
@@ -14621,11 +14725,11 @@ msgstr "正在åˆä½µ %s å’Œ %s"
#: builtin/stash.c
msgid "Index was not unstashed."
-msgstr "索引未從儲è—中復原。"
+msgstr "索引未從貯存中復原。"
#: builtin/stash.c
msgid "could not restore untracked files from stash"
-msgstr "無法從儲è—æ¢ç›®ä¸­å¾©åŽŸæœªè¿½è¹¤æª”案"
+msgstr "無法從貯存æ¢ç›®ä¸­å¾©åŽŸæœªè¿½è¹¤æª”案"
#: builtin/stash.c
msgid "attempt to recreate the index"
@@ -14639,16 +14743,16 @@ msgstr "æ¨æ£„了 %s(%s)"
#: builtin/stash.c
#, c-format
msgid "%s: Could not drop stash entry"
-msgstr "%s:無法æ¨æ£„儲è—æ¢ç›®"
+msgstr "%s:無法æ¨æ£„貯存æ¢ç›®"
#: builtin/stash.c
#, c-format
msgid "'%s' is not a stash reference"
-msgstr "'%s' ä¸æ˜¯ä¸€å€‹å„²è—引用"
+msgstr "'%s' ä¸æ˜¯ä¸€å€‹è²¯å­˜å¼•ç”¨"
#: builtin/stash.c
msgid "The stash entry is kept in case you need it again."
-msgstr "儲è—æ¢ç›®è¢«ä¿ç•™ä»¥å‚™æ‚¨å†æ¬¡éœ€è¦ã€‚"
+msgstr "貯存æ¢ç›®è¢«ä¿ç•™ä»¥å‚™æ‚¨å†æ¬¡éœ€è¦ã€‚"
#: builtin/stash.c
msgid "No branch name specified"
@@ -14664,11 +14768,11 @@ msgstr "無法解包樹"
#: builtin/stash.c
msgid "include untracked files in the stash"
-msgstr "在儲è—å€åŒ…å«æœªè¿½è¹¤æª”案"
+msgstr "在貯存å€åŒ…å«æœªè¿½è¹¤æª”案"
#: builtin/stash.c
msgid "only show untracked files in the stash"
-msgstr "åªåœ¨å„²è—å€é¡¯ç¤ºæœªè¿½è¹¤æª”案"
+msgstr "åªåœ¨è²¯å­˜å€é¡¯ç¤ºæœªè¿½è¹¤æª”案"
#: builtin/stash.c
#, c-format
@@ -14677,7 +14781,7 @@ msgstr "無法用 %2$s 更新 %1$s"
#: builtin/stash.c
msgid "stash message"
-msgstr "儲è—說明"
+msgstr "貯存說明"
#: builtin/stash.c
msgid "\"git stash store\" requires one <commit> argument"
@@ -14733,7 +14837,7 @@ msgstr "沒有è¦å„²å­˜çš„本機修改"
#: builtin/stash.c
msgid "Cannot initialize stash"
-msgstr "無法åˆå§‹åŒ–儲è—"
+msgstr "無法åˆå§‹åŒ–貯存"
#: builtin/stash.c
msgid "Cannot save the current status"
@@ -14754,11 +14858,11 @@ msgstr "ä¿æŒç´¢å¼•"
#: builtin/stash.c
msgid "stash staged changes only"
-msgstr "åªå„²è—暫存變更"
+msgstr "åªè²¯å­˜æš«å­˜è®Šæ›´"
#: builtin/stash.c
msgid "stash in patch mode"
-msgstr "以修補檔模å¼å„²è—"
+msgstr "以修補檔模å¼è²¯å­˜"
#: builtin/stash.c
msgid "quiet mode"
@@ -14766,7 +14870,7 @@ msgstr "éœé»˜æ¨¡å¼"
#: builtin/stash.c
msgid "include untracked files in stash"
-msgstr "儲è—中包å«æœªè¿½è¹¤æª”案"
+msgstr "貯存中包å«æœªè¿½è¹¤æª”案"
#: builtin/stash.c
msgid "include ignore files"
@@ -15249,10 +15353,6 @@ msgid "don't fetch new objects from the remote site"
msgstr "ä¸å¾žé ç«¯ç«™å°å–得新物件"
#: builtin/submodule--helper.c
-msgid "path into the working tree"
-msgstr "到工作å€çš„路徑"
-
-#: builtin/submodule--helper.c
msgid "use the 'checkout' update strategy (default)"
msgstr "使用 “checkout†更新策略(é è¨­å€¼ï¼‰"
@@ -15297,34 +15397,10 @@ msgstr ""
"[--] [<path>...]"
#: builtin/submodule--helper.c
-msgid "recurse into submodules"
-msgstr "在å­æ¨¡çµ„中éžè¿´"
-
-#: builtin/submodule--helper.c
msgid "git submodule absorbgitdirs [<options>] [<path>...]"
msgstr "git submodule absorbgitdirs [<options>] [<path>...]"
#: builtin/submodule--helper.c
-msgid "check if it is safe to write to the .gitmodules file"
-msgstr "檢查寫入 .gitmodules 檔案是å¦å®‰å…¨"
-
-#: builtin/submodule--helper.c
-msgid "unset the config in the .gitmodules file"
-msgstr "å–消 .gitmodules 檔案中的設定"
-
-#: builtin/submodule--helper.c
-msgid "git submodule--helper config <name> [<value>]"
-msgstr "git submodule--helper config <å稱> [<值>]"
-
-#: builtin/submodule--helper.c
-msgid "git submodule--helper config --unset <name>"
-msgstr "git submodule--helper config --unset <å稱>"
-
-#: builtin/submodule--helper.c
-msgid "please make sure that the .gitmodules file is in the working tree"
-msgstr "è«‹ç¢ºèª .gitmodules 檔案在工作å€è£¡"
-
-#: builtin/submodule--helper.c
msgid "suppress output for setting url of a submodule"
msgstr "éš±è—å­æ¨¡çµ„設定 URL 的輸出"
@@ -15418,6 +15494,10 @@ msgid "unable to checkout submodule '%s'"
msgstr "無法簽出「%sã€å­æ¨¡çµ„"
#: builtin/submodule--helper.c
+msgid "please make sure that the .gitmodules file is in the working tree"
+msgstr "è«‹ç¢ºèª .gitmodules 檔案在工作å€è£¡"
+
+#: builtin/submodule--helper.c
#, c-format
msgid "Failed to add submodule '%s'"
msgstr "無法加入å­æ¨¡çµ„「%sã€"
@@ -15478,23 +15558,26 @@ msgstr "版本庫 URL:「%sã€å¿…須是絕å°è·¯å¾‘,或開頭是 ./|../"
msgid "'%s' is not a valid submodule name"
msgstr "「%sã€ä¸æ˜¯æœ‰æ•ˆçš„å­æ¨¡çµ„å稱"
+#: builtin/submodule--helper.c
+msgid "git submodule--helper <command>"
+msgstr "git submodule--helper <command>"
+
#: builtin/submodule--helper.c git.c
#, c-format
msgid "%s doesn't support --super-prefix"
msgstr "%s ä¸æ”¯æ´ --super-prefix"
-#: builtin/submodule--helper.c
-#, c-format
-msgid "'%s' is not a valid submodule--helper subcommand"
-msgstr "'%s' ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„ submodule--helper å­æŒ‡ä»¤"
+#: builtin/symbolic-ref.c
+msgid "git symbolic-ref [-m <reason>] <name> <ref>"
+msgstr "git symbolic-ref [-m <reason>] <name> <ref>"
#: builtin/symbolic-ref.c
-msgid "git symbolic-ref [<options>] <name> [<ref>]"
-msgstr "git symbolic-ref [<é¸é …>] <å稱> [<引用>]"
+msgid "git symbolic-ref [-q] [--short] [--no-recurse] <name>"
+msgstr "git symbolic-ref [-q] [--short] [--no-recurse] <name>"
#: builtin/symbolic-ref.c
-msgid "git symbolic-ref -d [-q] <name>"
-msgstr "git symbolic-ref -d [-q] <å稱>"
+msgid "git symbolic-ref --delete [-q] <name>"
+msgstr "git symbolic-ref --delete [-q] <name>"
#: builtin/symbolic-ref.c
msgid "suppress error message for non-symbolic (detached) refs"
@@ -15508,6 +15591,10 @@ msgstr "刪除符號引用"
msgid "shorten ref output"
msgstr "縮短引用輸出"
+#: builtin/symbolic-ref.c
+msgid "recursively dereference (default)"
+msgstr "éžè¿´å解引用(é è¨­ï¼‰"
+
#: builtin/symbolic-ref.c builtin/update-ref.c
msgid "reason"
msgstr "原因"
@@ -15518,11 +15605,11 @@ msgstr "更新的原因"
#: builtin/tag.c
msgid ""
-"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]\n"
-" <tagname> [<head>]"
+"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n"
+" <tagname> [<commit> | <object>]"
msgstr ""
-"git tag [-a | -s | -u <key-id>] [-f] [-m <消æ¯> | -F <檔案>]\n"
-" <標籤å> [<head>]"
+"git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n"
+" <tagname> [<commit> | <object>]"
#: builtin/tag.c
msgid "git tag -d <tagname>..."
@@ -15530,14 +15617,15 @@ msgstr "git tag -d <標籤å>..."
#: builtin/tag.c
msgid ""
-"git tag -l [-n[<num>]] [--contains <commit>] [--no-contains <commit>] [--"
-"points-at <object>]\n"
-" [--format=<format>] [--merged <commit>] [--no-merged <commit>] "
-"[<pattern>...]"
+"git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]\n"
+" [--points-at <object>] [--column[=<options>] | --no-column]\n"
+" [--create-reflog] [--sort=<key>] [--format=<format>]\n"
+" [--merged <commit>] [--no-merged <commit>] [<pattern>...]"
msgstr ""
-"git tag -l [-n[<數字>]] [--contains <æ交>] [--no-contains <æ交>] [--points-"
-"at <物件>]\n"
-" [--format=<æ ¼å¼>] [--merged <æ交>] [--no-merged <æ交>] [<模å¼>...]"
+"git tag [-n[<num>]] -l [--contains <commit>] [--no-contains <commit>]\n"
+" [--points-at <object>] [--column[=<options>] | --no-column]\n"
+" [--create-reflog] [--sort=<key>] [--format=<format>]\n"
+" [--merged <commit>] [--no-merged <commit>] [<pattern>...]"
#: builtin/tag.c
msgid "git tag -v [--format=<format>] <tagname>..."
@@ -16007,8 +16095,12 @@ msgid "update the info files from scratch"
msgstr "從頭開始更新檔案訊æ¯"
#: builtin/upload-pack.c
-msgid "git upload-pack [<options>] <dir>"
-msgstr "git upload-pack [<é¸é …>] <目錄>"
+msgid ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <directory>"
+msgstr ""
+"git-upload-pack [--[no-]strict] [--timeout=<n>] [--stateless-rpc]\n"
+" [--advertise-refs] <directory>"
#: builtin/upload-pack.c t/helper/test-serve-v2.c
msgid "quit after a single request/response exchange"
@@ -16027,8 +16119,8 @@ msgid "interrupt transfer after <n> seconds of inactivity"
msgstr "ä¸æ´»å‹• <n> 秒é˜å¾Œçµ‚止傳輸"
#: builtin/verify-commit.c
-msgid "git verify-commit [-v | --verbose] <commit>..."
-msgstr "git verify-commit [-v | --verbose] <æ交>..."
+msgid "git verify-commit [-v | --verbose] [--raw] <commit>..."
+msgstr "git verify-commit [-v | --verbose] [--raw] <commit>..."
#: builtin/verify-commit.c
msgid "print commit contents"
@@ -16039,8 +16131,8 @@ msgid "print raw gpg status output"
msgstr "列å°åŽŸå§‹ gpg 狀態輸出"
#: builtin/verify-pack.c
-msgid "git verify-pack [-v | --verbose] [-s | --stat-only] <pack>..."
-msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] <包>..."
+msgid "git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pack>.idx..."
+msgstr "git verify-pack [-v | --verbose] [-s | --stat-only] [--] <pack>.idx..."
#: builtin/verify-pack.c
msgid "verbose"
@@ -16051,44 +16143,48 @@ msgid "show statistics only"
msgstr "åªé¡¯ç¤ºçµ±è¨ˆ"
#: builtin/verify-tag.c
-msgid "git verify-tag [-v | --verbose] [--format=<format>] <tag>..."
-msgstr "git verify-tag [-v | --verbose] [--format=<æ ¼å¼>] <標籤>..."
+msgid "git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."
+msgstr "git verify-tag [-v | --verbose] [--format=<format>] [--raw] <tag>..."
#: builtin/verify-tag.c
msgid "print tag contents"
msgstr "列å°æ¨™ç±¤å…§å®¹"
#: builtin/worktree.c
-msgid "git worktree add [<options>] <path> [<commit-ish>]"
-msgstr "git worktree add [<é¸é …>] <路徑> [<æ交>]"
+msgid ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]\n"
+" [-b <new-branch>] <path> [<commit-ish>]"
+msgstr ""
+"git worktree add [-f] [--detach] [--checkout] [--lock [--reason <string>]]\n"
+" [-b <new-branch>] <path> [<commit-ish>]"
#: builtin/worktree.c
-msgid "git worktree list [<options>]"
-msgstr "git worktree list [<é¸é …>]"
+msgid "git worktree list [-v | --porcelain [-z]]"
+msgstr "git worktree list [-v | --porcelain [-z]]"
#: builtin/worktree.c
-msgid "git worktree lock [<options>] <path>"
-msgstr "git worktree lock [<é¸é …>] <路徑>"
+msgid "git worktree lock [--reason <string>] <worktree>"
+msgstr "git worktree lock [--reason <string>] <worktree>"
#: builtin/worktree.c
msgid "git worktree move <worktree> <new-path>"
msgstr "git worktree move <工作å€> <新路徑>"
#: builtin/worktree.c
-msgid "git worktree prune [<options>]"
-msgstr "git worktree prune [<é¸é …>]"
+msgid "git worktree prune [-n] [-v] [--expire <expire>]"
+msgstr "git worktree prune [-n] [-v] [--expire <expire>]"
#: builtin/worktree.c
-msgid "git worktree remove [<options>] <worktree>"
-msgstr "git worktree remove [<é¸é …>] <工作å€>"
+msgid "git worktree remove [-f] <worktree>"
+msgstr "git worktree remove [-f] <worktree>"
#: builtin/worktree.c
msgid "git worktree repair [<path>...]"
msgstr "git worktree repair [<路徑>...]"
#: builtin/worktree.c
-msgid "git worktree unlock <path>"
-msgstr "git worktree unlock <路徑>"
+msgid "git worktree unlock <worktree>"
+msgstr "git worktree unlock <worktree>"
#: builtin/worktree.c
#, c-format
@@ -16373,6 +16469,11 @@ msgid "core.fsyncMethod = batch is unsupported on this platform"
msgstr "core.fsyncMethod = batch ä¸æ”¯æ´æœ¬å¹³å°"
#: bundle-uri.c
+#, c-format
+msgid "bundle list at '%s' has no mode"
+msgstr "ä½æ–¼ “%s†的套件包清單沒有模å¼"
+
+#: bundle-uri.c
msgid "failed to create temporary file"
msgstr "無法建立暫存檔"
@@ -16382,23 +16483,40 @@ msgstr "功能ä¸è¶³"
#: bundle-uri.c
#, c-format
-msgid "failed to download bundle from URI '%s'"
-msgstr "無法從 “%s†URI 下載套件"
+msgid "unrecognized bundle mode from URI '%s'"
+msgstr "無法識別從 URI “%s†å–回的套件包模å¼"
+
+#: bundle-uri.c
+#, c-format
+msgid "exceeded bundle URI recursion limit (%d)"
+msgstr "超出套件包 URI éžè¿´é™åˆ¶ (%d)"
#: bundle-uri.c
#, c-format
-msgid "file at URI '%s' is not a bundle"
-msgstr "ä½æ–¼ URI “%s†的檔案ä¸æ˜¯å¥—件"
+msgid "failed to download bundle from URI '%s'"
+msgstr "無法從 “%s†URI 下載套件包"
#: bundle-uri.c
#, c-format
-msgid "failed to unbundle bundle from URI '%s'"
-msgstr "無法解開æºè‡ª URI “%s†的套件"
+msgid "file at URI '%s' is not a bundle or bundle list"
+msgstr "ä½æ–¼ URI “%s†的檔案ä¸æ˜¯å¥—件包或套件包清單"
+
+#: bundle-uri.c
+msgid "bundle-uri: got an empty line"
+msgstr "bundle-uri: 收到空白列"
+
+#: bundle-uri.c
+msgid "bundle-uri: line is not of the form 'key=value'"
+msgstr "bundle-uri: 列的格å¼ä¸æ˜¯ “key=valueâ€"
+
+#: bundle-uri.c
+msgid "bundle-uri: line has empty key or value"
+msgstr "bundle-uri: 列有空éµæˆ–空值"
#: bundle.c
#, c-format
msgid "unrecognized bundle hash algorithm: %s"
-msgstr "無法識別的套件雜湊演算法:%s"
+msgstr "無法識別的套件包雜湊演算法:%s"
#: bundle.c
#, c-format
@@ -16408,7 +16526,7 @@ msgstr "未知功能 '%s'"
#: bundle.c
#, c-format
msgid "'%s' does not look like a v2 or v3 bundle file"
-msgstr "'%s' ä¸åƒæ˜¯ä¸€å€‹ v2 或 v3 版本的套件檔案"
+msgstr "“%s†ä¸åƒæ˜¯ä¸€å€‹ v2 或 v3 版本的套件包檔案"
#: bundle.c
#, c-format
@@ -16421,27 +16539,27 @@ msgstr "版本庫中缺少這些必備的æ交:"
#: bundle.c
msgid "need a repository to verify a bundle"
-msgstr "需è¦ç‰ˆæœ¬åº«é©—證套件"
+msgstr "需è¦ç‰ˆæœ¬åº«é©—證套件包"
#: bundle.c
#, c-format
msgid "The bundle contains this ref:"
msgid_plural "The bundle contains these %<PRIuMAX> refs:"
-msgstr[0] "這個套件å«æœ‰é€™ %<PRIuMAX> 個引用:"
+msgstr[0] "這個套件包,å«æœ‰é€™ %<PRIuMAX> 個引用:"
#: bundle.c
msgid "The bundle records a complete history."
-msgstr "這個套件記錄完整歷å²ç´€éŒ„。"
+msgstr "這個套件包記下了完整歷å²ç´€éŒ„。"
#: bundle.c
#, c-format
msgid "The bundle requires this ref:"
msgid_plural "The bundle requires these %<PRIuMAX> refs:"
-msgstr[0] "這個套件需è¦é€™ %<PRIuMAX> 個引用:"
+msgstr[0] "這個套件包需è¦é€™ %<PRIuMAX> 個引用:"
#: bundle.c
msgid "unable to dup bundle descriptor"
-msgstr "無法複製套件æ述符"
+msgstr "無法複製套件包æè¿°å…ƒ"
#: bundle.c
msgid "Could not spawn pack-objects"
@@ -16459,16 +16577,16 @@ msgstr "引用 '%s' 被 rev-list é¸é …排除"
#: bundle.c
#, c-format
msgid "unsupported bundle version %d"
-msgstr "ä¸æ”¯æ´çš„套件版本 %d"
+msgstr "ä¸æ”¯æ´çš„套件包版本 %d"
#: bundle.c
#, c-format
msgid "cannot write bundle version %d with algorithm %s"
-msgstr "無法寫入 %2$s 演算法的套件版本 %1$d"
+msgstr "無法寫入使用 %2$s 演算法的套件包版本 %1$d"
#: bundle.c
msgid "Refusing to create empty bundle."
-msgstr "ä¸èƒ½å»ºç«‹ç©ºå¥—件。"
+msgstr "ä¸èƒ½å»ºç«‹ç©ºå¥—件包。"
#: bundle.c
#, c-format
@@ -17015,7 +17133,7 @@ msgstr "將檔案內容新增到索引"
#: command-list.h
msgid "Stash the changes in a dirty working directory away"
-msgstr "儲è—髒工作å€ä¸­çš„修改"
+msgstr "貯存髒工作å€ä¸­çš„修改"
#: command-list.h
msgid "Show the working tree status"
@@ -17111,7 +17229,7 @@ msgstr "定義路徑的屬性"
#: command-list.h
msgid "Git command-line interface and conventions"
-msgstr "Git 指令列介é¢å’Œç´„定"
+msgstr "Git 命令列介é¢å’Œç´„定"
#: command-list.h
msgid "A Git core tutorial for developers"
@@ -17139,14 +17257,14 @@ msgstr "Git 使用的常見å•é¡Œ"
#: command-list.h
msgid "The bundle file format"
-msgstr "套件檔案格å¼"
+msgstr "套件包檔案格å¼"
#: command-list.h
msgid "Chunk-based file formats"
msgstr "以å€å¡Šç‚ºåŸºç¤Žçš„檔案格å¼"
#: command-list.h
-msgid "Git commit graph format"
+msgid "Git commit-graph format"
msgstr "Git æ交圖格å¼"
#: command-list.h
@@ -17571,6 +17689,11 @@ msgstr "“has_worktree_moved†中有未處置的情æ³ï¼š%d"
msgid "health thread wait failed [GLE %ld]"
msgstr "å¥åº·ç›£è½åŸ·è¡Œç·’等待失敗 [GLE %ld]"
+#: compat/fsmonitor/fsm-ipc-darwin.c
+#, c-format
+msgid "Invalid path: %s"
+msgstr "無效路徑:%s"
+
#: compat/fsmonitor/fsm-listen-darwin.c
msgid "Unable to create FSEventStream."
msgstr "無法建立 FSEventStream。"
@@ -17609,12 +17732,32 @@ msgstr "在 “%sâ€ ä¸Šå‘¼å« GetOverlappedResult 失敗 [GLE %ld]"
msgid "could not read directory changes [GLE %ld]"
msgstr "無法讀å–目錄變化 [GLE %ld]"
-#: compat/fsmonitor/fsm-settings-win32.c
+#: compat/fsmonitor/fsm-path-utils-darwin.c
+#, c-format
+msgid "opendir('%s') failed"
+msgstr "opendir('%s') 失敗"
+
+#: compat/fsmonitor/fsm-path-utils-darwin.c
+#, c-format
+msgid "lstat('%s') failed"
+msgstr "lstat('%s') 失敗"
+
+#: compat/fsmonitor/fsm-path-utils-darwin.c
+#, c-format
+msgid "strbuf_readlink('%s') failed"
+msgstr "strbuf_readlink('%s') 失敗"
+
+#: compat/fsmonitor/fsm-path-utils-darwin.c
+#, c-format
+msgid "closedir('%s') failed"
+msgstr "closedir('%s') 失敗"
+
+#: compat/fsmonitor/fsm-path-utils-win32.c
#, c-format
msgid "[GLE %ld] unable to open for read '%ls'"
msgstr "[GLE %ld] 無法開啟以讀å–「%lsã€"
-#: compat/fsmonitor/fsm-settings-win32.c
+#: compat/fsmonitor/fsm-path-utils-win32.c
#, c-format
msgid "[GLE %ld] unable to get protocol information for '%ls'"
msgstr "[GLE %ld] 無法å–得「%lsã€çš„通訊å”定資訊"
@@ -17879,7 +18022,7 @@ msgstr "å­æ¨¡çµ„資料物件 %2$s 中錯誤的設定行 %1$d"
#: config.c
#, c-format
msgid "bad config line %d in command line %s"
-msgstr "指令列 %2$s 中錯誤的設定行 %1$d"
+msgstr "命令列 %2$s 中錯誤的設定行 %1$d"
#: config.c
#, c-format
@@ -17922,7 +18065,7 @@ msgstr "å­æ¨¡çµ„資料 %3$s 中設定變數 '%2$s' 錯誤的å–值 '%1$s':%4$
#: config.c
#, c-format
msgid "bad numeric config value '%s' for '%s' in command line %s: %s"
-msgstr "指令列 %3$s 中設定變數 '%2$s' 錯誤的å–值 '%1$s':%4$s"
+msgstr "命令列 %3$s 中設定變數 '%2$s' 錯誤的å–值 '%1$s':%4$s"
#: config.c
#, c-format
@@ -18018,7 +18161,7 @@ msgstr "è§£æž %s 失敗"
#: config.c
msgid "unable to parse command-line config"
-msgstr "無法解æžæŒ‡ä»¤åˆ—中的設定"
+msgstr "無法解æžå‘½ä»¤åˆ—中的設定"
#: config.c
msgid "unknown error occurred while reading the configuration files"
@@ -18037,7 +18180,7 @@ msgstr "splitIndex.maxPercentChange çš„å–值 '%d' 應該介於 0 å’Œ 100 之間
#: config.c
#, c-format
msgid "unable to parse '%s' from command-line config"
-msgstr "無法解æžæŒ‡ä»¤åˆ—設定中的 '%s'"
+msgstr "無法解æžå‘½ä»¤åˆ—設定中的 '%s'"
#: config.c
#, c-format
@@ -19242,7 +19385,7 @@ msgid ""
"Please specify a directory on the command line"
msgstr ""
"無法猜到目錄å。\n"
-"請在指令列指定一個目錄"
+"請在命令列指定一個目錄"
#: dir.c
#, c-format
@@ -19573,8 +19716,9 @@ msgstr "虛擬版本庫 “%s†與 fsmonitor ä¸ç›¸å®¹"
#: fsmonitor-settings.c
#, c-format
msgid ""
-"repository '%s' is incompatible with fsmonitor due to lack of Unix sockets"
-msgstr "版本庫 “%s†因缺少 Unix 通訊端而與 fsmonitor ä¸ç›¸å®¹"
+"socket directory '%s' is incompatible with fsmonitor due to lack of Unix "
+"sockets support"
+msgstr "通訊端 “%s†因缺少 Unix 通訊端支æ´ï¼Œè€Œèˆ‡ fsmonitor ä¸ç›¸å®¹"
#: git.c
msgid ""
@@ -19609,7 +19753,7 @@ msgstr ""
#: git.c help.c
#, c-format
msgid "unsupported command listing type '%s'"
-msgstr "ä¸æ”¯æ´çš„指令列表類型 '%s'"
+msgstr "ä¸æ”¯æ´çš„命令列表類型 '%s'"
#: git.c
#, c-format
@@ -19958,8 +20102,8 @@ msgstr[0] ""
"最類似的指令有"
#: help.c
-msgid "git version [<options>]"
-msgstr "git version [<é¸é …>]"
+msgid "git version [--build-options]"
+msgstr "git version [--build-options]"
#: help.c
#, c-format
@@ -20642,8 +20786,8 @@ msgstr "拒絕éºå¤±æœªè¿½è¹¤æª”案 '%s',而是新增為 %s"
#: merge-recursive.c
#, c-format
msgid ""
-"CONFLICT (rename/rename): Rename \"%s\"->\"%s\" in branch \"%s\" rename \"%s"
-"\"->\"%s\" in \"%s\"%s"
+"CONFLICT (rename/rename): Rename \"%s\"->\"%s\" in branch \"%s\" rename "
+"\"%s\"->\"%s\" in \"%s\"%s"
msgstr ""
"è¡çªï¼ˆé‡æ–°å‘½å/é‡æ–°å‘½å):在分支 \"%3$s\" 中é‡æ–°å‘½å \"%1$s\"->\"%2$s\",在"
"分支 \"%6$s\" 中é‡æ–°å‘½å \"%4$s\"->\"%5$s\"%7$s"
@@ -21033,11 +21177,6 @@ msgid "%s: ignoring alternate object stores, nesting too deep"
msgstr "%s:忽略備用物件庫,嵌套太深"
#: object-file.c
-#, c-format
-msgid "unable to normalize object directory: %s"
-msgstr "無法è¦ç¯„化物件目錄: %s"
-
-#: object-file.c
msgid "unable to fdopen alternates lockfile"
msgstr "無法 fdopen å–代鎖檔案"
@@ -22047,6 +22186,11 @@ msgstr "promisor-remote: 無法關閉 fetch å­è™•ç†ç¨‹åºçš„ stdin"
msgid "promisor remote name cannot begin with '/': %s"
msgstr "promisor é ç«¯å稱ä¸èƒ½ä»¥ '/' 開始:%s"
+#: promisor-remote.c
+#, c-format
+msgid "could not fetch %s from promisor remote"
+msgstr "無法從承諾者é ç«¯æŠ“å– %s"
+
#: protocol-caps.c
msgid "object-info: expected flush after arguments"
msgstr "object-info:引數後é æœŸè¦æœ‰ flush"
@@ -23320,6 +23464,15 @@ msgstr "無法找到 %s 指å‘的樹"
#: revision.c
#, c-format
+msgid "unsupported section for hidden refs: %s"
+msgstr "ä¸æ”¯æ´çš„éš±è—引用å€å¡Šï¼š%s"
+
+#: revision.c
+msgid "--exclude-hidden= passed more than once"
+msgstr "--exclude-hidden= 傳入了ä¸æ­¢ä¸€æ¬¡"
+
+#: revision.c
+#, c-format
msgid "resolve-undo records `%s` which is missing"
msgstr "resolve-undo ä¸å­˜åœ¨çš„「%sã€è¨˜éŒ„"
@@ -23505,6 +23658,16 @@ msgstr "--all 或 <enlistment> 但ä¸èƒ½å‚³å…¥å…©è€…"
#: scalar.c
#, c-format
+msgid "could not remove stale scalar.repo '%s'"
+msgstr "無法移除éŽæ™‚çš„ scalar.repo “%sâ€"
+
+#: scalar.c
+#, c-format
+msgid "removing stale scalar.repo '%s'"
+msgstr "正在移除éŽæ™‚çš„ scalar.repo “%sâ€"
+
+#: scalar.c
+#, c-format
msgid "git repository gone in '%s'"
msgstr "git 版本庫在「%sã€éºå¤±"
@@ -23636,7 +23799,7 @@ msgstr "摘å–"
#: sequencer.c
msgid "rebase"
-msgstr "rebase"
+msgstr "é‡å®šåŸºåº•"
#: sequencer.c
#, c-format
@@ -23710,7 +23873,7 @@ msgstr "您的本機修改將被%s覆蓋。"
#: sequencer.c
msgid "commit your changes or stash them to proceed."
-msgstr "æ交您的修改或儲è—後å†ç¹¼çºŒã€‚"
+msgstr "æ交您的修改或貯存後å†ç¹¼çºŒã€‚"
#. TRANSLATORS: %s will be "revert", "cherry-pick" or
#. "rebase".
@@ -24244,7 +24407,7 @@ msgid ""
msgstr ""
"執行æˆåŠŸï¼š%s\n"
"但是在索引和/或工作å€ä¸­å­˜åœ¨è®Šæ›´\n"
-"æ交或儲è—修改,然後執行\n"
+"æ交或貯存修改,然後執行\n"
"\n"
" git rebase --continue\n"
"\n"
@@ -24255,6 +24418,11 @@ msgid "illegal label name: '%.*s'"
msgstr "éžæ³•çš„標籤å稱:'%.*s'"
#: sequencer.c
+#, c-format
+msgid "could not resolve '%s'"
+msgstr "ç„¡æ³•è§£æž '%s'"
+
+#: sequencer.c
msgid "writing fake root commit"
msgstr "寫å½æ ¹æ交"
@@ -24263,11 +24431,6 @@ msgid "writing squash-onto"
msgstr "寫入 squash-onto"
#: sequencer.c
-#, c-format
-msgid "could not resolve '%s'"
-msgstr "ç„¡æ³•è§£æž '%s'"
-
-#: sequencer.c
msgid "cannot merge without a current revision"
msgstr "沒有目å‰ç‰ˆæœ¬ä¸èƒ½åˆä½µ"
@@ -24364,16 +24527,16 @@ msgid ""
"You can run \"git stash pop\" or \"git stash drop\" at any time.\n"
msgstr ""
"%s\n"
-"您的修改安全地儲存在儲è—å€ä¸­ã€‚\n"
+"您的修改安全地儲存在貯存å€ä¸­ã€‚\n"
"您å¯ä»¥åœ¨ä»»ä½•æ™‚候執行 \"git stash pop\" 或 \"git stash drop\"。\n"
#: sequencer.c
msgid "Applying autostash resulted in conflicts."
-msgstr "因套用自動儲è—而導致è¡çªã€‚"
+msgstr "因套用自動貯存而導致è¡çªã€‚"
#: sequencer.c
msgid "Autostash exists; creating a new stash entry."
-msgstr "已有自動儲è—;建立新儲è—項目。"
+msgstr "已有自動貯存;建立新貯存項目。"
#: sequencer.c
msgid "could not detach HEAD"
@@ -24778,7 +24941,7 @@ msgstr "submodule.fetchJobs ä¸å…許為負值"
#: submodule-config.c
#, c-format
msgid "ignoring '%s' which may be interpreted as a command-line option: %s"
-msgstr "忽略å¯èƒ½è¢«è§£æžç‚ºæŒ‡ä»¤åˆ—é¸é …çš„ '%s':%s"
+msgstr "忽略å¯èƒ½è¢«è§£æžç‚ºå‘½ä»¤åˆ—é¸é …çš„ '%s':%s"
#: submodule-config.c
#, c-format
@@ -24976,6 +25139,18 @@ msgstr "ls-tree 返回未知返回值 %d"
msgid "failed to lstat '%s'"
msgstr "無法 lstat “%sâ€"
+#: t/helper/test-cache-tree.c
+msgid "test-tool cache-tree <options> (control|prime|update)"
+msgstr "test-tool cache-tree <options> (control|prime|update)"
+
+#: t/helper/test-cache-tree.c
+msgid "clear the cache tree before each iteration"
+msgstr "æ¯æ¬¡è¿­ä»£å‰æ¸…除快å–樹狀物件"
+
+#: t/helper/test-cache-tree.c
+msgid "number of entries in the cache tree to invalidate (default 0)"
+msgstr "在快å–樹狀物件中,è¦ä½¿å¤±æ•ˆçš„項目數é‡ï¼ˆé è¨­å€¼ç‚º 0)"
+
#: t/helper/test-fast-rebase.c
msgid "unhandled options"
msgstr "未處ç†é¸é …"
@@ -25317,7 +25492,7 @@ msgstr "å°‡è¦è¨­å®š '%1$s' 的上游為 '%3$s' çš„ '%2$s'\n"
#: transport.c
#, c-format
msgid "could not read bundle '%s'"
-msgstr "無法讀å–「%sã€å¥—件"
+msgstr "無法讀å–「%sã€å¥—件包"
#: transport.c
#, c-format
@@ -25423,7 +25598,7 @@ msgid ""
"%%sPlease commit your changes or stash them before you switch branches."
msgstr ""
"您å°ä¸‹åˆ—檔案的本機修改將被簽出動作覆蓋:\n"
-"%%s請在切æ›åˆ†æ”¯å‰æ交或儲è—您的修改。"
+"%%s請在切æ›åˆ†æ”¯å‰æ交或貯存您的修改。"
#: unpack-trees.c
#, c-format
@@ -25441,7 +25616,7 @@ msgid ""
"%%sPlease commit your changes or stash them before you merge."
msgstr ""
"您å°ä¸‹åˆ—檔案的本機修改將被åˆä½µå‹•ä½œè¦†è“‹ï¼š\n"
-"%%s請在åˆä½µå‰æ交或儲è—您的修改。"
+"%%s請在åˆä½µå‰æ交或貯存您的修改。"
#: unpack-trees.c
#, c-format
@@ -25459,7 +25634,7 @@ msgid ""
"%%sPlease commit your changes or stash them before you %s."
msgstr ""
"您å°ä¸‹åˆ—檔案的本機修改將被 %s 覆蓋:\n"
-"%%s請在 %s 之å‰æ交或儲è—您的修改。"
+"%%s請在 %s 之å‰æ交或貯存您的修改。"
#: unpack-trees.c
#, c-format
@@ -25710,19 +25885,19 @@ msgstr "無效的 '..' 路徑å€å¡Š"
#: usage.c
msgid "usage: "
-msgstr "用法:"
+msgstr "用法: "
#: usage.c
msgid "fatal: "
-msgstr "致命錯誤:"
+msgstr "致命錯誤: "
#: usage.c
msgid "error: "
-msgstr "錯誤:"
+msgstr "錯誤: "
#: usage.c
msgid "warning: "
-msgstr "警告:"
+msgstr "警告: "
#: walker.c
msgid "Fetching objects"
@@ -26001,7 +26176,7 @@ msgstr "未追蹤的內容, "
#, c-format
msgid "Your stash currently has %d entry"
msgid_plural "Your stash currently has %d entries"
-msgstr[0] "您的儲è—å€ç›®å‰æœ‰ %d æ¢ç´€éŒ„"
+msgstr[0] "您的貯存å€ç›®å‰æœ‰ %d æ¢ç´€éŒ„"
#: wt-status.c
msgid "Submodules changed but not updated:"
@@ -26511,31 +26686,31 @@ msgstr[0] "建立了 %d 個路徑\n"
msgid ""
"If the patch applies cleanly, the edited hunk will immediately be\n"
"marked for staging."
-msgstr "如果修補檔能乾淨地套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºæš«å­˜ã€‚"
+msgstr "如果修補檔能完全套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºæš«å­˜ã€‚"
#: git-add--interactive.perl
msgid ""
"If the patch applies cleanly, the edited hunk will immediately be\n"
"marked for stashing."
-msgstr "如果修補檔能乾淨地套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºå„²è—。"
+msgstr "如果修補檔能完全套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºè²¯å­˜ã€‚"
#: git-add--interactive.perl
msgid ""
"If the patch applies cleanly, the edited hunk will immediately be\n"
"marked for unstaging."
-msgstr "如果修補檔能乾淨地套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºæœªæš«å­˜ã€‚"
+msgstr "如果修補檔能完全套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºæœªæš«å­˜ã€‚"
#: git-add--interactive.perl
msgid ""
"If the patch applies cleanly, the edited hunk will immediately be\n"
"marked for applying."
-msgstr "如果修補檔能乾淨地套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºå¥—用。"
+msgstr "如果修補檔能完全套用,編輯å€å¡Šå°‡ç«‹å³æ¨™è¨˜ç‚ºå¥—用。"
#: git-add--interactive.perl
msgid ""
"If the patch applies cleanly, the edited hunk will immediately be\n"
"marked for discarding."
-msgstr "如果修補檔能乾淨地套用,編輯塊將立å³æ¨™è¨˜ç‚ºæ¨æ£„。"
+msgstr "如果修補檔能完全套用,編輯塊將立å³æ¨™è¨˜ç‚ºæ¨æ£„。"
#: git-add--interactive.perl
#, perl-format
@@ -26582,11 +26757,11 @@ msgid ""
"a - stash this hunk and all later hunks in the file\n"
"d - do not stash this hunk or any of the later hunks in the file"
msgstr ""
-"y - 儲è—æ­¤å€å¡Š\n"
-"n - ä¸è¦å„²è—æ­¤å€å¡Š\n"
-"q - 離開。ä¸å„²è—æ­¤å€å¡ŠåŠå¾Œé¢çš„全部å€å¡Š\n"
-"a - 儲è—æ­¤å€å¡Šå’Œæœ¬æª”案中後é¢çš„全部å€å¡Š\n"
-"d - ä¸å„²è—æ­¤å€å¡Šå’Œæœ¬æª”案中後é¢çš„全部å€å¡Š"
+"y - 貯存此å€å¡Š\n"
+"n - ä¸è¦è²¯å­˜æ­¤å€å¡Š\n"
+"q - 離開。ä¸è²¯å­˜æ­¤å€å¡ŠåŠå¾Œé¢çš„全部å€å¡Š\n"
+"a - 貯存此å€å¡Šå’Œæœ¬æª”案中後é¢çš„全部å€å¡Š\n"
+"d - ä¸è²¯å­˜æ­¤å€å¡Šå’Œæœ¬æª”案中後é¢çš„全部å€å¡Š"
#: git-add--interactive.perl
msgid ""
@@ -26801,7 +26976,7 @@ msgstr "致命錯誤:命令「%sã€ä¸­æ­¢ï¼ŒçµæŸç¢¼ï¼š%d"
#: git-send-email.perl
msgid "the editor exited uncleanly, aborting everything"
-msgstr "編輯器éžæ­£å¸¸é›¢é–‹ï¼Œçµ‚止所有動作"
+msgstr "編輯器éžæ­£å¸¸é›¢é–‹ï¼Œä¸­æ­¢æ‰€æœ‰å‹•ä½œ"
#: git-send-email.perl
#, perl-format
@@ -26836,7 +27011,7 @@ msgstr "ä¸èƒ½åœ¨ç‰ˆæœ¬åº«ä¹‹å¤–執行 git format-patch\n"
msgid ""
"`batch-size` and `relogin` must be specified together (via command-line or "
"configuration option)\n"
-msgstr "`batch-size` å’Œ `relogin` å¿…é ˆåŒæ™‚定義(é€éŽæŒ‡ä»¤åˆ—或者設定é¸é …)\n"
+msgstr "`batch-size` å’Œ `relogin` å¿…é ˆåŒæ™‚定義(é€éŽå‘½ä»¤åˆ—或者設定é¸é …)\n"
#: git-send-email.perl
#, perl-format
@@ -27158,3 +27333,147 @@ msgstr "ç•¥éŽ %s å«å‚™ä»½å¾Œç¶´ '%s'。\n"
#, perl-format
msgid "Do you really want to send %s? [y|N]: "
msgstr "您真的è¦å‚³é€ %s?[y|N]: "
+
+#, c-format
+#~ msgid "unable to normalize object directory: %s"
+#~ msgstr "無法è¦ç¯„化物件目錄: %s"
+
+#~ msgid "reset the bisection state"
+#~ msgstr "清除二分æœå°‹ç‹€æ…‹"
+
+#~ msgid "check whether bad or good terms exist"
+#~ msgstr "檢查壞的或好的術語是å¦å­˜åœ¨"
+
+#~ msgid "print out the bisect terms"
+#~ msgstr "列å°äºŒåˆ†æœå°‹è¡“語"
+
+#~ msgid "start the bisect session"
+#~ msgstr "啟動二分æœå°‹éŽç¨‹"
+
+#~ msgid "find the next bisection commit"
+#~ msgstr "尋找下一個二分æœå°‹æ交"
+
+#~ msgid "mark the state of ref (or refs)"
+#~ msgstr "標記 ref (或 refs) 的狀態"
+
+#~ msgid "list the bisection steps so far"
+#~ msgstr "列出迄今的二分æœå°‹æ­¥é©Ÿ"
+
+#~ msgid "replay the bisection process from the given file"
+#~ msgstr "從指定檔案é‡æ”¾äºŒåˆ†æœå°‹éŽç¨‹"
+
+#~ msgid "skip some commits for checkout"
+#~ msgstr "ç•¥éŽè¦ç°½å‡ºçš„部分æ交"
+
+#~ msgid "visualize the bisection"
+#~ msgstr "視覺化二分æœå°‹éŽç¨‹"
+
+#~ msgid "use <cmd>... to automatically bisect"
+#~ msgstr "使用 <cmd>... 自動進行二分æœå°‹"
+
+#~ msgid "no log for BISECT_WRITE"
+#~ msgstr "BISECT_WRITE 無日誌"
+
+#~ msgid "Couldn't look up commit object for HEAD"
+#~ msgstr "無法查詢 HEAD 指å‘çš„æ交物件"
+
+#~ msgid "git bundle create [<options>] <file> <git-rev-list args>"
+#~ msgstr "git bundle create [<é¸é …>] <檔案> <git-rev-list åƒæ•¸>"
+
+#, c-format
+#~ msgid "options '%s' and '%s %s' cannot be used together"
+#~ msgstr "「%sã€å’Œã€Œ%s %sã€é¸é …ä¸å¾—åŒæ™‚使用"
+
+#~ msgid "git commit [<options>] [--] <pathspec>..."
+#~ msgstr "git commit [<é¸é …>] [--] <路徑è¦æ ¼>..."
+
+#~ msgid "git fsck [<options>] [<object>...]"
+#~ msgstr "git fsck [<é¸é …>] [<物件>...]"
+
+#~ msgid "git fsmonitor--daemon stop"
+#~ msgstr "git fsmonitor--daemon stop"
+
+#~ msgid "git fsmonitor--daemon status"
+#~ msgstr "git fsmonitor--daemon status"
+
+#~ msgid "failed to run 'git config'"
+#~ msgstr "無法執行 ‘git config’"
+
+#, c-format
+#~ msgid "could not get 'onto': '%s'"
+#~ msgstr "無法å–å¾— 'onto':'%s'"
+
+#~ msgid "Could not resolve HEAD to a revision"
+#~ msgstr "無法將 HEAD 解æžç‚ºä¸€å€‹ç‰ˆæœ¬"
+
+#, c-format
+#~ msgid "missing required file: %s"
+#~ msgstr "缺少必è¦æª”案:%s"
+
+#~ msgid "git revert [<options>] <commit-ish>..."
+#~ msgstr "git revert [<é¸é …>] <æ交號>..."
+
+#~ msgid "git revert <subcommand>"
+#~ msgstr "git revert <å­æŒ‡ä»¤>"
+
+#~ msgid "git cherry-pick [<options>] <commit-ish>..."
+#~ msgstr "git cherry-pick [<é¸é …>] <æ交號>..."
+
+#~ msgid "git cherry-pick <subcommand>"
+#~ msgstr "git cherry-pick <å­æŒ‡ä»¤>"
+
+#~ msgid "git rm [<options>] [--] <file>..."
+#~ msgstr "git rm [<é¸é …>] [--] <檔案>..."
+
+#~ msgid "using --group=trailer with stdin is not supported"
+#~ msgstr "ä¸æ”¯æ´åœ¨æ¨™æº–輸入使用 --group=trailer"
+
+#~ msgid "git stash show [<options>] [<stash>]"
+#~ msgstr "git stash show [<é¸é …>] [<stash>]"
+
+#~ msgid "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
+#~ msgstr "git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]"
+
+#~ msgid ""
+#~ "git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
+#~ " [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n"
+#~ " [--] [<pathspec>...]]"
+#~ msgstr ""
+#~ "git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
+#~ " [-u|--include-untracked] [-a|--all] [-m|--message <消æ¯>]\n"
+#~ " [--] [<路徑è¦æ ¼>...]]"
+
+#~ msgid ""
+#~ "git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
+#~ " [-u|--include-untracked] [-a|--all] [<message>]"
+#~ msgstr ""
+#~ "git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n"
+#~ " [-u|--include-untracked] [-a|--all] [<消æ¯>]"
+
+#~ msgid "path into the working tree"
+#~ msgstr "到工作å€çš„路徑"
+
+#~ msgid "recurse into submodules"
+#~ msgstr "在å­æ¨¡çµ„中éžè¿´"
+
+#~ msgid "check if it is safe to write to the .gitmodules file"
+#~ msgstr "檢查寫入 .gitmodules 檔案是å¦å®‰å…¨"
+
+#~ msgid "unset the config in the .gitmodules file"
+#~ msgstr "å–消 .gitmodules 檔案中的設定"
+
+#~ msgid "git submodule--helper config --unset <name>"
+#~ msgstr "git submodule--helper config --unset <å稱>"
+
+#, c-format
+#~ msgid "'%s' is not a valid submodule--helper subcommand"
+#~ msgstr "'%s' ä¸æ˜¯ä¸€å€‹æœ‰æ•ˆçš„ submodule--helper å­æŒ‡ä»¤"
+
+#~ msgid "git upload-pack [<options>] <dir>"
+#~ msgstr "git upload-pack [<é¸é …>] <目錄>"
+
+#~ msgid "git worktree add [<options>] <path> [<commit-ish>]"
+#~ msgstr "git worktree add [<é¸é …>] <路徑> [<æ交>]"
+
+#~ msgid "git worktree lock [<options>] <path>"
+#~ msgstr "git worktree lock [<é¸é …>] <路徑>"
diff --git a/preload-index.c b/preload-index.c
index 100f7a374d..7a26b08c21 100644
--- a/preload-index.c
+++ b/preload-index.c
@@ -4,11 +4,15 @@
#include "cache.h"
#include "pathspec.h"
#include "dir.h"
+#include "environment.h"
#include "fsmonitor.h"
+#include "gettext.h"
#include "config.h"
#include "progress.h"
#include "thread-utils.h"
#include "repository.h"
+#include "symlinks.h"
+#include "trace2.h"
/*
* Mostly randomly chosen maximum thread counts: we
diff --git a/pretty.c b/pretty.c
index 1e1e21878c..0bb938021b 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1,8 +1,13 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "config.h"
#include "commit.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "utf8.h"
#include "diff.h"
+#include "pager.h"
#include "revision.h"
#include "string-list.h"
#include "mailmap.h"
@@ -719,7 +724,7 @@ const char *repo_logmsg_reencode(struct repository *r,
* Otherwise, we still want to munge the encoding header in the
* result, which will be done by modifying the buffer. If we
* are using a fresh copy, we can reuse it. But if we are using
- * the cached copy from get_commit_buffer, we need to duplicate it
+ * the cached copy from repo_get_commit_buffer, we need to duplicate it
* to avoid munging the cached copy.
*/
if (msg == get_cached_commit_buffer(r, commit, NULL))
@@ -1857,7 +1862,8 @@ static size_t format_commit_item(struct strbuf *sb, /* in UTF-8 */
return consumed + 1;
}
-static size_t userformat_want_item(struct strbuf *sb, const char *placeholder,
+static size_t userformat_want_item(struct strbuf *sb UNUSED,
+ const char *placeholder,
void *context)
{
struct userformat_want *w = context;
@@ -2199,12 +2205,14 @@ void pretty_print_commit(struct pretty_print_context *pp,
int need_8bit_cte = pp->need_8bit_cte;
if (pp->fmt == CMIT_FMT_USERFORMAT) {
- format_commit_message(commit, user_format, sb, pp);
+ repo_format_commit_message(the_repository, commit,
+ user_format, sb, pp);
return;
}
encoding = get_log_output_encoding();
- msg = reencoded = logmsg_reencode(commit, NULL, encoding);
+ msg = reencoded = repo_logmsg_reencode(the_repository, commit, NULL,
+ encoding);
if (pp->fmt == CMIT_FMT_ONELINE || cmit_fmt_is_mail(pp->fmt))
indent = 0;
@@ -2261,7 +2269,7 @@ void pretty_print_commit(struct pretty_print_context *pp,
if (cmit_fmt_is_mail(pp->fmt) && sb->len <= beginning_of_body)
strbuf_addch(sb, '\n');
- unuse_commit_buffer(commit, reencoded);
+ repo_unuse_commit_buffer(the_repository, commit, reencoded);
}
void pp_commit_easy(enum cmit_fmt fmt, const struct commit *commit,
diff --git a/pretty.h b/pretty.h
index f34e24c53a..421209e9ec 100644
--- a/pretty.h
+++ b/pretty.h
@@ -1,11 +1,11 @@
#ifndef PRETTY_H
#define PRETTY_H
-#include "cache.h"
#include "date.h"
#include "string-list.h"
struct commit;
+struct repository;
struct strbuf;
struct process_trailer_options;
@@ -120,10 +120,6 @@ void repo_format_commit_message(struct repository *r,
const struct commit *commit,
const char *format, struct strbuf *sb,
const struct pretty_print_context *context);
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define format_commit_message(c, f, s, con) \
- repo_format_commit_message(the_repository, c, f, s, con)
-#endif
/*
* Parse given arguments from "arg", check it for correctness and
@@ -153,6 +149,8 @@ int commit_format_is_empty(enum cmit_fmt);
/* Make subject of commit message suitable for filename */
void format_sanitized_subject(struct strbuf *sb, const char *msg, size_t len);
+int has_non_ascii(const char *text);
+
/*
* Set values of fields in "struct process_trailer_options"
* according to trailers arguments.
diff --git a/prio-queue.c b/prio-queue.c
index d31b48e725..dc2476be53 100644
--- a/prio-queue.c
+++ b/prio-queue.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "prio-queue.h"
static inline int compare(struct prio_queue *queue, int i, int j)
diff --git a/progress.c b/progress.c
index 0cdd875d37..f695798aca 100644
--- a/progress.c
+++ b/progress.c
@@ -9,11 +9,13 @@
*/
#define GIT_TEST_PROGRESS_ONLY
-#include "cache.h"
-#include "gettext.h"
+#include "git-compat-util.h"
+#include "pager.h"
#include "progress.h"
+#include "repository.h"
#include "strbuf.h"
#include "trace.h"
+#include "trace2.h"
#include "utf8.h"
#include "config.h"
@@ -59,7 +61,7 @@ void progress_test_force_update(void)
}
-static void progress_interval(int signum)
+static void progress_interval(int signum UNUSED)
{
progress_update = 1;
}
diff --git a/promisor-remote.c b/promisor-remote.c
index 68f46f5ec7..1adcd6fb0a 100644
--- a/promisor-remote.c
+++ b/promisor-remote.c
@@ -1,9 +1,13 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
+#include "hex.h"
#include "object-store.h"
#include "promisor-remote.h"
#include "config.h"
+#include "trace2.h"
#include "transport.h"
#include "strvec.h"
+#include "packfile.h"
struct promisor_remote_config {
struct promisor_remote *promisors;
@@ -230,18 +234,18 @@ static int remove_fetched_oids(struct repository *repo,
return remaining_nr;
}
-int promisor_remote_get_direct(struct repository *repo,
- const struct object_id *oids,
- int oid_nr)
+void promisor_remote_get_direct(struct repository *repo,
+ const struct object_id *oids,
+ int oid_nr)
{
struct promisor_remote *r;
struct object_id *remaining_oids = (struct object_id *)oids;
int remaining_nr = oid_nr;
int to_free = 0;
- int res = -1;
+ int i;
if (oid_nr == 0)
- return 0;
+ return;
promisor_remote_init(repo);
@@ -256,12 +260,16 @@ int promisor_remote_get_direct(struct repository *repo,
continue;
}
}
- res = 0;
- break;
+ goto all_fetched;
}
+ for (i = 0; i < remaining_nr; i++) {
+ if (is_promisor_object(&remaining_oids[i]))
+ die(_("could not fetch %s from promisor remote"),
+ oid_to_hex(&remaining_oids[i]));
+ }
+
+all_fetched:
if (to_free)
free(remaining_oids);
-
- return res;
}
diff --git a/promisor-remote.h b/promisor-remote.h
index edc45ab0f5..2cb9eda9ea 100644
--- a/promisor-remote.h
+++ b/promisor-remote.h
@@ -18,34 +18,18 @@ struct promisor_remote {
};
void repo_promisor_remote_reinit(struct repository *r);
-static inline void promisor_remote_reinit(void)
-{
- repo_promisor_remote_reinit(the_repository);
-}
-
void promisor_remote_clear(struct promisor_remote_config *config);
-
struct promisor_remote *repo_promisor_remote_find(struct repository *r, const char *remote_name);
-static inline struct promisor_remote *promisor_remote_find(const char *remote_name)
-{
- return repo_promisor_remote_find(the_repository, remote_name);
-}
-
int repo_has_promisor_remote(struct repository *r);
-static inline int has_promisor_remote(void)
-{
- return repo_has_promisor_remote(the_repository);
-}
/*
* Fetches all requested objects from all promisor remotes, trying them one at
- * a time until all objects are fetched. Returns 0 upon success, and non-zero
- * otherwise.
+ * a time until all objects are fetched.
*
- * If oid_nr is 0, this function returns 0 (success) immediately.
+ * If oid_nr is 0, this function returns immediately.
*/
-int promisor_remote_get_direct(struct repository *repo,
- const struct object_id *oids,
- int oid_nr);
+void promisor_remote_get_direct(struct repository *repo,
+ const struct object_id *oids,
+ int oid_nr);
#endif /* PROMISOR_REMOTE_H */
diff --git a/prompt.c b/prompt.c
index 50df17279d..3baa33f63d 100644
--- a/prompt.c
+++ b/prompt.c
@@ -1,5 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
+#include "environment.h"
#include "run-command.h"
#include "strbuf.h"
#include "prompt.h"
diff --git a/protocol-caps.c b/protocol-caps.c
index bbde91810a..a90c48852e 100644
--- a/protocol-caps.c
+++ b/protocol-caps.c
@@ -1,9 +1,11 @@
#include "git-compat-util.h"
#include "protocol-caps.h"
#include "gettext.h"
+#include "hex.h"
#include "pkt-line.h"
#include "strvec.h"
-#include "hash.h"
+#include "hash-ll.h"
+#include "hex.h"
#include "object.h"
#include "object-store.h"
#include "string-list.h"
@@ -77,7 +79,7 @@ static void send_info(struct repository *r, struct packet_writer *writer,
int cap_object_info(struct repository *r, struct packet_reader *request)
{
- struct requested_info info;
+ struct requested_info info = { 0 };
struct packet_writer writer;
struct string_list oid_str_list = STRING_LIST_INIT_DUP;
diff --git a/protocol.c b/protocol.c
index c53f7df5be..079ba75acf 100644
--- a/protocol.c
+++ b/protocol.c
@@ -1,6 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
+#include "environment.h"
#include "protocol.h"
+#include "trace2.h"
static enum protocol_version parse_protocol_version(const char *value)
{
diff --git a/protocol.h b/protocol.h
index cef1a4a01c..de66bf80f8 100644
--- a/protocol.h
+++ b/protocol.h
@@ -1,6 +1,27 @@
#ifndef PROTOCOL_H
#define PROTOCOL_H
+/*
+ * Intensive research over the course of many years has shown that
+ * port 9418 is totally unused by anything else. Or
+ *
+ * Your search - "port 9418" - did not match any documents.
+ *
+ * as www.google.com puts it.
+ *
+ * This port has been properly assigned for git use by IANA:
+ * git (Assigned-9418) [I06-050728-0001].
+ *
+ * git 9418/tcp git pack transfer service
+ * git 9418/udp git pack transfer service
+ *
+ * with Linus Torvalds <torvalds@osdl.org> as the point of
+ * contact. September 2005.
+ *
+ * See http://www.iana.org/assignments/port-numbers
+ */
+#define DEFAULT_GIT_PORT 9418
+
enum protocol_version {
protocol_unknown_version = -1,
protocol_v0 = 0,
diff --git a/prune-packed.c b/prune-packed.c
index 261520b472..58412b4fb9 100644
--- a/prune-packed.c
+++ b/prune-packed.c
@@ -1,3 +1,6 @@
+#include "git-compat-util.h"
+#include "environment.h"
+#include "gettext.h"
#include "object-store.h"
#include "packfile.h"
#include "progress.h"
diff --git a/quote.c b/quote.c
index 26719d21d1..43c739671e 100644
--- a/quote.c
+++ b/quote.c
@@ -1,5 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
+#include "path.h"
#include "quote.h"
+#include "strbuf.h"
#include "strvec.h"
int quote_path_fully = 1;
diff --git a/quote.h b/quote.h
index 87ff458b06..0300c29104 100644
--- a/quote.h
+++ b/quote.h
@@ -3,6 +3,8 @@
struct strbuf;
+extern int quote_path_fully;
+
/* Help to copy the thing properly quoted for the shell safety.
* any single quote is replaced with '\'', any exclamation point
* is replaced with '\!', and the whole thing is enclosed in a
diff --git a/range-diff.c b/range-diff.c
index 8b7d81adc1..6a704e6f47 100644
--- a/range-diff.c
+++ b/range-diff.c
@@ -1,5 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "environment.h"
+#include "gettext.h"
#include "range-diff.h"
+#include "object-name.h"
#include "string-list.h"
#include "run-command.h"
#include "strvec.h"
@@ -8,6 +11,7 @@
#include "linear-assignment.h"
#include "diffcore.h"
#include "commit.h"
+#include "pager.h"
#include "pretty.h"
#include "userdiff.h"
#include "apply.h"
@@ -94,7 +98,7 @@ static int read_patches(const char *range, struct string_list *list,
strbuf_reset(&buf);
}
CALLOC_ARRAY(util, 1);
- if (get_oid(p, &util->oid)) {
+ if (repo_get_oid(the_repository, p, &util->oid)) {
error(_("could not parse commit '%s'"), p);
FREE_AND_NULL(util);
string_list_clear(list, 1);
@@ -269,14 +273,18 @@ static void find_exact_matches(struct string_list *a, struct string_list *b)
hashmap_clear(&map);
}
-static int diffsize_consume(void *data, char *line, unsigned long len)
+static int diffsize_consume(void *data,
+ char *line UNUSED,
+ unsigned long len UNUSED)
{
(*(int *)data)++;
return 0;
}
-static void diffsize_hunk(void *data, long ob, long on, long nb, long nn,
- const char *funcline, long funclen)
+static void diffsize_hunk(void *data,
+ long ob UNUSED, long on UNUSED,
+ long nb UNUSED, long nn UNUSED,
+ const char *func UNUSED, long funclen UNUSED)
{
diffsize_consume(data, NULL, 0);
}
@@ -379,11 +387,14 @@ static void output_pair_header(struct diff_options *diffopt,
const char *color_new = diff_get_color_opt(diffopt, DIFF_FILE_NEW);
const char *color_commit = diff_get_color_opt(diffopt, DIFF_COMMIT);
const char *color;
+ int abbrev = diffopt->abbrev;
+
+ if (abbrev < 0)
+ abbrev = DEFAULT_ABBREV;
if (!dashes->len)
strbuf_addchars(dashes, '-',
- strlen(find_unique_abbrev(oid,
- DEFAULT_ABBREV)));
+ strlen(repo_find_unique_abbrev(the_repository, oid, abbrev)));
if (!b_util) {
color = color_old;
@@ -405,7 +416,7 @@ static void output_pair_header(struct diff_options *diffopt,
strbuf_addf(buf, "%*s: %s ", patch_no_width, "-", dashes->buf);
else
strbuf_addf(buf, "%*d: %s ", patch_no_width, a_util->i + 1,
- find_unique_abbrev(&a_util->oid, DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, &a_util->oid, abbrev));
if (status == '!')
strbuf_addf(buf, "%s%s", color_reset, color);
@@ -417,7 +428,7 @@ static void output_pair_header(struct diff_options *diffopt,
strbuf_addf(buf, " %*s: %s", patch_no_width, "-", dashes->buf);
else
strbuf_addf(buf, " %*d: %s", patch_no_width, b_util->i + 1,
- find_unique_abbrev(&b_util->oid, DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, &b_util->oid, abbrev));
commit = lookup_commit_reference(the_repository, oid);
if (commit) {
@@ -461,7 +472,7 @@ static void patch_diff(const char *a, const char *b,
diff_flush(diffopt);
}
-static struct strbuf *output_prefix_cb(struct diff_options *opt, void *data)
+static struct strbuf *output_prefix_cb(struct diff_options *opt UNUSED, void *data)
{
return data;
}
@@ -478,7 +489,7 @@ static void output(struct string_list *a, struct string_list *b,
if (range_diff_opts->diffopt)
memcpy(&opts, range_diff_opts->diffopt, sizeof(opts));
else
- diff_setup(&opts);
+ repo_diff_setup(the_repository, &opts);
opts.no_free = 1;
if (!opts.output_format)
@@ -581,7 +592,7 @@ int is_range_diff_range(const char *arg)
int i, positive = 0, negative = 0;
struct rev_info revs;
- init_revisions(&revs, NULL);
+ repo_init_revisions(the_repository, &revs, NULL);
if (setup_revisions(3, argv, &revs, NULL) == 1) {
for (i = 0; i < revs.pending.nr; i++)
if (revs.pending.objects[i].item->flags & UNINTERESTING)
diff --git a/reachable.c b/reachable.c
index aba63ebeb3..55bb114353 100644
--- a/reachable.c
+++ b/reachable.c
@@ -1,4 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
#include "tag.h"
#include "commit.h"
@@ -48,7 +50,9 @@ static int add_one_ref(const char *path, const struct object_id *oid,
* The traversal will have already marked us as SEEN, so we
* only need to handle any progress reporting here.
*/
-static void mark_object(struct object *obj, const char *name, void *data)
+static void mark_object(struct object *obj UNUSED,
+ const char *name UNUSED,
+ void *data)
{
update_progress(data);
}
@@ -152,7 +156,8 @@ static int add_recent_loose(const struct object_id *oid,
}
static int add_recent_packed(const struct object_id *oid,
- struct packed_git *p, uint32_t pos,
+ struct packed_git *p,
+ uint32_t pos,
void *data)
{
struct object *obj;
@@ -202,10 +207,10 @@ int add_unseen_recent_objects_to_traversal(struct rev_info *revs,
static int mark_object_seen(const struct object_id *oid,
enum object_type type,
- int exclude,
- uint32_t name_hash,
- struct packed_git *found_pack,
- off_t found_offset)
+ int exclude UNUSED,
+ uint32_t name_hash UNUSED,
+ struct packed_git *found_pack UNUSED,
+ off_t found_offset UNUSED)
{
struct object *obj = lookup_object_by_type(the_repository, oid, type);
if (!obj)
diff --git a/read-cache.c b/read-cache.c
index 3202402927..f4c31a68c8 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -4,23 +4,34 @@
* Copyright (C) Linus Torvalds, 2005
*/
#include "cache.h"
+#include "alloc.h"
#include "config.h"
+#include "date.h"
#include "diff.h"
#include "diffcore.h"
+#include "hex.h"
#include "tempfile.h"
#include "lockfile.h"
#include "cache-tree.h"
#include "refs.h"
#include "dir.h"
+#include "object-file.h"
#include "object-store.h"
+#include "oid-array.h"
#include "tree.h"
#include "commit.h"
#include "blob.h"
+#include "environment.h"
+#include "gettext.h"
+#include "mem-pool.h"
+#include "object-name.h"
#include "resolve-undo.h"
#include "run-command.h"
#include "strbuf.h"
+#include "trace2.h"
#include "varint.h"
#include "split-index.h"
+#include "symlinks.h"
#include "utf8.h"
#include "fsmonitor.h"
#include "thread-utils.h"
@@ -29,6 +40,7 @@
#include "csum-file.h"
#include "promisor-remote.h"
#include "hook.h"
+#include "wrapper.h"
/* Mask for the name length in ce_flags in the on-disk index */
@@ -263,7 +275,7 @@ static int ce_compare_link(const struct cache_entry *ce, size_t expected_size)
if (strbuf_readlink(&sb, ce->name, expected_size))
return -1;
- buffer = read_object_file(&ce->oid, &type, &size);
+ buffer = repo_read_object_file(the_repository, &ce->oid, &type, &size);
if (buffer) {
if (size == sb.len)
match = memcmp(buffer, sb.buf, size);
@@ -488,86 +500,30 @@ int ie_modified(struct index_state *istate,
return 0;
}
-int base_name_compare(const char *name1, int len1, int mode1,
- const char *name2, int len2, int mode2)
+static int cache_name_stage_compare(const char *name1, int len1, int stage1,
+ const char *name2, int len2, int stage2)
{
- unsigned char c1, c2;
- int len = len1 < len2 ? len1 : len2;
int cmp;
- cmp = memcmp(name1, name2, len);
+ cmp = name_compare(name1, len1, name2, len2);
if (cmp)
return cmp;
- c1 = name1[len];
- c2 = name2[len];
- if (!c1 && S_ISDIR(mode1))
- c1 = '/';
- if (!c2 && S_ISDIR(mode2))
- c2 = '/';
- return (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0;
-}
-
-/*
- * df_name_compare() is identical to base_name_compare(), except it
- * compares conflicting directory/file entries as equal. Note that
- * while a directory name compares as equal to a regular file, they
- * then individually compare _differently_ to a filename that has
- * a dot after the basename (because '\0' < '.' < '/').
- *
- * This is used by routines that want to traverse the git namespace
- * but then handle conflicting entries together when possible.
- */
-int df_name_compare(const char *name1, int len1, int mode1,
- const char *name2, int len2, int mode2)
-{
- int len = len1 < len2 ? len1 : len2, cmp;
- unsigned char c1, c2;
- cmp = memcmp(name1, name2, len);
- if (cmp)
- return cmp;
- /* Directories and files compare equal (same length, same name) */
- if (len1 == len2)
- return 0;
- c1 = name1[len];
- if (!c1 && S_ISDIR(mode1))
- c1 = '/';
- c2 = name2[len];
- if (!c2 && S_ISDIR(mode2))
- c2 = '/';
- if (c1 == '/' && !c2)
- return 0;
- if (c2 == '/' && !c1)
- return 0;
- return c1 - c2;
-}
-
-int name_compare(const char *name1, size_t len1, const char *name2, size_t len2)
-{
- size_t min_len = (len1 < len2) ? len1 : len2;
- int cmp = memcmp(name1, name2, min_len);
- if (cmp)
- return cmp;
- if (len1 < len2)
+ if (stage1 < stage2)
return -1;
- if (len1 > len2)
+ if (stage1 > stage2)
return 1;
return 0;
}
-int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2)
+int cmp_cache_name_compare(const void *a_, const void *b_)
{
- int cmp;
-
- cmp = name_compare(name1, len1, name2, len2);
- if (cmp)
- return cmp;
+ const struct cache_entry *ce1, *ce2;
- if (stage1 < stage2)
- return -1;
- if (stage1 > stage2)
- return 1;
- return 0;
+ ce1 = *((const struct cache_entry **)a_);
+ ce2 = *((const struct cache_entry **)b_);
+ return cache_name_stage_compare(ce1->name, ce1->ce_namelen, ce_stage(ce1),
+ ce2->name, ce2->ce_namelen, ce_stage(ce2));
}
static int index_name_stage_pos(struct index_state *istate,
@@ -1817,6 +1773,8 @@ static int verify_hdr(const struct cache_header *hdr, unsigned long size)
git_hash_ctx c;
unsigned char hash[GIT_MAX_RAWSZ];
int hdr_version;
+ unsigned char *start, *end;
+ struct object_id oid;
if (hdr->hdr_signature != htonl(CACHE_SIGNATURE))
return error(_("bad signature 0x%08x"), hdr->hdr_signature);
@@ -1827,10 +1785,16 @@ static int verify_hdr(const struct cache_header *hdr, unsigned long size)
if (!verify_index_checksum)
return 0;
+ end = (unsigned char *)hdr + size;
+ start = end - the_hash_algo->rawsz;
+ oidread(&oid, start);
+ if (oideq(&oid, null_oid()))
+ return 0;
+
the_hash_algo->init_fn(&c);
the_hash_algo->update_fn(&c, hdr, size - the_hash_algo->rawsz);
the_hash_algo->final_fn(hash, &c);
- if (!hasheq(hash, (unsigned char *)hdr + size - the_hash_algo->rawsz))
+ if (!hasheq(hash, start))
return error(_("bad index file sha1 signature"));
return 0;
}
@@ -2292,12 +2256,10 @@ static void set_new_index_sparsity(struct index_state *istate)
* If the index's repo exists, mark it sparse according to
* repo settings.
*/
- if (istate->repo) {
- prepare_repo_settings(istate->repo);
- if (!istate->repo->settings.command_requires_full_index &&
- is_sparse_index_allowed(istate, 0))
- istate->sparse_index = 1;
- }
+ prepare_repo_settings(istate->repo);
+ if (!istate->repo->settings.command_requires_full_index &&
+ is_sparse_index_allowed(istate, 0))
+ istate->sparse_index = 1;
}
/* remember to discard_cache() before reading a different cache! */
@@ -2322,8 +2284,6 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
fd = open(path, O_RDONLY);
if (fd < 0) {
if (!must_exist && errno == ENOENT) {
- if (!istate->repo)
- istate->repo = the_repository;
set_new_index_sparsity(istate);
return 0;
}
@@ -2425,9 +2385,6 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
trace2_data_intmax("index", the_repository, "read/cache_nr",
istate->cache_nr);
- if (!istate->repo)
- istate->repo = the_repository;
-
/*
* If the command explicitly requires a full index, force it
* to be full. Otherwise, correct the sparsity based on repository
@@ -2490,9 +2447,10 @@ int read_index_from(struct index_state *istate, const char *path,
trace_performance_enter();
if (split_index->base)
- discard_index(split_index->base);
+ release_index(split_index->base);
else
- CALLOC_ARRAY(split_index->base, 1);
+ ALLOC_ARRAY(split_index->base, 1);
+ index_state_init(split_index->base, istate->repo);
base_oid_hex = oid_to_hex(&split_index->base_oid);
base_path = xstrfmt("%s/sharedindex.%s", gitdir, base_oid_hex);
@@ -2531,7 +2489,13 @@ int is_index_unborn(struct index_state *istate)
return (!istate->cache_nr && !istate->timestamp.sec);
}
-int discard_index(struct index_state *istate)
+void index_state_init(struct index_state *istate, struct repository *r)
+{
+ struct index_state blank = INDEX_STATE_INIT(r);
+ memcpy(istate, &blank, sizeof(*istate));
+}
+
+void release_index(struct index_state *istate)
{
/*
* Cache entries in istate->cache[] should have been allocated
@@ -2543,27 +2507,28 @@ int discard_index(struct index_state *istate)
validate_cache_entries(istate);
resolve_undo_clear_index(istate);
- istate->cache_nr = 0;
- istate->cache_changed = 0;
- istate->timestamp.sec = 0;
- istate->timestamp.nsec = 0;
free_name_hash(istate);
cache_tree_free(&(istate->cache_tree));
- istate->initialized = 0;
- istate->fsmonitor_has_run_once = 0;
- FREE_AND_NULL(istate->fsmonitor_last_update);
- FREE_AND_NULL(istate->cache);
- istate->cache_alloc = 0;
+ free(istate->fsmonitor_last_update);
+ free(istate->cache);
discard_split_index(istate);
free_untracked_cache(istate->untracked);
- istate->untracked = NULL;
+
+ if (istate->sparse_checkout_patterns) {
+ clear_pattern_list(istate->sparse_checkout_patterns);
+ FREE_AND_NULL(istate->sparse_checkout_patterns);
+ }
if (istate->ce_mem_pool) {
mem_pool_discard(istate->ce_mem_pool, should_validate_cache_entries());
FREE_AND_NULL(istate->ce_mem_pool);
}
+}
- return 0;
+void discard_index(struct index_state *istate)
+{
+ release_index(istate);
+ index_state_init(istate, istate->repo);
}
/*
@@ -2618,7 +2583,7 @@ int repo_index_has_changes(struct repository *repo,
if (tree)
cmp = tree->object.oid;
- if (tree || !get_oid_tree("HEAD", &cmp)) {
+ if (tree || !repo_get_oid_tree(repo, "HEAD", &cmp)) {
struct diff_options opt;
repo_diff_setup(repo, &opt);
@@ -2891,6 +2856,16 @@ static int record_ieot(void)
return !git_config_get_index_threads(&val) && val != 1;
}
+enum write_extensions {
+ WRITE_NO_EXTENSION = 0,
+ WRITE_SPLIT_INDEX_EXTENSION = 1<<0,
+ WRITE_CACHE_TREE_EXTENSION = 1<<1,
+ WRITE_RESOLVE_UNDO_EXTENSION = 1<<2,
+ WRITE_UNTRACKED_CACHE_EXTENSION = 1<<3,
+ WRITE_FSMONITOR_EXTENSION = 1<<4,
+};
+#define WRITE_ALL_EXTENSIONS ((enum write_extensions)-1)
+
/*
* On success, `tempfile` is closed. If it is the temporary file
* of a `struct lock_file`, we will therefore effectively perform
@@ -2899,7 +2874,7 @@ static int record_ieot(void)
* rely on it.
*/
static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
- int strip_extensions, unsigned flags)
+ enum write_extensions write_extensions, unsigned flags)
{
uint64_t start = getnanotime();
struct hashfile *f;
@@ -2917,9 +2892,13 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
int ieot_entries = 1;
struct index_entry_offset_table *ieot = NULL;
int nr, nr_threads;
+ struct repository *r = istate->repo;
f = hashfd(tempfile->fd, tempfile->filename.buf);
+ prepare_repo_settings(r);
+ f->skip_hash = r->settings.index_skip_hash;
+
for (i = removed = extended = 0; i < entries; i++) {
if (cache[i]->ce_flags & CE_REMOVE)
removed++;
@@ -2933,7 +2912,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
}
if (!istate->version)
- istate->version = get_index_format_default(the_repository);
+ istate->version = get_index_format_default(r);
/* demote version 3 to version 2 when the latter suffices */
if (istate->version == 3 || istate->version == 2)
@@ -3068,8 +3047,8 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
return -1;
}
- if (!strip_extensions && istate->split_index &&
- !is_null_oid(&istate->split_index->base_oid)) {
+ if (write_extensions & WRITE_SPLIT_INDEX_EXTENSION &&
+ istate->split_index) {
struct strbuf sb = STRBUF_INIT;
if (istate->sparse_index)
@@ -3083,7 +3062,8 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
if (err)
return -1;
}
- if (!strip_extensions && !drop_cache_tree && istate->cache_tree) {
+ if (write_extensions & WRITE_CACHE_TREE_EXTENSION &&
+ !drop_cache_tree && istate->cache_tree) {
struct strbuf sb = STRBUF_INIT;
cache_tree_write(&sb, istate->cache_tree);
@@ -3093,7 +3073,8 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
if (err)
return -1;
}
- if (!strip_extensions && istate->resolve_undo) {
+ if (write_extensions & WRITE_RESOLVE_UNDO_EXTENSION &&
+ istate->resolve_undo) {
struct strbuf sb = STRBUF_INIT;
resolve_undo_write(&sb, istate->resolve_undo);
@@ -3104,7 +3085,8 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
if (err)
return -1;
}
- if (!strip_extensions && istate->untracked) {
+ if (write_extensions & WRITE_UNTRACKED_CACHE_EXTENSION &&
+ istate->untracked) {
struct strbuf sb = STRBUF_INIT;
write_untracked_extension(&sb, istate->untracked);
@@ -3115,7 +3097,8 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
if (err)
return -1;
}
- if (!strip_extensions && istate->fsmonitor_last_update) {
+ if (write_extensions & WRITE_FSMONITOR_EXTENSION &&
+ istate->fsmonitor_last_update) {
struct strbuf sb = STRBUF_INIT;
write_fsmonitor_extension(&sb, istate);
@@ -3189,8 +3172,10 @@ static int commit_locked_index(struct lock_file *lk)
return commit_lock_file(lk);
}
-static int do_write_locked_index(struct index_state *istate, struct lock_file *lock,
- unsigned flags)
+static int do_write_locked_index(struct index_state *istate,
+ struct lock_file *lock,
+ unsigned flags,
+ enum write_extensions write_extensions)
{
int ret;
int was_full = istate->sparse_index == INDEX_EXPANDED;
@@ -3208,7 +3193,7 @@ static int do_write_locked_index(struct index_state *istate, struct lock_file *l
*/
trace2_region_enter_printf("index", "do_write_index", the_repository,
"%s", get_lock_file_path(lock));
- ret = do_write_index(istate, lock->tempfile, 0, flags);
+ ret = do_write_index(istate, lock->tempfile, write_extensions, flags);
trace2_region_leave_printf("index", "do_write_index", the_repository,
"%s", get_lock_file_path(lock));
@@ -3237,7 +3222,7 @@ static int write_split_index(struct index_state *istate,
{
int ret;
prepare_to_write_split_index(istate);
- ret = do_write_locked_index(istate, lock, flags);
+ ret = do_write_locked_index(istate, lock, flags, WRITE_ALL_EXTENSIONS);
finish_writing_split_index(istate);
return ret;
}
@@ -3312,7 +3297,7 @@ static int write_shared_index(struct index_state *istate,
trace2_region_enter_printf("index", "shared/do_write_index",
the_repository, "%s", get_tempfile_path(*temp));
- ret = do_write_index(si->base, *temp, 1, flags);
+ ret = do_write_index(si->base, *temp, WRITE_NO_EXTENSION, flags);
trace2_region_leave_printf("index", "shared/do_write_index",
the_repository, "%s", get_tempfile_path(*temp));
@@ -3389,9 +3374,8 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock,
if ((!si && !test_split_index_env) ||
alternate_index_output ||
(istate->cache_changed & ~EXTMASK)) {
- if (si)
- oidclr(&si->base_oid);
- ret = do_write_locked_index(istate, lock, flags);
+ ret = do_write_locked_index(istate, lock, flags,
+ ~WRITE_SPLIT_INDEX_EXTENSION);
goto out;
}
@@ -3417,8 +3401,8 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock,
/* Same initial permissions as the main .git/index file */
temp = mks_tempfile_sm(git_path("sharedindex_XXXXXX"), 0, 0666);
if (!temp) {
- oidclr(&si->base_oid);
- ret = do_write_locked_index(istate, lock, flags);
+ ret = do_write_locked_index(istate, lock, flags,
+ ~WRITE_SPLIT_INDEX_EXTENSION);
goto out;
}
ret = write_shared_index(istate, &temp, flags);
@@ -3539,7 +3523,8 @@ void *read_blob_data_from_index(struct index_state *istate,
}
if (pos < 0)
return NULL;
- data = read_object_file(&istate->cache[pos]->oid, &type, &sz);
+ data = repo_read_object_file(the_repository, &istate->cache[pos]->oid,
+ &type, &sz);
if (!data || type != OBJ_BLOB) {
free(data);
return NULL;
diff --git a/rebase-interactive.c b/rebase-interactive.c
index 7407c59319..852a331318 100644
--- a/rebase-interactive.c
+++ b/rebase-interactive.c
@@ -1,11 +1,17 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "commit.h"
+#include "editor.h"
+#include "environment.h"
+#include "gettext.h"
#include "sequencer.h"
#include "rebase-interactive.h"
+#include "repository.h"
#include "strbuf.h"
#include "commit-slab.h"
#include "config.h"
#include "dir.h"
+#include "object-name.h"
+#include "wrapper.h"
static const char edit_todo_list_advice[] =
N_("You can fix this with 'git rebase --edit-todo' "
@@ -187,7 +193,7 @@ int todo_list_check(struct todo_list *old_todo, struct todo_list *new_todo)
struct commit *commit = item->commit;
if (commit && !*commit_seen_at(&commit_seen, commit)) {
strbuf_addf(&missing, " - %s %.*s\n",
- find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV),
+ repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV),
item->arg_len,
todo_item_get_arg(old_todo, item));
*commit_seen_at(&commit_seen, commit) = 1;
diff --git a/rebase.c b/rebase.c
index 6775cddb28..17a570f1ff 100644
--- a/rebase.c
+++ b/rebase.c
@@ -1,3 +1,4 @@
+#include "git-compat-util.h"
#include "rebase.h"
#include "config.h"
#include "gettext.h"
diff --git a/ref-filter.c b/ref-filter.c
index 914908fac5..4991cd4f7a 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1,9 +1,15 @@
-#include "builtin.h"
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
+#include "environment.h"
+#include "gettext.h"
+#include "gpg-interface.h"
+#include "hex.h"
#include "parse-options.h"
#include "refs.h"
#include "wildmatch.h"
+#include "object-name.h"
#include "object-store.h"
+#include "oid-array.h"
#include "repository.h"
#include "commit.h"
#include "remote.h"
@@ -13,8 +19,8 @@
#include "ref-filter.h"
#include "revision.h"
#include "utf8.h"
-#include "git-compat-util.h"
#include "version.h"
+#include "versioncmp.h"
#include "trailer.h"
#include "wt-status.h"
#include "commit-slab.h"
@@ -158,6 +164,7 @@ enum atom_type {
ATOM_THEN,
ATOM_ELSE,
ATOM_REST,
+ ATOM_AHEADBEHIND,
};
/*
@@ -228,6 +235,22 @@ static int strbuf_addf_ret(struct strbuf *sb, int ret, const char *fmt, ...)
return ret;
}
+static int err_no_arg(struct strbuf *sb, const char *name)
+{
+ size_t namelen = strchrnul(name, ':') - name;
+ strbuf_addf(sb, _("%%(%.*s) does not take arguments"),
+ (int)namelen, name);
+ return -1;
+}
+
+static int err_bad_arg(struct strbuf *sb, const char *name, const char *arg)
+{
+ size_t namelen = strchrnul(name, ':') - name;
+ strbuf_addf(sb, _("unrecognized %%(%.*s) argument: %s"),
+ (int)namelen, name, arg);
+ return -1;
+}
+
static int color_atom_parser(struct ref_format *format, struct used_atom *atom,
const char *color_value, struct strbuf *err)
{
@@ -262,11 +285,12 @@ static int refname_atom_parser_internal(struct refname_atom *atom, const char *a
if (strtol_i(arg, 10, &atom->rstrip))
return strbuf_addf_ret(err, -1, _("Integer value expected refname:rstrip=%s"), arg);
} else
- return strbuf_addf_ret(err, -1, _("unrecognized %%(%s) argument: %s"), name, arg);
+ return err_bad_arg(err, name, arg);
return 0;
}
-static int remote_ref_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int remote_ref_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
const char *arg, struct strbuf *err)
{
struct string_list params = STRING_LIST_INIT_DUP;
@@ -313,11 +337,12 @@ static int remote_ref_atom_parser(struct ref_format *format, struct used_atom *a
return 0;
}
-static int objecttype_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int objecttype_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (arg)
- return strbuf_addf_ret(err, -1, _("%%(objecttype) does not take arguments"));
+ return err_no_arg(err, "objecttype");
if (*atom->name == '*')
oi_deref.info.typep = &oi_deref.type;
else
@@ -325,7 +350,8 @@ static int objecttype_atom_parser(struct ref_format *format, struct used_atom *a
return 0;
}
-static int objectsize_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int objectsize_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (!arg) {
@@ -341,15 +367,16 @@ static int objectsize_atom_parser(struct ref_format *format, struct used_atom *a
else
oi.info.disk_sizep = &oi.disk_size;
} else
- return strbuf_addf_ret(err, -1, _("unrecognized %%(%s) argument: %s"), "objectsize", arg);
+ return err_bad_arg(err, "objectsize", arg);
return 0;
}
-static int deltabase_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int deltabase_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (arg)
- return strbuf_addf_ret(err, -1, _("%%(deltabase) does not take arguments"));
+ return err_no_arg(err, "deltabase");
if (*atom->name == '*')
oi_deref.info.delta_base_oid = &oi_deref.delta_base_oid;
else
@@ -357,16 +384,18 @@ static int deltabase_atom_parser(struct ref_format *format, struct used_atom *at
return 0;
}
-static int body_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int body_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (arg)
- return strbuf_addf_ret(err, -1, _("%%(body) does not take arguments"));
+ return err_no_arg(err, "body");
atom->u.contents.option = C_BODY_DEP;
return 0;
}
-static int subject_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int subject_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (!arg)
@@ -374,11 +403,12 @@ static int subject_atom_parser(struct ref_format *format, struct used_atom *atom
else if (!strcmp(arg, "sanitize"))
atom->u.contents.option = C_SUB_SANITIZE;
else
- return strbuf_addf_ret(err, -1, _("unrecognized %%(%s) argument: %s"), "subject", arg);
+ return err_bad_arg(err, "subject", arg);
return 0;
}
-static int trailers_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int trailers_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
const char *arg, struct strbuf *err)
{
atom->u.contents.trailer_opts.no_divider = 1;
@@ -428,23 +458,25 @@ static int contents_atom_parser(struct ref_format *format, struct used_atom *ato
if (strtoul_ui(arg, 10, &atom->u.contents.nlines))
return strbuf_addf_ret(err, -1, _("positive value expected contents:lines=%s"), arg);
} else
- return strbuf_addf_ret(err, -1, _("unrecognized %%(%s) argument: %s"), "contents", arg);
+ return err_bad_arg(err, "contents", arg);
return 0;
}
-static int raw_atom_parser(struct ref_format *format, struct used_atom *atom,
- const char *arg, struct strbuf *err)
+static int raw_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
+ const char *arg, struct strbuf *err)
{
if (!arg)
atom->u.raw_data.option = RAW_BARE;
else if (!strcmp(arg, "size"))
atom->u.raw_data.option = RAW_LENGTH;
else
- return strbuf_addf_ret(err, -1, _("unrecognized %%(%s) argument: %s"), "raw", arg);
+ return err_bad_arg(err, "raw", arg);
return 0;
}
-static int oid_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int oid_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (!arg)
@@ -459,11 +491,12 @@ static int oid_atom_parser(struct ref_format *format, struct used_atom *atom,
if (atom->u.oid.length < MINIMUM_ABBREV)
atom->u.oid.length = MINIMUM_ABBREV;
} else
- return strbuf_addf_ret(err, -1, _("unrecognized %%(%s) argument: %s"), atom->name, arg);
+ return err_bad_arg(err, atom->name, arg);
return 0;
}
-static int person_email_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int person_email_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (!arg)
@@ -473,11 +506,12 @@ static int person_email_atom_parser(struct ref_format *format, struct used_atom
else if (!strcmp(arg, "localpart"))
atom->u.email_option.option = EO_LOCALPART;
else
- return strbuf_addf_ret(err, -1, _("unrecognized email option: %s"), arg);
+ return err_bad_arg(err, atom->name, arg);
return 0;
}
-static int refname_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int refname_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
const char *arg, struct strbuf *err)
{
return refname_atom_parser_internal(&atom->u.refname, arg, atom->name, err);
@@ -494,7 +528,8 @@ static align_type parse_align_position(const char *s)
return -1;
}
-static int align_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int align_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
const char *arg, struct strbuf *err)
{
struct align *align = &atom->u.align;
@@ -546,7 +581,8 @@ static int align_atom_parser(struct ref_format *format, struct used_atom *atom,
return 0;
}
-static int if_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int if_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (!arg) {
@@ -557,22 +593,41 @@ static int if_atom_parser(struct ref_format *format, struct used_atom *atom,
} else if (skip_prefix(arg, "notequals=", &atom->u.if_then_else.str)) {
atom->u.if_then_else.cmp_status = COMPARE_UNEQUAL;
} else
- return strbuf_addf_ret(err, -1, _("unrecognized %%(%s) argument: %s"), "if", arg);
+ return err_bad_arg(err, "if", arg);
return 0;
}
-static int rest_atom_parser(struct ref_format *format, struct used_atom *atom,
+static int rest_atom_parser(struct ref_format *format,
+ struct used_atom *atom UNUSED,
const char *arg, struct strbuf *err)
{
if (arg)
- return strbuf_addf_ret(err, -1, _("%%(rest) does not take arguments"));
- format->use_rest = 1;
+ return err_no_arg(err, "rest");
return 0;
}
-static int head_atom_parser(struct ref_format *format, struct used_atom *atom,
- const char *arg, struct strbuf *unused_err)
+static int ahead_behind_atom_parser(struct ref_format *format, struct used_atom *atom,
+ const char *arg, struct strbuf *err)
+{
+ struct string_list_item *item;
+
+ if (!arg)
+ return strbuf_addf_ret(err, -1, _("expected format: %%(ahead-behind:<committish>)"));
+
+ item = string_list_append(&format->bases, arg);
+ item->util = lookup_commit_reference_by_name(arg);
+ if (!item->util)
+ die("failed to find '%s'", arg);
+
+ return 0;
+}
+
+static int head_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
+ const char *arg, struct strbuf *err)
{
+ if (arg)
+ return err_no_arg(err, "HEAD");
atom->u.head = resolve_refdup("HEAD", RESOLVE_REF_READING, NULL, NULL);
return 0;
}
@@ -627,6 +682,7 @@ static struct {
[ATOM_THEN] = { "then", SOURCE_NONE },
[ATOM_ELSE] = { "else", SOURCE_NONE },
[ATOM_REST] = { "rest", SOURCE_NONE, FIELD_STR, rest_atom_parser },
+ [ATOM_AHEADBEHIND] = { "ahead-behind", SOURCE_OTHER, FIELD_STR, ahead_behind_atom_parser },
/*
* Please update $__git_ref_fieldlist in git-completion.bash
* when you add new atoms
@@ -773,7 +829,7 @@ static void quote_formatting(struct strbuf *s, const char *str, ssize_t len, int
}
static int append_atom(struct atom_value *v, struct ref_formatting_state *state,
- struct strbuf *unused_err)
+ struct strbuf *err UNUSED)
{
/*
* Quote formatting is only done when the stack has a single
@@ -823,7 +879,7 @@ static void end_align_handler(struct ref_formatting_stack **stack)
}
static int align_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,
- struct strbuf *unused_err)
+ struct strbuf *err UNUSED)
{
struct ref_formatting_stack *new_stack;
@@ -870,7 +926,7 @@ static void if_then_else_handler(struct ref_formatting_stack **stack)
}
static int if_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,
- struct strbuf *unused_err)
+ struct strbuf *err UNUSED)
{
struct ref_formatting_stack *new_stack;
struct if_then_else *if_then_else = xcalloc(1,
@@ -897,7 +953,8 @@ static int is_empty(struct strbuf *buf)
return cur == end;
}
-static int then_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,
+static int then_atom_handler(struct atom_value *atomv UNUSED,
+ struct ref_formatting_state *state,
struct strbuf *err)
{
struct ref_formatting_stack *cur = state->stack;
@@ -934,7 +991,8 @@ static int then_atom_handler(struct atom_value *atomv, struct ref_formatting_sta
return 0;
}
-static int else_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,
+static int else_atom_handler(struct atom_value *atomv UNUSED,
+ struct ref_formatting_state *state,
struct strbuf *err)
{
struct ref_formatting_stack *prev = state->stack;
@@ -955,7 +1013,8 @@ static int else_atom_handler(struct atom_value *atomv, struct ref_formatting_sta
return 0;
}
-static int end_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,
+static int end_atom_handler(struct atom_value *atomv UNUSED,
+ struct ref_formatting_state *state,
struct strbuf *err)
{
struct ref_formatting_stack *current = state->stack;
@@ -1057,9 +1116,11 @@ static const char *do_grab_oid(const char *field, const struct object_id *oid,
case O_FULL:
return oid_to_hex(oid);
case O_LENGTH:
- return find_unique_abbrev(oid, atom->u.oid.length);
+ return repo_find_unique_abbrev(the_repository, oid,
+ atom->u.oid.length);
case O_SHORT:
- return find_unique_abbrev(oid, DEFAULT_ABBREV);
+ return repo_find_unique_abbrev(the_repository, oid,
+ DEFAULT_ABBREV);
default:
BUG("unknown %%(%s) option", field);
}
@@ -1191,7 +1252,7 @@ static const char *copy_name(const char *buf)
{
const char *cp;
for (cp = buf; *cp && *cp != '\n'; cp++) {
- if (!strncmp(cp, " <", 2))
+ if (starts_with(cp, " <"))
return xmemdupz(buf, cp - buf);
}
return xstrdup("");
@@ -1358,6 +1419,7 @@ static void find_subpos(const char *buf,
/* parse signature first; we might not even have a subject line */
parse_signature(buf, end - buf, &payload, &signature);
+ strbuf_release(&payload);
/* skip past header until we hit empty line */
while (*buf && *buf != '\n') {
@@ -1375,12 +1437,12 @@ static void find_subpos(const char *buf,
/* subject is first non-empty line */
*sub = buf;
/* subject goes to first empty line before signature begins */
- if ((eol = strstr(*sub, "\n\n"))) {
+ if ((eol = strstr(*sub, "\n\n")) ||
+ (eol = strstr(*sub, "\r\n\r\n"))) {
eol = eol < sigstart ? eol : sigstart;
- /* check if message uses CRLF */
- } else if (! (eol = strstr(*sub, "\r\n\r\n"))) {
+ } else {
/* treat whole message as subject */
- eol = strrchr(*sub, '\0');
+ eol = sigstart;
}
buf = eol;
*sublen = buf - *sub;
@@ -1803,7 +1865,7 @@ static void lazy_init_worktree_map(void)
populate_worktree_map(&(ref_to_worktree_map.map), ref_to_worktree_map.worktrees);
}
-static char *get_worktree_path(const struct used_atom *atom, const struct ref_array_item *ref)
+static char *get_worktree_path(const struct ref_array_item *ref)
{
struct hashmap_entry entry, *e;
struct ref_to_worktree_entry *lookup_result;
@@ -1829,6 +1891,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
struct object *obj;
int i;
struct object_info empty = OBJECT_INFO_INIT;
+ int ahead_behind_atoms = 0;
CALLOC_ARRAY(ref->value, used_atom_cnt);
@@ -1862,7 +1925,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
refname = get_refname(atom, ref);
else if (atom_type == ATOM_WORKTREEPATH) {
if (ref->kind == FILTER_REFS_BRANCHES)
- v->s = get_worktree_path(atom, ref);
+ v->s = get_worktree_path(ref);
else
v->s = xstrdup("");
continue;
@@ -1959,6 +2022,16 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
else
v->s = xstrdup("");
continue;
+ } else if (atom_type == ATOM_AHEADBEHIND) {
+ if (ref->counts) {
+ const struct ahead_behind_count *count;
+ count = ref->counts[ahead_behind_atoms++];
+ v->s = xstrfmt("%d %d", count->ahead, count->behind);
+ } else {
+ /* Not a commit. */
+ v->s = xstrdup("");
+ }
+ continue;
} else
continue;
@@ -2128,8 +2201,9 @@ static int for_each_fullref_in_pattern(struct ref_filter *filter,
return for_each_fullref_in("", cb, cb_data);
}
- return for_each_fullref_in_prefixes(NULL, filter->name_patterns,
- cb, cb_data);
+ return refs_for_each_fullref_in_prefixes(get_main_ref_store(the_repository),
+ NULL, filter->name_patterns,
+ cb, cb_data);
}
/*
@@ -2308,6 +2382,7 @@ static void free_array_item(struct ref_array_item *item)
free((char *)item->value[i].s);
free(item->value);
}
+ free(item->counts);
free(item);
}
@@ -2336,6 +2411,8 @@ void ref_array_clear(struct ref_array *array)
free_worktrees(ref_to_worktree_map.worktrees);
ref_to_worktree_map.worktrees = NULL;
}
+
+ FREE_AND_NULL(array->counts);
}
#define EXCLUDE_REACHED 0
@@ -2344,33 +2421,22 @@ static void reach_filter(struct ref_array *array,
struct commit_list *check_reachable,
int include_reached)
{
- struct rev_info revs;
int i, old_nr;
struct commit **to_clear;
- struct commit_list *cr;
if (!check_reachable)
return;
CALLOC_ARRAY(to_clear, array->nr);
-
- repo_init_revisions(the_repository, &revs, NULL);
-
for (i = 0; i < array->nr; i++) {
struct ref_array_item *item = array->items[i];
- add_pending_object(&revs, &item->commit->object, item->refname);
to_clear[i] = item->commit;
}
- for (cr = check_reachable; cr; cr = cr->next) {
- struct commit *merge_commit = cr->item;
- merge_commit->object.flags |= UNINTERESTING;
- add_pending_object(&revs, &merge_commit->object, "");
- }
-
- revs.limited = 1;
- if (prepare_revision_walk(&revs))
- die(_("revision walk setup failed"));
+ tips_reachable_from_bases(the_repository,
+ check_reachable,
+ to_clear, array->nr,
+ UNINTERESTING);
old_nr = array->nr;
array->nr = 0;
@@ -2394,10 +2460,50 @@ static void reach_filter(struct ref_array *array,
clear_commit_marks(merge_commit, ALL_REV_FLAGS);
}
- release_revisions(&revs);
free(to_clear);
}
+void filter_ahead_behind(struct repository *r,
+ struct ref_format *format,
+ struct ref_array *array)
+{
+ struct commit **commits;
+ size_t commits_nr = format->bases.nr + array->nr;
+
+ if (!format->bases.nr || !array->nr)
+ return;
+
+ ALLOC_ARRAY(commits, commits_nr);
+ for (size_t i = 0; i < format->bases.nr; i++)
+ commits[i] = format->bases.items[i].util;
+
+ ALLOC_ARRAY(array->counts, st_mult(format->bases.nr, array->nr));
+
+ commits_nr = format->bases.nr;
+ array->counts_nr = 0;
+ for (size_t i = 0; i < array->nr; i++) {
+ const char *name = array->items[i]->refname;
+ commits[commits_nr] = lookup_commit_reference_by_name(name);
+
+ if (!commits[commits_nr])
+ continue;
+
+ CALLOC_ARRAY(array->items[i]->counts, format->bases.nr);
+ for (size_t j = 0; j < format->bases.nr; j++) {
+ struct ahead_behind_count *count;
+ count = &array->counts[array->counts_nr++];
+ count->tip_index = commits_nr;
+ count->base_index = j;
+
+ array->items[i]->counts[j] = count;
+ }
+ commits_nr++;
+ }
+
+ ahead_behind(r, commits, commits_nr, array->counts, array->counts_nr);
+ free(commits);
+}
+
/*
* API for filtering a set of refs. Based on the type of refs the user
* has requested, we iterate through those refs and apply filters
@@ -2745,7 +2851,7 @@ int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset)
BUG_ON_OPT_NEG(unset);
- if (get_oid(arg, &oid))
+ if (repo_get_oid(the_repository, arg, &oid))
die(_("malformed object name %s"), arg);
merge_commit = lookup_commit_reference_gently(the_repository, &oid, 0);
diff --git a/ref-filter.h b/ref-filter.h
index aa0eea4ecf..430701cfb7 100644
--- a/ref-filter.h
+++ b/ref-filter.h
@@ -1,10 +1,11 @@
#ifndef REF_FILTER_H
#define REF_FILTER_H
+#include "gettext.h"
#include "oid-array.h"
#include "refs.h"
#include "commit.h"
-#include "parse-options.h"
+#include "string-list.h"
/* Quoting styles */
#define QUOTE_NONE 0
@@ -24,6 +25,8 @@
struct atom_value;
struct ref_sorting;
+struct ahead_behind_count;
+struct option;
enum ref_sorting_order {
REF_SORTING_REVERSE = 1<<0,
@@ -40,6 +43,8 @@ struct ref_array_item {
const char *symref;
struct commit *commit;
struct atom_value *value;
+ struct ahead_behind_count **counts;
+
char refname[FLEX_ARRAY];
};
@@ -47,6 +52,9 @@ struct ref_array {
int nr, alloc;
struct ref_array_item **items;
struct rev_info *revs;
+
+ struct ahead_behind_count *counts;
+ size_t counts_nr;
};
struct ref_filter {
@@ -75,14 +83,19 @@ struct ref_format {
const char *format;
const char *rest;
int quote_style;
- int use_rest;
int use_color;
/* Internal state to ref-filter */
int need_color_reset_at_eol;
+
+ /* List of bases for ahead-behind counts. */
+ struct string_list bases;
};
-#define REF_FORMAT_INIT { .use_color = -1 }
+#define REF_FORMAT_INIT { \
+ .use_color = -1, \
+ .bases = STRING_LIST_INIT_DUP, \
+}
/* Macros for checking --merged and --no-merged options */
#define _OPT_MERGED_NO_MERGED(option, filter, h) \
@@ -143,4 +156,15 @@ struct ref_array_item *ref_array_push(struct ref_array *array,
const char *refname,
const struct object_id *oid);
+/*
+ * If the provided format includes ahead-behind atoms, then compute the
+ * ahead-behind values for the array of filtered references. Must be
+ * called after filter_refs() but before outputting the formatted refs.
+ *
+ * If this is not called, then any ahead-behind atoms will be blank.
+ */
+void filter_ahead_behind(struct repository *r,
+ struct ref_format *format,
+ struct ref_array *array);
+
#endif /* REF_FILTER_H */
diff --git a/reflog-walk.c b/reflog-walk.c
index 7aa6595a51..4ba1a10c82 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "commit.h"
#include "refs.h"
#include "diff.h"
@@ -55,7 +56,7 @@ static void free_complete_reflog(struct complete_reflogs *array)
free(array);
}
-static void complete_reflogs_clear(void *util, const char *str)
+static void complete_reflogs_clear(void *util, const char *str UNUSED)
{
struct complete_reflogs *array = util;
free_complete_reflog(array);
diff --git a/reflog-walk.h b/reflog-walk.h
index 8076f10d9f..4d93a26957 100644
--- a/reflog-walk.h
+++ b/reflog-walk.h
@@ -1,8 +1,6 @@
#ifndef REFLOG_WALK_H
#define REFLOG_WALK_H
-#include "cache.h"
-
struct commit;
struct reflog_walk_info;
struct date_mode;
diff --git a/reflog.c b/reflog.c
index d258fd3199..ee1bf5d032 100644
--- a/reflog.c
+++ b/reflog.c
@@ -1,8 +1,11 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
#include "object-store.h"
#include "reflog.h"
#include "refs.h"
#include "revision.h"
+#include "tree.h"
+#include "tree-walk.h"
#include "worktree.h"
/* Remember to update object flag allocation in object.h */
@@ -28,7 +31,8 @@ static int tree_is_complete(const struct object_id *oid)
if (!tree->buffer) {
enum object_type type;
unsigned long size;
- void *data = read_object_file(oid, &type, &size);
+ void *data = repo_read_object_file(the_repository, oid, &type,
+ &size);
if (!data) {
tree->object.flags |= INCOMPLETE;
return 0;
@@ -39,7 +43,7 @@ static int tree_is_complete(const struct object_id *oid)
init_tree_desc(&desc, tree->buffer, tree->size);
complete = 1;
while (tree_entry(&desc, &entry)) {
- if (!has_object_file(&entry.oid) ||
+ if (!repo_has_object_file(the_repository, &entry.oid) ||
(S_ISDIR(entry.mode) && !tree_is_complete(&entry.oid))) {
tree->object.flags |= INCOMPLETE;
complete = 0;
@@ -186,14 +190,13 @@ static void mark_reachable(struct expire_reflog_policy_cb *cb)
struct commit *commit = pop_commit(&pending);
if (commit->object.flags & REACHABLE)
continue;
- if (parse_commit(commit))
+ if (repo_parse_commit(the_repository, commit))
continue;
commit->object.flags |= REACHABLE;
if (commit->date < expire_limit) {
commit_list_insert(commit, &leftover);
continue;
}
- commit->object.flags |= REACHABLE;
parent = commit->parents;
while (parent) {
commit = parent->item;
@@ -312,16 +315,9 @@ static int push_tip_to_list(const char *refname UNUSED,
static int is_head(const char *refname)
{
- switch (ref_type(refname)) {
- case REF_TYPE_OTHER_PSEUDOREF:
- case REF_TYPE_MAIN_PSEUDOREF:
- if (parse_worktree_ref(refname, NULL, NULL, &refname))
- BUG("not a worktree ref: %s", refname);
- break;
- default:
- break;
- }
- return !strcmp(refname, "HEAD");
+ const char *stripped_refname;
+ parse_worktree_ref(refname, NULL, NULL, &stripped_refname);
+ return !strcmp(stripped_refname, "HEAD");
}
void reflog_expiry_prepare(const char *refname,
@@ -378,6 +374,9 @@ void reflog_expiry_cleanup(void *cb_data)
clear_commit_marks(cb->tip_commit, REACHABLE);
break;
}
+ for (elem = cb->mark_list; elem; elem = elem->next)
+ clear_commit_marks(elem->item, REACHABLE);
+ free_commit_list(cb->mark_list);
}
int count_reflog_ent(struct object_id *ooid UNUSED,
diff --git a/refs.c b/refs.c
index c89d558892..d2a98e1c21 100644
--- a/refs.c
+++ b/refs.c
@@ -2,15 +2,21 @@
* The backend-independent part of the reference module.
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "advice.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
#include "hashmap.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "iterator.h"
#include "refs.h"
#include "refs/refs-internal.h"
#include "run-command.h"
#include "hook.h"
+#include "object-name.h"
#include "object-store.h"
#include "object.h"
#include "tag.h"
@@ -18,9 +24,11 @@
#include "worktree.h"
#include "strvec.h"
#include "repository.h"
+#include "setup.h"
#include "sigchain.h"
#include "date.h"
#include "commit.h"
+#include "wrapper.h"
/*
* List of all available backends
@@ -811,7 +819,7 @@ int dwim_log(const char *str, int len, struct object_id *oid, char **log)
return repo_dwim_log(the_repository, str, len, oid, log);
}
-static int is_per_worktree_ref(const char *refname)
+int is_per_worktree_ref(const char *refname)
{
return starts_with(refname, "refs/worktree/") ||
starts_with(refname, "refs/bisect/") ||
@@ -827,37 +835,63 @@ static int is_pseudoref_syntax(const char *refname)
return 0;
}
+ /*
+ * HEAD is not a pseudoref, but it certainly uses the
+ * pseudoref syntax.
+ */
return 1;
}
-static int is_main_pseudoref_syntax(const char *refname)
-{
- return skip_prefix(refname, "main-worktree/", &refname) &&
- *refname &&
- is_pseudoref_syntax(refname);
+static int is_current_worktree_ref(const char *ref) {
+ return is_pseudoref_syntax(ref) || is_per_worktree_ref(ref);
}
-static int is_other_pseudoref_syntax(const char *refname)
+enum ref_worktree_type parse_worktree_ref(const char *maybe_worktree_ref,
+ const char **worktree_name, int *worktree_name_length,
+ const char **bare_refname)
{
- if (!skip_prefix(refname, "worktrees/", &refname))
- return 0;
- refname = strchr(refname, '/');
- if (!refname || !refname[1])
- return 0;
- return is_pseudoref_syntax(refname + 1);
-}
+ const char *name_dummy;
+ int name_length_dummy;
+ const char *ref_dummy;
-enum ref_type ref_type(const char *refname)
-{
- if (is_per_worktree_ref(refname))
- return REF_TYPE_PER_WORKTREE;
- if (is_pseudoref_syntax(refname))
- return REF_TYPE_PSEUDOREF;
- if (is_main_pseudoref_syntax(refname))
- return REF_TYPE_MAIN_PSEUDOREF;
- if (is_other_pseudoref_syntax(refname))
- return REF_TYPE_OTHER_PSEUDOREF;
- return REF_TYPE_NORMAL;
+ if (!worktree_name)
+ worktree_name = &name_dummy;
+ if (!worktree_name_length)
+ worktree_name_length = &name_length_dummy;
+ if (!bare_refname)
+ bare_refname = &ref_dummy;
+
+ if (skip_prefix(maybe_worktree_ref, "worktrees/", bare_refname)) {
+ const char *slash = strchr(*bare_refname, '/');
+
+ *worktree_name = *bare_refname;
+ if (!slash) {
+ *worktree_name_length = strlen(*worktree_name);
+
+ /* This is an error condition, and the caller tell because the bare_refname is "" */
+ *bare_refname = *worktree_name + *worktree_name_length;
+ return REF_WORKTREE_OTHER;
+ }
+
+ *worktree_name_length = slash - *bare_refname;
+ *bare_refname = slash + 1;
+
+ if (is_current_worktree_ref(*bare_refname))
+ return REF_WORKTREE_OTHER;
+ }
+
+ *worktree_name = NULL;
+ *worktree_name_length = 0;
+
+ if (skip_prefix(maybe_worktree_ref, "main-worktree/", bare_refname)
+ && is_current_worktree_ref(*bare_refname))
+ return REF_WORKTREE_MAIN;
+
+ *bare_refname = maybe_worktree_ref;
+ if (is_current_worktree_ref(maybe_worktree_ref))
+ return REF_WORKTREE_CURRENT;
+
+ return REF_WORKTREE_SHARED;
}
long get_files_ref_lock_timeout_ms(void)
@@ -1284,65 +1318,68 @@ int update_ref(const char *msg, const char *refname,
old_oid, flags, onerr);
}
+/*
+ * Check that the string refname matches a rule of the form
+ * "{prefix}%.*s{suffix}". So "foo/bar/baz" would match the rule
+ * "foo/%.*s/baz", and return the string "bar".
+ */
+static const char *match_parse_rule(const char *refname, const char *rule,
+ size_t *len)
+{
+ /*
+ * Check that rule matches refname up to the first percent in the rule.
+ * We can bail immediately if not, but otherwise we leave "rule" at the
+ * %-placeholder, and "refname" at the start of the potential matched
+ * name.
+ */
+ while (*rule != '%') {
+ if (!*rule)
+ BUG("rev-parse rule did not have percent");
+ if (*refname++ != *rule++)
+ return NULL;
+ }
+
+ /*
+ * Check that our "%" is the expected placeholder. This assumes there
+ * are no other percents (placeholder or quoted) in the string, but
+ * that is sufficient for our rev-parse rules.
+ */
+ if (!skip_prefix(rule, "%.*s", &rule))
+ return NULL;
+
+ /*
+ * And now check that our suffix (if any) matches.
+ */
+ if (!strip_suffix(refname, rule, len))
+ return NULL;
+
+ return refname; /* len set by strip_suffix() */
+}
+
char *refs_shorten_unambiguous_ref(struct ref_store *refs,
const char *refname, int strict)
{
int i;
- static char **scanf_fmts;
- static int nr_rules;
- char *short_name;
struct strbuf resolved_buf = STRBUF_INIT;
- if (!nr_rules) {
- /*
- * Pre-generate scanf formats from ref_rev_parse_rules[].
- * Generate a format suitable for scanf from a
- * ref_rev_parse_rules rule by interpolating "%s" at the
- * location of the "%.*s".
- */
- size_t total_len = 0;
- size_t offset = 0;
-
- /* the rule list is NULL terminated, count them first */
- for (nr_rules = 0; ref_rev_parse_rules[nr_rules]; nr_rules++)
- /* -2 for strlen("%.*s") - strlen("%s"); +1 for NUL */
- total_len += strlen(ref_rev_parse_rules[nr_rules]) - 2 + 1;
-
- scanf_fmts = xmalloc(st_add(st_mult(sizeof(char *), nr_rules), total_len));
-
- offset = 0;
- for (i = 0; i < nr_rules; i++) {
- assert(offset < total_len);
- scanf_fmts[i] = (char *)&scanf_fmts[nr_rules] + offset;
- offset += xsnprintf(scanf_fmts[i], total_len - offset,
- ref_rev_parse_rules[i], 2, "%s") + 1;
- }
- }
-
- /* bail out if there are no rules */
- if (!nr_rules)
- return xstrdup(refname);
-
- /* buffer for scanf result, at most refname must fit */
- short_name = xstrdup(refname);
-
/* skip first rule, it will always match */
- for (i = nr_rules - 1; i > 0 ; --i) {
+ for (i = NUM_REV_PARSE_RULES - 1; i > 0 ; --i) {
int j;
int rules_to_fail = i;
- int short_name_len;
+ const char *short_name;
+ size_t short_name_len;
- if (1 != sscanf(refname, scanf_fmts[i], short_name))
+ short_name = match_parse_rule(refname, ref_rev_parse_rules[i],
+ &short_name_len);
+ if (!short_name)
continue;
- short_name_len = strlen(short_name);
-
/*
* in strict mode, all (except the matched one) rules
* must fail to resolve to a valid non-ambiguous ref
*/
if (strict)
- rules_to_fail = nr_rules;
+ rules_to_fail = NUM_REV_PARSE_RULES;
/*
* check if the short name resolves to a valid ref,
@@ -1362,7 +1399,8 @@ char *refs_shorten_unambiguous_ref(struct ref_store *refs,
*/
strbuf_reset(&resolved_buf);
strbuf_addf(&resolved_buf, rule,
- short_name_len, short_name);
+ cast_size_t_to_int(short_name_len),
+ short_name);
if (refs_ref_exists(refs, resolved_buf.buf))
break;
}
@@ -1373,12 +1411,11 @@ char *refs_shorten_unambiguous_ref(struct ref_store *refs,
*/
if (j == rules_to_fail) {
strbuf_release(&resolved_buf);
- return short_name;
+ return xmemdupz(short_name, short_name_len);
}
}
strbuf_release(&resolved_buf);
- free(short_name);
return xstrdup(refname);
}
@@ -1388,9 +1425,8 @@ char *shorten_unambiguous_ref(const char *refname, int strict)
refname, strict);
}
-static struct string_list *hide_refs;
-
-int parse_hide_refs_config(const char *var, const char *value, const char *section)
+int parse_hide_refs_config(const char *var, const char *value, const char *section,
+ struct string_list *hide_refs)
{
const char *key;
if (!strcmp("transfer.hiderefs", var) ||
@@ -1405,21 +1441,16 @@ int parse_hide_refs_config(const char *var, const char *value, const char *secti
len = strlen(ref);
while (len && ref[len - 1] == '/')
ref[--len] = '\0';
- if (!hide_refs) {
- CALLOC_ARRAY(hide_refs, 1);
- hide_refs->strdup_strings = 1;
- }
- string_list_append(hide_refs, ref);
+ string_list_append_nodup(hide_refs, ref);
}
return 0;
}
-int ref_is_hidden(const char *refname, const char *refname_full)
+int ref_is_hidden(const char *refname, const char *refname_full,
+ const struct string_list *hide_refs)
{
int i;
- if (!hide_refs)
- return 0;
for (i = hide_refs->nr - 1; i >= 0; i--) {
const char *match = hide_refs->items[i].string;
const char *subject;
@@ -1703,9 +1734,10 @@ static void find_longest_prefixes(struct string_list *out,
strbuf_release(&prefix);
}
-int for_each_fullref_in_prefixes(const char *namespace,
- const char **patterns,
- each_ref_fn fn, void *cb_data)
+int refs_for_each_fullref_in_prefixes(struct ref_store *ref_store,
+ const char *namespace,
+ const char **patterns,
+ each_ref_fn fn, void *cb_data)
{
struct string_list prefixes = STRING_LIST_INIT_DUP;
struct string_list_item *prefix;
@@ -1720,7 +1752,7 @@ int for_each_fullref_in_prefixes(const char *namespace,
for_each_string_list_item(prefix, &prefixes) {
strbuf_addstr(&buf, prefix->string);
- ret = for_each_fullref_in(buf.buf, fn, cb_data);
+ ret = refs_for_each_fullref_in(ref_store, buf.buf, fn, cb_data);
if (ret)
break;
strbuf_setlen(&buf, namespace_len);
@@ -1797,7 +1829,7 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs,
return NULL;
/*
- * dwim_ref() uses REF_ISBROKEN to distinguish between
+ * repo_dwim_ref() uses REF_ISBROKEN to distinguish between
* missing refs and refs that were present but invalid,
* to complain about the latter to stderr.
*
diff --git a/refs.h b/refs.h
index d6575b8c2b..123cfa4424 100644
--- a/refs.h
+++ b/refs.h
@@ -1,7 +1,6 @@
#ifndef REFS_H
#define REFS_H
-#include "cache.h"
#include "commit.h"
struct object_id;
@@ -159,12 +158,6 @@ int expand_ref(struct repository *r, const char *str, int len, struct object_id
int repo_dwim_ref(struct repository *r, const char *str, int len,
struct object_id *oid, char **ref, int nonfatal_dangling_mark);
int repo_dwim_log(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
-static inline int dwim_ref(const char *str, int len, struct object_id *oid,
- char **ref, int nonfatal_dangling_mark)
-{
- return repo_dwim_ref(the_repository, str, len, oid, ref,
- nonfatal_dangling_mark);
-}
int dwim_log(const char *str, int len, struct object_id *oid, char **ref);
/*
@@ -354,8 +347,10 @@ int for_each_fullref_in(const char *prefix, each_ref_fn fn, void *cb_data);
*
* callers should be prepared to ignore references that they did not ask for.
*/
-int for_each_fullref_in_prefixes(const char *namespace, const char **patterns,
- each_ref_fn fn, void *cb_data);
+int refs_for_each_fullref_in_prefixes(struct ref_store *refs,
+ const char *namespace, const char **patterns,
+ each_ref_fn fn, void *cb_data);
+
/**
* iterate refs from the respective area.
*/
@@ -808,7 +803,8 @@ int update_ref(const char *msg, const char *refname,
const struct object_id *new_oid, const struct object_id *old_oid,
unsigned int flags, enum action_on_err onerr);
-int parse_hide_refs_config(const char *var, const char *value, const char *);
+int parse_hide_refs_config(const char *var, const char *value, const char *,
+ struct string_list *);
/*
* Check whether a ref is hidden. If no namespace is set, both the first and
@@ -818,17 +814,36 @@ int parse_hide_refs_config(const char *var, const char *value, const char *);
* the ref is outside that namespace, the first parameter is NULL. The second
* parameter always points to the full ref name.
*/
-int ref_is_hidden(const char *, const char *);
+int ref_is_hidden(const char *, const char *, const struct string_list *);
-enum ref_type {
- REF_TYPE_PER_WORKTREE, /* refs inside refs/ but not shared */
- REF_TYPE_PSEUDOREF, /* refs outside refs/ in current worktree */
- REF_TYPE_MAIN_PSEUDOREF, /* pseudo refs from the main worktree */
- REF_TYPE_OTHER_PSEUDOREF, /* pseudo refs from other worktrees */
- REF_TYPE_NORMAL, /* normal/shared refs inside refs/ */
+/* Is this a per-worktree ref living in the refs/ namespace? */
+int is_per_worktree_ref(const char *refname);
+
+/* Describes how a refname relates to worktrees */
+enum ref_worktree_type {
+ REF_WORKTREE_CURRENT, /* implicitly per worktree, eg. HEAD or
+ refs/bisect/SOMETHING */
+ REF_WORKTREE_MAIN, /* explicitly in main worktree, eg.
+ main-worktree/HEAD */
+ REF_WORKTREE_OTHER, /* explicitly in named worktree, eg.
+ worktrees/bla/HEAD */
+ REF_WORKTREE_SHARED, /* the default, eg. refs/heads/main */
};
-enum ref_type ref_type(const char *refname);
+/*
+ * Parse a `maybe_worktree_ref` as a ref that possibly refers to a worktree ref
+ * (ie. either REFNAME, main-worktree/REFNAME or worktree/WORKTREE/REFNAME). It
+ * returns what kind of ref was found, and in case of REF_WORKTREE_OTHER, the
+ * worktree name is returned in `worktree_name` (pointing into
+ * `maybe_worktree_ref`) and `worktree_name_length`. The bare refname (the
+ * refname stripped of prefixes) is returned in `bare_refname`. The
+ * `worktree_name`, `worktree_name_length` and `bare_refname` arguments may be
+ * NULL.
+ */
+enum ref_worktree_type parse_worktree_ref(const char *maybe_worktree_ref,
+ const char **worktree_name,
+ int *worktree_name_length,
+ const char **bare_refname);
enum expire_reflog_flags {
EXPIRE_REFLOGS_DRY_RUN = 1 << 0,
diff --git a/refs/debug.c b/refs/debug.c
index eed8bc94b0..6f11e6de46 100644
--- a/refs/debug.c
+++ b/refs/debug.c
@@ -1,5 +1,7 @@
-
+#include "git-compat-util.h"
+#include "hex.h"
#include "refs-internal.h"
+#include "string-list.h"
#include "trace.h"
static struct trace_key trace_refs = TRACE_KEY_INIT(REFS);
diff --git a/refs/files-backend.c b/refs/files-backend.c
index e4009b3c42..bca7b851c5 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1,16 +1,26 @@
#include "../cache.h"
#include "../config.h"
+#include "../copy.h"
+#include "../environment.h"
+#include "../gettext.h"
+#include "../hash.h"
+#include "../hex.h"
#include "../refs.h"
#include "refs-internal.h"
#include "ref-cache.h"
#include "packed-backend.h"
+#include "../ident.h"
#include "../iterator.h"
#include "../dir-iterator.h"
#include "../lockfile.h"
#include "../object.h"
+#include "../object-file.h"
#include "../dir.h"
#include "../chdir-notify.h"
-#include "worktree.h"
+#include "../setup.h"
+#include "../worktree.h"
+#include "../wrapper.h"
+#include "../write-or-die.h"
/*
* This backend uses the following flags in `ref_update::flags` for
@@ -138,44 +148,30 @@ static struct files_ref_store *files_downcast(struct ref_store *ref_store,
return refs;
}
-static void files_reflog_path_other_worktrees(struct files_ref_store *refs,
- struct strbuf *sb,
- const char *refname)
-{
- const char *real_ref;
- const char *worktree_name;
- int length;
-
- if (parse_worktree_ref(refname, &worktree_name, &length, &real_ref))
- BUG("refname %s is not a other-worktree ref", refname);
-
- if (worktree_name)
- strbuf_addf(sb, "%s/worktrees/%.*s/logs/%s", refs->gitcommondir,
- length, worktree_name, real_ref);
- else
- strbuf_addf(sb, "%s/logs/%s", refs->gitcommondir,
- real_ref);
-}
-
static void files_reflog_path(struct files_ref_store *refs,
struct strbuf *sb,
const char *refname)
{
- switch (ref_type(refname)) {
- case REF_TYPE_PER_WORKTREE:
- case REF_TYPE_PSEUDOREF:
+ const char *bare_refname;
+ const char *wtname;
+ int wtname_len;
+ enum ref_worktree_type wt_type = parse_worktree_ref(
+ refname, &wtname, &wtname_len, &bare_refname);
+
+ switch (wt_type) {
+ case REF_WORKTREE_CURRENT:
strbuf_addf(sb, "%s/logs/%s", refs->base.gitdir, refname);
break;
- case REF_TYPE_OTHER_PSEUDOREF:
- case REF_TYPE_MAIN_PSEUDOREF:
- files_reflog_path_other_worktrees(refs, sb, refname);
+ case REF_WORKTREE_SHARED:
+ case REF_WORKTREE_MAIN:
+ strbuf_addf(sb, "%s/logs/%s", refs->gitcommondir, bare_refname);
break;
- case REF_TYPE_NORMAL:
- strbuf_addf(sb, "%s/logs/%s", refs->gitcommondir, refname);
+ case REF_WORKTREE_OTHER:
+ strbuf_addf(sb, "%s/worktrees/%.*s/logs/%s", refs->gitcommondir,
+ wtname_len, wtname, bare_refname);
break;
default:
- BUG("unknown ref type %d of ref %s",
- ref_type(refname), refname);
+ BUG("unknown ref type %d of ref %s", wt_type, refname);
}
}
@@ -183,22 +179,25 @@ static void files_ref_path(struct files_ref_store *refs,
struct strbuf *sb,
const char *refname)
{
- switch (ref_type(refname)) {
- case REF_TYPE_PER_WORKTREE:
- case REF_TYPE_PSEUDOREF:
+ const char *bare_refname;
+ const char *wtname;
+ int wtname_len;
+ enum ref_worktree_type wt_type = parse_worktree_ref(
+ refname, &wtname, &wtname_len, &bare_refname);
+ switch (wt_type) {
+ case REF_WORKTREE_CURRENT:
strbuf_addf(sb, "%s/%s", refs->base.gitdir, refname);
break;
- case REF_TYPE_MAIN_PSEUDOREF:
- if (!skip_prefix(refname, "main-worktree/", &refname))
- BUG("ref %s is not a main pseudoref", refname);
- /* fallthrough */
- case REF_TYPE_OTHER_PSEUDOREF:
- case REF_TYPE_NORMAL:
- strbuf_addf(sb, "%s/%s", refs->gitcommondir, refname);
+ case REF_WORKTREE_OTHER:
+ strbuf_addf(sb, "%s/worktrees/%.*s/%s", refs->gitcommondir,
+ wtname_len, wtname, bare_refname);
+ break;
+ case REF_WORKTREE_SHARED:
+ case REF_WORKTREE_MAIN:
+ strbuf_addf(sb, "%s/%s", refs->gitcommondir, bare_refname);
break;
default:
- BUG("unknown ref type %d of ref %s",
- ref_type(refname), refname);
+ BUG("unknown ref type %d of ref %s", wt_type, refname);
}
}
@@ -771,7 +770,8 @@ static int files_ref_iterator_advance(struct ref_iterator *ref_iterator)
while ((ok = ref_iterator_advance(iter->iter0)) == ITER_OK) {
if (iter->flags & DO_FOR_EACH_PER_WORKTREE_ONLY &&
- ref_type(iter->iter0->refname) != REF_TYPE_PER_WORKTREE)
+ parse_worktree_ref(iter->iter0->refname, NULL, NULL,
+ NULL) != REF_WORKTREE_CURRENT)
continue;
if ((iter->flags & DO_FOR_EACH_OMIT_DANGLING_SYMREFS) &&
@@ -1178,7 +1178,8 @@ static int should_pack_ref(const char *refname,
unsigned int pack_flags)
{
/* Do not pack per-worktree refs: */
- if (ref_type(refname) != REF_TYPE_NORMAL)
+ if (parse_worktree_ref(refname, NULL, NULL, NULL) !=
+ REF_WORKTREE_SHARED)
return 0;
/* Do not pack non-tags unless PACK_REFS_ALL is set: */
@@ -2267,7 +2268,8 @@ static enum iterator_selection reflog_iterator_select(
*/
return ITER_SELECT_0;
} else if (iter_common) {
- if (ref_type(iter_common->refname) == REF_TYPE_NORMAL)
+ if (parse_worktree_ref(iter_common->refname, NULL, NULL,
+ NULL) == REF_WORKTREE_SHARED)
return ITER_SELECT_1;
/*
diff --git a/refs/iterator.c b/refs/iterator.c
index c9fd0bcaf9..6b680f610e 100644
--- a/refs/iterator.c
+++ b/refs/iterator.c
@@ -3,7 +3,7 @@
* documentation about the design and use of reference iterators.
*/
-#include "cache.h"
+#include "git-compat-util.h"
#include "refs.h"
#include "refs/refs-internal.h"
#include "iterator.h"
diff --git a/refs/packed-backend.c b/refs/packed-backend.c
index 43cdb97f8b..5b412a133b 100644
--- a/refs/packed-backend.c
+++ b/refs/packed-backend.c
@@ -1,11 +1,17 @@
#include "../cache.h"
+#include "../alloc.h"
#include "../config.h"
+#include "../gettext.h"
+#include "../hash.h"
+#include "../hex.h"
#include "../refs.h"
#include "refs-internal.h"
#include "packed-backend.h"
#include "../iterator.h"
#include "../lockfile.h"
#include "../chdir-notify.h"
+#include "../wrapper.h"
+#include "../write-or-die.h"
enum mmap_strategy {
/*
@@ -646,7 +652,7 @@ static struct snapshot *create_snapshot(struct packed_ref_store *refs)
snapshot->buf,
snapshot->eof - snapshot->buf);
- string_list_split_in_place(&traits, p, ' ', -1);
+ string_list_split_in_place(&traits, p, " ", -1);
if (unsorted_string_list_has_string(&traits, "fully-peeled"))
snapshot->peeled = PEELED_FULLY;
@@ -862,7 +868,7 @@ static int packed_ref_iterator_advance(struct ref_iterator *ref_iterator)
while ((ok = next_record(iter)) == ITER_OK) {
if (iter->flags & DO_FOR_EACH_PER_WORKTREE_ONLY &&
- ref_type(iter->base.refname) != REF_TYPE_PER_WORKTREE)
+ !is_per_worktree_ref(iter->base.refname))
continue;
if (!(iter->flags & DO_FOR_EACH_INCLUDE_BROKEN) &&
@@ -1263,7 +1269,8 @@ static int write_with_updates(struct packed_ref_store *refs,
goto error;
}
- if (fsync_component(FSYNC_COMPONENT_REFERENCE, get_tempfile_fd(refs->tempfile)) ||
+ if (fflush(out) ||
+ fsync_component(FSYNC_COMPONENT_REFERENCE, get_tempfile_fd(refs->tempfile)) ||
close_tempfile_gently(refs->tempfile)) {
strbuf_addf(err, "error closing file %s: %s",
get_tempfile_path(refs->tempfile),
diff --git a/refs/ref-cache.c b/refs/ref-cache.c
index 32afd8a40b..2294c4564f 100644
--- a/refs/ref-cache.c
+++ b/refs/ref-cache.c
@@ -1,5 +1,8 @@
-#include "../cache.h"
+#include "../git-compat-util.h"
+#include "../alloc.h"
+#include "../hash.h"
#include "../refs.h"
+#include "../repository.h"
#include "refs-internal.h"
#include "ref-cache.h"
#include "../iterator.h"
diff --git a/refs/ref-cache.h b/refs/ref-cache.h
index 850d9d3744..95c76e27c8 100644
--- a/refs/ref-cache.h
+++ b/refs/ref-cache.h
@@ -1,10 +1,11 @@
#ifndef REFS_REF_CACHE_H
#define REFS_REF_CACHE_H
-#include "cache.h"
+#include "hash-ll.h"
struct ref_dir;
struct ref_store;
+struct repository;
/*
* If this ref_cache is filled lazily, this function is used to load
diff --git a/refs/refs-internal.h b/refs/refs-internal.h
index 69f93b0e2a..a85d113123 100644
--- a/refs/refs-internal.h
+++ b/refs/refs-internal.h
@@ -1,7 +1,6 @@
#ifndef REFS_REFS_INTERNAL_H
#define REFS_REFS_INTERNAL_H
-#include "cache.h"
#include "refs.h"
#include "iterator.h"
diff --git a/refspec.c b/refspec.c
index 63e3112104..57f6c2aaf9 100644
--- a/refspec.c
+++ b/refspec.c
@@ -1,7 +1,12 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
+#include "gettext.h"
+#include "hash.h"
+#include "hex.h"
#include "strvec.h"
#include "refs.h"
#include "refspec.h"
+#include "strbuf.h"
static struct refspec_item s_tag_refspec = {
.force = 0,
diff --git a/reftable/dump.c b/reftable/dump.c
index 155953d1b8..ce936b4e18 100644
--- a/reftable/dump.c
+++ b/reftable/dump.c
@@ -7,7 +7,7 @@ https://developers.google.com/open-source/licenses/bsd
*/
#include "git-compat-util.h"
-#include "hash.h"
+#include "hash-ll.h"
#include "reftable-blocksource.h"
#include "reftable-error.h"
diff --git a/reftable/error.c b/reftable/error.c
index 93941f2145..0d1766735e 100644
--- a/reftable/error.c
+++ b/reftable/error.c
@@ -6,6 +6,7 @@ license that can be found in the LICENSE file or at
https://developers.google.com/open-source/licenses/bsd
*/
+#include "system.h"
#include "reftable-error.h"
#include <stdio.h>
diff --git a/reftable/publicbasics.c b/reftable/publicbasics.c
index 0ad7d5c0ff..bcb82530d6 100644
--- a/reftable/publicbasics.c
+++ b/reftable/publicbasics.c
@@ -6,10 +6,10 @@ license that can be found in the LICENSE file or at
https://developers.google.com/open-source/licenses/bsd
*/
+#include "system.h"
#include "reftable-malloc.h"
#include "basics.h"
-#include "system.h"
static void *(*reftable_malloc_ptr)(size_t sz);
static void *(*reftable_realloc_ptr)(void *, size_t);
diff --git a/reftable/system.h b/reftable/system.h
index 18f9207dfe..6b74a81514 100644
--- a/reftable/system.h
+++ b/reftable/system.h
@@ -13,7 +13,7 @@ https://developers.google.com/open-source/licenses/bsd
#include "git-compat-util.h"
#include "strbuf.h"
-#include "hash.h" /* hash ID, sizes.*/
+#include "hash-ll.h" /* hash ID, sizes.*/
#include "dir.h" /* remove_dir_recursively, for tests.*/
int hash_size(uint32_t id);
diff --git a/reftable/tree.c b/reftable/tree.c
index b8899e060a..a5bf880985 100644
--- a/reftable/tree.c
+++ b/reftable/tree.c
@@ -6,10 +6,10 @@ license that can be found in the LICENSE file or at
https://developers.google.com/open-source/licenses/bsd
*/
+#include "system.h"
#include "tree.h"
#include "basics.h"
-#include "system.h"
struct tree_node *tree_search(void *key, struct tree_node **rootp,
int (*compare)(const void *, const void *),
diff --git a/reftable/tree_test.c b/reftable/tree_test.c
index cbff125588..ac3a045ad4 100644
--- a/reftable/tree_test.c
+++ b/reftable/tree_test.c
@@ -6,6 +6,7 @@ license that can be found in the LICENSE file or at
https://developers.google.com/open-source/licenses/bsd
*/
+#include "system.h"
#include "tree.h"
#include "basics.h"
diff --git a/remote-curl.c b/remote-curl.c
index a76b6405eb..acf7b2bb40 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -1,5 +1,9 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "remote.h"
#include "connect.h"
#include "strbuf.h"
@@ -14,9 +18,12 @@
#include "credential.h"
#include "oid-array.h"
#include "send-pack.h"
+#include "setup.h"
#include "protocol.h"
#include "quote.h"
+#include "trace2.h"
#include "transport.h"
+#include "write-or-die.h"
static struct remote *remote;
/* always ends with a trailing slash */
@@ -472,10 +479,11 @@ static struct discovery *discover_refs(const char *service, int for_push)
/*
* NEEDSWORK: If we are trying to use protocol v2 and we are planning
- * to perform a push, then fallback to v0 since the client doesn't know
- * how to push yet using v2.
+ * to perform any operation that doesn't involve upload-pack (i.e., a
+ * fetch, ls-remote, etc), then fallback to v0 since we don't know how
+ * to do anything else (like push or remote archive) via v2.
*/
- if (version == protocol_v2 && !strcmp("git-receive-pack", service))
+ if (version == protocol_v2 && strcmp("git-upload-pack", service))
version = protocol_v0;
/* Add the extra Git-Protocol header */
diff --git a/remote.c b/remote.c
index 60869beebe..0764fca0db 100644
--- a/remote.c
+++ b/remote.c
@@ -1,20 +1,28 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "remote.h"
#include "urlmatch.h"
#include "refs.h"
#include "refspec.h"
+#include "object-name.h"
#include "object-store.h"
#include "commit.h"
#include "diff.h"
#include "revision.h"
#include "dir.h"
#include "tag.h"
+#include "setup.h"
#include "string-list.h"
#include "strvec.h"
#include "commit-reach.h"
#include "advice.h"
#include "connect.h"
+#include "parse-options.h"
enum map_direction { FROM_SRC, FROM_DST };
@@ -1163,7 +1171,7 @@ static int try_explicit_object_name(const char *name,
return 0;
}
- if (get_oid(name, &oid))
+ if (repo_get_oid(the_repository, name, &oid))
return -1;
if (match) {
@@ -1251,7 +1259,7 @@ static void show_push_unqualified_ref_name_error(const char *dst_value,
if (!advice_enabled(ADVICE_PUSH_UNQUALIFIED_REF_NAME))
return;
- if (get_oid(matched_src_name, &oid))
+ if (repo_get_oid(the_repository, matched_src_name, &oid))
BUG("'%s' is not a valid object, "
"match_explicit_lhs() should catch this!",
matched_src_name);
@@ -1759,7 +1767,7 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
if (!reject_reason && !ref->deletion && !is_null_oid(&ref->old_oid)) {
if (starts_with(ref->name, "refs/tags/"))
reject_reason = REF_STATUS_REJECT_ALREADY_EXISTS;
- else if (!has_object_file(&ref->old_oid))
+ else if (!repo_has_object_file(the_repository, &ref->old_oid))
reject_reason = REF_STATUS_REJECT_FETCH_FIRST;
else if (!lookup_commit_reference_gently(the_repository, &ref->old_oid, 1) ||
!lookup_commit_reference_gently(the_repository, &ref->new_oid, 1))
@@ -1808,8 +1816,9 @@ static void set_merge(struct remote_state *remote_state, struct branch *ret)
if (!remote_find_tracking(remote, ret->merge[i]) ||
strcmp(ret->remote_name, "."))
continue;
- if (dwim_ref(ret->merge_name[i], strlen(ret->merge_name[i]),
- &oid, &ref, 0) == 1)
+ if (repo_dwim_ref(the_repository, ret->merge_name[i],
+ strlen(ret->merge_name[i]), &oid, &ref,
+ 0) == 1)
ret->merge[i]->dst = ref;
else
ret->merge[i]->dst = xstrdup(ret->merge_name[i]);
@@ -2505,7 +2514,7 @@ static int parse_push_cas_option(struct push_cas_option *cas, const char *arg, i
entry->use_tracking = 1;
else if (!colon[1])
oidclr(&entry->expect);
- else if (get_oid(colon + 1, &entry->expect))
+ else if (repo_get_oid(the_repository, colon + 1, &entry->expect))
return error(_("cannot parse expected object name '%s'"),
colon + 1);
return 0;
@@ -2662,7 +2671,7 @@ static int is_reachable_in_reflog(const char *local, const struct ref *remote)
if (MERGE_BASES_BATCH_SIZE < size)
size = MERGE_BASES_BATCH_SIZE;
- if ((ret = in_merge_bases_many(commit, size, chunk)))
+ if ((ret = repo_in_merge_bases_many(the_repository, commit, size, chunk)))
break;
}
diff --git a/remote.h b/remote.h
index 1c4621b414..73638cefeb 100644
--- a/remote.h
+++ b/remote.h
@@ -1,11 +1,10 @@
#ifndef REMOTE_H
#define REMOTE_H
-#include "cache.h"
-#include "parse-options.h"
#include "hashmap.h"
#include "refspec.h"
+struct option;
struct transport_ls_refs_options;
/**
@@ -234,6 +233,11 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
const struct string_list *server_options,
int stateless_rpc);
+/* Used for protocol v2 in order to retrieve refs from a remote */
+struct bundle_list;
+int get_remote_bundle_uri(int fd_out, struct packet_reader *reader,
+ struct bundle_list *bundles, int stateless_rpc);
+
int resolve_remote_symref(struct ref *ref, struct ref *list);
/*
diff --git a/replace-object.c b/replace-object.c
index 320be2522d..e98825d585 100644
--- a/replace-object.c
+++ b/replace-object.c
@@ -1,4 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
+#include "hex.h"
#include "oidmap.h"
#include "object-store.h"
#include "replace-object.h"
diff --git a/replace-object.h b/replace-object.h
index 3fbc32eb7b..500482b02b 100644
--- a/replace-object.h
+++ b/replace-object.h
@@ -5,6 +5,14 @@
#include "repository.h"
#include "object-store.h"
+/*
+ * Do replace refs need to be checked this run? This variable is
+ * initialized to true unless --no-replace-object is used or
+ * $GIT_NO_REPLACE_OBJECTS is set, but is set to false by some
+ * commands that do not want replace references to be active.
+ */
+extern int read_replace_refs;
+
struct replace_object {
struct oidmap_entry original;
struct object_id replacement;
diff --git a/repo-settings.c b/repo-settings.c
index e8b58151bc..d220c5dd9f 100644
--- a/repo-settings.c
+++ b/repo-settings.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "repository.h"
#include "midx.h"
@@ -41,11 +41,11 @@ void prepare_repo_settings(struct repository *r)
repo_cfg_bool(r, "feature.experimental", &experimental, 0);
/* Defaults modified by feature.* */
- if (experimental) {
+ if (experimental)
r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_SKIPPING;
- }
if (manyfiles) {
r->settings.index_version = 4;
+ r->settings.index_skip_hash = 1;
r->settings.core_untracked_cache = UNTRACKED_CACHE_WRITE;
}
@@ -60,6 +60,8 @@ void prepare_repo_settings(struct repository *r)
repo_cfg_bool(r, "pack.usesparse", &r->settings.pack_use_sparse, 1);
repo_cfg_bool(r, "core.multipackindex", &r->settings.core_multi_pack_index, 1);
repo_cfg_bool(r, "index.sparse", &r->settings.sparse_index, 0);
+ repo_cfg_bool(r, "index.skiphash", &r->settings.index_skip_hash, r->settings.index_skip_hash);
+ repo_cfg_bool(r, "pack.readreverseindex", &r->settings.pack_read_reverse_index, 1);
/*
* The GIT_TEST_MULTI_PACK_INDEX variable is special in that
diff --git a/repository.c b/repository.c
index 5d166b692c..c53e480e32 100644
--- a/repository.c
+++ b/repository.c
@@ -2,16 +2,19 @@
* not really _using_ the compat macros, just make sure the_index
* declaration matches the definition in this file.
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "cache.h"
+#include "abspath.h"
#include "repository.h"
#include "object-store.h"
#include "config.h"
#include "object.h"
#include "lockfile.h"
#include "remote.h"
+#include "setup.h"
#include "submodule-config.h"
#include "sparse-index.h"
+#include "trace2.h"
#include "promisor-remote.h"
/* The main repository */
@@ -28,6 +31,8 @@ void initialize_the_repository(void)
the_repo.remote_state = remote_state_new();
the_repo.parsed_objects = parsed_object_pool_new();
+ index_state_init(&the_index, the_repository);
+
repo_set_hash_algo(&the_repo, GIT_HASH_SHA1);
}
@@ -302,14 +307,13 @@ int repo_read_index(struct repository *repo)
{
int res;
- if (!repo->index)
- CALLOC_ARRAY(repo->index, 1);
-
/* Complete the double-reference */
- if (!repo->index->repo)
- repo->index->repo = repo;
- else if (repo->index->repo != repo)
+ if (!repo->index) {
+ ALLOC_ARRAY(repo->index, 1);
+ index_state_init(repo->index, repo);
+ } else if (repo->index->repo != repo) {
BUG("repo's index should point back at itself");
+ }
res = read_index_from(repo->index, repo->index_file, repo->gitdir);
diff --git a/repository.h b/repository.h
index 24316ac944..1a13ff2867 100644
--- a/repository.h
+++ b/repository.h
@@ -1,7 +1,6 @@
#ifndef REPOSITORY_H
#define REPOSITORY_H
-#include "git-compat-util.h"
#include "path.h"
struct config_set;
@@ -37,10 +36,12 @@ struct repo_settings {
int fetch_write_commit_graph;
int command_requires_full_index;
int sparse_index;
+ int pack_read_reverse_index;
struct fsmonitor_settings *fsmonitor; /* lazily loaded */
int index_version;
+ int index_skip_hash;
enum untracked_cache_setting core_untracked_cache;
int pack_use_sparse;
diff --git a/rerere.c b/rerere.c
index 876ab435da..e968d413d6 100644
--- a/rerere.c
+++ b/rerere.c
@@ -1,5 +1,10 @@
#include "cache.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
+#include "copy.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "string-list.h"
#include "rerere.h"
@@ -9,9 +14,11 @@
#include "ll-merge.h"
#include "attr.h"
#include "pathspec.h"
+#include "object-file.h"
#include "object-store.h"
#include "hash-lookup.h"
#include "strmap.h"
+#include "wrapper.h"
#define RESOLVED 0
#define PUNTED 1
@@ -965,8 +972,9 @@ static int handle_cache(struct index_state *istate,
break;
i = ce_stage(ce) - 1;
if (!mmfile[i].ptr) {
- mmfile[i].ptr = read_object_file(&ce->oid, &type,
- &size);
+ mmfile[i].ptr = repo_read_object_file(the_repository,
+ &ce->oid, &type,
+ &size);
mmfile[i].size = size;
}
}
diff --git a/rerere.h b/rerere.h
index c32d79c3bd..5d6cb63879 100644
--- a/rerere.h
+++ b/rerere.h
@@ -1,6 +1,7 @@
#ifndef RERERE_H
#define RERERE_H
+#include "gettext.h"
#include "string-list.h"
struct pathspec;
@@ -24,9 +25,6 @@ struct rerere_id {
};
int setup_rerere(struct repository *,struct string_list *, int);
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define rerere(flags) repo_rerere(the_repository, flags)
-#endif
int repo_rerere(struct repository *, int);
/*
* Given the conflict ID and the name of a "file" used for replaying
diff --git a/reset.c b/reset.c
index e3383a9334..48da0adf85 100644
--- a/reset.c
+++ b/reset.c
@@ -1,6 +1,9 @@
#include "git-compat-util.h"
#include "cache-tree.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
+#include "object-name.h"
#include "refs.h"
#include "reset.h"
#include "run-command.h"
@@ -38,7 +41,7 @@ static int update_refs(const struct reset_head_opts *opts,
prefix_len = msg.len;
if (update_orig_head) {
- if (!get_oid("ORIG_HEAD", &oid_old_orig))
+ if (!repo_get_oid(the_repository, "ORIG_HEAD", &oid_old_orig))
old_orig = &oid_old_orig;
if (head) {
if (!reflog_orig_head) {
@@ -106,7 +109,7 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts)
goto leave_reset_head;
}
- if (!get_oid("HEAD", &head_oid)) {
+ if (!repo_get_oid(r, "HEAD", &head_oid)) {
head = &head_oid;
} else if (!oid || !reset_hard) {
ret = error(_("could not determine HEAD revision"));
@@ -128,6 +131,7 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts)
unpack_tree_opts.update = 1;
unpack_tree_opts.merge = 1;
unpack_tree_opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
+ unpack_tree_opts.skip_cache_tree_update = 1;
init_checkout_metadata(&unpack_tree_opts.meta, switch_to_branch, oid, NULL);
if (reset_hard)
unpack_tree_opts.reset = UNPACK_RESET_PROTECT_UNTRACKED;
diff --git a/reset.h b/reset.h
index a28f81829d..10708d8ddc 100644
--- a/reset.h
+++ b/reset.h
@@ -1,7 +1,7 @@
#ifndef RESET_H
#define RESET_H
-#include "hash.h"
+#include "hash-ll.h"
#include "repository.h"
#define GIT_REFLOG_ACTION_ENVIRONMENT "GIT_REFLOG_ACTION"
diff --git a/resolve-undo.c b/resolve-undo.c
index e81096e2d4..70a6db526d 100644
--- a/resolve-undo.c
+++ b/resolve-undo.c
@@ -1,5 +1,6 @@
#include "cache.h"
#include "dir.h"
+#include "hash.h"
#include "resolve-undo.h"
#include "string-list.h"
diff --git a/resolve-undo.h b/resolve-undo.h
index 2b3f0f901e..c5deafc92f 100644
--- a/resolve-undo.h
+++ b/resolve-undo.h
@@ -1,7 +1,12 @@
#ifndef RESOLVE_UNDO_H
#define RESOLVE_UNDO_H
-#include "cache.h"
+struct cache_entry;
+struct index_state;
+struct pathspec;
+struct string_list;
+
+#include "hash-ll.h"
struct resolve_undo_info {
unsigned int mode[3];
diff --git a/revision.c b/revision.c
index 8f2623b3b5..b33cc1d106 100644
--- a/revision.c
+++ b/revision.c
@@ -1,4 +1,11 @@
#include "cache.h"
+#include "alloc.h"
+#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-name.h"
+#include "object-file.h"
#include "object-store.h"
#include "tag.h"
#include "blob.h"
@@ -24,7 +31,9 @@
#include "bisect.h"
#include "packfile.h"
#include "worktree.h"
+#include "setup.h"
#include "strvec.h"
+#include "trace2.h"
#include "commit-reach.h"
#include "commit-graph.h"
#include "prio-queue.h"
@@ -34,6 +43,7 @@
#include "json-writer.h"
#include "list-objects-filter-options.h"
#include "resolve-undo.h"
+#include "parse-options.h"
volatile show_early_output_fn_t show_early_output;
@@ -323,7 +333,8 @@ static void add_pending_object_with_path(struct rev_info *revs,
if (revs->reflog_info && obj->type == OBJ_COMMIT) {
struct strbuf buf = STRBUF_INIT;
size_t namelen = strlen(name);
- int len = interpret_branch_name(name, namelen, &buf, &options);
+ int len = repo_interpret_branch_name(the_repository, name,
+ namelen, &buf, &options);
if (0 < len && len < namelen && buf.len)
strbuf_addstr(&buf, name + len);
@@ -353,7 +364,7 @@ void add_head_to_pending(struct rev_info *revs)
{
struct object_id oid;
struct object *obj;
- if (get_oid("HEAD", &oid))
+ if (repo_get_oid(the_repository, "HEAD", &oid))
return;
obj = parse_object(revs->repo, &oid);
if (!obj)
@@ -599,10 +610,12 @@ static struct commit *one_relevant_parent(const struct rev_info *revs,
static int tree_difference = REV_TREE_SAME;
static void file_add_remove(struct diff_options *options,
- int addremove, unsigned mode,
- const struct object_id *oid,
- int oid_valid,
- const char *fullpath, unsigned dirty_submodule)
+ int addremove,
+ unsigned mode UNUSED,
+ const struct object_id *oid UNUSED,
+ int oid_valid UNUSED,
+ const char *fullpath UNUSED,
+ unsigned dirty_submodule UNUSED)
{
int diff = addremove == '+' ? REV_TREE_NEW : REV_TREE_OLD;
struct rev_info *revs = options->change_fn_data;
@@ -613,12 +626,15 @@ static void file_add_remove(struct diff_options *options,
}
static void file_change(struct diff_options *options,
- unsigned old_mode, unsigned new_mode,
- const struct object_id *old_oid,
- const struct object_id *new_oid,
- int old_oid_valid, int new_oid_valid,
- const char *fullpath,
- unsigned old_dirty_submodule, unsigned new_dirty_submodule)
+ unsigned old_mode UNUSED,
+ unsigned new_mode UNUSED,
+ const struct object_id *old_oid UNUSED,
+ const struct object_id *new_oid UNUSED,
+ int old_oid_valid UNUSED,
+ int new_oid_valid UNUSED,
+ const char *fullpath UNUSED,
+ unsigned old_dirty_submodule UNUSED,
+ unsigned new_dirty_submodule UNUSED)
{
tree_difference = REV_TREE_DIFFERENT;
options->flags.has_changes = 1;
@@ -771,8 +787,8 @@ static int check_maybe_different_in_bloom_filter(struct rev_info *revs,
static int rev_compare_tree(struct rev_info *revs,
struct commit *parent, struct commit *commit, int nth_parent)
{
- struct tree *t1 = get_commit_tree(parent);
- struct tree *t2 = get_commit_tree(commit);
+ struct tree *t1 = repo_get_commit_tree(the_repository, parent);
+ struct tree *t2 = repo_get_commit_tree(the_repository, commit);
int bloom_ret = 1;
if (!t1)
@@ -818,7 +834,7 @@ static int rev_compare_tree(struct rev_info *revs,
static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit)
{
- struct tree *t1 = get_commit_tree(commit);
+ struct tree *t1 = repo_get_commit_tree(the_repository, commit);
if (!t1)
return 0;
@@ -956,7 +972,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
if (!revs->prune)
return;
- if (!get_commit_tree(commit))
+ if (!repo_get_commit_tree(the_repository, commit))
return;
if (!commit->parents) {
@@ -1517,27 +1533,78 @@ static void add_rev_cmdline_list(struct rev_info *revs,
}
}
-struct all_refs_cb {
- int all_flags;
- int warned_bad_reflog;
- struct rev_info *all_revs;
- const char *name_for_errormsg;
- struct worktree *wt;
-};
-
-int ref_excluded(struct string_list *ref_excludes, const char *path)
+int ref_excluded(const struct ref_exclusions *exclusions, const char *path)
{
+ const char *stripped_path = strip_namespace(path);
struct string_list_item *item;
- if (!ref_excludes)
- return 0;
- for_each_string_list_item(item, ref_excludes) {
+ for_each_string_list_item(item, &exclusions->excluded_refs) {
if (!wildmatch(item->string, path, 0))
return 1;
}
+
+ if (ref_is_hidden(stripped_path, path, &exclusions->hidden_refs))
+ return 1;
+
return 0;
}
+void init_ref_exclusions(struct ref_exclusions *exclusions)
+{
+ struct ref_exclusions blank = REF_EXCLUSIONS_INIT;
+ memcpy(exclusions, &blank, sizeof(*exclusions));
+}
+
+void clear_ref_exclusions(struct ref_exclusions *exclusions)
+{
+ string_list_clear(&exclusions->excluded_refs, 0);
+ string_list_clear(&exclusions->hidden_refs, 0);
+ exclusions->hidden_refs_configured = 0;
+}
+
+void add_ref_exclusion(struct ref_exclusions *exclusions, const char *exclude)
+{
+ string_list_append(&exclusions->excluded_refs, exclude);
+}
+
+struct exclude_hidden_refs_cb {
+ struct ref_exclusions *exclusions;
+ const char *section;
+};
+
+static int hide_refs_config(const char *var, const char *value, void *cb_data)
+{
+ struct exclude_hidden_refs_cb *cb = cb_data;
+ cb->exclusions->hidden_refs_configured = 1;
+ return parse_hide_refs_config(var, value, cb->section,
+ &cb->exclusions->hidden_refs);
+}
+
+void exclude_hidden_refs(struct ref_exclusions *exclusions, const char *section)
+{
+ struct exclude_hidden_refs_cb cb;
+
+ if (strcmp(section, "fetch") && strcmp(section, "receive") &&
+ strcmp(section, "uploadpack"))
+ die(_("unsupported section for hidden refs: %s"), section);
+
+ if (exclusions->hidden_refs_configured)
+ die(_("--exclude-hidden= passed more than once"));
+
+ cb.exclusions = exclusions;
+ cb.section = section;
+
+ git_config(hide_refs_config, &cb);
+}
+
+struct all_refs_cb {
+ int all_flags;
+ int warned_bad_reflog;
+ struct rev_info *all_revs;
+ const char *name_for_errormsg;
+ struct worktree *wt;
+};
+
static int handle_one_ref(const char *path, const struct object_id *oid,
int flag UNUSED,
void *cb_data)
@@ -1545,7 +1612,7 @@ static int handle_one_ref(const char *path, const struct object_id *oid,
struct all_refs_cb *cb = cb_data;
struct object *object;
- if (ref_excluded(cb->all_revs->ref_excludes, path))
+ if (ref_excluded(&cb->all_revs->ref_excludes, path))
return 0;
object = get_reference(cb->all_revs, path, oid, cb->all_flags);
@@ -1563,24 +1630,6 @@ static void init_all_refs_cb(struct all_refs_cb *cb, struct rev_info *revs,
cb->wt = NULL;
}
-void clear_ref_exclusion(struct string_list **ref_excludes_p)
-{
- if (*ref_excludes_p) {
- string_list_clear(*ref_excludes_p, 0);
- free(*ref_excludes_p);
- }
- *ref_excludes_p = NULL;
-}
-
-void add_ref_exclusion(struct string_list **ref_excludes_p, const char *exclude)
-{
- if (!*ref_excludes_p) {
- CALLOC_ARRAY(*ref_excludes_p, 1);
- (*ref_excludes_p)->strdup_strings = 1;
- }
- string_list_append(*ref_excludes_p, exclude);
-}
-
static void handle_refs(struct ref_store *refs,
struct rev_info *revs, unsigned flags,
int (*for_each)(struct ref_store *, each_ref_fn, void *))
@@ -1775,7 +1824,7 @@ void add_index_objects_to_pending(struct rev_info *revs, unsigned int flags)
worktrees = get_worktrees();
for (p = worktrees; *p; p++) {
struct worktree *wt = *p;
- struct index_state istate = { NULL };
+ struct index_state istate = INDEX_STATE_INIT(revs->repo);
if (wt->is_current)
continue; /* current index already taken care of */
@@ -1829,7 +1878,7 @@ static int add_parents_only(struct rev_info *revs, const char *arg_, int flags,
flags ^= UNINTERESTING | BOTTOM;
arg++;
}
- if (get_oid_committish(arg, &oid))
+ if (repo_get_oid_committish(the_repository, arg, &oid))
return 0;
while (1) {
it = get_reference(revs, arg, &oid, 0);
@@ -1865,30 +1914,15 @@ void repo_init_revisions(struct repository *r,
struct rev_info *revs,
const char *prefix)
{
- memset(revs, 0, sizeof(*revs));
+ struct rev_info blank = REV_INFO_INIT;
+ memcpy(revs, &blank, sizeof(*revs));
revs->repo = r;
- revs->abbrev = DEFAULT_ABBREV;
- revs->simplify_history = 1;
revs->pruning.repo = r;
- revs->pruning.flags.recursive = 1;
- revs->pruning.flags.quick = 1;
revs->pruning.add_remove = file_add_remove;
revs->pruning.change = file_change;
revs->pruning.change_fn_data = revs;
- revs->sort_order = REV_SORT_IN_GRAPH_ORDER;
- revs->dense = 1;
revs->prefix = prefix;
- revs->max_age = -1;
- revs->max_age_as_filter = -1;
- revs->min_age = -1;
- revs->skip_count = -1;
- revs->max_count = -1;
- revs->max_parents = -1;
- revs->expand_tabs_in_log = -1;
-
- revs->commit_format = CMIT_FMT_DEFAULT;
- revs->expand_tabs_in_log_default = 8;
grep_init(&revs->grep_filter, revs->repo);
revs->grep_filter.status_only = 1;
@@ -1901,6 +1935,7 @@ void repo_init_revisions(struct repository *r,
init_display_notes(&revs->notes_opt);
list_objects_filter_init(&revs->filter);
+ init_ref_exclusions(&revs->ref_excludes);
}
static void add_pending_commit_list(struct rev_info *revs,
@@ -1924,15 +1959,15 @@ static void prepare_show_merge(struct rev_info *revs)
int i, prune_num = 1; /* counting terminating NULL */
struct index_state *istate = revs->repo->index;
- if (get_oid("HEAD", &oid))
+ if (repo_get_oid(the_repository, "HEAD", &oid))
die("--merge without HEAD?");
head = lookup_commit_or_die(&oid, "HEAD");
- if (get_oid("MERGE_HEAD", &oid))
+ if (repo_get_oid(the_repository, "MERGE_HEAD", &oid))
die("--merge without MERGE_HEAD?");
other = lookup_commit_or_die(&oid, "MERGE_HEAD");
add_pending_object(revs, &head->object, "HEAD");
add_pending_object(revs, &other->object, "MERGE_HEAD");
- bases = get_merge_bases(head, other);
+ bases = repo_get_merge_bases(the_repository, head, other);
add_rev_cmdline_list(revs, bases, REV_CMD_MERGE_BASE, UNINTERESTING | BOTTOM);
add_pending_commit_list(revs, bases, UNINTERESTING | BOTTOM);
free_commit_list(bases);
@@ -2027,7 +2062,7 @@ static int handle_dotdot_1(const char *arg, char *dotdot,
if (!a || !b)
return dotdot_missing(arg, dotdot, revs, symmetric);
- exclude = get_merge_bases(a, b);
+ exclude = repo_get_merge_bases(the_repository, a, b);
add_rev_cmdline_list(revs, exclude, REV_CMD_MERGE_BASE,
flags_exclude);
add_pending_commit_list(revs, exclude, flags_exclude);
@@ -2113,9 +2148,8 @@ static int handle_revision_arg_1(const char *arg_, struct rev_info *revs, int fl
int exclude_parent = 1;
if (mark[2]) {
- char *end;
- exclude_parent = strtoul(mark + 2, &end, 10);
- if (*end != '\0' || !exclude_parent)
+ if (strtol_i(mark + 2, 10, &exclude_parent) ||
+ exclude_parent < 1)
return -1;
}
@@ -2226,7 +2260,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
!strcmp(arg, "--bisect") || starts_with(arg, "--glob=") ||
!strcmp(arg, "--indexed-objects") ||
!strcmp(arg, "--alternate-refs") ||
- starts_with(arg, "--exclude=") ||
+ starts_with(arg, "--exclude=") || starts_with(arg, "--exclude-hidden=") ||
starts_with(arg, "--branches=") || starts_with(arg, "--tags=") ||
starts_with(arg, "--remotes=") || starts_with(arg, "--no-walk="))
{
@@ -2690,10 +2724,12 @@ static int handle_revision_pseudo_opt(struct rev_info *revs,
init_all_refs_cb(&cb, revs, *flags);
other_head_refs(handle_one_ref, &cb);
}
- clear_ref_exclusion(&revs->ref_excludes);
+ clear_ref_exclusions(&revs->ref_excludes);
} else if (!strcmp(arg, "--branches")) {
+ if (revs->ref_excludes.hidden_refs_configured)
+ return error(_("--exclude-hidden cannot be used together with --branches"));
handle_refs(refs, revs, *flags, refs_for_each_branch_ref);
- clear_ref_exclusion(&revs->ref_excludes);
+ clear_ref_exclusions(&revs->ref_excludes);
} else if (!strcmp(arg, "--bisect")) {
read_bisect_terms(&term_bad, &term_good);
handle_refs(refs, revs, *flags, for_each_bad_bisect_ref);
@@ -2701,35 +2737,48 @@ static int handle_revision_pseudo_opt(struct rev_info *revs,
for_each_good_bisect_ref);
revs->bisect = 1;
} else if (!strcmp(arg, "--tags")) {
+ if (revs->ref_excludes.hidden_refs_configured)
+ return error(_("--exclude-hidden cannot be used together with --tags"));
handle_refs(refs, revs, *flags, refs_for_each_tag_ref);
- clear_ref_exclusion(&revs->ref_excludes);
+ clear_ref_exclusions(&revs->ref_excludes);
} else if (!strcmp(arg, "--remotes")) {
+ if (revs->ref_excludes.hidden_refs_configured)
+ return error(_("--exclude-hidden cannot be used together with --remotes"));
handle_refs(refs, revs, *flags, refs_for_each_remote_ref);
- clear_ref_exclusion(&revs->ref_excludes);
+ clear_ref_exclusions(&revs->ref_excludes);
} else if ((argcount = parse_long_opt("glob", argv, &optarg))) {
struct all_refs_cb cb;
init_all_refs_cb(&cb, revs, *flags);
for_each_glob_ref(handle_one_ref, optarg, &cb);
- clear_ref_exclusion(&revs->ref_excludes);
+ clear_ref_exclusions(&revs->ref_excludes);
return argcount;
} else if ((argcount = parse_long_opt("exclude", argv, &optarg))) {
add_ref_exclusion(&revs->ref_excludes, optarg);
return argcount;
+ } else if ((argcount = parse_long_opt("exclude-hidden", argv, &optarg))) {
+ exclude_hidden_refs(&revs->ref_excludes, optarg);
+ return argcount;
} else if (skip_prefix(arg, "--branches=", &optarg)) {
struct all_refs_cb cb;
+ if (revs->ref_excludes.hidden_refs_configured)
+ return error(_("--exclude-hidden cannot be used together with --branches"));
init_all_refs_cb(&cb, revs, *flags);
for_each_glob_ref_in(handle_one_ref, optarg, "refs/heads/", &cb);
- clear_ref_exclusion(&revs->ref_excludes);
+ clear_ref_exclusions(&revs->ref_excludes);
} else if (skip_prefix(arg, "--tags=", &optarg)) {
struct all_refs_cb cb;
+ if (revs->ref_excludes.hidden_refs_configured)
+ return error(_("--exclude-hidden cannot be used together with --tags"));
init_all_refs_cb(&cb, revs, *flags);
for_each_glob_ref_in(handle_one_ref, optarg, "refs/tags/", &cb);
- clear_ref_exclusion(&revs->ref_excludes);
+ clear_ref_exclusions(&revs->ref_excludes);
} else if (skip_prefix(arg, "--remotes=", &optarg)) {
struct all_refs_cb cb;
+ if (revs->ref_excludes.hidden_refs_configured)
+ return error(_("--exclude-hidden cannot be used together with --remotes"));
init_all_refs_cb(&cb, revs, *flags);
for_each_glob_ref_in(handle_one_ref, optarg, "refs/remotes/", &cb);
- clear_ref_exclusion(&revs->ref_excludes);
+ clear_ref_exclusions(&revs->ref_excludes);
} else if (!strcmp(arg, "--reflog")) {
add_reflogs_to_pending(revs, *flags);
} else if (!strcmp(arg, "--indexed-objects")) {
@@ -3021,6 +3070,7 @@ void release_revisions(struct rev_info *revs)
date_mode_release(&revs->date_mode);
release_revisions_mailmap(revs->mailmap);
free_grep_patterns(&revs->grep_filter);
+ graph_clear(revs->graph);
/* TODO (need to handle "no_free"): diff_free(&revs->diffopt) */
diff_free(&revs->pruning);
reflog_walk_info_release(revs->reflog_info);
@@ -3401,8 +3451,8 @@ void reset_revision_walk(void)
}
static int mark_uninteresting(const struct object_id *oid,
- struct packed_git *pack,
- uint32_t pos,
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED,
void *cb)
{
struct rev_info *revs = cb;
@@ -3838,7 +3888,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt)
* in it.
*/
encoding = get_log_output_encoding();
- message = logmsg_reencode(commit, NULL, encoding);
+ message = repo_logmsg_reencode(the_repository, commit, NULL, encoding);
/* Copy the commit to temporary if we are using "fake" headers */
if (buf.len)
@@ -3874,7 +3924,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt)
retval = grep_buffer(&opt->grep_filter,
(char *)message, strlen(message));
strbuf_release(&buf);
- unuse_commit_buffer(commit, message);
+ repo_unuse_commit_buffer(the_repository, commit, message);
return retval;
}
@@ -4120,7 +4170,7 @@ static struct commit *get_revision_1(struct rev_info *revs)
* Return true for entries that have not yet been shown. (This is an
* object_array_each_func_t.)
*/
-static int entry_unshown(struct object_array_entry *entry, void *cb_data_unused)
+static int entry_unshown(struct object_array_entry *entry, void *cb_data UNUSED)
{
return !(entry->item->flags & SHOWN);
}
diff --git a/revision.h b/revision.h
index afe1b77985..31828748dc 100644
--- a/revision.h
+++ b/revision.h
@@ -2,12 +2,13 @@
#define REVISION_H
#include "commit.h"
-#include "parse-options.h"
#include "grep.h"
#include "notes.h"
#include "pretty.h"
#include "diff.h"
#include "commit-slab-decl.h"
+#include "decorate.h"
+#include "ident.h"
#include "list-objects-filter-options.h"
/**
@@ -61,6 +62,8 @@ struct string_list;
struct saved_parents;
struct bloom_key;
struct bloom_filter_settings;
+struct option;
+struct parse_opt_ctx_t;
define_shared_commit_slab(revision_sources, char *);
struct rev_cmdline_info {
@@ -81,6 +84,35 @@ struct rev_cmdline_info {
} *rev;
};
+struct ref_exclusions {
+ /*
+ * Excluded refs is a list of wildmatch patterns. If any of the
+ * patterns matches, the reference will be excluded.
+ */
+ struct string_list excluded_refs;
+
+ /*
+ * Hidden refs is a list of patterns that is to be hidden via
+ * `ref_is_hidden()`.
+ */
+ struct string_list hidden_refs;
+
+ /*
+ * Indicates whether hidden refs have been configured. This is to
+ * distinguish between no hidden refs existing and hidden refs not
+ * being parsed.
+ */
+ char hidden_refs_configured;
+};
+
+/**
+ * Initialize a `struct ref_exclusions` with a macro.
+ */
+#define REF_EXCLUSIONS_INIT { \
+ .excluded_refs = STRING_LIST_INIT_DUP, \
+ .hidden_refs = STRING_LIST_INIT_DUP, \
+}
+
struct oidset;
struct topo_walk_info;
@@ -103,7 +135,7 @@ struct rev_info {
struct list_objects_filter_options filter;
/* excluding from --branches, --refs, etc. expansion */
- struct string_list *ref_excludes;
+ struct ref_exclusions ref_excludes;
/* Basic information */
const char *prefix;
@@ -357,7 +389,23 @@ struct rev_info {
* called before release_revisions() the "struct rev_info" can be left
* uninitialized.
*/
-#define REV_INFO_INIT { 0 }
+#define REV_INFO_INIT { \
+ .abbrev = DEFAULT_ABBREV, \
+ .simplify_history = 1, \
+ .pruning.flags.recursive = 1, \
+ .pruning.flags.quick = 1, \
+ .sort_order = REV_SORT_IN_GRAPH_ORDER, \
+ .dense = 1, \
+ .max_age = -1, \
+ .max_age_as_filter = -1, \
+ .min_age = -1, \
+ .skip_count = -1, \
+ .max_count = -1, \
+ .max_parents = -1, \
+ .expand_tabs_in_log = -1, \
+ .commit_format = CMIT_FMT_DEFAULT, \
+ .expand_tabs_in_log_default = 8, \
+}
/**
* Initialize a rev_info structure with default values. The third parameter may
@@ -370,9 +418,6 @@ struct rev_info {
void repo_init_revisions(struct repository *r,
struct rev_info *revs,
const char *prefix);
-#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
-#define init_revisions(revs, prefix) repo_init_revisions(the_repository, revs, prefix)
-#endif
/**
* Parse revision information, filling in the `rev_info` structure, and
@@ -439,12 +484,14 @@ void mark_trees_uninteresting_sparse(struct repository *r, struct oidset *trees)
void show_object_with_name(FILE *, struct object *, const char *);
/**
- * Helpers to check if a "struct string_list" item matches with
- * wildmatch().
+ * Helpers to check if a reference should be excluded.
*/
-int ref_excluded(struct string_list *, const char *path);
-void clear_ref_exclusion(struct string_list **);
-void add_ref_exclusion(struct string_list **, const char *exclude);
+
+int ref_excluded(const struct ref_exclusions *exclusions, const char *path);
+void init_ref_exclusions(struct ref_exclusions *);
+void clear_ref_exclusions(struct ref_exclusions *);
+void add_ref_exclusion(struct ref_exclusions *, const char *exclude);
+void exclude_hidden_refs(struct ref_exclusions *, const char *section);
/**
* This function can be used if you want to add commit objects as revision
diff --git a/run-command.c b/run-command.c
index 5ec3a46dcc..d4247d5fcc 100644
--- a/run-command.c
+++ b/run-command.c
@@ -1,11 +1,16 @@
#include "cache.h"
#include "run-command.h"
+#include "environment.h"
#include "exec-cmd.h"
+#include "gettext.h"
#include "sigchain.h"
#include "strvec.h"
+#include "symlinks.h"
#include "thread-utils.h"
#include "strbuf.h"
#include "string-list.h"
+#include "trace.h"
+#include "trace2.h"
#include "quote.h"
#include "config.h"
#include "packfile.h"
@@ -341,19 +346,19 @@ static void child_close_pair(int fd[2])
child_close(fd[1]);
}
-static void child_error_fn(const char *err, va_list params)
+static void child_error_fn(const char *err UNUSED, va_list params UNUSED)
{
const char msg[] = "error() should not be called in child\n";
xwrite(2, msg, sizeof(msg) - 1);
}
-static void child_warn_fn(const char *err, va_list params)
+static void child_warn_fn(const char *err UNUSED, va_list params UNUSED)
{
const char msg[] = "warn() should not be called in child\n";
xwrite(2, msg, sizeof(msg) - 1);
}
-static void NORETURN child_die_fn(const char *err, va_list params)
+static void NORETURN child_die_fn(const char *err UNUSED, va_list params UNUSED)
{
const char msg[] = "die() should not be called in child\n";
xwrite(2, msg, sizeof(msg) - 1);
@@ -1004,41 +1009,6 @@ int run_command(struct child_process *cmd)
return finish_command(cmd);
}
-int run_command_v_opt(const char **argv, int opt)
-{
- return run_command_v_opt_cd_env(argv, opt, NULL, NULL);
-}
-
-int run_command_v_opt_tr2(const char **argv, int opt, const char *tr2_class)
-{
- return run_command_v_opt_cd_env_tr2(argv, opt, NULL, NULL, tr2_class);
-}
-
-int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const char *const *env)
-{
- return run_command_v_opt_cd_env_tr2(argv, opt, dir, env, NULL);
-}
-
-int run_command_v_opt_cd_env_tr2(const char **argv, int opt, const char *dir,
- const char *const *env, const char *tr2_class)
-{
- struct child_process cmd = CHILD_PROCESS_INIT;
- strvec_pushv(&cmd.args, argv);
- cmd.no_stdin = opt & RUN_COMMAND_NO_STDIN ? 1 : 0;
- cmd.git_cmd = opt & RUN_GIT_CMD ? 1 : 0;
- cmd.stdout_to_stderr = opt & RUN_COMMAND_STDOUT_TO_STDERR ? 1 : 0;
- cmd.silent_exec_failure = opt & RUN_SILENT_EXEC_FAILURE ? 1 : 0;
- cmd.use_shell = opt & RUN_USING_SHELL ? 1 : 0;
- cmd.clean_on_exit = opt & RUN_CLEAN_ON_EXIT ? 1 : 0;
- cmd.wait_after_clean = opt & RUN_WAIT_AFTER_CLEAN ? 1 : 0;
- cmd.close_object_store = opt & RUN_CLOSE_OBJECT_STORE ? 1 : 0;
- cmd.dir = dir;
- if (env)
- strvec_pushv(&cmd.env, (const char **)env);
- cmd.trace2_child_class = tr2_class;
- return run_command(&cmd);
-}
-
#ifndef NO_PTHREADS
static pthread_t main_thread;
static int main_thread_set;
@@ -1054,7 +1024,7 @@ static void *run_thread(void *data)
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, SIGPIPE);
- if (pthread_sigmask(SIG_BLOCK, &mask, NULL) < 0) {
+ if (pthread_sigmask(SIG_BLOCK, &mask, NULL)) {
ret = error("unable to block SIGPIPE in async thread");
return (void *)ret;
}
@@ -1496,16 +1466,8 @@ enum child_state {
GIT_CP_WAIT_CLEANUP,
};
-int run_processes_parallel_ungroup;
struct parallel_processes {
- void *data;
-
- int max_processes;
- int nr_processes;
-
- get_next_task_fn get_next_task;
- start_failure_fn start_failure;
- task_finished_fn task_finished;
+ size_t nr_processes;
struct {
enum child_state state;
@@ -1520,81 +1482,60 @@ struct parallel_processes {
struct pollfd *pfd;
unsigned shutdown : 1;
- unsigned ungroup : 1;
- int output_owner;
+ size_t output_owner;
struct strbuf buffered_output; /* of finished children */
};
-static int default_start_failure(struct strbuf *out,
- void *pp_cb,
- void *pp_task_cb)
-{
- return 0;
-}
+struct parallel_processes_for_signal {
+ const struct run_process_parallel_opts *opts;
+ const struct parallel_processes *pp;
+};
-static int default_task_finished(int result,
- struct strbuf *out,
- void *pp_cb,
- void *pp_task_cb)
+static void kill_children(const struct parallel_processes *pp,
+ const struct run_process_parallel_opts *opts,
+ int signo)
{
- return 0;
+ for (size_t i = 0; i < opts->processes; i++)
+ if (pp->children[i].state == GIT_CP_WORKING)
+ kill(pp->children[i].process.pid, signo);
}
-static void kill_children(struct parallel_processes *pp, int signo)
+static void kill_children_signal(const struct parallel_processes_for_signal *pp_sig,
+ int signo)
{
- int i, n = pp->max_processes;
-
- for (i = 0; i < n; i++)
- if (pp->children[i].state == GIT_CP_WORKING)
- kill(pp->children[i].process.pid, signo);
+ kill_children(pp_sig->pp, pp_sig->opts, signo);
}
-static struct parallel_processes *pp_for_signal;
+static struct parallel_processes_for_signal *pp_for_signal;
static void handle_children_on_signal(int signo)
{
- kill_children(pp_for_signal, signo);
+ kill_children_signal(pp_for_signal, signo);
sigchain_pop(signo);
raise(signo);
}
static void pp_init(struct parallel_processes *pp,
- int n,
- get_next_task_fn get_next_task,
- start_failure_fn start_failure,
- task_finished_fn task_finished,
- void *data, int ungroup)
+ const struct run_process_parallel_opts *opts,
+ struct parallel_processes_for_signal *pp_sig)
{
- int i;
-
- if (n < 1)
- n = online_cpus();
+ const size_t n = opts->processes;
- pp->max_processes = n;
+ if (!n)
+ BUG("you must provide a non-zero number of processes!");
- trace_printf("run_processes_parallel: preparing to run up to %d tasks", n);
+ trace_printf("run_processes_parallel: preparing to run up to %"PRIuMAX" tasks",
+ (uintmax_t)n);
- pp->data = data;
- if (!get_next_task)
+ if (!opts->get_next_task)
BUG("you need to specify a get_next_task function");
- pp->get_next_task = get_next_task;
- pp->start_failure = start_failure ? start_failure : default_start_failure;
- pp->task_finished = task_finished ? task_finished : default_task_finished;
-
- pp->nr_processes = 0;
- pp->output_owner = 0;
- pp->shutdown = 0;
- pp->ungroup = ungroup;
CALLOC_ARRAY(pp->children, n);
- if (pp->ungroup)
- pp->pfd = NULL;
- else
+ if (!opts->ungroup)
CALLOC_ARRAY(pp->pfd, n);
- strbuf_init(&pp->buffered_output, 0);
- for (i = 0; i < n; i++) {
+ for (size_t i = 0; i < n; i++) {
strbuf_init(&pp->children[i].err, 0);
child_process_init(&pp->children[i].process);
if (pp->pfd) {
@@ -1603,16 +1544,17 @@ static void pp_init(struct parallel_processes *pp,
}
}
- pp_for_signal = pp;
+ pp_sig->pp = pp;
+ pp_sig->opts = opts;
+ pp_for_signal = pp_sig;
sigchain_push_common(handle_children_on_signal);
}
-static void pp_cleanup(struct parallel_processes *pp)
+static void pp_cleanup(struct parallel_processes *pp,
+ const struct run_process_parallel_opts *opts)
{
- int i;
-
trace_printf("run_processes_parallel: done");
- for (i = 0; i < pp->max_processes; i++) {
+ for (size_t i = 0; i < opts->processes; i++) {
strbuf_release(&pp->children[i].err);
child_process_clear(&pp->children[i].process);
}
@@ -1637,39 +1579,52 @@ static void pp_cleanup(struct parallel_processes *pp)
* <0 no new job was started, user wishes to shutdown early. Use negative code
* to signal the children.
*/
-static int pp_start_one(struct parallel_processes *pp)
+static int pp_start_one(struct parallel_processes *pp,
+ const struct run_process_parallel_opts *opts)
{
- int i, code;
+ size_t i;
+ int code;
- for (i = 0; i < pp->max_processes; i++)
+ for (i = 0; i < opts->processes; i++)
if (pp->children[i].state == GIT_CP_FREE)
break;
- if (i == pp->max_processes)
+ if (i == opts->processes)
BUG("bookkeeping is hard");
- code = pp->get_next_task(&pp->children[i].process,
- pp->ungroup ? NULL : &pp->children[i].err,
- pp->data,
- &pp->children[i].data);
+ /*
+ * By default, do not inherit stdin from the parent process - otherwise,
+ * all children would share stdin! Users may overwrite this to provide
+ * something to the child's stdin by having their 'get_next_task'
+ * callback assign 0 to .no_stdin and an appropriate integer to .in.
+ */
+ pp->children[i].process.no_stdin = 1;
+
+ code = opts->get_next_task(&pp->children[i].process,
+ opts->ungroup ? NULL : &pp->children[i].err,
+ opts->data,
+ &pp->children[i].data);
if (!code) {
- if (!pp->ungroup) {
+ if (!opts->ungroup) {
strbuf_addbuf(&pp->buffered_output, &pp->children[i].err);
strbuf_reset(&pp->children[i].err);
}
return 1;
}
- if (!pp->ungroup) {
+ if (!opts->ungroup) {
pp->children[i].process.err = -1;
pp->children[i].process.stdout_to_stderr = 1;
}
- pp->children[i].process.no_stdin = 1;
if (start_command(&pp->children[i].process)) {
- code = pp->start_failure(pp->ungroup ? NULL :
- &pp->children[i].err,
- pp->data,
- pp->children[i].data);
- if (!pp->ungroup) {
+ if (opts->start_failure)
+ code = opts->start_failure(opts->ungroup ? NULL :
+ &pp->children[i].err,
+ opts->data,
+ pp->children[i].data);
+ else
+ code = 0;
+
+ if (!opts->ungroup) {
strbuf_addbuf(&pp->buffered_output, &pp->children[i].err);
strbuf_reset(&pp->children[i].err);
}
@@ -1685,19 +1640,19 @@ static int pp_start_one(struct parallel_processes *pp)
return 0;
}
-static void pp_buffer_stderr(struct parallel_processes *pp, int output_timeout)
+static void pp_buffer_stderr(struct parallel_processes *pp,
+ const struct run_process_parallel_opts *opts,
+ int output_timeout)
{
- int i;
-
- while ((i = poll(pp->pfd, pp->max_processes, output_timeout)) < 0) {
+ while (poll(pp->pfd, opts->processes, output_timeout) < 0) {
if (errno == EINTR)
continue;
- pp_cleanup(pp);
+ pp_cleanup(pp, opts);
die_errno("poll");
}
/* Buffer output from all pipes. */
- for (i = 0; i < pp->max_processes; i++) {
+ for (size_t i = 0; i < opts->processes; i++) {
if (pp->children[i].state == GIT_CP_WORKING &&
pp->pfd[i].revents & (POLLIN | POLLHUP)) {
int n = strbuf_read_once(&pp->children[i].err,
@@ -1712,9 +1667,9 @@ static void pp_buffer_stderr(struct parallel_processes *pp, int output_timeout)
}
}
-static void pp_output(struct parallel_processes *pp)
+static void pp_output(const struct parallel_processes *pp)
{
- int i = pp->output_owner;
+ size_t i = pp->output_owner;
if (pp->children[i].state == GIT_CP_WORKING &&
pp->children[i].err.len) {
@@ -1723,24 +1678,28 @@ static void pp_output(struct parallel_processes *pp)
}
}
-static int pp_collect_finished(struct parallel_processes *pp)
+static int pp_collect_finished(struct parallel_processes *pp,
+ const struct run_process_parallel_opts *opts)
{
- int i, code;
- int n = pp->max_processes;
+ int code;
+ size_t i;
int result = 0;
while (pp->nr_processes > 0) {
- for (i = 0; i < pp->max_processes; i++)
+ for (i = 0; i < opts->processes; i++)
if (pp->children[i].state == GIT_CP_WAIT_CLEANUP)
break;
- if (i == pp->max_processes)
+ if (i == opts->processes)
break;
code = finish_command(&pp->children[i].process);
- code = pp->task_finished(code, pp->ungroup ? NULL :
- &pp->children[i].err, pp->data,
- pp->children[i].data);
+ if (opts->task_finished)
+ code = opts->task_finished(code, opts->ungroup ? NULL :
+ &pp->children[i].err, opts->data,
+ pp->children[i].data);
+ else
+ code = 0;
if (code)
result = code;
@@ -1753,12 +1712,14 @@ static int pp_collect_finished(struct parallel_processes *pp)
pp->pfd[i].fd = -1;
child_process_init(&pp->children[i].process);
- if (pp->ungroup) {
+ if (opts->ungroup) {
; /* no strbuf_*() work to do here */
} else if (i != pp->output_owner) {
strbuf_addbuf(&pp->buffered_output, &pp->children[i].err);
strbuf_reset(&pp->children[i].err);
} else {
+ const size_t n = opts->processes;
+
strbuf_write(&pp->children[i].err, stderr);
strbuf_reset(&pp->children[i].err);
@@ -1783,76 +1744,60 @@ static int pp_collect_finished(struct parallel_processes *pp)
return result;
}
-int run_processes_parallel(int n,
- get_next_task_fn get_next_task,
- start_failure_fn start_failure,
- task_finished_fn task_finished,
- void *pp_cb)
+void run_processes_parallel(const struct run_process_parallel_opts *opts)
{
int i, code;
int output_timeout = 100;
int spawn_cap = 4;
- int ungroup = run_processes_parallel_ungroup;
- struct parallel_processes pp;
-
- /* unset for the next API user */
- run_processes_parallel_ungroup = 0;
-
- pp_init(&pp, n, get_next_task, start_failure, task_finished, pp_cb,
- ungroup);
+ struct parallel_processes_for_signal pp_sig;
+ struct parallel_processes pp = {
+ .buffered_output = STRBUF_INIT,
+ };
+ /* options */
+ const char *tr2_category = opts->tr2_category;
+ const char *tr2_label = opts->tr2_label;
+ const int do_trace2 = tr2_category && tr2_label;
+
+ if (do_trace2)
+ trace2_region_enter_printf(tr2_category, tr2_label, NULL,
+ "max:%d", opts->processes);
+
+ pp_init(&pp, opts, &pp_sig);
while (1) {
for (i = 0;
i < spawn_cap && !pp.shutdown &&
- pp.nr_processes < pp.max_processes;
+ pp.nr_processes < opts->processes;
i++) {
- code = pp_start_one(&pp);
+ code = pp_start_one(&pp, opts);
if (!code)
continue;
if (code < 0) {
pp.shutdown = 1;
- kill_children(&pp, -code);
+ kill_children(&pp, opts, -code);
}
break;
}
if (!pp.nr_processes)
break;
- if (ungroup) {
- int i;
-
- for (i = 0; i < pp.max_processes; i++)
+ if (opts->ungroup) {
+ for (size_t i = 0; i < opts->processes; i++)
pp.children[i].state = GIT_CP_WAIT_CLEANUP;
} else {
- pp_buffer_stderr(&pp, output_timeout);
+ pp_buffer_stderr(&pp, opts, output_timeout);
pp_output(&pp);
}
- code = pp_collect_finished(&pp);
+ code = pp_collect_finished(&pp, opts);
if (code) {
pp.shutdown = 1;
if (code < 0)
- kill_children(&pp, -code);
+ kill_children(&pp, opts,-code);
}
}
- pp_cleanup(&pp);
- return 0;
-}
-
-int run_processes_parallel_tr2(int n, get_next_task_fn get_next_task,
- start_failure_fn start_failure,
- task_finished_fn task_finished, void *pp_cb,
- const char *tr2_category, const char *tr2_label)
-{
- int result;
-
- trace2_region_enter_printf(tr2_category, tr2_label, NULL, "max:%d",
- ((n < 1) ? online_cpus() : n));
+ pp_cleanup(&pp, opts);
- result = run_processes_parallel(n, get_next_task, start_failure,
- task_finished, pp_cb);
-
- trace2_region_leave(tr2_category, tr2_label, NULL);
-
- return result;
+ if (do_trace2)
+ trace2_region_leave(tr2_category, tr2_label, NULL);
}
int run_auto_maintenance(int quiet)
@@ -1918,7 +1863,7 @@ enum start_bg_result start_bg_command(struct child_process *cmd,
*
* We also assume that `start_command()` does not add
* us to the cleanup list. And that it calls
- * calls `child_process_clear()`.
+ * `child_process_clear()`.
*/
sbgr = SBGR_ERROR;
goto done;
diff --git a/run-command.h b/run-command.h
index 0e85e5846a..072db56a4d 100644
--- a/run-command.h
+++ b/run-command.h
@@ -150,9 +150,7 @@ struct child_process {
}
/**
- * The functions: child_process_init, start_command, finish_command,
- * run_command, run_command_v_opt, run_command_v_opt_cd_env, child_process_clear
- * do the following:
+ * The functions: start_command, finish_command, run_command do the following:
*
* - If a system call failed, errno is set and -1 is returned. A diagnostic
* is printed.
@@ -224,36 +222,6 @@ int run_command(struct child_process *);
*/
int run_auto_maintenance(int quiet);
-#define RUN_COMMAND_NO_STDIN (1<<0)
-#define RUN_GIT_CMD (1<<1)
-#define RUN_COMMAND_STDOUT_TO_STDERR (1<<2)
-#define RUN_SILENT_EXEC_FAILURE (1<<3)
-#define RUN_USING_SHELL (1<<4)
-#define RUN_CLEAN_ON_EXIT (1<<5)
-#define RUN_WAIT_AFTER_CLEAN (1<<6)
-#define RUN_CLOSE_OBJECT_STORE (1<<7)
-
-/**
- * Convenience functions that encapsulate a sequence of
- * start_command() followed by finish_command(). The argument argv
- * specifies the program and its arguments. The argument opt is zero
- * or more of the flags `RUN_COMMAND_NO_STDIN`, `RUN_GIT_CMD`,
- * `RUN_COMMAND_STDOUT_TO_STDERR`, or `RUN_SILENT_EXEC_FAILURE`
- * that correspond to the members .no_stdin, .git_cmd,
- * .stdout_to_stderr, .silent_exec_failure of `struct child_process`.
- * The argument dir corresponds the member .dir. The argument env
- * corresponds to the member .env.
- */
-int run_command_v_opt(const char **argv, int opt);
-int run_command_v_opt_tr2(const char **argv, int opt, const char *tr2_class);
-/*
- * env (the environment) is to be formatted like environ: "VAR=VALUE".
- * To unset an environment variable use just "VAR".
- */
-int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const char *const *env);
-int run_command_v_opt_cd_env_tr2(const char **argv, int opt, const char *dir,
- const char *const *env, const char *tr2_class);
-
/**
* Execute the given command, sending "in" to its stdin, and capturing its
* stdout and stderr in the "out" and "err" strbufs. Any of the three may
@@ -459,17 +427,64 @@ typedef int (*task_finished_fn)(int result,
void *pp_task_cb);
/**
- * Runs up to n processes at the same time. Whenever a process can be
- * started, the callback get_next_task_fn is called to obtain the data
+ * Option used by run_processes_parallel(), { 0 }-initialized means no
+ * options.
+ */
+struct run_process_parallel_opts
+{
+ /**
+ * tr2_category & tr2_label: sets the trace2 category and label for
+ * logging. These must either be unset, or both of them must be set.
+ */
+ const char *tr2_category;
+ const char *tr2_label;
+
+ /**
+ * processes: see 'processes' in run_processes_parallel() below.
+ */
+ size_t processes;
+
+ /**
+ * ungroup: see 'ungroup' in run_processes_parallel() below.
+ */
+ unsigned int ungroup:1;
+
+ /**
+ * get_next_task: See get_next_task_fn() above. This must be
+ * specified.
+ */
+ get_next_task_fn get_next_task;
+
+ /**
+ * start_failure: See start_failure_fn() above. This can be
+ * NULL to omit any special handling.
+ */
+ start_failure_fn start_failure;
+
+ /**
+ * task_finished: See task_finished_fn() above. This can be
+ * NULL to omit any special handling.
+ */
+ task_finished_fn task_finished;
+
+ /**
+ * data: user data, will be passed as "pp_cb" to the callback
+ * parameters.
+ */
+ void *data;
+};
+
+/**
+ * Options are passed via the "struct run_process_parallel_opts" above.
+ *
+ * Runs N 'processes' at the same time. Whenever a process can be
+ * started, the callback opts.get_next_task is called to obtain the data
* required to start another child process.
*
* The children started via this function run in parallel. Their output
* (both stdout and stderr) is routed to stderr in a manner that output
* from different tasks does not interleave (but see "ungroup" below).
*
- * start_failure_fn and task_finished_fn can be NULL to omit any
- * special handling.
- *
* If the "ungroup" option isn't specified, the API will set the
* "stdout_to_stderr" parameter in "struct child_process" and provide
* the callbacks with a "struct strbuf *out" parameter to write output
@@ -479,20 +494,8 @@ typedef int (*task_finished_fn)(int result,
* NULL "struct strbuf *out" parameter, and are responsible for
* emitting their own output, including dealing with any race
* conditions due to writing in parallel to stdout and stderr.
- * The "ungroup" option can be enabled by setting the global
- * "run_processes_parallel_ungroup" to "1" before invoking
- * run_processes_parallel(), it will be set back to "0" as soon as the
- * API reads that setting.
*/
-extern int run_processes_parallel_ungroup;
-int run_processes_parallel(int n,
- get_next_task_fn,
- start_failure_fn,
- task_finished_fn,
- void *pp_cb);
-int run_processes_parallel_tr2(int n, get_next_task_fn, start_failure_fn,
- task_finished_fn, void *pp_cb,
- const char *tr2_category, const char *tr2_label);
+void run_processes_parallel(const struct run_process_parallel_opts *opts);
/**
* Convenience function which prepares env for a command to be run in a
diff --git a/scalar.c b/scalar.c
index c5c1ce6891..1326e1f608 100644
--- a/scalar.c
+++ b/scalar.c
@@ -2,7 +2,8 @@
* The Scalar command-line interface.
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
#include "gettext.h"
#include "parse-options.h"
#include "config.h"
@@ -14,6 +15,8 @@
#include "dir.h"
#include "packfile.h"
#include "help.h"
+#include "setup.h"
+#include "trace2.h"
static void setup_enlistment_directory(int argc, const char **argv,
const char * const *usagestr,
@@ -69,21 +72,18 @@ static void setup_enlistment_directory(int argc, const char **argv,
static int run_git(const char *arg, ...)
{
- struct strvec argv = STRVEC_INIT;
+ struct child_process cmd = CHILD_PROCESS_INIT;
va_list args;
const char *p;
- int res;
va_start(args, arg);
- strvec_push(&argv, arg);
+ strvec_push(&cmd.args, arg);
while ((p = va_arg(args, const char *)))
- strvec_push(&argv, p);
+ strvec_push(&cmd.args, p);
va_end(args);
- res = run_command_v_opt(argv.v, RUN_GIT_CMD);
-
- strvec_clear(&argv);
- return res;
+ cmd.git_cmd = 1;
+ return run_command(&cmd);
}
struct scalar_config {
@@ -146,6 +146,7 @@ static int set_recommended_config(int reconfigure)
{ "credential.validate", "false", 1 }, /* GCM4W-only */
{ "gc.auto", "0", 1 },
{ "gui.GCWarning", "false", 1 },
+ { "index.skipHash", "false", 1 },
{ "index.threads", "true", 1 },
{ "index.version", "4", 1 },
{ "merge.stat", "false", 1 },
@@ -207,7 +208,10 @@ static int set_recommended_config(int reconfigure)
static int toggle_maintenance(int enable)
{
- return run_git("maintenance", enable ? "start" : "unregister", NULL);
+ return run_git("maintenance",
+ enable ? "start" : "unregister",
+ enable ? NULL : "--force",
+ NULL);
}
static int add_or_remove_enlistment(int add)
@@ -261,7 +265,7 @@ static int register_dir(void)
return error(_("could not set recommended config"));
if (toggle_maintenance(1))
- return error(_("could not turn on maintenance"));
+ warning(_("could not turn on maintenance"));
if (have_fsmonitor_support() && start_fsmonitor_daemon()) {
return error(_("could not start the FSMonitor daemon"));
@@ -404,7 +408,7 @@ void load_builtin_commands(const char *prefix, struct cmdnames *cmds)
static int cmd_clone(int argc, const char **argv)
{
const char *branch = NULL;
- int full_clone = 0, single_branch = 0;
+ int full_clone = 0, single_branch = 0, show_progress = isatty(2);
struct option clone_options[] = {
OPT_STRING('b', "branch", &branch, N_("<branch>"),
N_("branch to checkout after clone")),
@@ -499,7 +503,9 @@ static int cmd_clone(int argc, const char **argv)
if (set_recommended_config(0))
return error(_("could not configure '%s'"), dir);
- if ((res = run_git("fetch", "--quiet", "origin", NULL))) {
+ if ((res = run_git("fetch", "--quiet",
+ show_progress ? "--progress" : "--no-progress",
+ "origin", NULL))) {
warning(_("partial clone failed; attempting full clone"));
if (set_config("remote.origin.promisor") ||
@@ -508,7 +514,9 @@ static int cmd_clone(int argc, const char **argv)
goto cleanup;
}
- if ((res = run_git("fetch", "--quiet", "origin", NULL)))
+ if ((res = run_git("fetch", "--quiet",
+ show_progress ? "--progress" : "--no-progress",
+ "origin", NULL)))
goto cleanup;
}
@@ -558,7 +566,7 @@ static int cmd_diagnose(int argc, const char **argv)
return res;
}
-static int cmd_list(int argc, const char **argv)
+static int cmd_list(int argc, const char **argv UNUSED)
{
if (argc != 1)
die(_("`scalar list` does not take arguments"));
@@ -596,6 +604,24 @@ static int get_scalar_repos(const char *key, const char *value, void *data)
return 0;
}
+static int remove_deleted_enlistment(struct strbuf *path)
+{
+ int res = 0;
+ strbuf_realpath_forgiving(path, path->buf, 1);
+
+ if (run_git("config", "--global",
+ "--unset", "--fixed-value",
+ "scalar.repo", path->buf, NULL) < 0)
+ res = -1;
+
+ if (run_git("config", "--global",
+ "--unset", "--fixed-value",
+ "maintenance.repo", path->buf, NULL) < 0)
+ res = -1;
+
+ return res;
+}
+
static int cmd_reconfigure(int argc, const char **argv)
{
int all = 0;
@@ -635,8 +661,22 @@ static int cmd_reconfigure(int argc, const char **argv)
strbuf_reset(&gitdir);
if (chdir(dir) < 0) {
- warning_errno(_("could not switch to '%s'"), dir);
- res = -1;
+ struct strbuf buf = STRBUF_INIT;
+
+ if (errno != ENOENT) {
+ warning_errno(_("could not switch to '%s'"), dir);
+ res = -1;
+ continue;
+ }
+
+ strbuf_addstr(&buf, dir);
+ if (remove_deleted_enlistment(&buf))
+ res = error(_("could not remove stale "
+ "scalar.repo '%s'"), dir);
+ else
+ warning(_("removing stale scalar.repo '%s'"),
+ dir);
+ strbuf_release(&buf);
} else if (discover_git_directory(&commondir, &gitdir) < 0) {
warning_errno(_("git repository gone in '%s'"), dir);
res = -1;
@@ -722,24 +762,6 @@ static int cmd_run(int argc, const char **argv)
return 0;
}
-static int remove_deleted_enlistment(struct strbuf *path)
-{
- int res = 0;
- strbuf_realpath_forgiving(path, path->buf, 1);
-
- if (run_git("config", "--global",
- "--unset", "--fixed-value",
- "scalar.repo", path->buf, NULL) < 0)
- res = -1;
-
- if (run_git("config", "--global",
- "--unset", "--fixed-value",
- "maintenance.repo", path->buf, NULL) < 0)
- res = -1;
-
- return res;
-}
-
static int cmd_unregister(int argc, const char **argv)
{
struct option options[] = {
diff --git a/send-pack.c b/send-pack.c
index f2e19838c9..0c7ccaef68 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -1,6 +1,9 @@
-#include "builtin.h"
+#include "git-compat-util.h"
#include "config.h"
#include "commit.h"
+#include "date.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
#include "object-store.h"
#include "pkt-line.h"
@@ -12,10 +15,13 @@
#include "quote.h"
#include "transport.h"
#include "version.h"
+#include "wrapper.h"
#include "oid-array.h"
#include "gpg-interface.h"
-#include "cache.h"
#include "shallow.h"
+#include "parse-options.h"
+#include "trace2.h"
+#include "write-or-die.h"
int option_parse_push_signed(const struct option *opt,
const char *arg, int unset)
@@ -42,9 +48,9 @@ int option_parse_push_signed(const struct option *opt,
static void feed_object(const struct object_id *oid, FILE *fh, int negative)
{
if (negative &&
- !has_object_file_with_flags(oid,
- OBJECT_INFO_SKIP_FETCH_OBJECT |
- OBJECT_INFO_QUICK))
+ !repo_has_object_file_with_flags(the_repository, oid,
+ OBJECT_INFO_SKIP_FETCH_OBJECT |
+ OBJECT_INFO_QUICK))
return;
if (negative)
@@ -534,7 +540,7 @@ int send_pack(struct send_pack_args *args,
die(_("the receiving end does not support this repository's hash algorithm"));
if (args->push_cert != SEND_PACK_PUSH_CERT_NEVER) {
- int len;
+ size_t len;
push_cert_nonce = server_feature_value("push-cert", &len);
if (push_cert_nonce) {
reject_invalid_nonce(push_cert_nonce, len);
diff --git a/sequencer.c b/sequencer.c
index 0cf3842201..b553b49fbb 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1,9 +1,19 @@
#include "cache.h"
+#include "abspath.h"
+#include "advice.h"
+#include "alloc.h"
#include "config.h"
+#include "copy.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "dir.h"
+#include "object-file.h"
+#include "object-name.h"
#include "object-store.h"
#include "object.h"
+#include "pager.h"
#include "commit.h"
#include "sequencer.h"
#include "tag.h"
@@ -36,7 +46,7 @@
#include "rebase-interactive.h"
#include "reset.h"
#include "branch.h"
-#include "log-tree.h"
+#include "wrapper.h"
#define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"
@@ -264,10 +274,6 @@ static int git_sequencer_config(const char *k, const char *v, void *cb)
if (opts->action == REPLAY_REVERT && !strcmp(k, "revert.reference"))
opts->commit_use_reference = git_config_bool(k, v);
- status = git_gpg_config(k, v, NULL);
- if (status)
- return status;
-
return git_diff_basic_config(k, v, NULL);
}
@@ -352,10 +358,23 @@ static const char *gpg_sign_opt_quoted(struct replay_opts *opts)
return buf.buf;
}
+void replay_opts_release(struct replay_opts *opts)
+{
+ free(opts->gpg_sign);
+ free(opts->reflog_action);
+ free(opts->default_strategy);
+ free(opts->strategy);
+ strvec_clear (&opts->xopts);
+ strbuf_release(&opts->current_fixups);
+ if (opts->revs)
+ release_revisions(opts->revs);
+ free(opts->revs);
+}
+
int sequencer_remove_state(struct replay_opts *opts)
{
struct strbuf buf = STRBUF_INIT;
- int i, ret = 0;
+ int ret = 0;
if (is_rebase_i(opts) &&
strbuf_read_file(&buf, rebase_path_refs_to_delete(), 0) > 0) {
@@ -374,14 +393,6 @@ int sequencer_remove_state(struct replay_opts *opts)
}
}
- free(opts->gpg_sign);
- free(opts->default_strategy);
- free(opts->strategy);
- for (i = 0; i < opts->xopts_nr; i++)
- free(opts->xopts[i]);
- free(opts->xopts);
- strbuf_release(&opts->current_fixups);
-
strbuf_reset(&buf);
strbuf_addstr(&buf, get_dir(opts));
if (remove_dir_recursively(&buf, 0))
@@ -413,7 +424,8 @@ struct commit_message {
static const char *short_commit_name(struct commit *commit)
{
- return find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV);
+ return repo_find_unique_abbrev(the_repository, &commit->object.oid,
+ DEFAULT_ABBREV);
}
static int get_message(struct commit *commit, struct commit_message *out)
@@ -421,7 +433,8 @@ static int get_message(struct commit *commit, struct commit_message *out)
const char *abbrev, *subject;
int subject_len;
- out->message = logmsg_reencode(commit, NULL, get_commit_output_encoding());
+ out->message = repo_logmsg_reencode(the_repository, commit, NULL,
+ get_commit_output_encoding());
abbrev = short_commit_name(commit);
subject_len = find_commit_subject(out->message, &subject);
@@ -438,7 +451,7 @@ static void free_message(struct commit *commit, struct commit_message *msg)
free(msg->parent_label);
free(msg->label);
free(msg->subject);
- unuse_commit_buffer(commit, msg->message);
+ repo_unuse_commit_buffer(the_repository, commit, msg->message);
}
static void print_advice(struct repository *r, int show_hint,
@@ -555,7 +568,7 @@ static void update_abort_safety_file(void)
if (!file_exists(git_path_seq_dir()))
return;
- if (!get_oid("HEAD", &head))
+ if (!repo_get_oid(the_repository, "HEAD", &head))
write_file(git_path_abort_safety_file(), "%s", oid_to_hex(&head));
else
write_file(git_path_abort_safety_file(), "%s", "");
@@ -686,11 +699,11 @@ static int do_recursive_merge(struct repository *r,
o.show_rename_progress = 1;
head_tree = parse_tree_indirect(head);
- next_tree = next ? get_commit_tree(next) : empty_tree(r);
- base_tree = base ? get_commit_tree(base) : empty_tree(r);
+ next_tree = next ? repo_get_commit_tree(r, next) : empty_tree(r);
+ base_tree = base ? repo_get_commit_tree(r, base) : empty_tree(r);
- for (i = 0; i < opts->xopts_nr; i++)
- parse_merge_opt(&o, opts->xopts[i]);
+ for (i = 0; i < opts->xopts.nr; i++)
+ parse_merge_opt(&o, opts->xopts.v[i]);
if (!opts->strategy || !strcmp(opts->strategy, "ort")) {
memset(&result, 0, sizeof(result));
@@ -760,12 +773,12 @@ static int is_index_unchanged(struct repository *r)
/*
* If head_commit is NULL, check_commit, called from
* lookup_commit, would have indicated that head_commit is not
- * a commit object already. parse_commit() will return failure
+ * a commit object already. repo_parse_commit() will return failure
* without further complaints in such a case. Otherwise, if
- * the commit is invalid, parse_commit() will complain. So
+ * the commit is invalid, repo_parse_commit() will complain. So
* there is nothing for us to say here. Just return failure.
*/
- if (parse_commit(head_commit))
+ if (repo_parse_commit(r, head_commit))
return -1;
if (!(cache_tree_oid = get_cache_tree_oid(istate)))
@@ -1050,6 +1063,8 @@ static int run_git_commit(const char *defmsg,
gpg_opt, gpg_opt);
}
+ strvec_pushf(&cmd.env, GIT_REFLOG_ACTION "=%s", opts->reflog_message);
+
if (opts->committer_date_is_author_date)
strvec_pushf(&cmd.env, "GIT_COMMITTER_DATE=%s",
opts->ignore_date ?
@@ -1328,13 +1343,15 @@ void print_commit_summary(struct repository *r,
commit = lookup_commit(r, oid);
if (!commit)
die(_("couldn't look up newly created commit"));
- if (parse_commit(commit))
+ if (repo_parse_commit(r, commit))
die(_("could not parse newly created commit"));
strbuf_addstr(&format, "format:%h] %s");
- format_commit_message(commit, "%an <%ae>", &author_ident, &pctx);
- format_commit_message(commit, "%cn <%ce>", &committer_ident, &pctx);
+ repo_format_commit_message(r, commit, "%an <%ae>", &author_ident,
+ &pctx);
+ repo_format_commit_message(r, commit, "%cn <%ce>", &committer_ident,
+ &pctx);
if (strbuf_cmp(&author_ident, &committer_ident)) {
strbuf_addstr(&format, "\n Author: ");
strbuf_addbuf_percentquote(&format, &author_ident);
@@ -1342,7 +1359,7 @@ void print_commit_summary(struct repository *r,
if (flags & SUMMARY_SHOW_AUTHOR_DATE) {
struct strbuf date = STRBUF_INIT;
- format_commit_message(commit, "%ad", &date, &pctx);
+ repo_format_commit_message(r, commit, "%ad", &date, &pctx);
strbuf_addstr(&format, "\n Date: ");
strbuf_addbuf_percentquote(&format, &date);
strbuf_release(&date);
@@ -1372,7 +1389,7 @@ void print_commit_summary(struct repository *r,
rev.diffopt.detect_rename = DIFF_DETECT_RENAME;
diff_setup_done(&rev.diffopt);
- refs = get_main_ref_store(the_repository);
+ refs = get_main_ref_store(r);
head = refs_resolve_ref_unsafe(refs, "HEAD", 0, NULL, NULL);
if (!head)
die(_("unable to resolve HEAD after creating commit"));
@@ -1398,7 +1415,7 @@ static int parse_head(struct repository *r, struct commit **head)
struct commit *current_head;
struct object_id oid;
- if (get_oid("HEAD", &oid)) {
+ if (repo_get_oid(r, "HEAD", &oid)) {
current_head = NULL;
} else {
current_head = lookup_commit_reference(r, &oid);
@@ -1408,7 +1425,7 @@ static int parse_head(struct repository *r, struct commit **head)
warning(_("HEAD %s is not a commit!"),
oid_to_hex(&oid));
}
- if (parse_commit(current_head))
+ if (repo_parse_commit(r, current_head))
return error(_("could not parse HEAD commit"));
}
*head = current_head;
@@ -1451,8 +1468,8 @@ static int try_to_commit(struct repository *r,
if (flags & AMEND_MSG) {
const char *exclude_gpgsig[] = { "gpgsig", "gpgsig-sha256", NULL };
const char *out_enc = get_commit_output_encoding();
- const char *message = logmsg_reencode(current_head, NULL,
- out_enc);
+ const char *message = repo_logmsg_reencode(r, current_head,
+ NULL, out_enc);
if (!msg) {
const char *orig_message = NULL;
@@ -1463,7 +1480,8 @@ static int try_to_commit(struct repository *r,
hook_commit = "HEAD";
}
author = amend_author = get_author(message);
- unuse_commit_buffer(current_head, message);
+ repo_unuse_commit_buffer(r, current_head,
+ message);
if (!author) {
res = error(_("unable to parse commit author"));
goto out;
@@ -1589,8 +1607,8 @@ static int try_to_commit(struct repository *r,
goto out;
}
- if (update_head_with_reflog(current_head, oid,
- getenv("GIT_REFLOG_ACTION"), msg, &err)) {
+ if (update_head_with_reflog(current_head, oid, opts->reflog_message,
+ msg, &err)) {
res = error("%s", err.buf);
goto out;
}
@@ -1660,12 +1678,12 @@ static int is_original_commit_empty(struct commit *commit)
{
const struct object_id *ptree_oid;
- if (parse_commit(commit))
+ if (repo_parse_commit(the_repository, commit))
return error(_("could not parse commit %s"),
oid_to_hex(&commit->object.oid));
if (commit->parents) {
struct commit *parent = commit->parents->item;
- if (parse_commit(parent))
+ if (repo_parse_commit(the_repository, parent))
return error(_("could not parse parent commit %s"),
oid_to_hex(&parent->object.oid));
ptree_oid = get_commit_tree_oid(parent);
@@ -1989,17 +2007,18 @@ static int update_squash_messages(struct repository *r,
struct commit *head_commit;
const char *head_message, *body;
- if (get_oid("HEAD", &head))
+ if (repo_get_oid(r, "HEAD", &head))
return error(_("need a HEAD to fixup"));
if (!(head_commit = lookup_commit_reference(r, &head)))
return error(_("could not read HEAD"));
- if (!(head_message = logmsg_reencode(head_commit, NULL, encoding)))
+ if (!(head_message = repo_logmsg_reencode(r, head_commit, NULL,
+ encoding)))
return error(_("could not read HEAD's commit message"));
find_commit_subject(head_message, &body);
if (command == TODO_FIXUP && !flag && write_message(body, strlen(body),
rebase_path_fixup_msg(), 0) < 0) {
- unuse_commit_buffer(head_commit, head_message);
+ repo_unuse_commit_buffer(r, head_commit, head_message);
return error(_("cannot write '%s'"), rebase_path_fixup_msg());
}
strbuf_addf(&buf, "%c ", comment_line_char);
@@ -2014,10 +2033,10 @@ static int update_squash_messages(struct repository *r,
else
strbuf_addstr(&buf, body);
- unuse_commit_buffer(head_commit, head_message);
+ repo_unuse_commit_buffer(r, head_commit, head_message);
}
- if (!(message = logmsg_reencode(commit, NULL, encoding)))
+ if (!(message = repo_logmsg_reencode(r, commit, NULL, encoding)))
return error(_("could not read commit message of %s"),
oid_to_hex(&commit->object.oid));
find_commit_subject(message, &body);
@@ -2032,7 +2051,7 @@ static int update_squash_messages(struct repository *r,
strbuf_add_commented_lines(&buf, body, strlen(body));
} else
return error(_("unknown command: %d"), command);
- unuse_commit_buffer(commit, message);
+ repo_unuse_commit_buffer(r, commit, message);
if (!res)
res = write_message(buf.buf, buf.len, rebase_path_squash_msg(),
@@ -2059,7 +2078,7 @@ static void flush_rewritten_pending(void)
FILE *out;
if (strbuf_read_file(&buf, rebase_path_rewritten_pending(), (GIT_MAX_HEXSZ + 1) * 2) > 0 &&
- !get_oid("HEAD", &newoid) &&
+ !repo_get_oid(the_repository, "HEAD", &newoid) &&
(out = fopen_or_warn(rebase_path_rewritten_list(), "a"))) {
char *bol = buf.buf, *eol;
@@ -2111,7 +2130,8 @@ static void refer_to_commit(struct replay_opts *opts,
.abbrev = DEFAULT_ABBREV,
.date_mode.type = DATE_SHORT,
};
- format_commit_message(commit, "%h (%s, %ad)", msgbuf, &ctx);
+ repo_format_commit_message(the_repository, commit,
+ "%h (%s, %ad)", msgbuf, &ctx);
} else {
strbuf_addstr(msgbuf, oid_to_hex(&commit->object.oid));
}
@@ -2144,7 +2164,7 @@ static int do_pick_commit(struct repository *r,
if (write_index_as_tree(&head, r->index, r->index_file, 0, NULL))
return error(_("your index file is unmerged."));
} else {
- unborn = get_oid("HEAD", &head);
+ unborn = repo_get_oid(r, "HEAD", &head);
/* Do we want to generate a root commit? */
if (is_pick_or_similar(command) && opts->have_squash_onto &&
oideq(&head, &opts->squash_onto)) {
@@ -2206,7 +2226,7 @@ static int do_pick_commit(struct repository *r,
msg_file = NULL;
goto fast_forward_edit;
}
- if (parent && parse_commit(parent) < 0)
+ if (parent && repo_parse_commit(r, parent) < 0)
/* TRANSLATORS: The first %s will be a "todo" command like
"revert" or "pick", the second %s a SHA1. */
return error(_("%s: cannot parse parent commit %s"),
@@ -2269,8 +2289,10 @@ static int do_pick_commit(struct repository *r,
reword = 1;
else if (is_fixup(command)) {
if (update_squash_messages(r, command, commit,
- opts, item->flags))
- return -1;
+ opts, item->flags)) {
+ res = -1;
+ goto leave;
+ }
flags |= AMEND_MSG;
if (!final_fixup)
msg_file = rebase_path_squash_msg();
@@ -2280,9 +2302,11 @@ static int do_pick_commit(struct repository *r,
} else {
const char *dest = git_path_squash_msg(r);
unlink(dest);
- if (copy_file(dest, rebase_path_squash_msg(), 0666))
- return error(_("could not rename '%s' to '%s'"),
- rebase_path_squash_msg(), dest);
+ if (copy_file(dest, rebase_path_squash_msg(), 0666)) {
+ res = error(_("could not rename '%s' to '%s'"),
+ rebase_path_squash_msg(), dest);
+ goto leave;
+ }
unlink(git_path_merge_msg(r));
msg_file = dest;
flags |= EDIT_MSG;
@@ -2315,12 +2339,11 @@ static int do_pick_commit(struct repository *r,
commit_list_insert(base, &common);
commit_list_insert(next, &remotes);
res |= try_merge_command(r, opts->strategy,
- opts->xopts_nr, (const char **)opts->xopts,
+ opts->xopts.nr, opts->xopts.v,
common, oid_to_hex(&head), remotes);
free_commit_list(common);
free_commit_list(remotes);
}
- strbuf_release(&msgbuf);
/*
* If the merge was clean or if it failed due to conflict, we write
@@ -2394,6 +2417,7 @@ fast_forward_edit:
leave:
free_message(commit, &msg);
free(author);
+ strbuf_release(&msgbuf);
update_abort_safety_file();
return res;
@@ -2467,12 +2491,39 @@ static int is_command(enum todo_command command, const char **bol)
{
const char *str = todo_command_info[command].str;
const char nick = todo_command_info[command].c;
- const char *p = *bol + 1;
+ const char *p = *bol;
+
+ return (skip_prefix(p, str, &p) || (nick && *p++ == nick)) &&
+ (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r' || !*p) &&
+ (*bol = p);
+}
+
+static int check_label_or_ref_arg(enum todo_command command, const char *arg)
+{
+ switch (command) {
+ case TODO_LABEL:
+ /*
+ * '#' is not a valid label as the merge command uses it to
+ * separate merge parents from the commit subject.
+ */
+ if (!strcmp(arg, "#") ||
+ check_refname_format(arg, REFNAME_ALLOW_ONELEVEL))
+ return error(_("'%s' is not a valid label"), arg);
+ break;
+
+ case TODO_UPDATE_REF:
+ if (check_refname_format(arg, REFNAME_ALLOW_ONELEVEL))
+ return error(_("'%s' is not a valid refname"), arg);
+ if (check_refname_format(arg, 0))
+ return error(_("update-ref requires a fully qualified "
+ "refname e.g. refs/heads/%s"), arg);
+ break;
+
+ default:
+ BUG("unexpected todo_command");
+ }
- return skip_prefix(*bol, str, bol) ||
- ((nick && **bol == nick) &&
- (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r' || !*p) &&
- (*bol = p));
+ return 0;
}
static int parse_insn_line(struct repository *r, struct todo_item *item,
@@ -2501,7 +2552,8 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,
break;
}
if (i >= TODO_COMMENT)
- return -1;
+ return error(_("invalid command '%.*s'"),
+ (int)strcspn(bol, " \t\r\n"), bol);
/* Eat up extra spaces/ tabs before object name */
padding = strspn(bol, " \t");
@@ -2523,19 +2575,26 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,
if (item->command == TODO_EXEC || item->command == TODO_LABEL ||
item->command == TODO_RESET || item->command == TODO_UPDATE_REF) {
+ int ret = 0;
+
item->commit = NULL;
item->arg_offset = bol - buf;
item->arg_len = (int)(eol - bol);
- return 0;
+ if (item->command == TODO_LABEL ||
+ item->command == TODO_UPDATE_REF) {
+ saved = *eol;
+ *eol = '\0';
+ ret = check_label_or_ref_arg(item->command, bol);
+ *eol = saved;
+ }
+ return ret;
}
if (item->command == TODO_FIXUP) {
- if (skip_prefix(bol, "-C", &bol) &&
- (*bol == ' ' || *bol == '\t')) {
+ if (skip_prefix(bol, "-C", &bol)) {
bol += strspn(bol, " \t");
item->flags |= TODO_REPLACE_FIXUP_MSG;
- } else if (skip_prefix(bol, "-c", &bol) &&
- (*bol == ' ' || *bol == '\t')) {
+ } else if (skip_prefix(bol, "-c", &bol)) {
bol += strspn(bol, " \t");
item->flags |= TODO_EDIT_FIXUP_MSG;
}
@@ -2559,7 +2618,7 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,
end_of_object_name = (char *) bol + strcspn(bol, " \t\n");
saved = *end_of_object_name;
*end_of_object_name = '\0';
- status = get_oid(bol, &commit_oid);
+ status = repo_get_oid(r, bol, &commit_oid);
if (status < 0)
error(_("could not parse '%s'"), bol); /* return later */
*end_of_object_name = saved;
@@ -2853,8 +2912,7 @@ static int populate_opts_cb(const char *key, const char *value, void *data)
else if (!strcmp(key, "options.gpg-sign"))
git_config_string_dup(&opts->gpg_sign, key, value);
else if (!strcmp(key, "options.strategy-option")) {
- ALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc);
- opts->xopts[opts->xopts_nr++] = xstrdup(value);
+ strvec_push(&opts->xopts, value);
} else if (!strcmp(key, "options.allow-rerere-auto"))
opts->allow_rerere_auto =
git_config_bool_or_int(key, value, &error_flag) ?
@@ -2871,22 +2929,27 @@ static int populate_opts_cb(const char *key, const char *value, void *data)
return 0;
}
-void parse_strategy_opts(struct replay_opts *opts, char *raw_opts)
+static void parse_strategy_opts(struct replay_opts *opts, char *raw_opts)
{
int i;
+ int count;
+ const char **argv;
char *strategy_opts_string = raw_opts;
if (*strategy_opts_string == ' ')
strategy_opts_string++;
- opts->xopts_nr = split_cmdline(strategy_opts_string,
- (const char ***)&opts->xopts);
- for (i = 0; i < opts->xopts_nr; i++) {
- const char *arg = opts->xopts[i];
+ count = split_cmdline(strategy_opts_string, &argv);
+ if (count < 0)
+ BUG("could not split '%s': %s", strategy_opts_string,
+ split_cmdline_strerror(count));
+ for (i = 0; i < count; i++) {
+ const char *arg = argv[i];
skip_prefix(arg, "--", &arg);
- opts->xopts[i] = xstrdup(arg);
+ strvec_push(&opts->xopts, arg);
}
+ free(argv);
}
static void read_strategy_opts(struct replay_opts *opts, struct strbuf *buf)
@@ -2974,7 +3037,7 @@ static int read_populate_opts(struct replay_opts *opts)
}
if (read_oneliner(&buf, rebase_path_squash_onto(), 0)) {
- if (get_oid_committish(buf.buf, &opts->squash_onto) < 0) {
+ if (repo_get_oid_committish(the_repository, buf.buf, &opts->squash_onto) < 0) {
ret = error(_("unusable squash-onto"));
goto done_rebase_i;
}
@@ -3002,12 +3065,13 @@ done_rebase_i:
static void write_strategy_opts(struct replay_opts *opts)
{
- int i;
struct strbuf buf = STRBUF_INIT;
- for (i = 0; i < opts->xopts_nr; ++i)
- strbuf_addf(&buf, " --%s", opts->xopts[i]);
-
+ /*
+ * Quote strategy options so that they can be read correctly
+ * by split_cmdline().
+ */
+ quote_cmdline(&buf, opts->xopts.v);
write_file(rebase_path_strategy_opts(), "%s\n", buf.buf);
strbuf_release(&buf);
}
@@ -3030,7 +3094,7 @@ int write_basic_state(struct replay_opts *opts, const char *head_name,
write_file(rebase_path_verbose(), "%s", "");
if (opts->strategy)
write_file(rebase_path_strategy(), "%s\n", opts->strategy);
- if (opts->xopts_nr > 0)
+ if (opts->xopts.nr > 0)
write_strategy_opts(opts);
if (opts->allow_rerere_auto == RERERE_AUTOUPDATE)
@@ -3074,7 +3138,9 @@ static int walk_revs_populate_todo(struct todo_list *todo_list,
while ((commit = get_revision(opts->revs))) {
struct todo_item *item = append_new_todo(todo_list);
- const char *commit_buffer = logmsg_reencode(commit, NULL, encoding);
+ const char *commit_buffer = repo_logmsg_reencode(the_repository,
+ commit, NULL,
+ encoding);
const char *subject;
int subject_len;
@@ -3086,7 +3152,8 @@ static int walk_revs_populate_todo(struct todo_list *todo_list,
subject_len = find_commit_subject(commit_buffer, &subject);
strbuf_addf(&todo_list->buf, "%s %s %.*s\n", command_string,
short_commit_name(commit), subject_len, subject);
- unuse_commit_buffer(commit, commit_buffer);
+ repo_unuse_commit_buffer(the_repository, commit,
+ commit_buffer);
}
if (!todo_list->nr)
@@ -3136,25 +3203,7 @@ static int create_seq_dir(struct repository *r)
static int save_head(const char *head)
{
- struct lock_file head_lock = LOCK_INIT;
- struct strbuf buf = STRBUF_INIT;
- int fd;
- ssize_t written;
-
- fd = hold_lock_file_for_update(&head_lock, git_path_head_file(), 0);
- if (fd < 0)
- return error_errno(_("could not lock HEAD"));
- strbuf_addf(&buf, "%s\n", head);
- written = write_in_full(fd, buf.buf, buf.len);
- strbuf_release(&buf);
- if (written < 0) {
- error_errno(_("could not write to '%s'"), git_path_head_file());
- rollback_lock_file(&head_lock);
- return -1;
- }
- if (commit_lock_file(&head_lock) < 0)
- return error(_("failed to finalize '%s'"), git_path_head_file());
- return 0;
+ return write_message(head, strlen(head), git_path_head_file(), 1);
}
static int rollback_is_safe(void)
@@ -3175,7 +3224,7 @@ static int rollback_is_safe(void)
else
die_errno(_("could not read '%s'"), git_path_abort_safety_file());
- if (get_oid("HEAD", &actual_head))
+ if (repo_get_oid(the_repository, "HEAD", &actual_head))
oidclr(&actual_head);
return oideq(&actual_head, &expected_head);
@@ -3183,18 +3232,15 @@ static int rollback_is_safe(void)
static int reset_merge(const struct object_id *oid)
{
- int ret;
- struct strvec argv = STRVEC_INIT;
+ struct child_process cmd = CHILD_PROCESS_INIT;
- strvec_pushl(&argv, "reset", "--merge", NULL);
+ cmd.git_cmd = 1;
+ strvec_pushl(&cmd.args, "reset", "--merge", NULL);
if (!is_null_oid(oid))
- strvec_push(&argv, oid_to_hex(oid));
+ strvec_push(&cmd.args, oid_to_hex(oid));
- ret = run_command_v_opt(argv.v, RUN_GIT_CMD);
- strvec_clear(&argv);
-
- return ret;
+ return run_command(&cmd);
}
static int rollback_single_pick(struct repository *r)
@@ -3417,13 +3463,10 @@ static int save_opts(struct replay_opts *opts)
if (opts->gpg_sign)
res |= git_config_set_in_file_gently(opts_file,
"options.gpg-sign", opts->gpg_sign);
- if (opts->xopts) {
- int i;
- for (i = 0; i < opts->xopts_nr; i++)
- res |= git_config_set_multivar_in_file_gently(opts_file,
- "options.strategy-option",
- opts->xopts[i], "^$", 0);
- }
+ for (size_t i = 0; i < opts->xopts.nr; i++)
+ res |= git_config_set_multivar_in_file_gently(opts_file,
+ "options.strategy-option",
+ opts->xopts.v[i], "^$", 0);
if (opts->allow_rerere_auto)
res |= git_config_set_in_file_gently(opts_file,
"options.allow-rerere-auto",
@@ -3473,10 +3516,13 @@ static int make_patch(struct repository *r,
strbuf_addf(&buf, "%s/message", get_dir(opts));
if (!file_exists(buf.buf)) {
const char *encoding = get_commit_output_encoding();
- const char *commit_buffer = logmsg_reencode(commit, NULL, encoding);
+ const char *commit_buffer = repo_logmsg_reencode(r,
+ commit, NULL,
+ encoding);
find_commit_subject(commit_buffer, &subject);
res |= write_message(subject, strlen(subject), buf.buf, 1);
- unuse_commit_buffer(commit, commit_buffer);
+ repo_unuse_commit_buffer(r, commit,
+ commit_buffer);
}
strbuf_release(&buf);
release_revisions(&log_tree_opt);
@@ -3489,7 +3535,7 @@ static int intend_to_amend(void)
struct object_id head;
char *p;
- if (get_oid("HEAD", &head))
+ if (repo_get_oid(the_repository, "HEAD", &head))
return error(_("cannot read HEAD"));
p = oid_to_hex(&head);
@@ -3558,15 +3604,17 @@ static int error_failed_squash(struct repository *r,
static int do_exec(struct repository *r, const char *command_line)
{
- const char *child_argv[] = { NULL, NULL };
+ struct child_process cmd = CHILD_PROCESS_INIT;
int dirty, status;
fprintf(stderr, _("Executing: %s\n"), command_line);
- child_argv[0] = command_line;
- status = run_command_v_opt(child_argv, RUN_USING_SHELL);
+ cmd.use_shell = 1;
+ strvec_push(&cmd.args, command_line);
+ status = run_command(&cmd);
/* force re-reading of the cache */
- if (discard_index(r->index) < 0 || repo_read_index(r) < 0)
+ discard_index(r->index);
+ if (repo_read_index(r) < 0)
return error(_("could not read index"));
dirty = require_clean_work_tree(r, "rebase", NULL, 1, 1);
@@ -3578,14 +3626,14 @@ static int do_exec(struct repository *r, const char *command_line)
" git rebase --continue\n"
"\n"),
command_line,
- dirty ? N_("and made changes to the index and/or the "
- "working tree\n") : "");
+ dirty ? _("and made changes to the index and/or the "
+ "working tree.\n") : "");
if (status == 127)
/* command not found */
status = 1;
} else if (dirty) {
warning(_("execution succeeded: %s\nbut "
- "left changes to the index and/or the working tree\n"
+ "left changes to the index and/or the working tree.\n"
"Commit or stash your changes, and then run\n"
"\n"
" git rebase --continue\n"
@@ -3626,7 +3674,6 @@ static int safe_append(const char *filename, const char *fmt, ...)
}
if (commit_lock_file(&lock) < 0) {
strbuf_release(&buf);
- rollback_lock_file(&lock);
return error(_("failed to finalize '%s'"), filename);
}
@@ -3653,7 +3700,7 @@ static int do_label(struct repository *r, const char *name, int len)
if (!transaction) {
error("%s", err.buf);
ret = -1;
- } else if (get_oid("HEAD", &head_oid)) {
+ } else if (repo_get_oid(r, "HEAD", &head_oid)) {
error(_("could not read HEAD"));
ret = -1;
} else if (ref_transaction_update(transaction, ref_name.buf, &head_oid,
@@ -3674,17 +3721,28 @@ static int do_label(struct repository *r, const char *name, int len)
return ret;
}
+static const char *sequencer_reflog_action(struct replay_opts *opts)
+{
+ if (!opts->reflog_action) {
+ opts->reflog_action = getenv(GIT_REFLOG_ACTION);
+ opts->reflog_action =
+ xstrdup(opts->reflog_action ? opts->reflog_action
+ : action_name(opts));
+ }
+
+ return opts->reflog_action;
+}
+
__attribute__((format (printf, 3, 4)))
static const char *reflog_message(struct replay_opts *opts,
const char *sub_action, const char *fmt, ...)
{
va_list ap;
static struct strbuf buf = STRBUF_INIT;
- char *reflog_action = getenv(GIT_REFLOG_ACTION);
va_start(ap, fmt);
strbuf_reset(&buf);
- strbuf_addstr(&buf, reflog_action ? reflog_action : action_name(opts));
+ strbuf_addstr(&buf, sequencer_reflog_action(opts));
if (sub_action)
strbuf_addf(&buf, " (%s)", sub_action);
if (fmt) {
@@ -3696,6 +3754,28 @@ static const char *reflog_message(struct replay_opts *opts,
return buf.buf;
}
+static struct commit *lookup_label(struct repository *r, const char *label,
+ int len, struct strbuf *buf)
+{
+ struct commit *commit;
+ struct object_id oid;
+
+ strbuf_reset(buf);
+ strbuf_addf(buf, "refs/rewritten/%.*s", len, label);
+ if (!read_ref(buf->buf, &oid)) {
+ commit = lookup_commit_object(r, &oid);
+ } else {
+ /* fall back to non-rewritten ref or commit */
+ strbuf_splice(buf, 0, strlen("refs/rewritten/"), "", 0);
+ commit = lookup_commit_reference_by_name(buf->buf);
+ }
+
+ if (!commit)
+ error(_("could not resolve '%s'"), buf->buf);
+
+ return commit;
+}
+
static int do_reset(struct repository *r,
const char *name, int len,
struct replay_opts *opts)
@@ -3727,6 +3807,7 @@ static int do_reset(struct repository *r,
oidcpy(&oid, &opts->squash_onto);
} else {
int i;
+ struct commit *commit;
/* Determine the length of the label */
for (i = 0; i < len; i++)
@@ -3734,12 +3815,12 @@ static int do_reset(struct repository *r,
break;
len = i;
- strbuf_addf(&ref_name, "refs/rewritten/%.*s", len, name);
- if (get_oid(ref_name.buf, &oid) &&
- get_oid(ref_name.buf + strlen("refs/rewritten/"), &oid)) {
- ret = error(_("could not read '%s'"), ref_name.buf);
+ commit = lookup_label(r, name, len, &ref_name);
+ if (!commit) {
+ ret = -1;
goto cleanup;
}
+ oid = commit->object.oid;
}
setup_unpack_trees_porcelain(&unpack_tree_opts, "reset");
@@ -3750,6 +3831,7 @@ static int do_reset(struct repository *r,
unpack_tree_opts.merge = 1;
unpack_tree_opts.update = 1;
unpack_tree_opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
+ unpack_tree_opts.skip_cache_tree_update = 1;
init_checkout_metadata(&unpack_tree_opts.meta, name, &oid, NULL);
if (repo_read_index_unmerged(r)) {
@@ -3786,26 +3868,6 @@ cleanup:
return ret;
}
-static struct commit *lookup_label(const char *label, int len,
- struct strbuf *buf)
-{
- struct commit *commit;
-
- strbuf_reset(buf);
- strbuf_addf(buf, "refs/rewritten/%.*s", len, label);
- commit = lookup_commit_reference_by_name(buf->buf);
- if (!commit) {
- /* fall back to non-rewritten ref or commit */
- strbuf_splice(buf, 0, strlen("refs/rewritten/"), "", 0);
- commit = lookup_commit_reference_by_name(buf->buf);
- }
-
- if (!commit)
- error(_("could not resolve '%s'"), buf->buf);
-
- return commit;
-}
-
static int do_merge(struct repository *r,
struct commit *commit,
const char *arg, int arg_len,
@@ -3816,7 +3878,7 @@ static int do_merge(struct repository *r,
struct commit *head_commit, *merge_commit, *i;
struct commit_list *bases, *j;
struct commit_list *to_merge = NULL, **tail = &to_merge;
- const char *strategy = !opts->xopts_nr &&
+ const char *strategy = !opts->xopts.nr &&
(!opts->strategy ||
!strcmp(opts->strategy, "recursive") ||
!strcmp(opts->strategy, "ort")) ?
@@ -3853,7 +3915,7 @@ static int do_merge(struct repository *r,
k = strcspn(p, " \t\n");
if (!k)
continue;
- merge_commit = lookup_label(p, k, &ref_name);
+ merge_commit = lookup_label(r, p, k, &ref_name);
if (!merge_commit) {
ret = error(_("unable to parse '%.*s'"), k, p);
goto leave_merge;
@@ -3926,7 +3988,8 @@ static int do_merge(struct repository *r,
if (commit) {
const char *encoding = get_commit_output_encoding();
- const char *message = logmsg_reencode(commit, NULL, encoding);
+ const char *message = repo_logmsg_reencode(r, commit, NULL,
+ encoding);
const char *body;
int len;
@@ -3939,7 +4002,7 @@ static int do_merge(struct repository *r,
find_commit_subject(message, &body);
len = strlen(body);
ret = write_message(body, len, git_path_merge_msg(r), 0);
- unuse_commit_buffer(commit, message);
+ repo_unuse_commit_buffer(r, commit, message);
if (ret) {
error_errno(_("could not write '%s'"),
git_path_merge_msg(r));
@@ -3999,9 +4062,9 @@ static int do_merge(struct repository *r,
strvec_push(&cmd.args, "octopus");
else {
strvec_push(&cmd.args, strategy);
- for (k = 0; k < opts->xopts_nr; k++)
+ for (k = 0; k < opts->xopts.nr; k++)
strvec_pushf(&cmd.args,
- "-X%s", opts->xopts[k]);
+ "-X%s", opts->xopts.v[k]);
}
if (!(flags & TODO_EDIT_MERGE_MSG))
strvec_push(&cmd.args, "--no-edit");
@@ -4030,14 +4093,16 @@ static int do_merge(struct repository *r,
ret = run_command(&cmd);
/* force re-reading of the cache */
- if (!ret && (discard_index(r->index) < 0 ||
- repo_read_index(r) < 0))
- ret = error(_("could not read index"));
+ if (!ret) {
+ discard_index(r->index);
+ if (repo_read_index(r) < 0)
+ ret = error(_("could not read index"));
+ }
goto leave_merge;
}
merge_commit = to_merge->item;
- bases = get_merge_bases(head_commit, merge_commit);
+ bases = repo_get_merge_bases(r, head_commit, merge_commit);
if (bases && oideq(&merge_commit->object.oid,
&bases->item->object.oid)) {
ret = 0;
@@ -4392,7 +4457,7 @@ void create_autostash(struct repository *r, const char *path)
if (capture_command(&stash, &buf, GIT_MAX_HEXSZ))
die(_("Cannot autostash"));
strbuf_trim_trailing_newline(&buf);
- if (get_oid(buf.buf, &oid))
+ if (repo_get_oid(r, buf.buf, &oid))
die(_("Unexpected stash response: '%s'"),
buf.buf);
strbuf_reset(&buf);
@@ -4405,8 +4470,8 @@ void create_autostash(struct repository *r, const char *path)
printf(_("Created autostash: %s\n"), buf.buf);
if (reset_head(r, &ropts) < 0)
die(_("could not reset --hard"));
- if (discard_index(r->index) < 0 ||
- repo_read_index(r) < 0)
+ discard_index(r->index);
+ if (repo_read_index(r) < 0)
die(_("could not read index"));
}
strbuf_release(&buf);
@@ -4500,7 +4565,7 @@ static int checkout_onto(struct repository *r, struct replay_opts *opts,
RESET_HEAD_RUN_POST_CHECKOUT_HOOK,
.head_msg = reflog_message(opts, "start", "checkout %s",
onto_name),
- .default_reflog_action = "rebase"
+ .default_reflog_action = sequencer_reflog_action(opts)
};
if (reset_head(r, &ropts)) {
apply_autostash(rebase_path_autostash());
@@ -4517,9 +4582,9 @@ static int stopped_at_head(struct repository *r)
struct commit *commit;
struct commit_message message;
- if (get_oid("HEAD", &head) ||
+ if (repo_get_oid(r, "HEAD", &head) ||
!(commit = lookup_commit(r, &head)) ||
- parse_commit(commit) || get_message(commit, &message))
+ repo_parse_commit(r, commit) || get_message(commit, &message))
fprintf(stderr, _("Stopped at HEAD\n"));
else {
fprintf(stderr, _("Stopped at %s\n"), message.label);
@@ -4569,11 +4634,8 @@ static int pick_commits(struct repository *r,
struct replay_opts *opts)
{
int res = 0, reschedule = 0;
- char *prev_reflog_action;
- /* Note that 0 for 3rd parameter of setenv means set only if not set */
- setenv(GIT_REFLOG_ACTION, action_name(opts), 0);
- prev_reflog_action = xstrdup(getenv(GIT_REFLOG_ACTION));
+ opts->reflog_message = sequencer_reflog_action(opts);
if (opts->allow_ff)
assert(!(opts->signoff || opts->no_commit ||
opts->record_origin || should_edit(opts) ||
@@ -4621,14 +4683,12 @@ static int pick_commits(struct repository *r,
}
if (item->command <= TODO_SQUASH) {
if (is_rebase_i(opts))
- setenv(GIT_REFLOG_ACTION, reflog_message(opts,
- command_to_string(item->command), NULL),
- 1);
+ opts->reflog_message = reflog_message(opts,
+ command_to_string(item->command), NULL);
+
res = do_pick_commit(r, item, opts,
is_final_fixup(todo_list),
&check_todo);
- if (is_rebase_i(opts))
- setenv(GIT_REFLOG_ACTION, prev_reflog_action, 1);
if (is_rebase_i(opts) && res < 0) {
/* Reschedule */
advise(_(rescheduled_advice),
@@ -4672,7 +4732,7 @@ static int pick_commits(struct repository *r,
* otherwise we do not.
*/
if (item->command == TODO_REWORD &&
- !get_oid("HEAD", &oid) &&
+ !repo_get_oid(r, "HEAD", &oid) &&
(oideq(&item->commit->object.oid, &oid) ||
(opts->have_squash_onto &&
oideq(&opts->squash_onto, &oid))))
@@ -4761,7 +4821,7 @@ static int pick_commits(struct repository *r,
struct object_id head, orig;
int res;
- if (get_oid("HEAD", &head)) {
+ if (repo_get_oid(r, "HEAD", &head)) {
res = error(_("cannot read HEAD"));
cleanup_head_ref:
strbuf_release(&head_ref);
@@ -4808,8 +4868,8 @@ cleanup_head_ref:
log_tree_opt.disable_stdin = 1;
if (read_oneliner(&buf, rebase_path_orig_head(), 0) &&
- !get_oid(buf.buf, &orig) &&
- !get_oid("HEAD", &head)) {
+ !repo_get_oid(r, buf.buf, &orig) &&
+ !repo_get_oid(r, "HEAD", &head)) {
diff_tree_oid(&orig, &head, "",
&log_tree_opt.diffopt);
log_tree_diff_flush(&log_tree_opt);
@@ -4820,8 +4880,7 @@ cleanup_head_ref:
if (!stat(rebase_path_rewritten_list(), &st) &&
st.st_size > 0) {
struct child_process child = CHILD_PROCESS_INIT;
- const char *post_rewrite_hook =
- find_hook("post-rewrite");
+ struct run_hooks_opt hook_opt = RUN_HOOKS_OPT_INIT;
child.in = open(rebase_path_rewritten_list(), O_RDONLY);
child.git_cmd = 1;
@@ -4831,18 +4890,9 @@ cleanup_head_ref:
/* we don't care if this copying failed */
run_command(&child);
- if (post_rewrite_hook) {
- struct child_process hook = CHILD_PROCESS_INIT;
-
- hook.in = open(rebase_path_rewritten_list(),
- O_RDONLY);
- hook.stdout_to_stderr = 1;
- hook.trace2_hook_name = "post-rewrite";
- strvec_push(&hook.args, post_rewrite_hook);
- strvec_push(&hook.args, "rebase");
- /* we don't care if this hook failed */
- run_command(&hook);
- }
+ hook_opt.path_to_stdin = rebase_path_rewritten_list();
+ strvec_push(&hook_opt.args, "rebase");
+ run_hooks_opt("post-rewrite", &hook_opt);
}
apply_autostash(rebase_path_autostash());
@@ -4870,14 +4920,14 @@ cleanup_head_ref:
static int continue_single_pick(struct repository *r, struct replay_opts *opts)
{
- struct strvec argv = STRVEC_INIT;
- int ret;
+ struct child_process cmd = CHILD_PROCESS_INIT;
if (!refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
!refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD"))
return error(_("no cherry-pick or revert in progress"));
- strvec_push(&argv, "commit");
+ cmd.git_cmd = 1;
+ strvec_push(&cmd.args, "commit");
/*
* continue_single_pick() handles the case of recovering from a
@@ -4890,11 +4940,9 @@ static int continue_single_pick(struct repository *r, struct replay_opts *opts)
* Include --cleanup=strip as well because we don't want the
* "# Conflicts:" messages.
*/
- strvec_pushl(&argv, "--no-edit", "--cleanup=strip", NULL);
+ strvec_pushl(&cmd.args, "--no-edit", "--cleanup=strip", NULL);
- ret = run_command_v_opt(argv.v, RUN_GIT_CMD);
- strvec_clear(&argv);
- return ret;
+ return run_command(&cmd);
}
static int commit_staged_changes(struct repository *r,
@@ -4913,7 +4961,7 @@ static int commit_staged_changes(struct repository *r,
struct strbuf rev = STRBUF_INIT;
struct object_id head, to_amend;
- if (get_oid("HEAD", &head))
+ if (repo_get_oid(r, "HEAD", &head))
return error(_("cannot amend non-existing commit"));
if (!read_oneliner(&rev, rebase_path_amend(), 0))
return error(_("invalid file: '%s'"), rebase_path_amend());
@@ -4993,13 +5041,14 @@ static int commit_staged_changes(struct repository *r,
const char *encoding = get_commit_output_encoding();
if (parse_head(r, &commit) ||
- !(p = logmsg_reencode(commit, NULL, encoding)) ||
+ !(p = repo_logmsg_reencode(r, commit, NULL, encoding)) ||
write_message(p, strlen(p), path, 0)) {
- unuse_commit_buffer(commit, p);
+ repo_unuse_commit_buffer(r, commit, p);
return error(_("could not write file: "
"'%s'"), path);
}
- unuse_commit_buffer(commit, p);
+ repo_unuse_commit_buffer(r,
+ commit, p);
}
}
@@ -5063,6 +5112,7 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
unlink(rebase_path_dropped());
}
+ opts->reflog_message = reflog_message(opts, "continue", NULL);
if (commit_staged_changes(r, opts, &todo_list)) {
res = -1;
goto release_todo_list;
@@ -5114,7 +5164,7 @@ static int single_pick(struct repository *r,
TODO_PICK : TODO_REVERT;
item.commit = cmit;
- setenv(GIT_REFLOG_ACTION, action_name(opts), 0);
+ opts->reflog_message = sequencer_reflog_action(opts);
return do_pick_commit(r, &item, opts, 0, &check_todo);
}
@@ -5137,7 +5187,7 @@ int sequencer_pick_revisions(struct repository *r,
if (!strlen(name))
continue;
- if (!get_oid(name, &oid)) {
+ if (!repo_get_oid(r, name, &oid)) {
if (!lookup_commit_reference_gently(r, &oid, 1)) {
enum object_type type = oid_object_info(r,
&oid,
@@ -5180,7 +5230,7 @@ int sequencer_pick_revisions(struct repository *r,
if (walk_revs_populate_todo(&todo_list, opts) ||
create_seq_dir(r) < 0)
return -1;
- if (get_oid("HEAD", &oid) && (opts->action == REPLAY_REVERT))
+ if (repo_get_oid(r, "HEAD", &oid) && (opts->action == REPLAY_REVERT))
return error(_("can't revert as initial commit"));
if (save_head(oid_to_hex(&oid)))
return -1;
@@ -5296,7 +5346,7 @@ static const char *label_oid(struct object_id *oid, const char *label,
* For "uninteresting" commits, i.e. commits that are not to be
* rebased, and which can therefore not be labeled, we use a unique
* abbreviation of the commit name. This is slightly more complicated
- * than calling find_unique_abbrev() because we also need to make
+ * than calling repo_find_unique_abbrev() because we also need to make
* sure that the abbreviation does not conflict with any other
* label.
*
@@ -5312,7 +5362,8 @@ static const char *label_oid(struct object_id *oid, const char *label,
strbuf_grow(&state->buf, GIT_MAX_HEXSZ);
label = p = state->buf.buf;
- find_unique_abbrev_r(p, oid, default_abbrev);
+ repo_find_unique_abbrev_r(the_repository, p, oid,
+ default_abbrev);
/*
* We may need to extend the abbreviated hash so that there is
@@ -5732,8 +5783,8 @@ static void todo_list_add_exec_commands(struct todo_list *todo_list,
base_items[i].command = TODO_EXEC;
base_items[i].offset_in_buf = base_offset;
- base_items[i].arg_offset = base_offset + strlen("exec ");
- base_items[i].arg_len = command_len - strlen("exec ");
+ base_items[i].arg_offset = base_offset;
+ base_items[i].arg_len = command_len;
base_offset += command_len + 1;
}
@@ -5874,7 +5925,7 @@ static int skip_unnecessary_picks(struct repository *r,
continue;
if (item->command != TODO_PICK)
break;
- if (parse_commit(item->commit)) {
+ if (repo_parse_commit(r, item->commit)) {
return error(_("could not parse commit '%s'"),
oid_to_hex(&item->commit->object.oid));
}
@@ -6045,7 +6096,8 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla
struct object_id oid = onto->object.oid;
int res;
- find_unique_abbrev_r(shortonto, &oid, DEFAULT_ABBREV);
+ repo_find_unique_abbrev_r(r, shortonto, &oid,
+ DEFAULT_ABBREV);
if (buf->len == 0) {
struct todo_item *item = append_new_todo(todo_list);
@@ -6206,12 +6258,15 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)
return error(_("the script was already rearranged."));
}
- parse_commit(item->commit);
- commit_buffer = logmsg_reencode(item->commit, NULL, "UTF-8");
+ repo_parse_commit(the_repository, item->commit);
+ commit_buffer = repo_logmsg_reencode(the_repository,
+ item->commit, NULL,
+ "UTF-8");
find_commit_subject(commit_buffer, &subject);
format_subject(&buf, subject, " ");
subject = subjects[i] = strbuf_detach(&buf, &subject_len);
- unuse_commit_buffer(item->commit, commit_buffer);
+ repo_unuse_commit_buffer(the_repository, item->commit,
+ commit_buffer);
if (skip_fixupish(subject, &p)) {
struct commit *commit2;
@@ -6321,8 +6376,8 @@ int sequencer_determine_whence(struct repository *r, enum commit_whence *whence)
if (file_exists(git_path_seq_dir()))
*whence = FROM_CHERRY_PICK_MULTI;
if (file_exists(rebase_path()) &&
- !get_oid("REBASE_HEAD", &rebase_head) &&
- !get_oid("CHERRY_PICK_HEAD", &cherry_pick_head) &&
+ !repo_get_oid(r, "REBASE_HEAD", &rebase_head) &&
+ !repo_get_oid(r, "CHERRY_PICK_HEAD", &cherry_pick_head) &&
oideq(&rebase_head, &cherry_pick_head))
*whence = FROM_REBASE_PICK;
else
diff --git a/sequencer.h b/sequencer.h
index 563fe59933..913a0f652d 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -1,11 +1,12 @@
#ifndef SEQUENCER_H
#define SEQUENCER_H
-#include "cache.h"
#include "strbuf.h"
+#include "strvec.h"
#include "wt-status.h"
struct commit;
+struct index_state;
struct repository;
const char *git_path_commit_editmsg(void);
@@ -60,8 +61,10 @@ struct replay_opts {
/* Merge strategy */
char *default_strategy; /* from config options */
char *strategy;
- char **xopts;
- size_t xopts_nr, xopts_alloc;
+ struct strvec xopts;
+
+ /* Reflog */
+ char *reflog_action;
/* Used by fixup/squash */
struct strbuf current_fixups;
@@ -73,8 +76,16 @@ struct replay_opts {
/* Only used by REPLAY_NONE */
struct rev_info *revs;
+
+ /* Private use */
+ const char *reflog_message;
};
-#define REPLAY_OPTS_INIT { .edit = -1, .action = -1, .current_fixups = STRBUF_INIT }
+#define REPLAY_OPTS_INIT { \
+ .edit = -1, \
+ .action = -1, \
+ .current_fixups = STRBUF_INIT, \
+ .xopts = STRVEC_INIT, \
+}
/*
* Note that ordering matters in this enum. Not only must it match the mapping
@@ -152,6 +163,7 @@ int sequencer_pick_revisions(struct repository *repo,
int sequencer_continue(struct repository *repo, struct replay_opts *opts);
int sequencer_rollback(struct repository *repo, struct replay_opts *opts);
int sequencer_skip(struct repository *repo, struct replay_opts *opts);
+void replay_opts_release(struct replay_opts *opts);
int sequencer_remove_state(struct replay_opts *opts);
#define TODO_LIST_KEEP_EMPTY (1U << 0)
@@ -240,7 +252,6 @@ int read_oneliner(struct strbuf *buf,
const char *path, unsigned flags);
int read_author_script(const char *path, char **name, char **email, char **date,
int allow_missing);
-void parse_strategy_opts(struct replay_opts *opts, char *raw_opts);
int write_basic_state(struct replay_opts *opts, const char *head_name,
struct commit *onto, const struct object_id *orig_head);
void sequencer_post_commit_cleanup(struct repository *r, int verbose);
diff --git a/serve.c b/serve.c
index 733347f602..5329c91011 100644
--- a/serve.c
+++ b/serve.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "repository.h"
#include "config.h"
#include "pkt-line.h"
@@ -7,17 +7,19 @@
#include "protocol-caps.h"
#include "serve.h"
#include "upload-pack.h"
+#include "bundle-uri.h"
+#include "trace2.h"
static int advertise_sid = -1;
static int client_hash_algo = GIT_HASH_SHA1;
-static int always_advertise(struct repository *r,
- struct strbuf *value)
+static int always_advertise(struct repository *r UNUSED,
+ struct strbuf *value UNUSED)
{
return 1;
}
-static int agent_advertise(struct repository *r,
+static int agent_advertise(struct repository *r UNUSED,
struct strbuf *value)
{
if (value)
@@ -33,7 +35,7 @@ static int object_format_advertise(struct repository *r,
return 1;
}
-static void object_format_receive(struct repository *r,
+static void object_format_receive(struct repository *r UNUSED,
const char *algo_name)
{
if (!algo_name)
@@ -47,7 +49,7 @@ static void object_format_receive(struct repository *r,
static int session_id_advertise(struct repository *r, struct strbuf *value)
{
if (advertise_sid == -1 &&
- git_config_get_bool("transfer.advertisesid", &advertise_sid))
+ repo_config_get_bool(r, "transfer.advertisesid", &advertise_sid))
advertise_sid = 0;
if (!advertise_sid)
return 0;
@@ -56,7 +58,7 @@ static int session_id_advertise(struct repository *r, struct strbuf *value)
return 1;
}
-static void session_id_receive(struct repository *r,
+static void session_id_receive(struct repository *r UNUSED,
const char *client_sid)
{
if (!client_sid)
@@ -135,6 +137,11 @@ static struct protocol_capability capabilities[] = {
.advertise = always_advertise,
.command = cap_object_info,
},
+ {
+ .name = "bundle-uri",
+ .advertise = bundle_uri_advertise,
+ .command = bundle_uri_command,
+ },
};
void protocol_v2_advertise_capabilities(void)
diff --git a/server-info.c b/server-info.c
index 0ec6c0c165..55aa04f00a 100644
--- a/server-info.c
+++ b/server-info.c
@@ -1,13 +1,19 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "dir.h"
+#include "environment.h"
+#include "hex.h"
#include "repository.h"
#include "refs.h"
#include "object.h"
#include "commit.h"
#include "tag.h"
#include "packfile.h"
+#include "object-file.h"
#include "object-store.h"
+#include "server-info.h"
#include "strbuf.h"
+#include "wrapper.h"
struct update_info_ctx {
FILE *cur_fp;
diff --git a/server-info.h b/server-info.h
new file mode 100644
index 0000000000..13bbde2c55
--- /dev/null
+++ b/server-info.h
@@ -0,0 +1,7 @@
+#ifndef SERVER_INFO_H
+#define SERVER_INFO_H
+
+/* Dumb servers support */
+int update_server_info(int);
+
+#endif /* SERVER_INFO_H */
diff --git a/setup.c b/setup.c
index cefd5f63c4..458582207e 100644
--- a/setup.c
+++ b/setup.c
@@ -1,11 +1,18 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "environment.h"
+#include "gettext.h"
+#include "object-name.h"
#include "repository.h"
#include "config.h"
#include "dir.h"
+#include "setup.h"
#include "string-list.h"
#include "chdir-notify.h"
#include "promisor-remote.h"
#include "quote.h"
+#include "trace2.h"
+#include "wrapper.h"
static int inside_git_dir = -1;
static int inside_work_tree = -1;
@@ -1345,6 +1352,7 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,
}
if (is_git_directory(dir->buf)) {
+ trace2_data_string("setup", NULL, "implicit-bare-repository", dir->buf);
if (get_allowed_bare_repo() == ALLOWED_BARE_REPO_EXPLICIT)
return GIT_DIR_DISALLOWED_BARE;
if (!ensure_valid_ownership(NULL, NULL, dir->buf, report))
diff --git a/setup.h b/setup.h
new file mode 100644
index 0000000000..4c1ca9d0c9
--- /dev/null
+++ b/setup.h
@@ -0,0 +1,168 @@
+#ifndef SETUP_H
+#define SETUP_H
+
+#include "string-list.h"
+
+int is_inside_git_dir(void);
+int is_inside_work_tree(void);
+int get_common_dir_noenv(struct strbuf *sb, const char *gitdir);
+int get_common_dir(struct strbuf *sb, const char *gitdir);
+
+/*
+ * Return true if the given path is a git directory; note that this _just_
+ * looks at the directory itself. If you want to know whether "foo/.git"
+ * is a repository, you must feed that path, not just "foo".
+ */
+int is_git_directory(const char *path);
+
+/*
+ * Return 1 if the given path is the root of a git repository or
+ * submodule, else 0. Will not return 1 for bare repositories with the
+ * exception of creating a bare repository in "foo/.git" and calling
+ * is_git_repository("foo").
+ *
+ * If we run into read errors, we err on the side of saying "yes, it is",
+ * as we usually consider sub-repos precious, and would prefer to err on the
+ * side of not disrupting or deleting them.
+ */
+int is_nonbare_repository_dir(struct strbuf *path);
+
+#define READ_GITFILE_ERR_STAT_FAILED 1
+#define READ_GITFILE_ERR_NOT_A_FILE 2
+#define READ_GITFILE_ERR_OPEN_FAILED 3
+#define READ_GITFILE_ERR_READ_FAILED 4
+#define READ_GITFILE_ERR_INVALID_FORMAT 5
+#define READ_GITFILE_ERR_NO_PATH 6
+#define READ_GITFILE_ERR_NOT_A_REPO 7
+#define READ_GITFILE_ERR_TOO_LARGE 8
+void read_gitfile_error_die(int error_code, const char *path, const char *dir);
+const char *read_gitfile_gently(const char *path, int *return_error_code);
+#define read_gitfile(path) read_gitfile_gently((path), NULL)
+const char *resolve_gitdir_gently(const char *suspect, int *return_error_code);
+#define resolve_gitdir(path) resolve_gitdir_gently((path), NULL)
+
+void setup_work_tree(void);
+/*
+ * Find the commondir and gitdir of the repository that contains the current
+ * working directory, without changing the working directory or other global
+ * state. The result is appended to commondir and gitdir. If the discovered
+ * gitdir does not correspond to a worktree, then 'commondir' and 'gitdir' will
+ * both have the same result appended to the buffer. The return value is
+ * either 0 upon success and non-zero if no repository was found.
+ */
+int discover_git_directory(struct strbuf *commondir,
+ struct strbuf *gitdir);
+const char *setup_git_directory_gently(int *);
+const char *setup_git_directory(void);
+char *prefix_path(const char *prefix, int len, const char *path);
+char *prefix_path_gently(const char *prefix, int len, int *remaining, const char *path);
+
+int check_filename(const char *prefix, const char *name);
+void verify_filename(const char *prefix,
+ const char *name,
+ int diagnose_misspelt_rev);
+void verify_non_filename(const char *prefix, const char *name);
+int path_inside_repo(const char *prefix, const char *path);
+
+void sanitize_stdfds(void);
+int daemonize(void);
+
+/*
+ * GIT_REPO_VERSION is the version we write by default. The
+ * _READ variant is the highest number we know how to
+ * handle.
+ */
+#define GIT_REPO_VERSION 0
+#define GIT_REPO_VERSION_READ 1
+
+/*
+ * You _have_ to initialize a `struct repository_format` using
+ * `= REPOSITORY_FORMAT_INIT` before calling `read_repository_format()`.
+ */
+struct repository_format {
+ int version;
+ int precious_objects;
+ char *partial_clone; /* value of extensions.partialclone */
+ int worktree_config;
+ int is_bare;
+ int hash_algo;
+ int sparse_index;
+ char *work_tree;
+ struct string_list unknown_extensions;
+ struct string_list v1_only_extensions;
+};
+
+/*
+ * Always use this to initialize a `struct repository_format`
+ * to a well-defined, default state before calling
+ * `read_repository()`.
+ */
+#define REPOSITORY_FORMAT_INIT \
+{ \
+ .version = -1, \
+ .is_bare = -1, \
+ .hash_algo = GIT_HASH_SHA1, \
+ .unknown_extensions = STRING_LIST_INIT_DUP, \
+ .v1_only_extensions = STRING_LIST_INIT_DUP, \
+}
+
+/*
+ * Read the repository format characteristics from the config file "path" into
+ * "format" struct. Returns the numeric version. On error, or if no version is
+ * found in the configuration, -1 is returned, format->version is set to -1,
+ * and all other fields in the struct are set to the default configuration
+ * (REPOSITORY_FORMAT_INIT). Always initialize the struct using
+ * REPOSITORY_FORMAT_INIT before calling this function.
+ */
+int read_repository_format(struct repository_format *format, const char *path);
+
+/*
+ * Free the memory held onto by `format`, but not the struct itself.
+ * (No need to use this after `read_repository_format()` fails.)
+ */
+void clear_repository_format(struct repository_format *format);
+
+/*
+ * Verify that the repository described by repository_format is something we
+ * can read. If it is, return 0. Otherwise, return -1, and "err" will describe
+ * any errors encountered.
+ */
+int verify_repository_format(const struct repository_format *format,
+ struct strbuf *err);
+
+/*
+ * Check the repository format version in the path found in get_git_dir(),
+ * and die if it is a version we don't understand. Generally one would
+ * set_git_dir() before calling this, and use it only for "are we in a valid
+ * repo?".
+ *
+ * If successful and fmt is not NULL, fill fmt with data.
+ */
+void check_repository_format(struct repository_format *fmt);
+
+/*
+ * NOTE NOTE NOTE!!
+ *
+ * PERM_UMASK, OLD_PERM_GROUP and OLD_PERM_EVERYBODY enumerations must
+ * not be changed. Old repositories have core.sharedrepository written in
+ * numeric format, and therefore these values are preserved for compatibility
+ * reasons.
+ */
+enum sharedrepo {
+ PERM_UMASK = 0,
+ OLD_PERM_GROUP = 1,
+ OLD_PERM_EVERYBODY = 2,
+ PERM_GROUP = 0660,
+ PERM_EVERYBODY = 0664
+};
+int git_config_perm(const char *var, const char *value);
+
+struct startup_info {
+ int have_repository;
+ const char *prefix;
+ const char *original_cwd;
+};
+extern struct startup_info *startup_info;
+extern const char *tmp_original_cwd;
+
+#endif /* SETUP_H */
diff --git a/sha1dc_git.c b/sha1dc_git.c
index 5c300e812e..9b675a046e 100644
--- a/sha1dc_git.c
+++ b/sha1dc_git.c
@@ -1,4 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "sha1dc_git.h"
+#include "hex.h"
#ifdef DC_SHA1_EXTERNAL
/*
diff --git a/sha1dc_git.h b/sha1dc_git.h
index 41e1c3fd3f..60e3ce8439 100644
--- a/sha1dc_git.h
+++ b/sha1dc_git.h
@@ -17,6 +17,7 @@ void git_SHA1DCInit(SHA1_CTX *);
void git_SHA1DCFinal(unsigned char [20], SHA1_CTX *);
void git_SHA1DCUpdate(SHA1_CTX *ctx, const void *data, unsigned long len);
+#define platform_SHA_IS_SHA1DC /* used by "test-tool sha1-is-sha1dc" */
#define platform_SHA_CTX SHA1_CTX
#define platform_SHA1_Init git_SHA1DCInit
#define platform_SHA1_Update git_SHA1DCUpdate
diff --git a/shallow.c b/shallow.c
index 17f9bcdb5f..128f56179e 100644
--- a/shallow.c
+++ b/shallow.c
@@ -1,4 +1,6 @@
#include "cache.h"
+#include "alloc.h"
+#include "hex.h"
#include "repository.h"
#include "tempfile.h"
#include "lockfile.h"
@@ -15,6 +17,8 @@
#include "list-objects.h"
#include "commit-reach.h"
#include "shallow.h"
+#include "trace.h"
+#include "wrapper.h"
void set_alternate_shallow_file(struct repository *r, const char *path, int override)
{
@@ -30,7 +34,7 @@ int register_shallow(struct repository *r, const struct object_id *oid)
{
struct commit_graft *graft =
xmalloc(sizeof(struct commit_graft));
- struct commit *commit = lookup_commit(the_repository, oid);
+ struct commit *commit = lookup_commit(r, oid);
oidcpy(&graft->oid, oid);
graft->nr_parent = -1;
@@ -247,7 +251,7 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
struct commit *c = p->item;
struct commit_list *parent;
- if (parse_commit(c))
+ if (repo_parse_commit(the_repository, c))
die("unable to parse commit %s",
oid_to_hex(&c->object.oid));
@@ -301,7 +305,7 @@ static int write_one_shallow(const struct commit_graft *graft, void *cb_data)
if (graft->nr_parent != -1)
return 0;
if (data->flags & QUICK) {
- if (!has_object_file(&graft->oid))
+ if (!repo_has_object_file(the_repository, &graft->oid))
return 0;
} else if (data->flags & SEEN_ONLY) {
struct commit *c = lookup_commit(the_repository, &graft->oid);
@@ -466,7 +470,7 @@ void prepare_shallow_info(struct shallow_info *info, struct oid_array *sa)
ALLOC_ARRAY(info->ours, sa->nr);
ALLOC_ARRAY(info->theirs, sa->nr);
for (i = 0; i < sa->nr; i++) {
- if (has_object_file(sa->oid + i)) {
+ if (repo_has_object_file(the_repository, sa->oid + i)) {
struct commit_graft *graft;
graft = lookup_commit_graft(the_repository,
&sa->oid[i]);
@@ -494,7 +498,7 @@ void remove_nonexistent_theirs_shallow(struct shallow_info *info)
for (i = dst = 0; i < info->nr_theirs; i++) {
if (i != dst)
info->theirs[dst] = info->theirs[i];
- if (has_object_file(oid + info->theirs[i]))
+ if (repo_has_object_file(the_repository, oid + info->theirs[i]))
dst++;
}
info->nr_theirs = dst;
@@ -583,7 +587,7 @@ static void paint_down(struct paint_info *info, const struct object_id *oid,
if (c->object.flags & BOTTOM)
continue;
- if (parse_commit(c))
+ if (repo_parse_commit(the_repository, c))
die("unable to parse commit %s",
oid_to_hex(&c->object.oid));
@@ -791,7 +795,7 @@ static void post_assign_shallow(struct shallow_info *info,
for (j = 0; j < bitmap_nr; j++)
if (bitmap[0][j] &&
/* Step 7, reachability test at commit level */
- !in_merge_bases_many(c, ca.nr, ca.commits)) {
+ !repo_in_merge_bases_many(the_repository, c, ca.nr, ca.commits)) {
update_refstatus(ref_status, info->ref->nr, *bitmap);
dst++;
break;
@@ -819,9 +823,10 @@ int delayed_reachability_test(struct shallow_info *si, int c)
si->nr_commits = ca.nr;
}
- si->reachable[c] = in_merge_bases_many(commit,
- si->nr_commits,
- si->commits);
+ si->reachable[c] = repo_in_merge_bases_many(the_repository,
+ commit,
+ si->nr_commits,
+ si->commits);
si->need_reachability_test[c] = 0;
}
return si->reachable[c];
diff --git a/shallow.h b/shallow.h
index aba6ff5829..e9ca7e4bc8 100644
--- a/shallow.h
+++ b/shallow.h
@@ -6,6 +6,8 @@
#include "repository.h"
#include "strbuf.h"
+struct oid_array;
+
void set_alternate_shallow_file(struct repository *r, const char *path, int override);
int register_shallow(struct repository *r, const struct object_id *oid);
int unregister_shallow(const struct object_id *oid);
diff --git a/shared.mak b/shared.mak
index 33f43edbf9..aeb80fc4d5 100644
--- a/shared.mak
+++ b/shared.mak
@@ -37,13 +37,13 @@ space := $(empty) $(empty)
QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
QUIET_SUBDIR1 =
-ifneq ($(findstring w,$(MAKEFLAGS)),w)
+ifneq ($(findstring w,$(firstword -$(MAKEFLAGS))),w)
PRINT_DIR = --no-print-directory
else # "make -w"
NO_SUBDIR = :
endif
-ifneq ($(findstring s,$(MAKEFLAGS)),s)
+ifneq ($(findstring s,$(firstword -$(MAKEFLAGS))),s)
ifndef V
## common
QUIET_SUBDIR0 = +@subdir=
@@ -60,6 +60,7 @@ ifndef V
QUIET_AR = @echo ' ' AR $@;
QUIET_LINK = @echo ' ' LINK $@;
QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
+ QUIET_CP = @echo ' ' CP $< $@;
QUIET_LNCP = @echo ' ' LN/CP $@;
QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
QUIET_MSGINIT = @echo ' ' MSGINIT $@;
@@ -69,8 +70,11 @@ ifndef V
QUIET_SP = @echo ' ' SP $<;
QUIET_HDR = @echo ' ' HDR $(<:hcc=h);
QUIET_RC = @echo ' ' RC $@;
- QUIET_SPATCH = @echo ' ' SPATCH $<;
- QUIET_SPATCH_T = @echo ' ' SPATCH TEST $(@:.build/%=%);
+
+## Used in "Makefile": SPATCH
+ QUIET_SPATCH = @echo ' ' SPATCH $< \>$@;
+ QUIET_SPATCH_TEST = @echo ' ' SPATCH TEST $(@:.build/%=%);
+ QUIET_SPATCH_CAT = @echo ' ' SPATCH CAT $(@:%.patch=%.d/)\*\*.patch \>$@;
## Used in "Documentation/Makefile"
QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@;
diff --git a/shell.c b/shell.c
index 7ff4109db7..5c67e7bd97 100644
--- a/shell.c
+++ b/shell.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "quote.h"
#include "exec-cmd.h"
#include "strbuf.h"
@@ -52,21 +52,24 @@ static void cd_to_homedir(void)
static void run_shell(void)
{
int done = 0;
- static const char *help_argv[] = { HELP_COMMAND, NULL };
+ struct child_process help_cmd = CHILD_PROCESS_INIT;
if (!access(NOLOGIN_COMMAND, F_OK)) {
/* Interactive login disabled. */
- const char *argv[] = { NOLOGIN_COMMAND, NULL };
+ struct child_process nologin_cmd = CHILD_PROCESS_INIT;
int status;
- status = run_command_v_opt(argv, 0);
+ strvec_push(&nologin_cmd.args, NOLOGIN_COMMAND);
+ status = run_command(&nologin_cmd);
if (status < 0)
exit(127);
exit(status);
}
/* Print help if enabled */
- run_command_v_opt(help_argv, RUN_SILENT_EXEC_FAILURE);
+ help_cmd.silent_exec_failure = 1;
+ strvec_push(&help_cmd.args, HELP_COMMAND);
+ run_command(&help_cmd);
do {
const char *prog;
@@ -125,9 +128,13 @@ static void run_shell(void)
!strcmp(prog, "exit") || !strcmp(prog, "bye")) {
done = 1;
} else if (is_valid_cmd_name(prog)) {
+ struct child_process cmd = CHILD_PROCESS_INIT;
+
full_cmd = make_cmd(prog);
argv[0] = full_cmd;
- code = run_command_v_opt(argv, RUN_SILENT_EXEC_FAILURE);
+ cmd.silent_exec_failure = 1;
+ strvec_pushv(&cmd.args, argv);
+ code = run_command(&cmd);
if (code == -1 && errno == ENOENT) {
fprintf(stderr, "unrecognized command '%s'\n", prog);
}
diff --git a/shortlog.h b/shortlog.h
index 3f7e9aabca..28d04f951a 100644
--- a/shortlog.h
+++ b/shortlog.h
@@ -2,6 +2,7 @@
#define SHORTLOG_H
#include "string-list.h"
+#include "date.h"
struct commit;
@@ -15,13 +16,16 @@ struct shortlog {
int in2;
int user_format;
int abbrev;
+ struct date_mode date_mode;
enum {
SHORTLOG_GROUP_AUTHOR = (1 << 0),
SHORTLOG_GROUP_COMMITTER = (1 << 1),
SHORTLOG_GROUP_TRAILER = (1 << 2),
+ SHORTLOG_GROUP_FORMAT = (1 << 3),
} groups;
struct string_list trailers;
+ struct string_list format;
int email;
struct string_list mailmap;
@@ -29,6 +33,7 @@ struct shortlog {
};
void shortlog_init(struct shortlog *log);
+void shortlog_finish_setup(struct shortlog *log);
void shortlog_add_commit(struct shortlog *log, struct commit *commit);
diff --git a/sideband.c b/sideband.c
index 85bddfdcd4..6cbfd391c4 100644
--- a/sideband.c
+++ b/sideband.c
@@ -1,9 +1,12 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "color.h"
#include "config.h"
+#include "editor.h"
+#include "gettext.h"
#include "sideband.h"
#include "help.h"
#include "pkt-line.h"
+#include "write-or-die.h"
struct keyword_entry {
/*
diff --git a/sigchain.c b/sigchain.c
index 022677b6ab..ee778c0580 100644
--- a/sigchain.c
+++ b/sigchain.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "sigchain.h"
#define SIGCHAIN_MAX_SIGNALS 32
diff --git a/sparse-index.c b/sparse-index.c
index e4a54ce194..886054729e 100644
--- a/sparse-index.c
+++ b/sparse-index.c
@@ -1,4 +1,7 @@
#include "cache.h"
+#include "alloc.h"
+#include "environment.h"
+#include "gettext.h"
#include "repository.h"
#include "sparse-index.h"
#include "tree.h"
@@ -128,9 +131,6 @@ int is_sparse_index_allowed(struct index_state *istate, int flags)
if (!core_apply_sparse_checkout || !core_sparse_checkout_cone)
return 0;
- if (!istate->repo)
- istate->repo = the_repository;
-
if (!(flags & SPARSE_INDEX_MEMORY_ONLY)) {
int test_env;
@@ -299,7 +299,7 @@ void expand_index(struct index_state *istate, struct pattern_list *pl)
* If the index is already full, then keep it full. We will convert
* it to a sparse index on write, if possible.
*/
- if (!istate || istate->sparse_index == INDEX_EXPANDED)
+ if (istate->sparse_index == INDEX_EXPANDED)
return;
/*
@@ -327,9 +327,6 @@ void expand_index(struct index_state *istate, struct pattern_list *pl)
pl = NULL;
}
- if (!istate->repo)
- istate->repo = the_repository;
-
/*
* A NULL pattern set indicates we are expanding a full index, so
* we use a special region name that indicates the full expansion.
@@ -424,6 +421,8 @@ void expand_index(struct index_state *istate, struct pattern_list *pl)
void ensure_full_index(struct index_state *istate)
{
+ if (!istate)
+ BUG("ensure_full_index() must get an index!");
expand_index(istate, NULL);
}
@@ -493,24 +492,42 @@ void clear_skip_worktree_from_present_files(struct index_state *istate)
int dir_found = 1;
int i;
+ int path_count[2] = {0, 0};
+ int restarted = 0;
if (!core_apply_sparse_checkout ||
sparse_expect_files_outside_of_patterns)
return;
+ trace2_region_enter("index", "clear_skip_worktree_from_present_files",
+ istate->repo);
restart:
for (i = 0; i < istate->cache_nr; i++) {
struct cache_entry *ce = istate->cache[i];
- if (ce_skip_worktree(ce) &&
- path_found(ce->name, &last_dirname, &dir_len, &dir_found)) {
- if (S_ISSPARSEDIR(ce->ce_mode)) {
- ensure_full_index(istate);
- goto restart;
+ if (ce_skip_worktree(ce)) {
+ path_count[restarted]++;
+ if (path_found(ce->name, &last_dirname, &dir_len, &dir_found)) {
+ if (S_ISSPARSEDIR(ce->ce_mode)) {
+ if (restarted)
+ BUG("ensure-full-index did not fully flatten?");
+ ensure_full_index(istate);
+ restarted = 1;
+ goto restart;
+ }
+ ce->ce_flags &= ~CE_SKIP_WORKTREE;
}
- ce->ce_flags &= ~CE_SKIP_WORKTREE;
}
}
+
+ if (path_count[0])
+ trace2_data_intmax("index", istate->repo,
+ "sparse_path_count", path_count[0]);
+ if (restarted)
+ trace2_data_intmax("index", istate->repo,
+ "sparse_path_count_full", path_count[1]);
+ trace2_region_leave("index", "clear_skip_worktree_from_present_files",
+ istate->repo);
}
/*
@@ -529,12 +546,9 @@ void expand_to_path(struct index_state *istate,
if (in_expand_to_path)
return;
- if (!istate || !istate->sparse_index)
+ if (!istate->sparse_index)
return;
- if (!istate->repo)
- istate->repo = the_repository;
-
in_expand_to_path = 1;
/*
diff --git a/split-index.c b/split-index.c
index 9d0ccc30d0..40e54760b3 100644
--- a/split-index.c
+++ b/split-index.c
@@ -1,5 +1,10 @@
#include "cache.h"
+#include "alloc.h"
+#include "gettext.h"
+#include "hash.h"
+#include "mem-pool.h"
#include "split-index.h"
+#include "strbuf.h"
#include "ewah/ewok.h"
struct split_index *init_split_index(struct index_state *istate)
@@ -90,7 +95,8 @@ void move_cache_to_base_index(struct index_state *istate)
mem_pool_combine(istate->ce_mem_pool, istate->split_index->base->ce_mem_pool);
}
- CALLOC_ARRAY(si->base, 1);
+ 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() */
si->base->timestamp = istate->timestamp;
diff --git a/split-index.h b/split-index.h
index 7a435ca2c9..15a29cd08c 100644
--- a/split-index.h
+++ b/split-index.h
@@ -1,7 +1,7 @@
#ifndef SPLIT_INDEX_H
#define SPLIT_INDEX_H
-#include "cache.h"
+#include "hash-ll.h"
struct index_state;
struct strbuf;
diff --git a/statinfo.h b/statinfo.h
new file mode 100644
index 0000000000..e49e3054ea
--- /dev/null
+++ b/statinfo.h
@@ -0,0 +1,24 @@
+#ifndef STATINFO_H
+#define STATINFO_H
+
+/*
+ * The "cache_time" is just the low 32 bits of the
+ * time. It doesn't matter if it overflows - we only
+ * check it for equality in the 32 bits we save.
+ */
+struct cache_time {
+ uint32_t sec;
+ uint32_t nsec;
+};
+
+struct stat_data {
+ struct cache_time sd_ctime;
+ struct cache_time sd_mtime;
+ unsigned int sd_dev;
+ unsigned int sd_ino;
+ unsigned int sd_uid;
+ unsigned int sd_gid;
+ unsigned int sd_size;
+};
+
+#endif
diff --git a/strbuf.c b/strbuf.c
index 0890b1405c..08eec8f1d8 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -1,8 +1,16 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "alloc.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-name.h"
#include "refs.h"
+#include "repository.h"
#include "string-list.h"
#include "utf8.h"
#include "date.h"
+#include "wrapper.h"
int starts_with(const char *str, const char *prefix)
{
@@ -1173,30 +1181,8 @@ int strbuf_normalize_path(struct strbuf *src)
return 0;
}
-int strbuf_edit_interactively(struct strbuf *buffer, const char *path,
- const char *const *env)
+void strbuf_strip_file_from_path(struct strbuf *sb)
{
- char *path2 = NULL;
- int fd, res = 0;
-
- if (!is_absolute_path(path))
- path = path2 = xstrdup(git_path("%s", path));
-
- fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0666);
- if (fd < 0)
- res = error_errno(_("could not open '%s' for writing"), path);
- else if (write_in_full(fd, buffer->buf, buffer->len) < 0) {
- res = error_errno(_("could not write to '%s'"), path);
- close(fd);
- } else if (close(fd) < 0)
- res = error_errno(_("could not close '%s'"), path);
- else {
- strbuf_reset(buffer);
- if (launch_editor(path, buffer, env) < 0)
- res = error_errno(_("could not edit '%s'"), path);
- unlink(path);
- }
-
- free(path2);
- return res;
+ char *path_sep = find_last_dir_sep(sb->buf);
+ strbuf_setlen(sb, path_sep ? path_sep - sb->buf + 1 : 0);
}
diff --git a/strbuf.h b/strbuf.h
index 76965a17d4..3dfeadb44c 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -631,7 +631,7 @@ void strbuf_add_separated_string_list(struct strbuf *str,
void strbuf_list_free(struct strbuf **list);
/**
- * Add the abbreviation, as generated by find_unique_abbrev, of `sha1` to
+ * Add the abbreviation, as generated by repo_find_unique_abbrev(), of `sha1` to
* the strbuf `sb`.
*/
struct repository;
@@ -640,29 +640,16 @@ void strbuf_repo_add_unique_abbrev(struct strbuf *sb, struct repository *repo,
void strbuf_add_unique_abbrev(struct strbuf *sb, const struct object_id *oid,
int abbrev_len);
-/**
- * Launch the user preferred editor to edit a file and fill the buffer
- * with the file's contents upon the user completing their editing. The
- * third argument can be used to set the environment which the editor is
- * run in. If the buffer is NULL the editor is launched as usual but the
- * file's contents are not read into the buffer upon completion.
- */
-int launch_editor(const char *path, struct strbuf *buffer,
- const char *const *env);
-
-int launch_sequence_editor(const char *path, struct strbuf *buffer,
- const char *const *env);
-
/*
- * In contrast to `launch_editor()`, this function writes out the contents
- * of the specified file first, then clears the `buffer`, then launches
- * the editor and reads back in the file contents into the `buffer`.
- * Finally, it deletes the temporary file.
+ * Remove the filename from the provided path string. If the path
+ * contains a trailing separator, then the path is considered a directory
+ * and nothing is modified.
*
- * If `path` is relative, it refers to a file in the `.git` directory.
+ * Examples:
+ * - "/path/to/file" -> "/path/to/"
+ * - "/path/to/dir/" -> "/path/to/dir/"
*/
-int strbuf_edit_interactively(struct strbuf *buffer, const char *path,
- const char *const *env);
+void strbuf_strip_file_from_path(struct strbuf *sb);
void strbuf_add_lines(struct strbuf *sb,
const char *prefix,
@@ -695,14 +682,14 @@ static inline void strbuf_complete_line(struct strbuf *sb)
/*
* Copy "name" to "sb", expanding any special @-marks as handled by
- * interpret_branch_name(). The result is a non-qualified branch name
+ * 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
- * interpret_branch_name() for details.
+ * repo_interpret_branch_name() for details.
*/
void strbuf_branchname(struct strbuf *sb, const char *name,
unsigned allowed);
diff --git a/streaming.c b/streaming.c
index 7b2f8b2b93..21e39585e8 100644
--- a/streaming.c
+++ b/streaming.c
@@ -1,12 +1,16 @@
/*
* Copyright (c) 2011, Google Inc.
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "convert.h"
+#include "environment.h"
#include "streaming.h"
#include "repository.h"
+#include "object-file.h"
#include "object-store.h"
#include "replace-object.h"
#include "packfile.h"
+#include "wrapper.h"
typedef int (*open_istream_fn)(struct git_istream *,
struct repository *,
@@ -38,7 +42,7 @@ struct git_istream {
union {
struct {
- char *buf; /* from read_object() */
+ char *buf; /* from oid_object_info_extended() */
unsigned long read_ptr;
} incore;
@@ -388,12 +392,17 @@ static ssize_t read_istream_incore(struct git_istream *st, char *buf, size_t sz)
static int open_istream_incore(struct git_istream *st, struct repository *r,
const struct object_id *oid, enum object_type *type)
{
- st->u.incore.buf = read_object_file_extended(r, oid, type, &st->size, 0);
+ struct object_info oi = OBJECT_INFO_INIT;
+
st->u.incore.read_ptr = 0;
st->close = close_istream_incore;
st->read = read_istream_incore;
- return st->u.incore.buf ? 0 : -1;
+ oi.typep = type;
+ oi.sizep = &st->size;
+ oi.contentp = (void **)&st->u.incore.buf;
+ return oid_object_info_extended(r, oid, &oi,
+ OBJECT_INFO_DIE_IF_CORRUPT);
}
/*****************************************************************************
diff --git a/streaming.h b/streaming.h
index 5e4e6acfd0..bd27f59e57 100644
--- a/streaming.h
+++ b/streaming.h
@@ -3,10 +3,12 @@
*/
#ifndef STREAMING_H
#define STREAMING_H 1
-#include "cache.h"
+
+#include "object.h"
/* opaque */
struct git_istream;
+struct stream_filter;
struct git_istream *open_istream(struct repository *, const struct object_id *,
enum object_type *, unsigned long *,
diff --git a/string-list.c b/string-list.c
index 549fc416d6..0f8ac117fd 100644
--- a/string-list.c
+++ b/string-list.c
@@ -1,5 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "string-list.h"
+#include "alloc.h"
void string_list_init_nodup(struct string_list *list)
{
@@ -156,7 +157,7 @@ void filter_string_list(struct string_list *list, int free_util,
list->nr = dst;
}
-static int item_is_not_empty(struct string_list_item *item, void *unused)
+static int item_is_not_empty(struct string_list_item *item, void *data UNUSED)
{
return *item->string != '\0';
}
@@ -202,6 +203,15 @@ void string_list_clear_func(struct string_list *list, string_list_clear_func_t c
list->nr = list->alloc = 0;
}
+void string_list_setlen(struct string_list *list, size_t nr)
+{
+ if (list->strdup_strings)
+ BUG("cannot setlen a string_list which owns its entries");
+ if (nr > list->nr)
+ BUG("cannot grow a string_list with setlen");
+ list->nr = nr;
+}
+
struct string_list_item *string_list_append_nodup(struct string_list *list,
char *string)
{
@@ -300,7 +310,7 @@ int string_list_split(struct string_list *list, const char *string,
}
int string_list_split_in_place(struct string_list *list, char *string,
- int delim, int maxsplit)
+ const char *delim, int maxsplit)
{
int count = 0;
char *p = string, *end;
@@ -314,7 +324,7 @@ int string_list_split_in_place(struct string_list *list, char *string,
string_list_append(list, p);
return count;
}
- end = strchr(p, delim);
+ end = strpbrk(p, delim);
if (end) {
*end = '\0';
string_list_append(list, p);
diff --git a/string-list.h b/string-list.h
index d5a744e143..122b318641 100644
--- a/string-list.h
+++ b/string-list.h
@@ -134,6 +134,16 @@ typedef void (*string_list_clear_func_t)(void *p, const char *str);
/** Call a custom clear function on each util pointer */
void string_list_clear_func(struct string_list *list, string_list_clear_func_t clearfunc);
+/*
+ * Set the length of a string_list to `nr`, provided that (a) `list`
+ * does not own its own storage, and (b) that `nr` is no larger than
+ * `list->nr`.
+ *
+ * Useful when "shrinking" `list` to write over existing entries that
+ * are no longer used without reallocating.
+ */
+void string_list_setlen(struct string_list *list, size_t nr);
+
/**
* Apply `func` to each item. If `func` returns nonzero, the
* iteration aborts and the return value is propagated.
@@ -141,7 +151,12 @@ void string_list_clear_func(struct string_list *list, string_list_clear_func_t c
int for_each_string_list(struct string_list *list,
string_list_each_func_t func, void *cb_data);
-/** Iterate over each item, as a macro. */
+/**
+ * Iterate over each item, as a macro.
+ *
+ * Be sure that 'list' is non-NULL. The macro cannot perform NULL
+ * checks due to -Werror=address errors.
+ */
#define for_each_string_list_item(item,list) \
for (item = (list)->items; \
item && item < (list)->items + (list)->nr; \
@@ -265,5 +280,5 @@ int string_list_split(struct string_list *list, const char *string,
* list->strdup_strings must *not* be set.
*/
int string_list_split_in_place(struct string_list *list, char *string,
- int delim, int maxsplit);
+ const char *delim, int maxsplit);
#endif /* STRING_LIST_H */
diff --git a/strvec.c b/strvec.c
index 61a76ce6cb..17d54b6c3b 100644
--- a/strvec.c
+++ b/strvec.c
@@ -1,5 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "strvec.h"
+#include "alloc.h"
+#include "hex.h"
#include "strbuf.h"
const char *empty_strvec[] = { NULL };
diff --git a/sub-process.c b/sub-process.c
index 6d4232294d..1daf5a9752 100644
--- a/sub-process.c
+++ b/sub-process.c
@@ -1,6 +1,7 @@
/*
* Generic implementation of background process infrastructure.
*/
+#include "git-compat-util.h"
#include "sub-process.h"
#include "sigchain.h"
#include "pkt-line.h"
diff --git a/sub-process.h b/sub-process.h
index e85f21fa1a..6a61638a8a 100644
--- a/sub-process.h
+++ b/sub-process.h
@@ -1,7 +1,6 @@
#ifndef SUBPROCESS_H
#define SUBPROCESS_H
-#include "git-compat-util.h"
#include "hashmap.h"
#include "run-command.h"
diff --git a/submodule-config.c b/submodule-config.c
index cd7ee236a1..58dfbde9ae 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -1,12 +1,18 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "config.h"
#include "submodule-config.h"
#include "submodule.h"
#include "strbuf.h"
+#include "object-name.h"
#include "object-store.h"
#include "parse-options.h"
+#include "thread-utils.h"
#include "tree-walk.h"
/*
@@ -303,6 +309,8 @@ int parse_submodule_fetchjobs(const char *var, const char *value)
int fetchjobs = git_config_int(var, value);
if (fetchjobs < 0)
die(_("negative values not allowed for submodule.fetchJobs"));
+ if (!fetchjobs)
+ fetchjobs = online_cpus();
return fetchjobs;
}
@@ -533,7 +541,7 @@ static int gitmodule_oid_from_commit(const struct object_id *treeish_name,
}
strbuf_addf(rev, "%s:.gitmodules", oid_to_hex(treeish_name));
- if (get_oid(rev->buf, gitmodules_oid) >= 0)
+ if (repo_get_oid(the_repository, rev->buf, gitmodules_oid) >= 0)
ret = 1;
return ret;
@@ -586,7 +594,8 @@ static const struct submodule *config_from(struct submodule_cache *cache,
if (submodule)
goto out;
- config = read_object_file(&oid, &type, &config_size);
+ config = repo_read_object_file(the_repository, &oid, &type,
+ &config_size);
if (!config || type != OBJ_BLOB)
goto out;
diff --git a/submodule-config.h b/submodule-config.h
index 28a8ca6bf4..c2045875bb 100644
--- a/submodule-config.h
+++ b/submodule-config.h
@@ -1,7 +1,6 @@
#ifndef SUBMODULE_CONFIG_CACHE_H
#define SUBMODULE_CONFIG_CACHE_H
-#include "cache.h"
#include "config.h"
#include "hashmap.h"
#include "submodule.h"
diff --git a/submodule.c b/submodule.c
index bf7a2c7918..2e78f51349 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1,5 +1,6 @@
-
#include "cache.h"
+#include "abspath.h"
+#include "alloc.h"
#include "repository.h"
#include "config.h"
#include "submodule-config.h"
@@ -7,6 +8,9 @@
#include "dir.h"
#include "diff.h"
#include "commit.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "revision.h"
#include "run-command.h"
#include "diffcore.h"
@@ -20,9 +24,13 @@
#include "remote.h"
#include "worktree.h"
#include "parse-options.h"
+#include "object-file.h"
+#include "object-name.h"
#include "object-store.h"
#include "commit-reach.h"
+#include "setup.h"
#include "shallow.h"
+#include "trace2.h"
static int config_update_recurse_submodules = RECURSE_SUBMODULES_OFF;
static int initialized_fetch_ref_tips;
@@ -65,7 +73,7 @@ int is_writing_gitmodules_ok(void)
{
struct object_id oid;
return file_exists(GITMODULES_FILE) ||
- (get_oid(GITMODULES_INDEX, &oid) < 0 && get_oid(GITMODULES_HEAD, &oid) < 0);
+ (repo_get_oid(the_repository, GITMODULES_INDEX, &oid) < 0 && repo_get_oid(the_repository, GITMODULES_HEAD, &oid) < 0);
}
/*
@@ -274,8 +282,7 @@ int is_tree_submodule_active(struct repository *repo,
free(key);
/* submodule.active is set */
- sl = repo_config_get_value_multi(repo, "submodule.active");
- if (sl) {
+ if (!repo_config_get_string_multi(repo, "submodule.active", &sl)) {
struct pathspec ps;
struct strvec args = STRVEC_INIT;
const struct string_list_item *item;
@@ -832,7 +839,7 @@ static void changed_submodule_data_clear(struct changed_submodule_data *cs_data)
}
static void collect_changed_submodules_cb(struct diff_queue_struct *q,
- struct diff_options *options,
+ struct diff_options *options UNUSED,
void *data)
{
struct collect_changed_submodules_cb_data *me = data;
@@ -1130,6 +1137,12 @@ static int push_submodule(const char *path,
if (for_each_remote_ref_submodule(path, has_remote, NULL) > 0) {
struct child_process cp = CHILD_PROCESS_INIT;
strvec_push(&cp.args, "push");
+ /*
+ * When recursing into a submodule, treat any "only" configurations as "on-
+ * demand", since "only" would not work (we need all submodules to be pushed
+ * in order to be able to push the superproject).
+ */
+ strvec_push(&cp.args, "--recurse-submodules=only-is-on-demand");
if (dry_run)
strvec_push(&cp.args, "--dry-run");
@@ -1619,7 +1632,7 @@ get_fetch_task_from_changed(struct submodule_parallel_fetch *spf,
if (!task->repo) {
strbuf_addf(err, _("Could not access submodule '%s' at commit %s\n"),
cs_data->path,
- find_unique_abbrev(cs_data->super_oid, DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, cs_data->super_oid, DEFAULT_ABBREV));
fetch_task_release(task);
free(task);
@@ -1630,8 +1643,8 @@ get_fetch_task_from_changed(struct submodule_parallel_fetch *spf,
strbuf_addf(err,
_("Fetching submodule %s%s at commit %s\n"),
spf->prefix, task->sub->path,
- find_unique_abbrev(cs_data->super_oid,
- DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, cs_data->super_oid,
+ DEFAULT_ABBREV));
spf->changed_count++;
/*
@@ -1733,7 +1746,7 @@ static int get_next_submodule(struct child_process *cp, struct strbuf *err,
return 0;
}
-static int fetch_start_failure(struct strbuf *err,
+static int fetch_start_failure(struct strbuf *err UNUSED,
void *cb, void *task_cb)
{
struct submodule_parallel_fetch *spf = cb;
@@ -1754,7 +1767,7 @@ static int commit_missing_in_sub(const struct object_id *oid, void *data)
return type != OBJ_COMMIT;
}
-static int fetch_finish(int retvalue, struct strbuf *err,
+static int fetch_finish(int retvalue, struct strbuf *err UNUSED,
void *cb, void *task_cb)
{
struct submodule_parallel_fetch *spf = cb;
@@ -1819,6 +1832,17 @@ int fetch_submodules(struct repository *r,
{
int i;
struct submodule_parallel_fetch spf = SPF_INIT;
+ const struct run_process_parallel_opts opts = {
+ .tr2_category = "submodule",
+ .tr2_label = "parallel/fetch",
+
+ .processes = max_parallel_jobs,
+
+ .get_next_task = get_next_submodule,
+ .start_failure = fetch_start_failure,
+ .task_finished = fetch_finish,
+ .data = &spf,
+ };
spf.r = r;
spf.command_line_option = command_line_option;
@@ -1840,12 +1864,7 @@ int fetch_submodules(struct repository *r,
calculate_changed_submodule_paths(r, &spf.changed_submodule_names);
string_list_sort(&spf.changed_submodule_names);
- run_processes_parallel_tr2(max_parallel_jobs,
- get_next_submodule,
- fetch_start_failure,
- fetch_finish,
- &spf,
- "submodule", "parallel/fetch");
+ run_processes_parallel(&opts);
if (spf.submodules_with_errors.len > 0)
fprintf(stderr, _("Errors during submodule fetch:\n%s"),
@@ -2042,14 +2061,6 @@ void submodule_unset_core_worktree(const struct submodule *sub)
strbuf_release(&config_path);
}
-static const char *get_super_prefix_or_empty(void)
-{
- const char *s = get_super_prefix();
- if (!s)
- s = "";
- return s;
-}
-
static int submodule_has_dirty_index(const struct submodule *sub)
{
struct child_process cp = CHILD_PROCESS_INIT;
@@ -2068,7 +2079,7 @@ static int submodule_has_dirty_index(const struct submodule *sub)
return finish_command(&cp);
}
-static void submodule_reset_index(const char *path)
+static void submodule_reset_index(const char *path, const char *super_prefix)
{
struct child_process cp = CHILD_PROCESS_INIT;
prepare_submodule_repo_env(&cp.env);
@@ -2077,10 +2088,10 @@ static void submodule_reset_index(const char *path)
cp.no_stdin = 1;
cp.dir = path;
- strvec_pushf(&cp.args, "--super-prefix=%s%s/",
- get_super_prefix_or_empty(), path);
/* TODO: determine if this might overwright untracked files */
strvec_pushl(&cp.args, "read-tree", "-u", "--reset", NULL);
+ strvec_pushf(&cp.args, "--super-prefix=%s%s/",
+ (super_prefix ? super_prefix : ""), path);
strvec_push(&cp.args, empty_tree_oid_hex());
@@ -2093,10 +2104,9 @@ static void submodule_reset_index(const char *path)
* For edge cases (a submodule coming into existence or removing a submodule)
* pass NULL for old or new respectively.
*/
-int submodule_move_head(const char *path,
- const char *old_head,
- const char *new_head,
- unsigned flags)
+int submodule_move_head(const char *path, const char *super_prefix,
+ const char *old_head, const char *new_head,
+ unsigned flags)
{
int ret = 0;
struct child_process cp = CHILD_PROCESS_INIT;
@@ -2134,7 +2144,7 @@ int submodule_move_head(const char *path,
if (old_head) {
if (!submodule_uses_gitfile(path))
absorb_git_dir_into_superproject(path,
- ABSORB_GITDIR_RECURSE_SUBMODULES);
+ super_prefix);
} else {
struct strbuf gitdir = STRBUF_INIT;
submodule_name_to_gitdir(&gitdir, the_repository,
@@ -2143,7 +2153,7 @@ int submodule_move_head(const char *path,
strbuf_release(&gitdir);
/* make sure the index is clean as well */
- submodule_reset_index(path);
+ submodule_reset_index(path, super_prefix);
}
if (old_head && (flags & SUBMODULE_MOVE_HEAD_FORCE)) {
@@ -2161,9 +2171,9 @@ int submodule_move_head(const char *path,
cp.no_stdin = 1;
cp.dir = path;
- strvec_pushf(&cp.args, "--super-prefix=%s%s/",
- get_super_prefix_or_empty(), path);
strvec_pushl(&cp.args, "read-tree", "--recurse-submodules", NULL);
+ strvec_pushf(&cp.args, "--super-prefix=%s%s/",
+ (super_prefix ? super_prefix : ""), path);
if (flags & SUBMODULE_MOVE_HEAD_DRY_RUN)
strvec_push(&cp.args, "-n");
@@ -2263,7 +2273,8 @@ int validate_submodule_git_dir(char *git_dir, const char *submodule_name)
* Embeds a single submodules git directory into the superprojects git dir,
* non recursively.
*/
-static void relocate_single_git_dir_into_superproject(const char *path)
+static void relocate_single_git_dir_into_superproject(const char *path,
+ const char *super_prefix)
{
char *old_git_dir = NULL, *real_old_git_dir = NULL, *real_new_git_dir = NULL;
struct strbuf new_gitdir = STRBUF_INIT;
@@ -2293,7 +2304,7 @@ static void relocate_single_git_dir_into_superproject(const char *path)
real_new_git_dir = real_pathdup(new_gitdir.buf, 1);
fprintf(stderr, _("Migrating git directory of '%s%s' from\n'%s' to\n'%s'\n"),
- get_super_prefix_or_empty(), path,
+ super_prefix ? super_prefix : "", path,
real_old_git_dir, real_new_git_dir);
relocate_gitdir(path, real_old_git_dir, real_new_git_dir);
@@ -2304,13 +2315,32 @@ static void relocate_single_git_dir_into_superproject(const char *path)
strbuf_release(&new_gitdir);
}
+static void absorb_git_dir_into_superproject_recurse(const char *path,
+ const char *super_prefix)
+{
+
+ struct child_process cp = CHILD_PROCESS_INIT;
+
+ cp.dir = path;
+ cp.git_cmd = 1;
+ cp.no_stdin = 1;
+ strvec_pushl(&cp.args, "submodule--helper",
+ "absorbgitdirs", NULL);
+ strvec_pushf(&cp.args, "--super-prefix=%s%s/", super_prefix ?
+ super_prefix : "", path);
+
+ prepare_submodule_repo_env(&cp.env);
+ if (run_command(&cp))
+ die(_("could not recurse into submodule '%s'"), path);
+}
+
/*
* Migrate the git directory of the submodule given by path from
* having its git directory within the working tree to the git dir nested
* in its superprojects git dir under modules/.
*/
void absorb_git_dir_into_superproject(const char *path,
- unsigned flags)
+ const char *super_prefix)
{
int err_code;
const char *sub_git_dir;
@@ -2352,36 +2382,14 @@ void absorb_git_dir_into_superproject(const char *path,
char *real_common_git_dir = real_pathdup(get_git_common_dir(), 1);
if (!starts_with(real_sub_git_dir, real_common_git_dir))
- relocate_single_git_dir_into_superproject(path);
+ relocate_single_git_dir_into_superproject(path, super_prefix);
free(real_sub_git_dir);
free(real_common_git_dir);
}
strbuf_release(&gitdir);
- if (flags & ABSORB_GITDIR_RECURSE_SUBMODULES) {
- struct child_process cp = CHILD_PROCESS_INIT;
- struct strbuf sb = STRBUF_INIT;
-
- if (flags & ~ABSORB_GITDIR_RECURSE_SUBMODULES)
- BUG("we don't know how to pass the flags down?");
-
- strbuf_addstr(&sb, get_super_prefix_or_empty());
- strbuf_addstr(&sb, path);
- strbuf_addch(&sb, '/');
-
- cp.dir = path;
- cp.git_cmd = 1;
- cp.no_stdin = 1;
- strvec_pushl(&cp.args, "--super-prefix", sb.buf,
- "submodule--helper",
- "absorbgitdirs", NULL);
- prepare_submodule_repo_env(&cp.env);
- if (run_command(&cp))
- die(_("could not recurse into submodule '%s'"), path);
-
- strbuf_release(&sb);
- }
+ absorb_git_dir_into_superproject_recurse(path, super_prefix);
}
int get_superproject_working_tree(struct strbuf *buf)
diff --git a/submodule.h b/submodule.h
index 6a9fec6de1..c55a25ca37 100644
--- a/submodule.h
+++ b/submodule.h
@@ -150,9 +150,8 @@ int validate_submodule_git_dir(char *git_dir, const char *submodule_name);
#define SUBMODULE_MOVE_HEAD_DRY_RUN (1<<0)
#define SUBMODULE_MOVE_HEAD_FORCE (1<<1)
-int submodule_move_head(const char *path,
- const char *old,
- const char *new_head,
+int submodule_move_head(const char *path, const char *super_prefix,
+ const char *old_head, const char *new_head,
unsigned flags);
void submodule_unset_core_worktree(const struct submodule *sub);
@@ -164,9 +163,8 @@ void submodule_unset_core_worktree(const struct submodule *sub);
*/
void prepare_submodule_repo_env(struct strvec *env);
-#define ABSORB_GITDIR_RECURSE_SUBMODULES (1<<0)
void absorb_git_dir_into_superproject(const char *path,
- unsigned flags);
+ const char *super_prefix);
/*
* Return the absolute path of the working tree of the superproject, which this
diff --git a/symlinks.c b/symlinks.c
index c667baa949..b29e340c2d 100644
--- a/symlinks.c
+++ b/symlinks.c
@@ -1,4 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
+#include "setup.h"
+#include "symlinks.h"
static int threaded_check_leading_path(struct cache_def *cache, const char *name,
int len, int warn_on_lstat_err);
diff --git a/symlinks.h b/symlinks.h
new file mode 100644
index 0000000000..7ae3d5b856
--- /dev/null
+++ b/symlinks.h
@@ -0,0 +1,28 @@
+#ifndef SYMLINKS_H
+#define SYMLINKS_H
+
+#include "strbuf.h"
+
+struct cache_def {
+ struct strbuf path;
+ int flags;
+ int track_flags;
+ int prefix_len_stat_func;
+};
+#define CACHE_DEF_INIT { \
+ .path = STRBUF_INIT, \
+}
+static inline void cache_def_clear(struct cache_def *cache)
+{
+ strbuf_release(&cache->path);
+}
+
+int has_symlink_leading_path(const char *name, int len);
+int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);
+int check_leading_path(const char *name, int len, int warn_on_lstat_err);
+int has_dirs_only_path(const char *name, int len, int prefix_len);
+void invalidate_lstat_cache(void);
+void schedule_dir_for_removal(const char *name, int len);
+void remove_scheduled_dirs(void);
+
+#endif /* SYMLINKS_H */
diff --git a/t/Makefile b/t/Makefile
index 882782a519..3e00cdd801 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -44,8 +44,8 @@ CHAINLINT = '$(PERL_PATH_SQ)' chainlint.pl
# `test-chainlint` (which is a dependency of `test-lint`, `test` and `prove`)
# checks all tests in all scripts via a single invocation, so tell individual
-# scripts not to "chainlint" themselves
-CHAINLINTSUPPRESS = GIT_TEST_CHAIN_LINT=0 && export GIT_TEST_CHAIN_LINT &&
+# scripts not to run the external "chainlint.pl" script themselves
+CHAINLINTSUPPRESS = GIT_TEST_EXT_CHAIN_LINT=0 && export GIT_TEST_EXT_CHAIN_LINT &&
all: $(DEFAULT_TEST_TARGET)
@@ -94,7 +94,7 @@ check-chainlint:
done \
} >'$(CHAINLINTTMP_SQ)'/expect && \
$(CHAINLINT) --emit-all '$(CHAINLINTTMP_SQ)'/tests | \
- grep -v '^[ ]*$$' >'$(CHAINLINTTMP_SQ)'/actual && \
+ sed -e 's/^[1-9][0-9]* //;/^[ ]*$$/d' >'$(CHAINLINTTMP_SQ)'/actual && \
if test -f ../GIT-BUILD-OPTIONS; then \
. ../GIT-BUILD-OPTIONS; \
fi && \
@@ -140,9 +140,7 @@ aggregate-results-and-cleanup: $(T)
$(MAKE) clean
aggregate-results:
- for f in '$(TEST_RESULTS_DIRECTORY_SQ)'/t*-*.counts; do \
- echo "$$f"; \
- done | '$(SHELL_PATH_SQ)' ./aggregate-results.sh
+ @'$(SHELL_PATH_SQ)' ./aggregate-results.sh '$(TEST_RESULTS_DIRECTORY_SQ)'
valgrind:
$(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind"
diff --git a/t/README b/t/README
index 979b2d4833..bdfac4cceb 100644
--- a/t/README
+++ b/t/README
@@ -449,10 +449,6 @@ the --sparse command-line argument.
GIT_TEST_PRELOAD_INDEX=<boolean> exercises the preload-index code path
by overriding the minimum number of cache entries required per thread.
-GIT_TEST_ADD_I_USE_BUILTIN=<boolean>, when false, disables the
-built-in version of git add -i. See 'add.interactive.useBuiltin' in
-git-config(1).
-
GIT_TEST_INDEX_THREADS=<n> enables exercising the multi-threaded loading
of the index for the whole test suite by bypassing the default number of
cache entries and thread minimums. Setting this to 1 will make the
@@ -479,7 +475,7 @@ GIT_TEST_DEFAULT_HASH=<hash-algo> specifies which hash algorithm to
use in the test scripts. Recognized values for <hash-algo> are "sha1"
and "sha256".
-GIT_TEST_WRITE_REV_INDEX=<boolean>, when true enables the
+GIT_TEST_NO_WRITE_REV_INDEX=<boolean>, when true disables the
'pack.writeReverseIndex' setting.
GIT_TEST_SPARSE_INDEX=<boolean>, when true enables index writes to use the
diff --git a/t/aggregate-results.sh b/t/aggregate-results.sh
index 7f2b83bdc8..6e3bcc4aec 100755
--- a/t/aggregate-results.sh
+++ b/t/aggregate-results.sh
@@ -8,7 +8,7 @@ broken=0
total=0
missing_prereq=
-while read file
+for file in "$1"/t*-*.counts
do
while read type value
do
diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
index f1b9a6ce4d..2ef70235b1 100644
--- a/t/annotate-tests.sh
+++ b/t/annotate-tests.sh
@@ -72,6 +72,23 @@ test_expect_success 'blame 1 author' '
check_count A 2
'
+test_expect_success 'blame working copy' '
+ test_when_finished "git restore file" &&
+ echo "1A quick brown fox jumps over the" >file &&
+ echo "another lazy dog" >>file &&
+ check_count A 1 "Not Committed Yet" 1
+'
+
+test_expect_success 'blame with --contents' '
+ check_count --contents=file A 2
+'
+
+test_expect_success 'blame with --contents changed' '
+ echo "1A quick brown fox jumps over the" >contents &&
+ echo "another lazy dog" >>contents &&
+ check_count --contents=contents A 1 "External file (--contents)" 1
+'
+
test_expect_success 'blame in a bare repo without starting commit' '
git clone --bare . bare.git &&
(
@@ -98,6 +115,10 @@ test_expect_success 'blame 2 authors' '
check_count A 2 B 2
'
+test_expect_success 'blame with --contents and revision' '
+ check_count -h testTag --contents=file A 2 "External file (--contents)" 2
+'
+
test_expect_success 'setup B1 lines (branch1)' '
git checkout -b branch1 main &&
echo "3A slow green fox jumps into the" >>file &&
diff --git a/t/chainlint.pl b/t/chainlint.pl
index 976db4b8a0..556ee91a15 100755
--- a/t/chainlint.pl
+++ b/t/chainlint.pl
@@ -67,6 +67,7 @@ sub new {
bless {
parser => $parser,
buff => $s,
+ lineno => 1,
heretags => []
} => $class;
}
@@ -75,9 +76,12 @@ sub scan_heredoc_tag {
my $self = shift @_;
${$self->{buff}} =~ /\G(-?)/gc;
my $indented = $1;
- my $tag = $self->scan_token();
+ my $token = $self->scan_token();
+ return "<<$indented" unless $token;
+ my $tag = $token->[0];
$tag =~ s/['"\\]//g;
- push(@{$self->{heretags}}, $indented ? "\t$tag" : "$tag");
+ $$token[0] = $indented ? "\t$tag" : "$tag";
+ push(@{$self->{heretags}}, $token);
return "<<$indented$tag";
}
@@ -95,7 +99,9 @@ sub scan_op {
sub scan_sqstring {
my $self = shift @_;
${$self->{buff}} =~ /\G([^']*'|.*\z)/sgc;
- return "'" . $1;
+ my $s = $1;
+ $self->{lineno} += () = $s =~ /\n/sg;
+ return "'" . $s;
}
sub scan_dqstring {
@@ -113,7 +119,7 @@ sub scan_dqstring {
if ($c eq '\\') {
$s .= '\\', last unless $$b =~ /\G(.)/sgc;
$c = $1;
- next if $c eq "\n"; # line splice
+ $self->{lineno}++, next if $c eq "\n"; # line splice
# backslash escapes only $, `, ", \ in dq-string
$s .= '\\' unless $c =~ /^[\$`"\\]$/;
$s .= $c;
@@ -121,6 +127,7 @@ sub scan_dqstring {
}
die("internal error scanning dq-string '$c'\n");
}
+ $self->{lineno} += () = $s =~ /\n/sg;
return $s;
}
@@ -135,6 +142,7 @@ sub scan_balanced {
$depth--;
last if $depth == 0;
}
+ $self->{lineno} += () = $s =~ /\n/sg;
return $s;
}
@@ -149,7 +157,7 @@ sub scan_dollar {
my $self = shift @_;
my $b = $self->{buff};
return $self->scan_balanced('(', ')') if $$b =~ /\G\((?=\()/gc; # $((...))
- return '(' . join(' ', $self->scan_subst()) . ')' if $$b =~ /\G\(/gc; # $(...)
+ return '(' . join(' ', map {$_->[0]} $self->scan_subst()) . ')' if $$b =~ /\G\(/gc; # $(...)
return $self->scan_balanced('{', '}') if $$b =~ /\G\{/gc; # ${...}
return $1 if $$b =~ /\G(\w+)/gc; # $var
return $1 if $$b =~ /\G([@*#?$!0-9-])/gc; # $*, $1, $$, etc.
@@ -161,8 +169,19 @@ sub swallow_heredocs {
my $b = $self->{buff};
my $tags = $self->{heretags};
while (my $tag = shift @$tags) {
- my $indent = $tag =~ s/^\t// ? '\\s*' : '';
- $$b =~ /(?:\G|\n)$indent\Q$tag\E(?:\n|\z)/gc;
+ my $start = pos($$b);
+ my $indent = $$tag[0] =~ s/^\t// ? '\\s*' : '';
+ $$b =~ /(?:\G|\n)$indent\Q$$tag[0]\E(?:\n|\z)/gc;
+ if (pos($$b) > $start) {
+ my $body = substr($$b, $start, pos($$b) - $start);
+ $self->{lineno} += () = $body =~ /\n/sg;
+ next;
+ }
+ push(@{$self->{parser}->{problems}}, ['UNCLOSED-HEREDOC', $tag]);
+ $$b =~ /(?:\G|\n).*\z/gc; # consume rest of input
+ my $body = substr($$b, $start, pos($$b) - $start);
+ $self->{lineno} += () = $body =~ /\n/sg;
+ last;
}
}
@@ -170,34 +189,37 @@ sub scan_token {
my $self = shift @_;
my $b = $self->{buff};
my $token = '';
+ my ($start, $startln);
RESTART:
+ $startln = $self->{lineno};
$$b =~ /\G[ \t]+/gc; # skip whitespace (but not newline)
- return "\n" if $$b =~ /\G#[^\n]*(?:\n|\z)/gc; # comment
+ $start = pos($$b) || 0;
+ $self->{lineno}++, return ["\n", $start, pos($$b), $startln, $startln] if $$b =~ /\G#[^\n]*(?:\n|\z)/gc; # comment
while (1) {
# slurp up non-special characters
$token .= $1 if $$b =~ /\G([^\\;&|<>(){}'"\$\s]+)/gc;
# handle special characters
last unless $$b =~ /\G(.)/sgc;
my $c = $1;
- last if $c =~ /^[ \t]$/; # whitespace ends token
+ pos($$b)--, last if $c =~ /^[ \t]$/; # whitespace ends token
pos($$b)--, last if length($token) && $c =~ /^[;&|<>(){}\n]$/;
$token .= $self->scan_sqstring(), next if $c eq "'";
$token .= $self->scan_dqstring(), next if $c eq '"';
$token .= $c . $self->scan_dollar(), next if $c eq '$';
- $self->swallow_heredocs(), $token = $c, last if $c eq "\n";
+ $self->{lineno}++, $self->swallow_heredocs(), $token = $c, last if $c eq "\n";
$token = $self->scan_op($c), last if $c =~ /^[;&|<>]$/;
$token = $c, last if $c =~ /^[(){}]$/;
if ($c eq '\\') {
$token .= '\\', last unless $$b =~ /\G(.)/sgc;
$c = $1;
- next if $c eq "\n" && length($token); # line splice
- goto RESTART if $c eq "\n"; # line splice
+ $self->{lineno}++, next if $c eq "\n" && length($token); # line splice
+ $self->{lineno}++, goto RESTART if $c eq "\n"; # line splice
$token .= '\\' . $c;
next;
}
die("internal error scanning character '$c'\n");
}
- return length($token) ? $token : undef;
+ return length($token) ? [$token, $start, pos($$b), $startln, $self->{lineno}] : undef;
}
# ShellParser parses POSIX shell scripts (with minor extensions for Bash). It
@@ -239,14 +261,14 @@ sub stop_at {
my ($self, $token) = @_;
return 1 unless defined($token);
my $stop = ${$self->{stop}}[-1] if @{$self->{stop}};
- return defined($stop) && $token =~ $stop;
+ return defined($stop) && $token->[0] =~ $stop;
}
sub expect {
my ($self, $expect) = @_;
my $token = $self->next_token();
- return $token if defined($token) && $token eq $expect;
- push(@{$self->{output}}, "?!ERR?! expected '$expect' but found '" . (defined($token) ? $token : "<end-of-input>") . "'\n");
+ return $token if defined($token) && $token->[0] eq $expect;
+ push(@{$self->{output}}, "?!ERR?! expected '$expect' but found '" . (defined($token) ? $token->[0] : "<end-of-input>") . "'\n");
$self->untoken($token) if defined($token);
return ();
}
@@ -255,7 +277,7 @@ sub optional_newlines {
my $self = shift @_;
my @tokens;
while (my $token = $self->peek()) {
- last unless $token eq "\n";
+ last unless $token->[0] eq "\n";
push(@tokens, $self->next_token());
}
return @tokens;
@@ -278,7 +300,7 @@ sub parse_case_pattern {
my @tokens;
while (defined(my $token = $self->next_token())) {
push(@tokens, $token);
- last if $token eq ')';
+ last if $token->[0] eq ')';
}
return @tokens;
}
@@ -293,13 +315,13 @@ sub parse_case {
$self->optional_newlines());
while (1) {
my $token = $self->peek();
- last unless defined($token) && $token ne 'esac';
+ last unless defined($token) && $token->[0] ne 'esac';
push(@tokens,
$self->parse_case_pattern(),
$self->optional_newlines(),
$self->parse(qr/^(?:;;|esac)$/)); # item body
$token = $self->peek();
- last unless defined($token) && $token ne 'esac';
+ last unless defined($token) && $token->[0] ne 'esac';
push(@tokens,
$self->expect(';;'),
$self->optional_newlines());
@@ -315,7 +337,7 @@ sub parse_for {
$self->next_token(), # variable
$self->optional_newlines());
my $token = $self->peek();
- if (defined($token) && $token eq 'in') {
+ if (defined($token) && $token->[0] eq 'in') {
push(@tokens,
$self->expect('in'),
$self->optional_newlines());
@@ -339,11 +361,11 @@ sub parse_if {
$self->optional_newlines(),
$self->parse(qr/^(?:elif|else|fi)$/)); # if/elif body
my $token = $self->peek();
- last unless defined($token) && $token eq 'elif';
+ last unless defined($token) && $token->[0] eq 'elif';
push(@tokens, $self->expect('elif'));
}
my $token = $self->peek();
- if (defined($token) && $token eq 'else') {
+ if (defined($token) && $token->[0] eq 'else') {
push(@tokens,
$self->expect('else'),
$self->optional_newlines(),
@@ -380,7 +402,7 @@ sub parse_bash_array_assignment {
my @tokens = $self->expect('(');
while (defined(my $token = $self->next_token())) {
push(@tokens, $token);
- last if $token eq ')';
+ last if $token->[0] eq ')';
}
return @tokens;
}
@@ -398,29 +420,31 @@ sub parse_cmd {
my $self = shift @_;
my $cmd = $self->next_token();
return () unless defined($cmd);
- return $cmd if $cmd eq "\n";
+ return $cmd if $cmd->[0] eq "\n";
my $token;
my @tokens = $cmd;
- if ($cmd eq '!') {
+ if ($cmd->[0] eq '!') {
push(@tokens, $self->parse_cmd());
return @tokens;
- } elsif (my $f = $compound{$cmd}) {
+ } elsif (my $f = $compound{$cmd->[0]}) {
push(@tokens, $self->$f());
- } elsif (defined($token = $self->peek()) && $token eq '(') {
- if ($cmd !~ /\w=$/) {
+ } elsif (defined($token = $self->peek()) && $token->[0] eq '(') {
+ if ($cmd->[0] !~ /\w=$/) {
push(@tokens, $self->parse_func());
return @tokens;
}
- $tokens[-1] .= join(' ', $self->parse_bash_array_assignment());
+ my @array = $self->parse_bash_array_assignment();
+ $tokens[-1]->[0] .= join(' ', map {$_->[0]} @array);
+ $tokens[-1]->[2] = $array[$#array][2] if @array;
}
while (defined(my $token = $self->next_token())) {
$self->untoken($token), last if $self->stop_at($token);
push(@tokens, $token);
- last if $token =~ /^(?:[;&\n|]|&&|\|\|)$/;
+ last if $token->[0] =~ /^(?:[;&\n|]|&&|\|\|)$/;
}
- push(@tokens, $self->next_token()) if $tokens[-1] ne "\n" && defined($token = $self->peek()) && $token eq "\n";
+ push(@tokens, $self->next_token()) if $tokens[-1]->[0] ne "\n" && defined($token = $self->peek()) && $token->[0] eq "\n";
return @tokens;
}
@@ -453,11 +477,18 @@ package TestParser;
use base 'ShellParser';
+sub new {
+ my $class = shift @_;
+ my $self = $class->SUPER::new(@_);
+ $self->{problems} = [];
+ return $self;
+}
+
sub find_non_nl {
my $tokens = shift @_;
my $n = shift @_;
$n = $#$tokens if !defined($n);
- $n-- while $n >= 0 && $$tokens[$n] eq "\n";
+ $n-- while $n >= 0 && $$tokens[$n]->[0] eq "\n";
return $n;
}
@@ -467,7 +498,7 @@ sub ends_with {
for my $needle (reverse(@$needles)) {
return undef if $n < 0;
$n = find_non_nl($tokens, $n), next if $needle eq "\n";
- return undef if $$tokens[$n] !~ $needle;
+ return undef if $$tokens[$n]->[0] !~ $needle;
$n--;
}
return 1;
@@ -486,13 +517,13 @@ sub parse_loop_body {
my $self = shift @_;
my @tokens = $self->SUPER::parse_loop_body(@_);
# did loop signal failure via "|| return" or "|| exit"?
- return @tokens if !@tokens || grep(/^(?:return|exit|\$\?)$/, @tokens);
+ return @tokens if !@tokens || grep {$_->[0] =~ /^(?:return|exit|\$\?)$/} @tokens;
# did loop upstream of a pipe signal failure via "|| echo 'impossible
# text'" as the final command in the loop body?
return @tokens if ends_with(\@tokens, [qr/^\|\|$/, "\n", qr/^echo$/, qr/^.+$/]);
# flag missing "return/exit" handling explicit failure in loop body
my $n = find_non_nl(\@tokens);
- splice(@tokens, $n + 1, 0, '?!LOOP?!');
+ push(@{$self->{problems}}, ['LOOP', $tokens[$n]]);
return @tokens;
}
@@ -505,8 +536,13 @@ my @safe_endings = (
sub accumulate {
my ($self, $tokens, $cmd) = @_;
+ my $problems = $self->{problems};
+
+ # no previous command to check for missing "&&"
goto DONE unless @$tokens;
- goto DONE if @$cmd == 1 && $$cmd[0] eq "\n";
+
+ # new command is empty line; can't yet check if previous is missing "&&"
+ goto DONE if @$cmd == 1 && $$cmd[0]->[0] eq "\n";
# did previous command end with "&&", "|", "|| return" or similar?
goto DONE if match_ending($tokens, \@safe_endings);
@@ -514,20 +550,20 @@ sub accumulate {
# if this command handles "$?" specially, then okay for previous
# command to be missing "&&"
for my $token (@$cmd) {
- goto DONE if $token =~ /\$\?/;
+ goto DONE if $token->[0] =~ /\$\?/;
}
# if this command is "false", "return 1", or "exit 1" (which signal
# failure explicitly), then okay for all preceding commands to be
# missing "&&"
- if ($$cmd[0] =~ /^(?:false|return|exit)$/) {
- @$tokens = grep(!/^\?!AMP\?!$/, @$tokens);
+ if ($$cmd[0]->[0] =~ /^(?:false|return|exit)$/) {
+ @$problems = grep {$_->[0] ne 'AMP'} @$problems;
goto DONE;
}
# flag missing "&&" at end of previous command
my $n = find_non_nl($tokens);
- splice(@$tokens, $n + 1, 0, '?!AMP?!') unless $n < 0;
+ push(@$problems, ['AMP', $tokens->[$n]]) unless $n < 0;
DONE:
$self->SUPER::accumulate($tokens, $cmd);
@@ -553,7 +589,7 @@ sub new {
# composition of multiple strings and non-string character runs; for instance,
# `"test body"` unwraps to `test body`; `word"a b"42'c d'` to `worda b42c d`
sub unwrap {
- my $token = @_ ? shift @_ : $_;
+ my $token = (@_ ? shift @_ : $_)->[0];
# simple case: 'sqstring' or "dqstring"
return $token if $token =~ s/^'([^']*)'$/$1/;
return $token if $token =~ s/^"([^"]*)"$/$1/;
@@ -584,13 +620,25 @@ sub check_test {
$self->{ntests}++;
my $parser = TestParser->new(\$body);
my @tokens = $parser->parse();
- return unless $emit_all || grep(/\?![^?]+\?!/, @tokens);
+ my $problems = $parser->{problems};
+ return unless $emit_all || @$problems;
my $c = main::fd_colors(1);
- my $checked = join(' ', @tokens);
- $checked =~ s/^\n//;
- $checked =~ s/^ //mg;
- $checked =~ s/ $//mg;
+ my $lineno = $_[1]->[3];
+ my $start = 0;
+ my $checked = '';
+ for (sort {$a->[1]->[2] <=> $b->[1]->[2]} @$problems) {
+ my ($label, $token) = @$_;
+ my $pos = $token->[2];
+ $checked .= substr($body, $start, $pos - $start) . " ?!$label?! ";
+ $start = $pos;
+ }
+ $checked .= substr($body, $start);
+ $checked =~ s/^/$lineno++ . ' '/mge;
+ $checked =~ s/^\d+ \n//;
+ $checked =~ s/(\s) \?!/$1?!/mg;
+ $checked =~ s/\?! (\s)/?!$1/mg;
$checked =~ s/(\?![^?]+\?!)/$c->{rev}$c->{red}$1$c->{reset}/mg;
+ $checked =~ s/^\d+/$c->{dim}$&$c->{reset}/mg;
$checked .= "\n" unless $checked =~ /\n$/;
push(@{$self->{output}}, "$c->{blue}# chainlint: $title$c->{reset}\n$checked");
}
@@ -598,9 +646,9 @@ sub check_test {
sub parse_cmd {
my $self = shift @_;
my @tokens = $self->SUPER::parse_cmd();
- return @tokens unless @tokens && $tokens[0] =~ /^test_expect_(?:success|failure)$/;
+ return @tokens unless @tokens && $tokens[0]->[0] =~ /^test_expect_(?:success|failure)$/;
my $n = $#tokens;
- $n-- while $n >= 0 && $tokens[$n] =~ /^(?:[;&\n|]|&&|\|\|)$/;
+ $n-- while $n >= 0 && $tokens[$n]->[0] =~ /^(?:[;&\n|]|&&|\|\|)$/;
$self->check_test($tokens[1], $tokens[2]) if $n == 2; # title body
$self->check_test($tokens[2], $tokens[3]) if $n > 2; # prereq title body
return @tokens;
@@ -622,25 +670,39 @@ if (eval {require Time::HiRes; Time::HiRes->import(); 1;}) {
# thread and ignore %ENV changes in subthreads.
$ENV{TERM} = $ENV{USER_TERM} if $ENV{USER_TERM};
-my @NOCOLORS = (bold => '', rev => '', reset => '', blue => '', green => '', red => '');
+my @NOCOLORS = (bold => '', rev => '', dim => '', reset => '', blue => '', green => '', red => '');
my %COLORS = ();
sub get_colors {
return \%COLORS if %COLORS;
- if (exists($ENV{NO_COLOR}) ||
- system("tput sgr0 >/dev/null 2>&1") != 0 ||
- system("tput bold >/dev/null 2>&1") != 0 ||
- system("tput rev >/dev/null 2>&1") != 0 ||
- system("tput setaf 1 >/dev/null 2>&1") != 0) {
+ if (exists($ENV{NO_COLOR})) {
%COLORS = @NOCOLORS;
return \%COLORS;
}
- %COLORS = (bold => `tput bold`,
- rev => `tput rev`,
- reset => `tput sgr0`,
- blue => `tput setaf 4`,
- green => `tput setaf 2`,
- red => `tput setaf 1`);
- chomp(%COLORS);
+ if ($ENV{TERM} =~ /xterm|xterm-\d+color|xterm-new|xterm-direct|nsterm|nsterm-\d+color|nsterm-direct/) {
+ %COLORS = (bold => "\e[1m",
+ rev => "\e[7m",
+ dim => "\e[2m",
+ reset => "\e[0m",
+ blue => "\e[34m",
+ green => "\e[32m",
+ red => "\e[31m");
+ return \%COLORS;
+ }
+ if (system("tput sgr0 >/dev/null 2>&1") == 0 &&
+ system("tput bold >/dev/null 2>&1") == 0 &&
+ system("tput rev >/dev/null 2>&1") == 0 &&
+ system("tput dim >/dev/null 2>&1") == 0 &&
+ system("tput setaf 1 >/dev/null 2>&1") == 0) {
+ %COLORS = (bold => `tput bold`,
+ rev => `tput rev`,
+ dim => `tput dim`,
+ reset => `tput sgr0`,
+ blue => `tput setaf 4`,
+ green => `tput setaf 2`,
+ red => `tput setaf 1`);
+ return \%COLORS;
+ }
+ %COLORS = @NOCOLORS;
return \%COLORS;
}
@@ -656,7 +718,7 @@ sub ncores {
# Windows
return $ENV{NUMBER_OF_PROCESSORS} if exists($ENV{NUMBER_OF_PROCESSORS});
# Linux / MSYS2 / Cygwin / WSL
- do { local @ARGV='/proc/cpuinfo'; return scalar(grep(/^processor\s*:/, <>)); } if -r '/proc/cpuinfo';
+ do { local @ARGV='/proc/cpuinfo'; return scalar(grep(/^processor[\s\d]*:/, <>)); } if -r '/proc/cpuinfo';
# macOS & BSD
return qx/sysctl -n hw.ncpu/ if $^O =~ /(?:^darwin$|bsd)/;
return 1;
diff --git a/t/chainlint/block-comment.expect b/t/chainlint/block-comment.expect
index d10b2eeaf2..df2beea888 100644
--- a/t/chainlint/block-comment.expect
+++ b/t/chainlint/block-comment.expect
@@ -1,6 +1,8 @@
(
{
+ # show a
echo a &&
+ # show b
echo b
}
)
diff --git a/t/chainlint/case-comment.expect b/t/chainlint/case-comment.expect
index 1e4b054bda..641c157b98 100644
--- a/t/chainlint/case-comment.expect
+++ b/t/chainlint/case-comment.expect
@@ -1,7 +1,10 @@
(
case "$x" in
+ # found foo
x) foo ;;
+ # found other
*)
+ # treat it as bar
bar
;;
esac
diff --git a/t/chainlint/close-subshell.expect b/t/chainlint/close-subshell.expect
index 0f87db9ae6..2192a2870a 100644
--- a/t/chainlint/close-subshell.expect
+++ b/t/chainlint/close-subshell.expect
@@ -15,7 +15,8 @@
) | wuzzle &&
(
bop
-) | fazz fozz &&
+) | fazz \
+ fozz &&
(
bup
) |
diff --git a/t/chainlint/comment.expect b/t/chainlint/comment.expect
index f76fde1ffb..a68f1f9d7c 100644
--- a/t/chainlint/comment.expect
+++ b/t/chainlint/comment.expect
@@ -1,4 +1,8 @@
(
+ # comment 1
nothing &&
+ # comment 2
something
+ # comment 3
+ # comment 4
)
diff --git a/t/chainlint/double-here-doc.expect b/t/chainlint/double-here-doc.expect
index 75477bb1ad..cd584a4357 100644
--- a/t/chainlint/double-here-doc.expect
+++ b/t/chainlint/double-here-doc.expect
@@ -1,2 +1,12 @@
-run_sub_test_lib_test_err run-inv-range-start "--run invalid range start" --run="a-5" <<-EOF &&
-check_sub_test_lib_test_err run-inv-range-start <<-EOF_OUT 3 <<-EOF_ERR
+run_sub_test_lib_test_err run-inv-range-start \
+ "--run invalid range start" \
+ --run="a-5" <<-\EOF &&
+test_expect_success "passing test #1" "true"
+test_done
+EOF
+check_sub_test_lib_test_err run-inv-range-start \
+ <<-\EOF_OUT 3<<-EOF_ERR
+> FATAL: Unexpected exit with code 1
+EOF_OUT
+> error: --run: invalid non-numeric in range start: ${SQ}a-5${SQ}
+EOF_ERR
diff --git a/t/chainlint/empty-here-doc.expect b/t/chainlint/empty-here-doc.expect
index f42f2d41ba..e8733c97c6 100644
--- a/t/chainlint/empty-here-doc.expect
+++ b/t/chainlint/empty-here-doc.expect
@@ -1,3 +1,4 @@
git ls-tree $tree path > current &&
-cat > expected <<EOF &&
+cat > expected <<\EOF &&
+EOF
test_output
diff --git a/t/chainlint/for-loop.expect b/t/chainlint/for-loop.expect
index a5810c9bdd..d65c82129a 100644
--- a/t/chainlint/for-loop.expect
+++ b/t/chainlint/for-loop.expect
@@ -2,7 +2,9 @@
for i in a b c
do
echo $i ?!AMP?!
- cat <<-EOF ?!LOOP?!
+ cat <<-\EOF ?!LOOP?!
+ bar
+ EOF
done ?!AMP?!
for i in a b c; do
echo $i &&
diff --git a/t/chainlint/here-doc-close-subshell.expect b/t/chainlint/here-doc-close-subshell.expect
index 2af9ced71c..7d9c2b5607 100644
--- a/t/chainlint/here-doc-close-subshell.expect
+++ b/t/chainlint/here-doc-close-subshell.expect
@@ -1,2 +1,4 @@
(
- cat <<-INPUT)
+ cat <<-\INPUT)
+ fizz
+ INPUT
diff --git a/t/chainlint/here-doc-indent-operator.expect b/t/chainlint/here-doc-indent-operator.expect
index fb6cf7285d..f92a7ce999 100644
--- a/t/chainlint/here-doc-indent-operator.expect
+++ b/t/chainlint/here-doc-indent-operator.expect
@@ -1,5 +1,11 @@
-cat > expect <<-EOF &&
+cat >expect <<- EOF &&
+header: 43475048 1 $(test_oid oid_version) $NUM_CHUNKS 0
+num_commits: $1
+chunks: oid_fanout oid_lookup commit_metadata generation_data bloom_indexes bloom_data
+EOF
-cat > expect <<-EOF ?!AMP?!
+cat >expect << -EOF ?!AMP?!
+this is not indented
+-EOF
cleanup
diff --git a/t/chainlint/here-doc-multi-line-command-subst.expect b/t/chainlint/here-doc-multi-line-command-subst.expect
index f8b3aa73c4..b7364c82c8 100644
--- a/t/chainlint/here-doc-multi-line-command-subst.expect
+++ b/t/chainlint/here-doc-multi-line-command-subst.expect
@@ -1,5 +1,8 @@
(
- x=$(bobble <<-END &&
+ x=$(bobble <<-\END &&
+ fossil
+ vegetable
+ END
wiffle) ?!AMP?!
echo $x
)
diff --git a/t/chainlint/here-doc-multi-line-string.expect b/t/chainlint/here-doc-multi-line-string.expect
index be64b26869..6c13bdcbfb 100644
--- a/t/chainlint/here-doc-multi-line-string.expect
+++ b/t/chainlint/here-doc-multi-line-string.expect
@@ -1,5 +1,7 @@
(
- cat <<-TXT && echo "multi-line
+ cat <<-\TXT && echo "multi-line
string" ?!AMP?!
+ fizzle
+ TXT
bap
)
diff --git a/t/chainlint/here-doc.expect b/t/chainlint/here-doc.expect
index 110059ba58..1df3f78282 100644
--- a/t/chainlint/here-doc.expect
+++ b/t/chainlint/here-doc.expect
@@ -1,7 +1,25 @@
-boodle wobba gorgo snoot wafta snurb <<EOF &&
+boodle wobba \
+ gorgo snoot \
+ wafta snurb <<EOF &&
+quoth the raven,
+nevermore...
+EOF
cat <<-Arbitrary_Tag_42 >foo &&
+snoz
+boz
+woz
+Arbitrary_Tag_42
-cat <<zump >boo &&
+cat <<"zump" >boo &&
+snoz
+boz
+woz
+zump
-horticulture <<EOF
+horticulture <<\EOF
+gomez
+morticia
+wednesday
+pugsly
+EOF
diff --git a/t/chainlint/if-then-else.expect b/t/chainlint/if-then-else.expect
index 44d86c3597..cbaaf857d4 100644
--- a/t/chainlint/if-then-else.expect
+++ b/t/chainlint/if-then-else.expect
@@ -8,7 +8,9 @@
echo foo
else
echo foo &&
- cat <<-EOF
+ cat <<-\EOF
+ bar
+ EOF
fi ?!AMP?!
echo poodle
) &&
diff --git a/t/chainlint/incomplete-line.expect b/t/chainlint/incomplete-line.expect
index ffac8f9018..134d3a14f5 100644
--- a/t/chainlint/incomplete-line.expect
+++ b/t/chainlint/incomplete-line.expect
@@ -1,4 +1,10 @@
-line 1 line 2 line 3 line 4 &&
+line 1 \
+line 2 \
+line 3 \
+line 4 &&
(
- line 5 line 6 line 7 line 8
+ line 5 \
+ line 6 \
+ line 7 \
+ line 8
)
diff --git a/t/chainlint/inline-comment.expect b/t/chainlint/inline-comment.expect
index dd0dace077..6bad218530 100644
--- a/t/chainlint/inline-comment.expect
+++ b/t/chainlint/inline-comment.expect
@@ -1,6 +1,6 @@
(
- foobar &&
- barfoo ?!AMP?!
+ foobar && # comment 1
+ barfoo ?!AMP?! # wrong position for &&
flibble "not a # comment"
) &&
diff --git a/t/chainlint/loop-detect-status.expect b/t/chainlint/loop-detect-status.expect
index 0ad23bb35e..24da9e86d5 100644
--- a/t/chainlint/loop-detect-status.expect
+++ b/t/chainlint/loop-detect-status.expect
@@ -2,7 +2,7 @@
do
printf "Generating blob $i/$blobcount\r" >& 2 &&
printf "blob\nmark :$i\ndata $blobsize\n" &&
-
+ #test-tool genrandom $i $blobsize &&
printf "%-${blobsize}s" $i &&
echo "M 100644 :$i $i" >> commit &&
i=$(($i+1)) ||
diff --git a/t/chainlint/nested-here-doc.expect b/t/chainlint/nested-here-doc.expect
index e3bef63f75..29b3832a98 100644
--- a/t/chainlint/nested-here-doc.expect
+++ b/t/chainlint/nested-here-doc.expect
@@ -1,7 +1,30 @@
cat <<ARBITRARY >foop &&
+naddle
+fub <<EOF
+ nozzle
+ noodle
+EOF
+formp
+ARBITRARY
(
- cat <<-INPUT_END &&
- cat <<-EOT ?!AMP?!
+ cat <<-\INPUT_END &&
+ fish are mice
+ but geese go slow
+ data <<EOF
+ perl is lerp
+ and nothing else
+ EOF
+ toink
+ INPUT_END
+
+ cat <<-\EOT ?!AMP?!
+ text goes here
+ data <<EOF
+ data goes here
+ EOF
+ more test here
+ EOT
+
foobar
)
diff --git a/t/chainlint/nested-subshell-comment.expect b/t/chainlint/nested-subshell-comment.expect
index be4b27a305..9138cf386d 100644
--- a/t/chainlint/nested-subshell-comment.expect
+++ b/t/chainlint/nested-subshell-comment.expect
@@ -2,6 +2,8 @@
foo &&
(
bar &&
+ # bottles wobble while fiddles gobble
+ # minor numbers of cows (or do they?)
baz &&
snaff
) ?!AMP?!
diff --git a/t/chainlint/subshell-here-doc.expect b/t/chainlint/subshell-here-doc.expect
index 029d129299..52789278d1 100644
--- a/t/chainlint/subshell-here-doc.expect
+++ b/t/chainlint/subshell-here-doc.expect
@@ -1,10 +1,30 @@
(
- echo wobba gorgo snoot wafta snurb <<-EOF &&
+ echo wobba \
+ gorgo snoot \
+ wafta snurb <<-EOF &&
+ quoth the raven,
+ nevermore...
+ EOF
+
cat <<EOF >bip ?!AMP?!
- echo <<-EOF >bop
+ fish fly high
+EOF
+
+ echo <<-\EOF >bop
+ gomez
+ morticia
+ wednesday
+ pugsly
+ EOF
) &&
(
- cat <<-ARBITRARY >bup &&
- cat <<-ARBITRARY3 >bup3 &&
+ cat <<-\ARBITRARY >bup &&
+ glink
+ FIZZ
+ ARBITRARY
+ cat <<-"ARBITRARY3" >bup3 &&
+ glink
+ FIZZ
+ ARBITRARY3
meep
)
diff --git a/t/chainlint/t7900-subtree.expect b/t/chainlint/t7900-subtree.expect
index 69167da2f2..71b3b3bc20 100644
--- a/t/chainlint/t7900-subtree.expect
+++ b/t/chainlint/t7900-subtree.expect
@@ -4,12 +4,16 @@ sub2
sub3
sub4" &&
chks_sub=$(cat <<TXT | sed "s,^,sub dir/,"
+$chks
+TXT
) &&
chkms="main-sub1
main-sub2
main-sub3
main-sub4" &&
chkms_sub=$(cat <<TXT | sed "s,^,sub dir/,"
+$chkms
+TXT
) &&
subfiles=$(git ls-files) &&
check_equal "$subfiles" "$chkms
diff --git a/t/chainlint/unclosed-here-doc-indent.expect b/t/chainlint/unclosed-here-doc-indent.expect
new file mode 100644
index 0000000000..7c30a1a024
--- /dev/null
+++ b/t/chainlint/unclosed-here-doc-indent.expect
@@ -0,0 +1,4 @@
+command_which_is_run &&
+cat >expect <<-\EOF ?!UNCLOSED-HEREDOC?! &&
+we forget to end the here-doc
+command_which_is_gobbled
diff --git a/t/chainlint/unclosed-here-doc-indent.test b/t/chainlint/unclosed-here-doc-indent.test
new file mode 100644
index 0000000000..5c841a9dfd
--- /dev/null
+++ b/t/chainlint/unclosed-here-doc-indent.test
@@ -0,0 +1,4 @@
+command_which_is_run &&
+cat >expect <<-\EOF &&
+we forget to end the here-doc
+command_which_is_gobbled
diff --git a/t/chainlint/unclosed-here-doc.expect b/t/chainlint/unclosed-here-doc.expect
new file mode 100644
index 0000000000..d65e50f78d
--- /dev/null
+++ b/t/chainlint/unclosed-here-doc.expect
@@ -0,0 +1,7 @@
+command_which_is_run &&
+cat >expect <<\EOF ?!UNCLOSED-HEREDOC?! &&
+ we try to end the here-doc below,
+ but the indentation throws us off
+ since the operator is not "<<-".
+ EOF
+command_which_is_gobbled
diff --git a/t/chainlint/unclosed-here-doc.test b/t/chainlint/unclosed-here-doc.test
new file mode 100644
index 0000000000..69d3786c34
--- /dev/null
+++ b/t/chainlint/unclosed-here-doc.test
@@ -0,0 +1,7 @@
+command_which_is_run &&
+cat >expect <<\EOF &&
+ we try to end the here-doc below,
+ but the indentation throws us off
+ since the operator is not "<<-".
+ EOF
+command_which_is_gobbled
diff --git a/t/chainlint/while-loop.expect b/t/chainlint/while-loop.expect
index f272aa21fe..1f5eaea0fd 100644
--- a/t/chainlint/while-loop.expect
+++ b/t/chainlint/while-loop.expect
@@ -2,7 +2,9 @@
while true
do
echo foo ?!AMP?!
- cat <<-EOF ?!LOOP?!
+ cat <<-\EOF ?!LOOP?!
+ bar
+ EOF
done ?!AMP?!
while true; do
echo foo &&
diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl
index fd3303552b..dd8107cd7d 100755
--- a/t/check-non-portable-shell.pl
+++ b/t/check-non-portable-shell.pl
@@ -45,6 +45,7 @@ while (<>) {
/\bhead\s+-c\b/ and err 'head -c is not portable (use test_copy_bytes BYTES <file >out)';
/(?:\$\(seq|^\s*seq\b)/ and err 'seq is not portable (use test_seq)';
/\bgrep\b.*--file\b/ and err 'grep --file FILE is not portable (use grep -f FILE)';
+ /\b[ef]grep\b/ and err 'egrep/fgrep obsolescent (use grep -E/-F)';
/\bexport\s+[A-Za-z0-9_]*=/ and err '"export FOO=bar" is not portable (use FOO=bar && export FOO)';
/^\s*([A-Z0-9_]+=(\w*|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and
err '"FOO=bar shell_func" assignment extends beyond "shell_func"';
diff --git a/t/helper/test-advise.c b/t/helper/test-advise.c
index cb881139f7..8a3fd0009a 100644
--- a/t/helper/test-advise.c
+++ b/t/helper/test-advise.c
@@ -1,7 +1,7 @@
#include "test-tool.h"
-#include "cache.h"
#include "advice.h"
#include "config.h"
+#include "setup.h"
int cmd__advise_if_enabled(int argc, const char **argv)
{
diff --git a/t/helper/test-bitmap.c b/t/helper/test-bitmap.c
index ff35f5999b..af43ee1cb5 100644
--- a/t/helper/test-bitmap.c
+++ b/t/helper/test-bitmap.c
@@ -1,6 +1,7 @@
#include "test-tool.h"
-#include "cache.h"
+#include "git-compat-util.h"
#include "pack-bitmap.h"
+#include "setup.h"
static int bitmap_list_commits(void)
{
diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c
index 6c900ca668..aabe31d724 100644
--- a/t/helper/test-bloom.c
+++ b/t/helper/test-bloom.c
@@ -1,7 +1,9 @@
-#include "git-compat-util.h"
-#include "bloom.h"
#include "test-tool.h"
+#include "bloom.h"
+#include "hex.h"
#include "commit.h"
+#include "repository.h"
+#include "setup.h"
static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;
diff --git a/t/helper/test-bundle-uri.c b/t/helper/test-bundle-uri.c
new file mode 100644
index 0000000000..475058592d
--- /dev/null
+++ b/t/helper/test-bundle-uri.c
@@ -0,0 +1,137 @@
+#include "test-tool.h"
+#include "parse-options.h"
+#include "bundle-uri.h"
+#include "gettext.h"
+#include "strbuf.h"
+#include "string-list.h"
+#include "transport.h"
+#include "ref-filter.h"
+#include "remote.h"
+#include "refs.h"
+
+enum input_mode {
+ KEY_VALUE_PAIRS,
+ CONFIG_FILE,
+};
+
+static int cmd__bundle_uri_parse(int argc, const char **argv, enum input_mode mode)
+{
+ const char *key_value_usage[] = {
+ "test-tool bundle-uri parse-key-values <input>",
+ NULL
+ };
+ const char *config_usage[] = {
+ "test-tool bundle-uri parse-config <input>",
+ NULL
+ };
+ const char **usage = key_value_usage;
+ struct option options[] = {
+ OPT_END(),
+ };
+ struct strbuf sb = STRBUF_INIT;
+ struct bundle_list list;
+ int err = 0;
+ FILE *fp;
+
+ if (mode == CONFIG_FILE)
+ usage = config_usage;
+
+ argc = parse_options(argc, argv, NULL, options, usage,
+ PARSE_OPT_STOP_AT_NON_OPTION);
+
+ init_bundle_list(&list);
+
+ list.baseURI = xstrdup("<uri>");
+
+ switch (mode) {
+ case KEY_VALUE_PAIRS:
+ if (argc != 1)
+ goto usage;
+ fp = fopen(argv[0], "r");
+ if (!fp)
+ die("failed to open '%s'", argv[0]);
+ while (strbuf_getline(&sb, fp) != EOF) {
+ if (bundle_uri_parse_line(&list, sb.buf))
+ err = error("bad line: '%s'", sb.buf);
+ }
+ fclose(fp);
+ break;
+
+ case CONFIG_FILE:
+ if (argc != 1)
+ goto usage;
+ err = bundle_uri_parse_config_format("<uri>", argv[0], &list);
+ break;
+ }
+ strbuf_release(&sb);
+
+ print_bundle_list(stdout, &list);
+
+ clear_bundle_list(&list);
+
+ return !!err;
+
+usage:
+ usage_with_options(usage, options);
+}
+
+static int cmd_ls_remote(int argc, const char **argv)
+{
+ const char *dest;
+ struct remote *remote;
+ struct transport *transport;
+ int status = 0;
+
+ dest = argc > 1 ? argv[1] : NULL;
+
+ remote = remote_get(dest);
+ if (!remote) {
+ if (dest)
+ die(_("bad repository '%s'"), dest);
+ die(_("no remote configured to get bundle URIs from"));
+ }
+ if (!remote->url_nr)
+ die(_("remote '%s' has no configured URL"), dest);
+
+ transport = transport_get(remote, NULL);
+ if (transport_get_remote_bundle_uri(transport) < 0) {
+ error(_("could not get the bundle-uri list"));
+ status = 1;
+ goto cleanup;
+ }
+
+ print_bundle_list(stdout, transport->bundles);
+
+cleanup:
+ if (transport_disconnect(transport))
+ return 1;
+ return status;
+}
+
+int cmd__bundle_uri(int argc, const char **argv)
+{
+ const char *usage[] = {
+ "test-tool bundle-uri <subcommand> [<options>]",
+ NULL
+ };
+ struct option options[] = {
+ OPT_END(),
+ };
+
+ argc = parse_options(argc, argv, NULL, options, usage,
+ PARSE_OPT_STOP_AT_NON_OPTION |
+ PARSE_OPT_KEEP_ARGV0);
+ if (argc == 1)
+ goto usage;
+
+ if (!strcmp(argv[1], "parse-key-values"))
+ return cmd__bundle_uri_parse(argc - 1, argv + 1, KEY_VALUE_PAIRS);
+ if (!strcmp(argv[1], "parse-config"))
+ return cmd__bundle_uri_parse(argc - 1, argv + 1, CONFIG_FILE);
+ if (!strcmp(argv[1], "ls-remote"))
+ return cmd_ls_remote(argc - 1, argv + 1);
+ error("there is no test-tool bundle-uri tool '%s'", argv[1]);
+
+usage:
+ usage_with_options(usage, options);
+}
diff --git a/t/helper/test-cache-tree.c b/t/helper/test-cache-tree.c
new file mode 100644
index 0000000000..9507b356e2
--- /dev/null
+++ b/t/helper/test-cache-tree.c
@@ -0,0 +1,69 @@
+#define USE_THE_INDEX_VARIABLE
+#include "test-tool.h"
+#include "cache.h"
+#include "gettext.h"
+#include "hex.h"
+#include "tree.h"
+#include "cache-tree.h"
+#include "parse-options.h"
+#include "repository.h"
+#include "setup.h"
+
+static char const * const test_cache_tree_usage[] = {
+ N_("test-tool cache-tree <options> (control|prime|update)"),
+ NULL
+};
+
+int cmd__cache_tree(int argc, const char **argv)
+{
+ struct object_id oid;
+ struct tree *tree;
+ int empty = 0;
+ int invalidate_qty = 0;
+ int i;
+
+ struct option options[] = {
+ OPT_BOOL(0, "empty", &empty,
+ N_("clear the cache tree before each iteration")),
+ OPT_INTEGER_F(0, "invalidate", &invalidate_qty,
+ N_("number of entries in the cache tree to invalidate (default 0)"),
+ PARSE_OPT_NONEG),
+ OPT_END()
+ };
+
+ setup_git_directory();
+
+ argc = parse_options(argc, argv, NULL, options, test_cache_tree_usage, 0);
+
+ if (repo_read_index(the_repository) < 0)
+ die(_("unable to read index file"));
+
+ oidcpy(&oid, &the_index.cache_tree->oid);
+ tree = parse_tree_indirect(&oid);
+ if (!tree)
+ die(_("not a tree object: %s"), oid_to_hex(&oid));
+
+ if (empty) {
+ /* clear the cache tree & allocate a new one */
+ cache_tree_free(&the_index.cache_tree);
+ the_index.cache_tree = cache_tree();
+ } else if (invalidate_qty) {
+ /* invalidate the specified number of unique paths */
+ float f_interval = (float)the_index.cache_nr / invalidate_qty;
+ int interval = f_interval < 1.0 ? 1 : (int)f_interval;
+ for (i = 0; i < invalidate_qty && i * interval < the_index.cache_nr; i++)
+ cache_tree_invalidate_path(&the_index, the_index.cache[i * interval]->name);
+ }
+
+ if (argc != 1)
+ usage_with_options(test_cache_tree_usage, options);
+ else if (!strcmp(argv[0], "prime"))
+ prime_cache_tree(the_repository, &the_index, tree);
+ else if (!strcmp(argv[0], "update"))
+ cache_tree_update(&the_index, WRITE_TREE_SILENT | WRITE_TREE_REPAIR);
+ /* use "control" subcommand to specify no-op */
+ else if (!!strcmp(argv[0], "control"))
+ die(_("Unhandled subcommand '%s'"), argv[0]);
+
+ return 0;
+}
diff --git a/t/helper/test-chmtime.c b/t/helper/test-chmtime.c
index dc28890a18..0e5538833a 100644
--- a/t/helper/test-chmtime.c
+++ b/t/helper/test-chmtime.c
@@ -94,7 +94,7 @@ int cmd__chmtime(int argc, const char **argv)
if (timespec_arg(argv[i], &set_time, &set_eq)) {
++i;
} else {
- if (get == 0) {
+ if (get == 0 && verbose == 0) {
fprintf(stderr, "Not a base-10 integer: %s\n", argv[i] + 1);
goto usage;
}
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 4ba9eb6560..ad78fc1768 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -1,6 +1,6 @@
#include "test-tool.h"
-#include "cache.h"
#include "config.h"
+#include "setup.h"
#include "string-list.h"
/*
@@ -14,6 +14,8 @@
* get_value_multi -> prints all values for the entered key in increasing order
* of priority
*
+ * get -> print return value for the entered key
+ *
* get_int -> print integer value for the entered key or die
*
* get_bool -> print bool value for the entered key or die
@@ -30,6 +32,9 @@
* iterate -> iterate over all values using git_config(), and print some
* data for each
*
+ * git_config_int -> iterate over all values using git_config() and print the
+ * integer value for the entered key or die
+ *
* Examples:
*
* To print the value with highest priority for key "foo.bAr Baz.rock":
@@ -54,6 +59,17 @@ static int iterate_cb(const char *var, const char *value, void *data UNUSED)
return 0;
}
+static int parse_int_cb(const char *var, const char *value, void *data)
+{
+ const char *key_to_match = data;
+
+ if (!strcmp(key_to_match, var)) {
+ int parsed = git_config_int(value, value);
+ printf("%d\n", parsed);
+ }
+ return 0;
+}
+
static int early_config_cb(const char *var, const char *value, void *vdata)
{
const char *key = vdata;
@@ -95,8 +111,7 @@ int cmd__config(int argc, const char **argv)
goto exit1;
}
} else if (argc == 3 && !strcmp(argv[1], "get_value_multi")) {
- strptr = git_config_get_value_multi(argv[2]);
- if (strptr) {
+ if (!git_config_get_value_multi(argv[2], &strptr)) {
for (i = 0; i < strptr->nr; i++) {
v = strptr->items[i].string;
if (!v)
@@ -109,6 +124,26 @@ int cmd__config(int argc, const char **argv)
printf("Value not found for \"%s\"\n", argv[2]);
goto exit1;
}
+ } else if (argc == 3 && !strcmp(argv[1], "get")) {
+ int ret;
+
+ if (!(ret = git_config_get(argv[2])))
+ goto exit0;
+ else if (ret == 1)
+ printf("Value not found for \"%s\"\n", argv[2]);
+ else if (ret == -CONFIG_INVALID_KEY)
+ printf("Key \"%s\" is invalid\n", argv[2]);
+ else if (ret == -CONFIG_NO_SECTION_OR_NAME)
+ printf("Key \"%s\" has no section\n", argv[2]);
+ else
+ /*
+ * A normal caller should just check "ret <
+ * 0", but for our own tests let's BUG() if
+ * our whitelist of git_config_parse_key()
+ * return values isn't exhaustive.
+ */
+ BUG("Key \"%s\" has unknown return %d", argv[2], ret);
+ goto exit1;
} else if (argc == 3 && !strcmp(argv[1], "get_int")) {
if (!git_config_get_int(argv[2], &val)) {
printf("%d\n", val);
@@ -159,8 +194,7 @@ int cmd__config(int argc, const char **argv)
goto exit2;
}
}
- strptr = git_configset_get_value_multi(&cs, argv[2]);
- if (strptr) {
+ if (!git_configset_get_value_multi(&cs, argv[2], &strptr)) {
for (i = 0; i < strptr->nr; i++) {
v = strptr->items[i].string;
if (!v)
@@ -176,6 +210,9 @@ int cmd__config(int argc, const char **argv)
} else if (!strcmp(argv[1], "iterate")) {
git_config(iterate_cb, NULL);
goto exit0;
+ } else if (argc == 3 && !strcmp(argv[1], "git_config_int")) {
+ git_config(parse_int_cb, (void *) argv[2]);
+ goto exit0;
}
die("%s: Please check the syntax and the function name", argv[0]);
diff --git a/t/helper/test-crontab.c b/t/helper/test-crontab.c
index e6c1b1e22b..597027a96e 100644
--- a/t/helper/test-crontab.c
+++ b/t/helper/test-crontab.c
@@ -1,5 +1,4 @@
#include "test-tool.h"
-#include "cache.h"
/*
* Usage: test-tool crontab <file> -l|<input>
diff --git a/t/helper/test-ctype.c b/t/helper/test-ctype.c
index 92c4c2313e..e5659df40b 100644
--- a/t/helper/test-ctype.c
+++ b/t/helper/test-ctype.c
@@ -1,5 +1,4 @@
#include "test-tool.h"
-#include "cache.h"
static int rc;
@@ -11,9 +10,14 @@ static void report_error(const char *class, int ch)
static int is_in(const char *s, int ch)
{
- /* We can't find NUL using strchr. It's classless anyway. */
+ /*
+ * We can't find NUL using strchr. Accept it as the first
+ * character in the spec -- there are no empty classes.
+ */
if (ch == '\0')
- return 0;
+ return ch == *s;
+ if (*s == '\0')
+ s++;
return !!strchr(s, ch);
}
@@ -23,13 +27,29 @@ static int is_in(const char *s, int ch)
if (is_in(s, i) != t(i)) \
report_error(#t, i); \
} \
+ if (t(EOF)) \
+ report_error(#t, EOF); \
}
#define DIGIT "0123456789"
#define LOWER "abcdefghijklmnopqrstuvwxyz"
#define UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+#define PUNCT "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
+#define ASCII \
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" \
+ "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \
+ "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" \
+ "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" \
+ "\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" \
+ "\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" \
+ "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" \
+ "\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
+#define CNTRL \
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" \
+ "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \
+ "\x7f"
-int cmd__ctype(int argc, const char **argv)
+int cmd__ctype(int argc UNUSED, const char **argv UNUSED)
{
TEST_CLASS(isdigit, DIGIT);
TEST_CLASS(isspace, " \n\r\t");
@@ -38,6 +58,13 @@ int cmd__ctype(int argc, const char **argv)
TEST_CLASS(is_glob_special, "*?[\\");
TEST_CLASS(is_regex_special, "$()*+.?[\\^{|");
TEST_CLASS(is_pathspec_magic, "!\"#%&',-/:;<=>@_`~");
+ TEST_CLASS(isascii, ASCII);
+ TEST_CLASS(islower, LOWER);
+ TEST_CLASS(isupper, UPPER);
+ TEST_CLASS(iscntrl, CNTRL);
+ TEST_CLASS(ispunct, PUNCT);
+ TEST_CLASS(isxdigit, DIGIT "abcdefABCDEF");
+ TEST_CLASS(isprint, LOWER UPPER DIGIT PUNCT " ");
return rc;
}
diff --git a/t/helper/test-date.c b/t/helper/test-date.c
index 45951b1df8..0683d46574 100644
--- a/t/helper/test-date.c
+++ b/t/helper/test-date.c
@@ -1,6 +1,6 @@
#include "test-tool.h"
-#include "cache.h"
#include "date.h"
+#include "trace.h"
static const char *usage_msg = "\n"
" test-tool date relative [time_t]...\n"
@@ -81,7 +81,7 @@ static void parse_approxidate(const char **argv)
{
for (; *argv; argv++) {
timestamp_t t;
- t = approxidate_relative(*argv);
+ t = approxidate(*argv);
printf("%s -> %s\n", *argv, show_date(t, 0, DATE_MODE(ISO8601)));
}
}
@@ -90,7 +90,7 @@ static void parse_approx_timestamp(const char **argv)
{
for (; *argv; argv++) {
timestamp_t t;
- t = approxidate_relative(*argv);
+ t = approxidate(*argv);
printf("%s -> %"PRItime"\n", *argv, t);
}
}
@@ -104,7 +104,7 @@ static void getnanos(const char **argv)
printf("%lf\n", seconds);
}
-int cmd__date(int argc, const char **argv)
+int cmd__date(int argc UNUSED, const char **argv)
{
const char *x;
diff --git a/t/helper/test-delta.c b/t/helper/test-delta.c
index b15481ea59..e7d134ec25 100644
--- a/t/helper/test-delta.c
+++ b/t/helper/test-delta.c
@@ -11,7 +11,7 @@
#include "test-tool.h"
#include "git-compat-util.h"
#include "delta.h"
-#include "cache.h"
+#include "wrapper.h"
static const char usage_str[] =
"test-tool delta (-d|-p) <from_file> <data_file> <out_file>";
diff --git a/t/helper/test-dir-iterator.c b/t/helper/test-dir-iterator.c
index 659b6bfa81..6b297bd753 100644
--- a/t/helper/test-dir-iterator.c
+++ b/t/helper/test-dir-iterator.c
@@ -15,7 +15,7 @@ static const char *error_name(int error_number)
/*
* usage:
- * tool-test dir-iterator [--follow-symlinks] [--pedantic] directory_path
+ * tool-test dir-iterator [--pedantic] directory_path
*/
int cmd__dir_iterator(int argc, const char **argv)
{
@@ -24,9 +24,7 @@ int cmd__dir_iterator(int argc, const char **argv)
int iter_status;
for (++argv, --argc; *argv && starts_with(*argv, "--"); ++argv, --argc) {
- if (strcmp(*argv, "--follow-symlinks") == 0)
- flags |= DIR_ITERATOR_FOLLOW_SYMLINKS;
- else if (strcmp(*argv, "--pedantic") == 0)
+ if (strcmp(*argv, "--pedantic") == 0)
flags |= DIR_ITERATOR_PEDANTIC;
else
die("invalid option '%s'", *argv);
diff --git a/t/helper/test-drop-caches.c b/t/helper/test-drop-caches.c
index e37396dd9c..73e551cfc2 100644
--- a/t/helper/test-drop-caches.c
+++ b/t/helper/test-drop-caches.c
@@ -155,7 +155,7 @@ static int cmd_dropcaches(void)
#endif
-int cmd__drop_caches(int argc, const char **argv)
+int cmd__drop_caches(int argc UNUSED, const char **argv UNUSED)
{
cmd_sync();
return cmd_dropcaches();
diff --git a/t/helper/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c
index 0d6d7f1ecb..f22f7bd84a 100644
--- a/t/helper/test-dump-cache-tree.c
+++ b/t/helper/test-dump-cache-tree.c
@@ -1,8 +1,12 @@
+#define USE_THE_INDEX_VARIABLE
#include "test-tool.h"
#include "cache.h"
+#include "hash.h"
+#include "hex.h"
#include "tree.h"
#include "cache-tree.h"
-
+#include "repository.h"
+#include "setup.h"
static void dump_one(struct cache_tree *it, const char *pfx, const char *x)
{
@@ -55,19 +59,19 @@ static int dump_cache_tree(struct cache_tree *it,
return errs;
}
-int cmd__dump_cache_tree(int ac, const char **av)
+int cmd__dump_cache_tree(int ac UNUSED, const char **av UNUSED)
{
struct index_state istate;
struct cache_tree *another = cache_tree();
int ret;
setup_git_directory();
- if (read_cache() < 0)
+ if (repo_read_index(the_repository) < 0)
die("unable to read index file");
istate = the_index;
istate.cache_tree = another;
cache_tree_update(&istate, WRITE_TREE_DRY_RUN);
- ret = dump_cache_tree(active_cache_tree, another, "");
+ ret = dump_cache_tree(the_index.cache_tree, another, "");
cache_tree_free(&another);
return ret;
diff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c
index 975f0ac890..9a098a25cb 100644
--- a/t/helper/test-dump-fsmonitor.c
+++ b/t/helper/test-dump-fsmonitor.c
@@ -1,7 +1,9 @@
#include "test-tool.h"
#include "cache.h"
+#include "repository.h"
+#include "setup.h"
-int cmd__dump_fsmonitor(int ac, const char **av)
+int cmd__dump_fsmonitor(int ac UNUSED, const char **av UNUSED)
{
struct index_state *istate = the_repository->index;
int i;
diff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c
index a209880eb3..d1badd7112 100644
--- a/t/helper/test-dump-split-index.c
+++ b/t/helper/test-dump-split-index.c
@@ -1,5 +1,8 @@
+#define USE_THE_INDEX_VARIABLE
#include "test-tool.h"
#include "cache.h"
+#include "hex.h"
+#include "setup.h"
#include "split-index.h"
#include "ewah/ewok.h"
@@ -8,7 +11,7 @@ static void show_bit(size_t pos, void *data)
printf(" %d", (int)pos);
}
-int cmd__dump_split_index(int ac, const char **av)
+int cmd__dump_split_index(int ac UNUSED, const char **av)
{
struct split_index *si;
int i;
diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c
index 99010614f6..df70be549f 100644
--- a/t/helper/test-dump-untracked-cache.c
+++ b/t/helper/test-dump-untracked-cache.c
@@ -1,7 +1,10 @@
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "test-tool.h"
#include "cache.h"
#include "dir.h"
+#include "hex.h"
+#include "repository.h"
+#include "setup.h"
static int compare_untracked(const void *a_, const void *b_)
{
@@ -40,7 +43,7 @@ static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)
strbuf_setlen(base, len);
}
-int cmd__dump_untracked_cache(int ac, const char **av)
+int cmd__dump_untracked_cache(int ac UNUSED, const char **av UNUSED)
{
struct untracked_cache *uc;
struct strbuf base = STRBUF_INIT;
@@ -51,7 +54,7 @@ int cmd__dump_untracked_cache(int ac, const char **av)
xsetenv("GIT_CONFIG_VALUE_0", "keep", 1);
setup_git_directory();
- if (read_cache() < 0)
+ if (repo_read_index(the_repository) < 0)
die("unable to read index file");
uc = the_index.untracked;
if (!uc) {
diff --git a/builtin/env--helper.c b/t/helper/test-env-helper.c
index ea04c16636..66c88b8ff3 100644
--- a/builtin/env--helper.c
+++ b/t/helper/test-env-helper.c
@@ -1,9 +1,9 @@
-#include "builtin.h"
+#include "test-tool.h"
#include "config.h"
#include "parse-options.h"
static char const * const env__helper_usage[] = {
- N_("git env--helper --type=[bool|ulong] <options> <env-var>"),
+ "test-tool env-helper --type=[bool|ulong] <options> <env-var>",
NULL
};
@@ -24,12 +24,12 @@ static int option_parse_type(const struct option *opt, const char *arg,
else if (!strcmp(arg, "ulong"))
*cmdmode = ENV_HELPER_TYPE_ULONG;
else
- die(_("unrecognized --type argument, %s"), arg);
+ die("unrecognized --type argument, %s", arg);
return 0;
}
-int cmd_env__helper(int argc, const char **argv, const char *prefix)
+int cmd__env_helper(int argc, const char **argv)
{
int exit_code = 0;
const char *env_variable = NULL;
@@ -39,17 +39,17 @@ int cmd_env__helper(int argc, const char **argv, const char *prefix)
unsigned long ret_ulong, default_ulong;
enum cmdmode cmdmode = 0;
struct option opts[] = {
- OPT_CALLBACK_F(0, "type", &cmdmode, N_("type"),
- N_("value is given this type"), PARSE_OPT_NONEG,
+ OPT_CALLBACK_F(0, "type", &cmdmode, "type",
+ "value is given this type", PARSE_OPT_NONEG,
option_parse_type),
- OPT_STRING(0, "default", &env_default, N_("value"),
- N_("default for git_env_*(...) to fall back on")),
+ OPT_STRING(0, "default", &env_default, "value",
+ "default for git_env_*(...) to fall back on"),
OPT_BOOL(0, "exit-code", &exit_code,
- N_("be quiet only use git_env_*() value as exit code")),
+ "be quiet only use git_env_*() value as exit code"),
OPT_END(),
};
- argc = parse_options(argc, argv, prefix, opts, env__helper_usage,
+ argc = parse_options(argc, argv, NULL, opts, env__helper_usage,
PARSE_OPT_KEEP_UNKNOWN_OPT);
if (env_default && !*env_default)
usage_with_options(env__helper_usage, opts);
@@ -64,7 +64,7 @@ int cmd_env__helper(int argc, const char **argv, const char *prefix)
if (env_default) {
default_int = git_parse_maybe_bool(env_default);
if (default_int == -1) {
- error(_("option `--default' expects a boolean value with `--type=bool`, not `%s`"),
+ error("option `--default' expects a boolean value with `--type=bool`, not `%s`",
env_default);
usage_with_options(env__helper_usage, opts);
}
@@ -79,7 +79,7 @@ int cmd_env__helper(int argc, const char **argv, const char *prefix)
case ENV_HELPER_TYPE_ULONG:
if (env_default) {
if (!git_parse_ulong(env_default, &default_ulong)) {
- error(_("option `--default' expects an unsigned long value with `--type=ulong`, not `%s`"),
+ error("option `--default' expects an unsigned long value with `--type=ulong`, not `%s`",
env_default);
usage_with_options(env__helper_usage, opts);
}
diff --git a/t/helper/test-example-decorate.c b/t/helper/test-example-decorate.c
index b9d1200eb9..2ed910adaa 100644
--- a/t/helper/test-example-decorate.c
+++ b/t/helper/test-example-decorate.c
@@ -1,9 +1,10 @@
#include "test-tool.h"
-#include "cache.h"
+#include "git-compat-util.h"
#include "object.h"
#include "decorate.h"
+#include "repository.h"
-int cmd__example_decorate(int argc, const char **argv)
+int cmd__example_decorate(int argc UNUSED, const char **argv UNUSED)
{
struct decoration n;
struct object_id one_oid = { {1} };
diff --git a/t/helper/test-fake-ssh.c b/t/helper/test-fake-ssh.c
index 12beee99ad..27323cb367 100644
--- a/t/helper/test-fake-ssh.c
+++ b/t/helper/test-fake-ssh.c
@@ -8,7 +8,7 @@ int cmd_main(int argc, const char **argv)
struct strbuf buf = STRBUF_INIT;
FILE *f;
int i;
- const char *child_argv[] = { NULL, NULL };
+ struct child_process cmd = CHILD_PROCESS_INIT;
/* First, print all parameters into $TRASH_DIRECTORY/ssh-output */
if (!trash_directory)
@@ -17,6 +17,7 @@ int cmd_main(int argc, const char **argv)
f = fopen(buf.buf, "w");
if (!f)
die("Could not write to %s", buf.buf);
+ strbuf_release(&buf);
for (i = 0; i < argc; i++)
fprintf(f, "%s%s", i > 0 ? " " : "", i > 0 ? argv[i] : "ssh:");
fprintf(f, "\n");
@@ -25,6 +26,7 @@ int cmd_main(int argc, const char **argv)
/* Now, evaluate the *last* parameter */
if (argc < 2)
return 0;
- child_argv[0] = argv[argc - 1];
- return run_command_v_opt(child_argv, RUN_USING_SHELL);
+ cmd.use_shell = 1;
+ strvec_push(&cmd.args, argv[argc - 1]);
+ return run_command(&cmd);
}
diff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c
index 45665ec19a..d1d63feaa9 100644
--- a/t/helper/test-fast-rebase.c
+++ b/t/helper/test-fast-rebase.c
@@ -10,22 +10,28 @@
* refactoring is the better route).
*/
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
#include "test-tool.h"
-
+#include "cache.h"
#include "cache-tree.h"
#include "commit.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "merge-ort.h"
+#include "object-name.h"
#include "refs.h"
#include "revision.h"
#include "sequencer.h"
+#include "setup.h"
#include "strvec.h"
#include "tree.h"
static const char *short_commit_name(struct commit *commit)
{
- return find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV);
+ return repo_find_unique_abbrev(the_repository, &commit->object.oid,
+ DEFAULT_ABBREV);
}
static struct commit *peel_committish(const char *name)
@@ -33,10 +39,11 @@ static struct commit *peel_committish(const char *name)
struct object *obj;
struct object_id oid;
- if (get_oid(name, &oid))
+ if (repo_get_oid(the_repository, name, &oid))
return NULL;
obj = parse_object(the_repository, &oid);
- return (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);
+ return (struct commit *)repo_peel_to_type(the_repository, name, 0, obj,
+ OBJ_COMMIT);
}
static char *get_author(const char *message)
@@ -63,7 +70,8 @@ static struct commit *create_commit(struct tree *tree,
struct commit_extra_header *extra;
struct strbuf msg = STRBUF_INIT;
const char *out_enc = get_commit_output_encoding();
- const char *message = logmsg_reencode(based_on, NULL, out_enc);
+ const char *message = repo_logmsg_reencode(the_repository, based_on,
+ NULL, out_enc);
const char *orig_message = NULL;
const char *exclude_gpgsig[] = { "gpgsig", NULL };
@@ -119,11 +127,11 @@ int cmd__fast_rebase(int argc, const char **argv)
strbuf_addf(&branch_name, "refs/heads/%s", argv[4]);
/* Sanity check */
- if (get_oid("HEAD", &head))
+ if (repo_get_oid(the_repository, "HEAD", &head))
die(_("Cannot read HEAD"));
assert(oideq(&onto->object.oid, &head));
- hold_locked_index(&lock, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &lock, LOCK_DIE_ON_ERROR);
if (repo_read_index(the_repository) < 0)
BUG("Could not read index");
@@ -154,7 +162,7 @@ int cmd__fast_rebase(int argc, const char **argv)
memset(&result, 0, sizeof(result));
merge_opt.show_rename_progress = 1;
merge_opt.branch1 = "HEAD";
- head_tree = get_commit_tree(onto);
+ head_tree = repo_get_commit_tree(the_repository, onto);
result.tree = head_tree;
last_commit = onto;
while ((commit = get_revision(&revs))) {
@@ -165,8 +173,8 @@ int cmd__fast_rebase(int argc, const char **argv)
assert(commit->parents && !commit->parents->next);
base = commit->parents->item;
- next_tree = get_commit_tree(commit);
- base_tree = get_commit_tree(base);
+ next_tree = repo_get_commit_tree(the_repository, commit);
+ base_tree = repo_get_commit_tree(the_repository, base);
merge_opt.branch2 = short_commit_name(commit);
merge_opt.ancestor = xstrfmt("parent of %s", merge_opt.branch2);
diff --git a/t/helper/test-fsmonitor-client.c b/t/helper/test-fsmonitor-client.c
index 54a4856c48..9f18c685b7 100644
--- a/t/helper/test-fsmonitor-client.c
+++ b/t/helper/test-fsmonitor-client.c
@@ -7,11 +7,14 @@
#include "cache.h"
#include "parse-options.h"
#include "fsmonitor-ipc.h"
+#include "repository.h"
+#include "setup.h"
#include "thread-utils.h"
#include "trace2.h"
+#include "wrapper.h"
#ifndef HAVE_FSMONITOR_DAEMON_BACKEND
-int cmd__fsmonitor_client(int argc, const char **argv)
+int cmd__fsmonitor_client(int argc UNUSED, const char **argv UNUSED)
{
die("fsmonitor--daemon not available on this platform");
}
diff --git a/t/helper/test-genzeros.c b/t/helper/test-genzeros.c
index 8ca988d621..47af843b68 100644
--- a/t/helper/test-genzeros.c
+++ b/t/helper/test-genzeros.c
@@ -17,15 +17,16 @@ int cmd__genzeros(int argc, const char **argv)
/* Writing out individual NUL bytes is slow... */
while (count < 0)
- if (write(1, zeros, ARRAY_SIZE(zeros)) < 0)
- return -1;
+ if (xwrite(1, zeros, ARRAY_SIZE(zeros)) < 0)
+ die_errno("write error");
while (count > 0) {
- n = write(1, zeros, count < ARRAY_SIZE(zeros) ?
- count : ARRAY_SIZE(zeros));
+ n = xwrite(1, zeros,
+ count < ARRAY_SIZE(zeros)
+ ? count : ARRAY_SIZE(zeros));
if (n < 0)
- return -1;
+ die_errno("write error");
count -= n;
}
diff --git a/t/helper/test-hash.c b/t/helper/test-hash.c
index 5860dab0ff..45d829c908 100644
--- a/t/helper/test-hash.c
+++ b/t/helper/test-hash.c
@@ -1,5 +1,5 @@
#include "test-tool.h"
-#include "cache.h"
+#include "hex.h"
int cmd_hash_impl(int ac, const char **av, int algo)
{
diff --git a/t/helper/test-hashmap.c b/t/helper/test-hashmap.c
index 36ff07bd4b..0eb0b3d49c 100644
--- a/t/helper/test-hashmap.c
+++ b/t/helper/test-hashmap.c
@@ -2,6 +2,7 @@
#include "git-compat-util.h"
#include "hashmap.h"
#include "strbuf.h"
+#include "string-list.h"
struct test_entry
{
@@ -150,6 +151,7 @@ static void perf_hashmap(unsigned int method, unsigned int rounds)
*/
int cmd__hashmap(int argc, const char **argv)
{
+ struct string_list parts = STRING_LIST_INIT_NODUP;
struct strbuf line = STRBUF_INIT;
int icase;
struct hashmap map = HASHMAP_INIT(test_entry_cmp, &icase);
@@ -159,21 +161,26 @@ int cmd__hashmap(int argc, const char **argv)
/* process commands from stdin */
while (strbuf_getline(&line, stdin) != EOF) {
- char *cmd, *p1 = NULL, *p2 = NULL;
+ char *cmd, *p1, *p2;
unsigned int hash = 0;
struct test_entry *entry;
/* break line into command and up to two parameters */
- cmd = strtok(line.buf, DELIM);
+ string_list_setlen(&parts, 0);
+ string_list_split_in_place(&parts, line.buf, DELIM, 2);
+ string_list_remove_empty_items(&parts, 0);
+
/* ignore empty lines */
- if (!cmd || *cmd == '#')
+ if (!parts.nr)
+ continue;
+ if (!*parts.items[0].string || *parts.items[0].string == '#')
continue;
- p1 = strtok(NULL, DELIM);
- if (p1) {
+ cmd = parts.items[0].string;
+ p1 = parts.nr >= 1 ? parts.items[1].string : NULL;
+ p2 = parts.nr >= 2 ? parts.items[2].string : NULL;
+ if (p1)
hash = icase ? strihash(p1) : strhash(p1);
- p2 = strtok(NULL, DELIM);
- }
if (!strcmp("add", cmd) && p1 && p2) {
@@ -260,6 +267,7 @@ int cmd__hashmap(int argc, const char **argv)
}
}
+ string_list_clear(&parts, 0);
strbuf_release(&line);
hashmap_clear_and_free(&map, struct test_entry, ent);
return 0;
diff --git a/t/helper/test-hexdump.c b/t/helper/test-hexdump.c
index 811e89c1bc..05f55eca21 100644
--- a/t/helper/test-hexdump.c
+++ b/t/helper/test-hexdump.c
@@ -4,7 +4,7 @@
/*
* Read stdin and print a hexdump to stdout.
*/
-int cmd__hexdump(int argc, const char **argv)
+int cmd__hexdump(int argc UNUSED, const char **argv UNUSED)
{
char buf[1024];
ssize_t i, len;
diff --git a/t/helper/test-index-version.c b/t/helper/test-index-version.c
index fcd10968cc..a06c45c1f8 100644
--- a/t/helper/test-index-version.c
+++ b/t/helper/test-index-version.c
@@ -1,7 +1,7 @@
#include "test-tool.h"
#include "cache.h"
-int cmd__index_version(int argc, const char **argv)
+int cmd__index_version(int argc UNUSED, const char **argv UNUSED)
{
struct cache_header hdr;
int version;
diff --git a/t/helper/test-json-writer.c b/t/helper/test-json-writer.c
index 8c3edacc00..afe393f597 100644
--- a/t/helper/test-json-writer.c
+++ b/t/helper/test-json-writer.c
@@ -1,6 +1,6 @@
#include "test-tool.h"
-#include "cache.h"
#include "json-writer.h"
+#include "string-list.h"
static const char *expect_obj1 = "{\"a\":\"abc\",\"b\":42,\"c\":true}";
static const char *expect_obj2 = "{\"a\":-1,\"b\":2147483647,\"c\":0}";
@@ -395,35 +395,41 @@ static int unit_tests(void)
return 0;
}
-static void get_s(int line_nr, char **s_in)
+struct line {
+ struct string_list *parts;
+ size_t consumed_nr;
+ int nr;
+};
+
+static void get_s(struct line *line, char **s_in)
{
- *s_in = strtok(NULL, " ");
- if (!*s_in)
- die("line[%d]: expected: <s>", line_nr);
+ if (line->consumed_nr > line->parts->nr)
+ die("line[%d]: expected: <s>", line->nr);
+ *s_in = line->parts->items[line->consumed_nr++].string;
}
-static void get_i(int line_nr, intmax_t *s_in)
+static void get_i(struct line *line, intmax_t *s_in)
{
char *s;
char *endptr;
- get_s(line_nr, &s);
+ get_s(line, &s);
*s_in = strtol(s, &endptr, 10);
if (*endptr || errno == ERANGE)
- die("line[%d]: invalid integer value", line_nr);
+ die("line[%d]: invalid integer value", line->nr);
}
-static void get_d(int line_nr, double *s_in)
+static void get_d(struct line *line, double *s_in)
{
char *s;
char *endptr;
- get_s(line_nr, &s);
+ get_s(line, &s);
*s_in = strtod(s, &endptr);
if (*endptr || errno == ERANGE)
- die("line[%d]: invalid float value", line_nr);
+ die("line[%d]: invalid float value", line->nr);
}
static int pretty;
@@ -454,6 +460,7 @@ static char *get_trimmed_line(char *buf, int buf_size)
static int scripted(void)
{
+ struct string_list parts = STRING_LIST_INIT_NODUP;
struct json_writer jw = JSON_WRITER_INIT;
char buf[MAX_LINE_LENGTH];
char *line;
@@ -471,66 +478,77 @@ static int scripted(void)
die("expected first line to be 'object' or 'array'");
while ((line = get_trimmed_line(buf, MAX_LINE_LENGTH)) != NULL) {
+ struct line state = { 0 };
char *verb;
char *key;
char *s_value;
intmax_t i_value;
double d_value;
- line_nr++;
+ state.parts = &parts;
+ state.nr = ++line_nr;
+
+ /* break line into command and zero or more tokens */
+ string_list_setlen(&parts, 0);
+ string_list_split_in_place(&parts, line, " ", -1);
+ string_list_remove_empty_items(&parts, 0);
+
+ /* ignore empty lines */
+ if (!parts.nr || !*parts.items[0].string)
+ continue;
- verb = strtok(line, " ");
+ verb = parts.items[state.consumed_nr++].string;
if (!strcmp(verb, "end")) {
jw_end(&jw);
}
else if (!strcmp(verb, "object-string")) {
- get_s(line_nr, &key);
- get_s(line_nr, &s_value);
+ get_s(&state, &key);
+ get_s(&state, &s_value);
jw_object_string(&jw, key, s_value);
}
else if (!strcmp(verb, "object-int")) {
- get_s(line_nr, &key);
- get_i(line_nr, &i_value);
+ get_s(&state, &key);
+ get_i(&state, &i_value);
jw_object_intmax(&jw, key, i_value);
}
else if (!strcmp(verb, "object-double")) {
- get_s(line_nr, &key);
- get_i(line_nr, &i_value);
- get_d(line_nr, &d_value);
+ get_s(&state, &key);
+ get_i(&state, &i_value);
+ get_d(&state, &d_value);
jw_object_double(&jw, key, i_value, d_value);
}
else if (!strcmp(verb, "object-true")) {
- get_s(line_nr, &key);
+ get_s(&state, &key);
jw_object_true(&jw, key);
}
else if (!strcmp(verb, "object-false")) {
- get_s(line_nr, &key);
+ get_s(&state, &key);
jw_object_false(&jw, key);
}
else if (!strcmp(verb, "object-null")) {
- get_s(line_nr, &key);
+ get_s(&state, &key);
jw_object_null(&jw, key);
}
else if (!strcmp(verb, "object-object")) {
- get_s(line_nr, &key);
+ get_s(&state, &key);
jw_object_inline_begin_object(&jw, key);
}
else if (!strcmp(verb, "object-array")) {
- get_s(line_nr, &key);
+ get_s(&state, &key);
jw_object_inline_begin_array(&jw, key);
}
else if (!strcmp(verb, "array-string")) {
- get_s(line_nr, &s_value);
+ get_s(&state, &s_value);
jw_array_string(&jw, s_value);
}
else if (!strcmp(verb, "array-int")) {
- get_i(line_nr, &i_value);
+ get_i(&state, &i_value);
jw_array_intmax(&jw, i_value);
}
else if (!strcmp(verb, "array-double")) {
- get_i(line_nr, &i_value);
- get_d(line_nr, &d_value);
+ get_i(&state, &i_value);
+ get_d(&state, &d_value);
jw_array_double(&jw, i_value, d_value);
}
else if (!strcmp(verb, "array-true"))
@@ -553,6 +571,7 @@ static int scripted(void)
printf("%s\n", jw.json.buf);
jw_release(&jw);
+ string_list_clear(&parts, 0);
return 0;
}
diff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c
index cd1b4c9736..b83a75d19f 100644
--- a/t/helper/test-lazy-init-name-hash.c
+++ b/t/helper/test-lazy-init-name-hash.c
@@ -1,6 +1,11 @@
+#define USE_THE_INDEX_VARIABLE
#include "test-tool.h"
#include "cache.h"
+#include "environment.h"
#include "parse-options.h"
+#include "repository.h"
+#include "setup.h"
+#include "trace.h"
static int single;
static int multi;
@@ -32,7 +37,7 @@ static void dump_run(void)
struct dir_entry *dir;
struct cache_entry *ce;
- read_cache();
+ repo_read_index(the_repository);
if (single) {
test_lazy_init_name_hash(&the_index, 0);
} else {
@@ -49,7 +54,7 @@ static void dump_run(void)
ent /* member name */)
printf("name %08x %s\n", ce->ent.hash, ce->name);
- discard_cache();
+ discard_index(&the_index);
}
/*
@@ -66,7 +71,7 @@ static uint64_t time_runs(int try_threaded)
for (i = 0; i < count; i++) {
t0 = getnanotime();
- read_cache();
+ repo_read_index(the_repository);
t1 = getnanotime();
nr_threads_used = test_lazy_init_name_hash(&the_index, try_threaded);
t2 = getnanotime();
@@ -89,7 +94,7 @@ static uint64_t time_runs(int try_threaded)
the_index.cache_nr);
fflush(stdout);
- discard_cache();
+ discard_index(&the_index);
}
avg = sum / count;
@@ -113,9 +118,9 @@ static void analyze_run(void)
int i;
int nr;
- read_cache();
+ repo_read_index(the_repository);
cache_nr_limit = the_index.cache_nr;
- discard_cache();
+ discard_index(&the_index);
nr = analyze;
while (1) {
@@ -128,23 +133,23 @@ static void analyze_run(void)
nr = cache_nr_limit;
for (i = 0; i < count; i++) {
- read_cache();
+ repo_read_index(the_repository);
the_index.cache_nr = nr; /* cheap truncate of index */
t1s = getnanotime();
test_lazy_init_name_hash(&the_index, 0);
t2s = getnanotime();
sum_single += (t2s - t1s);
the_index.cache_nr = cache_nr_limit;
- discard_cache();
+ discard_index(&the_index);
- read_cache();
+ repo_read_index(the_repository);
the_index.cache_nr = nr; /* cheap truncate of index */
t1m = getnanotime();
nr_threads_used = test_lazy_init_name_hash(&the_index, 1);
t2m = getnanotime();
sum_multi += (t2m - t1m);
the_index.cache_nr = cache_nr_limit;
- discard_cache();
+ discard_index(&the_index);
if (!nr_threads_used)
printf(" [size %8d] [single %f] non-threaded code path used\n",
diff --git a/t/helper/test-match-trees.c b/t/helper/test-match-trees.c
index 4079fdee06..d0db5ff26f 100644
--- a/t/helper/test-match-trees.c
+++ b/t/helper/test-match-trees.c
@@ -1,17 +1,21 @@
#include "test-tool.h"
-#include "cache.h"
+#include "hex.h"
+#include "match-trees.h"
+#include "object-name.h"
+#include "repository.h"
+#include "setup.h"
#include "tree.h"
-int cmd__match_trees(int ac, const char **av)
+int cmd__match_trees(int ac UNUSED, const char **av)
{
struct object_id hash1, hash2, shifted;
struct tree *one, *two;
setup_git_directory();
- if (get_oid(av[1], &hash1))
+ if (repo_get_oid(the_repository, av[1], &hash1))
die("cannot parse %s as an object name", av[1]);
- if (get_oid(av[2], &hash2))
+ if (repo_get_oid(the_repository, av[2], &hash2))
die("cannot parse %s as an object name", av[2]);
one = parse_tree_indirect(&hash1);
if (!one)
diff --git a/t/helper/test-mergesort.c b/t/helper/test-mergesort.c
index 335e5bb3a9..42ccc87051 100644
--- a/t/helper/test-mergesort.c
+++ b/t/helper/test-mergesort.c
@@ -1,6 +1,7 @@
#include "test-tool.h"
-#include "cache.h"
+#include "mem-pool.h"
#include "mergesort.h"
+#include "strbuf.h"
static uint32_t minstd_rand(uint32_t *state)
{
diff --git a/t/helper/test-oid-array.c b/t/helper/test-oid-array.c
index d1324d086a..eef68833b7 100644
--- a/t/helper/test-oid-array.c
+++ b/t/helper/test-oid-array.c
@@ -1,6 +1,8 @@
#include "test-tool.h"
-#include "cache.h"
+#include "hex.h"
#include "oid-array.h"
+#include "setup.h"
+#include "strbuf.h"
static int print_oid(const struct object_id *oid, void *data)
{
@@ -8,7 +10,7 @@ static int print_oid(const struct object_id *oid, void *data)
return 0;
}
-int cmd__oid_array(int argc, const char **argv)
+int cmd__oid_array(int argc UNUSED, const char **argv UNUSED)
{
struct oid_array array = OID_ARRAY_INIT;
struct strbuf line = STRBUF_INIT;
diff --git a/t/helper/test-oidmap.c b/t/helper/test-oidmap.c
index 0acf99931e..bd30244a54 100644
--- a/t/helper/test-oidmap.c
+++ b/t/helper/test-oidmap.c
@@ -1,7 +1,11 @@
#include "test-tool.h"
-#include "cache.h"
+#include "hex.h"
+#include "object-name.h"
#include "oidmap.h"
+#include "repository.h"
+#include "setup.h"
#include "strbuf.h"
+#include "string-list.h"
/* key is an oid and value is a name (could be a refname for example) */
struct test_entry {
@@ -21,8 +25,9 @@ struct test_entry {
* iterate -> oidkey1 namevalue1\noidkey2 namevalue2\n...
*
*/
-int cmd__oidmap(int argc, const char **argv)
+int cmd__oidmap(int argc UNUSED, const char **argv UNUSED)
{
+ struct string_list parts = STRING_LIST_INIT_NODUP;
struct strbuf line = STRBUF_INIT;
struct oidmap map = OIDMAP_INIT;
@@ -33,23 +38,28 @@ int cmd__oidmap(int argc, const char **argv)
/* process commands from stdin */
while (strbuf_getline(&line, stdin) != EOF) {
- char *cmd, *p1 = NULL, *p2 = NULL;
+ char *cmd, *p1, *p2;
struct test_entry *entry;
struct object_id oid;
/* break line into command and up to two parameters */
- cmd = strtok(line.buf, DELIM);
+ string_list_setlen(&parts, 0);
+ string_list_split_in_place(&parts, line.buf, DELIM, 2);
+ string_list_remove_empty_items(&parts, 0);
+
/* ignore empty lines */
- if (!cmd || *cmd == '#')
+ if (!parts.nr)
+ continue;
+ if (!*parts.items[0].string || *parts.items[0].string == '#')
continue;
- p1 = strtok(NULL, DELIM);
- if (p1)
- p2 = strtok(NULL, DELIM);
+ cmd = parts.items[0].string;
+ p1 = parts.nr >= 1 ? parts.items[1].string : NULL;
+ p2 = parts.nr >= 2 ? parts.items[2].string : NULL;
if (!strcmp("put", cmd) && p1 && p2) {
- if (get_oid(p1, &oid)) {
+ if (repo_get_oid(the_repository, p1, &oid)) {
printf("Unknown oid: %s\n", p1);
continue;
}
@@ -67,7 +77,7 @@ int cmd__oidmap(int argc, const char **argv)
} else if (!strcmp("get", cmd) && p1) {
- if (get_oid(p1, &oid)) {
+ if (repo_get_oid(the_repository, p1, &oid)) {
printf("Unknown oid: %s\n", p1);
continue;
}
@@ -80,7 +90,7 @@ int cmd__oidmap(int argc, const char **argv)
} else if (!strcmp("remove", cmd) && p1) {
- if (get_oid(p1, &oid)) {
+ if (repo_get_oid(the_repository, p1, &oid)) {
printf("Unknown oid: %s\n", p1);
continue;
}
@@ -106,6 +116,7 @@ int cmd__oidmap(int argc, const char **argv)
}
}
+ string_list_clear(&parts, 0);
strbuf_release(&line);
oidmap_free(&map, 1);
return 0;
diff --git a/t/helper/test-oidtree.c b/t/helper/test-oidtree.c
index d48a409f4e..c7a1d4c642 100644
--- a/t/helper/test-oidtree.c
+++ b/t/helper/test-oidtree.c
@@ -1,14 +1,16 @@
#include "test-tool.h"
-#include "cache.h"
+#include "hex.h"
#include "oidtree.h"
+#include "setup.h"
+#include "strbuf.h"
-static enum cb_next print_oid(const struct object_id *oid, void *data)
+static enum cb_next print_oid(const struct object_id *oid, void *data UNUSED)
{
puts(oid_to_hex(oid));
return CB_CONTINUE;
}
-int cmd__oidtree(int argc, const char **argv)
+int cmd__oidtree(int argc UNUSED, const char **argv UNUSED)
{
struct oidtree ot;
struct strbuf line = STRBUF_INIT;
diff --git a/t/helper/test-online-cpus.c b/t/helper/test-online-cpus.c
index 8cb0d53840..47dc211711 100644
--- a/t/helper/test-online-cpus.c
+++ b/t/helper/test-online-cpus.c
@@ -2,7 +2,7 @@
#include "git-compat-util.h"
#include "thread-utils.h"
-int cmd__online_cpus(int argc, const char **argv)
+int cmd__online_cpus(int argc UNUSED, const char **argv UNUSED)
{
printf("%d\n", online_cpus());
return 0;
diff --git a/t/helper/test-pack-mtimes.c b/t/helper/test-pack-mtimes.c
index f7b79daf4c..0f3fbeec53 100644
--- a/t/helper/test-pack-mtimes.c
+++ b/t/helper/test-pack-mtimes.c
@@ -1,9 +1,10 @@
-#include "git-compat-util.h"
#include "test-tool.h"
+#include "hex.h"
#include "strbuf.h"
#include "object-store.h"
#include "packfile.h"
#include "pack-mtimes.h"
+#include "setup.h"
static void dump_mtimes(struct packed_git *p)
{
diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c
index 506835521a..00fa281a9c 100644
--- a/t/helper/test-parse-options.c
+++ b/t/helper/test-parse-options.c
@@ -1,6 +1,6 @@
#include "test-tool.h"
-#include "cache.h"
#include "parse-options.h"
+#include "strbuf.h"
#include "string-list.h"
#include "trace2.h"
@@ -263,14 +263,14 @@ 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)
+static int subcmd_one(int argc, const char **argv, const char *prefix UNUSED)
{
printf("fn: subcmd_one\n");
print_args(argc, argv);
return 0;
}
-static int subcmd_two(int argc, const char **argv, const char *prefix)
+static int subcmd_two(int argc, const char **argv, const char *prefix UNUSED)
{
printf("fn: subcmd_two\n");
print_args(argc, argv);
diff --git a/t/helper/test-parse-pathspec-file.c b/t/helper/test-parse-pathspec-file.c
index b3e08cef4b..89ecefd1cd 100644
--- a/t/helper/test-parse-pathspec-file.c
+++ b/t/helper/test-parse-pathspec-file.c
@@ -1,12 +1,11 @@
#include "test-tool.h"
#include "parse-options.h"
#include "pathspec.h"
-#include "gettext.h"
int cmd__parse_pathspec_file(int argc, const char **argv)
{
struct pathspec pathspec;
- const char *pathspec_from_file = NULL;
+ char *pathspec_from_file = NULL;
int pathspec_file_nul = 0, i;
static const char *const usage[] = {
@@ -29,5 +28,6 @@ int cmd__parse_pathspec_file(int argc, const char **argv)
printf("%s\n", pathspec.items[i].original);
clear_pathspec(&pathspec);
+ free(pathspec_from_file);
return 0;
}
diff --git a/t/helper/test-partial-clone.c b/t/helper/test-partial-clone.c
index 3f102cfddd..362bd64a4c 100644
--- a/t/helper/test-partial-clone.c
+++ b/t/helper/test-partial-clone.c
@@ -1,7 +1,8 @@
-#include "cache.h"
#include "test-tool.h"
+#include "hex.h"
#include "repository.h"
#include "object-store.h"
+#include "setup.h"
/*
* Prints the size of the object corresponding to the given hash in a specific
diff --git a/t/helper/test-path-utils.c b/t/helper/test-path-utils.c
index d20e1b7a18..2ef53d5f7a 100644
--- a/t/helper/test-path-utils.c
+++ b/t/helper/test-path-utils.c
@@ -1,6 +1,11 @@
#include "test-tool.h"
#include "cache.h"
+#include "abspath.h"
+#include "environment.h"
+#include "path.h"
+#include "setup.h"
#include "string-list.h"
+#include "trace.h"
#include "utf8.h"
/*
@@ -8,7 +13,8 @@
* GIT_CEILING_DIRECTORIES. If the path is unusable for some reason,
* die with an explanation.
*/
-static int normalize_ceiling_entry(struct string_list_item *item, void *unused)
+static int normalize_ceiling_entry(struct string_list_item *item,
+ void *data UNUSED)
{
char *ceil = item->string;
diff --git a/t/helper/test-pcre2-config.c b/t/helper/test-pcre2-config.c
index 5258fdddba..5d0b2a2e10 100644
--- a/t/helper/test-pcre2-config.c
+++ b/t/helper/test-pcre2-config.c
@@ -1,5 +1,4 @@
#include "test-tool.h"
-#include "cache.h"
#include "grep.h"
int cmd__pcre2_config(int argc, const char **argv)
diff --git a/t/helper/test-pkt-line.c b/t/helper/test-pkt-line.c
index c5e052e537..f4d134a145 100644
--- a/t/helper/test-pkt-line.c
+++ b/t/helper/test-pkt-line.c
@@ -1,6 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "test-tool.h"
#include "pkt-line.h"
+#include "write-or-die.h"
static void pack_line(const char *line)
{
diff --git a/t/helper/test-prio-queue.c b/t/helper/test-prio-queue.c
index 133b5e6f4a..f0bf255f5f 100644
--- a/t/helper/test-prio-queue.c
+++ b/t/helper/test-prio-queue.c
@@ -1,8 +1,7 @@
#include "test-tool.h"
-#include "cache.h"
#include "prio-queue.h"
-static int intcmp(const void *va, const void *vb, void *data)
+static int intcmp(const void *va, const void *vb, void *data UNUSED)
{
const int *a = va, *b = vb;
return *a - *b;
@@ -17,7 +16,7 @@ static void show(int *v)
free(v);
}
-int cmd__prio_queue(int argc, const char **argv)
+int cmd__prio_queue(int argc UNUSED, const char **argv)
{
struct prio_queue pq = { intcmp };
diff --git a/t/helper/test-proc-receive.c b/t/helper/test-proc-receive.c
index cc08506cf0..f30022d222 100644
--- a/t/helper/test-proc-receive.c
+++ b/t/helper/test-proc-receive.c
@@ -1,12 +1,13 @@
-#include "cache.h"
+#include "test-tool.h"
#include "connect.h"
+#include "hex.h"
#include "parse-options.h"
#include "pkt-line.h"
+#include "setup.h"
#include "sigchain.h"
-#include "test-tool.h"
static const char *proc_receive_usage[] = {
- "test-tool proc-receive [<options>...]",
+ "test-tool proc-receive [<options>]",
NULL
};
diff --git a/t/helper/test-progress.c b/t/helper/test-progress.c
index 6cc9735b60..66acb6a06c 100644
--- a/t/helper/test-progress.c
+++ b/t/helper/test-progress.c
@@ -19,7 +19,6 @@
*/
#define GIT_TEST_PROGRESS_ONLY
#include "test-tool.h"
-#include "gettext.h"
#include "parse-options.h"
#include "progress.h"
#include "strbuf.h"
diff --git a/t/helper/test-reach.c b/t/helper/test-reach.c
index 2f65c7f6a5..5b6f217441 100644
--- a/t/helper/test-reach.c
+++ b/t/helper/test-reach.c
@@ -1,10 +1,14 @@
#include "test-tool.h"
-#include "cache.h"
+#include "alloc.h"
#include "commit.h"
#include "commit-reach.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-name.h"
#include "parse-options.h"
#include "ref-filter.h"
+#include "setup.h"
#include "string-list.h"
#include "tag.h"
@@ -57,7 +61,7 @@ int cmd__reach(int ac, const char **av)
if (buf.len < 3)
continue;
- if (get_oid_committish(buf.buf + 2, &oid))
+ if (repo_get_oid_committish(the_repository, buf.buf + 2, &oid))
die("failed to resolve %s", buf.buf + 2);
orig = parse_object(r, &oid);
@@ -106,13 +110,17 @@ int cmd__reach(int ac, const char **av)
if (!strcmp(av[1], "ref_newer"))
printf("%s(A,B):%d\n", av[1], ref_newer(&oid_A, &oid_B));
else if (!strcmp(av[1], "in_merge_bases"))
- printf("%s(A,B):%d\n", av[1], in_merge_bases(A, B));
+ printf("%s(A,B):%d\n", av[1],
+ repo_in_merge_bases(the_repository, A, B));
else if (!strcmp(av[1], "in_merge_bases_many"))
- printf("%s(A,X):%d\n", av[1], in_merge_bases_many(A, X_nr, X_array));
+ printf("%s(A,X):%d\n", av[1],
+ repo_in_merge_bases_many(the_repository, A, X_nr, X_array));
else if (!strcmp(av[1], "is_descendant_of"))
printf("%s(A,X):%d\n", av[1], repo_is_descendant_of(r, A, X));
else if (!strcmp(av[1], "get_merge_bases_many")) {
- struct commit_list *list = get_merge_bases_many(A, X_nr, X_array);
+ struct commit_list *list = repo_get_merge_bases_many(the_repository,
+ A, X_nr,
+ X_array);
printf("%s(A,X):\n", av[1]);
print_sorted_commit_ids(list);
} else if (!strcmp(av[1], "reduce_heads")) {
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c
index b736ef1642..c1ae276395 100644
--- a/t/helper/test-read-cache.c
+++ b/t/helper/test-read-cache.c
@@ -1,6 +1,10 @@
+#define USE_THE_INDEX_VARIABLE
#include "test-tool.h"
#include "cache.h"
#include "config.h"
+#include "repository.h"
+#include "setup.h"
+#include "wrapper.h"
int cmd__read_cache(int argc, const char **argv)
{
@@ -20,7 +24,7 @@ int cmd__read_cache(int argc, const char **argv)
git_config(git_default_config, NULL);
for (i = 0; i < cnt; i++) {
- read_cache();
+ repo_read_index(the_repository);
if (name) {
int pos;
@@ -33,7 +37,7 @@ int cmd__read_cache(int argc, const char **argv)
ce_uptodate(the_index.cache[pos]) ? "" : " not");
write_file(name, "%d\n", i);
}
- discard_cache();
+ discard_index(&the_index);
}
return 0;
}
diff --git a/t/helper/test-read-graph.c b/t/helper/test-read-graph.c
index 98b73bb8f2..3ac496e27e 100644
--- a/t/helper/test-read-graph.c
+++ b/t/helper/test-read-graph.c
@@ -1,11 +1,11 @@
#include "test-tool.h"
-#include "cache.h"
#include "commit-graph.h"
#include "repository.h"
#include "object-store.h"
#include "bloom.h"
+#include "setup.h"
-int cmd__read_graph(int argc, const char **argv)
+int cmd__read_graph(int argc UNUSED, const char **argv UNUSED)
{
struct commit_graph *graph = NULL;
struct object_directory *odb;
diff --git a/t/helper/test-read-midx.c b/t/helper/test-read-midx.c
index 27072ba94d..211addaa00 100644
--- a/t/helper/test-read-midx.c
+++ b/t/helper/test-read-midx.c
@@ -1,9 +1,11 @@
#include "test-tool.h"
-#include "cache.h"
+#include "hex.h"
#include "midx.h"
#include "repository.h"
#include "object-store.h"
#include "pack-bitmap.h"
+#include "packfile.h"
+#include "setup.h"
static int read_midx_file(const char *object_dir, int show_objects)
{
diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c
index ae8a5648da..6d8f844e9c 100644
--- a/t/helper/test-ref-store.c
+++ b/t/helper/test-ref-store.c
@@ -1,6 +1,7 @@
#include "test-tool.h"
-#include "cache.h"
+#include "hex.h"
#include "refs.h"
+#include "setup.h"
#include "worktree.h"
#include "object-store.h"
#include "repository.h"
@@ -200,7 +201,8 @@ static int cmd_verify_ref(struct ref_store *refs, const char **argv)
return ret;
}
-static int cmd_for_each_reflog(struct ref_store *refs, const char **argv)
+static int cmd_for_each_reflog(struct ref_store *refs,
+ const char **argv UNUSED)
{
return refs_for_each_reflog(refs, each_ref, NULL);
}
@@ -322,7 +324,7 @@ static struct command commands[] = {
{ NULL, NULL }
};
-int cmd__ref_store(int argc, const char **argv)
+int cmd__ref_store(int argc UNUSED, const char **argv)
{
struct ref_store *refs;
const char *func;
diff --git a/t/helper/test-reftable.c b/t/helper/test-reftable.c
index 1f0a28cbb6..00237ef0d9 100644
--- a/t/helper/test-reftable.c
+++ b/t/helper/test-reftable.c
@@ -1,3 +1,4 @@
+#include "reftable/system.h"
#include "reftable/reftable-tests.h"
#include "test-tool.h"
diff --git a/t/helper/test-repository.c b/t/helper/test-repository.c
index 56f0e3c1be..bafd2a5bf9 100644
--- a/t/helper/test-repository.c
+++ b/t/helper/test-repository.c
@@ -1,11 +1,13 @@
#include "test-tool.h"
-#include "cache.h"
#include "commit-graph.h"
#include "commit.h"
#include "config.h"
+#include "environment.h"
+#include "hex.h"
#include "object-store.h"
#include "object.h"
#include "repository.h"
+#include "setup.h"
#include "tree.h"
static void test_parse_commit_in_graph(const char *gitdir, const char *worktree,
diff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c
index 4a45d5bac2..0c62b9de18 100644
--- a/t/helper/test-revision-walking.c
+++ b/t/helper/test-revision-walking.c
@@ -9,17 +9,18 @@
*/
#include "test-tool.h"
-#include "cache.h"
#include "commit.h"
#include "diff.h"
#include "revision.h"
+#include "setup.h"
static void print_commit(struct commit *commit)
{
struct strbuf sb = STRBUF_INIT;
struct pretty_print_context ctx = {0};
ctx.date_mode.type = DATE_NORMAL;
- format_commit_message(commit, " %m %s", &sb, &ctx);
+ repo_format_commit_message(the_repository, commit, " %m %s", &sb,
+ &ctx);
printf("%s\n", sb.buf);
strbuf_release(&sb);
}
diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c
index c9283b47af..c0ed8722c8 100644
--- a/t/helper/test-run-command.c
+++ b/t/helper/test-run-command.c
@@ -9,8 +9,6 @@
*/
#include "test-tool.h"
-#include "git-compat-util.h"
-#include "cache.h"
#include "run-command.h"
#include "strvec.h"
#include "strbuf.h"
@@ -18,13 +16,12 @@
#include "string-list.h"
#include "thread-utils.h"
#include "wildmatch.h"
-#include "gettext.h"
static int number_callbacks;
static int parallel_next(struct child_process *cp,
struct strbuf *err,
void *cb,
- void **task_cb)
+ void **task_cb UNUSED)
{
struct child_process *d = cb;
if (number_callbacks >= 4)
@@ -40,10 +37,10 @@ static int parallel_next(struct child_process *cp,
return 1;
}
-static int no_job(struct child_process *cp,
+static int no_job(struct child_process *cp UNUSED,
struct strbuf *err,
- void *cb,
- void **task_cb)
+ void *cb UNUSED,
+ void **task_cb UNUSED)
{
if (err)
strbuf_addstr(err, "no further jobs available\n");
@@ -52,10 +49,10 @@ static int no_job(struct child_process *cp,
return 0;
}
-static int task_finished(int result,
+static int task_finished(int result UNUSED,
struct strbuf *err,
- void *pp_cb,
- void *pp_task_cb)
+ void *pp_cb UNUSED,
+ void *pp_task_cb UNUSED)
{
if (err)
strbuf_addstr(err, "asking for a quick stop\n");
@@ -136,7 +133,7 @@ static const char * const testsuite_usage[] = {
static int testsuite(int argc, const char **argv)
{
struct testsuite suite = TESTSUITE_INIT;
- int max_jobs = 1, i, ret;
+ int max_jobs = 1, i, ret = 0;
DIR *dir;
struct dirent *d;
struct option options[] = {
@@ -152,6 +149,12 @@ static int testsuite(int argc, const char **argv)
"write JUnit-style XML files"),
OPT_END()
};
+ struct run_process_parallel_opts opts = {
+ .get_next_task = next_test,
+ .start_failure = test_failed,
+ .task_finished = test_finished,
+ .data = &suite,
+ };
argc = parse_options(argc, argv, NULL, options,
testsuite_usage, PARSE_OPT_STOP_AT_NON_OPTION);
@@ -192,8 +195,8 @@ static int testsuite(int argc, const char **argv)
fprintf(stderr, "Running %"PRIuMAX" tests (%d at a time)\n",
(uintmax_t)suite.tests.nr, max_jobs);
- ret = run_processes_parallel(max_jobs, next_test, test_failed,
- test_finished, &suite);
+ opts.processes = max_jobs;
+ run_processes_parallel(&opts);
if (suite.failed.nr > 0) {
ret = 1;
@@ -206,7 +209,7 @@ static int testsuite(int argc, const char **argv)
string_list_clear(&suite.tests, 0);
string_list_clear(&suite.failed, 0);
- return !!ret;
+ return ret;
}
static uint64_t my_random_next = 1234;
@@ -381,13 +384,17 @@ int cmd__run_command(int argc, const char **argv)
{
struct child_process proc = CHILD_PROCESS_INIT;
int jobs;
+ int ret;
+ struct run_process_parallel_opts opts = {
+ .data = &proc,
+ };
if (argc > 1 && !strcmp(argv[1], "testsuite"))
- exit(testsuite(argc - 1, argv + 1));
+ return testsuite(argc - 1, argv + 1);
if (!strcmp(argv[1], "inherited-handle"))
- exit(inherit_handle(argv[0]));
+ return inherit_handle(argv[0]);
if (!strcmp(argv[1], "inherited-handle-child"))
- exit(inherit_handle_child());
+ return inherit_handle_child();
if (argc >= 2 && !strcmp(argv[1], "quote-stress-test"))
return !!quote_stress_test(argc - 1, argv + 1);
@@ -404,41 +411,52 @@ int cmd__run_command(int argc, const char **argv)
argv += 2;
argc -= 2;
}
- if (argc < 3)
- return 1;
+ if (argc < 3) {
+ ret = 1;
+ goto cleanup;
+ }
strvec_pushv(&proc.args, (const char **)argv + 2);
if (!strcmp(argv[1], "start-command-ENOENT")) {
- if (start_command(&proc) < 0 && errno == ENOENT)
- return 0;
+ if (start_command(&proc) < 0 && errno == ENOENT) {
+ ret = 0;
+ goto cleanup;
+ }
fprintf(stderr, "FAIL %s\n", argv[1]);
return 1;
}
- if (!strcmp(argv[1], "run-command"))
- exit(run_command(&proc));
+ if (!strcmp(argv[1], "run-command")) {
+ ret = run_command(&proc);
+ goto cleanup;
+ }
if (!strcmp(argv[1], "--ungroup")) {
argv += 1;
argc -= 1;
- run_processes_parallel_ungroup = 1;
+ opts.ungroup = 1;
}
jobs = atoi(argv[2]);
strvec_clear(&proc.args);
strvec_pushv(&proc.args, (const char **)argv + 3);
- if (!strcmp(argv[1], "run-command-parallel"))
- exit(run_processes_parallel(jobs, parallel_next,
- NULL, NULL, &proc));
-
- if (!strcmp(argv[1], "run-command-abort"))
- exit(run_processes_parallel(jobs, parallel_next,
- NULL, task_finished, &proc));
-
- if (!strcmp(argv[1], "run-command-no-jobs"))
- exit(run_processes_parallel(jobs, no_job,
- NULL, task_finished, &proc));
-
- fprintf(stderr, "check usage\n");
- return 1;
+ if (!strcmp(argv[1], "run-command-parallel")) {
+ opts.get_next_task = parallel_next;
+ } else if (!strcmp(argv[1], "run-command-abort")) {
+ opts.get_next_task = parallel_next;
+ opts.task_finished = task_finished;
+ } else if (!strcmp(argv[1], "run-command-no-jobs")) {
+ opts.get_next_task = no_job;
+ opts.task_finished = task_finished;
+ } else {
+ ret = 1;
+ fprintf(stderr, "check usage\n");
+ goto cleanup;
+ }
+ opts.processes = jobs;
+ run_processes_parallel(&opts);
+ ret = 0;
+cleanup:
+ child_process_clear(&proc);
+ return ret;
}
diff --git a/t/helper/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c
index 026c802479..6e17f50d22 100644
--- a/t/helper/test-scrap-cache-tree.c
+++ b/t/helper/test-scrap-cache-tree.c
@@ -1,19 +1,22 @@
+#define USE_THE_INDEX_VARIABLE
#include "test-tool.h"
#include "cache.h"
#include "lockfile.h"
+#include "repository.h"
+#include "setup.h"
#include "tree.h"
#include "cache-tree.h"
-int cmd__scrap_cache_tree(int ac, const char **av)
+int cmd__scrap_cache_tree(int ac UNUSED, const char **av UNUSED)
{
struct lock_file index_lock = LOCK_INIT;
setup_git_directory();
- hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
- if (read_cache() < 0)
+ repo_hold_locked_index(the_repository, &index_lock, LOCK_DIE_ON_ERROR);
+ if (repo_read_index(the_repository) < 0)
die("unable to read index file");
- cache_tree_free(&active_cache_tree);
- active_cache_tree = NULL;
+ cache_tree_free(&the_index.cache_tree);
+ the_index.cache_tree = NULL;
if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
die("unable to write index file");
return 0;
diff --git a/t/helper/test-serve-v2.c b/t/helper/test-serve-v2.c
index 824e5c0a95..054cbcf5d8 100644
--- a/t/helper/test-serve-v2.c
+++ b/t/helper/test-serve-v2.c
@@ -1,7 +1,8 @@
#include "test-tool.h"
-#include "cache.h"
+#include "gettext.h"
#include "parse-options.h"
#include "serve.h"
+#include "setup.h"
static char const * const serve_usage[] = {
N_("test-tool serve-v2 [<options>]"),
diff --git a/t/helper/test-sha1.c b/t/helper/test-sha1.c
index d860c387c3..71fe5c6145 100644
--- a/t/helper/test-sha1.c
+++ b/t/helper/test-sha1.c
@@ -5,3 +5,11 @@ int cmd__sha1(int ac, const char **av)
{
return cmd_hash_impl(ac, av, GIT_HASH_SHA1);
}
+
+int cmd__sha1_is_sha1dc(int argc UNUSED, const char **argv UNUSED)
+{
+#ifdef platform_SHA_IS_SHA1DC
+ return 0;
+#endif
+ return 1;
+}
diff --git a/t/helper/test-sigchain.c b/t/helper/test-sigchain.c
index d013bccdda..2d5ecf7383 100644
--- a/t/helper/test-sigchain.c
+++ b/t/helper/test-sigchain.c
@@ -1,5 +1,4 @@
#include "test-tool.h"
-#include "cache.h"
#include "sigchain.h"
#define X(f) \
@@ -14,7 +13,7 @@ X(two)
X(three)
#undef X
-int cmd__sigchain(int argc, const char **argv)
+int cmd__sigchain(int argc UNUSED, const char **argv UNUSED)
{
sigchain_push(SIGTERM, one);
sigchain_push(SIGTERM, two);
diff --git a/t/helper/test-simple-ipc.c b/t/helper/test-simple-ipc.c
index 28365ff85b..3d1436da59 100644
--- a/t/helper/test-simple-ipc.c
+++ b/t/helper/test-simple-ipc.c
@@ -3,13 +3,14 @@
*/
#include "test-tool.h"
-#include "cache.h"
+#include "gettext.h"
#include "strbuf.h"
#include "simple-ipc.h"
#include "parse-options.h"
#include "thread-utils.h"
#include "strvec.h"
#include "run-command.h"
+#include "trace2.h"
#ifndef SUPPORTS_SIMPLE_IPC
int cmd__simple_ipc(int argc, const char **argv)
diff --git a/t/helper/test-strcmp-offset.c b/t/helper/test-strcmp-offset.c
index 44e4a6d143..96b9a5b529 100644
--- a/t/helper/test-strcmp-offset.c
+++ b/t/helper/test-strcmp-offset.c
@@ -1,7 +1,7 @@
#include "test-tool.h"
#include "cache.h"
-int cmd__strcmp_offset(int argc, const char **argv)
+int cmd__strcmp_offset(int argc UNUSED, const char **argv)
{
int result;
size_t offset;
diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c
index 2123dda85b..e2aad611d1 100644
--- a/t/helper/test-string-list.c
+++ b/t/helper/test-string-list.c
@@ -1,5 +1,5 @@
#include "test-tool.h"
-#include "cache.h"
+#include "strbuf.h"
#include "string-list.h"
/*
@@ -62,7 +62,7 @@ int cmd__string_list(int argc, const char **argv)
struct string_list list = STRING_LIST_INIT_NODUP;
int i;
char *s = xstrdup(argv[2]);
- int delim = *argv[3];
+ const char *delim = argv[3];
int maxsplit = atoi(argv[4]);
i = string_list_split_in_place(&list, s, delim, maxsplit);
@@ -111,7 +111,7 @@ int cmd__string_list(int argc, const char **argv)
*/
if (sb.len && sb.buf[sb.len - 1] == '\n')
strbuf_setlen(&sb, sb.len - 1);
- string_list_split_in_place(&list, sb.buf, '\n', -1);
+ string_list_split_in_place(&list, sb.buf, "\n", -1);
string_list_sort(&list);
diff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c
index 22a41c4092..9df2f03ac8 100644
--- a/t/helper/test-submodule-config.c
+++ b/t/helper/test-submodule-config.c
@@ -1,10 +1,13 @@
#include "test-tool.h"
-#include "cache.h"
#include "config.h"
+#include "hash.h"
+#include "object-name.h"
+#include "repository.h"
+#include "setup.h"
#include "submodule-config.h"
#include "submodule.h"
-static void die_usage(int argc, const char **argv, const char *msg)
+static void die_usage(int argc UNUSED, const char **argv, const char *msg)
{
fprintf(stderr, "%s\n", msg);
fprintf(stderr, "Usage: %s [<commit> <submodulepath>] ...\n", argv[0]);
@@ -42,7 +45,7 @@ int cmd__submodule_config(int argc, const char **argv)
if (commit[0] == '\0')
oidclr(&commit_oid);
- else if (get_oid(commit, &commit_oid) < 0)
+ else if (repo_get_oid(the_repository, commit, &commit_oid) < 0)
die_usage(argc, argv, "Commit not found.");
if (lookup_name) {
diff --git a/t/helper/test-submodule-nested-repo-config.c b/t/helper/test-submodule-nested-repo-config.c
index dc1c14bde3..ecd40ded99 100644
--- a/t/helper/test-submodule-nested-repo-config.c
+++ b/t/helper/test-submodule-nested-repo-config.c
@@ -1,4 +1,6 @@
#include "test-tool.h"
+#include "repository.h"
+#include "setup.h"
#include "submodule-config.h"
static void die_usage(const char **argv, const char *msg)
diff --git a/t/helper/test-submodule.c b/t/helper/test-submodule.c
index b7d117cd55..356e0a26c5 100644
--- a/t/helper/test-submodule.c
+++ b/t/helper/test-submodule.c
@@ -1,8 +1,9 @@
#include "test-tool.h"
#include "test-tool-utils.h"
-#include "cache.h"
#include "parse-options.h"
#include "remote.h"
+#include "repository.h"
+#include "setup.h"
#include "submodule-config.h"
#include "submodule.h"
@@ -111,10 +112,94 @@ static int cmd__submodule_resolve_relative_url(int argc, const char **argv)
return 0;
}
+static int cmd__submodule_config_list(int argc, const char **argv)
+{
+ struct option options[] = {
+ OPT_END()
+ };
+ const char *const usage[] = {
+ "test-tool submodule config-list <key>",
+ NULL
+ };
+ argc = parse_options(argc, argv, "test-tools", options, usage,
+ PARSE_OPT_KEEP_ARGV0);
+
+ setup_git_directory();
+
+ if (argc == 2)
+ return print_config_from_gitmodules(the_repository, argv[1]);
+ usage_with_options(usage, options);
+}
+
+static int cmd__submodule_config_set(int argc, const char **argv)
+{
+ struct option options[] = {
+ OPT_END()
+ };
+ const char *const usage[] = {
+ "test-tool submodule config-set <key> <value>",
+ NULL
+ };
+ argc = parse_options(argc, argv, "test-tools", options, usage,
+ PARSE_OPT_KEEP_ARGV0);
+
+ setup_git_directory();
+
+ /* Equivalent to ACTION_SET in builtin/config.c */
+ if (argc == 3) {
+ if (!is_writing_gitmodules_ok())
+ die("please make sure that the .gitmodules file is in the working tree");
+
+ return config_set_in_gitmodules_file_gently(argv[1], argv[2]);
+ }
+ usage_with_options(usage, options);
+}
+
+static int cmd__submodule_config_unset(int argc, const char **argv)
+{
+ struct option options[] = {
+ OPT_END()
+ };
+ const char *const usage[] = {
+ "test-tool submodule config-unset <key>",
+ NULL
+ };
+
+ setup_git_directory();
+
+ if (argc == 2) {
+ if (!is_writing_gitmodules_ok())
+ die("please make sure that the .gitmodules file is in the working tree");
+ return config_set_in_gitmodules_file_gently(argv[1], NULL);
+ }
+ usage_with_options(usage, options);
+}
+
+static int cmd__submodule_config_writeable(int argc, const char **argv UNUSED)
+{
+ struct option options[] = {
+ OPT_END()
+ };
+ const char *const usage[] = {
+ "test-tool submodule config-writeable",
+ NULL
+ };
+ setup_git_directory();
+
+ if (argc == 1)
+ return is_writing_gitmodules_ok() ? 0 : -1;
+
+ usage_with_options(usage, options);
+}
+
static struct test_cmd cmds[] = {
{ "check-name", cmd__submodule_check_name },
{ "is-active", cmd__submodule_is_active },
{ "resolve-relative-url", cmd__submodule_resolve_relative_url},
+ { "config-list", cmd__submodule_config_list },
+ { "config-set", cmd__submodule_config_set },
+ { "config-unset", cmd__submodule_config_unset },
+ { "config-writeable", cmd__submodule_config_writeable },
};
int cmd__submodule(int argc, const char **argv)
diff --git a/t/helper/test-subprocess.c b/t/helper/test-subprocess.c
index ff22f2fa2c..c344f1694d 100644
--- a/t/helper/test-subprocess.c
+++ b/t/helper/test-subprocess.c
@@ -1,6 +1,6 @@
#include "test-tool.h"
-#include "cache.h"
#include "run-command.h"
+#include "setup.h"
int cmd__subprocess(int argc, const char **argv)
{
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index d1d013bcd9..abe8a785eb 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -13,6 +13,8 @@ static struct test_cmd cmds[] = {
{ "advise", cmd__advise_if_enabled },
{ "bitmap", cmd__bitmap },
{ "bloom", cmd__bloom },
+ { "bundle-uri", cmd__bundle_uri },
+ { "cache-tree", cmd__cache_tree },
{ "chmtime", cmd__chmtime },
{ "config", cmd__config },
{ "crontab", cmd__crontab },
@@ -26,6 +28,7 @@ static struct test_cmd cmds[] = {
{ "dump-fsmonitor", cmd__dump_fsmonitor },
{ "dump-split-index", cmd__dump_split_index },
{ "dump-untracked-cache", cmd__dump_untracked_cache },
+ { "env-helper", cmd__env_helper },
{ "example-decorate", cmd__example_decorate },
{ "fast-rebase", cmd__fast_rebase },
{ "fsmonitor-client", cmd__fsmonitor_client },
@@ -72,6 +75,7 @@ static struct test_cmd cmds[] = {
{ "scrap-cache-tree", cmd__scrap_cache_tree },
{ "serve-v2", cmd__serve_v2 },
{ "sha1", cmd__sha1 },
+ { "sha1-is-sha1dc", cmd__sha1_is_sha1dc },
{ "sha256", cmd__sha256 },
{ "sigchain", cmd__sigchain },
{ "simple-ipc", cmd__simple_ipc },
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index 6b46b6444b..ea2672436c 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -1,12 +1,13 @@
#ifndef TEST_TOOL_H
#define TEST_TOOL_H
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "git-compat-util.h"
int cmd__advise_if_enabled(int argc, const char **argv);
int cmd__bitmap(int argc, const char **argv);
int cmd__bloom(int argc, const char **argv);
+int cmd__bundle_uri(int argc, const char **argv);
+int cmd__cache_tree(int argc, const char **argv);
int cmd__chmtime(int argc, const char **argv);
int cmd__config(int argc, const char **argv);
int cmd__crontab(int argc, const char **argv);
@@ -21,6 +22,7 @@ int cmd__dump_fsmonitor(int argc, const char **argv);
int cmd__dump_split_index(int argc, const char **argv);
int cmd__dump_untracked_cache(int argc, const char **argv);
int cmd__dump_reftable(int argc, const char **argv);
+int cmd__env_helper(int argc, const char **argv);
int cmd__example_decorate(int argc, const char **argv);
int cmd__fast_rebase(int argc, const char **argv);
int cmd__fsmonitor_client(int argc, const char **argv);
@@ -65,6 +67,7 @@ int cmd__run_command(int argc, const char **argv);
int cmd__scrap_cache_tree(int argc, const char **argv);
int cmd__serve_v2(int argc, const char **argv);
int cmd__sha1(int argc, const char **argv);
+int cmd__sha1_is_sha1dc(int argc, const char **argv);
int cmd__oid_array(int argc, const char **argv);
int cmd__sha256(int argc, const char **argv);
int cmd__sigchain(int argc, const char **argv);
diff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c
index a714130ece..20c7495f38 100644
--- a/t/helper/test-trace2.c
+++ b/t/helper/test-trace2.c
@@ -1,9 +1,10 @@
#include "test-tool.h"
-#include "cache.h"
#include "strvec.h"
#include "run-command.h"
#include "exec-cmd.h"
#include "config.h"
+#include "repository.h"
+#include "trace2.h"
typedef int(fn_unit_test)(int argc, const char **argv);
@@ -132,6 +133,7 @@ static int ut_003error(int argc, const char **argv)
*/
static int ut_004child(int argc, const char **argv)
{
+ struct child_process cmd = CHILD_PROCESS_INIT;
int result;
/*
@@ -141,7 +143,8 @@ static int ut_004child(int argc, const char **argv)
if (!argc)
return 0;
- result = run_command_v_opt(argv, 0);
+ strvec_pushv(&cmd.args, argv);
+ result = run_command(&cmd);
exit(result);
}
@@ -206,7 +209,7 @@ static int ut_007BUG(int argc, const char **argv)
BUG("the bug message");
}
-static int ut_008bug(int argc, const char **argv)
+static int ut_008bug(int argc UNUSED, const char **argv UNUSED)
{
bug("a bug message");
bug("another bug message");
@@ -214,7 +217,7 @@ static int ut_008bug(int argc, const char **argv)
return 0;
}
-static int ut_009bug_BUG(int argc, const char **argv)
+static int ut_009bug_BUG(int argc UNUSED, const char **argv UNUSED)
{
bug("a bug message");
bug("another bug message");
@@ -222,13 +225,194 @@ static int ut_009bug_BUG(int argc, const char **argv)
return 0;
}
-static int ut_010bug_BUG(int argc, const char **argv)
+static int ut_010bug_BUG(int argc UNUSED, const char **argv UNUSED)
{
bug("a %s message", "bug");
BUG("a %s message", "BUG");
}
/*
+ * Single-threaded timer test. Create several intervals using the
+ * TEST1 timer. The test script can verify that an aggregate Trace2
+ * "timer" event is emitted indicating that we started+stopped the
+ * timer the requested number of times.
+ */
+static int ut_100timer(int argc, const char **argv)
+{
+ const char *usage_error =
+ "expect <count> <ms_delay>";
+
+ int count = 0;
+ int delay = 0;
+ int k;
+
+ if (argc != 2)
+ die("%s", usage_error);
+ if (get_i(&count, argv[0]))
+ die("%s", usage_error);
+ if (get_i(&delay, argv[1]))
+ die("%s", usage_error);
+
+ for (k = 0; k < count; k++) {
+ trace2_timer_start(TRACE2_TIMER_ID_TEST1);
+ sleep_millisec(delay);
+ trace2_timer_stop(TRACE2_TIMER_ID_TEST1);
+ }
+
+ return 0;
+}
+
+struct ut_101_data {
+ int count;
+ int delay;
+};
+
+static void *ut_101timer_thread_proc(void *_ut_101_data)
+{
+ struct ut_101_data *data = _ut_101_data;
+ int k;
+
+ trace2_thread_start("ut_101");
+
+ for (k = 0; k < data->count; k++) {
+ trace2_timer_start(TRACE2_TIMER_ID_TEST2);
+ sleep_millisec(data->delay);
+ trace2_timer_stop(TRACE2_TIMER_ID_TEST2);
+ }
+
+ trace2_thread_exit();
+ return NULL;
+}
+
+/*
+ * Multi-threaded timer test. Create several threads that each create
+ * several intervals using the TEST2 timer. The test script can verify
+ * that an individual Trace2 "th_timer" events for each thread and an
+ * aggregate "timer" event are generated.
+ */
+static int ut_101timer(int argc, const char **argv)
+{
+ const char *usage_error =
+ "expect <count> <ms_delay> <threads>";
+
+ struct ut_101_data data = { 0, 0 };
+ int nr_threads = 0;
+ int k;
+ pthread_t *pids = NULL;
+
+ if (argc != 3)
+ die("%s", usage_error);
+ if (get_i(&data.count, argv[0]))
+ die("%s", usage_error);
+ if (get_i(&data.delay, argv[1]))
+ die("%s", usage_error);
+ if (get_i(&nr_threads, argv[2]))
+ die("%s", usage_error);
+
+ CALLOC_ARRAY(pids, nr_threads);
+
+ for (k = 0; k < nr_threads; k++) {
+ if (pthread_create(&pids[k], NULL, ut_101timer_thread_proc, &data))
+ die("failed to create thread[%d]", k);
+ }
+
+ for (k = 0; k < nr_threads; k++) {
+ if (pthread_join(pids[k], NULL))
+ die("failed to join thread[%d]", k);
+ }
+
+ free(pids);
+
+ return 0;
+}
+
+/*
+ * Single-threaded counter test. Add several values to the TEST1 counter.
+ * The test script can verify that the final sum is reported in the "counter"
+ * event.
+ */
+static int ut_200counter(int argc, const char **argv)
+{
+ const char *usage_error =
+ "expect <v1> [<v2> [...]]";
+ int value;
+ int k;
+
+ if (argc < 1)
+ die("%s", usage_error);
+
+ for (k = 0; k < argc; k++) {
+ if (get_i(&value, argv[k]))
+ die("invalid value[%s] -- %s",
+ argv[k], usage_error);
+ trace2_counter_add(TRACE2_COUNTER_ID_TEST1, value);
+ }
+
+ return 0;
+}
+
+/*
+ * Multi-threaded counter test. Create seveal threads that each increment
+ * the TEST2 global counter. The test script can verify that an individual
+ * "th_counter" event is generated with a partial sum for each thread and
+ * that a final aggregate "counter" event is generated.
+ */
+
+struct ut_201_data {
+ int v1;
+ int v2;
+};
+
+static void *ut_201counter_thread_proc(void *_ut_201_data)
+{
+ struct ut_201_data *data = _ut_201_data;
+
+ trace2_thread_start("ut_201");
+
+ trace2_counter_add(TRACE2_COUNTER_ID_TEST2, data->v1);
+ trace2_counter_add(TRACE2_COUNTER_ID_TEST2, data->v2);
+
+ trace2_thread_exit();
+ return NULL;
+}
+
+static int ut_201counter(int argc, const char **argv)
+{
+ const char *usage_error =
+ "expect <v1> <v2> <threads>";
+
+ struct ut_201_data data = { 0, 0 };
+ int nr_threads = 0;
+ int k;
+ pthread_t *pids = NULL;
+
+ if (argc != 3)
+ die("%s", usage_error);
+ if (get_i(&data.v1, argv[0]))
+ die("%s", usage_error);
+ if (get_i(&data.v2, argv[1]))
+ die("%s", usage_error);
+ if (get_i(&nr_threads, argv[2]))
+ die("%s", usage_error);
+
+ CALLOC_ARRAY(pids, nr_threads);
+
+ for (k = 0; k < nr_threads; k++) {
+ if (pthread_create(&pids[k], NULL, ut_201counter_thread_proc, &data))
+ die("failed to create thread[%d]", k);
+ }
+
+ for (k = 0; k < nr_threads; k++) {
+ if (pthread_join(pids[k], NULL))
+ die("failed to join thread[%d]", k);
+ }
+
+ free(pids);
+
+ return 0;
+}
+
+/*
* Usage:
* test-tool trace2 <ut_name_1> <ut_usage_1>
* test-tool trace2 <ut_name_2> <ut_usage_2>
@@ -248,6 +432,12 @@ static struct unit_test ut_table[] = {
{ ut_008bug, "008bug", "" },
{ ut_009bug_BUG, "009bug_BUG","" },
{ ut_010bug_BUG, "010bug_BUG","" },
+
+ { ut_100timer, "100timer", "<count> <ms_delay>" },
+ { ut_101timer, "101timer", "<count> <ms_delay> <threads>" },
+
+ { ut_200counter, "200counter", "<v1> [<v2> [<v3> [...]]]" },
+ { ut_201counter, "201counter", "<v1> <v2> <threads>" },
};
/* clang-format on */
diff --git a/t/helper/test-userdiff.c b/t/helper/test-userdiff.c
index a2b56b9cae..680124a676 100644
--- a/t/helper/test-userdiff.c
+++ b/t/helper/test-userdiff.c
@@ -1,5 +1,5 @@
#include "test-tool.h"
-#include "cache.h"
+#include "setup.h"
#include "userdiff.h"
#include "config.h"
diff --git a/t/helper/test-wildmatch.c b/t/helper/test-wildmatch.c
index 2c103d1824..a95bb4da9b 100644
--- a/t/helper/test-wildmatch.c
+++ b/t/helper/test-wildmatch.c
@@ -1,5 +1,4 @@
#include "test-tool.h"
-#include "cache.h"
int cmd__wildmatch(int argc, const char **argv)
{
diff --git a/t/helper/test-write-cache.c b/t/helper/test-write-cache.c
index 8837717d36..eace08072d 100644
--- a/t/helper/test-write-cache.c
+++ b/t/helper/test-write-cache.c
@@ -1,6 +1,9 @@
+#define USE_THE_INDEX_VARIABLE
#include "test-tool.h"
#include "cache.h"
#include "lockfile.h"
+#include "repository.h"
+#include "setup.h"
int cmd__write_cache(int argc, const char **argv)
{
@@ -9,9 +12,10 @@ int cmd__write_cache(int argc, const char **argv)
if (argc == 2)
cnt = strtol(argv[1], NULL, 0);
setup_git_directory();
- read_cache();
+ repo_read_index(the_repository);
for (i = 0; i < cnt; i++) {
- hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
+ repo_hold_locked_index(the_repository, &index_lock,
+ LOCK_DIE_ON_ERROR);
if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
die("unable to write index file");
}
diff --git a/t/helper/test-xml-encode.c b/t/helper/test-xml-encode.c
index a648bbd961..b2f330d1a4 100644
--- a/t/helper/test-xml-encode.c
+++ b/t/helper/test-xml-encode.c
@@ -6,7 +6,7 @@ static const char *utf8_replace_character = "&#xfffd;";
* Encodes (possibly incorrect) UTF-8 on <stdin> to <stdout>, to be embedded
* in an XML file.
*/
-int cmd__xml_encode(int argc, const char **argv)
+int cmd__xml_encode(int argc UNUSED, const char **argv UNUSED)
{
unsigned char buf[1024], tmp[4], *tmp2 = NULL;
ssize_t cur = 0, len = 1, remaining = 0;
diff --git a/t/interop/interop-lib.sh b/t/interop/interop-lib.sh
index 3e0a2911d4..62f4481b6e 100644
--- a/t/interop/interop-lib.sh
+++ b/t/interop/interop-lib.sh
@@ -68,7 +68,7 @@ generate_wrappers () {
wrap_git .bin/git.a "$DIR_A" &&
wrap_git .bin/git.b "$DIR_B" &&
write_script .bin/git <<-\EOF &&
- echo >&2 fatal: test tried to run generic git
+ echo >&2 fatal: test tried to run generic git: $*
exit 1
EOF
PATH=$(pwd)/.bin:$PATH
diff --git a/t/lib-bundle-uri-protocol.sh b/t/lib-bundle-uri-protocol.sh
new file mode 100644
index 0000000000..a4a1af8d02
--- /dev/null
+++ b/t/lib-bundle-uri-protocol.sh
@@ -0,0 +1,216 @@
+# Set up and run tests of the 'bundle-uri' command in protocol v2
+#
+# The test that includes this script should set BUNDLE_URI_PROTOCOL
+# to one of "file", "git", or "http".
+
+BUNDLE_URI_TEST_PARENT=
+BUNDLE_URI_TEST_URI=
+BUNDLE_URI_TEST_BUNDLE_URI=
+case "$BUNDLE_URI_PROTOCOL" in
+file)
+ BUNDLE_URI_PARENT=file_parent
+ BUNDLE_URI_REPO_URI="file://$PWD/file_parent"
+ BUNDLE_URI_BUNDLE_URI="$BUNDLE_URI_REPO_URI/fake.bdl"
+ test_set_prereq BUNDLE_URI_FILE
+ ;;
+git)
+ . "$TEST_DIRECTORY"/lib-git-daemon.sh
+ start_git_daemon --export-all --enable=receive-pack
+ BUNDLE_URI_PARENT="$GIT_DAEMON_DOCUMENT_ROOT_PATH/parent"
+ BUNDLE_URI_REPO_URI="$GIT_DAEMON_URL/parent"
+ BUNDLE_URI_BUNDLE_URI="https://example.com/fake.bdl"
+ test_set_prereq BUNDLE_URI_GIT
+ ;;
+http)
+ . "$TEST_DIRECTORY"/lib-httpd.sh
+ start_httpd
+ BUNDLE_URI_PARENT="$HTTPD_DOCUMENT_ROOT_PATH/http_parent"
+ BUNDLE_URI_REPO_URI="$HTTPD_URL/smart/http_parent"
+ BUNDLE_URI_BUNDLE_URI="https://example.com/fake.bdl"
+ test_set_prereq BUNDLE_URI_HTTP
+ ;;
+*)
+ BUG "Need to pass valid BUNDLE_URI_PROTOCOL (was \"$BUNDLE_URI_PROTOCOL\")"
+ ;;
+esac
+
+test_expect_success "setup protocol v2 $BUNDLE_URI_PROTOCOL:// tests" '
+ git init "$BUNDLE_URI_PARENT" &&
+ test_commit -C "$BUNDLE_URI_PARENT" one &&
+ git -C "$BUNDLE_URI_PARENT" config uploadpack.advertiseBundleURIs true
+'
+
+case "$BUNDLE_URI_PROTOCOL" in
+http)
+ test_expect_success "setup config for $BUNDLE_URI_PROTOCOL:// tests" '
+ git -C "$BUNDLE_URI_PARENT" config http.receivepack true
+ '
+ ;;
+*)
+ ;;
+esac
+BUNDLE_URI_BUNDLE_URI_ESCAPED=$(echo "$BUNDLE_URI_BUNDLE_URI" | test_uri_escape)
+
+test_expect_success "connect with $BUNDLE_URI_PROTOCOL:// using protocol v2: no bundle-uri" '
+ test_when_finished "rm -f log" &&
+ test_when_finished "git -C \"$BUNDLE_URI_PARENT\" config uploadpack.advertiseBundleURIs true" &&
+ git -C "$BUNDLE_URI_PARENT" config uploadpack.advertiseBundleURIs false &&
+
+ GIT_TRACE_PACKET="$PWD/log" \
+ git \
+ -c protocol.version=2 \
+ ls-remote --symref "$BUNDLE_URI_REPO_URI" \
+ >actual 2>err &&
+
+ # Server responded using protocol v2
+ grep "< version 2" log &&
+
+ ! grep bundle-uri log
+'
+
+test_expect_success "connect with $BUNDLE_URI_PROTOCOL:// using protocol v2: have bundle-uri" '
+ test_when_finished "rm -f log" &&
+
+ GIT_TRACE_PACKET="$PWD/log" \
+ git \
+ -c protocol.version=2 \
+ ls-remote --symref "$BUNDLE_URI_REPO_URI" \
+ >actual 2>err &&
+
+ # Server responded using protocol v2
+ grep "< version 2" log &&
+
+ # Server advertised bundle-uri capability
+ grep "< bundle-uri" log
+'
+
+test_expect_success "clone with $BUNDLE_URI_PROTOCOL:// using protocol v2: request bundle-uris" '
+ test_when_finished "rm -rf log* cloned*" &&
+
+ GIT_TRACE_PACKET="$PWD/log" \
+ git \
+ -c transfer.bundleURI=false \
+ -c protocol.version=2 \
+ clone "$BUNDLE_URI_REPO_URI" cloned \
+ >actual 2>err &&
+
+ # Server responded using protocol v2
+ grep "< version 2" log &&
+
+ # Server advertised bundle-uri capability
+ grep "< bundle-uri" log &&
+
+ # Client did not issue bundle-uri command
+ ! grep "> command=bundle-uri" log &&
+
+ GIT_TRACE_PACKET="$PWD/log" \
+ git \
+ -c transfer.bundleURI=true \
+ -c protocol.version=2 \
+ clone "$BUNDLE_URI_REPO_URI" cloned2 \
+ >actual 2>err &&
+
+ # Server responded using protocol v2
+ grep "< version 2" log &&
+
+ # Server advertised bundle-uri capability
+ grep "< bundle-uri" log &&
+
+ # Client issued bundle-uri command
+ grep "> command=bundle-uri" log &&
+
+ GIT_TRACE_PACKET="$PWD/log3" \
+ git \
+ -c transfer.bundleURI=true \
+ -c protocol.version=2 \
+ clone --bundle-uri="$BUNDLE_URI_BUNDLE_URI" \
+ "$BUNDLE_URI_REPO_URI" cloned3 \
+ >actual 2>err &&
+
+ # Server responded using protocol v2
+ grep "< version 2" log3 &&
+
+ # Server advertised bundle-uri capability
+ grep "< bundle-uri" log3 &&
+
+ # Client did not issue bundle-uri command (--bundle-uri override)
+ ! grep "> command=bundle-uri" log3
+'
+
+# The remaining tests will all assume transfer.bundleURI=true
+#
+# This test can be removed when transfer.bundleURI is enabled by default.
+test_expect_success 'enable transfer.bundleURI for remaining tests' '
+ git config --global transfer.bundleURI true
+'
+
+test_expect_success "test bundle-uri with $BUNDLE_URI_PROTOCOL:// using protocol v2" '
+ test_config -C "$BUNDLE_URI_PARENT" \
+ bundle.only.uri "$BUNDLE_URI_BUNDLE_URI_ESCAPED" &&
+
+ # All data about bundle URIs
+ cat >expect <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ [bundle "only"]
+ uri = $BUNDLE_URI_BUNDLE_URI_ESCAPED
+ EOF
+
+ test-tool bundle-uri \
+ ls-remote \
+ "$BUNDLE_URI_REPO_URI" \
+ >actual &&
+ test_cmp_config_output expect actual
+'
+
+test_expect_success "test bundle-uri with $BUNDLE_URI_PROTOCOL:// using protocol v2 and extra data" '
+ test_config -C "$BUNDLE_URI_PARENT" \
+ bundle.only.uri "$BUNDLE_URI_BUNDLE_URI_ESCAPED" &&
+
+ # Extra data should be ignored
+ test_config -C "$BUNDLE_URI_PARENT" bundle.only.extra bogus &&
+
+ # All data about bundle URIs
+ cat >expect <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ [bundle "only"]
+ uri = $BUNDLE_URI_BUNDLE_URI_ESCAPED
+ EOF
+
+ test-tool bundle-uri \
+ ls-remote \
+ "$BUNDLE_URI_REPO_URI" \
+ >actual &&
+ test_cmp_config_output expect actual
+'
+
+test_expect_success "test bundle-uri with $BUNDLE_URI_PROTOCOL:// using protocol v2 with list" '
+ test_config -C "$BUNDLE_URI_PARENT" \
+ bundle.bundle1.uri "$BUNDLE_URI_BUNDLE_URI_ESCAPED-1.bdl" &&
+ test_config -C "$BUNDLE_URI_PARENT" \
+ bundle.bundle2.uri "$BUNDLE_URI_BUNDLE_URI_ESCAPED-2.bdl" &&
+ test_config -C "$BUNDLE_URI_PARENT" \
+ bundle.bundle3.uri "$BUNDLE_URI_BUNDLE_URI_ESCAPED-3.bdl" &&
+
+ # All data about bundle URIs
+ cat >expect <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ [bundle "bundle1"]
+ uri = $BUNDLE_URI_BUNDLE_URI_ESCAPED-1.bdl
+ [bundle "bundle2"]
+ uri = $BUNDLE_URI_BUNDLE_URI_ESCAPED-2.bdl
+ [bundle "bundle3"]
+ uri = $BUNDLE_URI_BUNDLE_URI_ESCAPED-3.bdl
+ EOF
+
+ test-tool bundle-uri \
+ ls-remote \
+ "$BUNDLE_URI_REPO_URI" \
+ >actual &&
+ test_cmp_config_output expect actual
+'
diff --git a/t/lib-credential.sh b/t/lib-credential.sh
index 5ea8bc9f1d..f1ab92ba35 100644
--- a/t/lib-credential.sh
+++ b/t/lib-credential.sh
@@ -43,6 +43,7 @@ helper_test_clean() {
reject $1 https example.com store-user
reject $1 https example.com user1
reject $1 https example.com user2
+ reject $1 https example.com user4
reject $1 http path.tld user
reject $1 https timeout.tld user
reject $1 https sso.tld
@@ -270,6 +271,35 @@ helper_test() {
password=
EOF
'
+
+ : ${GIT_TEST_LONG_CRED_BUFFER:=1024}
+ # 23 bytes accounts for "wwwauth[]=basic realm=" plus NUL
+ LONG_VALUE_LEN=$((GIT_TEST_LONG_CRED_BUFFER - 23))
+ LONG_VALUE=$(perl -e 'print "a" x shift' $LONG_VALUE_LEN)
+
+ test_expect_success "helper ($HELPER) not confused by long header" '
+ check approve $HELPER <<-\EOF &&
+ protocol=https
+ host=victim.example.com
+ username=user
+ password=to-be-stolen
+ EOF
+
+ check fill $HELPER <<-EOF
+ protocol=https
+ host=badguy.example.com
+ wwwauth[]=basic realm=${LONG_VALUE}host=victim.example.com
+ --
+ protocol=https
+ host=badguy.example.com
+ username=askpass-username
+ password=askpass-password
+ wwwauth[]=basic realm=${LONG_VALUE}host=victim.example.com
+ --
+ askpass: Username for '\''https://badguy.example.com'\'':
+ askpass: Password for '\''https://askpass-username@badguy.example.com'\'':
+ EOF
+ '
}
helper_test_timeout() {
@@ -298,6 +328,35 @@ helper_test_timeout() {
'
}
+helper_test_oauth_refresh_token() {
+ HELPER=$1
+
+ test_expect_success "helper ($HELPER) stores oauth_refresh_token" '
+ check approve $HELPER <<-\EOF
+ protocol=https
+ host=example.com
+ username=user4
+ password=pass
+ oauth_refresh_token=xyzzy
+ EOF
+ '
+
+ test_expect_success "helper ($HELPER) gets oauth_refresh_token" '
+ check fill $HELPER <<-\EOF
+ protocol=https
+ host=example.com
+ username=user4
+ --
+ protocol=https
+ host=example.com
+ username=user4
+ password=pass
+ oauth_refresh_token=xyzzy
+ --
+ EOF
+ '
+}
+
write_script askpass <<\EOF
echo >&2 askpass: $*
what=$(echo $1 | cut -d" " -f1 | tr A-Z a-z | tr -cd a-z)
diff --git a/t/lib-diff-alternative.sh b/t/lib-diff-alternative.sh
index 8d1e408bb5..a8f5d3274a 100644
--- a/t/lib-diff-alternative.sh
+++ b/t/lib-diff-alternative.sh
@@ -105,10 +105,46 @@ index $file1..$file2 100644
}
EOF
+ cat >expect_diffstat <<EOF
+ file1 => file2 | 21 ++++++++++-----------
+ 1 file changed, 10 insertions(+), 11 deletions(-)
+EOF
+
STRATEGY=$1
+ test_expect_success "$STRATEGY diff from attributes" '
+ echo "file* diff=driver" >.gitattributes &&
+ git config diff.driver.algorithm "$STRATEGY" &&
+ test_must_fail git diff --no-index file1 file2 > output &&
+ cat expect &&
+ cat output &&
+ test_cmp expect output
+ '
+
+ test_expect_success "$STRATEGY diff from attributes has valid diffstat" '
+ echo "file* diff=driver" >.gitattributes &&
+ git config diff.driver.algorithm "$STRATEGY" &&
+ test_must_fail git diff --stat --no-index file1 file2 > output &&
+ test_cmp expect_diffstat output
+ '
+
test_expect_success "$STRATEGY diff" '
- test_must_fail git diff --no-index "--$STRATEGY" file1 file2 > output &&
+ test_must_fail git diff --no-index "--diff-algorithm=$STRATEGY" file1 file2 > output &&
+ test_cmp expect output
+ '
+
+ test_expect_success "$STRATEGY diff command line precedence before attributes" '
+ echo "file* diff=driver" >.gitattributes &&
+ git config diff.driver.algorithm myers &&
+ test_must_fail git diff --no-index "--diff-algorithm=$STRATEGY" file1 file2 > output &&
+ test_cmp expect output
+ '
+
+ test_expect_success "$STRATEGY diff attributes precedence before config" '
+ git config diff.algorithm default &&
+ echo "file* diff=driver" >.gitattributes &&
+ git config diff.driver.algorithm "$STRATEGY" &&
+ test_must_fail git diff --no-index file1 file2 > output &&
test_cmp expect output
'
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index 1f6b9b08d1..6805229dcb 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -25,6 +25,7 @@
# LIB_HTTPD_DAV enable DAV
# LIB_HTTPD_SVN enable SVN at given location (e.g. "svn")
# LIB_HTTPD_SSL enable SSL
+# LIB_HTTPD_PROXY enable proxy
#
# Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at>
#
@@ -65,7 +66,8 @@ done
for DEFAULT_HTTPD_MODULE_PATH in '/usr/libexec/apache2' \
'/usr/lib/apache2/modules' \
'/usr/lib64/httpd/modules' \
- '/usr/lib/httpd/modules'
+ '/usr/lib/httpd/modules' \
+ '/usr/libexec/httpd'
do
if test -d "$DEFAULT_HTTPD_MODULE_PATH"
then
@@ -98,16 +100,19 @@ then
fi
HTTPD_VERSION=$($LIB_HTTPD_PATH -v | \
- sed -n 's/^Server version: Apache\/\([0-9]*\)\..*$/\1/p; q')
+ sed -n 's/^Server version: Apache\/\([0-9.]*\).*$/\1/p; q')
+HTTPD_VERSION_MAJOR=$(echo $HTTPD_VERSION | cut -d. -f1)
+HTTPD_VERSION_MINOR=$(echo $HTTPD_VERSION | cut -d. -f2)
-if test -n "$HTTPD_VERSION"
+if test -n "$HTTPD_VERSION_MAJOR"
then
if test -z "$LIB_HTTPD_MODULE_PATH"
then
- if ! test $HTTPD_VERSION -ge 2
+ if ! test "$HTTPD_VERSION_MAJOR" -eq 2 ||
+ ! test "$HTTPD_VERSION_MINOR" -ge 4
then
test_skip_or_die GIT_TEST_HTTPD \
- "at least Apache version 2 is required"
+ "at least Apache version 2.4 is required"
fi
if ! test -d "$DEFAULT_HTTPD_MODULE_PATH"
then
@@ -129,6 +134,7 @@ install_script () {
prepare_httpd() {
mkdir -p "$HTTPD_DOCUMENT_ROOT_PATH"
cp "$TEST_PATH"/passwd "$HTTPD_ROOT_PATH"
+ cp "$TEST_PATH"/proxy-passwd "$HTTPD_ROOT_PATH"
install_script incomplete-length-upload-pack-v2-http.sh
install_script incomplete-body-upload-pack-v2-http.sh
install_script error-no-report.sh
@@ -136,6 +142,7 @@ prepare_httpd() {
install_script error-smart-http.sh
install_script error.sh
install_script apply-one-time-perl.sh
+ install_script nph-custom-auth.sh
ln -s "$LIB_HTTPD_MODULE_PATH" "$HTTPD_ROOT_PATH/modules"
@@ -172,6 +179,16 @@ prepare_httpd() {
export LIB_HTTPD_SVN LIB_HTTPD_SVNPATH
fi
fi
+
+ if test -n "$LIB_HTTPD_PROXY"
+ then
+ HTTPD_PARA="$HTTPD_PARA -DPROXY"
+ fi
+}
+
+enable_http2 () {
+ HTTPD_PARA="$HTTPD_PARA -DHTTP2"
+ test_set_prereq HTTP2
}
start_httpd() {
@@ -211,8 +228,12 @@ test_http_push_nonff () {
git commit -a -m path2 --amend &&
test_must_fail git push -v origin >output 2>&1 &&
- (cd "$REMOTE_REPO" &&
- test $HEAD = $(git rev-parse --verify HEAD))
+ (
+ cd "$REMOTE_REPO" &&
+ echo "$HEAD" >expect &&
+ git rev-parse --verify HEAD >actual &&
+ test_cmp expect actual
+ )
'
test_expect_success 'non-fast-forward push show ref status' '
@@ -274,11 +295,11 @@ expect_askpass() {
none)
;;
pass)
- echo "askpass: Password for 'http://$2@$dest': "
+ echo "askpass: Password for '$HTTPD_PROTO://$2@$dest': "
;;
both)
- echo "askpass: Username for 'http://$dest': "
- echo "askpass: Password for 'http://$2@$dest': "
+ echo "askpass: Username for '$HTTPD_PROTO://$dest': "
+ echo "askpass: Password for '$HTTPD_PROTO://$2@$dest': "
;;
*)
false
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 706799391b..9e6892970d 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -29,17 +29,11 @@ ErrorLog error.log
LoadModule setenvif_module modules/mod_setenvif.so
</IfModule>
-<IfVersion < 2.4>
-LockFile accept.lock
-</IfVersion>
-
-<IfVersion < 2.1>
-<IfModule !mod_auth.c>
- LoadModule auth_module modules/mod_auth.so
-</IfModule>
-</IfVersion>
+<IfDefine HTTP2>
+LoadModule http2_module modules/mod_http2.so
+Protocols h2 h2c
+</IfDefine>
-<IfVersion >= 2.1>
<IfModule !mod_auth_basic.c>
LoadModule auth_basic_module modules/mod_auth_basic.so
</IfModule>
@@ -52,9 +46,23 @@ LockFile accept.lock
<IfModule !mod_authz_host.c>
LoadModule authz_host_module modules/mod_authz_host.so
</IfModule>
-</IfVersion>
-<IfVersion >= 2.4>
+<IfDefine PROXY>
+<IfModule !mod_proxy.c>
+ LoadModule proxy_module modules/mod_proxy.so
+</IfModule>
+<IfModule !mod_proxy_http.c>
+ LoadModule proxy_http_module modules/mod_proxy_http.so
+</IfModule>
+ProxyRequests On
+<Proxy "*">
+ AuthType Basic
+ AuthName "proxy-auth"
+ AuthUserFile proxy-passwd
+ Require valid-user
+</Proxy>
+</IfDefine>
+
<IfModule !mod_authn_core.c>
LoadModule authn_core_module modules/mod_authn_core.so
</IfModule>
@@ -64,13 +72,20 @@ LockFile accept.lock
<IfModule !mod_access_compat.c>
LoadModule access_compat_module modules/mod_access_compat.so
</IfModule>
-<IfModule !mod_mpm_prefork.c>
- LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
-</IfModule>
<IfModule !mod_unixd.c>
LoadModule unixd_module modules/mod_unixd.so
</IfModule>
-</IfVersion>
+
+<IfDefine HTTP2>
+<IfModule !mod_mpm_event.c>
+ LoadModule mpm_event_module modules/mod_mpm_event.so
+</IfModule>
+</IfDefine>
+<IfDefine !HTTP2>
+<IfModule !mod_mpm_prefork.c>
+ LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
+</IfModule>
+</IfDefine>
PassEnv GIT_VALGRIND
PassEnv GIT_VALGRIND_OPTIONS
@@ -86,6 +101,8 @@ PassEnv LC_ALL
Alias /dumb/ www/
Alias /auth/dumb/ www/auth/dumb/
+SetEnv PERL_PATH ${PERL_PATH}
+
<LocationMatch /smart/>
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
SetEnv GIT_HTTP_EXPORT_ALL
@@ -110,6 +127,10 @@ Alias /auth/dumb/ www/auth/dumb/
Header set Set-Cookie name=value
</LocationMatch>
<LocationMatch /smart_headers/>
+ <RequireAll>
+ Require expr %{HTTP:x-magic-one} == 'abra'
+ Require expr %{HTTP:x-magic-two} == 'cadabra'
+ </RequireAll>
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
SetEnv GIT_HTTP_EXPORT_ALL
</LocationMatch>
@@ -122,6 +143,11 @@ Alias /auth/dumb/ www/auth/dumb/
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv GIT_PROTOCOL
</LocationMatch>
+<LocationMatch /custom_auth/>
+ SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
+ SetEnv GIT_HTTP_EXPORT_ALL
+ CGIPassAuth on
+</LocationMatch>
ScriptAlias /smart/incomplete_length/git-upload-pack incomplete-length-upload-pack-v2-http.sh/
ScriptAlias /smart/incomplete_body/git-upload-pack incomplete-body-upload-pack-v2-http.sh/
ScriptAlias /smart/no_report/git-receive-pack error-no-report.sh/
@@ -131,6 +157,7 @@ ScriptAlias /broken_smart/ broken-smart-http.sh/
ScriptAlias /error_smart/ error-smart-http.sh/
ScriptAlias /error/ error.sh/
ScriptAliasMatch /one_time_perl/(.*) apply-one-time-perl.sh/$1
+ScriptAliasMatch /custom_auth/(.*) nph-custom-auth.sh/$1
<Directory ${GIT_EXEC_PATH}>
Options FollowSymlinks
</Directory>
@@ -192,18 +219,6 @@ RewriteRule ^/intern-redir/(.*)/foo$ /smart/$1 [PT]
RewriteRule ^/redir-objects/(.*/info/refs)$ /dumb/$1 [PT]
RewriteRule ^/redir-objects/(.*/objects/.*)$ /dumb/$1 [R=301]
-# Apache 2.2 does not understand <RequireAll>, so we use RewriteCond.
-# And as RewriteCond does not allow testing for non-matches, we match
-# the desired case first (one has abra, two has cadabra), and let it
-# pass by marking the RewriteRule as [L], "last rule, do not process
-# any other matching RewriteRules after this"), and then have another
-# RewriteRule that matches all other cases and lets them fail via '[F]',
-# "fail the request".
-RewriteCond %{HTTP:x-magic-one} =abra
-RewriteCond %{HTTP:x-magic-two} =cadabra
-RewriteRule ^/smart_headers/.* - [L]
-RewriteRule ^/smart_headers/.* - [F]
-
<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so
@@ -212,7 +227,6 @@ SSLCertificateKeyFile httpd.pem
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect file:/dev/urandom 512
SSLSessionCache none
-SSLMutex file:ssl_mutex
SSLEngine On
</IfDefine>
diff --git a/t/lib-httpd/apply-one-time-perl.sh b/t/lib-httpd/apply-one-time-perl.sh
index 09a0abdff7..d7f9fed6ae 100644
--- a/t/lib-httpd/apply-one-time-perl.sh
+++ b/t/lib-httpd/apply-one-time-perl.sh
@@ -13,7 +13,7 @@ then
export LC_ALL
"$GIT_EXEC_PATH/git-http-backend" >out
- perl -pe "$(cat one-time-perl)" out >out_modified
+ "$PERL_PATH" -pe "$(cat one-time-perl)" out >out_modified
if cmp -s out out_modified
then
diff --git a/t/lib-httpd/nph-custom-auth.sh b/t/lib-httpd/nph-custom-auth.sh
new file mode 100644
index 0000000000..f5345e775e
--- /dev/null
+++ b/t/lib-httpd/nph-custom-auth.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+VALID_CREDS_FILE=custom-auth.valid
+CHALLENGE_FILE=custom-auth.challenge
+
+#
+# If $VALID_CREDS_FILE exists in $HTTPD_ROOT_PATH, consider each line as a valid
+# credential for the current request. Each line in the file is considered a
+# valid HTTP Authorization header value. For example:
+#
+# Basic YWxpY2U6c2VjcmV0LXBhc3N3ZA==
+#
+# If $CHALLENGE_FILE exists in $HTTPD_ROOT_PATH, output the contents as headers
+# in a 401 response if no valid authentication credentials were included in the
+# request. For example:
+#
+# WWW-Authenticate: Bearer authorize_uri="id.example.com" p=1 q=0
+# WWW-Authenticate: Basic realm="example.com"
+#
+
+if test -n "$HTTP_AUTHORIZATION" && \
+ grep -Fqsx "${HTTP_AUTHORIZATION}" "$VALID_CREDS_FILE"
+then
+ # Note that although git-http-backend returns a status line, it
+ # does so using a CGI 'Status' header. Because this script is an
+ # No Parsed Headers (NPH) script, we must return a real HTTP
+ # status line.
+ # This is only a test script, so we don't bother to check for
+ # the actual status from git-http-backend and always return 200.
+ echo 'HTTP/1.1 200 OK'
+ exec "$GIT_EXEC_PATH"/git-http-backend
+fi
+
+echo 'HTTP/1.1 401 Authorization Required'
+if test -f "$CHALLENGE_FILE"
+then
+ cat "$CHALLENGE_FILE"
+fi
+echo
diff --git a/t/lib-httpd/proxy-passwd b/t/lib-httpd/proxy-passwd
new file mode 100644
index 0000000000..77c25138e0
--- /dev/null
+++ b/t/lib-httpd/proxy-passwd
@@ -0,0 +1 @@
+proxuser:2x7tAukjAED5M
diff --git a/t/lib-httpd/ssl.cnf b/t/lib-httpd/ssl.cnf
index 6dab2579cb..812e8253f0 100644
--- a/t/lib-httpd/ssl.cnf
+++ b/t/lib-httpd/ssl.cnf
@@ -1,7 +1,7 @@
RANDFILE = $ENV::RANDFILE_PATH
[ req ]
-default_bits = 1024
+default_bits = 2048
distinguished_name = req_distinguished_name
prompt = no
[ req_distinguished_name ]
diff --git a/t/lib-patch-mode.sh b/t/lib-patch-mode.sh
index cfd76bf987..89ca1f7805 100644
--- a/t/lib-patch-mode.sh
+++ b/t/lib-patch-mode.sh
@@ -29,8 +29,12 @@ set_and_save_state () {
# verify_state <path> <expected-worktree-content> <expected-index-content>
verify_state () {
- test "$(cat "$1")" = "$2" &&
- test "$(git show :"$1")" = "$3"
+ echo "$2" >expect &&
+ test_cmp expect "$1" &&
+
+ echo "$3" >expect &&
+ git show :"$1" >actual &&
+ test_cmp expect actual
}
# verify_saved_state <path>
@@ -46,5 +50,6 @@ save_head () {
}
verify_saved_head () {
- test "$(cat _head)" = "$(git rev-parse HEAD)"
+ git rev-parse HEAD >actual &&
+ test_cmp _head actual
}
diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
index b57541356b..7ca5b918f0 100644
--- a/t/lib-rebase.sh
+++ b/t/lib-rebase.sh
@@ -60,7 +60,7 @@ set_fake_editor () {
">")
echo >> "$1";;
bad)
- action="badcmd";;
+ action="pickled";;
fakesha)
test \& != "$action" || action=pick
echo "$action XXXXXXX False commit" >> "$1"
@@ -211,6 +211,9 @@ check_reworded_commits () {
# usage: set_replace_editor <file>
#
# Replace the todo file with the exact contents of the given file.
+# N.B. sets GIT_SEQUENCE_EDITOR rather than EDITOR so it can be
+# combined with set_fake_editor to reword commits and replace the
+# todo list
set_replace_editor () {
cat >script <<-\EOF &&
cat FILENAME >"$1"
@@ -219,6 +222,7 @@ set_replace_editor () {
cat "$1"
EOF
- sed -e "s/FILENAME/$1/g" <script | write_script fake-editor.sh &&
- test_set_editor "$(pwd)/fake-editor.sh"
+ sed -e "s/FILENAME/$1/g" script |
+ write_script fake-sequence-editor.sh &&
+ test_set_sequence_editor "$(pwd)/fake-sequence-editor.sh"
}
diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
index 2d31fcfda1..dee14992c5 100644
--- a/t/lib-submodule-update.sh
+++ b/t/lib-submodule-update.sh
@@ -168,20 +168,16 @@ replace_gitfile_with_git_dir () {
# Note that this only supports submodules at the root level of the
# superproject, with the default name, i.e. same as its path.
test_git_directory_is_unchanged () {
- (
- cd ".git/modules/$1" &&
- # does core.worktree point at the right place?
- test "$(git config core.worktree)" = "../../../$1" &&
- # remove it temporarily before comparing, as
- # "$1/.git/config" lacks it...
- git config --unset core.worktree
- ) &&
+ # does core.worktree point at the right place?
+ echo "../../../$1" >expect &&
+ git -C ".git/modules/$1" config core.worktree >actual &&
+ test_cmp expect actual &&
+ # remove it temporarily before comparing, as
+ # "$1/.git/config" lacks it...
+ git -C ".git/modules/$1" config --unset core.worktree &&
diff -r ".git/modules/$1" "$1/.git" &&
- (
- # ... and then restore.
- cd ".git/modules/$1" &&
- git config core.worktree "../../../$1"
- )
+ # ... and then restore.
+ git -C ".git/modules/$1" config core.worktree "../../../$1"
}
test_git_directory_exists () {
@@ -189,7 +185,9 @@ test_git_directory_exists () {
if test -f sub1/.git
then
# does core.worktree point at the right place?
- test "$(git -C .git/modules/$1 config core.worktree)" = "../../../$1"
+ echo "../../../$1" >expect &&
+ git -C ".git/modules/$1" config core.worktree >actual &&
+ test_cmp expect actual
fi
}
diff --git a/t/perf/p0006-read-tree-checkout.sh b/t/perf/p0006-read-tree-checkout.sh
index c481c012d2..325566e18e 100755
--- a/t/perf/p0006-read-tree-checkout.sh
+++ b/t/perf/p0006-read-tree-checkout.sh
@@ -49,6 +49,14 @@ test_perf "read-tree br_base br_ballast ($nr_files)" '
git read-tree -n -m br_base br_ballast
'
+test_perf "read-tree br_ballast_plus_1 ($nr_files)" '
+ # Run read-tree 100 times for clearer performance results & comparisons
+ for i in $(test_seq 100)
+ do
+ git read-tree -n -m br_ballast_plus_1 || return 1
+ done
+'
+
test_perf "switch between br_base br_ballast ($nr_files)" '
git checkout -q br_base &&
git checkout -q br_ballast
diff --git a/t/perf/p0090-cache-tree.sh b/t/perf/p0090-cache-tree.sh
new file mode 100755
index 0000000000..a8eabca2c4
--- /dev/null
+++ b/t/perf/p0090-cache-tree.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+test_description="Tests performance of cache tree update operations"
+
+. ./perf-lib.sh
+
+test_perf_large_repo
+test_checkout_worktree
+
+count=100
+
+test_expect_success 'setup cache tree' '
+ git write-tree
+'
+
+test_cache_tree () {
+ test_perf "$1, $3" "
+ for i in \$(test_seq $count)
+ do
+ test-tool cache-tree $4 $2
+ done
+ "
+}
+
+test_cache_tree_update_functions () {
+ test_cache_tree 'no-op' 'control' "$1" "$2"
+ test_cache_tree 'prime_cache_tree' 'prime' "$1" "$2"
+ test_cache_tree 'cache_tree_update' 'update' "$1" "$2"
+}
+
+test_cache_tree_update_functions "clean" ""
+test_cache_tree_update_functions "invalidate 2" "--invalidate 2"
+test_cache_tree_update_functions "invalidate 50" "--invalidate 50"
+test_cache_tree_update_functions "empty" "--empty"
+
+test_done
diff --git a/t/perf/p1500-graph-walks.sh b/t/perf/p1500-graph-walks.sh
new file mode 100755
index 0000000000..e14e7620cc
--- /dev/null
+++ b/t/perf/p1500-graph-walks.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+test_description='Commit walk performance tests'
+. ./perf-lib.sh
+
+test_perf_large_repo
+
+test_expect_success 'setup' '
+ git for-each-ref --format="%(refname)" "refs/heads/*" "refs/tags/*" >allrefs &&
+ sort -r allrefs | head -n 50 >refs &&
+ for ref in $(cat refs)
+ do
+ git branch -f ref-$ref $ref &&
+ echo ref-$ref ||
+ return 1
+ done >branches &&
+ for ref in $(cat refs)
+ do
+ git tag -f tag-$ref $ref &&
+ echo tag-$ref ||
+ return 1
+ done >tags &&
+ git commit-graph write --reachable
+'
+
+test_perf 'ahead-behind counts: git for-each-ref' '
+ git for-each-ref --format="%(ahead-behind:HEAD)" --stdin <refs
+'
+
+test_perf 'ahead-behind counts: git branch' '
+ xargs git branch -l --format="%(ahead-behind:HEAD)" <branches
+'
+
+test_perf 'ahead-behind counts: git tag' '
+ xargs git tag -l --format="%(ahead-behind:HEAD)" <tags
+'
+
+test_perf 'contains: git for-each-ref --merged' '
+ git for-each-ref --merged=HEAD --stdin <refs
+'
+
+test_perf 'contains: git branch --merged' '
+ xargs git branch --merged=HEAD <branches
+'
+
+test_perf 'contains: git tag --merged' '
+ xargs git tag --merged=HEAD <tags
+'
+
+test_done
diff --git a/t/perf/p2000-sparse-operations.sh b/t/perf/p2000-sparse-operations.sh
index fce8151d41..60d1de0662 100755
--- a/t/perf/p2000-sparse-operations.sh
+++ b/t/perf/p2000-sparse-operations.sh
@@ -43,6 +43,7 @@ test_expect_success 'setup repo and indexes' '
done &&
git sparse-checkout init --cone &&
+ git tag -a v1.0 -m "Final" &&
git sparse-checkout set $SPARSE_CONE &&
git checkout -b wide $OLD_COMMIT &&
@@ -124,5 +125,9 @@ test_perf_on_all git read-tree -mu HEAD
test_perf_on_all git checkout-index -f --all
test_perf_on_all git update-index --add --remove $SPARSE_CONE/a
test_perf_on_all "git rm -f $SPARSE_CONE/a && git checkout HEAD -- $SPARSE_CONE/a"
+test_perf_on_all git grep --cached bogus -- "f2/f1/f1/*"
+test_perf_on_all git write-tree
+test_perf_on_all git describe --dirty
+test_perf_on_all 'echo >>new && git describe --dirty'
test_done
diff --git a/t/perf/p5312-pack-bitmaps-revs.sh b/t/perf/p5312-pack-bitmaps-revs.sh
index 0684b690af..ceec60656b 100755
--- a/t/perf/p5312-pack-bitmaps-revs.sh
+++ b/t/perf/p5312-pack-bitmaps-revs.sh
@@ -12,8 +12,7 @@ test_lookup_pack_bitmap () {
test_perf_large_repo
test_expect_success 'setup bitmap config' '
- git config pack.writebitmaps true &&
- git config pack.writeReverseIndex true
+ git config pack.writebitmaps true
'
# we need to create the tag up front such that it is covered by the repack and
diff --git a/t/perf/p7102-reset.sh b/t/perf/p7102-reset.sh
new file mode 100755
index 0000000000..9b039e8691
--- /dev/null
+++ b/t/perf/p7102-reset.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+test_description='performance of reset'
+. ./perf-lib.sh
+
+test_perf_default_repo
+test_checkout_worktree
+
+test_perf 'reset --hard with change in tree' '
+ base=$(git rev-parse HEAD) &&
+ test_commit --no-tag A &&
+ new=$(git rev-parse HEAD) &&
+
+ for i in $(test_seq 10)
+ do
+ git reset --hard $new &&
+ git reset --hard $base || return $?
+ done
+'
+
+test_done
diff --git a/t/perf/p7822-grep-perl-character.sh b/t/perf/p7822-grep-perl-character.sh
new file mode 100755
index 0000000000..87009c60df
--- /dev/null
+++ b/t/perf/p7822-grep-perl-character.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+test_description="git-grep's perl regex
+
+If GIT_PERF_GREP_THREADS is set to a list of threads (e.g. '1 4 8'
+etc.) we will test the patterns under those numbers of threads.
+"
+
+. ./perf-lib.sh
+
+test_perf_large_repo
+test_checkout_worktree
+
+if test -n "$GIT_PERF_GREP_THREADS"
+then
+ test_set_prereq PERF_GREP_ENGINES_THREADS
+fi
+
+for pattern in \
+ '\\bhow' \
+ '\\bÆvar' \
+ '\\d+ \\bÆvar' \
+ '\\bBelón\\b' \
+ '\\w{12}\\b'
+do
+ echo '$pattern' >pat
+ if ! test_have_prereq PERF_GREP_ENGINES_THREADS
+ then
+ test_perf "grep -P '$pattern'" --prereq PCRE "
+ git -P grep -f pat || :
+ "
+ else
+ for threads in $GIT_PERF_GREP_THREADS
+ do
+ test_perf "grep -P '$pattern' with $threads threads" --prereq PTHREADS,PCRE "
+ git -c grep.threads=$threads -P grep -f pat || :
+ "
+ done
+ fi
+done
+
+test_done
diff --git a/t/perf/run b/t/perf/run
index 33da4d2aba..34115edec3 100755
--- a/t/perf/run
+++ b/t/perf/run
@@ -232,10 +232,10 @@ then
)
elif test -n "$GIT_PERF_SUBSECTION"
then
- egrep "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names >/dev/null ||
+ grep -E "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names >/dev/null ||
die "subsection '$GIT_PERF_SUBSECTION' not found in '$GIT_PERF_CONFIG_FILE'"
- egrep "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names | while read -r subsec
+ grep -E "^$GIT_PERF_SUBSECTION\$" "$TEST_RESULTS_DIR"/run_subsections.names | while read -r subsec
do
(
GIT_PERF_SUBSECTION="$subsec"
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 502b4bcf9e..8ea31d187a 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -815,7 +815,8 @@ test_expect_success 'test_oid provides sane info by default' '
grep "^00*\$" actual &&
rawsz="$(test_oid rawsz)" &&
hexsz="$(test_oid hexsz)" &&
- test "$hexsz" -eq $(wc -c <actual) &&
+ # +1 accounts for the trailing newline
+ test $(( $hexsz + 1)) -eq $(wc -c <actual) &&
test $(( $rawsz * 2)) -eq "$hexsz"
'
@@ -826,7 +827,7 @@ test_expect_success 'test_oid can look up data for SHA-1' '
grep "^00*\$" actual &&
rawsz="$(test_oid rawsz)" &&
hexsz="$(test_oid hexsz)" &&
- test $(wc -c <actual) -eq 40 &&
+ test $(wc -c <actual) -eq 41 &&
test "$rawsz" -eq 20 &&
test "$hexsz" -eq 40
'
@@ -838,7 +839,7 @@ test_expect_success 'test_oid can look up data for SHA-256' '
grep "^00*\$" actual &&
rawsz="$(test_oid rawsz)" &&
hexsz="$(test_oid hexsz)" &&
- test $(wc -c <actual) -eq 64 &&
+ test $(wc -c <actual) -eq 65 &&
test "$rawsz" -eq 32 &&
test "$hexsz" -eq 64
'
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index d479303efa..30a6edca1d 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -598,9 +598,14 @@ test_expect_success 'invalid default branch name' '
test_expect_success 'branch -m with the initial branch' '
git init rename-initial &&
git -C rename-initial branch -m renamed &&
- test renamed = $(git -C rename-initial symbolic-ref --short HEAD) &&
+ echo renamed >expect &&
+ git -C rename-initial symbolic-ref --short HEAD >actual &&
+ test_cmp expect actual &&
+
git -C rename-initial branch -m renamed again &&
- test again = $(git -C rename-initial symbolic-ref --short HEAD)
+ echo again >expect &&
+ git -C rename-initial symbolic-ref --short HEAD >actual &&
+ test_cmp expect actual
'
test_done
diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh
index 26eaca095a..e013d38f48 100755
--- a/t/t0002-gitfile.sh
+++ b/t/t0002-gitfile.sh
@@ -33,7 +33,9 @@ test_expect_success 'bad setup: invalid .git file path' '
test_expect_success 'final setup + check rev-parse --git-dir' '
echo "gitdir: $REAL" >.git &&
- test "$REAL" = "$(git rev-parse --git-dir)"
+ echo "$REAL" >expect &&
+ git rev-parse --git-dir >actual &&
+ test_cmp expect actual
'
test_expect_success 'check hash-object' '
diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
index d0284fe2d7..89b306cb11 100755
--- a/t/t0003-attributes.sh
+++ b/t/t0003-attributes.sh
@@ -25,7 +25,15 @@ attr_check_quote () {
git check-attr test -- "$path" >actual &&
echo "\"$quoted_path\": test: $expect" >expect &&
test_cmp expect actual
+}
+
+attr_check_source () {
+ path="$1" expect="$2" source="$3" git_opts="$4" &&
+ git $git_opts check-attr --source $source test -- "$path" >actual 2>err &&
+ echo "$path: test: $expect" >expect &&
+ test_cmp expect actual &&
+ test_must_be_empty err
}
test_expect_success 'open-quoted pathname' '
@@ -33,7 +41,6 @@ test_expect_success 'open-quoted pathname' '
attr_check a unspecified
'
-
test_expect_success 'setup' '
mkdir -p a/b/d a/c b &&
(
@@ -80,12 +87,23 @@ test_expect_success 'setup' '
EOF
'
+test_expect_success 'setup branches' '
+ mkdir -p foo/bar &&
+ test_commit --printf "add .gitattributes" foo/bar/.gitattributes \
+ "f test=f\na/i test=n\n" tag-1 &&
+ test_commit --printf "add .gitattributes" foo/bar/.gitattributes \
+ "g test=g\na/i test=m\n" tag-2 &&
+ rm foo/bar/.gitattributes
+'
+
test_expect_success 'command line checks' '
test_must_fail git check-attr &&
test_must_fail git check-attr -- &&
test_must_fail git check-attr test &&
test_must_fail git check-attr test -- &&
test_must_fail git check-attr -- f &&
+ test_must_fail git check-attr --source &&
+ test_must_fail git check-attr --source not-a-valid-ref &&
echo "f" | test_must_fail git check-attr --stdin &&
echo "f" | test_must_fail git check-attr --stdin -- f &&
echo "f" | test_must_fail git check-attr --stdin test -- f &&
@@ -203,9 +221,12 @@ test_expect_success 'attribute test: read paths from stdin' '
test_cmp expect actual
'
-test_expect_success 'attribute test: --all option' '
+test_expect_success 'setup --all option' '
grep -v unspecified <expect-all | sort >specified-all &&
- sed -e "s/:.*//" <expect-all | uniq >stdin-all &&
+ sed -e "s/:.*//" <expect-all | uniq >stdin-all
+'
+
+test_expect_success 'attribute test: --all option' '
git check-attr --stdin --all <stdin-all >tmp &&
sort tmp >actual &&
test_cmp specified-all actual
@@ -284,6 +305,15 @@ test_expect_success 'using --git-dir and --work-tree' '
)
'
+test_expect_success 'using --source' '
+ attr_check_source foo/bar/f f tag-1 &&
+ attr_check_source foo/bar/a/i n tag-1 &&
+ attr_check_source foo/bar/f unspecified tag-2 &&
+ attr_check_source foo/bar/a/i m tag-2 &&
+ attr_check_source foo/bar/g g tag-2 &&
+ attr_check_source foo/bar/g unspecified tag-1
+'
+
test_expect_success 'setup bare' '
git clone --template= --bare . bare.git
'
@@ -303,6 +333,18 @@ test_expect_success 'bare repository: check that .gitattribute is ignored' '
)
'
+test_expect_success 'bare repository: with --source' '
+ (
+ cd bare.git &&
+ attr_check_source foo/bar/f f tag-1 &&
+ attr_check_source foo/bar/a/i n tag-1 &&
+ attr_check_source foo/bar/f unspecified tag-2 &&
+ attr_check_source foo/bar/a/i m tag-2 &&
+ attr_check_source foo/bar/g g tag-2 &&
+ attr_check_source foo/bar/g unspecified tag-1
+ )
+'
+
test_expect_success 'bare repository: check that --cached honors index' '
(
cd bare.git &&
@@ -400,7 +442,7 @@ test_expect_success 'large attributes line ignores trailing content in tree' '
test_expect_success EXPENSIVE 'large attributes file ignored in tree' '
test_when_finished "rm .gitattributes" &&
- dd if=/dev/zero of=.gitattributes bs=101M count=1 2>/dev/null &&
+ dd if=/dev/zero of=.gitattributes bs=1048576 count=101 2>/dev/null &&
git check-attr --all path >/dev/null 2>err &&
echo "warning: ignoring overly large gitattributes file ${SQ}.gitattributes${SQ}" >expect &&
test_cmp expect err
@@ -428,7 +470,7 @@ test_expect_success 'large attributes line ignores trailing content in index' '
test_expect_success EXPENSIVE 'large attributes file ignored in index' '
test_when_finished "git update-index --remove .gitattributes" &&
- blob=$(dd if=/dev/zero bs=101M count=1 2>/dev/null | git hash-object -w --stdin) &&
+ blob=$(dd if=/dev/zero bs=1048576 count=101 2>/dev/null | git hash-object -w --stdin) &&
git update-index --add --cacheinfo 100644,$blob,.gitattributes &&
git check-attr --cached --all path >/dev/null 2>err &&
echo "warning: ignoring overly large gitattributes blob ${SQ}.gitattributes${SQ}" >expect &&
diff --git a/t/t0006-date.sh b/t/t0006-date.sh
index 2490162071..e18b160286 100755
--- a/t/t0006-date.sh
+++ b/t/t0006-date.sh
@@ -88,6 +88,13 @@ check_parse 2008-02-14 bad
check_parse '2008-02-14 20:30:45' '2008-02-14 20:30:45 +0000'
check_parse '2008-02-14 20:30:45 -0500' '2008-02-14 20:30:45 -0500'
check_parse '2008.02.14 20:30:45 -0500' '2008-02-14 20:30:45 -0500'
+check_parse '20080214T20:30:45' '2008-02-14 20:30:45 +0000'
+check_parse '20080214T20:30' '2008-02-14 20:30:00 +0000'
+check_parse '20080214T20' '2008-02-14 20:00:00 +0000'
+check_parse '20080214T203045' '2008-02-14 20:30:45 +0000'
+check_parse '20080214T2030' '2008-02-14 20:30:00 +0000'
+check_parse '20080214T000000.20' '2008-02-14 00:00:00 +0000'
+check_parse '20080214T00:00:00.20' '2008-02-14 00:00:00 +0000'
check_parse '20080214T203045-04:00' '2008-02-14 20:30:45 -0400'
check_parse '20080214T203045 -04:00' '2008-02-14 20:30:45 -0400'
check_parse '20080214T203045.019-04:00' '2008-02-14 20:30:45 -0400'
@@ -99,6 +106,7 @@ check_parse '2008-02-14 20:30:45 -05' '2008-02-14 20:30:45 -0500'
check_parse '2008-02-14 20:30:45 -:30' '2008-02-14 20:30:45 +0000'
check_parse '2008-02-14 20:30:45 -05:00' '2008-02-14 20:30:45 -0500'
check_parse '2008-02-14 20:30:45' '2008-02-14 20:30:45 -0500' EST5
+check_parse 'Thu, 7 Apr 2005 15:14:13 -0700' '2005-04-07 15:14:13 -0700'
check_approxidate() {
echo "$1 -> $2 +0000" >expect
diff --git a/t/t0007-git-var.sh b/t/t0007-git-var.sh
index e56f4b9ac5..eeb8539c1b 100755
--- a/t/t0007-git-var.sh
+++ b/t/t0007-git-var.sh
@@ -5,6 +5,12 @@ test_description='basic sanity checks for git var'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
+sane_unset_all_editors () {
+ sane_unset GIT_EDITOR &&
+ sane_unset VISUAL &&
+ sane_unset EDITOR
+}
+
test_expect_success 'get GIT_AUTHOR_IDENT' '
test_tick &&
echo "$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> $GIT_AUTHOR_DATE" >expect &&
@@ -47,6 +53,100 @@ test_expect_success 'get GIT_DEFAULT_BRANCH with configuration' '
)
'
+test_expect_success 'get GIT_EDITOR without configuration' '
+ (
+ sane_unset_all_editors &&
+ test_expect_code 1 git var GIT_EDITOR >out &&
+ test_must_be_empty out
+ )
+'
+
+test_expect_success 'get GIT_EDITOR with configuration' '
+ test_config core.editor foo &&
+ (
+ sane_unset_all_editors &&
+ echo foo >expect &&
+ git var GIT_EDITOR >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success 'get GIT_EDITOR with environment variable GIT_EDITOR' '
+ (
+ sane_unset_all_editors &&
+ echo bar >expect &&
+ GIT_EDITOR=bar git var GIT_EDITOR >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success 'get GIT_EDITOR with environment variable EDITOR' '
+ (
+ sane_unset_all_editors &&
+ echo bar >expect &&
+ EDITOR=bar git var GIT_EDITOR >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success 'get GIT_EDITOR with configuration and environment variable GIT_EDITOR' '
+ test_config core.editor foo &&
+ (
+ sane_unset_all_editors &&
+ echo bar >expect &&
+ GIT_EDITOR=bar git var GIT_EDITOR >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success 'get GIT_EDITOR with configuration and environment variable EDITOR' '
+ test_config core.editor foo &&
+ (
+ sane_unset_all_editors &&
+ echo foo >expect &&
+ EDITOR=bar git var GIT_EDITOR >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success 'get GIT_SEQUENCE_EDITOR without configuration' '
+ (
+ sane_unset GIT_SEQUENCE_EDITOR &&
+ git var GIT_EDITOR >expect &&
+ git var GIT_SEQUENCE_EDITOR >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success 'get GIT_SEQUENCE_EDITOR with configuration' '
+ test_config sequence.editor foo &&
+ (
+ sane_unset GIT_SEQUENCE_EDITOR &&
+ echo foo >expect &&
+ git var GIT_SEQUENCE_EDITOR >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success 'get GIT_SEQUENCE_EDITOR with environment variable' '
+ (
+ sane_unset GIT_SEQUENCE_EDITOR &&
+ echo bar >expect &&
+ GIT_SEQUENCE_EDITOR=bar git var GIT_SEQUENCE_EDITOR >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success 'get GIT_SEQUENCE_EDITOR with configuration and environment variable' '
+ test_config sequence.editor foo &&
+ (
+ sane_unset GIT_SEQUENCE_EDITOR &&
+ echo bar >expect &&
+ GIT_SEQUENCE_EDITOR=bar git var GIT_SEQUENCE_EDITOR >actual &&
+ test_cmp expect actual
+ )
+'
+
# For git var -l, we check only a representative variable;
# testing the whole output would make our test too brittle with
# respect to unrelated changes in the test suite's environment.
diff --git a/t/t0013-sha1dc.sh b/t/t0013-sha1dc.sh
index 9ad76080aa..5324047689 100755
--- a/t/t0013-sha1dc.sh
+++ b/t/t0013-sha1dc.sh
@@ -6,9 +6,11 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
TEST_DATA="$TEST_DIRECTORY/t0013"
-if test -z "$DC_SHA1"
+test_lazy_prereq SHA1_IS_SHA1DC 'test-tool sha1-is-sha1dc'
+
+if ! test_have_prereq SHA1_IS_SHA1DC
then
- skip_all='skipping sha1 collision tests, DC_SHA1 not set'
+ skip_all='skipping sha1 collision tests, not using sha1collisiondetection'
test_done
fi
diff --git a/t/t0017-env-helper.sh b/t/t0017-env-helper.sh
index 2e42fba956..fc14ba091c 100755
--- a/t/t0017-env-helper.sh
+++ b/t/t0017-env-helper.sh
@@ -1,87 +1,87 @@
#!/bin/sh
-test_description='test env--helper'
+test_description='test test-tool env-helper'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
-test_expect_success 'env--helper usage' '
- test_must_fail git env--helper &&
- test_must_fail git env--helper --type=bool &&
- test_must_fail git env--helper --type=ulong &&
- test_must_fail git env--helper --type=bool &&
- test_must_fail git env--helper --type=bool --default &&
- test_must_fail git env--helper --type=bool --default= &&
- test_must_fail git env--helper --defaultxyz
+test_expect_success 'test-tool env-helper usage' '
+ test_must_fail test-tool env-helper &&
+ test_must_fail test-tool env-helper --type=bool &&
+ test_must_fail test-tool env-helper --type=ulong &&
+ test_must_fail test-tool env-helper --type=bool &&
+ test_must_fail test-tool env-helper --type=bool --default &&
+ test_must_fail test-tool env-helper --type=bool --default= &&
+ test_must_fail test-tool env-helper --defaultxyz
'
-test_expect_success 'env--helper bad default values' '
- test_must_fail git env--helper --type=bool --default=1xyz MISSING &&
- test_must_fail git env--helper --type=ulong --default=1xyz MISSING
+test_expect_success 'test-tool env-helper bad default values' '
+ test_must_fail test-tool env-helper --type=bool --default=1xyz MISSING &&
+ test_must_fail test-tool env-helper --type=ulong --default=1xyz MISSING
'
-test_expect_success 'env--helper --type=bool' '
+test_expect_success 'test-tool env-helper --type=bool' '
# Test various --default bool values
echo true >expected &&
- git env--helper --type=bool --default=1 MISSING >actual &&
+ test-tool env-helper --type=bool --default=1 MISSING >actual &&
test_cmp expected actual &&
- git env--helper --type=bool --default=yes MISSING >actual &&
+ test-tool env-helper --type=bool --default=yes MISSING >actual &&
test_cmp expected actual &&
- git env--helper --type=bool --default=true MISSING >actual &&
+ test-tool env-helper --type=bool --default=true MISSING >actual &&
test_cmp expected actual &&
echo false >expected &&
- test_must_fail git env--helper --type=bool --default=0 MISSING >actual &&
+ test_must_fail test-tool env-helper --type=bool --default=0 MISSING >actual &&
test_cmp expected actual &&
- test_must_fail git env--helper --type=bool --default=no MISSING >actual &&
+ test_must_fail test-tool env-helper --type=bool --default=no MISSING >actual &&
test_cmp expected actual &&
- test_must_fail git env--helper --type=bool --default=false MISSING >actual &&
+ test_must_fail test-tool env-helper --type=bool --default=false MISSING >actual &&
test_cmp expected actual &&
# No output with --exit-code
- git env--helper --type=bool --default=true --exit-code MISSING >actual.out 2>actual.err &&
+ test-tool env-helper --type=bool --default=true --exit-code MISSING >actual.out 2>actual.err &&
test_must_be_empty actual.out &&
test_must_be_empty actual.err &&
- test_must_fail git env--helper --type=bool --default=false --exit-code MISSING >actual.out 2>actual.err &&
+ test_must_fail test-tool env-helper --type=bool --default=false --exit-code MISSING >actual.out 2>actual.err &&
test_must_be_empty actual.out &&
test_must_be_empty actual.err &&
# Existing variable
- EXISTS=true git env--helper --type=bool --default=false --exit-code EXISTS >actual.out 2>actual.err &&
+ EXISTS=true test-tool env-helper --type=bool --default=false --exit-code EXISTS >actual.out 2>actual.err &&
test_must_be_empty actual.out &&
test_must_be_empty actual.err &&
test_must_fail \
env EXISTS=false \
- git env--helper --type=bool --default=true --exit-code EXISTS >actual.out 2>actual.err &&
+ test-tool env-helper --type=bool --default=true --exit-code EXISTS >actual.out 2>actual.err &&
test_must_be_empty actual.out &&
test_must_be_empty actual.err
'
-test_expect_success 'env--helper --type=ulong' '
+test_expect_success 'test-tool env-helper --type=ulong' '
echo 1234567890 >expected &&
- git env--helper --type=ulong --default=1234567890 MISSING >actual.out 2>actual.err &&
+ test-tool env-helper --type=ulong --default=1234567890 MISSING >actual.out 2>actual.err &&
test_cmp expected actual.out &&
test_must_be_empty actual.err &&
echo 0 >expected &&
- test_must_fail git env--helper --type=ulong --default=0 MISSING >actual &&
+ test_must_fail test-tool env-helper --type=ulong --default=0 MISSING >actual &&
test_cmp expected actual &&
- git env--helper --type=ulong --default=1234567890 --exit-code MISSING >actual.out 2>actual.err &&
+ test-tool env-helper --type=ulong --default=1234567890 --exit-code MISSING >actual.out 2>actual.err &&
test_must_be_empty actual.out &&
test_must_be_empty actual.err &&
- EXISTS=1234567890 git env--helper --type=ulong --default=0 EXISTS --exit-code >actual.out 2>actual.err &&
+ EXISTS=1234567890 test-tool env-helper --type=ulong --default=0 EXISTS --exit-code >actual.out 2>actual.err &&
test_must_be_empty actual.out &&
test_must_be_empty actual.err &&
echo 1234567890 >expected &&
- EXISTS=1234567890 git env--helper --type=ulong --default=0 EXISTS >actual.out 2>actual.err &&
+ EXISTS=1234567890 test-tool env-helper --type=ulong --default=0 EXISTS >actual.out 2>actual.err &&
test_cmp expected actual.out &&
test_must_be_empty actual.err
'
-test_expect_success 'env--helper reads config thanks to trace2' '
+test_expect_success 'test-tool env-helper reads config thanks to trace2' '
mkdir home &&
git config -f home/.gitconfig include.path cycle &&
git config -f home/cycle include.path .gitconfig &&
@@ -93,7 +93,7 @@ test_expect_success 'env--helper reads config thanks to trace2' '
test_must_fail \
env HOME="$(pwd)/home" GIT_TEST_ENV_HELPER=true \
- git -C cycle env--helper --type=bool --default=0 --exit-code GIT_TEST_ENV_HELPER 2>err &&
+ test-tool -C cycle env-helper --type=bool --default=0 --exit-code GIT_TEST_ENV_HELPER 2>err &&
grep "exceeded maximum include depth" err
'
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index abecd75e4e..46abbeed68 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -8,8 +8,8 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-terminal.sh
-TEST_ROOT="$PWD"
-PATH=$TEST_ROOT:$PATH
+PATH=$PWD:$PATH
+TEST_ROOT="$(pwd)"
write_script <<\EOF "$TEST_ROOT/rot13.sh"
tr \
diff --git a/t/t0023-crlf-am.sh b/t/t0023-crlf-am.sh
index f9bbb91f64..575805513a 100755
--- a/t/t0023-crlf-am.sh
+++ b/t/t0023-crlf-am.sh
@@ -2,6 +2,7 @@
test_description='Test am with auto.crlf'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
cat >patchfile <<\EOF
diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh
index a94ac1eae3..2f57c8669c 100755
--- a/t/t0027-auto-crlf.sh
+++ b/t/t0027-auto-crlf.sh
@@ -70,7 +70,8 @@ create_NNO_MIX_files () {
cp CRLF ${pfx}_CRLF.txt &&
cp CRLF_mix_LF ${pfx}_CRLF_mix_LF.txt &&
cp LF_mix_CR ${pfx}_LF_mix_CR.txt &&
- cp CRLF_nul ${pfx}_CRLF_nul.txt
+ cp CRLF_nul ${pfx}_CRLF_nul.txt ||
+ return 1
done
done
done
@@ -101,7 +102,8 @@ commit_check_warn () {
do
fname=${pfx}_$f.txt &&
cp $f $fname &&
- git -c core.autocrlf=$crlf add $fname 2>"${pfx}_$f.err"
+ git -c core.autocrlf=$crlf add $fname 2>"${pfx}_$f.err" ||
+ return 1
done &&
git commit -m "core.autocrlf $crlf" &&
check_warning "$lfname" ${pfx}_LF.err &&
@@ -121,15 +123,19 @@ commit_chk_wrnNNO () {
lfmixcr=$1 ; shift
crlfnul=$1 ; shift
pfx=NNO_attr_${attr}_aeol_${aeol}_${crlf}
- #Commit files on top of existing file
- create_gitattributes "$attr" $aeol &&
- for f in LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
- do
- fname=${pfx}_$f.txt &&
- cp $f $fname &&
- printf Z >>"$fname" &&
- git -c core.autocrlf=$crlf add $fname 2>"${pfx}_$f.err"
- done
+
+ test_expect_success 'setup commit NNO files' '
+ #Commit files on top of existing file
+ create_gitattributes "$attr" $aeol &&
+ for f in LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
+ do
+ fname=${pfx}_$f.txt &&
+ cp $f $fname &&
+ printf Z >>"$fname" &&
+ git -c core.autocrlf=$crlf add $fname 2>"${pfx}_$f.err" ||
+ return 1
+ done
+ '
test_expect_success "commit NNO files crlf=$crlf attr=$attr LF" '
check_warning "$lfwarn" ${pfx}_LF.err
@@ -163,15 +169,19 @@ commit_MIX_chkwrn () {
lfmixcr=$1 ; shift
crlfnul=$1 ; shift
pfx=MIX_attr_${attr}_aeol_${aeol}_${crlf}
- #Commit file with CLRF_mix_LF on top of existing file
- create_gitattributes "$attr" $aeol &&
- for f in LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
- do
- fname=${pfx}_$f.txt &&
- cp CRLF_mix_LF $fname &&
- printf Z >>"$fname" &&
- git -c core.autocrlf=$crlf add $fname 2>"${pfx}_$f.err"
- done
+
+ test_expect_success 'setup commit file with mixed EOL' '
+ #Commit file with CLRF_mix_LF on top of existing file
+ create_gitattributes "$attr" $aeol &&
+ for f in LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
+ do
+ fname=${pfx}_$f.txt &&
+ cp CRLF_mix_LF $fname &&
+ printf Z >>"$fname" &&
+ git -c core.autocrlf=$crlf add $fname 2>"${pfx}_$f.err" ||
+ return 1
+ done
+ '
test_expect_success "commit file with mixed EOL onto LF crlf=$crlf attr=$attr" '
check_warning "$lfwarn" ${pfx}_LF.err
@@ -289,17 +299,17 @@ checkout_files () {
lfmixcrlf=$1 ; shift
lfmixcr=$1 ; shift
crlfnul=$1 ; shift
- create_gitattributes "$attr" $ident $aeol &&
- git config core.autocrlf $crlf &&
+ test_expect_success "setup config for checkout attr=$attr ident=$ident aeol=$aeol core.autocrlf=$crlf" '
+ create_gitattributes "$attr" $ident $aeol &&
+ git config core.autocrlf $crlf
+ '
pfx=eol_${ceol}_crlf_${crlf}_attr_${attr}_ &&
for f in LF CRLF LF_mix_CR CRLF_mix_LF LF_nul
do
- rm crlf_false_attr__$f.txt &&
- if test -z "$ceol"; then
- git checkout -- crlf_false_attr__$f.txt
- else
- git -c core.eol=$ceol checkout -- crlf_false_attr__$f.txt
- fi
+ test_expect_success "setup $f checkout ${ceol:+ with -c core.eol=$ceol}" '
+ rm -f crlf_false_attr__$f.txt &&
+ git ${ceol:+-c core.eol=$ceol} checkout -- crlf_false_attr__$f.txt
+ '
done
test_expect_success "ls-files --eol attr=$attr $ident aeol=$aeol core.autocrlf=$crlf core.eol=$ceol" '
diff --git a/t/t0033-safe-directory.sh b/t/t0033-safe-directory.sh
index aecb308cf6..dc3496897a 100755
--- a/t/t0033-safe-directory.sh
+++ b/t/t0033-safe-directory.sh
@@ -71,4 +71,13 @@ test_expect_success 'safe.directory=*, but is reset' '
expect_rejected_dir
'
+test_expect_success 'safe.directory in included file' '
+ cat >gitconfig-include <<-EOF &&
+ [safe]
+ directory = "$(pwd)"
+ EOF
+ git config --global --add include.path "$(pwd)/gitconfig-include" &&
+ git status
+'
+
test_done
diff --git a/t/t0035-safe-bare-repository.sh b/t/t0035-safe-bare-repository.sh
index ecbdc8238d..038b8b788d 100755
--- a/t/t0035-safe-bare-repository.sh
+++ b/t/t0035-safe-bare-repository.sh
@@ -7,13 +7,26 @@ TEST_PASSES_SANITIZE_LEAK=true
pwd="$(pwd)"
-expect_accepted () {
- git "$@" rev-parse --git-dir
+expect_accepted_implicit () {
+ test_when_finished 'rm "$pwd/trace.perf"' &&
+ GIT_TRACE2_PERF="$pwd/trace.perf" git "$@" rev-parse --git-dir &&
+ # Note: we're intentionally only checking that the bare repo has a
+ # directory *prefix* of $pwd
+ grep -F "implicit-bare-repository:$pwd" "$pwd/trace.perf"
+}
+
+expect_accepted_explicit () {
+ test_when_finished 'rm "$pwd/trace.perf"' &&
+ GIT_DIR="$1" GIT_TRACE2_PERF="$pwd/trace.perf" git rev-parse --git-dir &&
+ ! grep -F "implicit-bare-repository:$pwd" "$pwd/trace.perf"
}
expect_rejected () {
- test_must_fail git "$@" rev-parse --git-dir 2>err &&
- grep -F "cannot use bare repository" err
+ test_when_finished 'rm "$pwd/trace.perf"' &&
+ test_env GIT_TRACE2_PERF="$pwd/trace.perf" \
+ test_must_fail git "$@" rev-parse --git-dir 2>err &&
+ grep -F "cannot use bare repository" err &&
+ grep -F "implicit-bare-repository:$pwd" "$pwd/trace.perf"
}
test_expect_success 'setup bare repo in worktree' '
@@ -22,12 +35,13 @@ test_expect_success 'setup bare repo in worktree' '
'
test_expect_success 'safe.bareRepository unset' '
- expect_accepted -C outer-repo/bare-repo
+ test_unconfig --global safe.bareRepository &&
+ expect_accepted_implicit -C outer-repo/bare-repo
'
test_expect_success 'safe.bareRepository=all' '
test_config_global safe.bareRepository all &&
- expect_accepted -C outer-repo/bare-repo
+ expect_accepted_implicit -C outer-repo/bare-repo
'
test_expect_success 'safe.bareRepository=explicit' '
@@ -47,8 +61,21 @@ test_expect_success 'safe.bareRepository in the repository' '
test_expect_success 'safe.bareRepository on the command line' '
test_config_global safe.bareRepository explicit &&
- expect_accepted -C outer-repo/bare-repo \
+ expect_accepted_implicit -C outer-repo/bare-repo \
-c safe.bareRepository=all
'
+test_expect_success 'safe.bareRepository in included file' '
+ cat >gitconfig-include <<-\EOF &&
+ [safe]
+ bareRepository = explicit
+ EOF
+ git config --global --add include.path "$(pwd)/gitconfig-include" &&
+ expect_rejected -C outer-repo/bare-repo
+'
+
+test_expect_success 'no trace when GIT_DIR is explicitly provided' '
+ expect_accepted_explicit "$pwd/outer-repo/bare-repo"
+'
+
test_done
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index 5cc62306e3..7d7ecfd571 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -709,4 +709,16 @@ test_expect_success 'subcommands are incompatible with KEEP_DASHDASH unless in c
grep ^BUG err
'
+test_expect_success 'negative magnitude' '
+ test_must_fail test-tool parse-options --magnitude -1 >out 2>err &&
+ grep "non-negative integer" err &&
+ test_must_be_empty out
+'
+
+test_expect_success 'magnitude with units but no numbers' '
+ test_must_fail test-tool parse-options --magnitude m >out 2>err &&
+ grep "non-negative integer" err &&
+ test_must_be_empty out
+'
+
test_done
diff --git a/t/t0055-beyond-symlinks.sh b/t/t0055-beyond-symlinks.sh
index 6bada37022..c3eb1158ef 100755
--- a/t/t0055-beyond-symlinks.sh
+++ b/t/t0055-beyond-symlinks.sh
@@ -15,12 +15,22 @@ test_expect_success SYMLINKS setup '
test_expect_success SYMLINKS 'update-index --add beyond symlinks' '
test_must_fail git update-index --add c/d &&
- ! ( git ls-files | grep c/d )
+ cat >expect <<-\EOF &&
+ a
+ b/d
+ EOF
+ git ls-files >actual &&
+ test_cmp expect actual
'
test_expect_success SYMLINKS 'add beyond symlinks' '
test_must_fail git add c/d &&
- ! ( git ls-files | grep c/d )
+ cat >expect <<-\EOF &&
+ a
+ b/d
+ EOF
+ git ls-files >actual &&
+ test_cmp expect actual
'
test_done
diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
index 68e29c904a..0afa3d0d31 100755
--- a/t/t0060-path-utils.sh
+++ b/t/t0060-path-utils.sh
@@ -10,20 +10,27 @@ TEST_PASSES_SANITIZE_LEAK=true
norm_path() {
expected=$(test-tool path-utils print_path "$2")
- test_expect_success $3 "normalize path: $1 => $2" \
- "test \"\$(test-tool path-utils normalize_path_copy '$1')\" = '$expected'"
+ test_expect_success $3 "normalize path: $1 => $2" "
+ echo '$expected' >expect &&
+ test-tool path-utils normalize_path_copy '$1' >actual &&
+ test_cmp expect actual
+ "
}
relative_path() {
expected=$(test-tool path-utils print_path "$3")
- test_expect_success $4 "relative path: $1 $2 => $3" \
- "test \"\$(test-tool path-utils relative_path '$1' '$2')\" = '$expected'"
+ test_expect_success $4 "relative path: $1 $2 => $3" "
+ echo '$expected' >expect &&
+ test-tool path-utils relative_path '$1' '$2' >actual &&
+ test_cmp expect actual
+ "
}
test_submodule_relative_url() {
test_expect_success "test_submodule_relative_url: $1 $2 $3 => $4" "
- actual=\$(test-tool submodule resolve-relative-url '$1' '$2' '$3') &&
- test \"\$actual\" = '$4'
+ echo '$4' >expect &&
+ test-tool submodule resolve-relative-url '$1' '$2' '$3' >actual &&
+ test_cmp expect actual
"
}
@@ -64,9 +71,11 @@ ancestor() {
expected=$(($expected-$rootslash+$rootoff))
;;
esac
- test_expect_success $4 "longest ancestor: $1 $2 => $expected" \
- "actual=\$(test-tool path-utils longest_ancestor_length '$1' '$2') &&
- test \"\$actual\" = '$expected'"
+ test_expect_success $4 "longest ancestor: $1 $2 => $expected" "
+ echo '$expected' >expect &&
+ test-tool path-utils longest_ancestor_length '$1' '$2' >actual &&
+ test_cmp expect actual
+ "
}
# Some absolute path tests should be skipped on Windows due to path mangling
@@ -166,8 +175,10 @@ ancestor D:/Users/me C:/ -1 MINGW
ancestor //server/share/my-directory //server/share/ 14 MINGW
test_expect_success 'strip_path_suffix' '
- test c:/msysgit = $(test-tool path-utils strip_path_suffix \
- c:/msysgit/libexec//git-core libexec/git-core)
+ echo c:/msysgit >expect &&
+ test-tool path-utils strip_path_suffix \
+ c:/msysgit/libexec//git-core libexec/git-core >actual &&
+ test_cmp expect actual
'
test_expect_success 'absolute path rejects the empty string' '
@@ -188,35 +199,61 @@ test_expect_success 'real path rejects the empty string' '
'
test_expect_success POSIX 'real path works on absolute paths 1' '
+ echo / >expect &&
+ test-tool path-utils real_path "/" >actual &&
+ test_cmp expect actual &&
+
nopath="hopefully-absent-path" &&
- test "/" = "$(test-tool path-utils real_path "/")" &&
- test "/$nopath" = "$(test-tool path-utils real_path "/$nopath")"
+ echo "/$nopath" >expect &&
+ test-tool path-utils real_path "/$nopath" >actual &&
+ test_cmp expect actual
'
test_expect_success 'real path works on absolute paths 2' '
- nopath="hopefully-absent-path" &&
# Find an existing top-level directory for the remaining tests:
d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
- test "$d" = "$(test-tool path-utils real_path "$d")" &&
- test "$d/$nopath" = "$(test-tool path-utils real_path "$d/$nopath")"
+ echo "$d" >expect &&
+ test-tool path-utils real_path "$d" >actual &&
+ test_cmp expect actual &&
+
+ nopath="hopefully-absent-path" &&
+ echo "$d/$nopath" >expect &&
+ test-tool path-utils real_path "$d/$nopath" >actual &&
+ test_cmp expect actual
'
test_expect_success POSIX 'real path removes extra leading slashes' '
+ echo "/" >expect &&
+ test-tool path-utils real_path "///" >actual &&
+ test_cmp expect actual &&
+
nopath="hopefully-absent-path" &&
- test "/" = "$(test-tool path-utils real_path "///")" &&
- test "/$nopath" = "$(test-tool path-utils real_path "///$nopath")" &&
+ echo "/$nopath" >expect &&
+ test-tool path-utils real_path "///$nopath" >actual &&
+ test_cmp expect actual &&
+
# Find an existing top-level directory for the remaining tests:
d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
- test "$d" = "$(test-tool path-utils real_path "//$d")" &&
- test "$d/$nopath" = "$(test-tool path-utils real_path "//$d/$nopath")"
+ echo "$d" >expect &&
+ test-tool path-utils real_path "//$d" >actual &&
+ test_cmp expect actual &&
+
+ echo "$d/$nopath" >expect &&
+ test-tool path-utils real_path "//$d/$nopath" >actual &&
+ test_cmp expect actual
'
test_expect_success 'real path removes other extra slashes' '
- nopath="hopefully-absent-path" &&
# Find an existing top-level directory for the remaining tests:
d=$(pwd -P | sed -e "s|^\([^/]*/[^/]*\)/.*|\1|") &&
- test "$d" = "$(test-tool path-utils real_path "$d///")" &&
- test "$d/$nopath" = "$(test-tool path-utils real_path "$d///$nopath")"
+ echo "$d" >expect &&
+ test-tool path-utils real_path "$d///" >actual &&
+ test_cmp expect actual &&
+
+ nopath="hopefully-absent-path" &&
+ echo "$d/$nopath" >expect &&
+ test-tool path-utils real_path "$d///$nopath" >actual &&
+ test_cmp expect actual
'
test_expect_success SYMLINKS 'real path works on symlinks' '
@@ -227,19 +264,29 @@ test_expect_success SYMLINKS 'real path works on symlinks' '
mkdir third &&
dir="$(cd .git && pwd -P)" &&
dir2=third/../second/other/.git &&
- test "$dir" = "$(test-tool path-utils real_path $dir2)" &&
+ echo "$dir" >expect &&
+ test-tool path-utils real_path $dir2 >actual &&
+ test_cmp expect actual &&
file="$dir"/index &&
- test "$file" = "$(test-tool path-utils real_path $dir2/index)" &&
+ echo "$file" >expect &&
+ test-tool path-utils real_path $dir2/index >actual &&
+ test_cmp expect actual &&
basename=blub &&
- test "$dir/$basename" = "$(cd .git && test-tool path-utils real_path "$basename")" &&
+ echo "$dir/$basename" >expect &&
+ test-tool -C .git path-utils real_path "$basename" >actual &&
+ test_cmp expect actual &&
ln -s ../first/file .git/syml &&
sym="$(cd first && pwd -P)"/file &&
- test "$sym" = "$(test-tool path-utils real_path "$dir2/syml")"
+ echo "$sym" >expect &&
+ test-tool path-utils real_path "$dir2/syml" >actual &&
+ test_cmp expect actual
'
test_expect_success SYMLINKS 'prefix_path works with absolute paths to work tree symlinks' '
ln -s target symlink &&
- test "$(test-tool path-utils prefix_path prefix "$(pwd)/symlink")" = "symlink"
+ echo "symlink" >expect &&
+ test-tool path-utils prefix_path prefix "$(pwd)/symlink" >actual &&
+ test_cmp expect actual
'
test_expect_success 'prefix_path works with only absolute path to work tree' '
@@ -255,7 +302,10 @@ test_expect_success 'prefix_path rejects absolute path to dir with same beginnin
test_expect_success SYMLINKS 'prefix_path works with absolute path to a symlink to work tree having same beginning as work tree' '
git init repo &&
ln -s repo repolink &&
- test "a" = "$(cd repo && test-tool path-utils prefix_path prefix "$(pwd)/../repolink/a")"
+ echo "a" >expect &&
+ repo_path="$(cd repo && pwd)" &&
+ test-tool -C repo path-utils prefix_path prefix "$repo_path/../repolink/a" >actual &&
+ test_cmp expect actual
'
relative_path /foo/a/b/c/ /foo/a/b/ c/
diff --git a/t/t0061-run-command.sh b/t/t0061-run-command.sh
index 7b5423eebd..e2411f6a9b 100755
--- a/t/t0061-run-command.sh
+++ b/t/t0061-run-command.sh
@@ -130,7 +130,8 @@ World
EOF
test_expect_success 'run_command runs in parallel with more jobs available than tasks' '
- test-tool run-command run-command-parallel 5 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
+ test-tool run-command run-command-parallel 5 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>actual &&
+ test_must_be_empty out &&
test_cmp expect actual
'
@@ -141,7 +142,8 @@ test_expect_success 'run_command runs ungrouped in parallel with more jobs avail
'
test_expect_success 'run_command runs in parallel with as many jobs as tasks' '
- test-tool run-command run-command-parallel 4 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
+ test-tool run-command run-command-parallel 4 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>actual &&
+ test_must_be_empty out &&
test_cmp expect actual
'
@@ -152,7 +154,8 @@ test_expect_success 'run_command runs ungrouped in parallel with as many jobs as
'
test_expect_success 'run_command runs in parallel with more tasks than jobs available' '
- test-tool run-command run-command-parallel 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
+ test-tool run-command run-command-parallel 3 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>actual &&
+ test_must_be_empty out &&
test_cmp expect actual
'
@@ -172,7 +175,8 @@ asking for a quick stop
EOF
test_expect_success 'run_command is asked to abort gracefully' '
- test-tool run-command run-command-abort 3 false 2>actual &&
+ test-tool run-command run-command-abort 3 false >out 2>actual &&
+ test_must_be_empty out &&
test_cmp expect actual
'
@@ -187,7 +191,8 @@ no further jobs available
EOF
test_expect_success 'run_command outputs ' '
- test-tool run-command run-command-no-jobs 3 sh -c "printf \"%s\n%s\n\" Hello World" 2>actual &&
+ test-tool run-command run-command-no-jobs 3 sh -c "printf \"%s\n%s\n\" Hello World" >out 2>actual &&
+ test_must_be_empty out &&
test_cmp expect actual
'
diff --git a/t/t0063-string-list.sh b/t/t0063-string-list.sh
index 46d4839194..1fee6d9010 100755
--- a/t/t0063-string-list.sh
+++ b/t/t0063-string-list.sh
@@ -18,6 +18,14 @@ test_split () {
"
}
+test_split_in_place() {
+ cat >expected &&
+ test_expect_success "split (in place) $1 at $2, max $3" "
+ test-tool string-list split_in_place '$1' '$2' '$3' >actual &&
+ test_cmp expected actual
+ "
+}
+
test_split "foo:bar:baz" ":" "-1" <<EOF
3
[0]: "foo"
@@ -61,6 +69,49 @@ test_split ":" ":" "-1" <<EOF
[1]: ""
EOF
+test_split_in_place "foo:;:bar:;:baz:;:" ":;" "-1" <<EOF
+10
+[0]: "foo"
+[1]: ""
+[2]: ""
+[3]: "bar"
+[4]: ""
+[5]: ""
+[6]: "baz"
+[7]: ""
+[8]: ""
+[9]: ""
+EOF
+
+test_split_in_place "foo:;:bar:;:baz" ":;" "0" <<EOF
+1
+[0]: "foo:;:bar:;:baz"
+EOF
+
+test_split_in_place "foo:;:bar:;:baz" ":;" "1" <<EOF
+2
+[0]: "foo"
+[1]: ";:bar:;:baz"
+EOF
+
+test_split_in_place "foo:;:bar:;:baz" ":;" "2" <<EOF
+3
+[0]: "foo"
+[1]: ""
+[2]: ":bar:;:baz"
+EOF
+
+test_split_in_place "foo:;:bar:;:" ":;" "-1" <<EOF
+7
+[0]: "foo"
+[1]: ""
+[2]: ""
+[3]: "bar"
+[4]: ""
+[5]: ""
+[6]: ""
+EOF
+
test_expect_success "test filter_string_list" '
test "x-" = "x$(test-tool string-list filter - y)" &&
test "x-" = "x$(test-tool string-list filter no y)" &&
diff --git a/t/t0066-dir-iterator.sh b/t/t0066-dir-iterator.sh
index 04b811622b..7d0a0da8c0 100755
--- a/t/t0066-dir-iterator.sh
+++ b/t/t0066-dir-iterator.sh
@@ -106,13 +106,7 @@ test_expect_success SYMLINKS 'setup dirs with symlinks' '
ln -s d dir4/a/e &&
ln -s ../b dir4/a/f &&
- mkdir -p dir5/a/b &&
- mkdir -p dir5/a/c &&
- ln -s ../c dir5/a/b/d &&
- ln -s ../ dir5/a/b/e &&
- ln -s ../../ dir5/a/b/f &&
-
- ln -s dir4 dir6
+ ln -s dir4 dir5
'
test_expect_success SYMLINKS 'dir-iterator should not follow symlinks by default' '
@@ -131,44 +125,10 @@ test_expect_success SYMLINKS 'dir-iterator should not follow symlinks by default
test_cmp expected-no-follow-sorted-output actual-no-follow-sorted-output
'
-test_expect_success SYMLINKS 'dir-iterator should follow symlinks w/ follow flag' '
- cat >expected-follow-sorted-output <<-EOF &&
- [d] (a) [a] ./dir4/a
- [d] (a/f) [f] ./dir4/a/f
- [d] (a/f/c) [c] ./dir4/a/f/c
- [d] (b) [b] ./dir4/b
- [d] (b/c) [c] ./dir4/b/c
- [f] (a/d) [d] ./dir4/a/d
- [f] (a/e) [e] ./dir4/a/e
- EOF
-
- test-tool dir-iterator --follow-symlinks ./dir4 >out &&
- sort out >actual-follow-sorted-output &&
-
- test_cmp expected-follow-sorted-output actual-follow-sorted-output
-'
-
test_expect_success SYMLINKS 'dir-iterator does not resolve top-level symlinks' '
- test_must_fail test-tool dir-iterator ./dir6 >out &&
+ test_must_fail test-tool dir-iterator ./dir5 >out &&
grep "ENOTDIR" out
'
-test_expect_success SYMLINKS 'dir-iterator resolves top-level symlinks w/ follow flag' '
- cat >expected-follow-sorted-output <<-EOF &&
- [d] (a) [a] ./dir6/a
- [d] (a/f) [f] ./dir6/a/f
- [d] (a/f/c) [c] ./dir6/a/f/c
- [d] (b) [b] ./dir6/b
- [d] (b/c) [c] ./dir6/b/c
- [f] (a/d) [d] ./dir6/a/d
- [f] (a/e) [e] ./dir6/a/e
- EOF
-
- test-tool dir-iterator --follow-symlinks ./dir6 >out &&
- sort out >actual-follow-sorted-output &&
-
- test_cmp expected-follow-sorted-output actual-follow-sorted-output
-'
-
test_done
diff --git a/t/t0068-for-each-repo.sh b/t/t0068-for-each-repo.sh
index 4675e85251..4b90b74d5d 100755
--- a/t/t0068-for-each-repo.sh
+++ b/t/t0068-for-each-repo.sh
@@ -2,15 +2,18 @@
test_description='git for-each-repo builtin'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'run based on configured value' '
git init one &&
git init two &&
git init three &&
+ git init ~/four &&
git -C two commit --allow-empty -m "DID NOT RUN" &&
git config run.key "$TRASH_DIRECTORY/one" &&
git config --add run.key "$TRASH_DIRECTORY/three" &&
+ git config --add run.key "~/four" &&
git for-each-repo --config=run.key commit --allow-empty -m "ran" &&
git -C one log -1 --pretty=format:%s >message &&
grep ran message &&
@@ -18,12 +21,16 @@ test_expect_success 'run based on configured value' '
! grep ran message &&
git -C three log -1 --pretty=format:%s >message &&
grep ran message &&
+ git -C ~/four log -1 --pretty=format:%s >message &&
+ grep ran message &&
git for-each-repo --config=run.key -- commit --allow-empty -m "ran again" &&
git -C one log -1 --pretty=format:%s >message &&
grep again message &&
git -C two log -1 --pretty=format:%s >message &&
! grep again message &&
git -C three log -1 --pretty=format:%s >message &&
+ grep again message &&
+ git -C ~/four log -1 --pretty=format:%s >message &&
grep again message
'
@@ -33,4 +40,23 @@ test_expect_success 'do nothing on empty config' '
git for-each-repo --config=bogus.config -- help --no-such-option
'
+test_expect_success 'error on bad config keys' '
+ test_expect_code 129 git for-each-repo --config=a &&
+ test_expect_code 129 git for-each-repo --config=a.b. &&
+ test_expect_code 129 git for-each-repo --config="'\''.b"
+'
+
+test_expect_success 'error on NULL value for config keys' '
+ cat >>.git/config <<-\EOF &&
+ [empty]
+ key
+ EOF
+ cat >expect <<-\EOF &&
+ error: missing value for '\''empty.key'\''
+ EOF
+ test_expect_code 129 git for-each-repo --config=empty.key 2>actual.raw &&
+ grep ^error actual.raw >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh
index 8d59905ef0..574de34198 100755
--- a/t/t0070-fundamental.sh
+++ b/t/t0070-fundamental.sh
@@ -6,6 +6,7 @@ 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 'character classes (isspace, isalpha etc.)' '
diff --git a/t/t0100-previous.sh b/t/t0100-previous.sh
index a16cc3d298..70a3223f21 100755
--- a/t/t0100-previous.sh
+++ b/t/t0100-previous.sh
@@ -12,7 +12,9 @@ test_expect_success 'branch -d @{-1}' '
test_commit A &&
git checkout -b junk &&
git checkout - &&
- test "$(git symbolic-ref HEAD)" = refs/heads/main &&
+ echo refs/heads/main >expect &&
+ git symbolic-ref HEAD >actual &&
+ test_cmp expect actual &&
git branch -d @{-1} &&
test_must_fail git rev-parse --verify refs/heads/junk
'
@@ -21,7 +23,9 @@ test_expect_success 'branch -d @{-12} when there is not enough switches yet' '
git reflog expire --expire=now &&
git checkout -b junk2 &&
git checkout - &&
- test "$(git symbolic-ref HEAD)" = refs/heads/main &&
+ echo refs/heads/main >expect &&
+ git symbolic-ref HEAD >actual &&
+ test_cmp expect actual &&
test_must_fail git branch -d @{-12} &&
git rev-parse --verify refs/heads/main
'
diff --git a/t/t0211-trace2-perf.sh b/t/t0211-trace2-perf.sh
index 22d0845544..b4e9135118 100755
--- a/t/t0211-trace2-perf.sh
+++ b/t/t0211-trace2-perf.sh
@@ -173,4 +173,99 @@ test_expect_success 'using global config, perf stream, return code 0' '
test_cmp expect actual
'
+# Exercise the stopwatch timers in a loop and confirm that we have
+# as many start/stop intervals as expected. We cannot really test the
+# actual (total, min, max) timer values, so we have to assume that they
+# are good, but we can verify the interval count.
+#
+# The timer "test/test1" should only emit a global summary "timer" event.
+# The timer "test/test2" should emit per-thread "th_timer" events and a
+# global summary "timer" event.
+
+have_timer_event () {
+ thread=$1 event=$2 category=$3 name=$4 intervals=$5 file=$6 &&
+
+ pattern="d0|${thread}|${event}||||${category}|name:${name} intervals:${intervals}" &&
+
+ grep "${pattern}" ${file}
+}
+
+test_expect_success 'stopwatch timer test/test1' '
+ test_when_finished "rm trace.perf actual" &&
+ test_config_global trace2.perfBrief 1 &&
+ test_config_global trace2.perfTarget "$(pwd)/trace.perf" &&
+
+ # Use the timer "test1" 5 times from "main".
+ test-tool trace2 100timer 5 10 &&
+
+ perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <trace.perf >actual &&
+
+ have_timer_event "main" "timer" "test" "test1" 5 actual
+'
+
+test_expect_success PTHREAD 'stopwatch timer test/test2' '
+ test_when_finished "rm trace.perf actual" &&
+ test_config_global trace2.perfBrief 1 &&
+ test_config_global trace2.perfTarget "$(pwd)/trace.perf" &&
+
+ # Use the timer "test2" 5 times each in 3 threads.
+ test-tool trace2 101timer 5 10 3 &&
+
+ perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <trace.perf >actual &&
+
+ # So we should have 3 per-thread events of 5 each.
+ have_timer_event "th01:ut_101" "th_timer" "test" "test2" 5 actual &&
+ have_timer_event "th02:ut_101" "th_timer" "test" "test2" 5 actual &&
+ have_timer_event "th03:ut_101" "th_timer" "test" "test2" 5 actual &&
+
+ # And we should have 15 total uses.
+ have_timer_event "main" "timer" "test" "test2" 15 actual
+'
+
+# Exercise the global counters and confirm that we get the expected values.
+#
+# The counter "test/test1" should only emit a global summary "counter" event.
+# The counter "test/test2" could emit per-thread "th_counter" events and a
+# global summary "counter" event.
+
+have_counter_event () {
+ thread=$1 event=$2 category=$3 name=$4 value=$5 file=$6 &&
+
+ pattern="d0|${thread}|${event}||||${category}|name:${name} value:${value}" &&
+
+ grep "${patern}" ${file}
+}
+
+test_expect_success 'global counter test/test1' '
+ test_when_finished "rm trace.perf actual" &&
+ test_config_global trace2.perfBrief 1 &&
+ test_config_global trace2.perfTarget "$(pwd)/trace.perf" &&
+
+ # Use the counter "test1" and add n integers.
+ test-tool trace2 200counter 1 2 3 4 5 &&
+
+ perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <trace.perf >actual &&
+
+ have_counter_event "main" "counter" "test" "test1" 15 actual
+'
+
+test_expect_success PTHREAD 'global counter test/test2' '
+ test_when_finished "rm trace.perf actual" &&
+ test_config_global trace2.perfBrief 1 &&
+ test_config_global trace2.perfTarget "$(pwd)/trace.perf" &&
+
+ # Add 2 integers to the counter "test2" in each of 3 threads.
+ test-tool trace2 201counter 7 13 3 &&
+
+ perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <trace.perf >actual &&
+
+ # So we should have 3 per-thread events of 5 each.
+ have_counter_event "th01:ut_201" "th_counter" "test" "test2" 20 actual &&
+ have_counter_event "th02:ut_201" "th_counter" "test" "test2" 20 actual &&
+ have_counter_event "th03:ut_201" "th_counter" "test" "test2" 20 actual &&
+
+ # And we should have a single event with the total across all threads.
+ have_counter_event "main" "counter" "test" "test2" 60 actual
+'
+
test_done
diff --git a/t/t0211/scrub_perf.perl b/t/t0211/scrub_perf.perl
index 299999f0f8..7a50bae646 100644
--- a/t/t0211/scrub_perf.perl
+++ b/t/t0211/scrub_perf.perl
@@ -64,6 +64,12 @@ while (<>) {
goto SKIP_LINE;
}
}
+ elsif ($tokens[$col_event] =~ m/timer/) {
+ # This also captures "th_timer" events
+ $tokens[$col_rest] =~ s/ total:\d+\.\d*/ total:_T_TOTAL_/;
+ $tokens[$col_rest] =~ s/ min:\d+\.\d*/ min:_T_MIN_/;
+ $tokens[$col_rest] =~ s/ max:\d+\.\d*/ max:_T_MAX_/;
+ }
# t_abs and t_rel are either blank or a float. Replace the float
# with a constant for matching the HEREDOC in the test script.
diff --git a/t/t0300-credentials.sh b/t/t0300-credentials.sh
index 3485c0534e..a4f5bba507 100755
--- a/t/t0300-credentials.sh
+++ b/t/t0300-credentials.sh
@@ -35,6 +35,16 @@ test_expect_success 'setup helper scripts' '
test -z "$pass" || echo password=$pass
EOF
+ write_script git-credential-verbatim-with-expiry <<-\EOF &&
+ user=$1; shift
+ pass=$1; shift
+ pexpiry=$1; shift
+ . ./dump
+ test -z "$user" || echo username=$user
+ test -z "$pass" || echo password=$pass
+ test -z "$pexpiry" || echo password_expiry_utc=$pexpiry
+ EOF
+
PATH="$PWD:$PATH"
'
@@ -109,6 +119,43 @@ test_expect_success 'credential_fill continues through partial response' '
EOF
'
+test_expect_success 'credential_fill populates password_expiry_utc' '
+ check fill "verbatim-with-expiry one two 9999999999" <<-\EOF
+ protocol=http
+ host=example.com
+ --
+ protocol=http
+ host=example.com
+ username=one
+ password=two
+ password_expiry_utc=9999999999
+ --
+ verbatim-with-expiry: get
+ verbatim-with-expiry: protocol=http
+ verbatim-with-expiry: host=example.com
+ EOF
+'
+
+test_expect_success 'credential_fill ignores expired password' '
+ check fill "verbatim-with-expiry one two 5" "verbatim three four" <<-\EOF
+ protocol=http
+ host=example.com
+ --
+ protocol=http
+ host=example.com
+ username=three
+ password=four
+ --
+ verbatim-with-expiry: get
+ verbatim-with-expiry: protocol=http
+ verbatim-with-expiry: host=example.com
+ verbatim: get
+ verbatim: protocol=http
+ verbatim: host=example.com
+ verbatim: username=one
+ EOF
+'
+
test_expect_success 'credential_fill passes along metadata' '
check fill "verbatim one two" <<-\EOF
protocol=ftp
@@ -149,6 +196,42 @@ test_expect_success 'credential_approve calls all helpers' '
EOF
'
+test_expect_success 'credential_approve stores password expiry' '
+ check approve useless <<-\EOF
+ protocol=http
+ host=example.com
+ username=foo
+ password=bar
+ password_expiry_utc=9999999999
+ --
+ --
+ useless: store
+ useless: protocol=http
+ useless: host=example.com
+ useless: username=foo
+ useless: password=bar
+ useless: password_expiry_utc=9999999999
+ EOF
+'
+
+test_expect_success 'credential_approve stores oauth refresh token' '
+ check approve useless <<-\EOF
+ protocol=http
+ host=example.com
+ username=foo
+ password=bar
+ oauth_refresh_token=xyzzy
+ --
+ --
+ useless: store
+ useless: protocol=http
+ useless: host=example.com
+ useless: username=foo
+ useless: password=bar
+ useless: oauth_refresh_token=xyzzy
+ EOF
+'
+
test_expect_success 'do not bother storing password-less credential' '
check approve useless <<-\EOF
protocol=http
@@ -159,6 +242,17 @@ test_expect_success 'do not bother storing password-less credential' '
EOF
'
+test_expect_success 'credential_approve does not store expired password' '
+ check approve useless <<-\EOF
+ protocol=http
+ host=example.com
+ username=foo
+ password=bar
+ password_expiry_utc=5
+ --
+ --
+ EOF
+'
test_expect_success 'credential_reject calls all helpers' '
check reject useless "verbatim one two" <<-\EOF
@@ -181,6 +275,24 @@ test_expect_success 'credential_reject calls all helpers' '
EOF
'
+test_expect_success 'credential_reject erases credential regardless of expiry' '
+ check reject useless <<-\EOF
+ protocol=http
+ host=example.com
+ username=foo
+ password=bar
+ password_expiry_utc=5
+ --
+ --
+ useless: erase
+ useless: protocol=http
+ useless: host=example.com
+ useless: username=foo
+ useless: password=bar
+ useless: password_expiry_utc=5
+ EOF
+'
+
test_expect_success 'usernames can be preserved' '
check fill "verbatim \"\" three" <<-\EOF
protocol=http
@@ -714,7 +826,7 @@ test_expect_success 'credential config with partial URLs' '
git -c credential.$partial.helper=yep \
-c credential.with%0anewline.username=uh-oh \
- credential fill <stdin >stdout 2>stderr &&
+ credential fill <stdin 2>stderr &&
test_i18ngrep "skipping credential lookup for key" stderr
'
diff --git a/t/t0301-credential-cache.sh b/t/t0301-credential-cache.sh
index 698b7159f0..c02a3b5969 100755
--- a/t/t0301-credential-cache.sh
+++ b/t/t0301-credential-cache.sh
@@ -29,6 +29,7 @@ test_atexit 'git credential-cache exit'
# test that the daemon works with no special setup
helper_test cache
+helper_test_oauth_refresh_token cache
test_expect_success 'socket defaults to ~/.cache/git/credential/socket' '
test_when_finished "
diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
index 1e864cf317..5b7bee888d 100755
--- a/t/t0410-partial-clone.sh
+++ b/t/t0410-partial-clone.sh
@@ -215,6 +215,20 @@ test_expect_success 'fetching of missing objects' '
grep "$HASH" out
'
+test_expect_success 'fetching of a promised object that promisor remote no longer has' '
+ rm -f err &&
+ test_create_repo unreliable-server &&
+ git -C unreliable-server config uploadpack.allowanysha1inwant 1 &&
+ git -C unreliable-server config uploadpack.allowfilter 1 &&
+ test_commit -C unreliable-server foo &&
+
+ git clone --filter=blob:none --no-checkout "file://$(pwd)/unreliable-server" unreliable-client &&
+
+ rm -rf unreliable-server/.git/objects/* &&
+ test_must_fail git -C unreliable-client checkout HEAD 2>err &&
+ grep "could not fetch.*from promisor remote" err
+'
+
test_expect_success 'fetching of missing objects works with ref-in-want enabled' '
# ref-in-want requires protocol version 2
git -C server config protocol.version 2 &&
diff --git a/t/t0450-txt-doc-vs-help.sh b/t/t0450-txt-doc-vs-help.sh
new file mode 100755
index 0000000000..cd3969e852
--- /dev/null
+++ b/t/t0450-txt-doc-vs-help.sh
@@ -0,0 +1,172 @@
+#!/bin/sh
+
+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' '
+ git --list-cmds=builtins >builtins
+'
+
+test_expect_success 'list of txt and help mismatches is sorted' '
+ sort -u "$TEST_DIRECTORY"/t0450/txt-help-mismatches >expect &&
+ if ! test_cmp expect "$TEST_DIRECTORY"/t0450/txt-help-mismatches
+ then
+ BUG "please keep the list of txt and help mismatches sorted"
+ fi
+'
+
+help_to_synopsis () {
+ builtin="$1" &&
+ out_dir="out/$builtin" &&
+ out="$out_dir/help.synopsis" &&
+ if test -f "$out"
+ then
+ echo "$out" &&
+ return 0
+ fi &&
+ mkdir -p "$out_dir" &&
+ test_expect_code 129 git $builtin -h >"$out.raw" 2>&1 &&
+ sed -n \
+ -e '1,/^$/ {
+ /^$/d;
+ s/^usage: //;
+ s/^ *or: //;
+ p;
+ }' <"$out.raw" >"$out" &&
+ echo "$out"
+}
+
+builtin_to_txt () {
+ echo "$GIT_BUILD_DIR/Documentation/git-$1.txt"
+}
+
+txt_to_synopsis () {
+ builtin="$1" &&
+ out_dir="out/$builtin" &&
+ out="$out_dir/txt.synopsis" &&
+ if test -f "$out"
+ then
+ echo "$out" &&
+ return 0
+ fi &&
+ b2t="$(builtin_to_txt "$builtin")" &&
+ sed -n \
+ -e '/^\[verse\]$/,/^$/ {
+ /^$/d;
+ /^\[verse\]$/d;
+
+ s/{litdd}/--/g;
+ s/'\''\(git[ a-z-]*\)'\''/\1/g;
+
+ p;
+ }' \
+ <"$b2t" >"$out" &&
+ echo "$out"
+}
+
+check_dashed_labels () {
+ ! grep -E "<[^>_-]+_" "$1"
+}
+
+HT=" "
+
+align_after_nl () {
+ builtin="$1" &&
+ len=$(printf "git %s " "$builtin" | wc -c) &&
+ pad=$(printf "%${len}s" "") &&
+
+ sed "s/^[ $HT][ $HT]*/$pad/"
+}
+
+test_debug '>failing'
+while read builtin
+do
+ # -h output assertions
+ test_expect_success "$builtin -h output has no \t" '
+ h2s="$(help_to_synopsis "$builtin")" &&
+ ! grep "$HT" "$h2s"
+ '
+
+ test_expect_success "$builtin -h output has dashed labels" '
+ check_dashed_labels "$(help_to_synopsis "$builtin")"
+ '
+
+ test_expect_success "$builtin -h output has consistent spacing" '
+ h2s="$(help_to_synopsis "$builtin")" &&
+ sed -n \
+ -e "/^ / {
+ s/[^ ].*//;
+ p;
+ }" \
+ <"$h2s" >help &&
+ sort -u help >help.ws &&
+ if test -s help.ws
+ then
+ test_line_count = 1 help.ws
+ fi
+ '
+
+ txt="$(builtin_to_txt "$builtin")" &&
+ preq="$(echo BUILTIN_TXT_$builtin | tr '[:lower:]-' '[:upper:]_')" &&
+
+ if test -f "$txt"
+ then
+ test_set_prereq "$preq"
+ fi &&
+
+ # *.txt output assertions
+ test_expect_success "$preq" "$builtin *.txt SYNOPSIS has dashed labels" '
+ check_dashed_labels "$(txt_to_synopsis "$builtin")"
+ '
+
+ # *.txt output consistency assertions
+ result=
+ if grep -q "^$builtin$" "$TEST_DIRECTORY"/t0450/txt-help-mismatches
+ then
+ result=failure
+ else
+ result=success
+ fi &&
+ test_expect_$result "$preq" "$builtin -h output and SYNOPSIS agree" '
+ t2s="$(txt_to_synopsis "$builtin")" &&
+ if test "$builtin" = "merge-tree"
+ then
+ test_when_finished "rm -f t2s.new" &&
+ sed -e '\''s/ (deprecated)$//g'\'' <"$t2s" >t2s.new
+ t2s=t2s.new
+ fi &&
+ h2s="$(help_to_synopsis "$builtin")" &&
+
+ # The *.txt and -h use different spacing for the
+ # alignment of continued usage output, normalize it.
+ align_after_nl "$builtin" <"$t2s" >txt &&
+ align_after_nl "$builtin" <"$h2s" >help &&
+ test_cmp txt help
+ '
+
+ if test_have_prereq "$preq" && test -e txt && test -e help
+ then
+ test_debug '
+ if test_cmp txt help >cmp 2>/dev/null
+ then
+ echo "=== DONE: $builtin ==="
+ else
+ echo "=== TODO: $builtin ===" &&
+ cat cmp
+ fi >>failing
+ '
+
+ # Not in test_expect_success in case --run is being
+ # used with --debug
+ rm -f txt help tmp 2>/dev/null
+ fi
+done <builtins
+
+test_debug 'say "$(cat failing)"'
+
+test_done
diff --git a/t/t0450/txt-help-mismatches b/t/t0450/txt-help-mismatches
new file mode 100644
index 0000000000..a0777acd66
--- /dev/null
+++ b/t/t0450/txt-help-mismatches
@@ -0,0 +1,58 @@
+add
+am
+apply
+archive
+bisect
+blame
+branch
+check-ref-format
+checkout
+checkout-index
+clone
+column
+config
+credential
+credential-cache
+credential-store
+fast-export
+fast-import
+fetch-pack
+fmt-merge-msg
+for-each-ref
+format-patch
+fsck-objects
+fsmonitor--daemon
+gc
+grep
+index-pack
+init-db
+log
+ls-files
+ls-tree
+mailinfo
+mailsplit
+maintenance
+merge
+merge-file
+merge-index
+merge-one-file
+multi-pack-index
+name-rev
+notes
+pack-objects
+push
+range-diff
+rebase
+remote
+remote-ext
+remote-fd
+repack
+reset
+restore
+rev-parse
+show
+stage
+switch
+update-index
+update-ref
+whatchanged
diff --git a/t/t1001-read-tree-m-2way.sh b/t/t1001-read-tree-m-2way.sh
index 516a6112fd..3fb1b0c162 100755
--- a/t/t1001-read-tree-m-2way.sh
+++ b/t/t1001-read-tree-m-2way.sh
@@ -370,7 +370,7 @@ test_expect_success 'read-tree supports the super-prefix' '
cat <<-EOF >expect &&
error: Updating '\''fictional/a'\'' would lose untracked files in it
EOF
- test_must_fail git --super-prefix fictional/ read-tree -u -m "$treeH" "$treeM" 2>actual &&
+ test_must_fail git read-tree --super-prefix fictional/ -u -m "$treeH" "$treeM" 2>actual &&
test_cmp expect actual
'
diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh
index bd5313caec..cdc077ce12 100755
--- a/t/t1002-read-tree-m-u-2way.sh
+++ b/t/t1002-read-tree-m-u-2way.sh
@@ -154,7 +154,7 @@ test_expect_success \
read_tree_u_must_succeed --reset -u $treeH &&
echo frotz frotz >frotz &&
git update-index --add frotz &&
- if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
+ ! read_tree_u_must_succeed -m -u $treeH $treeM'
test_expect_success \
'9 - conflicting addition.' \
@@ -163,7 +163,7 @@ test_expect_success \
echo frotz frotz >frotz &&
git update-index --add frotz &&
echo frotz >frotz &&
- if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
+ ! read_tree_u_must_succeed -m -u $treeH $treeM'
test_expect_success \
'10 - path removed.' \
@@ -186,7 +186,7 @@ test_expect_success \
echo rezrov >rezrov &&
git update-index --add rezrov &&
echo rezrov rezrov >rezrov &&
- if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
+ ! read_tree_u_must_succeed -m -u $treeH $treeM'
test_expect_success \
'12 - unmatching local changes being removed.' \
@@ -194,7 +194,7 @@ test_expect_success \
read_tree_u_must_succeed --reset -u $treeH &&
echo rezrov rezrov >rezrov &&
git update-index --add rezrov &&
- if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
+ ! read_tree_u_must_succeed -m -u $treeH $treeM'
test_expect_success \
'13 - unmatching local changes being removed.' \
@@ -203,7 +203,7 @@ test_expect_success \
echo rezrov rezrov >rezrov &&
git update-index --add rezrov &&
echo rezrov >rezrov &&
- if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
+ ! read_tree_u_must_succeed -m -u $treeH $treeM'
cat >expected <<EOF
-100644 X 0 nitfol
@@ -251,7 +251,7 @@ test_expect_success \
read_tree_u_must_succeed --reset -u $treeH &&
echo bozbar bozbar >bozbar &&
git update-index --add bozbar &&
- if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
+ ! read_tree_u_must_succeed -m -u $treeH $treeM'
test_expect_success \
'17 - conflicting local change.' \
@@ -260,7 +260,7 @@ test_expect_success \
echo bozbar bozbar >bozbar &&
git update-index --add bozbar &&
echo bozbar bozbar bozbar >bozbar &&
- if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
+ ! read_tree_u_must_succeed -m -u $treeH $treeM'
test_expect_success \
'18 - local change already having a good result.' \
@@ -316,7 +316,7 @@ test_expect_success \
echo bozbar >bozbar &&
git update-index --add bozbar &&
echo gnusto gnusto >bozbar &&
- if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
+ ! read_tree_u_must_succeed -m -u $treeH $treeM'
# Also make sure we did not break DF vs DF/DF case.
test_expect_success \
diff --git a/t/t1005-read-tree-reset.sh b/t/t1005-read-tree-reset.sh
index 12e30d77d0..26be4a2b5a 100755
--- a/t/t1005-read-tree-reset.sh
+++ b/t/t1005-read-tree-reset.sh
@@ -41,7 +41,8 @@ test_expect_success 'reset should remove remnants from a failed merge' '
git ls-files -s &&
read_tree_u_must_succeed --reset -u HEAD &&
git ls-files -s >actual &&
- ! test -f old
+ ! test -f old &&
+ test_cmp expect actual
'
test_expect_success 'two-way reset should remove remnants too' '
@@ -56,7 +57,8 @@ test_expect_success 'two-way reset should remove remnants too' '
git ls-files -s &&
read_tree_u_must_succeed --reset -u HEAD HEAD &&
git ls-files -s >actual &&
- ! test -f old
+ ! test -f old &&
+ test_cmp expect actual
'
test_expect_success 'Porcelain reset should remove remnants too' '
@@ -71,7 +73,8 @@ test_expect_success 'Porcelain reset should remove remnants too' '
git ls-files -s &&
git reset --hard &&
git ls-files -s >actual &&
- ! test -f old
+ ! test -f old &&
+ test_cmp expect actual
'
test_expect_success 'Porcelain checkout -f should remove remnants too' '
@@ -86,7 +89,8 @@ test_expect_success 'Porcelain checkout -f should remove remnants too' '
git ls-files -s &&
git checkout -f &&
git ls-files -s >actual &&
- ! test -f old
+ ! test -f old &&
+ test_cmp expect actual
'
test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '
@@ -101,7 +105,8 @@ test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '
git ls-files -s &&
git checkout -f HEAD &&
git ls-files -s >actual &&
- ! test -f old
+ ! test -f old &&
+ test_cmp expect actual
'
test_done
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index 23b8942edb..8eac74b59c 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -292,8 +292,8 @@ commit_message="Initial commit"
commit_sha1=$(echo_without_newline "$commit_message" | git commit-tree $tree_sha1)
commit_size=$(($(test_oid hexsz) + 137))
commit_content="tree $tree_sha1
-author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 0000000000 +0000
-committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 0000000000 +0000
+author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 0 +0000
+committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 0 +0000
$commit_message"
@@ -304,7 +304,7 @@ type blob
tag hellotag
tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
tag_description="This is a tag"
-tag_content="$tag_header_without_timestamp 0000000000 +0000
+tag_content="$tag_header_without_timestamp 0 +0000
$tag_description"
@@ -603,7 +603,8 @@ do
fatal: Not a valid object name $(test_oid deadbeef_short)
EOF
test_must_fail git cat-file $arg1 $arg2 $(test_oid deadbeef_short) >out 2>err.actual &&
- test_must_be_empty out
+ test_must_be_empty out &&
+ test_cmp expect.err err.actual
'
test_expect_success "cat-file $arg1 $arg2 error on missing full OID" '
diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh
index ac5ad8c740..ac3d173767 100755
--- a/t/t1007-hash-object.sh
+++ b/t/t1007-hash-object.sh
@@ -203,23 +203,34 @@ done
test_expect_success 'too-short tree' '
echo abc >malformed-tree &&
test_must_fail git hash-object -t tree malformed-tree 2>err &&
- test_i18ngrep "too-short tree object" err
+ grep "too-short tree object" err
'
test_expect_success 'malformed mode in tree' '
- hex_sha1=$(echo foo | git hash-object --stdin -w) &&
- bin_sha1=$(echo $hex_sha1 | hex2oct) &&
- printf "9100644 \0$bin_sha1" >tree-with-malformed-mode &&
+ hex_oid=$(echo foo | git hash-object --stdin -w) &&
+ bin_oid=$(echo $hex_oid | hex2oct) &&
+ printf "9100644 \0$bin_oid" >tree-with-malformed-mode &&
test_must_fail git hash-object -t tree tree-with-malformed-mode 2>err &&
- test_i18ngrep "malformed mode in tree entry" err
+ grep "malformed mode in tree entry" err
'
test_expect_success 'empty filename in tree' '
- hex_sha1=$(echo foo | git hash-object --stdin -w) &&
- bin_sha1=$(echo $hex_sha1 | hex2oct) &&
- printf "100644 \0$bin_sha1" >tree-with-empty-filename &&
+ hex_oid=$(echo foo | git hash-object --stdin -w) &&
+ bin_oid=$(echo $hex_oid | hex2oct) &&
+ printf "100644 \0$bin_oid" >tree-with-empty-filename &&
test_must_fail git hash-object -t tree tree-with-empty-filename 2>err &&
- test_i18ngrep "empty filename in tree entry" err
+ grep "empty filename in tree entry" err
+'
+
+test_expect_success 'duplicate filename in tree' '
+ hex_oid=$(echo foo | git hash-object --stdin -w) &&
+ bin_oid=$(echo $hex_oid | hex2oct) &&
+ {
+ printf "100644 file\0$bin_oid" &&
+ printf "100644 file\0$bin_oid"
+ } >tree-with-duplicate-filename &&
+ test_must_fail git hash-object -t tree tree-with-duplicate-filename 2>err &&
+ grep "duplicateEntries" err
'
test_expect_success 'corrupt commit' '
diff --git a/t/t1010-mktree.sh b/t/t1010-mktree.sh
index 3c08194526..22875ba598 100755
--- a/t/t1010-mktree.sh
+++ b/t/t1010-mktree.sh
@@ -60,11 +60,11 @@ test_expect_success 'allow missing object with --missing' '
'
test_expect_success 'mktree refuses to read ls-tree -r output (1)' '
- test_must_fail git mktree <all >actual
+ test_must_fail git mktree <all
'
test_expect_success 'mktree refuses to read ls-tree -r output (2)' '
- test_must_fail git mktree <all.withsub >actual
+ test_must_fail git mktree <all.withsub
'
test_done
diff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh
index 742f0fa909..595b24c0ad 100755
--- a/t/t1011-read-tree-sparse-checkout.sh
+++ b/t/t1011-read-tree-sparse-checkout.sh
@@ -12,6 +12,7 @@ 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/t1022-read-tree-partial-clone.sh b/t/t1022-read-tree-partial-clone.sh
index a9953b6a71..cca4380e43 100755
--- a/t/t1022-read-tree-partial-clone.sh
+++ b/t/t1022-read-tree-partial-clone.sh
@@ -3,7 +3,7 @@
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' '
@@ -19,7 +19,7 @@ test_expect_success 'read-tree in partial clone prefetches in one batch' '
git -C server config uploadpack.allowfilter 1 &&
git -C server config uploadpack.allowanysha1inwant 1 &&
git clone --bare --filter=blob:none "file://$(pwd)/server" client &&
- GIT_TRACE_PACKET="$(pwd)/trace" git -C client read-tree $TREE &&
+ GIT_TRACE_PACKET="$(pwd)/trace" git -C client read-tree $TREE $TREE &&
# "done" marks the end of negotiation (once per fetch). Expect that
# only one fetch occurs.
diff --git a/t/t1050-large.sh b/t/t1050-large.sh
index 4f3aa17c99..c71932b024 100755
--- a/t/t1050-large.sh
+++ b/t/t1050-large.sh
@@ -5,6 +5,12 @@ test_description='adding and checking out large blobs'
. ./test-lib.sh
+test_expect_success 'core.bigFileThreshold must be non-negative' '
+ test_must_fail git -c core.bigFileThreshold=-1 rev-parse >out 2>err &&
+ grep "bad numeric config value" err &&
+ test_must_be_empty out
+'
+
test_expect_success setup '
# clone does not allow us to pass core.bigfilethreshold to
# new repos, so set core.bigfilethreshold globally
diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh
index b563d6c263..9ceb17f911 100755
--- a/t/t1091-sparse-checkout-builtin.sh
+++ b/t/t1091-sparse-checkout-builtin.sh
@@ -238,7 +238,7 @@ test_expect_success 'cone mode: match patterns' '
test_expect_success 'cone mode: warn on bad pattern' '
test_when_finished mv sparse-checkout repo/.git/info/ &&
cp repo/.git/info/sparse-checkout . &&
- echo "!/deep/deeper/*" >>repo/.git/info/sparse-checkout &&
+ echo "!/deep/deeper/*/" >>repo/.git/info/sparse-checkout &&
git -C repo read-tree -mu HEAD 2>err &&
test_i18ngrep "unrecognized negative pattern" err
'
@@ -555,7 +555,7 @@ test_expect_success 'cone mode: set with core.ignoreCase=true' '
check_files repo a folder1
'
-test_expect_success 'interaction with submodules' '
+test_expect_success 'setup submodules' '
git clone repo super &&
(
cd super &&
@@ -566,11 +566,22 @@ test_expect_success 'interaction with submodules' '
git commit -m "add submodule" &&
git sparse-checkout init --cone &&
git sparse-checkout set folder1
- ) &&
+ )
+'
+
+test_expect_success 'interaction with submodules' '
check_files super a folder1 modules &&
check_files super/modules/child a deep folder1 folder2
'
+test_expect_success 'check-rules interaction with submodules' '
+ git -C super ls-tree --name-only -r HEAD >all-files &&
+ git -C super sparse-checkout check-rules >check-rules-matches <all-files &&
+
+ test_i18ngrep ! "modules/" check-rules-matches &&
+ test_i18ngrep "folder1/" check-rules-matches
+'
+
test_expect_success 'different sparse-checkouts with worktrees' '
git -C repo sparse-checkout set --cone deep folder1 &&
git -C repo worktree add --detach ../worktree &&
@@ -667,6 +678,15 @@ test_expect_success 'pattern-checks: starting "*"' '
check_read_tree_errors repo "a deep" "disabling cone pattern matching"
'
+test_expect_success 'pattern-checks: non directory pattern' '
+ cat >repo/.git/info/sparse-checkout <<-\EOF &&
+ /deep/deeper1/a
+ EOF
+ check_read_tree_errors repo deep "disabling cone pattern matching" &&
+ check_files repo/deep deeper1 &&
+ check_files repo/deep/deeper1 a
+'
+
test_expect_success 'pattern-checks: contained glob characters' '
for c in "[a]" "\\" "?" "*"
do
@@ -873,4 +893,156 @@ test_expect_success 'by default, non-cone mode will warn on individual files' '
grep "pass a leading slash before paths.*if you want a single file" warning
'
+test_expect_success 'setup bare repo' '
+ git clone --bare "file://$(pwd)/repo" bare
+'
+test_expect_success 'list fails outside work tree' '
+ test_must_fail git -C bare sparse-checkout list 2>err &&
+ test_i18ngrep "this operation must be run in a work tree" err
+'
+
+test_expect_success 'add fails outside work tree' '
+ test_must_fail git -C bare sparse-checkout add deeper 2>err &&
+ test_i18ngrep "this operation must be run in a work tree" err
+'
+
+test_expect_success 'set fails outside work tree' '
+ test_must_fail git -C bare sparse-checkout set deeper 2>err &&
+ test_i18ngrep "this operation must be run in a work tree" err
+'
+
+test_expect_success 'init fails outside work tree' '
+ test_must_fail git -C bare sparse-checkout init 2>err &&
+ test_i18ngrep "this operation must be run in a work tree" err
+'
+
+test_expect_success 'reapply fails outside work tree' '
+ test_must_fail git -C bare sparse-checkout reapply 2>err &&
+ test_i18ngrep "this operation must be run in a work tree" err
+'
+
+test_expect_success 'disable fails outside work tree' '
+ test_must_fail git -C bare sparse-checkout disable 2>err &&
+ test_i18ngrep "this operation must be run in a work tree" err
+'
+
+test_expect_success 'setup clean' '
+ git -C repo clean -fdx
+'
+
+test_expect_success 'check-rules cone mode' '
+ cat >rules <<-\EOF &&
+ folder1
+ deep/deeper1/deepest
+ EOF
+
+ git -C bare ls-tree -r --name-only HEAD >all-files &&
+ git -C bare sparse-checkout check-rules --cone \
+ --rules-file ../rules >check-rules-file <all-files &&
+
+ git -C repo sparse-checkout set --cone --stdin <rules&&
+ git -C repo ls-files -t >out &&
+ sed -n "/^S /!s/^. //p" out >ls-files &&
+
+ git -C repo sparse-checkout check-rules >check-rules-default <all-files &&
+
+ test_i18ngrep "deep/deeper1/deepest/a" check-rules-file &&
+ test_i18ngrep ! "deep/deeper2" check-rules-file &&
+
+ test_cmp check-rules-file ls-files &&
+ test_cmp check-rules-file check-rules-default
+'
+
+test_expect_success 'check-rules non-cone mode' '
+ cat >rules <<-\EOF &&
+ deep/deeper1/deepest/a
+ EOF
+
+ git -C bare ls-tree -r --name-only HEAD >all-files &&
+ git -C bare sparse-checkout check-rules --no-cone --rules-file ../rules\
+ >check-rules-file <all-files &&
+
+ cat rules | git -C repo sparse-checkout set --no-cone --stdin &&
+ git -C repo ls-files -t >out &&
+ sed -n "/^S /!s/^. //p" out >ls-files &&
+
+ git -C repo sparse-checkout check-rules >check-rules-default <all-files &&
+
+ cat >expect <<-\EOF &&
+ deep/deeper1/deepest/a
+ EOF
+
+ test_cmp expect check-rules-file &&
+ test_cmp check-rules-file ls-files &&
+ test_cmp check-rules-file check-rules-default
+'
+
+test_expect_success 'check-rules cone mode is default' '
+ cat >rules <<-\EOF &&
+ folder1
+ EOF
+
+ cat >all-files <<-\EOF &&
+ toplevel
+ folder2/file
+ folder1/file
+ EOF
+
+ cat >expect <<-\EOF &&
+ toplevel
+ folder1/file
+ EOF
+
+ git -C repo sparse-checkout set --no-cone &&
+ git -C repo sparse-checkout check-rules \
+ --rules-file ../rules >actual <all-files &&
+
+ git -C bare sparse-checkout check-rules \
+ --rules-file ../rules >actual-bare <all-files &&
+
+ test_cmp expect actual &&
+ test_cmp expect actual-bare
+'
+
+test_expect_success 'check-rules quoting' '
+ cat >rules <<-EOF &&
+ "folder\" a"
+ EOF
+ cat >files <<-EOF &&
+ "folder\" a/file"
+ "folder\" b/file"
+ EOF
+ cat >expect <<-EOF &&
+ "folder\" a/file"
+ EOF
+ git sparse-checkout check-rules --cone \
+ --rules-file rules >actual <files &&
+
+ test_cmp expect actual
+'
+
+test_expect_success 'check-rules null termination' '
+ cat >rules <<-EOF &&
+ "folder\" a"
+ EOF
+
+ lf_to_nul >files <<-EOF &&
+ folder" a/a
+ folder" a/b
+ folder" b/fileQ
+ EOF
+
+ cat >expect <<-EOF &&
+ folder" a/aQfolder" a/bQ
+ EOF
+
+ git sparse-checkout check-rules --cone -z \
+ --rules-file rules >actual.nul <files &&
+ nul_to_q <actual.nul >actual &&
+ echo >>actual &&
+
+ test_cmp expect actual
+'
+
+
test_done
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
index 4844922e57..0c784813f1 100755
--- a/t/t1092-sparse-checkout-compatibility.sh
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -162,6 +162,19 @@ init_repos () {
git -C sparse-index sparse-checkout set deep
}
+init_repos_as_submodules () {
+ git reset --hard &&
+ init_repos &&
+ git submodule add ./full-checkout &&
+ git submodule add ./sparse-checkout &&
+ git submodule add ./sparse-index &&
+
+ git submodule status >actual &&
+ grep full-checkout actual &&
+ grep sparse-checkout actual &&
+ grep sparse-index actual
+}
+
run_on_sparse () {
(
cd sparse-checkout &&
@@ -1501,6 +1514,31 @@ test_expect_success 'sparse-index is not expanded: stash' '
ensure_not_expanded stash pop
'
+test_expect_success 'describe tested on all' '
+ init_repos &&
+
+ # Add tag to be read by describe
+
+ run_on_all git tag -a v1.0 -m "Version 1" &&
+ test_all_match git describe --dirty &&
+ run_on_all rm g &&
+ test_all_match git describe --dirty
+'
+
+
+test_expect_success 'sparse-index is not expanded: describe' '
+ init_repos &&
+
+ # Add tag to be read by describe
+
+ git -C sparse-index tag -a v1.0 -m "Version 1" &&
+
+ ensure_not_expanded describe --dirty &&
+ echo "test" >>sparse-index/g &&
+ ensure_not_expanded describe --dirty &&
+ ensure_not_expanded describe
+'
+
test_expect_success 'sparse index is not expanded: diff' '
init_repos &&
@@ -1983,4 +2021,91 @@ test_expect_success 'sparse index is not expanded: rm' '
ensure_not_expanded rm -r deep
'
+test_expect_success 'grep with and --cached' '
+ init_repos &&
+
+ test_all_match git grep --cached a &&
+ test_all_match git grep --cached a -- "folder1/*"
+'
+
+test_expect_success 'grep is not expanded' '
+ init_repos &&
+
+ ensure_not_expanded grep a &&
+ ensure_not_expanded grep a -- deep/* &&
+
+ # All files within the folder1/* pathspec are sparse,
+ # so this command does not find any matches
+ ensure_not_expanded ! grep a -- folder1/* &&
+
+ # test out-of-cone pathspec with or without wildcard
+ ensure_not_expanded grep --cached a -- "folder1/a" &&
+ ensure_not_expanded grep --cached a -- "folder1/*" &&
+
+ # test in-cone pathspec with or without wildcard
+ ensure_not_expanded grep --cached a -- "deep/a" &&
+ ensure_not_expanded grep --cached a -- "deep/*"
+'
+
+# NEEDSWORK: when running `grep` in the superproject with --recurse-submodules,
+# Git expands the index of the submodules unexpectedly. Even though `grep`
+# builtin is marked as "command_requires_full_index = 0", this config is only
+# useful for the superproject. Namely, the submodules have their own configs,
+# which are _not_ populated by the one-time sparse-index feature switch.
+test_expect_failure 'grep within submodules is not expanded' '
+ init_repos_as_submodules &&
+
+ # do not use ensure_not_expanded() here, becasue `grep` should be
+ # run in the superproject, not in "./sparse-index"
+ GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
+ git grep --cached --recurse-submodules a -- "*/folder1/*" &&
+ test_region ! index ensure_full_index trace2.txt
+'
+
+# NEEDSWORK: this test is not actually testing the code. The design purpose
+# of this test is to verify the grep result when the submodules are using a
+# sparse-index. Namely, we want "folder1/" as a tree (a sparse directory); but
+# because of the index expansion, we are now grepping the "folder1/a" blob.
+# Because of the problem stated above 'grep within submodules is not expanded',
+# we don't have the ideal test environment yet.
+test_expect_success 'grep sparse directory within submodules' '
+ init_repos_as_submodules &&
+
+ cat >expect <<-\EOF &&
+ full-checkout/folder1/a:a
+ sparse-checkout/folder1/a:a
+ sparse-index/folder1/a:a
+ EOF
+ git grep --cached --recurse-submodules a -- "*/folder1/*" >actual &&
+ test_cmp actual expect
+'
+
+test_expect_success 'write-tree on all' '
+ init_repos &&
+
+ write_script edit-contents <<-\EOF &&
+ echo text >>"$1"
+ EOF
+
+ run_on_all ../edit-contents deep/a &&
+ run_on_all git update-index deep/a &&
+ test_all_match git write-tree &&
+
+ run_on_all mkdir -p folder1 &&
+ run_on_all cp a folder1/a &&
+ run_on_all ../edit-contents folder1/a &&
+ run_on_all git update-index folder1/a &&
+ test_all_match git write-tree
+'
+
+test_expect_success 'sparse-index is not expanded: write-tree' '
+ init_repos &&
+
+ ensure_not_expanded write-tree &&
+
+ echo "test1" >>sparse-index/a &&
+ git -C sparse-index update-index a &&
+ ensure_not_expanded write-tree
+'
+
test_done
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index e8505bd39c..86bfbc2b36 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -98,6 +98,23 @@ test_expect_success 'subsections are not canonicalized by git-config' '
test_cmp_config two section.SubSection.key
'
+test_missing_key () {
+ local key="$1" &&
+ local title="$2" &&
+ test_expect_success "value for $title is not printed" '
+ test_must_fail git config "$key" >out 2>err &&
+ test_must_be_empty out &&
+ test_must_be_empty err
+ '
+}
+
+test_missing_key 'missingsection.missingkey' 'missing section and missing key'
+test_missing_key 'missingsection.penguin' 'missing section and existing key'
+test_missing_key 'section.missingkey' 'existing section and missing key'
+test_missing_key 'section.MissingSubSection.missingkey' 'missing subsection and missing key'
+test_missing_key 'section.SubSection.missingkey' 'existing subsection and missing key'
+test_missing_key 'section.MissingSubSection.key' 'missing subsection and existing key'
+
cat > .git/config <<\EOF
[alpha]
bar = foo
@@ -1488,35 +1505,29 @@ test_expect_success 'git config ignores pairs without count' '
test_must_be_empty error
'
-test_expect_success 'git config ignores pairs with zero count' '
- test_must_fail env \
- GIT_CONFIG_COUNT=0 \
- GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
- git config pair.one
-'
-
test_expect_success 'git config ignores pairs exceeding count' '
GIT_CONFIG_COUNT=1 \
GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
GIT_CONFIG_KEY_1="pair.two" GIT_CONFIG_VALUE_1="value" \
- git config --get-regexp "pair.*" >actual &&
+ git config --get-regexp "pair.*" >actual 2>error &&
cat >expect <<-EOF &&
pair.one value
EOF
- test_cmp expect actual
+ test_cmp expect actual &&
+ test_must_be_empty error
'
test_expect_success 'git config ignores pairs with zero count' '
test_must_fail env \
GIT_CONFIG_COUNT=0 GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
- git config pair.one >error &&
+ git config pair.one 2>error &&
test_must_be_empty error
'
test_expect_success 'git config ignores pairs with empty count' '
test_must_fail env \
GIT_CONFIG_COUNT= GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
- git config pair.one >error &&
+ git config pair.one 2>error &&
test_must_be_empty error
'
@@ -1601,11 +1612,11 @@ test_expect_success 'git config --edit respects core.editor' '
# malformed configuration files
test_expect_success 'barf on syntax error' '
cat >.git/config <<-\EOF &&
- # broken section line
+ # broken key=value
[section]
key garbage
EOF
- test_must_fail git config --get section.key >actual 2>error &&
+ test_must_fail git config --get section.key 2>error &&
test_i18ngrep " line 3 " error
'
@@ -1615,17 +1626,17 @@ test_expect_success 'barf on incomplete section header' '
[section
key = value
EOF
- test_must_fail git config --get section.key >actual 2>error &&
+ test_must_fail git config --get section.key 2>error &&
test_i18ngrep " line 2 " error
'
test_expect_success 'barf on incomplete string' '
cat >.git/config <<-\EOF &&
- # broken section line
+ # broken value string
[section]
key = "value string
EOF
- test_must_fail git config --get section.key >actual 2>error &&
+ test_must_fail git config --get section.key 2>error &&
test_i18ngrep " line 3 " error
'
@@ -2258,6 +2269,12 @@ test_expect_success '--type rejects unknown specifiers' '
test_i18ngrep "unrecognized --type argument" error
'
+test_expect_success '--type=int requires at least one digit' '
+ test_must_fail git config --type int --default m some.key >out 2>error &&
+ grep "bad numeric config value" error &&
+ test_must_be_empty out
+'
+
test_expect_success '--replace-all does not invent newlines' '
q_to_tab >.git/config <<-\EOF &&
[abc]key
diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh
index 93a2f91f8a..1b6437ec07 100755
--- a/t/t1301-shared-repo.sh
+++ b/t/t1301-shared-repo.sh
@@ -8,6 +8,8 @@ test_description='Test shared repository initialization'
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.
@@ -25,6 +27,7 @@ test_expect_success 'shared = 0400 (faulty permission u-w)' '
for u in 002 022
do
test_expect_success POSIXPERM "shared=1 does not clear bits preset by umask $u" '
+ test_when_finished "rm -rf sub" &&
mkdir sub && (
cd sub &&
umask $u &&
@@ -42,12 +45,9 @@ do
;;
esac
'
- rm -rf sub
done
test_expect_success 'shared=all' '
- mkdir sub &&
- cd sub &&
git init --template= --shared=all &&
test 2 = $(git config core.sharedrepository)
'
@@ -132,6 +132,7 @@ test_expect_success POSIXPERM 'git reflog expire honors core.sharedRepository' '
'
test_expect_success POSIXPERM 'forced modes' '
+ test_when_finished "rm -rf new" &&
mkdir -p templates/hooks &&
echo update-server-info >templates/hooks/post-update &&
chmod +x templates/hooks/post-update &&
@@ -140,7 +141,8 @@ test_expect_success POSIXPERM 'forced modes' '
(
cd new &&
umask 002 &&
- git init --shared=0660 --template=templates &&
+ git init --shared=0660 --template=../templates &&
+ test_path_is_file .git/hooks/post-update &&
>frotz &&
git add frotz &&
git commit -a -m initial &&
@@ -173,6 +175,7 @@ test_expect_success POSIXPERM 'forced modes' '
'
test_expect_success POSIXPERM 'remote init does not use config from cwd' '
+ test_when_finished "rm -rf child.git" &&
git config core.sharedrepository 0666 &&
umask 0022 &&
git init --bare child.git &&
@@ -192,7 +195,7 @@ test_expect_success POSIXPERM 're-init respects core.sharedrepository (local)' '
'
test_expect_success POSIXPERM 're-init respects core.sharedrepository (remote)' '
- rm -rf child.git &&
+ test_when_finished "rm -rf child.git" &&
umask 0022 &&
git init --bare --shared=0666 child.git &&
test_path_is_missing child.git/foo &&
@@ -203,7 +206,7 @@ test_expect_success POSIXPERM 're-init respects core.sharedrepository (remote)'
'
test_expect_success POSIXPERM 'template can set core.sharedrepository' '
- rm -rf child.git &&
+ test_when_finished "rm -rf child.git" &&
umask 0022 &&
git config core.sharedrepository 0666 &&
cp .git/config templates/config &&
diff --git a/t/t1302-repo-version.sh b/t/t1302-repo-version.sh
index 0acabb6d11..179474fa65 100755
--- a/t/t1302-repo-version.sh
+++ b/t/t1302-repo-version.sh
@@ -5,6 +5,7 @@
test_description='Test repository version check'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
@@ -27,7 +28,7 @@ test_expect_success 'setup' '
'
test_expect_success 'gitdir selection on normal repos' '
- echo $(test_oid version) >expect &&
+ test_oid version >expect &&
git config core.repositoryformatversion >actual &&
git -C test config core.repositoryformatversion >actual2 &&
test_cmp expect actual &&
@@ -36,7 +37,7 @@ test_expect_success 'gitdir selection on normal repos' '
test_expect_success 'gitdir selection on unsupported repo' '
# Make sure it would stop at test2, not trash
- test_expect_code 1 git -C test2 config core.repositoryformatversion >actual
+ test_expect_code 1 git -C test2 config core.repositoryformatversion
'
test_expect_success 'gitdir not required mode' '
diff --git a/t/t1304-default-acl.sh b/t/t1304-default-acl.sh
index 335d3f3211..31b89dd969 100755
--- a/t/t1304-default-acl.sh
+++ b/t/t1304-default-acl.sh
@@ -9,6 +9,7 @@ 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
@@ -18,7 +19,7 @@ test_expect_success 'checking for a working acl setup' '
if setfacl -m d:m:rwx -m u:root:rwx . &&
getfacl . | grep user:root:rwx &&
touch should-have-readable-acl &&
- getfacl should-have-readable-acl | egrep "mask::?rw-"
+ getfacl should-have-readable-acl | grep -E "mask::?rw-"
then
test_set_prereq SETFACL
fi
@@ -34,7 +35,7 @@ check_perms_and_acl () {
getfacl "$1" > actual &&
grep -q "user:root:rwx" actual &&
grep -q "user:${LOGNAME}:rwx" actual &&
- egrep "mask::?r--" actual > /dev/null 2>&1 &&
+ grep -E "mask::?r--" actual > /dev/null 2>&1 &&
grep -q "group::---" actual || false
}
diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh
index b38e158d3b..777648722c 100755
--- a/t/t1308-config-set.sh
+++ b/t/t1308-config-set.sh
@@ -58,6 +58,8 @@ test_expect_success 'setup default config' '
skin = false
nose = 1
horns
+ [value]
+ less
EOF
'
@@ -116,10 +118,53 @@ test_expect_success 'find value with the highest priority' '
check_config get_value case.baz "hask"
'
+test_expect_success 'return value for an existing key' '
+ test-tool config get lamb.chop >out 2>err &&
+ test_must_be_empty out &&
+ test_must_be_empty err
+'
+
+test_expect_success 'return value for value-less key' '
+ test-tool config get value.less >out 2>err &&
+ test_must_be_empty out &&
+ test_must_be_empty err
+'
+
+test_expect_success 'return value for a missing key' '
+ cat >expect <<-\EOF &&
+ Value not found for "missing.key"
+ EOF
+ test_expect_code 1 test-tool config get missing.key >actual 2>err &&
+ test_cmp actual expect &&
+ test_must_be_empty err
+'
+
+test_expect_success 'return value for a bad key: CONFIG_INVALID_KEY' '
+ cat >expect <<-\EOF &&
+ Key "fails.iskeychar.-" is invalid
+ EOF
+ test_expect_code 1 test-tool config get fails.iskeychar.- >actual 2>err &&
+ test_cmp actual expect &&
+ test_must_be_empty out
+'
+
+test_expect_success 'return value for a bad key: CONFIG_NO_SECTION_OR_NAME' '
+ cat >expect <<-\EOF &&
+ Key "keynosection" has no section
+ EOF
+ test_expect_code 1 test-tool config get keynosection >actual 2>err &&
+ test_cmp actual expect &&
+ test_must_be_empty out
+'
+
test_expect_success 'find integer value for a key' '
check_config get_int lamb.chop 65
'
+test_expect_success 'parse integer value during iteration' '
+ check_config git_config_int lamb.chop 65
+'
+
test_expect_success 'find string value for a key' '
check_config get_string case.baz hask &&
check_config expect_code 1 get_string case.ba "Value not found for \"case.ba\""
@@ -134,6 +179,11 @@ test_expect_success 'find integer if value is non parse-able' '
check_config expect_code 128 get_int lamb.head
'
+test_expect_success 'non parse-able integer value during iteration' '
+ check_config expect_code 128 git_config_int lamb.head 2>result &&
+ grep "fatal: bad numeric config value .* in file \.git/config" result
+'
+
test_expect_success 'find bool value for the entered key' '
check_config get_bool goat.head 1 &&
check_config get_bool goat.skin 0 &&
@@ -146,6 +196,71 @@ test_expect_success 'find multiple values' '
check_config get_value_multi case.baz sam bat hask
'
+test_NULL_in_multi () {
+ local op="$1" &&
+ local file="$2" &&
+
+ test_expect_success "$op: NULL value in config${file:+ in $file}" '
+ config="$file" &&
+ if test -z "$config"
+ then
+ config=.git/config &&
+ test_when_finished "mv $config.old $config" &&
+ mv "$config" "$config".old
+ fi &&
+
+ # Value-less in the middle of a list
+ cat >"$config" <<-\EOF &&
+ [a]key=x
+ [a]key
+ [a]key=y
+ EOF
+ case "$op" in
+ *_multi)
+ cat >expect <<-\EOF
+ x
+ (NULL)
+ y
+ EOF
+ ;;
+ *)
+ cat >expect <<-\EOF
+ y
+ EOF
+ ;;
+ esac &&
+ test-tool config "$op" a.key $file >actual &&
+ test_cmp expect actual &&
+
+ # Value-less at the end of a least
+ cat >"$config" <<-\EOF &&
+ [a]key=x
+ [a]key=y
+ [a]key
+ EOF
+ case "$op" in
+ *_multi)
+ cat >expect <<-\EOF
+ x
+ y
+ (NULL)
+ EOF
+ ;;
+ *)
+ cat >expect <<-\EOF
+ (NULL)
+ EOF
+ ;;
+ esac &&
+ test-tool config "$op" a.key $file >actual &&
+ test_cmp expect actual
+ '
+}
+
+test_NULL_in_multi "get_value_multi"
+test_NULL_in_multi "configset_get_value" "my.config"
+test_NULL_in_multi "configset_get_value_multi" "my.config"
+
test_expect_success 'find value from a configset' '
cat >config2 <<-\EOF &&
[case]
@@ -207,7 +322,7 @@ test_expect_success 'proper error on error in default config files' '
cp .git/config .git/config.old &&
test_when_finished "mv .git/config.old .git/config" &&
echo "[" >>.git/config &&
- echo "fatal: bad config line 34 in file .git/config" >expect &&
+ echo "fatal: bad config line 36 in file .git/config" >expect &&
test_expect_code 128 test-tool config get_value foo.bar 2>actual &&
test_cmp expect actual
'
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index cf58cf025c..4d66cd7f4a 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -1568,6 +1568,7 @@ test_expect_success 'transaction can create and delete' '
EOF
git update-ref --stdin <stdin >actual &&
printf "%s: ok\n" start commit start commit >expect &&
+ test_cmp expect actual &&
test_must_fail git show-ref --verify refs/heads/create-and-delete
'
@@ -1595,6 +1596,8 @@ test_expect_success 'transaction cannot restart ongoing transaction' '
commit
EOF
test_must_fail git update-ref --stdin <stdin >actual &&
+ printf "%s: ok\n" start >expect &&
+ test_cmp expect actual &&
test_must_fail git show-ref --verify refs/heads/restart
'
diff --git a/t/t1401-symbolic-ref.sh b/t/t1401-symbolic-ref.sh
index 0c204089b8..c7745e1bf6 100755
--- a/t/t1401-symbolic-ref.sh
+++ b/t/t1401-symbolic-ref.sh
@@ -33,7 +33,8 @@ test_expect_success 'symbolic-ref refuses non-ref for HEAD' '
reset_to_sane
test_expect_success 'symbolic-ref refuses bare sha1' '
- test_must_fail git symbolic-ref HEAD $(git rev-parse HEAD)
+ rev=$(git rev-parse HEAD) &&
+ test_must_fail git symbolic-ref HEAD "$rev"
'
reset_to_sane
@@ -175,4 +176,52 @@ test_expect_success 'symbolic-ref allows top-level target for non-HEAD' '
test_cmp_rev top-level HEAD
'
+test_expect_success 'symbolic-ref pointing at another' '
+ git update-ref refs/heads/maint-2.37 HEAD &&
+ git symbolic-ref refs/heads/maint refs/heads/maint-2.37 &&
+ git checkout maint &&
+
+ git symbolic-ref HEAD >actual &&
+ echo refs/heads/maint-2.37 >expect &&
+ test_cmp expect actual &&
+
+ git symbolic-ref --no-recurse HEAD >actual &&
+ echo refs/heads/maint >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'symbolic-ref --short handles complex utf8 case' '
+ name="测试-加-增加-加-增加" &&
+ git symbolic-ref TEST_SYMREF "refs/heads/$name" &&
+ # In the real world, we saw problems with this case only
+ # when the locale includes UTF-8. Set it here to try to make things as
+ # hard as possible for us to pass, but in practice we should do the
+ # right thing regardless (and of course some platforms may not even
+ # have this locale).
+ LC_ALL=en_US.UTF-8 git symbolic-ref --short TEST_SYMREF >actual &&
+ echo "$name" >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'symbolic-ref --short handles name with suffix' '
+ git symbolic-ref TEST_SYMREF "refs/remotes/origin/HEAD" &&
+ git symbolic-ref --short TEST_SYMREF >actual &&
+ echo "origin" >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'symbolic-ref --short handles almost-matching name' '
+ git symbolic-ref TEST_SYMREF "refs/headsXfoo" &&
+ git symbolic-ref --short TEST_SYMREF >actual &&
+ echo "headsXfoo" >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'symbolic-ref --short handles name with percent' '
+ git symbolic-ref TEST_SYMREF "refs/heads/%foo" &&
+ git symbolic-ref --short TEST_SYMREF >actual &&
+ echo "%foo" >expect &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh
index 13c2b43bba..937ae0d733 100755
--- a/t/t1404-update-ref-errors.sh
+++ b/t/t1404-update-ref-errors.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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
@@ -549,7 +551,6 @@ test_expect_success REFFILES 'no bogus intermediate values during delete' '
git update-ref $prefix/foo $C &&
git pack-refs --all &&
git update-ref $prefix/foo $D &&
- git for-each-ref $prefix >unchanged &&
# Now try to update the reference, but hold the `packed-refs` lock
# for a while to see what happens while the process is blocked:
: >.git/packed-refs.lock &&
diff --git a/t/t1408-packed-refs.sh b/t/t1408-packed-refs.sh
index 41ba1f1d7f..9469c79a58 100755
--- a/t/t1408-packed-refs.sh
+++ b/t/t1408-packed-refs.sh
@@ -5,6 +5,7 @@ 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 be12fb6350..f23c0152a8 100755
--- a/t/t1409-avoid-packing-refs.sh
+++ b/t/t1409-avoid-packing-refs.sh
@@ -2,6 +2,7 @@
test_description='avoid rewriting packed-refs unnecessarily'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Add an identifying mark to the packed-refs file header line. This
diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh
index aa59954f6c..6c45965b1e 100755
--- a/t/t1410-reflog.sh
+++ b/t/t1410-reflog.sh
@@ -7,6 +7,7 @@ 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/t1413-reflog-detach.sh b/t/t1413-reflog-detach.sh
index 934688a1ee..d2a4822d46 100755
--- a/t/t1413-reflog-detach.sh
+++ b/t/t1413-reflog-detach.sh
@@ -4,6 +4,7 @@ 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/t1416-ref-transaction-hooks.sh b/t/t1416-ref-transaction-hooks.sh
index 27731722a5..b32ca798f9 100755
--- a/t/t1416-ref-transaction-hooks.sh
+++ b/t/t1416-ref-transaction-hooks.sh
@@ -5,6 +5,7 @@ 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/t1450-fsck.sh b/t/t1450-fsck.sh
index de0f6d5e7f..8c442adb1a 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -212,7 +212,7 @@ test_expect_success 'email without @ is okay' '
test_expect_success 'email with embedded > is not okay' '
git cat-file commit HEAD >basis &&
sed "s/@[a-z]/&>/" basis >bad-email &&
- new=$(git hash-object -t commit -w --stdin <bad-email) &&
+ new=$(git hash-object --literally -t commit -w --stdin <bad-email) &&
test_when_finished "remove_object $new" &&
git update-ref refs/heads/bogus "$new" &&
test_when_finished "git update-ref -d refs/heads/bogus" &&
@@ -223,7 +223,7 @@ test_expect_success 'email with embedded > is not okay' '
test_expect_success 'missing < email delimiter is reported nicely' '
git cat-file commit HEAD >basis &&
sed "s/<//" basis >bad-email-2 &&
- new=$(git hash-object -t commit -w --stdin <bad-email-2) &&
+ new=$(git hash-object --literally -t commit -w --stdin <bad-email-2) &&
test_when_finished "remove_object $new" &&
git update-ref refs/heads/bogus "$new" &&
test_when_finished "git update-ref -d refs/heads/bogus" &&
@@ -234,7 +234,7 @@ test_expect_success 'missing < email delimiter is reported nicely' '
test_expect_success 'missing email is reported nicely' '
git cat-file commit HEAD >basis &&
sed "s/[a-z]* <[^>]*>//" basis >bad-email-3 &&
- new=$(git hash-object -t commit -w --stdin <bad-email-3) &&
+ new=$(git hash-object --literally -t commit -w --stdin <bad-email-3) &&
test_when_finished "remove_object $new" &&
git update-ref refs/heads/bogus "$new" &&
test_when_finished "git update-ref -d refs/heads/bogus" &&
@@ -245,7 +245,7 @@ test_expect_success 'missing email is reported nicely' '
test_expect_success '> in name is reported' '
git cat-file commit HEAD >basis &&
sed "s/ </> </" basis >bad-email-4 &&
- new=$(git hash-object -t commit -w --stdin <bad-email-4) &&
+ new=$(git hash-object --literally -t commit -w --stdin <bad-email-4) &&
test_when_finished "remove_object $new" &&
git update-ref refs/heads/bogus "$new" &&
test_when_finished "git update-ref -d refs/heads/bogus" &&
@@ -258,7 +258,7 @@ test_expect_success 'integer overflow in timestamps is reported' '
git cat-file commit HEAD >basis &&
sed "s/^\\(author .*>\\) [0-9]*/\\1 18446744073709551617/" \
<basis >bad-timestamp &&
- new=$(git hash-object -t commit -w --stdin <bad-timestamp) &&
+ new=$(git hash-object --literally -t commit -w --stdin <bad-timestamp) &&
test_when_finished "remove_object $new" &&
git update-ref refs/heads/bogus "$new" &&
test_when_finished "git update-ref -d refs/heads/bogus" &&
@@ -269,7 +269,7 @@ test_expect_success 'integer overflow in timestamps is reported' '
test_expect_success 'commit with NUL in header' '
git cat-file commit HEAD >basis &&
sed "s/author ./author Q/" <basis | q_to_nul >commit-NUL-header &&
- new=$(git hash-object -t commit -w --stdin <commit-NUL-header) &&
+ new=$(git hash-object --literally -t commit -w --stdin <commit-NUL-header) &&
test_when_finished "remove_object $new" &&
git update-ref refs/heads/bogus "$new" &&
test_when_finished "git update-ref -d refs/heads/bogus" &&
@@ -292,7 +292,7 @@ test_expect_success 'tree object with duplicate entries' '
git cat-file tree $T &&
git cat-file tree $T
) |
- git hash-object -w -t tree --stdin
+ git hash-object --literally -w -t tree --stdin
) &&
test_must_fail git fsck 2>out &&
test_i18ngrep "error in tree .*contains duplicate file entries" out
@@ -426,7 +426,7 @@ test_expect_success 'tag with incorrect tag name & missing tagger' '
This is an invalid tag.
EOF
- tag=$(git hash-object -t tag -w --stdin <wrong-tag) &&
+ tag=$(git hash-object --literally -t tag -w --stdin <wrong-tag) &&
test_when_finished "remove_object $tag" &&
echo $tag >.git/refs/tags/wrong &&
test_when_finished "git update-ref -d refs/tags/wrong" &&
@@ -558,7 +558,7 @@ test_expect_success 'rev-list --verify-objects with commit graph (parent)' '
test_expect_success 'force fsck to ignore double author' '
git cat-file commit HEAD >basis &&
sed "s/^author .*/&,&/" <basis | tr , \\n >multiple-authors &&
- new=$(git hash-object -t commit -w --stdin <multiple-authors) &&
+ new=$(git hash-object --literally -t commit -w --stdin <multiple-authors) &&
test_when_finished "remove_object $new" &&
git update-ref refs/heads/bogus "$new" &&
test_when_finished "git update-ref -d refs/heads/bogus" &&
@@ -573,7 +573,7 @@ test_expect_success 'fsck notices blob entry pointing to null sha1' '
(git init null-blob &&
cd null-blob &&
sha=$(printf "100644 file$_bz$_bzoid" |
- git hash-object -w --stdin -t tree) &&
+ git hash-object --literally -w --stdin -t tree) &&
git fsck 2>out &&
test_i18ngrep "warning.*null sha1" out
)
@@ -583,7 +583,7 @@ test_expect_success 'fsck notices submodule entry pointing to null sha1' '
(git init null-commit &&
cd null-commit &&
sha=$(printf "160000 submodule$_bz$_bzoid" |
- git hash-object -w --stdin -t tree) &&
+ git hash-object --literally -w --stdin -t tree) &&
git fsck 2>out &&
test_i18ngrep "warning.*null sha1" out
)
@@ -648,7 +648,7 @@ test_expect_success 'NUL in commit' '
git commit --allow-empty -m "initial commitQNUL after message" &&
git cat-file commit HEAD >original &&
q_to_nul <original >munged &&
- git hash-object -w -t commit --stdin <munged >name &&
+ git hash-object --literally -w -t commit --stdin <munged >name &&
git branch bad $(cat name) &&
test_must_fail git -c fsck.nulInCommit=error fsck 2>warn.1 &&
@@ -794,8 +794,8 @@ test_expect_success 'fsck errors in packed objects' '
git cat-file commit HEAD >basis &&
sed "s/</one/" basis >one &&
sed "s/</foo/" basis >two &&
- one=$(git hash-object -t commit -w one) &&
- two=$(git hash-object -t commit -w two) &&
+ one=$(git hash-object --literally -t commit -w one) &&
+ two=$(git hash-object --literally -t commit -w two) &&
pack=$(
{
echo $one &&
@@ -989,10 +989,7 @@ test_expect_success 'fsck error and recovery on invalid object type' '
garbage_blob=$(git hash-object --stdin -w -t garbage --literally </dev/null) &&
- cat >err.expect <<-\EOF &&
- fatal: invalid object type
- EOF
- test_must_fail git fsck >out 2>err &&
+ test_must_fail git fsck 2>err &&
grep -e "^error" -e "^fatal" err >errors &&
test_line_count = 1 errors &&
grep "$garbage_blob: object is of unknown type '"'"'garbage'"'"':" err
@@ -1023,4 +1020,34 @@ test_expect_success 'fsck error on gitattributes with excessive size' '
test_cmp expected actual
'
+test_expect_success 'fsck detects problems in worktree index' '
+ test_when_finished "git worktree remove -f wt" &&
+ git worktree add wt &&
+
+ echo "this will be removed to break the worktree index" >wt/file &&
+ git -C wt add file &&
+ blob=$(git -C wt rev-parse :file) &&
+ remove_object $blob &&
+
+ test_must_fail git fsck --name-objects >actual 2>&1 &&
+ cat >expect <<-EOF &&
+ missing blob $blob (.git/worktrees/wt/index:file)
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'fsck reports problems in main index without filename' '
+ test_when_finished "rm -f .git/index && git read-tree HEAD" &&
+ echo "this object will be removed to break the main index" >file &&
+ git add file &&
+ blob=$(git rev-parse :file) &&
+ remove_object $blob &&
+
+ test_must_fail git fsck --name-objects >actual 2>&1 &&
+ cat >expect <<-EOF &&
+ missing blob $blob (:file)
+ EOF
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t1451-fsck-buffer.sh b/t/t1451-fsck-buffer.sh
new file mode 100755
index 0000000000..3413da40e4
--- /dev/null
+++ b/t/t1451-fsck-buffer.sh
@@ -0,0 +1,142 @@
+#!/bin/sh
+
+test_description='fsck on buffers without NUL termination
+
+The goal here is to make sure that the various fsck parsers never look
+past the end of the buffer they are given, even when encountering broken
+or truncated objects.
+
+We have to use "hash-object" for this because most code paths that read objects
+append an extra NUL for safety after the buffer. But hash-object, since it is
+reading straight from a file (and possibly even mmap-ing it) cannot always do
+so.
+
+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
+# progressively, and then test new truncations on top of it.
+reset () {
+ test_expect_success 'reset input to empty' '
+ >base
+ '
+}
+
+add () {
+ content="$1"
+ type=${content%% *}
+ test_expect_success "add $type line" '
+ echo "$content" >>base
+ '
+}
+
+check () {
+ type=$1
+ fsck=$2
+ content=$3
+ test_expect_success "truncated $type ($fsck, \"$content\")" '
+ # do not pipe into hash-object here; we want to increase
+ # the chance that it uses a fixed-size buffer or mmap,
+ # and a pipe would be read into a strbuf.
+ {
+ cat base &&
+ echo "$content"
+ } >input &&
+ test_must_fail git hash-object -t "$type" input 2>err &&
+ grep "$fsck" err
+ '
+}
+
+test_expect_success 'create valid objects' '
+ git commit --allow-empty -m foo &&
+ commit=$(git rev-parse --verify HEAD) &&
+ tree=$(git rev-parse --verify HEAD^{tree})
+'
+
+reset
+check commit missingTree ""
+check commit missingTree "tr"
+check commit missingTree "tree"
+check commit badTreeSha1 "tree "
+check commit badTreeSha1 "tree 1234"
+add "tree $tree"
+
+# these expect missingAuthor because "parent" is optional
+check commit missingAuthor ""
+check commit missingAuthor "par"
+check commit missingAuthor "parent"
+check commit badParentSha1 "parent "
+check commit badParentSha1 "parent 1234"
+add "parent $commit"
+
+check commit missingAuthor ""
+check commit missingAuthor "au"
+check commit missingAuthor "author"
+ident_checks () {
+ check $1 missingEmail "$2 "
+ check $1 missingEmail "$2 name"
+ check $1 badEmail "$2 name <"
+ check $1 badEmail "$2 name <email"
+ check $1 missingSpaceBeforeDate "$2 name <email>"
+ check $1 badDate "$2 name <email> "
+ check $1 badDate "$2 name <email> 1234"
+ check $1 badTimezone "$2 name <email> 1234 "
+ check $1 badTimezone "$2 name <email> 1234 +"
+}
+ident_checks commit author
+add "author name <email> 1234 +0000"
+
+check commit missingCommitter ""
+check commit missingCommitter "co"
+check commit missingCommitter "committer"
+ident_checks commit committer
+add "committer name <email> 1234 +0000"
+
+reset
+check tag missingObject ""
+check tag missingObject "obj"
+check tag missingObject "object"
+check tag badObjectSha1 "object "
+check tag badObjectSha1 "object 1234"
+add "object $commit"
+
+check tag missingType ""
+check tag missingType "ty"
+check tag missingType "type"
+check tag badType "type "
+check tag badType "type com"
+add "type commit"
+
+check tag missingTagEntry ""
+check tag missingTagEntry "ta"
+check tag missingTagEntry "tag"
+check tag badTagName "tag "
+add "tag foo"
+
+check tag missingTagger ""
+check tag missingTagger "ta"
+check tag missingTagger "tagger"
+ident_checks tag tagger
+
+# trees are a binary format and can't use our earlier helpers
+test_expect_success 'truncated tree (short hash)' '
+ printf "100644 foo\0\1\1\1\1" >input &&
+ test_must_fail git hash-object -t tree input 2>err &&
+ grep badTree err
+'
+
+test_expect_success 'truncated tree (missing nul)' '
+ # these two things are indistinguishable to the parser. The important
+ # thing about this is example is that there are enough bytes to
+ # make up a hash, and that there is no NUL (and we confirm that the
+ # parser does not walk past the end of the buffer).
+ printf "100644 a long filename, or a hash with missing nul?" >input &&
+ test_must_fail git hash-object -t tree input 2>err &&
+ grep badTree err
+'
+
+test_done
diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
index 81de584ea2..37ee5091b5 100755
--- a/t/t1500-rev-parse.sh
+++ b/t/t1500-rev-parse.sh
@@ -195,7 +195,7 @@ test_expect_success 'rev-parse --is-shallow-repository in non-shallow repo' '
'
test_expect_success 'rev-parse --show-object-format in repo' '
- echo "$(test_oid algo)" >expect &&
+ test_oid algo >expect &&
git rev-parse --show-object-format >actual &&
test_cmp expect actual &&
git rev-parse --show-object-format=storage >actual &&
diff --git a/t/t1501-work-tree.sh b/t/t1501-work-tree.sh
index b75558040f..ae6528aece 100755
--- a/t/t1501-work-tree.sh
+++ b/t/t1501-work-tree.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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 de1d48f3ba..dd811b7fb4 100755
--- a/t/t1502-rev-parse-parseopt.sh
+++ b/t/t1502-rev-parse-parseopt.sh
@@ -302,14 +302,14 @@ test_expect_success 'test --parseopt help output: "wrapped" options normal "or:"
|EOF
END_EXPECT
- test_must_fail git rev-parse --parseopt -- -h >out <spec >actual &&
+ test_must_fail git rev-parse --parseopt -- -h <spec >actual &&
test_cmp expect actual
'
test_expect_success 'test --parseopt invalid opt-spec' '
test_write_lines x -- "=, x" >spec &&
echo "fatal: missing opt-spec before option flags" >expect &&
- test_must_fail git rev-parse --parseopt -- >out <spec 2>err &&
+ test_must_fail git rev-parse --parseopt -- <spec 2>err &&
test_cmp expect err
'
@@ -339,7 +339,7 @@ test_expect_success 'test --parseopt help output: multi-line blurb after empty l
|EOF
END_EXPECT
- test_must_fail git rev-parse --parseopt -- -h >out <spec >actual &&
+ test_must_fail git rev-parse --parseopt -- -h <spec >actual &&
test_cmp expect actual
'
diff --git a/t/t1504-ceiling-dirs.sh b/t/t1504-ceiling-dirs.sh
index 0fafcf9dde..c1679e31d8 100755
--- a/t/t1504-ceiling-dirs.sh
+++ b/t/t1504-ceiling-dirs.sh
@@ -6,8 +6,12 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_prefix() {
- test_expect_success "$1" \
- "test '$2' = \"\$(git rev-parse --show-prefix)\""
+ local expect="$2" &&
+ test_expect_success "$1: git rev-parse --show-prefix is '$2'" '
+ echo "$expect" >expect &&
+ git rev-parse --show-prefix >actual &&
+ test_cmp expect actual
+ '
}
test_fail() {
diff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh
index c34714ffe3..d94c72c672 100755
--- a/t/t1507-rev-parse-upstream.sh
+++ b/t/t1507-rev-parse-upstream.sh
@@ -183,6 +183,11 @@ test_expect_success '@{u} error message when no upstream' '
test_cmp expect actual
'
+test_expect_success '@{u} silent error when no upstream' '
+ test_must_fail git rev-parse --verify --quiet @{u} 2>actual &&
+ test_must_be_empty actual
+'
+
test_expect_success 'branch@{u} error message with misspelt branch' '
cat >expect <<-EOF &&
fatal: no such branch: ${SQ}no-such-branch${SQ}
@@ -258,7 +263,8 @@ test_expect_success '@{reflog}-parsing does not look beyond colon' '
git add @{yesterday} &&
git commit -m "funny reflog file" &&
git hash-object @{yesterday} >expect &&
- git rev-parse HEAD:@{yesterday} >actual
+ git rev-parse HEAD:@{yesterday} >actual &&
+ test_cmp expect actual
'
test_expect_success '@{upstream}-parsing does not look beyond colon' '
@@ -266,7 +272,8 @@ test_expect_success '@{upstream}-parsing does not look beyond colon' '
git add @{upstream} &&
git commit -m "funny upstream file" &&
git hash-object @{upstream} >expect &&
- git rev-parse HEAD:@{upstream} >actual
+ git rev-parse HEAD:@{upstream} >actual &&
+ test_cmp expect actual
'
test_done
diff --git a/t/t1509-root-work-tree.sh b/t/t1509-root-work-tree.sh
index 553a3f601b..c799f5b6ac 100755
--- a/t/t1509-root-work-tree.sh
+++ b/t/t1509-root-work-tree.sh
@@ -221,7 +221,8 @@ test_expect_success 'setup' '
rm -rf /.git &&
echo "Initialized empty Git repository in /.git/" > expected &&
git init > result &&
- test_cmp expected result
+ test_cmp expected result &&
+ git config --global --add safe.directory /
'
test_vars 'auto gitdir, root' ".git" "/" ""
@@ -242,7 +243,7 @@ say "auto bare gitdir"
# DESTROYYYYY!!!!!
test_expect_success 'setup' '
rm -rf /refs /objects /info /hooks &&
- rm -f /expected /ls.expected /me /result &&
+ rm -f /HEAD /expected /ls.expected /me /result &&
cd / &&
echo "Initialized empty Git repository in /" > expected &&
git init --bare > result &&
@@ -255,4 +256,9 @@ test_expect_success 'go to /foo' 'cd /foo'
test_vars 'auto gitdir, root' "/" "" ""
+test_expect_success 'cleanup root' '
+ rm -rf /.git /refs /objects /info /hooks /branches /foo &&
+ rm -f /HEAD /config /description /expected /ls.expected /me /result
+'
+
test_done
diff --git a/t/t1600-index.sh b/t/t1600-index.sh
index 010989f90e..9368d82f7d 100755
--- a/t/t1600-index.sh
+++ b/t/t1600-index.sh
@@ -65,6 +65,37 @@ test_expect_success 'out of bounds index.version issues warning' '
)
'
+test_expect_success 'index.skipHash config option' '
+ rm -f .git/index &&
+ git -c index.skipHash=true add a &&
+ test_trailing_hash .git/index >hash &&
+ echo $(test_oid zero) >expect &&
+ test_cmp expect hash &&
+ git fsck &&
+
+ rm -f .git/index &&
+ git -c feature.manyFiles=true add a &&
+ test_trailing_hash .git/index >hash &&
+ cmp expect hash &&
+
+ rm -f .git/index &&
+ git -c feature.manyFiles=true \
+ -c index.skipHash=false add a &&
+ test_trailing_hash .git/index >hash &&
+ ! cmp expect hash &&
+
+ test_commit start &&
+ git -c protocol.file.allow=always submodule add ./ sub &&
+ git config index.skipHash false &&
+ git -C sub config index.skipHash true &&
+ rm -f .git/modules/sub/index &&
+ >sub/file &&
+ git -C sub add a &&
+ test_trailing_hash .git/modules/sub/index >hash &&
+ test_cmp expect hash &&
+ git -C sub fsck
+'
+
test_index_version () {
INDEX_VERSION_CONFIG=$1 &&
FEATURE_MANY_FILES=$2 &&
diff --git a/t/t1800-hook.sh b/t/t1800-hook.sh
index 43fcb7c0bf..3506f627b6 100755
--- a/t/t1800-hook.sh
+++ b/t/t1800-hook.sh
@@ -95,7 +95,7 @@ test_expect_success 'git hook run -- out-of-repo runs excluded' '
test_expect_success 'git -c core.hooksPath=<PATH> hook run' '
mkdir my-hooks &&
write_script my-hooks/test-hook <<-\EOF &&
- echo Hook ran $1 >>actual
+ echo Hook ran $1
EOF
cat >expect <<-\EOF &&
@@ -177,4 +177,22 @@ test_expect_success 'git hook run a hook with a bad shebang' '
test_cmp expect actual
'
+test_expect_success 'stdin to hooks' '
+ write_script .git/hooks/test-hook <<-\EOF &&
+ echo BEGIN stdin
+ cat
+ echo END stdin
+ EOF
+
+ cat >expect <<-EOF &&
+ BEGIN stdin
+ hello
+ END stdin
+ EOF
+
+ echo hello >input &&
+ git hook run --to-stdin=input test-hook 2>actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t2005-checkout-index-symlinks.sh b/t/t2005-checkout-index-symlinks.sh
index 112682a45a..67d18cfa10 100755
--- a/t/t2005-checkout-index-symlinks.sh
+++ b/t/t2005-checkout-index-symlinks.sh
@@ -22,8 +22,10 @@ test_expect_success \
git checkout-index symlink &&
test -f symlink'
-test_expect_success \
-'the file must be the blob we added during the setup' '
-test "$(git hash-object -t blob symlink)" = $l'
+test_expect_success 'the file must be the blob we added during the setup' '
+ echo "$l" >expect &&
+ git hash-object -t blob symlink >actual &&
+ test_cmp expect actual
+'
test_done
diff --git a/t/t2012-checkout-last.sh b/t/t2012-checkout-last.sh
index 1f6c4ed042..4b6372f4c3 100755
--- a/t/t2012-checkout-last.sh
+++ b/t/t2012-checkout-last.sh
@@ -5,6 +5,7 @@ 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/t2015-checkout-unborn.sh b/t/t2015-checkout-unborn.sh
index 9425aae639..fb0e13881c 100755
--- a/t/t2015-checkout-unborn.sh
+++ b/t/t2015-checkout-unborn.sh
@@ -9,11 +9,12 @@ TEST_PASSES_SANITIZE_LEAK=true
test_expect_success 'setup' '
mkdir parent &&
- (cd parent &&
- git init &&
- echo content >file &&
- git add file &&
- git commit -m base
+ (
+ cd parent &&
+ git init &&
+ echo content >file &&
+ git add file &&
+ git commit -m base
) &&
git fetch parent main:origin
'
diff --git a/t/t2016-checkout-patch.sh b/t/t2016-checkout-patch.sh
index a5822e41af..747eb5563e 100755
--- a/t/t2016-checkout-patch.sh
+++ b/t/t2016-checkout-patch.sh
@@ -4,12 +4,6 @@ test_description='git checkout --patch'
. ./lib-patch-mode.sh
-if ! test_have_prereq ADD_I_USE_BUILTIN && ! test_have_prereq PERL
-then
- skip_all='skipping interactive add tests, PERL not set'
- test_done
-fi
-
test_expect_success 'setup' '
mkdir dir &&
echo parent > dir/foo &&
diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh
index 771c3c3c50..8581ad3437 100755
--- a/t/t2018-checkout-branch.sh
+++ b/t/t2018-checkout-branch.sh
@@ -3,6 +3,7 @@
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 2c8c926b4d..9540588664 100755
--- a/t/t2019-checkout-ambiguous-ref.sh
+++ b/t/t2019-checkout-ambiguous-ref.sh
@@ -16,7 +16,7 @@ test_expect_success 'setup ambiguous refs' '
'
test_expect_success 'checkout ambiguous ref succeeds' '
- git checkout ambiguity >stdout 2>stderr
+ git checkout ambiguity 2>stderr
'
test_expect_success 'checkout produces ambiguity warning' '
@@ -37,7 +37,7 @@ test_expect_success 'checkout reports switch to branch' '
'
test_expect_success 'checkout vague ref succeeds' '
- git checkout vagueness >stdout 2>stderr &&
+ git checkout vagueness 2>stderr &&
test_set_prereq VAGUENESS_SUCCESS
'
diff --git a/t/t2021-checkout-overwrite.sh b/t/t2021-checkout-overwrite.sh
index 713c3fa603..034f62c13c 100755
--- a/t/t2021-checkout-overwrite.sh
+++ b/t/t2021-checkout-overwrite.sh
@@ -50,10 +50,13 @@ test_expect_success 'checkout commit with dir must not remove untracked a/b' '
test_expect_success SYMLINKS 'the symlink remained' '
- test_when_finished "rm a/b" &&
test -h a/b
'
+test_expect_success 'cleanup after previous symlink tests' '
+ rm a/b
+'
+
test_expect_success SYMLINKS 'checkout -f must not follow symlinks when removing entries' '
git checkout -f start &&
mkdir dir &&
@@ -66,4 +69,15 @@ test_expect_success SYMLINKS 'checkout -f must not follow symlinks when removing
test_path_is_file untracked/f
'
+test_expect_success 'checkout --overwrite-ignore should succeed if only ignored files in the way' '
+ git checkout -b df_conflict &&
+ test_commit contents some_dir &&
+ git checkout start &&
+ mkdir some_dir &&
+ echo autogenerated information >some_dir/ignore &&
+ echo ignore >.git/info/exclude &&
+ git checkout --overwrite-ignore df_conflict &&
+ ! test_path_is_dir some_dir
+'
+
test_done
diff --git a/t/t2024-checkout-dwim.sh b/t/t2024-checkout-dwim.sh
index 4a1c901456..74049a9812 100755
--- a/t/t2024-checkout-dwim.sh
+++ b/t/t2024-checkout-dwim.sh
@@ -305,10 +305,13 @@ test_expect_success 'loosely defined local base branch is reported correctly' '
test_config branch.strict.merge refs/heads/main &&
test_config branch.loose.merge main &&
- git checkout strict | sed -e "s/strict/BRANCHNAME/g" >expect &&
+ git checkout strict >expect.raw 2>&1 &&
+ sed -e "s/strict/BRANCHNAME/g" <expect.raw >expect &&
status_uno_is_clean &&
- git checkout loose | sed -e "s/loose/BRANCHNAME/g" >actual &&
+ git checkout loose >actual.raw 2>&1 &&
+ sed -e "s/loose/BRANCHNAME/g" <actual.raw >actual &&
status_uno_is_clean &&
+ grep BRANCHNAME actual &&
test_cmp expect actual
'
diff --git a/t/t2025-checkout-no-overlay.sh b/t/t2025-checkout-no-overlay.sh
index 8f13341cf8..3832c3de81 100755
--- a/t/t2025-checkout-no-overlay.sh
+++ b/t/t2025-checkout-no-overlay.sh
@@ -2,6 +2,7 @@
test_description='checkout --no-overlay <tree-ish> -- <pathspec>'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t2060-switch.sh b/t/t2060-switch.sh
index 5a7caf958c..e247a4735b 100755
--- a/t/t2060-switch.sh
+++ b/t/t2060-switch.sh
@@ -146,4 +146,33 @@ test_expect_success 'tracking info copied with autoSetupMerge=inherit' '
test_cmp_config "" --default "" branch.main2.merge
'
+test_expect_success 'switch back when temporarily detached and checked out elsewhere ' '
+ test_when_finished "
+ git worktree remove wt1 ||:
+ git worktree remove wt2 ||:
+ git checkout - ||:
+ git branch -D shared ||:
+ " &&
+ git checkout -b shared &&
+ test_commit shared-first &&
+ HASH1=$(git rev-parse --verify HEAD) &&
+ test_commit shared-second &&
+ test_commit shared-third &&
+ HASH2=$(git rev-parse --verify HEAD) &&
+ git worktree add wt1 -f shared &&
+ git -C wt1 bisect start &&
+ git -C wt1 bisect good $HASH1 &&
+ git -C wt1 bisect bad $HASH2 &&
+ git worktree add wt2 -f shared &&
+ git -C wt2 bisect start &&
+ git -C wt2 bisect good $HASH1 &&
+ git -C wt2 bisect bad $HASH2 &&
+ # we test in both worktrees to ensure that works
+ # as expected with "first" and "next" worktrees
+ test_must_fail git -C wt1 switch shared &&
+ git -C wt1 switch --ignore-other-worktrees shared &&
+ test_must_fail git -C wt2 switch shared &&
+ git -C wt2 switch --ignore-other-worktrees shared
+'
+
test_done
diff --git a/t/t2070-restore.sh b/t/t2070-restore.sh
index 7c43ddf1d9..c5d19dd973 100755
--- a/t/t2070-restore.sh
+++ b/t/t2070-restore.sh
@@ -137,4 +137,20 @@ test_expect_success 'restore --staged invalidates cache tree for deletions' '
test_must_fail git rev-parse HEAD:new1
'
+test_expect_success 'restore with merge options rejects --staged' '
+ for opts in \
+ "--staged --ours" \
+ "--staged --theirs" \
+ "--staged --merge" \
+ "--staged --conflict=diff3" \
+ "--staged --worktree --ours" \
+ "--staged --worktree --theirs" \
+ "--staged --worktree --merge" \
+ "--staged --worktree --conflict=zdiff3"
+ do
+ test_must_fail git restore $opts . 2>err &&
+ grep "cannot be used with --staged" err || return
+ done
+'
+
test_done
diff --git a/t/t2107-update-index-basic.sh b/t/t2107-update-index-basic.sh
index 07e6de84e6..89b285fa3a 100755
--- a/t/t2107-update-index-basic.sh
+++ b/t/t2107-update-index-basic.sh
@@ -83,7 +83,7 @@ test_expect_success '.lock files cleaned up' '
cd repo &&
git config core.worktree ../../worktree &&
# --refresh triggers late setup_work_tree,
- # active_cache_changed is zero, rollback_lock_file fails
+ # the_index.cache_changed is zero, rollback_lock_file fails
git update-index --refresh --verbose >out &&
test_must_be_empty out &&
! test -f .git/index.lock
diff --git a/t/t2401-worktree-prune.sh b/t/t2401-worktree-prune.sh
index 3d28c7f06b..568a47ec42 100755
--- a/t/t2401-worktree-prune.sh
+++ b/t/t2401-worktree-prune.sh
@@ -5,6 +5,7 @@ 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 '
diff --git a/t/t2402-worktree-list.sh b/t/t2402-worktree-list.sh
index 79e0fce2d9..9ad9be0c20 100755
--- a/t/t2402-worktree-list.sh
+++ b/t/t2402-worktree-list.sh
@@ -5,6 +5,7 @@ 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' '
diff --git a/t/t2406-worktree-repair.sh b/t/t2406-worktree-repair.sh
index 5c44453e1c..8970780efc 100755
--- a/t/t2406-worktree-repair.sh
+++ b/t/t2406-worktree-repair.sh
@@ -2,6 +2,7 @@
test_description='test git worktree repair'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t3009-ls-files-others-nonsubmodule.sh b/t/t3009-ls-files-others-nonsubmodule.sh
index 963f3462b7..14218b3424 100755
--- a/t/t3009-ls-files-others-nonsubmodule.sh
+++ b/t/t3009-ls-files-others-nonsubmodule.sh
@@ -18,6 +18,7 @@ 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 580e158f99..054178703d 100755
--- a/t/t3010-ls-files-killed-modified.sh
+++ b/t/t3010-ls-files-killed-modified.sh
@@ -41,6 +41,8 @@ Also for modification test, the cache and working tree have:
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/t3013-ls-files-format.sh b/t/t3013-ls-files-format.sh
index efb7450bf1..ef6fb53f7f 100755
--- a/t/t3013-ls-files-format.sh
+++ b/t/t3013-ls-files-format.sh
@@ -54,6 +54,22 @@ test_expect_success 'git ls-files --format path v.s. -s' '
test_cmp expect actual
'
+test_expect_success 'git ls-files --format with relative path' '
+ cat >expect <<-\EOF &&
+ ../o1.txt
+ ../o2.txt
+ ../o3.txt
+ ../o4.txt
+ ../o5.txt
+ ../o6.txt
+ EOF
+ mkdir sub &&
+ cd sub &&
+ git ls-files --format="%(path)" ":/" >../actual &&
+ cd .. &&
+ test_cmp expect actual
+'
+
test_expect_success 'git ls-files --format with -m' '
echo change >o1.txt &&
cat >expect <<-\EOF &&
diff --git a/t/t3050-subprojects-fetch.sh b/t/t3050-subprojects-fetch.sh
index f1f09abdd9..3884694165 100755
--- a/t/t3050-subprojects-fetch.sh
+++ b/t/t3050-subprojects-fetch.sh
@@ -2,6 +2,7 @@
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 52f76f7b57..5a06732ca7 100755
--- a/t/t3060-ls-files-with-tree.sh
+++ b/t/t3060-ls-files-with-tree.sh
@@ -8,6 +8,8 @@ test_description='git ls-files test (--with-tree).
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' '
@@ -38,7 +40,7 @@ test_expect_success 'setup' '
git commit -a -m "remove them all" &&
# The bug also requires some entry before our directory so that
- # prune_path will modify the_index.cache
+ # prune_index will modify the_repository->index.cache
mkdir a_directory_that_sorts_before_sub &&
>a_directory_that_sorts_before_sub/file &&
@@ -54,7 +56,7 @@ test_expect_success 'usage' '
'
test_expect_success 'git ls-files --with-tree should succeed from subdir' '
- # We have to run from a sub-directory to trigger prune_path
+ # We have to run from a sub-directory to trigger prune_index
# Then we finally get to run our --with-tree test
(
cd sub &&
diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh
index 5d871fde96..4dd42df38c 100755
--- a/t/t3070-wildmatch.sh
+++ b/t/t3070-wildmatch.sh
@@ -431,4 +431,15 @@ match 1 1 1 1 'a' '[B-a]'
match 0 1 0 1 'z' '[Z-y]'
match 1 1 1 1 'Z' '[Z-y]'
+test_expect_success 'matching does not exhibit exponential behavior' '
+ {
+ test-tool wildmatch wildmatch \
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab \
+ "*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a" &
+ pid=$!
+ } &&
+ sleep 2 &&
+ ! kill $!
+'
+
test_done
diff --git a/t/t3104-ls-tree-format.sh b/t/t3104-ls-tree-format.sh
index 383896667b..3adb206a93 100755
--- a/t/t3104-ls-tree-format.sh
+++ b/t/t3104-ls-tree-format.sh
@@ -20,7 +20,6 @@ test_ls_tree_format () {
format=$1 &&
opts=$2 &&
fmtopts=$3 &&
- shift 2 &&
test_expect_success "ls-tree '--format=<$format>' is like options '$opts $fmtopts'" '
git ls-tree $opts -r HEAD >expect &&
@@ -36,6 +35,12 @@ test_ls_tree_format () {
'
}
+test_expect_success "ls-tree --format='%(path) %(path) %(path)' HEAD top-file" '
+ git ls-tree --format="%(path) %(path) %(path)" HEAD top-file.t >actual &&
+ echo top-file.t top-file.t top-file.t >expect &&
+ test_cmp expect actual
+'
+
test_ls_tree_format \
"%(objectmode) %(objecttype) %(objectname)%x09%(path)" \
""
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index c7ec1c7520..98b6c8ac34 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -201,8 +201,8 @@ test_expect_success 'git branch -M baz bam should succeed when baz is checked ou
test_expect_success 'git branch -M baz bam should add entries to .git/logs/HEAD' '
msg="Branch: renamed refs/heads/baz to refs/heads/bam" &&
- grep " 0\{40\}.*$msg$" .git/logs/HEAD &&
- grep "^0\{40\}.*$msg$" .git/logs/HEAD
+ grep " $ZERO_OID.*$msg$" .git/logs/HEAD &&
+ grep "^$ZERO_OID.*$msg$" .git/logs/HEAD
'
test_expect_success 'git branch -M should leave orphaned HEAD alone' '
@@ -239,15 +239,34 @@ test_expect_success 'git branch -M baz bam should succeed when baz is checked ou
git worktree prune
'
+test_expect_success 'git branch -M fails if updating any linked working tree fails' '
+ git worktree add -b baz bazdir1 &&
+ git worktree add -f bazdir2 baz &&
+ touch .git/worktrees/bazdir1/HEAD.lock &&
+ test_must_fail git branch -M baz bam &&
+ test $(git -C bazdir2 rev-parse --abbrev-ref HEAD) = bam &&
+ git branch -M bam baz &&
+ rm .git/worktrees/bazdir1/HEAD.lock &&
+ touch .git/worktrees/bazdir2/HEAD.lock &&
+ test_must_fail git branch -M baz bam &&
+ test $(git -C bazdir1 rev-parse --abbrev-ref HEAD) = bam &&
+ rm -rf bazdir1 bazdir2 &&
+ git worktree prune
+'
+
test_expect_success 'git branch -M baz bam should succeed within a worktree in which baz is checked out' '
git checkout -b baz &&
git worktree add -f bazdir baz &&
(
cd bazdir &&
git branch -M baz bam &&
- test $(git rev-parse --abbrev-ref HEAD) = bam
+ echo bam >expect &&
+ git rev-parse --abbrev-ref HEAD >actual &&
+ test_cmp expect actual
) &&
- test $(git rev-parse --abbrev-ref HEAD) = bam &&
+ echo bam >expect &&
+ git rev-parse --abbrev-ref HEAD >actual &&
+ test_cmp expect actual &&
rm -r bazdir &&
git worktree prune
'
@@ -268,6 +287,67 @@ test_expect_success 'git branch -M topic topic should work when main is checked
git branch -M topic topic
'
+test_expect_success 'git branch -M and -C fail on detached HEAD' '
+ git checkout HEAD^{} &&
+ test_when_finished git checkout - &&
+ echo "fatal: cannot rename the current branch while not on any." >expect &&
+ test_must_fail git branch -M must-fail 2>err &&
+ test_cmp expect err &&
+ echo "fatal: cannot copy the current branch while not on any." >expect &&
+ test_must_fail git branch -C must-fail 2>err &&
+ test_cmp expect err
+'
+
+test_expect_success 'git branch -m should work with orphan branches' '
+ test_when_finished git checkout - &&
+ test_when_finished git worktree remove -f wt &&
+ git worktree add wt --detach &&
+ # rename orphan in another worktreee
+ git -C wt checkout --orphan orphan-foo-wt &&
+ git branch -m orphan-foo-wt orphan-bar-wt &&
+ test orphan-bar-wt=$(git -C orphan-worktree branch --show-current) &&
+ # rename orphan in the current worktree
+ git checkout --orphan orphan-foo &&
+ git branch -m orphan-foo orphan-bar &&
+ test orphan-bar=$(git branch --show-current)
+'
+
+test_expect_success 'git branch -d on orphan HEAD (merged)' '
+ test_when_finished git checkout main &&
+ git checkout --orphan orphan &&
+ test_when_finished "rm -rf .git/objects/commit-graph*" &&
+ git commit-graph write --reachable &&
+ git branch --track to-delete main &&
+ git branch -d to-delete
+'
+
+test_expect_success 'git branch -d on orphan HEAD (merged, graph)' '
+ test_when_finished git checkout main &&
+ git checkout --orphan orphan &&
+ git branch --track to-delete main &&
+ git branch -d to-delete
+'
+
+test_expect_success 'git branch -d on orphan HEAD (unmerged)' '
+ test_when_finished git checkout main &&
+ git checkout --orphan orphan &&
+ test_when_finished "git branch -D to-delete" &&
+ git branch to-delete main &&
+ test_must_fail git branch -d to-delete 2>err &&
+ grep "not fully merged" err
+'
+
+test_expect_success 'git branch -d on orphan HEAD (unmerged, graph)' '
+ test_when_finished git checkout main &&
+ git checkout --orphan orphan &&
+ test_when_finished "git branch -D to-delete" &&
+ git branch to-delete main &&
+ test_when_finished "rm -rf .git/objects/commit-graph*" &&
+ git commit-graph write --reachable &&
+ test_must_fail git branch -d to-delete 2>err &&
+ grep "not fully merged" err
+'
+
test_expect_success 'git branch -v -d t should work' '
git branch t &&
git rev-parse --verify refs/heads/t &&
@@ -1383,7 +1463,7 @@ test_expect_success 'branch --delete --force removes dangling branch' '
test_expect_success 'use --edit-description' '
EDITOR=: git branch --edit-description &&
- test_must_fail git config branch.main.description &&
+ test_expect_code 1 git config branch.main.description &&
write_script editor <<-\EOF &&
echo "New contents" >"$1"
diff --git a/t/t3202-show-branch.sh b/t/t3202-show-branch.sh
index ea7cfd1951..be20ebe1d5 100755
--- a/t/t3202-show-branch.sh
+++ b/t/t3202-show-branch.sh
@@ -221,4 +221,22 @@ test_expect_success 'fatal descriptions on non-existent branch' '
test_cmp expect actual
'
+test_expect_success 'error descriptions on orphan branch' '
+ test_when_finished git worktree remove -f wt &&
+ git worktree add wt --detach &&
+ git -C wt checkout --orphan orphan-branch &&
+ test_branch_op_in_wt() {
+ test_orphan_error() {
+ test_must_fail git $* 2>actual &&
+ test_i18ngrep "No commit on branch .orphan-branch. yet.$" actual
+ } &&
+ test_orphan_error -C wt branch $1 $2 && # implicit branch
+ test_orphan_error -C wt branch $1 orphan-branch $2 && # explicit branch
+ test_orphan_error branch $1 orphan-branch $2 # different worktree
+ } &&
+ test_branch_op_in_wt --edit-description &&
+ test_branch_op_in_wt --set-upstream-to=ne &&
+ test_branch_op_in_wt -c new-branch
+'
+
test_done
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index d34d77f893..93f8295339 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -337,10 +337,48 @@ test_expect_success 'git branch --format option' '
test_cmp expect actual
'
+test_expect_success 'git branch --format with ahead-behind' '
+ cat >expect <<-\EOF &&
+ (HEAD detached from fromtag) 0 0
+ refs/heads/ambiguous 0 0
+ refs/heads/branch-one 1 0
+ refs/heads/branch-two 0 0
+ refs/heads/main 1 0
+ refs/heads/ref-to-branch 1 0
+ refs/heads/ref-to-remote 1 0
+ EOF
+ git branch --format="%(refname) %(ahead-behind:HEAD)" >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'git branch with --format=%(rest) must fail' '
test_must_fail git branch --format="%(rest)" >actual
'
+test_expect_success 'git branch --format --omit-empty' '
+ cat >expect <<-\EOF &&
+ Refname is (HEAD detached from fromtag)
+ Refname is refs/heads/ambiguous
+ Refname is refs/heads/branch-one
+ Refname is refs/heads/branch-two
+
+ Refname is refs/heads/ref-to-branch
+ Refname is refs/heads/ref-to-remote
+ EOF
+ git branch --format="%(if:notequals=refs/heads/main)%(refname)%(then)Refname is %(refname)%(end)" >actual &&
+ test_cmp expect actual &&
+ cat >expect <<-\EOF &&
+ Refname is (HEAD detached from fromtag)
+ Refname is refs/heads/ambiguous
+ Refname is refs/heads/branch-one
+ Refname is refs/heads/branch-two
+ Refname is refs/heads/ref-to-branch
+ Refname is refs/heads/ref-to-remote
+ EOF
+ git branch --omit-empty --format="%(if:notequals=refs/heads/main)%(refname)%(then)Refname is %(refname)%(end)" >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'worktree colors correct' '
cat >expect <<-EOF &&
* <GREEN>(HEAD detached from fromtag)<RESET>
diff --git a/t/t3204-branch-name-interpretation.sh b/t/t3204-branch-name-interpretation.sh
index 993a6b5eff..3399344f25 100755
--- a/t/t3204-branch-name-interpretation.sh
+++ b/t/t3204-branch-name-interpretation.sh
@@ -57,6 +57,16 @@ test_expect_success 'create branch with pseudo-qualified name' '
expect_branch refs/heads/refs/heads/qualified two
'
+test_expect_success 'force-copy a branch to itself via @{-1} is no-op' '
+ git branch -t copiable main &&
+ git checkout copiable &&
+ git checkout - &&
+ git branch -C @{-1} copiable &&
+ git config --get-all branch.copiable.merge >actual &&
+ echo refs/heads/main >expect &&
+ test_cmp expect actual
+'
+
test_expect_success 'delete branch via @{-1}' '
git branch previous-del &&
@@ -133,4 +143,28 @@ test_expect_success 'checkout does not treat remote @{upstream} as a branch' '
expect_branch HEAD one
'
+test_expect_success 'edit-description via @{-1}' '
+ git checkout -b desc-branch &&
+ git checkout -b non-desc-branch &&
+ write_script editor <<-\EOF &&
+ echo "Branch description" >"$1"
+ EOF
+ EDITOR=./editor git branch --edit-description @{-1} &&
+ test_must_fail git config branch.non-desc-branch.description &&
+ git config branch.desc-branch.description >actual &&
+ printf "Branch description\n\n" >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'modify branch upstream via "@{-1}" and "@{-1}@{upstream}"' '
+ git checkout -b upstream-branch &&
+ git checkout -b upstream-other -t upstream-branch &&
+ git branch --set-upstream-to upstream-other @{-1} &&
+ git config branch.upstream-branch.merge >actual &&
+ echo "refs/heads/upstream-other" >expect &&
+ test_cmp expect actual &&
+ git branch --unset-upstream @{-1}@{upstream} &&
+ test_must_fail git config branch.upstream-other.merge
+'
+
test_done
diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
index 84dd0cd26d..b5f4d6a653 100755
--- a/t/t3206-range-diff.sh
+++ b/t/t3206-range-diff.sh
@@ -33,6 +33,26 @@ test_expect_success 'setup' '
u3 sha256:736c4bc
u4 sha256:673e77d
+ # topic (abbrev=10)
+ t1_abbrev sha1:4de457d2c0
+ t2_abbrev sha1:fccce22f8c
+ t3_abbrev sha1:147e64ef53
+ t4_abbrev sha1:a63e992599
+ t1_abbrev sha256:b89f8b9092
+ t2_abbrev sha256:5f12aadf34
+ t3_abbrev sha256:ea8b273a6c
+ t4_abbrev sha256:14b73361fc
+
+ # unmodified (abbrev=10)
+ u1_abbrev sha1:35b9b25f76
+ u2_abbrev sha1:de345ab3de
+ u3_abbrev sha1:9af6654000
+ u4_abbrev sha1:2901f773f3
+ u1_abbrev sha256:e3731be242
+ u2_abbrev sha256:14fadf8cee
+ u3_abbrev sha256:736c4bcb44
+ u4_abbrev sha256:673e77d589
+
# reordered
r1 sha1:aca177a
r2 sha1:14ad629
@@ -153,6 +173,18 @@ test_expect_success 'simple A B C (unmodified)' '
test_cmp expect actual
'
+test_expect_success 'simple A..B A..C (unmodified) with --abbrev' '
+ git range-diff --no-color --abbrev=10 main..topic main..unmodified \
+ >actual &&
+ cat >expect <<-EOF &&
+ 1: $(test_oid t1_abbrev) = 1: $(test_oid u1_abbrev) s/5/A/
+ 2: $(test_oid t2_abbrev) = 2: $(test_oid u2_abbrev) s/4/A/
+ 3: $(test_oid t3_abbrev) = 3: $(test_oid u3_abbrev) s/11/B/
+ 4: $(test_oid t4_abbrev) = 4: $(test_oid u4_abbrev) s/12/B/
+ EOF
+ test_cmp expect actual
+'
+
test_expect_success 'A^! and A^-<n> (unmodified)' '
git range-diff --no-color topic^! unmodified^-1 >actual &&
cat >expect <<-EOF &&
diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh
index 577f32dc71..07a0ff93de 100755
--- a/t/t3210-pack-refs.sh
+++ b/t/t3210-pack-refs.sh
@@ -12,6 +12,7 @@ semantic is still the same.
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 'enable reflogs' '
diff --git a/t/t3305-notes-fanout.sh b/t/t3305-notes-fanout.sh
index 22ffe5bcb9..1ec1fb6715 100755
--- a/t/t3305-notes-fanout.sh
+++ b/t/t3305-notes-fanout.sh
@@ -9,7 +9,7 @@ path_has_fanout() {
path=$1 &&
fanout=$2 &&
after_last_slash=$(($(test_oid hexsz) - $fanout * 2)) &&
- echo $path | grep -q "^\([0-9a-f]\{2\}/\)\{$fanout\}[0-9a-f]\{$after_last_slash\}$"
+ echo $path | grep -q -E "^([0-9a-f]{2}/){$fanout}[0-9a-f]{$after_last_slash}$"
}
touched_one_note_with_fanout() {
diff --git a/t/t3309-notes-merge-auto-resolve.sh b/t/t3309-notes-merge-auto-resolve.sh
index 141d3e4ca4..9bd5dbf341 100755
--- a/t/t3309-notes-merge-auto-resolve.sh
+++ b/t/t3309-notes-merge-auto-resolve.sh
@@ -360,7 +360,12 @@ test_expect_success 'merge z into y with invalid strategy => Fail/No changes' '
test_expect_success 'merge z into y with invalid configuration option => Fail/No changes' '
git config core.notesRef refs/notes/y &&
- test_must_fail git -c notes.mergeStrategy="foo" notes merge z &&
+ cat >expect <<-\EOF &&
+ error: unknown notes merge strategy foo
+ fatal: unable to parse '\''notes.mergeStrategy'\'' from command-line config
+ EOF
+ test_must_fail git -c notes.mergeStrategy="foo" notes merge z 2>actual &&
+ test_cmp expect actual &&
# Verify no changes (y)
verify_notes y y
'
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index d5a8ee39fc..3ce918fdb8 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -388,6 +388,20 @@ test_expect_success 'switch to branch checked out here' '
git rebase main main
'
+test_expect_success 'switch to branch checked out elsewhere fails' '
+ test_when_finished "
+ git worktree remove wt1 &&
+ git worktree remove wt2 &&
+ git branch -d shared
+ " &&
+ git worktree add wt1 -b shared &&
+ git worktree add wt2 -f shared &&
+ # we test in both worktrees to ensure that works
+ # as expected with "first" and "next" worktrees
+ test_must_fail git -C wt1 rebase shared shared &&
+ test_must_fail git -C wt2 rebase shared shared
+'
+
test_expect_success 'switch to branch not checked out' '
git checkout main &&
git branch other &&
diff --git a/t/t3402-rebase-merge.sh b/t/t3402-rebase-merge.sh
index 7e46f4ca85..79b0640c00 100755
--- a/t/t3402-rebase-merge.sh
+++ b/t/t3402-rebase-merge.sh
@@ -131,27 +131,6 @@ test_expect_success 'picking rebase' '
esac
'
-test_expect_success 'rebase -s funny -Xopt' '
- test_when_finished "rm -fr test-bin funny.was.run" &&
- mkdir test-bin &&
- cat >test-bin/git-merge-funny <<-EOF &&
- #!$SHELL_PATH
- case "\$1" in --opt) ;; *) exit 2 ;; esac
- shift &&
- >funny.was.run &&
- exec git merge-recursive "\$@"
- EOF
- chmod +x test-bin/git-merge-funny &&
- git reset --hard &&
- git checkout -b test-funny main^ &&
- test_commit funny &&
- (
- PATH=./test-bin:$PATH &&
- git rebase -s funny -Xopt main
- ) &&
- test -f funny.was.run
-'
-
test_expect_success 'rebase --skip works with two conflicts in a row' '
git checkout second-side &&
tr "[A-Z]" "[a-z]" <newfile >tmp &&
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index f0a0a54fba..ff0afad63e 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -1244,9 +1244,9 @@ test_expect_success 'short commit ID collide' '
test $colliding_id = "$(git rev-parse HEAD | cut -c 1-4)" &&
grep "^pick $colliding_id " \
.git/rebase-merge/git-rebase-todo.tmp &&
- grep "^pick [0-9a-f]\{$hexsz\}" \
+ grep -E "^pick [0-9a-f]{$hexsz}" \
.git/rebase-merge/git-rebase-todo &&
- grep "^pick [0-9a-f]\{$hexsz\}" \
+ grep -E "^pick [0-9a-f]{$hexsz}" \
.git/rebase-merge/git-rebase-todo.backup &&
git rebase --continue
) &&
@@ -1261,7 +1261,7 @@ test_expect_success 'respect core.abbrev' '
set_cat_todo_editor &&
test_must_fail git rebase -i HEAD~4 >todo-list
) &&
- test 4 = $(grep -c "pick [0-9a-f]\{12,\}" todo-list)
+ test 4 = $(grep -c -E "pick [0-9a-f]{12,}" todo-list)
'
test_expect_success 'todo count' '
@@ -1449,14 +1449,15 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = ig
test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = warn' '
cat >expect <<-EOF &&
- error: invalid line 1: badcmd $(git rev-list --pretty=oneline --abbrev-commit -1 primary~4)
+ error: invalid command '\''pickled'\''
+ error: invalid line 1: pickled $(git rev-list --pretty=oneline --abbrev-commit -1 primary~4)
Warning: some commits may have been dropped accidentally.
Dropped commits (newer to older):
- $(git rev-list --pretty=oneline --abbrev-commit -1 primary)
- $(git rev-list --pretty=oneline --abbrev-commit -1 primary~4)
To avoid this message, use "drop" to explicitly remove a commit.
EOF
- head -n4 expect >expect.2 &&
+ head -n5 expect >expect.2 &&
tail -n1 expect >>expect.2 &&
tail -n4 expect.2 >expect.3 &&
test_config rebase.missingCommitsCheck warn &&
@@ -1467,7 +1468,7 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = wa
git rebase -i --root &&
cp .git/rebase-merge/git-rebase-todo.backup orig &&
FAKE_LINES="2 3 4" git rebase --edit-todo 2>actual.2 &&
- head -n6 actual.2 >actual &&
+ head -n7 actual.2 >actual &&
test_cmp expect actual &&
cp orig .git/rebase-merge/git-rebase-todo &&
FAKE_LINES="1 2 3 4" git rebase --edit-todo 2>actual.2 &&
@@ -1483,7 +1484,8 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = wa
test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = error' '
cat >expect <<-EOF &&
- error: invalid line 1: badcmd $(git rev-list --pretty=oneline --abbrev-commit -1 primary~4)
+ error: invalid command '\''pickled'\''
+ error: invalid line 1: pickled $(git rev-list --pretty=oneline --abbrev-commit -1 primary~4)
Warning: some commits may have been dropped accidentally.
Dropped commits (newer to older):
- $(git rev-list --pretty=oneline --abbrev-commit -1 primary)
@@ -1583,7 +1585,7 @@ test_expect_success 'static check of bad command' '
set_fake_editor &&
test_must_fail env FAKE_LINES="1 2 3 bad 4 5" \
git rebase -i --root 2>actual &&
- test_i18ngrep "badcmd $(git rev-list --oneline -1 primary~1)" \
+ test_i18ngrep "pickled $(git rev-list --oneline -1 primary~1)" \
actual &&
test_i18ngrep "You can fix this with .git rebase --edit-todo.." \
actual &&
@@ -2072,6 +2074,7 @@ test_expect_success '--update-refs: --edit-todo with no update-ref lines' '
'
test_expect_success '--update-refs: check failed ref update' '
+ test_when_finished "test_might_fail git rebase --abort" &&
git checkout -B update-refs-error no-conflict-branch &&
git branch -f base HEAD~4 &&
git branch -f first HEAD~3 &&
@@ -2123,6 +2126,28 @@ test_expect_success '--update-refs: check failed ref update' '
test_cmp expect err.trimmed
'
+test_expect_success 'bad labels and refs rejected when parsing todo list' '
+ test_when_finished "test_might_fail git rebase --abort" &&
+ cat >todo <<-\EOF &&
+ exec >execed
+ label #
+ label :invalid
+ update-ref :bad
+ update-ref topic
+ EOF
+ rm -f execed &&
+ (
+ set_replace_editor todo &&
+ test_must_fail git rebase -i HEAD 2>err
+ ) &&
+ grep "'\''#'\'' is not a valid label" err &&
+ grep "'\'':invalid'\'' is not a valid label" err &&
+ grep "'\'':bad'\'' is not a valid refname" err &&
+ grep "update-ref requires a fully qualified refname e.g. refs/heads/topic" \
+ err &&
+ test_path_is_missing execed
+'
+
# This must be the last test in this file
test_expect_success '$EDITOR and friends are unchanged' '
test_editor_unchanged
diff --git a/t/t3405-rebase-malformed.sh b/t/t3405-rebase-malformed.sh
index 2524331861..8979bc3407 100755
--- a/t/t3405-rebase-malformed.sh
+++ b/t/t3405-rebase-malformed.sh
@@ -5,6 +5,7 @@ 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 d17b450e81..ceca160005 100755
--- a/t/t3406-rebase-message.sh
+++ b/t/t3406-rebase-message.sh
@@ -10,10 +10,16 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
test_expect_success 'setup' '
test_commit O fileO &&
test_commit X fileX &&
+ git branch fast-forward &&
test_commit A fileA &&
test_commit B fileB &&
test_commit Y fileY &&
+ git checkout -b conflicts O &&
+ test_commit P &&
+ test_commit conflict-X fileX &&
+ test_commit Q &&
+
git checkout -b topic O &&
git cherry-pick A B &&
test_commit Z fileZ &&
@@ -79,54 +85,165 @@ test_expect_success 'error out early upon -C<n> or --whitespace=<bad>' '
test_i18ngrep "Invalid whitespace option" err
'
-test_expect_success 'GIT_REFLOG_ACTION' '
- git checkout start &&
- test_commit reflog-onto &&
- git checkout -b reflog-topic start &&
- test_commit reflog-to-rebase &&
+write_reflog_expect () {
+ if test $mode = --apply
+ then
+ sed 's/(continue)/(pick)/'
+ else
+ cat
+ fi >expect
+}
- git rebase reflog-onto &&
- git log -g --format=%gs -3 >actual &&
- cat >expect <<-\EOF &&
- rebase (finish): returning to refs/heads/reflog-topic
- rebase (pick): reflog-to-rebase
- rebase (start): checkout reflog-onto
+test_reflog () {
+ mode=$1
+ reflog_action="$2"
+
+ test_expect_success "rebase $mode reflog${reflog_action:+ GIT_REFLOG_ACTION=$reflog_action}" '
+ git checkout conflicts &&
+ test_when_finished "git reset --hard Q" &&
+
+ (
+ if test -n "$reflog_action"
+ then
+ GIT_REFLOG_ACTION="$reflog_action" &&
+ export GIT_REFLOG_ACTION
+ fi &&
+ test_must_fail git rebase $mode main &&
+ echo resolved >fileX &&
+ git add fileX &&
+ git rebase --continue
+ ) &&
+
+ git log -g --format=%gs -5 >actual &&
+ write_reflog_expect <<-EOF &&
+ ${reflog_action:-rebase} (finish): returning to refs/heads/conflicts
+ ${reflog_action:-rebase} (pick): Q
+ ${reflog_action:-rebase} (continue): conflict-X
+ ${reflog_action:-rebase} (pick): P
+ ${reflog_action:-rebase} (start): checkout main
EOF
test_cmp expect actual &&
- git checkout -b reflog-prefix reflog-to-rebase &&
- GIT_REFLOG_ACTION=change-the-reflog git rebase reflog-onto &&
- git log -g --format=%gs -3 >actual &&
- cat >expect <<-\EOF &&
- change-the-reflog (finish): returning to refs/heads/reflog-prefix
- change-the-reflog (pick): reflog-to-rebase
- change-the-reflog (start): checkout reflog-onto
+ git log -g --format=%gs -1 conflicts >actual &&
+ write_reflog_expect <<-EOF &&
+ ${reflog_action:-rebase} (finish): refs/heads/conflicts onto $(git rev-parse main)
+ EOF
+ test_cmp expect actual &&
+
+ # check there is only one new entry in the branch reflog
+ test_cmp_rev conflicts@{1} Q
+ '
+
+ test_expect_success "rebase $mode fast-forward reflog${reflog_action:+ GIT_REFLOG_ACTION=$reflog_action}" '
+ git checkout fast-forward &&
+ test_when_finished "git reset --hard X" &&
+
+ (
+ if test -n "$reflog_action"
+ then
+ GIT_REFLOG_ACTION="$reflog_action" &&
+ export GIT_REFLOG_ACTION
+ fi &&
+ git rebase $mode main
+ ) &&
+
+ git log -g --format=%gs -2 >actual &&
+ write_reflog_expect <<-EOF &&
+ ${reflog_action:-rebase} (finish): returning to refs/heads/fast-forward
+ ${reflog_action:-rebase} (start): checkout main
+ EOF
+ test_cmp expect actual &&
+
+ git log -g --format=%gs -1 fast-forward >actual &&
+ write_reflog_expect <<-EOF &&
+ ${reflog_action:-rebase} (finish): refs/heads/fast-forward onto $(git rev-parse main)
+ EOF
+ test_cmp expect actual &&
+
+ # check there is only one new entry in the branch reflog
+ test_cmp_rev fast-forward@{1} X
+ '
+
+ test_expect_success "rebase $mode --skip reflog${reflog_action:+ GIT_REFLOG_ACTION=$reflog_action}" '
+ git checkout conflicts &&
+ test_when_finished "git reset --hard Q" &&
+
+ (
+ if test -n "$reflog_action"
+ then
+ GIT_REFLOG_ACTION="$reflog_action" &&
+ export GIT_REFLOG_ACTION
+ fi &&
+ test_must_fail git rebase $mode main &&
+ git rebase --skip
+ ) &&
+
+ git log -g --format=%gs -4 >actual &&
+ write_reflog_expect <<-EOF &&
+ ${reflog_action:-rebase} (finish): returning to refs/heads/conflicts
+ ${reflog_action:-rebase} (pick): Q
+ ${reflog_action:-rebase} (pick): P
+ ${reflog_action:-rebase} (start): checkout main
EOF
test_cmp expect actual
-'
+ '
-test_expect_success 'rebase --apply reflog' '
- git checkout -b reflog-apply start &&
- old_head_reflog="$(git log -g --format=%gs -1 HEAD)" &&
+ test_expect_success "rebase $mode --abort reflog${reflog_action:+ GIT_REFLOG_ACTION=$reflog_action}" '
+ git checkout conflicts &&
+ test_when_finished "git reset --hard Q" &&
- git rebase --apply Y &&
+ git log -g -1 conflicts >branch-expect &&
+ (
+ if test -n "$reflog_action"
+ then
+ GIT_REFLOG_ACTION="$reflog_action" &&
+ export GIT_REFLOG_ACTION
+ fi &&
+ test_must_fail git rebase $mode main &&
+ git rebase --abort
+ ) &&
- git log -g --format=%gs -4 HEAD >actual &&
- cat >expect <<-EOF &&
- rebase finished: returning to refs/heads/reflog-apply
- rebase: Z
- rebase: checkout Y
- $old_head_reflog
+ git log -g --format=%gs -3 >actual &&
+ write_reflog_expect <<-EOF &&
+ ${reflog_action:-rebase} (abort): returning to refs/heads/conflicts
+ ${reflog_action:-rebase} (pick): P
+ ${reflog_action:-rebase} (start): checkout main
EOF
test_cmp expect actual &&
- git log -g --format=%gs -2 reflog-apply >actual &&
- cat >expect <<-EOF &&
- rebase finished: refs/heads/reflog-apply onto $(git rev-parse Y)
- branch: Created from start
+ # check branch reflog is unchanged
+ git log -g -1 conflicts >branch-actual &&
+ test_cmp branch-expect branch-actual
+ '
+
+ test_expect_success "rebase $mode --abort detached HEAD reflog${reflog_action:+ GIT_REFLOG_ACTION=$reflog_action}" '
+ git checkout Q &&
+ test_when_finished "git reset --hard Q" &&
+
+ (
+ if test -n "$reflog_action"
+ then
+ GIT_REFLOG_ACTION="$reflog_action" &&
+ export GIT_REFLOG_ACTION
+ fi &&
+ test_must_fail git rebase $mode main &&
+ git rebase --abort
+ ) &&
+
+ git log -g --format=%gs -3 >actual &&
+ write_reflog_expect <<-EOF &&
+ ${reflog_action:-rebase} (abort): returning to $(git rev-parse Q)
+ ${reflog_action:-rebase} (pick): P
+ ${reflog_action:-rebase} (start): checkout main
EOF
test_cmp expect actual
-'
+ '
+}
+
+test_reflog --merge
+test_reflog --merge my-reflog-action
+test_reflog --apply
+test_reflog --apply my-reflog-action
test_expect_success 'rebase -i onto unrelated history' '
git init unrelated &&
diff --git a/t/t3409-rebase-environ.sh b/t/t3409-rebase-environ.sh
index 83ffb39d9f..acaf5558db 100755
--- a/t/t3409-rebase-environ.sh
+++ b/t/t3409-rebase-environ.sh
@@ -2,6 +2,7 @@
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 58371d8a54..e75b3d0e07 100755
--- a/t/t3412-rebase-root.sh
+++ b/t/t3412-rebase-root.sh
@@ -7,6 +7,7 @@ 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 9fab0d779b..e8456831e8 100755
--- a/t/t3413-rebase-hook.sh
+++ b/t/t3413-rebase-hook.sh
@@ -5,6 +5,7 @@ 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/t3416-rebase-onto-threedots.sh b/t/t3416-rebase-onto-threedots.sh
index 3e04802cb0..f8c4ed78c9 100755
--- a/t/t3416-rebase-onto-threedots.sh
+++ b/t/t3416-rebase-onto-threedots.sh
@@ -5,6 +5,7 @@ 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"
@@ -79,8 +80,10 @@ test_expect_success 'rebase -i --onto main...topic' '
git reset --hard &&
git checkout topic &&
git reset --hard G &&
- set_fake_editor &&
- EXPECT_COUNT=1 git rebase -i --onto main...topic F &&
+ (
+ set_fake_editor &&
+ EXPECT_COUNT=1 git rebase -i --onto main...topic F
+ ) &&
git rev-parse HEAD^1 >actual &&
git rev-parse C^0 >expect &&
test_cmp expect actual
@@ -90,20 +93,22 @@ test_expect_success 'rebase -i --onto main...' '
git reset --hard &&
git checkout topic &&
git reset --hard G &&
- set_fake_editor &&
- EXPECT_COUNT=1 git rebase -i --onto main... F &&
+ (
+ set_fake_editor &&
+ EXPECT_COUNT=1 git rebase -i --onto main... F
+ ) &&
git rev-parse HEAD^1 >actual &&
git rev-parse C^0 >expect &&
test_cmp expect actual
'
-test_expect_success 'rebase -i --onto main...side' '
+test_expect_success 'rebase --onto main...side requires a single merge-base' '
git reset --hard &&
git checkout side &&
git reset --hard K &&
- set_fake_editor &&
- test_must_fail git rebase -i --onto main...side J
+ test_must_fail git rebase -i --onto main...side J 2>err &&
+ grep "need exactly one merge base" err
'
test_expect_success 'rebase --keep-base --onto incompatible' '
@@ -156,8 +161,10 @@ test_expect_success 'rebase -i --keep-base main from topic' '
git checkout topic &&
git reset --hard G &&
- set_fake_editor &&
- EXPECT_COUNT=2 git rebase -i --keep-base main &&
+ (
+ set_fake_editor &&
+ EXPECT_COUNT=2 git rebase -i --keep-base main
+ ) &&
git rev-parse C >base.expect &&
git merge-base main HEAD >base.actual &&
test_cmp base.expect base.actual &&
@@ -171,8 +178,10 @@ test_expect_success 'rebase -i --keep-base main topic from main' '
git checkout main &&
git branch -f topic G &&
- set_fake_editor &&
- EXPECT_COUNT=2 git rebase -i --keep-base main topic &&
+ (
+ set_fake_editor &&
+ EXPECT_COUNT=2 git rebase -i --keep-base main topic
+ ) &&
git rev-parse C >base.expect &&
git merge-base main HEAD >base.actual &&
test_cmp base.expect base.actual &&
@@ -182,13 +191,39 @@ test_expect_success 'rebase -i --keep-base main topic from main' '
test_cmp expect actual
'
-test_expect_success 'rebase -i --keep-base main from side' '
+test_expect_success 'rebase --keep-base requires a single merge base' '
git reset --hard &&
git checkout side &&
git reset --hard K &&
- set_fake_editor &&
- test_must_fail git rebase -i --keep-base main
+ test_must_fail git rebase -i --keep-base main 2>err &&
+ grep "need exactly one merge base with branch" err
+'
+
+test_expect_success 'rebase --keep-base keeps cherry picks' '
+ git checkout -f -B main E &&
+ git cherry-pick F &&
+ (
+ set_fake_editor &&
+ EXPECT_COUNT=2 git rebase -i --keep-base HEAD G
+ ) &&
+ test_cmp_rev HEAD G
+'
+
+test_expect_success 'rebase --keep-base --no-reapply-cherry-picks' '
+ git checkout -f -B main E &&
+ git cherry-pick F &&
+ (
+ set_fake_editor &&
+ EXPECT_COUNT=1 git rebase -i --keep-base \
+ --no-reapply-cherry-picks HEAD G
+ ) &&
+ test_cmp_rev HEAD^ C
+'
+
+# This must be the last test in this file
+test_expect_success '$EDITOR and friends are unchanged' '
+ test_editor_unchanged
'
test_done
diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh
index 130e2f9b55..2d0789e554 100755
--- a/t/t3418-rebase-continue.sh
+++ b/t/t3418-rebase-continue.sh
@@ -62,61 +62,39 @@ test_expect_success 'rebase --continue remembers merge strategy and options' '
rm -fr .git/rebase-* &&
git reset --hard commit-new-file-F2-on-topic-branch &&
test_commit "commit-new-file-F3-on-topic-branch" F3 32 &&
- test_when_finished "rm -fr test-bin funny.was.run" &&
+ test_when_finished "rm -fr test-bin" &&
mkdir test-bin &&
- cat >test-bin/git-merge-funny <<-EOF &&
- #!$SHELL_PATH
- case "\$1" in --opt) ;; *) exit 2 ;; esac
- shift &&
- >funny.was.run &&
- exec git merge-recursive "\$@"
+
+ write_script test-bin/git-merge-funny <<-\EOF &&
+ printf "[%s]\n" $# "$1" "$2" "$3" "$5" >actual
+ shift 3 &&
+ exec git merge-recursive "$@"
EOF
- chmod +x test-bin/git-merge-funny &&
- (
- PATH=./test-bin:$PATH &&
- test_must_fail git rebase -s funny -Xopt main topic
- ) &&
- test -f funny.was.run &&
- rm funny.was.run &&
- echo "Resolved" >F2 &&
- git add F2 &&
- (
- PATH=./test-bin:$PATH &&
- git rebase --continue
- ) &&
- test -f funny.was.run
-'
-test_expect_success 'rebase -i --continue handles merge strategy and options' '
- rm -fr .git/rebase-* &&
- git reset --hard commit-new-file-F2-on-topic-branch &&
- test_commit "commit-new-file-F3-on-topic-branch-for-dash-i" F3 32 &&
- test_when_finished "rm -fr test-bin funny.was.run funny.args" &&
- mkdir test-bin &&
- cat >test-bin/git-merge-funny <<-EOF &&
- #!$SHELL_PATH
- echo "\$@" >>funny.args
- case "\$1" in --opt) ;; *) exit 2 ;; esac
- case "\$2" in --foo) ;; *) exit 2 ;; esac
- case "\$4" in --) ;; *) exit 2 ;; esac
- shift 2 &&
- >funny.was.run &&
- exec git merge-recursive "\$@"
+ cat >expect <<-\EOF &&
+ [7]
+ [--option=arg with space]
+ [--op"tion\]
+ [--new
+ line ]
+ [--]
EOF
- chmod +x test-bin/git-merge-funny &&
+
+ rm -f actual &&
(
PATH=./test-bin:$PATH &&
- test_must_fail git rebase -i -s funny -Xopt -Xfoo main topic
+ test_must_fail git rebase -s funny -X"option=arg with space" \
+ -Xop\"tion\\ -X"new${LF}line " main topic
) &&
- test -f funny.was.run &&
- rm funny.was.run &&
+ test_cmp expect actual &&
+ rm actual &&
echo "Resolved" >F2 &&
git add F2 &&
(
PATH=./test-bin:$PATH &&
git rebase --continue
) &&
- test -f funny.was.run
+ test_cmp expect actual
'
test_expect_success 'rebase -r passes merge strategy options correctly' '
diff --git a/t/t3419-rebase-patch-id.sh b/t/t3419-rebase-patch-id.sh
index 295040f2fe..6c61f240cf 100755
--- a/t/t3419-rebase-patch-id.sh
+++ b/t/t3419-rebase-patch-id.sh
@@ -5,6 +5,7 @@ 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 () {
@@ -43,15 +44,26 @@ test_expect_success 'setup: 500 lines' '
git add newfile &&
git commit -q -m "add small file" &&
- git cherry-pick main >/dev/null 2>&1
-'
+ git cherry-pick main >/dev/null 2>&1 &&
+
+ git branch -f squashed main &&
+ git checkout -q -f squashed &&
+ git reset -q --soft HEAD~2 &&
+ git commit -q -m squashed &&
+
+ git branch -f mode main &&
+ git checkout -q -f mode &&
+ test_chmod +x file &&
+ git commit -q -a --amend &&
-test_expect_success 'setup attributes' '
- echo "file binary" >.gitattributes
+ git branch -f modeother other &&
+ git checkout -q -f modeother &&
+ test_chmod +x file &&
+ git commit -q -a --amend
'
test_expect_success 'detect upstream patch' '
- git checkout -q main &&
+ git checkout -q main^{} &&
scramble file &&
git add file &&
git commit -q -m "change big file again" &&
@@ -61,14 +73,46 @@ test_expect_success 'detect upstream patch' '
test_must_be_empty revs
'
+test_expect_success 'detect upstream patch binary' '
+ echo "file binary" >.gitattributes &&
+ git checkout -q other^{} &&
+ git rebase main &&
+ git rev-list main...HEAD~ >revs &&
+ test_must_be_empty revs &&
+ test_when_finished "rm .gitattributes"
+'
+
+test_expect_success 'detect upstream patch modechange' '
+ git checkout -q modeother^{} &&
+ git rebase mode &&
+ git rev-list mode...HEAD~ >revs &&
+ test_must_be_empty revs
+'
+
test_expect_success 'do not drop patch' '
- git branch -f squashed main &&
- git checkout -q -f squashed &&
- git reset -q --soft HEAD~2 &&
- git commit -q -m squashed &&
git checkout -q other^{} &&
test_must_fail git rebase squashed &&
- git rebase --quit
+ test_when_finished "git rebase --abort"
+'
+
+test_expect_success 'do not drop patch binary' '
+ echo "file binary" >.gitattributes &&
+ git checkout -q other^{} &&
+ test_must_fail git rebase squashed &&
+ test_when_finished "git rebase --abort" &&
+ test_when_finished "rm .gitattributes"
+'
+
+test_expect_success 'do not drop patch modechange' '
+ git checkout -q modeother^{} &&
+ git rebase other &&
+ cat >expected <<-\EOF &&
+ diff --git a/file b/file
+ old mode 100644
+ new mode 100755
+ EOF
+ git diff HEAD~ >modediff &&
+ test_cmp expected modediff
'
test_done
diff --git a/t/t3422-rebase-incompatible-options.sh b/t/t3422-rebase-incompatible-options.sh
index 6dabb05a2a..2eba00bdf5 100755
--- a/t/t3422-rebase-incompatible-options.sh
+++ b/t/t3422-rebase-incompatible-options.sh
@@ -25,11 +25,11 @@ test_expect_success 'setup' '
'
#
-# Rebase has lots of useful options like --whitepsace=fix, which are
-# actually all built in terms of flags to git-am. Since neither
-# --merge nor --interactive (nor any options that imply those two) use
-# git-am, using them together will result in flags like --whitespace=fix
-# being ignored. Make sure rebase warns the user and aborts instead.
+# Rebase has a couple options which are specific to the apply backend,
+# and several options which are specific to the merge backend. Flags
+# from the different sets cannot work together, and we do not want to
+# just ignore one of the sets of flags. Make sure rebase warns the
+# user and aborts instead.
#
test_rebase_am_only () {
@@ -50,6 +50,11 @@ test_rebase_am_only () {
test_must_fail git rebase $opt --strategy-option=ours A
"
+ test_expect_success "$opt incompatible with --autosquash" "
+ git checkout B^0 &&
+ test_must_fail git rebase $opt --autosquash A
+ "
+
test_expect_success "$opt incompatible with --interactive" "
git checkout B^0 &&
test_must_fail git rebase $opt --interactive A
@@ -60,9 +65,82 @@ test_rebase_am_only () {
test_must_fail git rebase $opt --exec 'true' A
"
+ test_expect_success "$opt incompatible with --keep-empty" "
+ git checkout B^0 &&
+ test_must_fail git rebase $opt --keep-empty A
+ "
+
+ test_expect_success "$opt incompatible with --empty=..." "
+ git checkout B^0 &&
+ test_must_fail git rebase $opt --empty=ask A
+ "
+
+ test_expect_success "$opt incompatible with --no-reapply-cherry-picks" "
+ git checkout B^0 &&
+ test_must_fail git rebase $opt --no-reapply-cherry-picks A
+ "
+
+ test_expect_success "$opt incompatible with --reapply-cherry-picks" "
+ git checkout B^0 &&
+ test_must_fail git rebase $opt --reapply-cherry-picks A
+ "
+
+ test_expect_success "$opt incompatible with --rebase-merges" "
+ git checkout B^0 &&
+ test_must_fail git rebase $opt --rebase-merges A
+ "
+
+ test_expect_success "$opt incompatible with --update-refs" "
+ git checkout B^0 &&
+ test_must_fail git rebase $opt --update-refs A
+ "
+
+ test_expect_success "$opt incompatible with --root without --onto" "
+ git checkout B^0 &&
+ test_must_fail git rebase $opt --root A
+ "
+
+ test_expect_success "$opt incompatible with rebase.autosquash" "
+ git checkout B^0 &&
+ test_must_fail git -c rebase.autosquash=true rebase $opt A 2>err &&
+ grep -e --no-autosquash err
+ "
+
+ test_expect_success "$opt incompatible with rebase.rebaseMerges" "
+ git checkout B^0 &&
+ test_must_fail git -c rebase.rebaseMerges=true rebase $opt A 2>err &&
+ grep -e --no-rebase-merges err
+ "
+
+ test_expect_success "$opt incompatible with rebase.updateRefs" "
+ git checkout B^0 &&
+ test_must_fail git -c rebase.updateRefs=true rebase $opt A 2>err &&
+ grep -e --no-update-refs err
+ "
+
+ test_expect_success "$opt okay with overridden rebase.autosquash" "
+ test_when_finished \"git reset --hard B^0\" &&
+ git checkout B^0 &&
+ git -c rebase.autosquash=true rebase --no-autosquash $opt A
+ "
+
+ test_expect_success "$opt okay with overridden rebase.rebaseMerges" "
+ test_when_finished \"git reset --hard B^0\" &&
+ git checkout B^0 &&
+ git -c rebase.rebaseMerges=true rebase --no-rebase-merges $opt A
+ "
+
+ test_expect_success "$opt okay with overridden rebase.updateRefs" "
+ test_when_finished \"git reset --hard B^0\" &&
+ git checkout B^0 &&
+ git -c rebase.updateRefs=true rebase --no-update-refs $opt A
+ "
}
+# Check options which imply --apply
test_rebase_am_only --whitespace=fix
test_rebase_am_only -C4
+# Also check an explicit --apply
+test_rebase_am_only --apply
test_done
diff --git a/t/t3423-rebase-reword.sh b/t/t3423-rebase-reword.sh
index 4859bb8f72..2fab703d61 100755
--- a/t/t3423-rebase-reword.sh
+++ b/t/t3423-rebase-reword.sh
@@ -2,6 +2,7 @@
test_description='git rebase interactive with rewording'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh
diff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh
index 63acc1ea4d..a16428bdf5 100755
--- a/t/t3425-rebase-topology-merges.sh
+++ b/t/t3425-rebase-topology-merges.sh
@@ -1,6 +1,8 @@
#!/bin/sh
test_description='rebase topology tests with merges'
+
+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 f6993b7e14..e1b1e94764 100755
--- a/t/t3428-rebase-signoff.sh
+++ b/t/t3428-rebase-signoff.sh
@@ -5,6 +5,7 @@ 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
# A simple file to commit
diff --git a/t/t3429-rebase-edit-todo.sh b/t/t3429-rebase-edit-todo.sh
index abd66f3602..8e0d03969a 100755
--- a/t/t3429-rebase-edit-todo.sh
+++ b/t/t3429-rebase-edit-todo.sh
@@ -2,6 +2,7 @@
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 f351701fec..f03599c63b 100755
--- a/t/t3430-rebase-merges.sh
+++ b/t/t3430-rebase-merges.sh
@@ -138,6 +138,23 @@ test_expect_success '`reset` refuses to overwrite untracked files' '
git rebase --abort
'
+test_expect_success '`reset` rejects trees' '
+ test_when_finished "test_might_fail git rebase --abort" &&
+ test_must_fail env GIT_SEQUENCE_EDITOR="echo reset A^{tree} >" \
+ git rebase -i B C >out 2>err &&
+ grep "object .* is a tree" err &&
+ test_must_be_empty out
+'
+
+test_expect_success '`reset` only looks for labels under refs/rewritten/' '
+ test_when_finished "test_might_fail git rebase --abort" &&
+ git branch refs/rewritten/my-label A &&
+ test_must_fail env GIT_SEQUENCE_EDITOR="echo reset my-label >" \
+ git rebase -i B C >out 2>err &&
+ grep "could not resolve ${SQ}my-label${SQ}" err &&
+ test_must_be_empty out
+'
+
test_expect_success 'failed `merge -C` writes patch (may be rescheduled, too)' '
test_when_finished "test_might_fail git rebase --abort" &&
git checkout -b conflicting-merge A &&
@@ -233,6 +250,16 @@ test_expect_success 'with a branch tip that was cherry-picked already' '
EOF
'
+test_expect_success '--no-rebase-merges countermands --rebase-merges' '
+ git checkout -b no-rebase-merges E &&
+ git rebase --rebase-merges --no-rebase-merges C &&
+ test_cmp_graph C.. <<-\EOF
+ * B
+ * D
+ o C
+ EOF
+'
+
test_expect_success 'do not rebase cousins unless asked for' '
git checkout -b cousins main &&
before="$(git rev-parse --verify HEAD)" &&
@@ -251,6 +278,40 @@ test_expect_success 'do not rebase cousins unless asked for' '
EOF
'
+test_expect_success 'rebase.rebaseMerges=rebase-cousins is equivalent to --rebase-merges=rebase-cousins' '
+ test_config rebase.rebaseMerges rebase-cousins &&
+ git checkout -b config-rebase-cousins main &&
+ git rebase HEAD^ &&
+ test_cmp_graph HEAD^.. <<-\EOF
+ * Merge the topic branch '\''onebranch'\''
+ |\
+ | * D
+ | * G
+ |/
+ o H
+ EOF
+'
+
+test_expect_success '--no-rebase-merges overrides rebase.rebaseMerges=no-rebase-cousins' '
+ test_config rebase.rebaseMerges no-rebase-cousins &&
+ git checkout -b override-config-no-rebase-cousins E &&
+ git rebase --no-rebase-merges C &&
+ test_cmp_graph C.. <<-\EOF
+ * B
+ * D
+ o C
+ EOF
+'
+
+test_expect_success '--rebase-merges overrides rebase.rebaseMerges=rebase-cousins' '
+ test_config rebase.rebaseMerges rebase-cousins &&
+ git checkout -b override-config-rebase-cousins E &&
+ before="$(git rev-parse --verify HEAD)" &&
+ test_tick &&
+ git rebase --rebase-merges C &&
+ test_cmp_rev HEAD $before
+'
+
test_expect_success 'refs/rewritten/* is worktree-local' '
git worktree add wt &&
cat >wt/script-from-scratch <<-\EOF &&
diff --git a/t/t3431-rebase-fork-point.sh b/t/t3431-rebase-fork-point.sh
index 1d0b15380e..4bfc779bb8 100755
--- a/t/t3431-rebase-fork-point.sh
+++ b/t/t3431-rebase-fork-point.sh
@@ -8,6 +8,7 @@ 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)
@@ -50,7 +51,7 @@ test_rebase () {
test_rebase 'G F E D B A'
test_rebase 'G F D B A' --onto D
-test_rebase 'G F B A' --keep-base
+test_rebase 'G F C B A' --keep-base
test_rebase 'G F C E D B A' --no-fork-point
test_rebase 'G F C D B A' --no-fork-point --onto D
test_rebase 'G F C B A' --no-fork-point --keep-base
diff --git a/t/t3432-rebase-fast-forward.sh b/t/t3432-rebase-fast-forward.sh
index 5086e14c02..7f1a5dd3de 100755
--- a/t/t3432-rebase-fast-forward.sh
+++ b/t/t3432-rebase-fast-forward.sh
@@ -8,6 +8,7 @@ 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 05df964670..c8172b0852 100755
--- a/t/t3433-rebase-across-mode-change.sh
+++ b/t/t3433-rebase-across-mode-change.sh
@@ -2,6 +2,7 @@
test_description='git rebase across mode change'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t3437-rebase-fixup-options.sh b/t/t3437-rebase-fixup-options.sh
index c023fefd68..dd3b301fa7 100755
--- a/t/t3437-rebase-fixup-options.sh
+++ b/t/t3437-rebase-fixup-options.sh
@@ -14,6 +14,7 @@ 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
@@ -50,6 +51,7 @@ test_expect_success 'setup' '
body
EOF
+ test_commit initial &&
test_commit A A &&
test_commit B B &&
get_author HEAD >expected-author &&
@@ -208,4 +210,29 @@ test_expect_success 'fixup -C works upon --autosquash with amend!' '
actual-squash-message
'
+test_expect_success 'fixup -[Cc]<commit> works' '
+ test_when_finished "test_might_fail git rebase --abort" &&
+ cat >todo <<-\EOF &&
+ pick A
+ fixup -CA1
+ pick B
+ fixup -cA2
+ EOF
+ (
+ set_replace_editor todo &&
+ FAKE_COMMIT_MESSAGE="edited and fixed up" \
+ git rebase -i initial initial
+ ) &&
+ git log --pretty=format:%B initial.. >actual &&
+ cat >expect <<-EOF &&
+ edited and fixed up
+ $EMPTY
+ new subject
+ $EMPTY
+ new
+ body
+ EOF
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t3438-rebase-broken-files.sh b/t/t3438-rebase-broken-files.sh
index b92a3ce46b..c614c4f2e4 100755
--- a/t/t3438-rebase-broken-files.sh
+++ b/t/t3438-rebase-broken-files.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index 1f4cfc3744..e2ef619323 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -1,18 +1,11 @@
#!/bin/sh
-test_description='test cherry-pick and revert with renames
-
- --
- + rename2: renames oops to opos
- + rename1: renames oops to spoo
- + added: adds extra line to oops
- ++ initial: has lines in oops
-
-'
+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 '
@@ -62,6 +55,14 @@ test_expect_success 'revert --nonsense' '
test_i18ngrep "[Uu]sage:" msg
'
+# the following two test cherry-pick and revert with renames
+#
+# --
+# + rename2: renames oops to opos
+# + rename1: renames oops to spoo
+# + added: adds extra line to oops
+# ++ initial: has lines in oops
+
test_expect_success 'cherry-pick after renaming branch' '
git checkout rename2 &&
diff --git a/t/t3502-cherry-pick-merge.sh b/t/t3502-cherry-pick-merge.sh
index 5495eacfec..1b2c0d6aca 100755
--- a/t/t3502-cherry-pick-merge.sh
+++ b/t/t3502-cherry-pick-merge.sh
@@ -11,6 +11,7 @@ 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 95fe4feaee..76d393dc8a 100755
--- a/t/t3503-cherry-pick-root.sh
+++ b/t/t3503-cherry-pick-root.sh
@@ -5,6 +5,7 @@ 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/t3506-cherry-pick-ff.sh b/t/t3506-cherry-pick-ff.sh
index 7e11bd4a4c..b71bad17b8 100755
--- a/t/t3506-cherry-pick-ff.sh
+++ b/t/t3506-cherry-pick-ff.sh
@@ -5,6 +5,7 @@ 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/t3511-cherry-pick-x.sh b/t/t3511-cherry-pick-x.sh
index 84a587daf3..dd5d92ef30 100755
--- a/t/t3511-cherry-pick-x.sh
+++ b/t/t3511-cherry-pick-x.sh
@@ -2,6 +2,7 @@
test_description='Test cherry-pick -x and -s'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
pristine_detach () {
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 8689b48589..82dd768944 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -106,24 +106,32 @@ test_expect_success '.gitignore test setup' '
test_expect_success '.gitignore is honored' '
git add . &&
- ! (git ls-files | grep "\\.ig")
+ git ls-files >files &&
+ sed -n "/\\.ig/p" <files >actual &&
+ test_must_be_empty actual
'
test_expect_success 'error out when attempting to add ignored ones without -f' '
test_must_fail git add a.?? &&
- ! (git ls-files | grep "\\.ig")
+ git ls-files >files &&
+ sed -n "/\\.ig/p" <files >actual &&
+ test_must_be_empty actual
'
test_expect_success 'error out when attempting to add ignored ones without -f' '
test_must_fail git add d.?? &&
- ! (git ls-files | grep "\\.ig")
+ git ls-files >files &&
+ sed -n "/\\.ig/p" <files >actual &&
+ test_must_be_empty actual
'
test_expect_success 'error out when attempting to add ignored ones but add others' '
touch a.if &&
test_must_fail git add a.?? &&
- ! (git ls-files | grep "\\.ig") &&
- (git ls-files | grep a.if)
+ git ls-files >files &&
+ sed -n "/\\.ig/p" <files >actual &&
+ test_must_be_empty actual &&
+ grep a.if files
'
test_expect_success 'add ignored ones with -f' '
@@ -291,7 +299,7 @@ test_expect_success BSLASHPSPEC "git add 'fo\\[ou\\]bar' ignores foobar" '
git reset --hard &&
touch fo\[ou\]bar foobar &&
git add '\''fo\[ou\]bar'\'' &&
- git ls-files fo\[ou\]bar | fgrep fo\[ou\]bar &&
+ git ls-files fo\[ou\]bar | grep -F fo\[ou\]bar &&
! ( git ls-files foobar | grep foobar )
'
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index 5841f280fb..3982b6b49d 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -7,12 +7,6 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-terminal.sh
-if test_have_prereq !ADD_I_USE_BUILTIN,!PERL
-then
- skip_all='skipping add -i (scripted) tests, perl not available'
- test_done
-fi
-
diff_cmp () {
for x
do
@@ -46,6 +40,21 @@ force_color () {
)
}
+test_expect_success 'warn about add.interactive.useBuiltin' '
+ cat >expect <<-\EOF &&
+ warning: the add.interactive.useBuiltin setting has been removed!
+ See its entry in '\''git help config'\'' for details.
+ No changes.
+ EOF
+
+ for v in = =true =false
+ do
+ git -c "add.interactive.useBuiltin$v" add -p >out 2>actual &&
+ test_must_be_empty out &&
+ test_cmp expect actual || return 1
+ done
+'
+
test_expect_success 'setup (initial)' '
echo content >file &&
git add file &&
@@ -296,9 +305,11 @@ test_expect_success FILEMODE 'stage mode and hunk' '
echo content >>file &&
chmod +x file &&
printf "y\\ny\\n" | git add -p &&
- git diff --cached file | grep "new mode" &&
- git diff --cached file | grep "+content" &&
- test -z "$(git diff file)"
+ git diff --cached file >out &&
+ grep "new mode" out &&
+ grep "+content" out &&
+ git diff file >out &&
+ test_must_be_empty out
'
# end of tests disabled when filemode is not usable
@@ -547,15 +558,7 @@ test_expect_success 'split hunk "add -p (edit)"' '
! grep "^+15" actual
'
-test_expect_success 'setup ADD_I_USE_BUILTIN check' '
- result=success &&
- if ! test_have_prereq ADD_I_USE_BUILTIN
- then
- result=failure
- fi
-'
-
-test_expect_$result 'split hunk "add -p (no, yes, edit)"' '
+test_expect_success 'split hunk "add -p (no, yes, edit)"' '
test_write_lines 5 10 20 21 30 31 40 50 60 >test &&
git reset &&
# test sequence is s(plit), n(o), y(es), e(dit)
@@ -579,7 +582,7 @@ test_expect_success 'split hunk with incomplete line at end' '
test_must_fail git grep --cached before
'
-test_expect_$result 'edit, adding lines to the first hunk' '
+test_expect_success 'edit, adding lines to the first hunk' '
test_write_lines 10 11 20 30 40 50 51 60 >test &&
git reset &&
tr _ " " >patch <<-EOF &&
@@ -1068,4 +1071,25 @@ test_expect_success 'show help from add--helper' '
test_cmp expect actual
'
+test_expect_success 'reset -p with unmerged files' '
+ test_when_finished "git checkout --force main" &&
+ test_commit one conflict &&
+ git checkout -B side HEAD^ &&
+ test_commit two conflict &&
+ test_must_fail git merge one &&
+
+ # this is a noop with only an unmerged entry
+ git reset -p &&
+
+ # add files that sort before and after unmerged entry
+ echo a >a &&
+ echo z >z &&
+ git add a z &&
+
+ # confirm that we can reset those files
+ printf "%s\n" y y | git reset -p &&
+ git diff-index --cached --diff-filter=u HEAD >staged &&
+ test_must_be_empty staged
+'
+
test_done
diff --git a/t/t3702-add-edit.sh b/t/t3702-add-edit.sh
index a1801a8cbd..82bfb2fd2a 100755
--- a/t/t3702-add-edit.sh
+++ b/t/t3702-add-edit.sh
@@ -100,7 +100,7 @@ EOF
echo "#!$SHELL_PATH" >fake-editor.sh
cat >> fake-editor.sh <<\EOF
-egrep -v '^index' "$1" >orig-patch &&
+grep -E -v '^index' "$1" >orig-patch &&
mv -f patch "$1"
EOF
diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh
index e3cf0ffbe5..d3e428ff46 100755
--- a/t/t3800-mktag.sh
+++ b/t/t3800-mktag.sh
@@ -4,6 +4,7 @@
test_description='git mktag: tag object verify test'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
###########################################################
diff --git a/t/t3920-crlf-messages.sh b/t/t3920-crlf-messages.sh
index 4c661d4d54..67fd2345af 100755
--- a/t/t3920-crlf-messages.sh
+++ b/t/t3920-crlf-messages.sh
@@ -12,7 +12,7 @@ create_crlf_ref () {
cat >.crlf-orig-$branch.txt &&
cat .crlf-orig-$branch.txt | append_cr >.crlf-message-$branch.txt &&
grep 'Subject' .crlf-orig-$branch.txt | tr '\n' ' ' | sed 's/[ ]*$//' | tr -d '\n' >.crlf-subject-$branch.txt &&
- grep 'Body' .crlf-message-$branch.txt >.crlf-body-$branch.txt || true &&
+ grep 'Body' .crlf-orig-$branch.txt | append_cr >.crlf-body-$branch.txt &&
LIB_CRLF_BRANCHES="${LIB_CRLF_BRANCHES} ${branch}" &&
test_tick &&
hash=$(git commit-tree HEAD^{tree} -p HEAD -F .crlf-message-${branch}.txt) &&
diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh
index c509143c81..c64d9d2f40 100755
--- a/t/t4012-diff-binary.sh
+++ b/t/t4012-diff-binary.sh
@@ -113,20 +113,20 @@ test_expect_success 'diff --no-index with binary creation' '
'
cat >expect <<EOF
- binfile | Bin 0 -> 1026 bytes
- textfile | 10000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ binfilë | Bin 0 -> 1026 bytes
+ tëxtfilë | 10000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
EOF
test_expect_success 'diff --stat with binary files and big change count' '
- printf "\01\00%1024d" 1 >binfile &&
- git add binfile &&
+ printf "\01\00%1024d" 1 >binfilë &&
+ git add binfilë &&
i=0 &&
while test $i -lt 10000; do
echo $i &&
i=$(($i + 1)) || return 1
- done >textfile &&
- git add textfile &&
- git diff --cached --stat binfile textfile >output &&
+ done >tëxtfilë &&
+ git add tëxtfilë &&
+ git -c core.quotepath=false diff --cached --stat binfilë tëxtfilë >output &&
grep " | " output >actual &&
test_cmp expect actual
'
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index dfcf3a0aaa..5de1d19075 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -616,4 +616,46 @@ test_expect_success 'diff -I<regex>: detect malformed regex' '
test_i18ngrep "invalid regex given to -I: " error
'
+# check_prefix <patch> <src> <dst>
+# check only lines with paths to avoid dependency on exact oid/contents
+check_prefix () {
+ grep -E '^(diff|---|\+\+\+) ' "$1" >actual.paths &&
+ cat >expect <<-EOF &&
+ diff --git $2 $3
+ --- $2
+ +++ $3
+ EOF
+ test_cmp expect actual.paths
+}
+
+test_expect_success 'diff-files does not respect diff.noprefix' '
+ git -c diff.noprefix diff-files -p >actual &&
+ check_prefix actual a/file0 b/file0
+'
+
+test_expect_success 'diff-files respects --no-prefix' '
+ git diff-files -p --no-prefix >actual &&
+ check_prefix actual file0 file0
+'
+
+test_expect_success 'diff respects diff.noprefix' '
+ git -c diff.noprefix diff >actual &&
+ check_prefix actual file0 file0
+'
+
+test_expect_success 'diff --default-prefix overrides diff.noprefix' '
+ git -c diff.noprefix diff --default-prefix >actual &&
+ check_prefix actual a/file0 b/file0
+'
+
+test_expect_success 'diff respects diff.mnemonicprefix' '
+ git -c diff.mnemonicprefix diff >actual &&
+ check_prefix actual i/file0 w/file0
+'
+
+test_expect_success 'diff --default-prefix overrides diff.mnemonicprefix' '
+ git -c diff.mnemonicprefix diff --default-prefix >actual &&
+ check_prefix actual a/file0 b/file0
+'
+
test_done
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index ad5c029279..3cf2b7a7fb 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -59,6 +59,10 @@ test_expect_success setup '
test_tick &&
git commit -m "patchid 3" &&
+ git checkout -b empty main &&
+ test_tick &&
+ git commit --allow-empty -m "empty commit" &&
+
git checkout main
'
@@ -128,6 +132,12 @@ test_expect_success 'replay did not screw up the log message' '
grep "^Side .* with .* backslash-n" actual
'
+test_expect_success 'format-patch empty commit' '
+ git format-patch --stdout main..empty >empty &&
+ grep "^From " empty >from &&
+ test_line_count = 1 from
+'
+
test_expect_success 'extra headers' '
git config format.headers "To: R E Cipient <rcipient@example.com>
" &&
@@ -445,13 +455,13 @@ test_expect_success 'no threading' '
cat >expect.thread <<EOF
---
-Message-Id: <0>
+Message-ID: <0>
---
-Message-Id: <1>
+Message-ID: <1>
In-Reply-To: <0>
References: <0>
---
-Message-Id: <2>
+Message-ID: <2>
In-Reply-To: <0>
References: <0>
EOF
@@ -460,17 +470,22 @@ test_expect_success 'thread' '
check_threading expect.thread --thread main
'
+test_expect_success '--thread overrides format.thread=deep' '
+ test_config format.thread deep &&
+ check_threading expect.thread --thread main
+'
+
cat >expect.in-reply-to <<EOF
---
-Message-Id: <0>
+Message-ID: <0>
In-Reply-To: <1>
References: <1>
---
-Message-Id: <2>
+Message-ID: <2>
In-Reply-To: <1>
References: <1>
---
-Message-Id: <3>
+Message-ID: <3>
In-Reply-To: <1>
References: <1>
EOF
@@ -482,17 +497,17 @@ test_expect_success 'thread in-reply-to' '
cat >expect.cover-letter <<EOF
---
-Message-Id: <0>
+Message-ID: <0>
---
-Message-Id: <1>
+Message-ID: <1>
In-Reply-To: <0>
References: <0>
---
-Message-Id: <2>
+Message-ID: <2>
In-Reply-To: <0>
References: <0>
---
-Message-Id: <3>
+Message-ID: <3>
In-Reply-To: <0>
References: <0>
EOF
@@ -503,21 +518,21 @@ test_expect_success 'thread cover-letter' '
cat >expect.cl-irt <<EOF
---
-Message-Id: <0>
+Message-ID: <0>
In-Reply-To: <1>
References: <1>
---
-Message-Id: <2>
+Message-ID: <2>
In-Reply-To: <0>
References: <1>
<0>
---
-Message-Id: <3>
+Message-ID: <3>
In-Reply-To: <0>
References: <1>
<0>
---
-Message-Id: <4>
+Message-ID: <4>
In-Reply-To: <0>
References: <1>
<0>
@@ -535,13 +550,13 @@ test_expect_success 'thread explicit shallow' '
cat >expect.deep <<EOF
---
-Message-Id: <0>
+Message-ID: <0>
---
-Message-Id: <1>
+Message-ID: <1>
In-Reply-To: <0>
References: <0>
---
-Message-Id: <2>
+Message-ID: <2>
In-Reply-To: <1>
References: <0>
<1>
@@ -553,16 +568,16 @@ test_expect_success 'thread deep' '
cat >expect.deep-irt <<EOF
---
-Message-Id: <0>
+Message-ID: <0>
In-Reply-To: <1>
References: <1>
---
-Message-Id: <2>
+Message-ID: <2>
In-Reply-To: <0>
References: <1>
<0>
---
-Message-Id: <3>
+Message-ID: <3>
In-Reply-To: <2>
References: <1>
<0>
@@ -576,18 +591,18 @@ test_expect_success 'thread deep in-reply-to' '
cat >expect.deep-cl <<EOF
---
-Message-Id: <0>
+Message-ID: <0>
---
-Message-Id: <1>
+Message-ID: <1>
In-Reply-To: <0>
References: <0>
---
-Message-Id: <2>
+Message-ID: <2>
In-Reply-To: <1>
References: <0>
<1>
---
-Message-Id: <3>
+Message-ID: <3>
In-Reply-To: <2>
References: <0>
<1>
@@ -600,22 +615,22 @@ test_expect_success 'thread deep cover-letter' '
cat >expect.deep-cl-irt <<EOF
---
-Message-Id: <0>
+Message-ID: <0>
In-Reply-To: <1>
References: <1>
---
-Message-Id: <2>
+Message-ID: <2>
In-Reply-To: <0>
References: <1>
<0>
---
-Message-Id: <3>
+Message-ID: <3>
In-Reply-To: <2>
References: <1>
<0>
<2>
---
-Message-Id: <4>
+Message-ID: <4>
In-Reply-To: <3>
References: <1>
<0>
@@ -1457,7 +1472,7 @@ append_signoff()
C=$(git commit-tree HEAD^^{tree} -p HEAD) &&
git format-patch --stdout --signoff $C^..$C >append_signoff.patch &&
sed -n -e "1,/^---$/p" append_signoff.patch |
- egrep -n "^Subject|Sign|^$"
+ grep -E -n "^Subject|Sign|^$"
}
test_expect_success 'signoff: commit with no body' '
@@ -2274,14 +2289,32 @@ test_expect_success 'format-patch --base with --attach' '
test_expect_success 'format-patch --attach cover-letter only is non-multipart' '
test_when_finished "rm -fr patches" &&
git format-patch -o patches --cover-letter --attach=mimemime --base=HEAD~ -1 &&
- ! egrep "^--+mimemime" patches/0000*.patch &&
- egrep "^--+mimemime$" patches/0001*.patch >output &&
+ ! grep -E "^--+mimemime" patches/0000*.patch &&
+ grep -E "^--+mimemime$" patches/0001*.patch >output &&
test_line_count = 2 output &&
- egrep "^--+mimemime--$" patches/0001*.patch >output &&
+ grep -E "^--+mimemime--$" patches/0001*.patch >output &&
test_line_count = 1 output
'
-test_expect_success 'format-patch --pretty=mboxrd' '
+test_expect_success 'format-patch with format.attach' '
+ test_when_finished "rm -fr patches" &&
+ separator=attachment-separator &&
+ test_config format.attach "$separator" &&
+ filename=$(git format-patch -o patches -1) &&
+ grep "^Content-Type: multipart/.*$separator" "$filename"
+'
+
+test_expect_success 'format-patch with format.attach=disabled' '
+ test_when_finished "rm -fr patches" &&
+ separator=attachment-separator &&
+ test_config_global format.attach "$separator" &&
+ test_config format.attach "" &&
+ filename=$(git format-patch -o patches -1) &&
+ # The output should not even declare content type for text/plain.
+ ! grep "^Content-Type: multipart/" "$filename"
+'
+
+test_expect_success '-c format.mboxrd format-patch' '
sp=" " &&
cat >msg <<-INPUT_END &&
mboxrd should escape the body
@@ -2316,7 +2349,9 @@ test_expect_success 'format-patch --pretty=mboxrd' '
INPUT_END
C=$(git commit-tree HEAD^^{tree} -p HEAD <msg) &&
- git format-patch --pretty=mboxrd --stdout -1 $C~1..$C >patch &&
+ git -c format.mboxrd format-patch --stdout -1 $C~1..$C >patch &&
+ git format-patch --pretty=mboxrd --stdout -1 $C~1..$C >compat &&
+ test_cmp patch compat &&
git grep -h --no-index -A11 \
"^>From could trip up a loose mbox parser" patch >actual &&
test_cmp expect actual
@@ -2366,4 +2401,20 @@ test_expect_success 'interdiff: solo-patch' '
test_cmp expect actual
'
+test_expect_success 'format-patch does not respect diff.noprefix' '
+ git -c diff.noprefix format-patch -1 --stdout >actual &&
+ grep "^--- a/blorp" actual
+'
+
+test_expect_success 'format-patch respects format.noprefix' '
+ git -c format.noprefix format-patch -1 --stdout >actual &&
+ grep "^--- blorp" actual
+'
+
+test_expect_success 'format-patch --default-prefix overrides format.noprefix' '
+ git -c format.noprefix \
+ format-patch -1 --default-prefix --stdout >actual &&
+ grep "^--- a/blorp" actual
+'
+
test_done
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index f3e20dd5bb..b298f220e0 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -1638,7 +1638,7 @@ test_expect_success 'no effect on diff from --color-moved with --word-diff' '
test_cmp expect actual
'
-test_expect_success !SANITIZE_LEAK 'no effect on show from --color-moved with --word-diff' '
+test_expect_success 'no effect on show from --color-moved with --word-diff' '
git show --color-moved --word-diff >actual &&
git show --word-diff >expect &&
test_cmp expect actual
@@ -2024,7 +2024,7 @@ test_expect_success '--color-moved rewinds for MIN_ALNUM_COUNT' '
test_cmp expected actual
'
-test_expect_success !SANITIZE_LEAK 'move detection with submodules' '
+test_expect_success 'move detection with submodules' '
test_create_repo bananas &&
echo ripe >bananas/recipe &&
git -C bananas add recipe &&
diff --git a/t/t4018/java-class-brace-on-separate-line b/t/t4018/java-class-brace-on-separate-line
new file mode 100644
index 0000000000..8795acd4cf
--- /dev/null
+++ b/t/t4018/java-class-brace-on-separate-line
@@ -0,0 +1,6 @@
+class RIGHT
+{
+ static int ONE;
+ static int TWO;
+ static int ChangeMe;
+}
diff --git a/t/t4018/java-class-space-before-type-parameters b/t/t4018/java-class-space-before-type-parameters
new file mode 100644
index 0000000000..0bdef1dfbe
--- /dev/null
+++ b/t/t4018/java-class-space-before-type-parameters
@@ -0,0 +1,6 @@
+class RIGHT <TYPE, PARAMS, AFTER, SPACE> {
+ static int ONE;
+ static int TWO;
+ static int THREE;
+ private A ChangeMe;
+}
diff --git a/t/t4018/java-class-type-parameters b/t/t4018/java-class-type-parameters
new file mode 100644
index 0000000000..579aa7af21
--- /dev/null
+++ b/t/t4018/java-class-type-parameters
@@ -0,0 +1,6 @@
+class RIGHT<A, B> {
+ static int ONE;
+ static int TWO;
+ static int THREE;
+ private A ChangeMe;
+}
diff --git a/t/t4018/java-class-type-parameters-implements b/t/t4018/java-class-type-parameters-implements
new file mode 100644
index 0000000000..b8038b1866
--- /dev/null
+++ b/t/t4018/java-class-type-parameters-implements
@@ -0,0 +1,6 @@
+class RIGHT<A, B> implements List<A> {
+ static int ONE;
+ static int TWO;
+ static int THREE;
+ private A ChangeMe;
+}
diff --git a/t/t4018/java-interface-type-parameters b/t/t4018/java-interface-type-parameters
new file mode 100644
index 0000000000..a4baa1ae68
--- /dev/null
+++ b/t/t4018/java-interface-type-parameters
@@ -0,0 +1,6 @@
+interface RIGHT<A, B> {
+ static int ONE;
+ static int TWO;
+ static int THREE;
+ public B foo(A ChangeMe);
+}
diff --git a/t/t4018/java-interface-type-parameters-extends b/t/t4018/java-interface-type-parameters-extends
new file mode 100644
index 0000000000..31d7fb3244
--- /dev/null
+++ b/t/t4018/java-interface-type-parameters-extends
@@ -0,0 +1,6 @@
+interface RIGHT<A, B> extends Function<A, B> {
+ static int ONE;
+ static int TWO;
+ static int THREE;
+ public B foo(A ChangeMe);
+}
diff --git a/t/t4018/java-non-sealed b/t/t4018/java-non-sealed
new file mode 100644
index 0000000000..069087c1c6
--- /dev/null
+++ b/t/t4018/java-non-sealed
@@ -0,0 +1,8 @@
+public abstract sealed class SealedClass {
+ public static non-sealed class RIGHT extends SealedClass {
+ static int ONE;
+ static int TWO;
+ static int THREE;
+ private int ChangeMe;
+ }
+}
diff --git a/t/t4018/java-record b/t/t4018/java-record
new file mode 100644
index 0000000000..97aa819dd8
--- /dev/null
+++ b/t/t4018/java-record
@@ -0,0 +1,6 @@
+public record RIGHT(int comp1, double comp2, String comp3) {
+ static int ONE;
+ static int TWO;
+ static int THREE;
+ static int ChangeMe;
+}
diff --git a/t/t4018/java-record-space-before-components b/t/t4018/java-record-space-before-components
new file mode 100644
index 0000000000..9827f22583
--- /dev/null
+++ b/t/t4018/java-record-space-before-components
@@ -0,0 +1,6 @@
+public record RIGHT (String components, String after, String space) {
+ static int ONE;
+ static int TWO;
+ static int THREE;
+ static int ChangeMe;
+}
diff --git a/t/t4018/java-record-type-parameters b/t/t4018/java-record-type-parameters
new file mode 100644
index 0000000000..f62a035cc8
--- /dev/null
+++ b/t/t4018/java-record-type-parameters
@@ -0,0 +1,6 @@
+public record RIGHT<A, N extends Number>(A comp1, N comp2, int comp3) {
+ static int ONE;
+ static int TWO;
+ static int THREE;
+ static int ChangeMe;
+}
diff --git a/t/t4018/java-sealed b/t/t4018/java-sealed
new file mode 100644
index 0000000000..785fbc62bc
--- /dev/null
+++ b/t/t4018/java-sealed
@@ -0,0 +1,7 @@
+public abstract sealed class Sealed { // RIGHT
+ static int ONE;
+ static int TWO;
+ static int THREE;
+ public final class ChangeMe extends Sealed {
+ }
+}
diff --git a/t/t4018/java-sealed-permits b/t/t4018/java-sealed-permits
new file mode 100644
index 0000000000..18dd4894cf
--- /dev/null
+++ b/t/t4018/java-sealed-permits
@@ -0,0 +1,6 @@
+public abstract sealed class RIGHT permits PermittedA, PermittedB {
+ static int ONE;
+ static int TWO;
+ static int THREE;
+ private int ChangeMe;
+}
diff --git a/t/t4018/java-sealed-type-parameters b/t/t4018/java-sealed-type-parameters
new file mode 100644
index 0000000000..e6530c47c3
--- /dev/null
+++ b/t/t4018/java-sealed-type-parameters
@@ -0,0 +1,6 @@
+public abstract sealed class RIGHT<A, B> {
+ static int ONE;
+ static int TWO;
+ static int THREE;
+ private int ChangeMe;
+}
diff --git a/t/t4018/java-sealed-type-parameters-implements-permits b/t/t4018/java-sealed-type-parameters-implements-permits
new file mode 100644
index 0000000000..bd6e6d3582
--- /dev/null
+++ b/t/t4018/java-sealed-type-parameters-implements-permits
@@ -0,0 +1,6 @@
+public abstract sealed class RIGHT<A, B> implements List<A> permits PermittedA, PermittedB {
+ static int ONE;
+ static int TWO;
+ static int THREE;
+ private int ChangeMe;
+}
diff --git a/t/t4018/java-sealed-type-parameters-permits b/t/t4018/java-sealed-type-parameters-permits
new file mode 100644
index 0000000000..25a0da6442
--- /dev/null
+++ b/t/t4018/java-sealed-type-parameters-permits
@@ -0,0 +1,6 @@
+public abstract sealed class RIGHT<A, B> permits PermittedA, PermittedB {
+ static int ONE;
+ static int TWO;
+ static int THREE;
+ private int ChangeMe;
+}
diff --git a/t/t4023-diff-rename-typechange.sh b/t/t4023-diff-rename-typechange.sh
index 7cb9909293..787605ce3f 100755
--- a/t/t4023-diff-rename-typechange.sh
+++ b/t/t4023-diff-rename-typechange.sh
@@ -52,8 +52,8 @@ test_expect_success setup '
'
test_expect_success 'cross renames to be detected for regular files' '
-
- git diff-tree five six -r --name-status -B -M | sort >actual &&
+ git diff-tree five six -r --name-status -B -M >out &&
+ sort out >actual &&
{
echo "R100 foo bar" &&
echo "R100 bar foo"
@@ -63,8 +63,8 @@ test_expect_success 'cross renames to be detected for regular files' '
'
test_expect_success 'cross renames to be detected for typechange' '
-
- git diff-tree one two -r --name-status -B -M | sort >actual &&
+ git diff-tree one two -r --name-status -B -M >out &&
+ sort out >actual &&
{
echo "R100 foo bar" &&
echo "R100 bar foo"
@@ -74,8 +74,8 @@ test_expect_success 'cross renames to be detected for typechange' '
'
test_expect_success 'moves and renames' '
-
- git diff-tree three four -r --name-status -B -M | sort >actual &&
+ git diff-tree three four -r --name-status -B -M >out &&
+ sort out >actual &&
{
# see -B -M (#6) in t4008
echo "C100 foo bar" &&
diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index 15764ee9ac..74586f3813 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -69,6 +69,10 @@ test_language_driver () {
echo "* diff='"$lang"'" >.gitattributes &&
word_diff --color-words
'
+ test_expect_success "diff driver '$lang' in Islandic" '
+ LANG=is_IS.UTF-8 LANGUAGE=is LC_ALL="$is_IS_locale" \
+ word_diff --color-words
+ '
}
test_expect_success setup '
diff --git a/t/t4038-diff-combined.sh b/t/t4038-diff-combined.sh
index 9a292bac70..2ce26e585c 100755
--- a/t/t4038-diff-combined.sh
+++ b/t/t4038-diff-combined.sh
@@ -80,11 +80,21 @@ test_expect_success 'check combined output (1)' '
verify_helper sidewithone
'
+test_expect_success 'check combined output (1) with git diff <rev>^!' '
+ git diff sidewithone^! -- >sidewithone &&
+ verify_helper sidewithone
+'
+
test_expect_success 'check combined output (2)' '
git show sidesansone -- >sidesansone &&
verify_helper sidesansone
'
+test_expect_success 'check combined output (2) with git diff <rev>^!' '
+ git diff sidesansone^! -- >sidesansone &&
+ verify_helper sidesansone
+'
+
test_expect_success 'diagnose truncated file' '
>file &&
git add file &&
diff --git a/t/t4044-diff-index-unique-abbrev.sh b/t/t4044-diff-index-unique-abbrev.sh
index 29e49d2290..9f6043daba 100755
--- a/t/t4044-diff-index-unique-abbrev.sh
+++ b/t/t4044-diff-index-unique-abbrev.sh
@@ -34,12 +34,12 @@ test_expect_success 'setup' '
100644 blob $(test_oid hash2) foo
EOF
- echo "$(test_oid val1)" > foo &&
+ test_oid val1 > foo &&
git add foo &&
git commit -m "initial" &&
git cat-file -p HEAD: > actual &&
test_cmp expect_initial actual &&
- echo "$(test_oid val2)" > foo &&
+ test_oid val2 > foo &&
git commit -a -m "update" &&
git cat-file -p HEAD: > actual &&
test_cmp expect_update actual
diff --git a/t/t4045-diff-relative.sh b/t/t4045-diff-relative.sh
index fab351b48a..9b46c4c1be 100755
--- a/t/t4045-diff-relative.sh
+++ b/t/t4045-diff-relative.sh
@@ -1,6 +1,8 @@
#!/bin/sh
test_description='diff --relative tests'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
@@ -162,6 +164,35 @@ check_diff_relative_option subdir file2 true --no-relative --relative
check_diff_relative_option . file2 false --no-relative --relative=subdir
check_diff_relative_option . file2 true --no-relative --relative=subdir
+test_expect_success 'external diff with --relative' '
+ test_when_finished "git reset --hard" &&
+ echo changed >file1 &&
+ echo changed >subdir/file2 &&
+
+ write_script mydiff <<-\EOF &&
+ # hacky pretend diff; the goal here is just to make sure we got
+ # passed sensible input that we _could_ diff, without relying on
+ # the specific output of a system diff tool.
+ echo "diff a/$1 b/$1" &&
+ echo "--- a/$1" &&
+ echo "+++ b/$1" &&
+ echo "@@ -1 +0,0 @@" &&
+ sed "s/^/-/" "$2" &&
+ sed "s/^/+/" "$5"
+ EOF
+
+ cat >expect <<-\EOF &&
+ diff a/file2 b/file2
+ --- a/file2
+ +++ b/file2
+ @@ -1 +0,0 @@
+ -other content
+ +changed
+ EOF
+ GIT_EXTERNAL_DIFF=./mydiff git diff --relative=subdir >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'setup diff --relative unmerged' '
test_commit zero file0 &&
test_commit base subdir/file0 &&
diff --git a/t/t4046-diff-unmerged.sh b/t/t4046-diff-unmerged.sh
index 0ae0cd3a52..ffaf69335f 100755
--- a/t/t4046-diff-unmerged.sh
+++ b/t/t4046-diff-unmerged.sh
@@ -86,4 +86,14 @@ test_expect_success 'diff-files -3' '
test_cmp diff-files-3.expect diff-files-3.actual
'
+test_expect_success 'diff --stat' '
+ for path in $paths
+ do
+ echo " $path | Unmerged" || return 1
+ done >diff-stat.expect &&
+ echo " 0 files changed" >>diff-stat.expect &&
+ git diff --cached --stat >diff-stat.actual &&
+ test_cmp diff-stat.expect diff-stat.actual
+'
+
test_done
diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh
index b5c281edaa..3ee27e277d 100755
--- a/t/t4052-stat-output.sh
+++ b/t/t4052-stat-output.sh
@@ -8,6 +8,7 @@ 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 3feadf0e35..4e9fa0403d 100755
--- a/t/t4053-diff-no-index.sh
+++ b/t/t4053-diff-no-index.sh
@@ -2,6 +2,7 @@
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 294fb55313..05c88f8cdf 100755
--- a/t/t4054-diff-bogus-tree.sh
+++ b/t/t4054-diff-bogus-tree.sh
@@ -10,7 +10,7 @@ test_expect_success 'create bogus tree' '
bogus_tree=$(
printf "100644 fooQ$name" |
q_to_nul |
- git hash-object -w --stdin -t tree
+ git hash-object --literally -w --stdin -t tree
)
'
diff --git a/t/t4058-diff-duplicates.sh b/t/t4058-diff-duplicates.sh
index 54614b814d..2501c89c1c 100755
--- a/t/t4058-diff-duplicates.sh
+++ b/t/t4058-diff-duplicates.sh
@@ -29,7 +29,7 @@ make_tree () {
make_tree_entry "$1" "$2" "$3"
shift; shift; shift
done |
- git hash-object -w -t tree --stdin
+ git hash-object --literally -w -t tree --stdin
}
# this is kind of a convoluted setup, but matches
diff --git a/t/t4067-diff-partial-clone.sh b/t/t4067-diff-partial-clone.sh
index 28f42a4046..f60f5cbd65 100755
--- a/t/t4067-diff-partial-clone.sh
+++ b/t/t4067-diff-partial-clone.sh
@@ -2,6 +2,7 @@
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/t4111-apply-subdir.sh b/t/t4111-apply-subdir.sh
index 1618a6dbc7..e9a87d761d 100755
--- a/t/t4111-apply-subdir.sh
+++ b/t/t4111-apply-subdir.sh
@@ -2,6 +2,7 @@
test_description='patching from inconvenient places'
+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 6bc3fb97a7..d3502c6fdd 100755
--- a/t/t4135-apply-weird-filenames.sh
+++ b/t/t4135-apply-weird-filenames.sh
@@ -2,6 +2,7 @@
test_description='git apply with weird postimage filenames'
+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
new file mode 100755
index 0000000000..58742d4fc5
--- /dev/null
+++ b/t/t4141-apply-too-large.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+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' '
+ sz=$((1024 * 1024 * 1023)) &&
+ {
+ cat <<-\EOF &&
+ diff --git a/file b/file
+ new file mode 100644
+ --- /dev/null
+ +++ b/file
+ @@ -0,0 +1 @@
+ EOF
+ test-tool genzeros
+ } | test_copy_bytes $sz | test_must_fail git apply 2>err &&
+ grep "git apply: failed to read" err
+'
+
+test_done
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index cdad4b6880..2935fe1b2d 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -103,7 +103,7 @@ test_expect_success setup '
git format-patch --stdout first >patch1 &&
{
- echo "Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>" &&
+ echo "Message-ID: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>" &&
echo "X-Fake-Field: Line One" &&
echo "X-Fake-Field: Line Two" &&
echo "X-Fake-Field: Line Three" &&
@@ -345,6 +345,21 @@ test_expect_success 'am with failing applypatch-msg hook' '
test_cmp_rev first HEAD
'
+test_expect_success 'am with failing applypatch-msg hook (no verify)' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout first &&
+ test_hook applypatch-msg <<-\EOF &&
+ echo hook-message >"$1"
+ exit 1
+ EOF
+ git am --no-verify patch1 &&
+ test_path_is_missing .git/rebase-apply &&
+ git diff --exit-code second &&
+ git log -1 --format=format:%B >actual &&
+ test_cmp msg actual
+'
+
test_expect_success 'am with pre-applypatch hook' '
rm -fr .git/rebase-apply &&
git reset --hard &&
@@ -374,6 +389,23 @@ test_expect_success 'am with failing pre-applypatch hook' '
test_cmp_rev first HEAD
'
+test_expect_success 'am with failing pre-applypatch hook (no verify)' '
+ rm -fr .git/rebase-apply &&
+ git reset --hard &&
+ git checkout first &&
+ touch empty-file &&
+ test_hook pre-applypatch <<-\EOF &&
+ rm empty-file
+ exit 1
+ EOF
+ git am --no-verify patch1 &&
+ test_path_is_missing .git/rebase-apply &&
+ test_path_is_file empty-file &&
+ git diff --exit-code second &&
+ git log -1 --format=format:%B >actual &&
+ test_cmp msg actual
+'
+
test_expect_success 'am with post-applypatch hook' '
rm -fr .git/rebase-apply &&
git reset --hard &&
@@ -910,7 +942,7 @@ test_expect_success 'am --message-id really adds the message id' '
git am --message-id patch1.eml &&
test_path_is_missing .git/rebase-apply &&
git cat-file commit HEAD | tail -n1 >actual &&
- grep Message-Id patch1.eml >expected &&
+ grep Message-ID patch1.eml >expected &&
test_cmp expected actual
'
@@ -922,7 +954,7 @@ test_expect_success 'am.messageid really adds the message id' '
git am patch1.eml &&
test_path_is_missing .git/rebase-apply &&
git cat-file commit HEAD | tail -n1 >actual &&
- grep Message-Id patch1.eml >expected &&
+ grep Message-ID patch1.eml >expected &&
test_cmp expected actual
'
@@ -933,7 +965,7 @@ test_expect_success 'am --message-id -s signs off after the message id' '
git am -s --message-id patch1.eml &&
test_path_is_missing .git/rebase-apply &&
git cat-file commit HEAD | tail -n2 | head -n1 >actual &&
- grep Message-Id patch1.eml >expected &&
+ grep Message-ID patch1.eml >expected &&
test_cmp expected actual
'
@@ -1033,7 +1065,7 @@ test_expect_success 'am --patch-format=mboxrd handles mboxrd' '
>From extra escape for reversibility
INPUT_END
git commit -F msg &&
- git format-patch --pretty=mboxrd --stdout -1 >mboxrd1 &&
+ git -c format.mboxrd format-patch --stdout -1 >mboxrd1 &&
grep "^>From could trip up a loose mbox parser" mboxrd1 &&
git checkout -f first &&
git am --patch-format=mboxrd mboxrd1 &&
diff --git a/t/t4152-am-subjects.sh b/t/t4152-am-subjects.sh
index 4c68245aca..9f2edba1f8 100755
--- a/t/t4152-am-subjects.sh
+++ b/t/t4152-am-subjects.sh
@@ -1,6 +1,8 @@
#!/bin/sh
test_description='test subject preservation with format-patch | am'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
make_patches() {
diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh
index 3095b1b2ff..8e4effebdb 100755
--- a/t/t4201-shortlog.sh
+++ b/t/t4201-shortlog.sh
@@ -83,6 +83,13 @@ test_expect_success 'pretty format' '
test_cmp expect log.predictable
'
+test_expect_success 'pretty format (with --date)' '
+ sed "s/SUBJECT/2005-04-07 OBJECT_NAME/" expect.template >expect &&
+ git shortlog --format="%ad %H" --date=short HEAD >log &&
+ fuzz log >log.predictable &&
+ test_cmp expect log.predictable
+'
+
test_expect_success '--abbrev' '
sed s/SUBJECT/OBJID/ expect.template >expect &&
git shortlog --format="%h" --abbrev=35 HEAD >log &&
@@ -237,6 +244,26 @@ test_expect_success 'shortlog --group=trailer:signed-off-by' '
test_cmp expect actual
'
+test_expect_success 'shortlog --group=format' '
+ git shortlog -s --date="format:%Y" --group="format:%cN (%cd)" \
+ HEAD >actual &&
+ cat >expect <<-\EOF &&
+ 4 C O Mitter (2005)
+ 1 Sin Nombre (2005)
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'shortlog --group=<format> DWIM' '
+ git shortlog -s --date="format:%Y" --group="%cN (%cd)" HEAD >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'shortlog bogus --group' '
+ test_must_fail git shortlog --group=bogus HEAD 2>err &&
+ grep "unknown group type" err
+'
+
test_expect_success 'trailer idents are split' '
cat >expect <<-\EOF &&
2 C O Mitter
@@ -319,6 +346,18 @@ test_expect_success 'shortlog can match multiple groups' '
test_cmp expect actual
'
+test_expect_success 'shortlog can match multiple format groups' '
+ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" \
+ git commit --allow-empty -m "identical names" &&
+ test_tick &&
+ cat >expect <<-\EOF &&
+ 2 A U Thor
+ 1 C O Mitter
+ EOF
+ git shortlog -ns --group="%cn" --group="%an" -2 HEAD >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'set up option selection tests' '
git commit --allow-empty -F - <<-\EOF
subject
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index cc15cb4ff6..ae73aef922 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -249,6 +249,15 @@ test_expect_success 'log --grep' '
test_cmp expect actual
'
+for noop_opt in --invert-grep --all-match
+do
+ test_expect_success "log $noop_opt without --grep is a NOOP" '
+ git log >expect &&
+ git log $noop_opt >actual &&
+ test_cmp expect actual
+ '
+done
+
cat > expect << EOF
second
initial
@@ -826,6 +835,21 @@ test_expect_success 'log.decorate configuration' '
'
+test_expect_success 'parse log.excludeDecoration with no value' '
+ cp .git/config .git/config.orig &&
+ test_when_finished mv .git/config.orig .git/config &&
+
+ cat >>.git/config <<-\EOF &&
+ [log]
+ excludeDecoration
+ EOF
+ cat >expect <<-\EOF &&
+ error: missing value for '\''log.excludeDecoration'\''
+ EOF
+ git log --decorate=short 2>actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'decorate-refs with glob' '
cat >expect.decorate <<-\EOF &&
Merge-tag-reach
diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
index cd1cab3e54..fa7f987284 100755
--- a/t/t4203-mailmap.sh
+++ b/t/t4203-mailmap.sh
@@ -1022,4 +1022,69 @@ test_expect_success '--mailmap enables mailmap in cat-file for annotated tag obj
test_cmp expect actual
'
+test_expect_success 'git cat-file -s returns correct size with --use-mailmap' '
+ test_when_finished "rm .mailmap" &&
+ cat >.mailmap <<-\EOF &&
+ C O Mitter <committer@example.com> Orig <orig@example.com>
+ EOF
+ git cat-file commit HEAD >commit.out &&
+ echo $(wc -c <commit.out) >expect &&
+ git cat-file --use-mailmap commit HEAD >commit.out &&
+ echo $(wc -c <commit.out) >>expect &&
+ git cat-file -s HEAD >actual &&
+ git cat-file --use-mailmap -s HEAD >>actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'git cat-file -s returns correct size with --use-mailmap for tag objects' '
+ test_when_finished "rm .mailmap" &&
+ cat >.mailmap <<-\EOF &&
+ Orig <orig@example.com> C O Mitter <committer@example.com>
+ EOF
+ git tag -a -m "annotated tag" v3 &&
+ git cat-file tag v3 >tag.out &&
+ echo $(wc -c <tag.out) >expect &&
+ git cat-file --use-mailmap tag v3 >tag.out &&
+ echo $(wc -c <tag.out) >>expect &&
+ git cat-file -s v3 >actual &&
+ git cat-file --use-mailmap -s v3 >>actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'git cat-file --batch-check returns correct size with --use-mailmap' '
+ test_when_finished "rm .mailmap" &&
+ cat >.mailmap <<-\EOF &&
+ C O Mitter <committer@example.com> Orig <orig@example.com>
+ EOF
+ git cat-file commit HEAD >commit.out &&
+ commit_size=$(wc -c <commit.out) &&
+ commit_sha=$(git rev-parse HEAD) &&
+ echo $commit_sha commit $commit_size >expect &&
+ git cat-file --use-mailmap commit HEAD >commit.out &&
+ commit_size=$(wc -c <commit.out) &&
+ echo $commit_sha commit $commit_size >>expect &&
+ echo "HEAD" >in &&
+ git cat-file --batch-check <in >actual &&
+ git cat-file --use-mailmap --batch-check <in >>actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'git cat-file --batch-command returns correct size with --use-mailmap' '
+ test_when_finished "rm .mailmap" &&
+ cat >.mailmap <<-\EOF &&
+ C O Mitter <committer@example.com> Orig <orig@example.com>
+ EOF
+ git cat-file commit HEAD >commit.out &&
+ commit_size=$(wc -c <commit.out) &&
+ commit_sha=$(git rev-parse HEAD) &&
+ echo $commit_sha commit $commit_size >expect &&
+ git cat-file --use-mailmap commit HEAD >commit.out &&
+ commit_size=$(wc -c <commit.out) &&
+ echo $commit_sha commit $commit_size >>expect &&
+ echo "info HEAD" >in &&
+ git cat-file --batch-command <in >actual &&
+ git cat-file --use-mailmap --batch-command <in >>actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t4204-patch-id.sh b/t/t4204-patch-id.sh
index a730c0db98..a7fa94ce0a 100755
--- a/t/t4204-patch-id.sh
+++ b/t/t4204-patch-id.sh
@@ -8,13 +8,13 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
test_expect_success 'setup' '
- as="a a a a a a a a" && # eight a
- test_write_lines $as >foo &&
- test_write_lines $as >bar &&
+ str="ab cd ef gh ij kl mn op" &&
+ test_write_lines $str >foo &&
+ test_write_lines $str >bar &&
git add foo bar &&
git commit -a -m initial &&
- test_write_lines $as b >foo &&
- test_write_lines $as b >bar &&
+ test_write_lines $str b >foo &&
+ test_write_lines $str b >bar &&
git commit -a -m first &&
git checkout -b same main &&
git commit --amend -m same-msg &&
@@ -22,8 +22,23 @@ test_expect_success 'setup' '
echo c >foo &&
echo c >bar &&
git commit --amend -a -m notsame-msg &&
+ git checkout -b with_space main~ &&
+ cat >foo <<-\EOF &&
+ a b
+ c d
+ e f
+ g h
+ i j
+ k l
+ m n
+ op
+ EOF
+ cp foo bar &&
+ git add foo bar &&
+ git commit --amend -m "with spaces" &&
test_write_lines bar foo >bar-then-foo &&
test_write_lines foo bar >foo-then-bar
+
'
test_expect_success 'patch-id output is well-formed' '
@@ -42,7 +57,7 @@ calc_patch_id () {
}
get_top_diff () {
- git log -p -1 "$@" -O bar-then-foo --
+ git log -p -1 "$@" -O bar-then-foo --full-index --
}
get_patch_id () {
@@ -61,6 +76,33 @@ test_expect_success 'patch-id detects inequality' '
get_patch_id notsame &&
! test_cmp patch-id_main patch-id_notsame
'
+test_expect_success 'patch-id detects equality binary' '
+ cat >.gitattributes <<-\EOF &&
+ foo binary
+ bar binary
+ EOF
+ get_patch_id main &&
+ get_patch_id same &&
+ git log -p -1 --binary main >top-diff.output &&
+ calc_patch_id <top-diff.output main_binpatch &&
+ git log -p -1 --binary same >top-diff.output &&
+ calc_patch_id <top-diff.output same_binpatch &&
+ test_cmp patch-id_main patch-id_main_binpatch &&
+ test_cmp patch-id_same patch-id_same_binpatch &&
+ test_cmp patch-id_main patch-id_same &&
+ test_when_finished "rm .gitattributes"
+'
+
+test_expect_success 'patch-id detects inequality binary' '
+ cat >.gitattributes <<-\EOF &&
+ foo binary
+ bar binary
+ EOF
+ get_patch_id main &&
+ get_patch_id notsame &&
+ ! test_cmp patch-id_main patch-id_notsame &&
+ test_when_finished "rm .gitattributes"
+'
test_expect_success 'patch-id supports git-format-patch output' '
get_patch_id main &&
@@ -101,9 +143,21 @@ test_patch_id_file_order () {
git format-patch -1 --stdout -O foo-then-bar >format-patch.output &&
calc_patch_id <format-patch.output "ordered-$name" "$@" &&
cmp_patch_id $relevant "$name" "ordered-$name"
+}
+test_patch_id_whitespace () {
+ relevant="$1"
+ shift
+ name="ws-${1}-$relevant"
+ shift
+ get_top_diff "main~" >top-diff.output &&
+ calc_patch_id <top-diff.output "$name" "$@" &&
+ get_top_diff "with_space" >top-diff.output &&
+ calc_patch_id <top-diff.output "ws-$name" "$@" &&
+ cmp_patch_id $relevant "$name" "ws-$name"
}
+
# combined test for options: add more tests here to make them
# run with all options
test_patch_id () {
@@ -119,6 +173,14 @@ test_expect_success 'file order is relevant with --unstable' '
test_patch_id_file_order relevant --unstable --unstable
'
+test_expect_success 'whitespace is relevant with --verbatim' '
+ test_patch_id_whitespace relevant --verbatim --verbatim
+'
+
+test_expect_success 'whitespace is irrelevant without --verbatim' '
+ test_patch_id_whitespace irrelevant --stable --stable
+'
+
#Now test various option combinations.
test_expect_success 'default is unstable' '
test_patch_id relevant default
@@ -134,6 +196,17 @@ test_expect_success 'patchid.stable = false is unstable' '
test_patch_id relevant patchid.stable=false
'
+test_expect_success 'patchid.verbatim = true is correct and stable' '
+ test_config patchid.verbatim true &&
+ test_patch_id_whitespace relevant patchid.verbatim=true &&
+ test_patch_id irrelevant patchid.verbatim=true
+'
+
+test_expect_success 'patchid.verbatim = false is unstable' '
+ test_config patchid.verbatim false &&
+ test_patch_id relevant patchid.verbatim=false
+'
+
test_expect_success '--unstable overrides patchid.stable = true' '
test_config patchid.stable true &&
test_patch_id relevant patchid.stable=true--unstable --unstable
@@ -144,6 +217,11 @@ test_expect_success '--stable overrides patchid.stable = false' '
test_patch_id irrelevant patchid.stable=false--stable --stable
'
+test_expect_success '--verbatim overrides patchid.stable = false' '
+ test_config patchid.stable false &&
+ test_patch_id_whitespace relevant stable=false--verbatim --verbatim
+'
+
test_expect_success 'patch-id supports git-format-patch MIME output' '
get_patch_id main &&
git checkout same &&
@@ -198,7 +276,10 @@ test_expect_success 'patch-id handles no-nl-at-eof markers' '
EOF
calc_patch_id nonl <nonl &&
calc_patch_id withnl <withnl &&
- test_cmp patch-id_nonl patch-id_withnl
+ test_cmp patch-id_nonl patch-id_withnl &&
+ calc_patch_id nonl-inc-ws --verbatim <nonl &&
+ calc_patch_id withnl-inc-ws --verbatim <withnl &&
+ ! test_cmp patch-id_nonl-inc-ws patch-id_withnl-inc-ws
'
test_expect_success 'patch-id handles diffs with one line of before/after' '
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index fedb7ca749..4cf8a77667 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -156,7 +156,7 @@ test_expect_success 'NUL termination with --reflog --pretty=oneline' '
for r in $revs
do
git show -s --pretty=oneline "$r" >raw &&
- cat raw | lf_to_nul || exit 1
+ cat raw | lf_to_nul || return 1
done >expect &&
# the trailing NUL is already produced so we do not need to
# output another one
@@ -1094,4 +1094,31 @@ test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit mes
test_cmp expect error
'
+# pretty-formats note wide char limitations, and add tests
+test_expect_failure 'wide and decomposed characters column counting' '
+
+# from t/lib-unicode-nfc-nfd.sh hex values converted to octal
+ utf8_nfc=$(printf "\303\251") && # e acute combined.
+ utf8_nfd=$(printf "\145\314\201") && # e with a combining acute (i.e. decomposed)
+ utf8_emoji=$(printf "\360\237\221\250") &&
+
+# replacement character when requesting a wide char fits in a single display colum.
+# "half wide" alternative could be a plain ASCII dot `.`
+ utf8_vert_ell=$(printf "\342\213\256") &&
+
+# use ${xxx} here!
+ nfc10="${utf8_nfc}${utf8_nfc}${utf8_nfc}${utf8_nfc}${utf8_nfc}${utf8_nfc}${utf8_nfc}${utf8_nfc}${utf8_nfc}${utf8_nfc}" &&
+ nfd10="${utf8_nfd}${utf8_nfd}${utf8_nfd}${utf8_nfd}${utf8_nfd}${utf8_nfd}${utf8_nfd}${utf8_nfd}${utf8_nfd}${utf8_nfd}" &&
+ emoji5="${utf8_emoji}${utf8_emoji}${utf8_emoji}${utf8_emoji}${utf8_emoji}" &&
+# emoji5 uses 10 display columns
+
+ test_commit "abcdefghij" &&
+ test_commit --no-tag "${nfc10}" &&
+ test_commit --no-tag "${nfd10}" &&
+ test_commit --no-tag "${emoji5}" &&
+ printf "${utf8_emoji}..${utf8_emoji}${utf8_vert_ell}\n${utf8_nfd}..${utf8_nfd}${utf8_nfd}\n${utf8_nfc}..${utf8_nfc}${utf8_nfc}\na..ij\n" >expected &&
+ git log --format="%<(5,mtrunc)%s" -4 >actual &&
+ test_cmp expected actual
+'
+
test_done
diff --git a/t/t4211-line-log.sh b/t/t4211-line-log.sh
index ac9e4d0928..c6540e822f 100755
--- a/t/t4211-line-log.sh
+++ b/t/t4211-line-log.sh
@@ -315,4 +315,26 @@ test_expect_success 'line-log with --before' '
test_cmp expect actual
'
+test_expect_success 'setup tests for zero-width regular expressions' '
+ cat >expect <<-EOF
+ Modify func1() in file.c
+ Add func1() and func2() in file.c
+ EOF
+'
+
+test_expect_success 'zero-width regex $ matches any function name' '
+ git log --format="%s" --no-patch "-L:$:file.c" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'zero-width regex ^ matches any function name' '
+ git log --format="%s" --no-patch "-L:^:file.c" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'zero-width regex .* matches any function name' '
+ git log --format="%s" --no-patch "-L:.*:file.c" >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t4212-log-corrupt.sh b/t/t4212-log-corrupt.sh
index 30a219894b..85e90acb09 100755
--- a/t/t4212-log-corrupt.sh
+++ b/t/t4212-log-corrupt.sh
@@ -8,9 +8,10 @@ TEST_PASSES_SANITIZE_LEAK=true
test_expect_success 'setup' '
test_commit foo &&
- git cat-file commit HEAD |
- sed "/^author /s/>/>-<>/" >broken_email.commit &&
- git hash-object -w -t commit broken_email.commit >broken_email.hash &&
+ git cat-file commit HEAD >ok.commit &&
+ sed "s/>/>-<>/" <ok.commit >broken_email.commit &&
+
+ git hash-object --literally -w -t commit broken_email.commit >broken_email.hash &&
git update-ref refs/heads/broken_email $(cat broken_email.hash)
'
@@ -43,10 +44,15 @@ test_expect_success 'git log --format with broken author email' '
test_must_be_empty actual.err
'
+test_expect_success '--until handles broken email' '
+ git rev-list --until=1980-01-01 broken_email >actual &&
+ test_must_be_empty actual
+'
+
munge_author_date () {
git cat-file commit "$1" >commit.orig &&
sed "s/^\(author .*>\) [0-9]*/\1 $2/" <commit.orig >commit.munge &&
- git hash-object -w -t commit commit.munge
+ git hash-object --literally -w -t commit commit.munge
}
test_expect_success 'unparsable dates produce sentinel value' '
@@ -86,4 +92,45 @@ test_expect_success 'absurdly far-in-future date' '
git log -1 --format=%ad $commit
'
+test_expect_success 'create commits with whitespace committer dates' '
+ # It is important that this subject line is numeric, since we want to
+ # be sure we are not confused by skipping whitespace and accidentally
+ # parsing the subject as a timestamp.
+ #
+ # Do not use munge_author_date here. Besides not hitting the committer
+ # line, it leaves the timezone intact, and we want nothing but
+ # whitespace.
+ #
+ # We will make two munged commits here. The first, ws_commit, will
+ # be purely spaces. The second contains a vertical tab, which is
+ # considered a space by strtoumax(), but not by our isspace().
+ test_commit 1234567890 &&
+ git cat-file commit HEAD >commit.orig &&
+ sed "s/>.*/> /" <commit.orig >commit.munge &&
+ ws_commit=$(git hash-object --literally -w -t commit commit.munge) &&
+ sed "s/>.*/> $(printf "\013")/" <commit.orig >commit.munge &&
+ vt_commit=$(git hash-object --literally -w -t commit commit.munge)
+'
+
+test_expect_success '--until treats whitespace date as sentinel' '
+ echo $ws_commit >expect &&
+ git rev-list --until=1980-01-01 $ws_commit >actual &&
+ test_cmp expect actual &&
+
+ echo $vt_commit >expect &&
+ git rev-list --until=1980-01-01 $vt_commit >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'pretty-printer handles whitespace date' '
+ # as with the %ad test above, we will show these as the empty string,
+ # not the 1970 epoch date. This is intentional; see 7d9a281941 (t4212:
+ # test bogus timestamps with git-log, 2014-02-24) for more discussion.
+ echo : >expect &&
+ git log -1 --format="%at:%ct" $ws_commit >actual &&
+ test_cmp expect actual &&
+ git log -1 --format="%at:%ct" $vt_commit >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t4213-log-tabexpand.sh b/t/t4213-log-tabexpand.sh
index 53a4af3244..590fce95e9 100755
--- a/t/t4213-log-tabexpand.sh
+++ b/t/t4213-log-tabexpand.sh
@@ -2,6 +2,7 @@
test_description='log/show --expand-tabs'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
HT=" "
diff --git a/t/t4254-am-corrupt.sh b/t/t4254-am-corrupt.sh
index 54be7da161..45f1d4f95e 100755
--- a/t/t4254-am-corrupt.sh
+++ b/t/t4254-am-corrupt.sh
@@ -1,6 +1,8 @@
#!/bin/sh
test_description='git am with corrupt input'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
make_mbox_with_nul () {
diff --git a/t/t4256-am-format-flowed.sh b/t/t4256-am-format-flowed.sh
index 2369c4e17a..1015273bc8 100755
--- a/t/t4256-am-format-flowed.sh
+++ b/t/t4256-am-format-flowed.sh
@@ -2,6 +2,7 @@
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 aed8f4de3d..f26d7fd2db 100755
--- a/t/t4257-am-interactive.sh
+++ b/t/t4257-am-interactive.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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/mbox b/t/t4258/mbox
index c62819f3d2..1ae528ba78 100644
--- a/t/t4258/mbox
+++ b/t/t4258/mbox
@@ -2,7 +2,7 @@ From: A U Thor <mail@example.com>
To: list@example.org
Subject: [PATCH v2] sample
Date: Mon, 3 Aug 2020 22:40:55 +0700
-Message-Id: <msg-id@example.com>
+Message-ID: <msg-id@example.com>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
diff --git a/t/t4301-merge-tree-write-tree.sh b/t/t4301-merge-tree-write-tree.sh
index 013b77144b..250f721795 100755
--- a/t/t4301-merge-tree-write-tree.sh
+++ b/t/t4301-merge-tree-write-tree.sh
@@ -141,7 +141,7 @@ test_expect_success 'test conflict notices and such' '
# Commit O: foo, olddir/{a,b,c}
# Commit A: modify foo, newdir/{a,b,c}
# Commit B: modify foo differently & rename foo -> olddir/bar
-# Expected: CONFLICT(content) for for newdir/bar (not olddir/bar or foo)
+# Expected: CONFLICT(content) for newdir/bar (not olddir/bar or foo)
test_expect_success 'directory rename + content conflict' '
# Setup
@@ -653,7 +653,7 @@ test_expect_success 'mod6: chains of rename/rename(1to2) and add/add via collidi
# Commit O: foo, olddir/{a,b,c}
# Commit A: delete foo, rename olddir/ -> newdir/, add newdir/bar/file
# Commit B: modify foo & rename foo -> olddir/bar
-# Expected: CONFLICT(content) for for newdir/bar (not olddir/bar or foo)
+# Expected: CONFLICT(content) for newdir/bar (not olddir/bar or foo)
test_expect_success 'directory rename + rename/delete + modify/delete + directory/file conflict' '
# Setup
@@ -819,4 +819,107 @@ test_expect_success SANITY 'merge-ort fails gracefully in a read-only repository
test_must_fail git -C read-only merge-tree side1 side2
'
+test_expect_success '--stdin with both a successful and a conflicted merge' '
+ printf "side1 side3\nside1 side2" | git merge-tree --stdin >actual &&
+
+ git checkout side1^0 &&
+ git merge side3 &&
+
+ printf "1\0" >expect &&
+ git rev-parse HEAD^{tree} | lf_to_nul >>expect &&
+ printf "\0" >>expect &&
+
+ git checkout side1^0 &&
+ test_must_fail git merge side2 &&
+ sed s/HEAD/side1/ greeting >tmp &&
+ mv tmp greeting &&
+ git add -u &&
+ git mv whatever~HEAD whatever~side1 &&
+
+ printf "0\0" >>expect &&
+ git write-tree | lf_to_nul >>expect &&
+
+ cat <<-EOF | q_to_tab | lf_to_nul >>expect &&
+ 100644 $(git rev-parse side1~1:greeting) 1Qgreeting
+ 100644 $(git rev-parse side1:greeting) 2Qgreeting
+ 100644 $(git rev-parse side2:greeting) 3Qgreeting
+ 100644 $(git rev-parse side1~1:whatever) 1Qwhatever~side1
+ 100644 $(git rev-parse side1:whatever) 2Qwhatever~side1
+ EOF
+
+ q_to_nul <<-EOF >>expect &&
+ Q1QgreetingQAuto-mergingQAuto-merging greeting
+ Q1QgreetingQCONFLICT (contents)QCONFLICT (content): Merge conflict in greeting
+ Q1QnumbersQAuto-mergingQAuto-merging numbers
+ Q2Qwhatever~side1QwhateverQCONFLICT (file/directory)QCONFLICT (file/directory): directory in the way of whatever from side1; moving it to whatever~side1 instead.
+ Q1Qwhatever~side1QCONFLICT (modify/delete)QCONFLICT (modify/delete): whatever~side1 deleted in side2 and modified in side1. Version side1 of whatever~side1 left in tree.
+ EOF
+
+ printf "\0\0" >>expect &&
+
+ test_cmp expect actual
+'
+
+
+test_expect_success '--merge-base is incompatible with --stdin' '
+ test_must_fail git merge-tree --merge-base=side1 --stdin 2>expect &&
+
+ grep "^fatal: --merge-base is incompatible with --stdin" expect
+'
+
+# specify merge-base as parent of branch2
+# git merge-tree --write-tree --merge-base=c2 c1 c3
+# Commit c1: add file1
+# Commit c2: add file2 after c1
+# Commit c3: add file3 after c2
+# Expected: add file3, and file2 does NOT appear
+
+test_expect_success 'specify merge-base as parent of branch2' '
+ # Setup
+ test_when_finished "rm -rf base-b2-p" &&
+ git init base-b2-p &&
+ test_commit -C base-b2-p c1 file1 &&
+ test_commit -C base-b2-p c2 file2 &&
+ test_commit -C base-b2-p c3 file3 &&
+
+ # Testing
+ TREE_OID=$(git -C base-b2-p merge-tree --write-tree --merge-base=c2 c1 c3) &&
+
+ q_to_tab <<-EOF >expect &&
+ 100644 blob $(git -C base-b2-p rev-parse c1:file1)Qfile1
+ 100644 blob $(git -C base-b2-p rev-parse c3:file3)Qfile3
+ EOF
+
+ git -C base-b2-p ls-tree $TREE_OID >actual &&
+ test_cmp expect actual
+'
+
+# Since the earlier tests have verified that individual merge-tree calls
+# are doing the right thing, this test case is only used to verify that
+# we can also trigger merges via --stdin, and that when we do we get
+# the same answer as running a bunch of separate merges.
+
+test_expect_success 'check the input format when --stdin is passed' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ test_commit -C repo c1 &&
+ test_commit -C repo c2 &&
+ test_commit -C repo c3 &&
+ printf "c1 c3\nc2 -- c1 c3\nc2 c3" | git -C repo merge-tree --stdin >actual &&
+
+ printf "1\0" >expect &&
+ git -C repo merge-tree --write-tree -z c1 c3 >>expect &&
+ printf "\0" >>expect &&
+
+ printf "1\0" >>expect &&
+ git -C repo merge-tree --write-tree -z --merge-base=c2 c1 c3 >>expect &&
+ printf "\0" >>expect &&
+
+ printf "1\0" >>expect &&
+ git -C repo merge-tree --write-tree -z c2 c3 >>expect &&
+ printf "\0" >>expect &&
+
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index eaa0b22ece..4b4c3315d8 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -105,6 +105,18 @@ check_added() {
'
}
+check_mtime() {
+ dir=$1
+ path_in_archive=$2
+ mtime=$3
+
+ test_expect_success " validate mtime of $path_in_archive" '
+ test-tool chmtime --get $dir/$path_in_archive >actual.mtime &&
+ echo $mtime >expect.mtime &&
+ test_cmp expect.mtime actual.mtime
+ '
+}
+
test_expect_success 'setup' '
test_oid_cache <<-EOF
obj sha1:19f9c8273ec45a8938e6999cb59b3ff66739902a
@@ -173,6 +185,14 @@ test_expect_success 'git archive' '
'
check_tar b
+check_mtime b a/a 1117231200
+
+test_expect_success 'git archive --mtime' '
+ git archive --mtime=2002-02-02T02:02:02-0200 HEAD >with_mtime.tar
+'
+
+check_tar with_mtime
+check_mtime with_mtime a/a 1012622522
test_expect_success 'git archive --prefix=prefix/' '
git archive --prefix=prefix/ HEAD >with_prefix.tar
@@ -238,14 +258,6 @@ test_expect_success 'git archive --remote with configured remote' '
test_cmp_bin b.tar b5-nick.tar
'
-test_expect_success 'validate file modification time' '
- mkdir extract &&
- "$TAR" xf b.tar -C extract a/a &&
- test-tool chmtime --get extract/a/a >b.mtime &&
- echo "1117231200" >expected.mtime &&
- test_cmp expected.mtime b.mtime
-'
-
test_expect_success 'git get-tar-commit-id' '
git get-tar-commit-id <b.tar >actual &&
git rev-parse HEAD >expect &&
@@ -342,6 +354,13 @@ test_expect_success 'only enabled filters are available remotely' '
test_cmp_bin remote.bar config.bar
'
+test_expect_success 'invalid filter is reported only once' '
+ test_must_fail git -c tar.invalid.command= archive --format=invalid \
+ HEAD >out 2>err &&
+ test_must_be_empty out &&
+ test_line_count = 1 err
+'
+
test_expect_success 'git archive --format=tgz' '
git archive --format=tgz HEAD >j.tgz
'
@@ -395,11 +414,11 @@ test_expect_success GZIP 'extract tgz file (external gzip)' '
test_expect_success 'archive and :(glob)' '
git archive -v HEAD -- ":(glob)**/sh" >/dev/null 2>actual &&
- cat >expect <<EOF &&
-a/
-a/bin/
-a/bin/sh
-EOF
+ cat >expect <<-\EOF &&
+ a/
+ a/bin/
+ a/bin/sh
+ EOF
test_cmp expect actual
'
@@ -407,6 +426,19 @@ test_expect_success 'catch non-matching pathspec' '
test_must_fail git archive -v HEAD -- "*.abc" >/dev/null
'
+test_expect_success 'reject paths outside the current directory' '
+ test_must_fail git -C a/bin archive HEAD .. >/dev/null 2>err &&
+ grep "outside the current directory" err
+'
+
+test_expect_success 'allow pathspecs that resolve to the current directory' '
+ git -C a/bin archive -v HEAD ../bin >/dev/null 2>actual &&
+ cat >expect <<-\EOF &&
+ sh
+ EOF
+ test_cmp expect actual
+'
+
# Pull the size and date of each entry in a tarfile using the system tar.
#
# We'll pull out only the year from the date; that avoids any question of
diff --git a/t/t5001-archive-attr.sh b/t/t5001-archive-attr.sh
index 2f6eef5e37..0ff47a239d 100755
--- a/t/t5001-archive-attr.sh
+++ b/t/t5001-archive-attr.sh
@@ -3,6 +3,7 @@
test_description='git archive attribute tests'
TEST_CREATE_REPO_NO_TEMPLATE=1
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
SUBSTFORMAT='%H (%h)%n'
@@ -32,6 +33,13 @@ test_expect_success 'setup' '
echo ignored-by-tree.d export-ignore >>.gitattributes &&
git add ignored-by-tree ignored-by-tree.d .gitattributes &&
+ mkdir subdir &&
+ >subdir/included &&
+ >subdir/ignored-by-subtree &&
+ >subdir/ignored-by-tree &&
+ echo ignored-by-subtree export-ignore >subdir/.gitattributes &&
+ git add subdir &&
+
echo ignored by worktree >ignored-by-worktree &&
echo ignored-by-worktree export-ignore >.gitattributes &&
git add ignored-by-worktree &&
@@ -92,6 +100,15 @@ test_expect_exists archive-pathspec-wildcard/ignored-by-worktree
test_expect_missing archive-pathspec-wildcard/excluded-by-pathspec.d
test_expect_missing archive-pathspec-wildcard/excluded-by-pathspec.d/file
+test_expect_success 'git -C subdir archive' '
+ git -C subdir archive HEAD >archive-subdir.tar &&
+ extract_tar_to_dir archive-subdir
+'
+
+test_expect_exists archive-subdir/included
+test_expect_missing archive-subdir/ignored-by-subtree
+test_expect_missing archive-subdir/ignored-by-tree
+
test_expect_success 'git archive with worktree attributes' '
git archive --worktree-attributes HEAD >worktree.tar &&
(mkdir worktree && cd worktree && "$TAR" xf -) <worktree.tar
diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh
index ae508e2162..9f2c6da80e 100755
--- a/t/t5004-archive-corner-cases.sh
+++ b/t/t5004-archive-corner-cases.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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/msg0002 b/t/t5100/msg0002
index e2546ec733..1089382425 100644
--- a/t/t5100/msg0002
+++ b/t/t5100/msg0002
@@ -3,7 +3,7 @@ message:
From: Nit Picker <nit.picker@example.net>
Subject: foo is too old
-Message-Id: <nitpicker.12121212@example.net>
+Message-ID: <nitpicker.12121212@example.net>
Hopefully this would fix the problem stated there.
diff --git a/t/t5100/msg0003 b/t/t5100/msg0003
index 1ac68101b1..3402b534a6 100644
--- a/t/t5100/msg0003
+++ b/t/t5100/msg0003
@@ -3,7 +3,7 @@ message:
From: Nit Picker <nit.picker@example.net>
Subject: foo is too old
-Message-Id: <nitpicker.12121212@example.net>
+Message-ID: <nitpicker.12121212@example.net>
Hopefully this would fix the problem stated there.
diff --git a/t/t5100/msg0012--message-id b/t/t5100/msg0012--message-id
index 376e26e9ae..44482958ce 100644
--- a/t/t5100/msg0012--message-id
+++ b/t/t5100/msg0012--message-id
@@ -5,4 +5,4 @@ docutils заменён на python-docutils
python-docutils. Ð’ то Ð²Ñ€ÐµÐ¼Ñ ÐºÐ°Ðº Ñам rest2web не нужен.
Signed-off-by: Dmitriy Blinov <bda@mnsspb.ru>
-Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>
+Message-ID: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>
diff --git a/t/t5100/quoted-cr.mbox b/t/t5100/quoted-cr.mbox
index 909021bb7a..a529d4de08 100644
--- a/t/t5100/quoted-cr.mbox
+++ b/t/t5100/quoted-cr.mbox
@@ -3,7 +3,7 @@ From: A U Thor <mail@example.com>
To: list@example.org
Subject: [PATCH v2] sample
Date: Mon, 3 Aug 2020 22:40:55 +0700
-Message-Id: <msg-id@example.com>
+Message-ID: <msg-id@example.com>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
@@ -27,7 +27,7 @@ From: A U Thor <mail@example.com>
To: list@example.org
Subject: [PATCH v2] sample
Date: Mon, 3 Aug 2020 22:40:55 +0700
-Message-Id: <msg-id2@example.com>
+Message-ID: <msg-id2@example.com>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
diff --git a/t/t5100/sample.mbox b/t/t5100/sample.mbox
index 6d4d0e4474..4a54ee5171 100644
--- a/t/t5100/sample.mbox
+++ b/t/t5100/sample.mbox
@@ -35,7 +35,7 @@ message:
From: Nit Picker <nit.picker@example.net>
Subject: foo is too old
-Message-Id: <nitpicker.12121212@example.net>
+Message-ID: <nitpicker.12121212@example.net>
Hopefully this would fix the problem stated there.
@@ -78,7 +78,7 @@ message:
From: Nit Picker <nit.picker@example.net>
Subject: foo is too old
-Message-Id: <nitpicker.12121212@example.net>
+Message-ID: <nitpicker.12121212@example.net>
Hopefully this would fix the problem stated there.
@@ -508,7 +508,7 @@ From bda@mnsspb.ru Wed Nov 12 17:54:41 2008
From: Dmitriy Blinov <bda@mnsspb.ru>
To: navy-patches@dinar.mns.mnsspb.ru
Date: Wed, 12 Nov 2008 17:54:41 +0300
-Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>
+Message-ID: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>
X-Mailer: git-send-email 1.5.6.5
MIME-Version: 1.0
Content-Type: text/plain;
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index f8a0f309e2..d2ce236d61 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -589,141 +589,6 @@ test_expect_success 'prefetch objects' '
test_line_count = 1 donelines
'
-test_expect_success 'setup for --stdin-packs tests' '
- git init stdin-packs &&
- (
- cd stdin-packs &&
-
- test_commit A &&
- test_commit B &&
- test_commit C &&
-
- for id in A B C
- do
- git pack-objects .git/objects/pack/pack-$id \
- --incremental --revs <<-EOF || exit 1
- refs/tags/$id
- EOF
- done &&
-
- ls -la .git/objects/pack
- )
-'
-
-test_expect_success '--stdin-packs with excluded packs' '
- (
- cd stdin-packs &&
-
- PACK_A="$(basename .git/objects/pack/pack-A-*.pack)" &&
- PACK_B="$(basename .git/objects/pack/pack-B-*.pack)" &&
- PACK_C="$(basename .git/objects/pack/pack-C-*.pack)" &&
-
- git pack-objects test --stdin-packs <<-EOF &&
- $PACK_A
- ^$PACK_B
- $PACK_C
- EOF
-
- (
- git show-index <$(ls .git/objects/pack/pack-A-*.idx) &&
- git show-index <$(ls .git/objects/pack/pack-C-*.idx)
- ) >expect.raw &&
- git show-index <$(ls test-*.idx) >actual.raw &&
-
- cut -d" " -f2 <expect.raw | sort >expect &&
- cut -d" " -f2 <actual.raw | sort >actual &&
- test_cmp expect actual
- )
-'
-
-test_expect_success '--stdin-packs is incompatible with --filter' '
- (
- cd stdin-packs &&
- test_must_fail git pack-objects --stdin-packs --stdout \
- --filter=blob:none </dev/null 2>err &&
- test_i18ngrep "cannot use --filter with --stdin-packs" err
- )
-'
-
-test_expect_success '--stdin-packs is incompatible with --revs' '
- (
- cd stdin-packs &&
- test_must_fail git pack-objects --stdin-packs --revs out \
- </dev/null 2>err &&
- test_i18ngrep "cannot use internal rev list with --stdin-packs" err
- )
-'
-
-test_expect_success '--stdin-packs with loose objects' '
- (
- cd stdin-packs &&
-
- PACK_A="$(basename .git/objects/pack/pack-A-*.pack)" &&
- PACK_B="$(basename .git/objects/pack/pack-B-*.pack)" &&
- PACK_C="$(basename .git/objects/pack/pack-C-*.pack)" &&
-
- test_commit D && # loose
-
- git pack-objects test2 --stdin-packs --unpacked <<-EOF &&
- $PACK_A
- ^$PACK_B
- $PACK_C
- EOF
-
- (
- git show-index <$(ls .git/objects/pack/pack-A-*.idx) &&
- git show-index <$(ls .git/objects/pack/pack-C-*.idx) &&
- git rev-list --objects --no-object-names \
- refs/tags/C..refs/tags/D
-
- ) >expect.raw &&
- ls -la . &&
- git show-index <$(ls test2-*.idx) >actual.raw &&
-
- cut -d" " -f2 <expect.raw | sort >expect &&
- cut -d" " -f2 <actual.raw | sort >actual &&
- test_cmp expect actual
- )
-'
-
-test_expect_success '--stdin-packs with broken links' '
- (
- cd stdin-packs &&
-
- # make an unreachable object with a bogus parent
- git cat-file -p HEAD >commit &&
- sed "s/$(git rev-parse HEAD^)/$(test_oid zero)/" <commit |
- git hash-object -w -t commit --stdin >in &&
-
- git pack-objects .git/objects/pack/pack-D <in &&
-
- PACK_A="$(basename .git/objects/pack/pack-A-*.pack)" &&
- PACK_B="$(basename .git/objects/pack/pack-B-*.pack)" &&
- PACK_C="$(basename .git/objects/pack/pack-C-*.pack)" &&
- PACK_D="$(basename .git/objects/pack/pack-D-*.pack)" &&
-
- git pack-objects test3 --stdin-packs --unpacked <<-EOF &&
- $PACK_A
- ^$PACK_B
- $PACK_C
- $PACK_D
- EOF
-
- (
- git show-index <$(ls .git/objects/pack/pack-A-*.idx) &&
- git show-index <$(ls .git/objects/pack/pack-C-*.idx) &&
- git show-index <$(ls .git/objects/pack/pack-D-*.idx) &&
- git rev-list --objects --no-object-names \
- refs/tags/C..refs/tags/D
- ) >expect.raw &&
- git show-index <$(ls test3-*.idx) >actual.raw &&
-
- cut -d" " -f2 <expect.raw | sort >expect &&
- cut -d" " -f2 <actual.raw | sort >actual &&
- test_cmp expect actual
- )
-'
-
test_expect_success 'negative window clamps to 0' '
git pack-objects --progress --window=-1 neg-window <obj-list 2>stderr &&
check_deltas stderr = 0
diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index b0095ab41d..f89809be53 100755
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
@@ -4,6 +4,8 @@
#
test_description='pack index with 64-bit offsets and object CRC'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
@@ -263,7 +265,7 @@ tag guten tag
This is an invalid tag.
EOF
- tag=$(git hash-object -t tag -w --stdin <wrong-tag) &&
+ tag=$(git hash-object -t tag -w --stdin --literally <wrong-tag) &&
pack1=$(echo $tag $sha | git pack-objects tag-test) &&
echo remove tag object &&
thirtyeight=${tag#??} &&
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh
index 8ae314af58..662ae9b152 100755
--- a/t/t5304-prune.sh
+++ b/t/t5304-prune.sh
@@ -29,6 +29,14 @@ test_expect_success setup '
git gc
'
+test_expect_success 'bare repo prune is quiet without $GIT_DIR/objects/pack' '
+ git clone -q --shared --template= --bare . bare.git &&
+ rmdir bare.git/objects/pack &&
+ git --git-dir=bare.git prune --no-progress 2>prune.err &&
+ test_must_be_empty prune.err &&
+ rm -r bare.git prune.err
+'
+
test_expect_success 'prune stale packs' '
orig_pack=$(echo .git/objects/pack/*.pack) &&
>.git/objects/tmp_1.pack &&
@@ -54,23 +62,31 @@ test_expect_success 'prune --expire' '
test_expect_success 'gc: implicit prune --expire' '
add_blob &&
test-tool chmtime =-$((2*$week-30)) $BLOB_FILE &&
- git gc &&
+ git gc --no-cruft &&
verbose test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
test_path_is_file $BLOB_FILE &&
test-tool chmtime =-$((2*$week+1)) $BLOB_FILE &&
- git gc &&
+ git gc --no-cruft &&
verbose test $before = $(git count-objects | sed "s/ .*//") &&
test_path_is_missing $BLOB_FILE
'
test_expect_success 'gc: refuse to start with invalid gc.pruneExpire' '
- git config gc.pruneExpire invalid &&
- test_must_fail git gc
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ >repo/.git/config &&
+ git -C repo config gc.pruneExpire invalid &&
+ cat >expect <<-\EOF &&
+ error: Invalid gc.pruneexpire: '\''invalid'\''
+ fatal: bad config variable '\''gc.pruneexpire'\'' in file '\''.git/config'\'' at line 2
+ EOF
+ test_must_fail git -C repo gc 2>actual &&
+ test_cmp expect actual
'
test_expect_success 'gc: start with ok gc.pruneExpire' '
git config gc.pruneExpire 2.days.ago &&
- git gc
+ git gc --no-cruft
'
test_expect_success 'prune: prune nonsense parameters' '
@@ -121,44 +137,44 @@ test_expect_success 'gc --no-prune' '
add_blob &&
test-tool chmtime =-$((5001*$day)) $BLOB_FILE &&
git config gc.pruneExpire 2.days.ago &&
- git gc --no-prune &&
+ git gc --no-prune --no-cruft &&
verbose test 1 = $(git count-objects | sed "s/ .*//") &&
test_path_is_file $BLOB_FILE
'
test_expect_success 'gc respects gc.pruneExpire' '
git config gc.pruneExpire 5002.days.ago &&
- git gc &&
+ git gc --no-cruft &&
test_path_is_file $BLOB_FILE &&
git config gc.pruneExpire 5000.days.ago &&
- git gc &&
+ git gc --no-cruft &&
test_path_is_missing $BLOB_FILE
'
test_expect_success 'gc --prune=<date>' '
add_blob &&
test-tool chmtime =-$((5001*$day)) $BLOB_FILE &&
- git gc --prune=5002.days.ago &&
+ git gc --prune=5002.days.ago --no-cruft &&
test_path_is_file $BLOB_FILE &&
- git gc --prune=5000.days.ago &&
+ git gc --prune=5000.days.ago --no-cruft &&
test_path_is_missing $BLOB_FILE
'
test_expect_success 'gc --prune=never' '
add_blob &&
- git gc --prune=never &&
+ git gc --prune=never --no-cruft &&
test_path_is_file $BLOB_FILE &&
- git gc --prune=now &&
+ git gc --prune=now --no-cruft &&
test_path_is_missing $BLOB_FILE
'
test_expect_success 'gc respects gc.pruneExpire=never' '
git config gc.pruneExpire never &&
add_blob &&
- git gc &&
+ git gc --no-cruft &&
test_path_is_file $BLOB_FILE &&
git config gc.pruneExpire now &&
- git gc &&
+ git gc --no-cruft &&
test_path_is_missing $BLOB_FILE
'
@@ -178,7 +194,7 @@ test_expect_success 'gc: prune old objects after local clone' '
cd aclone &&
verbose test 1 = $(git count-objects | sed "s/ .*//") &&
test_path_is_file $BLOB_FILE &&
- git gc --prune &&
+ git gc --prune --no-cruft &&
verbose test 0 = $(git count-objects | sed "s/ .*//") &&
test_path_is_missing $BLOB_FILE
)
@@ -221,7 +237,7 @@ test_expect_success 'clean pack garbage with gc' '
>.git/objects/pack/fake2.keep &&
>.git/objects/pack/fake2.idx &&
>.git/objects/pack/fake3.keep &&
- git gc &&
+ git gc --no-cruft &&
git count-objects -v 2>stderr &&
grep "^warning:" stderr | sort >actual &&
cat >expected <<\EOF &&
diff --git a/t/t5306-pack-nobase.sh b/t/t5306-pack-nobase.sh
index 51973f4a51..846c5ca7d3 100755
--- a/t/t5306-pack-nobase.sh
+++ b/t/t5306-pack-nobase.sh
@@ -6,6 +6,8 @@
test_description='git-pack-object with missing base
'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Create A-B chain
diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
index 6d693eef82..526a5a506e 100755
--- a/t/t5310-pack-bitmaps.sh
+++ b/t/t5310-pack-bitmaps.sh
@@ -404,6 +404,26 @@ test_bitmap_cases () {
)
'
+ test_expect_success 'pack.preferBitmapTips' '
+ git init repo &&
+ test_when_finished "rm -rf repo" &&
+ (
+ cd repo &&
+ git config pack.writeBitmapLookupTable '"$writeLookupTable"' &&
+ test_commit_bulk --message="%s" 103 &&
+
+ cat >>.git/config <<-\EOF &&
+ [pack]
+ preferBitmapTips
+ EOF
+ cat >expect <<-\EOF &&
+ error: missing value for '\''pack.preferbitmaptips'\''
+ EOF
+ git repack -adb 2>actual &&
+ test_cmp expect actual
+ )
+ '
+
test_expect_success 'complains about multiple pack bitmaps' '
rm -fr repo &&
git init repo &&
@@ -428,8 +448,9 @@ test_bitmap_cases () {
test_line_count = 2 packs &&
test_line_count = 2 bitmaps &&
- git rev-list --use-bitmap-index HEAD 2>err &&
- grep "ignoring extra bitmap file" err
+ GIT_TRACE2_EVENT=$(pwd)/trace2.txt git rev-list --use-bitmap-index HEAD &&
+ grep "opened bitmap" trace2.txt &&
+ grep "ignoring extra bitmap" trace2.txt
)
'
}
diff --git a/t/t5312-prune-corruption.sh b/t/t5312-prune-corruption.sh
index 9d8e249ae8..230cb38712 100755
--- a/t/t5312-prune-corruption.sh
+++ b/t/t5312-prune-corruption.sh
@@ -14,6 +14,7 @@ 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 cc4cfaa9d3..ceaa6700a2 100755
--- a/t/t5313-pack-bounds-checks.sh
+++ b/t/t5313-pack-bounds-checks.sh
@@ -59,7 +59,7 @@ test_expect_success 'setup' '
test_expect_success 'set up base packfile and variables' '
# the hash of this content starts with ff, which
# makes some later computations much simpler
- echo $(test_oid oidfff) >file &&
+ test_oid oidfff >file &&
git add file &&
git commit -m base &&
git repack -ad &&
diff --git a/t/t5314-pack-cycle-detection.sh b/t/t5314-pack-cycle-detection.sh
index 73a241743a..82734b9a3c 100755
--- a/t/t5314-pack-cycle-detection.sh
+++ b/t/t5314-pack-cycle-detection.sh
@@ -63,13 +63,16 @@ TEST_PASSES_SANITIZE_LEAK=true
# Note that the two variants of "file" must be similar enough to convince git
# to create the delta.
make_pack () {
- {
- printf '%s\n' "-$(git rev-parse $2)"
- printf '%s dummy\n' "$(git rev-parse $1:dummy)"
- printf '%s file\n' "$(git rev-parse $1:file)"
- } |
- git pack-objects --stdout |
- git index-pack --stdin --fix-thin
+ ln1=$(git rev-parse "$2") &&
+ ln2=$(git rev-parse "$1:dummy") &&
+ ln3=$(git rev-parse "$1:file") &&
+ cat >list <<-EOF
+ -$ln1
+ $ln2 dummy
+ $ln3 file
+ EOF
+ git pack-objects --stdout <list >pack &&
+ git index-pack --stdin --fix-thin <pack
}
test_expect_success 'setup' '
diff --git a/t/t5317-pack-objects-filter-objects.sh b/t/t5317-pack-objects-filter-objects.sh
index bb633c9b09..b26d476c64 100755
--- a/t/t5317-pack-objects-filter-objects.sh
+++ b/t/t5317-pack-objects-filter-objects.sh
@@ -5,6 +5,7 @@ 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.
@@ -24,8 +25,9 @@ parse_verify_pack_blob_oid () {
}
test_expect_success 'verify blob count in normal packfile' '
- git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 |
- test_parse_ls_files_stage_oids |
+ git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \
+ >ls_files_result &&
+ test_parse_ls_files_stage_oids <ls_files_result |
sort >expected &&
git -C r1 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -123,8 +125,8 @@ test_expect_success 'setup r2' '
'
test_expect_success 'verify blob count in normal packfile' '
- git -C r2 ls-files -s large.1000 large.10000 |
- test_parse_ls_files_stage_oids |
+ git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
+ test_parse_ls_files_stage_oids <ls_files_result |
sort >expected &&
git -C r2 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -161,8 +163,8 @@ test_expect_success 'verify blob:limit=1000' '
'
test_expect_success 'verify blob:limit=1001' '
- git -C r2 ls-files -s large.1000 |
- test_parse_ls_files_stage_oids |
+ git -C r2 ls-files -s large.1000 >ls_files_result &&
+ test_parse_ls_files_stage_oids <ls_files_result |
sort >expected &&
git -C r2 pack-objects --revs --stdout --filter=blob:limit=1001 >filter.pack <<-EOF &&
@@ -179,8 +181,8 @@ test_expect_success 'verify blob:limit=1001' '
'
test_expect_success 'verify blob:limit=10001' '
- git -C r2 ls-files -s large.1000 large.10000 |
- test_parse_ls_files_stage_oids |
+ git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
+ test_parse_ls_files_stage_oids <ls_files_result |
sort >expected &&
git -C r2 pack-objects --revs --stdout --filter=blob:limit=10001 >filter.pack <<-EOF &&
@@ -197,8 +199,8 @@ test_expect_success 'verify blob:limit=10001' '
'
test_expect_success 'verify blob:limit=1k' '
- git -C r2 ls-files -s large.1000 |
- test_parse_ls_files_stage_oids |
+ git -C r2 ls-files -s large.1000 >ls_files_result &&
+ test_parse_ls_files_stage_oids <ls_files_result |
sort >expected &&
git -C r2 pack-objects --revs --stdout --filter=blob:limit=1k >filter.pack <<-EOF &&
@@ -215,8 +217,8 @@ test_expect_success 'verify blob:limit=1k' '
'
test_expect_success 'verify explicitly specifying oversized blob in input' '
- git -C r2 ls-files -s large.1000 large.10000 |
- test_parse_ls_files_stage_oids |
+ git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
+ test_parse_ls_files_stage_oids <ls_files_result |
sort >expected &&
echo HEAD >objects &&
@@ -233,8 +235,8 @@ test_expect_success 'verify explicitly specifying oversized blob in input' '
'
test_expect_success 'verify blob:limit=1m' '
- git -C r2 ls-files -s large.1000 large.10000 |
- test_parse_ls_files_stage_oids |
+ git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
+ test_parse_ls_files_stage_oids <ls_files_result |
sort >expected &&
git -C r2 pack-objects --revs --stdout --filter=blob:limit=1m >filter.pack <<-EOF &&
@@ -264,6 +266,44 @@ test_expect_success 'verify normal and blob:limit packfiles have same commits/tr
test_cmp expected observed
'
+test_expect_success 'verify small limit and big limit results in small limit' '
+ git -C r2 ls-files -s large.1000 >ls_files_result &&
+ test_parse_ls_files_stage_oids <ls_files_result |
+ sort >expected &&
+
+ git -C r2 pack-objects --revs --stdout --filter=blob:limit=1001 \
+ --filter=blob:limit=10001 >filter.pack <<-EOF &&
+ HEAD
+ EOF
+ git -C r2 index-pack ../filter.pack &&
+
+ git -C r2 verify-pack -v ../filter.pack >verify_result &&
+ grep blob verify_result |
+ parse_verify_pack_blob_oid |
+ sort >observed &&
+
+ test_cmp expected observed
+'
+
+test_expect_success 'verify big limit and small limit results in small limit' '
+ git -C r2 ls-files -s large.1000 >ls_files_result &&
+ test_parse_ls_files_stage_oids <ls_files_result |
+ sort >expected &&
+
+ git -C r2 pack-objects --revs --stdout --filter=blob:limit=10001 \
+ --filter=blob:limit=1001 >filter.pack <<-EOF &&
+ HEAD
+ EOF
+ git -C r2 index-pack ../filter.pack &&
+
+ git -C r2 verify-pack -v ../filter.pack >verify_result &&
+ grep blob verify_result |
+ parse_verify_pack_blob_oid |
+ sort >observed &&
+
+ test_cmp expected observed
+'
+
# Test sparse:path=<path> filter.
# !!!!
# NOTE: sparse:path filter support has been dropped for security reasons,
@@ -289,8 +329,9 @@ test_expect_success 'setup r3' '
'
test_expect_success 'verify blob count in normal packfile' '
- git -C r3 ls-files -s sparse1 sparse2 dir1/sparse1 dir1/sparse2 |
- test_parse_ls_files_stage_oids |
+ git -C r3 ls-files -s sparse1 sparse2 dir1/sparse1 dir1/sparse2 \
+ >ls_files_result &&
+ test_parse_ls_files_stage_oids <ls_files_result |
sort >expected &&
git -C r3 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -341,8 +382,9 @@ test_expect_success 'setup r4' '
'
test_expect_success 'verify blob count in normal packfile' '
- git -C r4 ls-files -s pattern sparse1 sparse2 dir1/sparse1 dir1/sparse2 |
- test_parse_ls_files_stage_oids |
+ git -C r4 ls-files -s pattern sparse1 sparse2 dir1/sparse1 dir1/sparse2 \
+ >ls_files_result &&
+ test_parse_ls_files_stage_oids <ls_files_result |
sort >expected &&
git -C r4 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -359,8 +401,8 @@ test_expect_success 'verify blob count in normal packfile' '
'
test_expect_success 'verify sparse:oid=OID' '
- git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 |
- test_parse_ls_files_stage_oids |
+ git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 >ls_files_result &&
+ test_parse_ls_files_stage_oids <ls_files_result |
sort >expected &&
git -C r4 ls-files -s pattern >staged &&
@@ -379,8 +421,8 @@ test_expect_success 'verify sparse:oid=OID' '
'
test_expect_success 'verify sparse:oid=oid-ish' '
- git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 |
- test_parse_ls_files_stage_oids |
+ git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 >ls_files_result &&
+ test_parse_ls_files_stage_oids <ls_files_result |
sort >expected &&
git -C r4 pack-objects --revs --stdout --filter=sparse:oid=main:pattern >filter.pack <<-EOF &&
@@ -400,8 +442,9 @@ test_expect_success 'verify sparse:oid=oid-ish' '
# This models previously omitted objects that we did not receive.
test_expect_success 'setup r1 - delete loose blobs' '
- git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 |
- test_parse_ls_files_stage_oids |
+ git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \
+ >ls_files_result &&
+ test_parse_ls_files_stage_oids <ls_files_result |
sort >expected &&
for id in `cat expected | sed "s|..|&/|"`
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index 049c5fc8ea..b6e1211578 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -630,7 +630,7 @@ test_expect_success 'detect incorrect generation number' '
test_expect_success 'detect incorrect generation number' '
corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_GENERATION "\01" \
- "non-zero generation number"
+ "commit-graph generation for commit"
'
test_expect_success 'detect incorrect commit date' '
diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
index b5f9b10922..0883c7c6bd 100755
--- a/t/t5319-multi-pack-index.sh
+++ b/t/t5319-multi-pack-index.sh
@@ -183,6 +183,18 @@ test_expect_success 'write midx with --stdin-packs' '
compare_results_with_midx "mixed mode (one pack + extra)"
+test_expect_success 'write with no objects and preferred pack' '
+ test_when_finished "rm -rf empty" &&
+ git init empty &&
+ test_must_fail git -C empty multi-pack-index write \
+ --stdin-packs --preferred-pack=does-not-exist </dev/null 2>err &&
+ cat >expect <<-EOF &&
+ warning: unknown preferred pack: ${SQ}does-not-exist${SQ}
+ error: no pack files to index.
+ EOF
+ test_cmp expect err
+'
+
test_expect_success 'write progress off for redirected stderr' '
git multi-pack-index --object-dir=$objdir write 2>err &&
test_line_count = 0 err
@@ -1015,4 +1027,20 @@ test_expect_success 'complains when run outside of a repository' '
grep "not a git repository" err
'
+test_expect_success 'repack with delta islands' '
+ git init repo &&
+ test_when_finished "rm -fr repo" &&
+ (
+ cd repo &&
+
+ test_commit first &&
+ git repack &&
+ test_commit second &&
+ git repack &&
+
+ git multi-pack-index write &&
+ git -c repack.useDeltaIslands=true multi-pack-index repack
+ )
+'
+
test_done
diff --git a/t/t5320-delta-islands.sh b/t/t5320-delta-islands.sh
index 124d47603d..406363381f 100755
--- a/t/t5320-delta-islands.sh
+++ b/t/t5320-delta-islands.sh
@@ -134,7 +134,7 @@ test_expect_success 'island core places core objects first' '
repack -adfi &&
git verify-pack -v .git/objects/pack/*.pack |
cut -d" " -f1 |
- egrep "$root|$two" >actual &&
+ grep -E "$root|$two" >actual &&
test_cmp expect actual
'
diff --git a/t/t5325-reverse-index.sh b/t/t5325-reverse-index.sh
index d042d26f2b..431a603ca0 100755
--- a/t/t5325-reverse-index.sh
+++ b/t/t5325-reverse-index.sh
@@ -1,17 +1,20 @@
#!/bin/sh
test_description='on-disk reverse index'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# The below tests want control over the 'pack.writeReverseIndex' setting
# themselves to assert various combinations of it with other options.
-sane_unset GIT_TEST_WRITE_REV_INDEX
+sane_unset GIT_TEST_NO_WRITE_REV_INDEX
packdir=.git/objects/pack
test_expect_success 'setup' '
test_commit base &&
+ test_config pack.writeReverseIndex false &&
pack=$(git pack-objects --all $packdir/pack) &&
rev=$packdir/pack-$pack.rev &&
@@ -94,6 +97,17 @@ test_expect_success 'reverse index is not generated when available on disk' '
--batch-check="%(objectsize:disk)" <tip
'
+test_expect_success 'reverse index is ignored when pack.readReverseIndex is false' '
+ test_index_pack true &&
+ test_path_is_file $rev &&
+
+ test_config pack.readReverseIndex false &&
+
+ git rev-parse HEAD >tip &&
+ GIT_TEST_REV_INDEX_DIE_ON_DISK=1 git cat-file \
+ --batch-check="%(objectsize:disk)" <tip
+'
+
test_expect_success 'revindex in-memory vs on-disk' '
git init repo &&
test_when_finished "rm -fr repo" &&
@@ -117,4 +131,78 @@ test_expect_success 'revindex in-memory vs on-disk' '
test_cmp on-disk in-core
)
'
+
+test_expect_success 'fsck succeeds on good rev-index' '
+ test_when_finished rm -fr repo &&
+ git init repo &&
+ (
+ cd repo &&
+
+ test_commit commit &&
+ git -c pack.writeReverseIndex=true repack -ad &&
+ git fsck 2>err &&
+ test_must_be_empty err
+ )
+'
+
+test_expect_success 'set up rev-index corruption tests' '
+ git init corrupt &&
+ (
+ cd corrupt &&
+
+ test_commit commit &&
+ git -c pack.writeReverseIndex=true repack -ad &&
+
+ revfile=$(ls .git/objects/pack/pack-*.rev) &&
+ chmod a+w $revfile &&
+ cp $revfile $revfile.bak
+ )
+'
+
+corrupt_rev_and_verify () {
+ (
+ pos="$1" &&
+ value="$2" &&
+ error="$3" &&
+
+ cd corrupt &&
+ revfile=$(ls .git/objects/pack/pack-*.rev) &&
+
+ # Reset to original rev-file.
+ cp $revfile.bak $revfile &&
+
+ printf "$value" | dd of=$revfile bs=1 seek="$pos" conv=notrunc &&
+ test_must_fail git fsck 2>err &&
+ grep "$error" err
+ )
+}
+
+test_expect_success 'fsck catches invalid checksum' '
+ revfile=$(ls corrupt/.git/objects/pack/pack-*.rev) &&
+ orig_size=$(wc -c <$revfile) &&
+ hashpos=$((orig_size - 10)) &&
+ corrupt_rev_and_verify $hashpos bogus \
+ "invalid checksum"
+'
+
+test_expect_success 'fsck catches invalid row position' '
+ corrupt_rev_and_verify 14 "\07" \
+ "invalid rev-index position"
+'
+
+test_expect_success 'fsck catches invalid header: magic number' '
+ corrupt_rev_and_verify 1 "\07" \
+ "reverse-index file .* has unknown signature"
+'
+
+test_expect_success 'fsck catches invalid header: version' '
+ corrupt_rev_and_verify 7 "\02" \
+ "reverse-index file .* has unsupported version"
+'
+
+test_expect_success 'fsck catches invalid header: hash function' '
+ corrupt_rev_and_verify 11 "\03" \
+ "reverse-index file .* has unsupported hash id"
+'
+
test_done
diff --git a/t/t5326-multi-pack-bitmaps.sh b/t/t5326-multi-pack-bitmaps.sh
index ad6eea5fa0..f771c442d4 100755
--- a/t/t5326-multi-pack-bitmaps.sh
+++ b/t/t5326-multi-pack-bitmaps.sh
@@ -410,4 +410,72 @@ test_expect_success 'preferred pack change with existing MIDX bitmap' '
)
'
+test_expect_success 'tagged commits are selected for bitmapping' '
+ rm -fr repo &&
+ git init repo &&
+ test_when_finished "rm -fr repo" &&
+ (
+ cd repo &&
+
+ test_commit --annotate base &&
+ git repack -d &&
+
+ # Remove refs/heads/main which points at the commit directly,
+ # leaving only a reference to the annotated tag.
+ git branch -M main &&
+ git checkout base &&
+ git branch -d main &&
+
+ git multi-pack-index write --bitmap &&
+
+ git rev-parse HEAD >want &&
+ test-tool bitmap list-commits >actual &&
+ grep $(cat want) actual
+ )
+'
+
+corrupt_file () {
+ chmod a+w "$1" &&
+ printf "bogus" | dd of="$1" bs=1 seek="12" conv=notrunc
+}
+
+test_expect_success 'git fsck correctly identifies good and bad bitmaps' '
+ git init valid &&
+ test_when_finished rm -rf valid &&
+
+ test_commit_bulk 20 &&
+ git repack -adbf &&
+
+ # Move pack-bitmap aside so it is not deleted
+ # in next repack.
+ packbitmap=$(ls .git/objects/pack/pack-*.bitmap) &&
+ mv "$packbitmap" "$packbitmap.bak" &&
+
+ test_commit_bulk 10 &&
+ git repack -b --write-midx &&
+ midxbitmap=$(ls .git/objects/pack/multi-pack-index-*.bitmap) &&
+
+ # Copy MIDX bitmap to backup. Copy pack bitmap from backup.
+ cp "$midxbitmap" "$midxbitmap.bak" &&
+ cp "$packbitmap.bak" "$packbitmap" &&
+
+ # fsck works at first
+ git fsck 2>err &&
+ test_must_be_empty err &&
+
+ corrupt_file "$packbitmap" &&
+ test_must_fail git fsck 2>err &&
+ grep "bitmap file '\''$packbitmap'\'' has invalid checksum" err &&
+
+ cp "$packbitmap.bak" "$packbitmap" &&
+ corrupt_file "$midxbitmap" &&
+ test_must_fail git fsck 2>err &&
+ grep "bitmap file '\''$midxbitmap'\'' has invalid checksum" err &&
+
+ corrupt_file "$packbitmap" &&
+ test_must_fail git fsck 2>err &&
+ grep "bitmap file '\''$midxbitmap'\'' has invalid checksum" err &&
+ grep "bitmap file '\''$packbitmap'\'' has invalid checksum" err
+'
+
test_done
diff --git a/t/t5328-commit-graph-64bit-time.sh b/t/t5328-commit-graph-64bit-time.sh
index 093f0c067a..57e4d9c699 100755
--- a/t/t5328-commit-graph-64bit-time.sh
+++ b/t/t5328-commit-graph-64bit-time.sh
@@ -63,4 +63,13 @@ test_expect_success 'set up and verify repo with generation data overflow chunk'
graph_git_behavior 'overflow 2' repo left right
+test_expect_success 'single commit with generation data exceeding UINT32_MAX' '
+ git init repo-uint32-max &&
+ cd repo-uint32-max &&
+ test_commit --date "@4294967297 +0000" 1 &&
+ git commit-graph write --reachable &&
+ graph_read_expect 1 "generation_data" &&
+ git commit-graph verify
+'
+
test_done
diff --git a/t/t5330-no-lazy-fetch-with-commit-graph.sh b/t/t5330-no-lazy-fetch-with-commit-graph.sh
index 2cc7fd7a47..5eb28f0512 100755
--- a/t/t5330-no-lazy-fetch-with-commit-graph.sh
+++ b/t/t5330-no-lazy-fetch-with-commit-graph.sh
@@ -2,6 +2,7 @@
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
new file mode 100755
index 0000000000..acab31667a
--- /dev/null
+++ b/t/t5331-pack-objects-stdin.sh
@@ -0,0 +1,240 @@
+#!/bin/sh
+
+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 () {
+ git show-index <"$1" >tmp-object-list &&
+ cut -d' ' -f2 tmp-object-list | sort &&
+ rm tmp-object-list
+ }
+
+test_expect_success 'setup for --stdin-packs tests' '
+ git init stdin-packs &&
+ (
+ cd stdin-packs &&
+
+ test_commit A &&
+ test_commit B &&
+ test_commit C &&
+
+ for id in A B C
+ do
+ git pack-objects .git/objects/pack/pack-$id \
+ --incremental --revs <<-EOF || exit 1
+ refs/tags/$id
+ EOF
+ done &&
+
+ ls -la .git/objects/pack
+ )
+'
+
+test_expect_success '--stdin-packs with excluded packs' '
+ (
+ cd stdin-packs &&
+
+ PACK_A="$(basename .git/objects/pack/pack-A-*.pack)" &&
+ PACK_B="$(basename .git/objects/pack/pack-B-*.pack)" &&
+ PACK_C="$(basename .git/objects/pack/pack-C-*.pack)" &&
+
+ git pack-objects test --stdin-packs <<-EOF &&
+ $PACK_A
+ ^$PACK_B
+ $PACK_C
+ EOF
+
+ (
+ git show-index <$(ls .git/objects/pack/pack-A-*.idx) &&
+ git show-index <$(ls .git/objects/pack/pack-C-*.idx)
+ ) >expect.raw &&
+ git show-index <$(ls test-*.idx) >actual.raw &&
+
+ cut -d" " -f2 <expect.raw | sort >expect &&
+ cut -d" " -f2 <actual.raw | sort >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success '--stdin-packs is incompatible with --filter' '
+ (
+ cd stdin-packs &&
+ test_must_fail git pack-objects --stdin-packs --stdout \
+ --filter=blob:none </dev/null 2>err &&
+ test_i18ngrep "cannot use --filter with --stdin-packs" err
+ )
+'
+
+test_expect_success '--stdin-packs is incompatible with --revs' '
+ (
+ cd stdin-packs &&
+ test_must_fail git pack-objects --stdin-packs --revs out \
+ </dev/null 2>err &&
+ test_i18ngrep "cannot use internal rev list with --stdin-packs" err
+ )
+'
+
+test_expect_success '--stdin-packs with loose objects' '
+ (
+ cd stdin-packs &&
+
+ PACK_A="$(basename .git/objects/pack/pack-A-*.pack)" &&
+ PACK_B="$(basename .git/objects/pack/pack-B-*.pack)" &&
+ PACK_C="$(basename .git/objects/pack/pack-C-*.pack)" &&
+
+ test_commit D && # loose
+
+ git pack-objects test2 --stdin-packs --unpacked <<-EOF &&
+ $PACK_A
+ ^$PACK_B
+ $PACK_C
+ EOF
+
+ (
+ git show-index <$(ls .git/objects/pack/pack-A-*.idx) &&
+ git show-index <$(ls .git/objects/pack/pack-C-*.idx) &&
+ git rev-list --objects --no-object-names \
+ refs/tags/C..refs/tags/D
+
+ ) >expect.raw &&
+ ls -la . &&
+ git show-index <$(ls test2-*.idx) >actual.raw &&
+
+ cut -d" " -f2 <expect.raw | sort >expect &&
+ cut -d" " -f2 <actual.raw | sort >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success '--stdin-packs with broken links' '
+ (
+ cd stdin-packs &&
+
+ # make an unreachable object with a bogus parent
+ git cat-file -p HEAD >commit &&
+ sed "s/$(git rev-parse HEAD^)/$(test_oid zero)/" <commit |
+ git hash-object -w -t commit --stdin >in &&
+
+ git pack-objects .git/objects/pack/pack-D <in &&
+
+ PACK_A="$(basename .git/objects/pack/pack-A-*.pack)" &&
+ PACK_B="$(basename .git/objects/pack/pack-B-*.pack)" &&
+ PACK_C="$(basename .git/objects/pack/pack-C-*.pack)" &&
+ PACK_D="$(basename .git/objects/pack/pack-D-*.pack)" &&
+
+ git pack-objects test3 --stdin-packs --unpacked <<-EOF &&
+ $PACK_A
+ ^$PACK_B
+ $PACK_C
+ $PACK_D
+ EOF
+
+ (
+ git show-index <$(ls .git/objects/pack/pack-A-*.idx) &&
+ git show-index <$(ls .git/objects/pack/pack-C-*.idx) &&
+ git show-index <$(ls .git/objects/pack/pack-D-*.idx) &&
+ git rev-list --objects --no-object-names \
+ refs/tags/C..refs/tags/D
+ ) >expect.raw &&
+ git show-index <$(ls test3-*.idx) >actual.raw &&
+
+ cut -d" " -f2 <expect.raw | sort >expect &&
+ cut -d" " -f2 <actual.raw | sort >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success 'pack-objects --stdin with duplicate packfile' '
+ test_when_finished "rm -fr repo" &&
+
+ git init repo &&
+ (
+ cd repo &&
+ test_commit "commit" &&
+ git repack -ad &&
+
+ {
+ basename .git/objects/pack/pack-*.pack &&
+ basename .git/objects/pack/pack-*.pack
+ } >packfiles &&
+
+ git pack-objects --stdin-packs generated-pack <packfiles &&
+ packed_objects .git/objects/pack/pack-*.idx >expect &&
+ packed_objects generated-pack-*.idx >actual &&
+ test_cmp expect actual
+ )
+'
+
+test_expect_success 'pack-objects --stdin with same packfile excluded and included' '
+ test_when_finished "rm -fr repo" &&
+
+ git init repo &&
+ (
+ cd repo &&
+ test_commit "commit" &&
+ git repack -ad &&
+
+ {
+ basename .git/objects/pack/pack-*.pack &&
+ printf "^%s\n" "$(basename .git/objects/pack/pack-*.pack)"
+ } >packfiles &&
+
+ git pack-objects --stdin-packs generated-pack <packfiles &&
+ packed_objects generated-pack-*.idx >packed-objects &&
+ test_must_be_empty packed-objects
+ )
+'
+
+test_expect_success 'pack-objects --stdin with packfiles from alternate object database' '
+ test_when_finished "rm -fr shared member" &&
+
+ # Set up a shared repository with a single packfile.
+ git init shared &&
+ test_commit -C shared "shared-objects" &&
+ git -C shared repack -ad &&
+ basename shared/.git/objects/pack/pack-*.pack >packfile &&
+
+ # Set up a repository that is connected to the shared repository. This
+ # repository has no objects on its own, but we still expect to be able
+ # to pack objects from its alternate.
+ git clone --shared shared member &&
+ git -C member pack-objects --stdin-packs generated-pack <packfile &&
+ test_cmp shared/.git/objects/pack/pack-*.pack member/generated-pack-*.pack
+'
+
+test_expect_success 'pack-objects --stdin with packfiles from main and alternate object database' '
+ test_when_finished "rm -fr shared member" &&
+
+ # Set up a shared repository with a single packfile.
+ git init shared &&
+ test_commit -C shared "shared-commit" &&
+ git -C shared repack -ad &&
+
+ # Set up a repository that is connected to the shared repository. This
+ # repository has a second packfile so that we can verify that it is
+ # possible to write packs that include packfiles from different object
+ # databases.
+ git clone --shared shared member &&
+ test_commit -C member "local-commit" &&
+ git -C member repack -dl &&
+
+ {
+ basename shared/.git/objects/pack/pack-*.pack &&
+ basename member/.git/objects/pack/pack-*.pack
+ } >packfiles &&
+
+ {
+ packed_objects shared/.git/objects/pack/pack-*.idx &&
+ packed_objects member/.git/objects/pack/pack-*.idx
+ } | sort >expected-objects &&
+
+ git -C member pack-objects --stdin-packs generated-pack <packfiles &&
+ packed_objects member/generated-pack-*.idx >actual-objects &&
+ test_cmp expected-objects actual-objects
+'
+
+test_done
diff --git a/t/t5403-post-checkout-hook.sh b/t/t5403-post-checkout-hook.sh
index 978f240cda..cfaae54739 100755
--- a/t/t5403-post-checkout-hook.sh
+++ b/t/t5403-post-checkout-hook.sh
@@ -7,6 +7,7 @@ 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/t5405-send-pack-rewind.sh b/t/t5405-send-pack-rewind.sh
index 11f03239a0..1686ac13aa 100755
--- a/t/t5405-send-pack-rewind.sh
+++ b/t/t5405-send-pack-rewind.sh
@@ -5,6 +5,7 @@ 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 dcbeb42082..d6a9946633 100755
--- a/t/t5406-remote-rejects.sh
+++ b/t/t5406-remote-rejects.sh
@@ -2,6 +2,7 @@
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/t5502-quickfetch.sh b/t/t5502-quickfetch.sh
index b160f8b7fb..7b3ff21b98 100755
--- a/t/t5502-quickfetch.sh
+++ b/t/t5502-quickfetch.sh
@@ -5,6 +5,7 @@ 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/t5504-fetch-receive-strict.sh b/t/t5504-fetch-receive-strict.sh
index ac4099ca89..0b8ab4afdb 100755
--- a/t/t5504-fetch-receive-strict.sh
+++ b/t/t5504-fetch-receive-strict.sh
@@ -4,6 +4,7 @@ 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' '
@@ -138,7 +139,7 @@ This commit object intentionally broken
EOF
test_expect_success 'setup bogus commit' '
- commit="$(git hash-object -t commit -w --stdin <bogus-commit)"
+ commit="$(git hash-object --literally -t commit -w --stdin <bogus-commit)"
'
test_expect_success 'fsck with no skipList input' '
diff --git a/t/t5506-remote-groups.sh b/t/t5506-remote-groups.sh
index 5bac03ede8..0e176175a3 100755
--- a/t/t5506-remote-groups.sh
+++ b/t/t5506-remote-groups.sh
@@ -99,4 +99,13 @@ test_expect_success 'updating remote name updates that remote' '
! repo_fetched two
'
+test_expect_success 'updating group in parallel with a duplicate remote does not fail (fetch)' '
+ mark fetch-group-duplicate &&
+ update_repo one &&
+ git config --add remotes.duplicate one &&
+ git config --add remotes.duplicate one &&
+ git -c fetch.parallel=2 remote update duplicate &&
+ repo_fetched one
+'
+
test_done
diff --git a/t/t5507-remote-environment.sh b/t/t5507-remote-environment.sh
index e6149295b1..c6a6957c50 100755
--- a/t/t5507-remote-environment.sh
+++ b/t/t5507-remote-environment.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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/t5510-fetch.sh b/t/t5510-fetch.sh
index c0b745e33b..dc44da9c79 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -806,6 +806,14 @@ test_expect_success 'fetch.writeCommitGraph with submodules' '
)
'
+# fetches from first configured url
+test_expect_success 'fetch from multiple configured URLs in single remote' '
+ git init url1 &&
+ git remote add multipleurls url1 &&
+ git remote set-url --add multipleurls url2 &&
+ git fetch multipleurls
+'
+
# configured prune tests
set_config_tristate () {
@@ -1163,6 +1171,15 @@ test_expect_success '--no-show-forced-updates' '
)
'
+for section in fetch transfer
+do
+ test_expect_success "$section.hideRefs affects connectivity check" '
+ GIT_TRACE="$PWD"/trace git -c $section.hideRefs=refs -c \
+ $section.hideRefs="!refs/tags/" fetch &&
+ grep "git rev-list .*--exclude-hidden=fetch" trace
+ '
+done
+
setup_negotiation_tip () {
SERVER="$1"
URL="$2"
diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index 20d063fb9a..151c76eb09 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -15,6 +15,19 @@ generate_references () {
done
}
+test_expect_success 'set up fake upload-pack' '
+ # This can be used to simulate an upload-pack that just shows the
+ # contents of the "input" file (prepared with the test-tool pkt-line
+ # helper), and does not do any negotiation (since ls-remote does not
+ # need it).
+ write_script cat-input <<-\EOF
+ # send our initial advertisement/response
+ cat input
+ # soak up the flush packet from the client
+ cat
+ EOF
+'
+
test_expect_success 'dies when no remote found' '
test_must_fail git ls-remote
'
@@ -231,22 +244,25 @@ test_expect_success 'protocol v2 supports hiderefs' '
test_expect_success 'ls-remote --symref' '
git fetch origin &&
- echo "ref: refs/heads/main HEAD" >expect &&
+ echo "ref: refs/heads/main HEAD" >expect.v2 &&
generate_references \
HEAD \
- refs/heads/main >>expect &&
+ refs/heads/main >>expect.v2 &&
+ echo "ref: refs/remotes/origin/main refs/remotes/origin/HEAD" >>expect.v2 &&
oid=$(git rev-parse HEAD) &&
- echo "$oid refs/remotes/origin/HEAD" >>expect &&
+ echo "$oid refs/remotes/origin/HEAD" >>expect.v2 &&
generate_references \
refs/remotes/origin/main \
refs/tags/mark \
refs/tags/mark1.1 \
refs/tags/mark1.10 \
- refs/tags/mark1.2 >>expect &&
- # Protocol v2 supports sending symrefs for refs other than HEAD, so use
- # protocol v0 here.
- GIT_TEST_PROTOCOL_VERSION=0 git ls-remote --symref >actual &&
- test_cmp expect actual
+ refs/tags/mark1.2 >>expect.v2 &&
+ # v0 does not show non-HEAD symrefs
+ grep -v "ref: refs/remotes" <expect.v2 >expect.v0 &&
+ git -c protocol.version=0 ls-remote --symref >actual.v0 &&
+ test_cmp expect.v0 actual.v0 &&
+ git -c protocol.version=2 ls-remote --symref >actual.v2 &&
+ test_cmp expect.v2 actual.v2
'
test_expect_success 'ls-remote with filtered symref (refname)' '
@@ -255,76 +271,41 @@ test_expect_success 'ls-remote with filtered symref (refname)' '
ref: refs/heads/main HEAD
$rev HEAD
EOF
- # Protocol v2 supports sending symrefs for refs other than HEAD, so use
- # protocol v0 here.
- GIT_TEST_PROTOCOL_VERSION=0 git ls-remote --symref . HEAD >actual &&
+ git ls-remote --symref . HEAD >actual &&
test_cmp expect actual
'
-test_expect_failure 'ls-remote with filtered symref (--heads)' '
+test_expect_success 'ls-remote with filtered symref (--heads)' '
git symbolic-ref refs/heads/foo refs/tags/mark &&
- cat >expect <<-EOF &&
+ cat >expect.v2 <<-EOF &&
ref: refs/tags/mark refs/heads/foo
$rev refs/heads/foo
$rev refs/heads/main
EOF
- # Protocol v2 supports sending symrefs for refs other than HEAD, so use
- # protocol v0 here.
- GIT_TEST_PROTOCOL_VERSION=0 git ls-remote --symref --heads . >actual &&
- test_cmp expect actual
+ grep -v "^ref: refs/tags/" <expect.v2 >expect.v0 &&
+ git -c protocol.version=0 ls-remote --symref --heads . >actual.v0 &&
+ test_cmp expect.v0 actual.v0 &&
+ git -c protocol.version=2 ls-remote --symref --heads . >actual.v2 &&
+ test_cmp expect.v2 actual.v2
'
-test_expect_success 'ls-remote --symref omits filtered-out matches' '
- cat >expect <<-EOF &&
- $rev refs/heads/foo
- $rev refs/heads/main
+test_expect_success 'indicate no refs in v0 standards-compliant empty remote' '
+ # Git does not produce an output like this, but it does match the
+ # standard and is produced by other implementations like JGit. So
+ # hard-code the case we care about.
+ #
+ # The actual capabilities do not matter; there are none that would
+ # change how ls-remote behaves.
+ oid=0000000000000000000000000000000000000000 &&
+ test-tool pkt-line pack >input.q <<-EOF &&
+ $oid capabilities^{}Qcaps-go-here
+ 0000
EOF
- # Protocol v2 supports sending symrefs for refs other than HEAD, so use
- # protocol v0 here.
- GIT_TEST_PROTOCOL_VERSION=0 git ls-remote --symref --heads . >actual &&
- test_cmp expect actual &&
- GIT_TEST_PROTOCOL_VERSION=0 git ls-remote --symref . "refs/heads/*" >actual &&
- test_cmp expect actual
-'
-
-test_lazy_prereq GIT_DAEMON '
- test_bool_env GIT_TEST_GIT_DAEMON true
-'
+ q_to_nul <input.q >input &&
-# This test spawns a daemon, so run it only if the user would be OK with
-# testing with git-daemon.
-test_expect_success PIPE,JGIT,GIT_DAEMON 'indicate no refs in standards-compliant empty remote' '
- test_set_port JGIT_DAEMON_PORT &&
- JGIT_DAEMON_PID= &&
- git init --bare empty.git &&
- >empty.git/git-daemon-export-ok &&
- mkfifo jgit_daemon_output &&
- {
- jgit daemon --port="$JGIT_DAEMON_PORT" . >jgit_daemon_output &
- JGIT_DAEMON_PID=$!
- } &&
- test_when_finished kill "$JGIT_DAEMON_PID" &&
- {
- read line &&
- case $line in
- Exporting*)
- ;;
- *)
- echo "Expected: Exporting" &&
- false;;
- esac &&
- read line &&
- case $line in
- "Listening on"*)
- ;;
- *)
- echo "Expected: Listening on" &&
- false;;
- esac
- } <jgit_daemon_output &&
# --exit-code asks the command to exit with 2 when no
# matching refs are found.
- test_expect_code 2 git ls-remote --exit-code git://localhost:$JGIT_DAEMON_PORT/empty.git
+ test_expect_code 2 git ls-remote --exit-code --upload-pack=./cat-input .
'
test_expect_success 'ls-remote works outside repository' '
@@ -345,8 +326,8 @@ test_expect_success 'ls-remote --sort fails gracefully outside repository' '
test_expect_success 'ls-remote patterns work with all protocol versions' '
git for-each-ref --format="%(objectname) %(refname)" \
refs/heads/main refs/remotes/origin/main >expect &&
- git -c protocol.version=1 ls-remote . main >actual.v1 &&
- test_cmp expect actual.v1 &&
+ git -c protocol.version=0 ls-remote . main >actual.v0 &&
+ test_cmp expect actual.v0 &&
git -c protocol.version=2 ls-remote . main >actual.v2 &&
test_cmp expect actual.v2
'
@@ -354,10 +335,49 @@ test_expect_success 'ls-remote patterns work with all protocol versions' '
test_expect_success 'ls-remote prefixes work with all protocol versions' '
git for-each-ref --format="%(objectname) %(refname)" \
refs/heads/ refs/tags/ >expect &&
- git -c protocol.version=1 ls-remote --heads --tags . >actual.v1 &&
- test_cmp expect actual.v1 &&
+ git -c protocol.version=0 ls-remote --heads --tags . >actual.v0 &&
+ test_cmp expect actual.v0 &&
git -c protocol.version=2 ls-remote --heads --tags . >actual.v2 &&
test_cmp expect actual.v2
'
+test_expect_success 'v0 clients can handle multiple symrefs' '
+ # Modern versions of Git will not return multiple symref capabilities
+ # for v0, so we have to hard-code the response. Note that we will
+ # always use both v0 and object-format=sha1 here, as the hard-coded
+ # response reflects a server that only supports those.
+ oid=1234567890123456789012345678901234567890 &&
+ symrefs="symref=refs/remotes/origin/HEAD:refs/remotes/origin/main" &&
+ symrefs="$symrefs symref=HEAD:refs/heads/main" &&
+
+ # Likewise we want to make sure our parser is not fooled by the string
+ # "symref" appearing as part of an earlier cap. But there is no way to
+ # do that via upload-pack, as arbitrary strings can appear only in a
+ # "symref" value itself (where we skip past the values as a whole)
+ # and "agent" (which always appears after "symref", so putting our
+ # parser in a confused state is less interesting).
+ caps="some other caps including a-fake-symref-cap" &&
+
+ test-tool pkt-line pack >input.q <<-EOF &&
+ $oid HEADQ$caps $symrefs
+ $oid refs/heads/main
+ $oid refs/remotes/origin/HEAD
+ $oid refs/remotes/origin/main
+ 0000
+ EOF
+ q_to_nul <input.q >input &&
+
+ cat >expect <<-EOF &&
+ ref: refs/heads/main HEAD
+ $oid HEAD
+ $oid refs/heads/main
+ ref: refs/remotes/origin/main refs/remotes/origin/HEAD
+ $oid refs/remotes/origin/HEAD
+ $oid refs/remotes/origin/main
+ EOF
+
+ git ls-remote --symref --upload-pack=./cat-input . >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t5514-fetch-multiple.sh b/t/t5514-fetch-multiple.sh
index 511ba3bd45..98f034aa77 100755
--- a/t/t5514-fetch-multiple.sh
+++ b/t/t5514-fetch-multiple.sh
@@ -58,6 +58,13 @@ test_expect_success 'git fetch --all' '
test_cmp expect output)
'
+test_expect_success 'git fetch --all --no-write-fetch-head' '
+ (cd test &&
+ rm -f .git/FETCH_HEAD &&
+ git fetch --all --no-write-fetch-head &&
+ test_path_is_missing .git/FETCH_HEAD)
+'
+
test_expect_success 'git fetch --all should continue if a remote has errors' '
(git clone one test2 &&
cd test2 &&
@@ -197,4 +204,9 @@ test_expect_success 'parallel' '
test_i18ngrep "could not fetch .two.*128" err
'
+test_expect_success 'git fetch --multiple --jobs=0 picks a default' '
+ (cd test &&
+ git fetch --multiple --jobs=0)
+'
+
test_done
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 79dc470c01..19ebefa5ac 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -401,6 +401,11 @@ test_expect_success 'push with ambiguity' '
'
+test_expect_success 'push with onelevel ref' '
+ mk_test testrepo heads/main &&
+ test_must_fail git push testrepo HEAD:refs/onelevel
+'
+
test_expect_success 'push with colon-less refspec (1)' '
mk_test testrepo heads/frotz tags/frotz &&
@@ -898,6 +903,13 @@ test_expect_success 'push --delete refuses empty string' '
test_must_fail git push testrepo --delete ""
'
+test_expect_success 'push --delete onelevel refspecs' '
+ mk_test testrepo heads/main &&
+ git -C testrepo update-ref refs/onelevel refs/heads/main &&
+ git push testrepo --delete refs/onelevel &&
+ test_must_fail git -C testrepo rev-parse --verify refs/onelevel
+'
+
test_expect_success 'warn on push to HEAD of non-bare repository' '
mk_test testrepo heads/main &&
(
@@ -1853,55 +1865,24 @@ test_expect_success 'refuse to push a hidden ref, and make sure do not pollute t
test_dir_is_empty testrepo/.git/objects/pack
'
-test_expect_success LIBCURL 'fetch warns or fails when using username:password' '
- message="URL '\''https://username:<redacted>@localhost/'\'' uses plaintext credentials" &&
- test_must_fail git -c transfer.credentialsInUrl=allow fetch https://username:password@localhost 2>err &&
- ! grep "$message" err &&
-
- test_must_fail git -c transfer.credentialsInUrl=warn fetch https://username:password@localhost 2>err &&
- grep "warning: $message" err >warnings &&
- test_line_count = 3 warnings &&
-
- test_must_fail git -c transfer.credentialsInUrl=die fetch https://username:password@localhost 2>err &&
- grep "fatal: $message" err >warnings &&
- test_line_count = 1 warnings &&
-
- test_must_fail git -c transfer.credentialsInUrl=die fetch https://username:@localhost 2>err &&
- grep "fatal: $message" err >warnings &&
- test_line_count = 1 warnings
-'
-
-
-test_expect_success LIBCURL 'push warns or fails when using username:password' '
- message="URL '\''https://username:<redacted>@localhost/'\'' uses plaintext credentials" &&
- test_must_fail git -c transfer.credentialsInUrl=allow push https://username:password@localhost 2>err &&
- ! grep "$message" err &&
-
- test_must_fail git -c transfer.credentialsInUrl=warn push https://username:password@localhost 2>err &&
- grep "warning: $message" err >warnings &&
- test_must_fail git -c transfer.credentialsInUrl=die push https://username:password@localhost 2>err &&
- grep "fatal: $message" err >warnings &&
- test_line_count = 1 warnings
-'
-
test_expect_success 'push with config push.useBitmaps' '
mk_test testrepo heads/main &&
git checkout main &&
test_unconfig push.useBitmaps &&
GIT_TRACE2_EVENT="$PWD/default" \
- git push testrepo main:test &&
+ git push --quiet testrepo main:test &&
test_subcommand git pack-objects --all-progress-implied --revs --stdout \
--thin --delta-base-offset -q <default &&
test_config push.useBitmaps true &&
GIT_TRACE2_EVENT="$PWD/true" \
- git push testrepo main:test2 &&
+ git push --quiet testrepo main:test2 &&
test_subcommand git pack-objects --all-progress-implied --revs --stdout \
--thin --delta-base-offset -q <true &&
test_config push.useBitmaps false &&
GIT_TRACE2_EVENT="$PWD/false" \
- git push testrepo main:test3 &&
+ git push --quiet testrepo main:test3 &&
test_subcommand git pack-objects --all-progress-implied --revs --stdout \
--thin --delta-base-offset -q --no-use-bitmap-index <false
'
diff --git a/t/t5522-pull-symlink.sh b/t/t5522-pull-symlink.sh
index bcff460d0a..cc5496e28f 100755
--- a/t/t5522-pull-symlink.sh
+++ b/t/t5522-pull-symlink.sh
@@ -2,6 +2,7 @@
test_description='pulling from symlinked subdir'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# The scenario we are building:
@@ -78,7 +79,9 @@ test_expect_success SYMLINKS 'pushing from symlinked subdir' '
git commit -m push ./file &&
git push
) &&
- test push = $(git show HEAD:subdir/file)
+ echo push >expect &&
+ git show HEAD:subdir/file >actual &&
+ test_cmp expect actual
'
test_done
diff --git a/t/t5523-push-upstream.sh b/t/t5523-push-upstream.sh
index fdb4292056..c9acc07635 100755
--- a/t/t5523-push-upstream.sh
+++ b/t/t5523-push-upstream.sh
@@ -4,6 +4,7 @@ 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/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
index 3c44f19612..dcdbe26a08 100755
--- a/t/t5526-fetch-submodules.sh
+++ b/t/t5526-fetch-submodules.sh
@@ -167,6 +167,19 @@ test_expect_success "fetch --recurse-submodules recurses into submodules" '
verify_fetch_result actual.err
'
+test_expect_success "fetch --recurse-submodules honors --no-write-fetch-head" '
+ (
+ cd downstream &&
+ git submodule foreach --recursive \
+ sh -c "cd \"\$(git rev-parse --git-dir)\" && rm -f FETCH_HEAD" &&
+
+ git fetch --recurse-submodules --no-write-fetch-head &&
+
+ git submodule foreach --recursive \
+ sh -c "cd \"\$(git rev-parse --git-dir)\" && ! test -f FETCH_HEAD"
+ )
+'
+
test_expect_success "submodule.recurse option triggers recursive fetch" '
add_submodule_commits &&
(
@@ -178,6 +191,7 @@ test_expect_success "submodule.recurse option triggers recursive fetch" '
'
test_expect_success "fetch --recurse-submodules -j2 has the same output behaviour" '
+ test_when_finished "rm -f trace.out" &&
add_submodule_commits &&
(
cd downstream &&
@@ -705,17 +719,30 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .git
test_expect_success 'fetching submodules respects parallel settings' '
git config fetch.recurseSubmodules true &&
+ test_when_finished "rm -f downstream/trace.out" &&
(
cd downstream &&
GIT_TRACE=$(pwd)/trace.out git fetch &&
grep "1 tasks" trace.out &&
+ >trace.out &&
+
GIT_TRACE=$(pwd)/trace.out git fetch --jobs 7 &&
grep "7 tasks" trace.out &&
+ >trace.out &&
+
git config submodule.fetchJobs 8 &&
GIT_TRACE=$(pwd)/trace.out git fetch &&
grep "8 tasks" trace.out &&
+ >trace.out &&
+
GIT_TRACE=$(pwd)/trace.out git fetch --jobs 9 &&
- grep "9 tasks" trace.out
+ grep "9 tasks" trace.out &&
+ >trace.out &&
+
+ GIT_TRACE=$(pwd)/trace.out git -c submodule.fetchJobs=0 fetch &&
+ grep "preparing to run up to [0-9]* tasks" trace.out &&
+ ! grep "up to 0 tasks" trace.out &&
+ >trace.out
)
'
diff --git a/t/t5527-fetch-odd-refs.sh b/t/t5527-fetch-odd-refs.sh
index e2770e4541..98ece27c6a 100755
--- a/t/t5527-fetch-odd-refs.sh
+++ b/t/t5527-fetch-odd-refs.sh
@@ -4,6 +4,7 @@ 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:
diff --git a/t/t5529-push-errors.sh b/t/t5529-push-errors.sh
index ce85fd30ad..0247137cb3 100755
--- a/t/t5529-push-errors.sh
+++ b/t/t5529-push-errors.sh
@@ -1,6 +1,8 @@
#!/bin/sh
test_description='detect some push errors early (before contacting remote)'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup commits' '
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
index 3f58b515ce..302e4cbdba 100755
--- a/t/t5531-deep-submodule-push.sh
+++ b/t/t5531-deep-submodule-push.sh
@@ -512,6 +512,56 @@ test_expect_success 'push only unpushed submodules recursively' '
test_cmp expected_pub actual_pub
'
+setup_subsub () {
+ git init upstream &&
+ git init upstream/sub &&
+ git init upstream/sub/deepsub &&
+ test_commit -C upstream/sub/deepsub innermost &&
+ git -C upstream/sub submodule add ./deepsub deepsub &&
+ git -C upstream/sub commit -m middle &&
+ git -C upstream submodule add ./sub sub &&
+ git -C upstream commit -m outermost &&
+
+ git -c protocol.file.allow=always clone --recurse-submodules upstream downstream &&
+ git -C downstream/sub/deepsub checkout -b downstream-branch &&
+ git -C downstream/sub checkout -b downstream-branch &&
+ git -C downstream checkout -b downstream-branch
+}
+
+new_downstream_commits () {
+ test_commit -C downstream/sub/deepsub new-innermost &&
+ git -C downstream/sub add deepsub &&
+ git -C downstream/sub commit -m new-middle &&
+ git -C downstream add sub &&
+ git -C downstream commit -m new-outermost
+}
+
+test_expect_success 'push with push.recurseSubmodules=only on superproject' '
+ test_when_finished rm -rf upstream downstream &&
+ setup_subsub &&
+ new_downstream_commits &&
+ git -C downstream config push.recurseSubmodules only &&
+ git -C downstream push origin downstream-branch &&
+
+ test_must_fail git -C upstream rev-parse refs/heads/downstream-branch &&
+ git -C upstream/sub rev-parse refs/heads/downstream-branch &&
+ test_must_fail git -C upstream/sub/deepsub rev-parse refs/heads/downstream-branch
+'
+
+test_expect_success 'push with push.recurseSubmodules=only on superproject and top-level submodule' '
+ test_when_finished rm -rf upstream downstream &&
+ setup_subsub &&
+ new_downstream_commits &&
+ git -C downstream config push.recurseSubmodules only &&
+ git -C downstream/sub config push.recurseSubmodules only &&
+ git -C downstream push origin downstream-branch 2> err &&
+
+ test_must_fail git -C upstream rev-parse refs/heads/downstream-branch &&
+ git -C upstream/sub rev-parse refs/heads/downstream-branch &&
+ git -C upstream/sub/deepsub rev-parse refs/heads/downstream-branch &&
+ grep "recursing into submodule with push.recurseSubmodules=only; using on-demand instead" err
+'
+
test_expect_success 'push propagating the remotes name to a submodule' '
git -C work remote add origin ../pub.git &&
git -C work remote add pub ../pub.git &&
diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
index fbad2d5ff5..d0211cd8be 100755
--- a/t/t5541-http-push-smart.sh
+++ b/t/t5541-http-push-smart.sh
@@ -36,28 +36,6 @@ test_expect_success 'setup remote repository' '
setup_askpass_helper
-cat >exp <<EOF
-GET /smart/test_repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
-POST /smart/test_repo.git/git-upload-pack HTTP/1.1 200
-EOF
-test_expect_success 'no empty path components' '
- # Clear the log, so that it does not affect the "used receive-pack
- # service" test which reads the log too.
- test_when_finished ">\"\$HTTPD_ROOT_PATH\"/access.log" &&
-
- # In the URL, add a trailing slash, and see if git appends yet another
- # slash.
- cd "$ROOT_PATH" &&
- git clone $HTTPD_URL/smart/test_repo.git/ test_repo_clone &&
-
- # NEEDSWORK: If the overspecification of the expected result is reduced, we
- # might be able to run this test in all protocol versions.
- if test "$GIT_TEST_PROTOCOL_VERSION" = 0
- then
- check_access_log exp
- fi
-'
-
test_expect_success 'clone remote repository' '
rm -rf test_repo_clone &&
git clone $HTTPD_URL/smart/test_repo.git test_repo_clone &&
@@ -67,6 +45,10 @@ test_expect_success 'clone remote repository' '
'
test_expect_success 'push to remote repository (standard)' '
+ # Clear the log, so that the "used receive-pack service" test below
+ # sees just what we did here.
+ >"$HTTPD_ROOT_PATH"/access.log &&
+
cd "$ROOT_PATH"/test_repo_clone &&
: >path2 &&
git add path2 &&
@@ -80,6 +62,15 @@ test_expect_success 'push to remote repository (standard)' '
test $HEAD = $(git rev-parse --verify HEAD))
'
+test_expect_success 'used receive-pack service' '
+ cat >exp <<-\EOF &&
+ GET /smart/test_repo.git/info/refs?service=git-receive-pack HTTP/1.1 200
+ POST /smart/test_repo.git/git-receive-pack HTTP/1.1 200
+ EOF
+
+ check_access_log exp
+'
+
test_expect_success 'push to remote repository (standard) with sending Accept-Language' '
cat >exp <<-\EOF &&
=> Send header: Accept-Language: ko-KR, *;q=0.9
@@ -141,28 +132,6 @@ test_expect_success 'rejected update prints status' '
'
rm -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/hooks/update"
-cat >exp <<EOF
-GET /smart/test_repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
-POST /smart/test_repo.git/git-upload-pack HTTP/1.1 200
-GET /smart/test_repo.git/info/refs?service=git-receive-pack HTTP/1.1 200
-POST /smart/test_repo.git/git-receive-pack HTTP/1.1 200
-GET /smart/test_repo.git/info/refs?service=git-receive-pack HTTP/1.1 200
-GET /smart/test_repo.git/info/refs?service=git-receive-pack HTTP/1.1 200
-POST /smart/test_repo.git/git-receive-pack HTTP/1.1 200
-GET /smart/test_repo.git/info/refs?service=git-receive-pack HTTP/1.1 200
-POST /smart/test_repo.git/git-receive-pack HTTP/1.1 200
-GET /smart/test_repo.git/info/refs?service=git-receive-pack HTTP/1.1 200
-POST /smart/test_repo.git/git-receive-pack HTTP/1.1 200
-EOF
-test_expect_success 'used receive-pack service' '
- # NEEDSWORK: If the overspecification of the expected result is reduced, we
- # might be able to run this test in all protocol versions.
- if test "$GIT_TEST_PROTOCOL_VERSION" = 0
- then
- check_access_log exp
- fi
-'
-
test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
"$ROOT_PATH"/test_repo_clone main success
diff --git a/t/t5544-pack-objects-hook.sh b/t/t5544-pack-objects-hook.sh
index 54f54f8d2e..1a9e14bbcc 100755
--- a/t/t5544-pack-objects-hook.sh
+++ b/t/t5544-pack-objects-hook.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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/t5546-receive-limits.sh b/t/t5546-receive-limits.sh
index 0b0e987fdb..eed3c9d81a 100755
--- a/t/t5546-receive-limits.sh
+++ b/t/t5546-receive-limits.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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 1876fb34e5..9f899b8c7d 100755
--- a/t/t5547-push-quarantine.sh
+++ b/t/t5547-push-quarantine.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
index d7cf85ffea..8f182a3cbf 100755
--- a/t/t5550-http-fetch-dumb.sh
+++ b/t/t5550-http-fetch-dumb.sh
@@ -234,7 +234,7 @@ test_expect_success 'http-fetch --packfile' '
--index-pack-arg=--keep \
"$HTTPD_URL"/dumb/repo_pack.git/$p >out &&
- grep "^keep.[0-9a-f]\{16,\}$" out &&
+ grep -E "^keep.[0-9a-f]{16,}$" out &&
cut -c6- out >packhash &&
# Ensure that the expected files are generated
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index 6a38294a47..0908534f25 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -1,13 +1,19 @@
#!/bin/sh
-test_description='test smart fetching over http via http-backend'
+: ${HTTP_PROTO:=HTTP/1.1}
+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-lib.sh
. "$TEST_DIRECTORY"/lib-httpd.sh
+test "$HTTP_PROTO" = "HTTP/2" && enable_http2
start_httpd
+test_expect_success HTTP2 'enable client-side http/2' '
+ git config --global http.version HTTP/2
+'
+
test_expect_success 'setup repository' '
git config push.default matching &&
echo content >file &&
@@ -27,35 +33,71 @@ test_expect_success 'create http-accessible bare repository' '
setup_askpass_helper
test_expect_success 'clone http repository' '
- cat >exp <<-\EOF &&
- > GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
- > Accept: */*
- > Accept-Encoding: ENCODINGS
- > Accept-Language: ko-KR, *;q=0.9
- > Pragma: no-cache
- < HTTP/1.1 200 OK
- < Pragma: no-cache
- < Cache-Control: no-cache, max-age=0, must-revalidate
- < Content-Type: application/x-git-upload-pack-advertisement
- > POST /smart/repo.git/git-upload-pack HTTP/1.1
- > Accept-Encoding: ENCODINGS
- > Content-Type: application/x-git-upload-pack-request
- > Accept: application/x-git-upload-pack-result
- > Accept-Language: ko-KR, *;q=0.9
- > Content-Length: xxx
- < HTTP/1.1 200 OK
- < Pragma: no-cache
- < Cache-Control: no-cache, max-age=0, must-revalidate
- < Content-Type: application/x-git-upload-pack-result
+ if test_have_prereq HTTP2 && test "$HTTPD_PROTO" = "https"
+ then
+ # ALPN lets us immediately use HTTP/2; likewise, POSTs with
+ # bodies can use it because they do not need to upgrade
+ INITIAL_PROTO=HTTP/2
+ else
+ # either we are not using HTTP/2, or the initial
+ # request is sent via HTTP/1.1 and asks for upgrade
+ INITIAL_PROTO=HTTP/1.1
+ fi &&
+
+ cat >exp.raw <<-EOF &&
+ > GET /smart/repo.git/info/refs?service=git-upload-pack $INITIAL_PROTO
+ > accept: */*
+ > accept-encoding: ENCODINGS
+ > accept-language: ko-KR, *;q=0.9
+ > pragma: no-cache
+ {V2} > git-protocol: version=2
+ < $HTTP_PROTO 200 OK
+ < pragma: no-cache
+ < cache-control: no-cache, max-age=0, must-revalidate
+ < content-type: application/x-git-upload-pack-advertisement
+ > POST /smart/repo.git/git-upload-pack $INITIAL_PROTO
+ > accept-encoding: ENCODINGS
+ > content-type: application/x-git-upload-pack-request
+ > accept: application/x-git-upload-pack-result
+ > accept-language: ko-KR, *;q=0.9
+ {V2} > git-protocol: version=2
+ > content-length: xxx
+ < $INITIAL_PROTO 200 OK
+ < pragma: no-cache
+ < cache-control: no-cache, max-age=0, must-revalidate
+ < content-type: application/x-git-upload-pack-result
+ {V2} > POST /smart/repo.git/git-upload-pack $INITIAL_PROTO
+ {V2} > accept-encoding: ENCODINGS
+ {V2} > content-type: application/x-git-upload-pack-request
+ {V2} > accept: application/x-git-upload-pack-result
+ {V2} > accept-language: ko-KR, *;q=0.9
+ {V2} > git-protocol: version=2
+ {V2} > content-length: xxx
+ {V2} < $INITIAL_PROTO 200 OK
+ {V2} < pragma: no-cache
+ {V2} < cache-control: no-cache, max-age=0, must-revalidate
+ {V2} < content-type: application/x-git-upload-pack-result
EOF
- GIT_TRACE_CURL=true GIT_TEST_PROTOCOL_VERSION=0 LANGUAGE="ko_KR.UTF-8" \
+ if test "$GIT_TEST_PROTOCOL_VERSION" = 0
+ then
+ sed "/^{V2}/d" <exp.raw >exp
+ else
+ sed "s/^{V2} //" <exp.raw >exp
+ fi &&
+
+ GIT_TRACE_CURL=true LANGUAGE="ko_KR.UTF-8" \
git clone --quiet $HTTPD_URL/smart/repo.git clone 2>err &&
test_cmp file clone/file &&
tr '\''\015'\'' Q <err |
+ perl -pe '\''
+ s/(Send|Recv) header: ([A-Za-z0-9-]+):/
+ "$1 header: " . lc($2) . ":"
+ /e;
+ '\'' |
sed -e "
s/Q\$//
- /^[*] /d
+ /^[^<=]/d
/^== Info:/d
/^=> Send header, /d
/^=> Send header:$/d
@@ -65,6 +107,8 @@ test_expect_success 'clone http repository' '
s/= Recv header://
/^<= Recv data/d
/^=> Send data/d
+ /^<= Recv SSL data/d
+ /^=> Send SSL data/d
/^$/d
/^< $/d
@@ -72,36 +116,35 @@ test_expect_success 'clone http repository' '
s/^/> /
}
- /^> User-Agent: /d
- /^> Host: /d
+ /^< HTTP/ {
+ s/200$/200 OK/
+ }
+ /^< HTTP\\/1.1 101/d
+ /^[><] connection: /d
+ /^[><] upgrade: /d
+ /^> http2-settings: /d
+
+ /^> user-agent: /d
+ /^> host: /d
/^> POST /,$ {
/^> Accept: [*]\\/[*]/d
}
- s/^> Content-Length: .*/> Content-Length: xxx/
+ s/^> content-length: .*/> content-length: xxx/
/^> 00..want /d
/^> 00.*done/d
- /^< Server: /d
- /^< Expires: /d
- /^< Date: /d
- /^< Content-Length: /d
- /^< Transfer-Encoding: /d
+ /^< server: /d
+ /^< expires: /d
+ /^< date: /d
+ /^< content-length: /d
+ /^< transfer-encoding: /d
" >actual &&
- # NEEDSWORK: If the overspecification of the expected result is reduced, we
- # might be able to run this test in all protocol versions.
- if test "$GIT_TEST_PROTOCOL_VERSION" = 0
- then
- sed -e "s/^> Accept-Encoding: .*/> Accept-Encoding: ENCODINGS/" \
- actual >actual.smudged &&
- test_cmp exp actual.smudged &&
-
- grep "Accept-Encoding:.*gzip" actual >actual.gzip &&
- test_line_count = 2 actual.gzip &&
+ sed -e "s/^> accept-encoding: .*/> accept-encoding: ENCODINGS/" \
+ actual >actual.smudged &&
+ test_cmp exp actual.smudged &&
- grep "Accept-Language: ko-KR, *" actual >actual.language &&
- test_line_count = 2 actual.language
- fi
+ grep "accept-encoding:.*gzip" actual >actual.gzip
'
test_expect_success 'fetch changes via http' '
@@ -113,19 +156,9 @@ test_expect_success 'fetch changes via http' '
'
test_expect_success 'used upload-pack service' '
- cat >exp <<-\EOF &&
- GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
- POST /smart/repo.git/git-upload-pack HTTP/1.1 200
- GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
- POST /smart/repo.git/git-upload-pack HTTP/1.1 200
- EOF
-
- # NEEDSWORK: If the overspecification of the expected result is reduced, we
- # might be able to run this test in all protocol versions.
- if test "$GIT_TEST_PROTOCOL_VERSION" = 0
- then
- check_access_log exp
- fi
+ strip_access_log >log &&
+ grep "GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/[0-9.]* 200" log &&
+ grep "POST /smart/repo.git/git-upload-pack HTTP/[0-9.]* 200" log
'
test_expect_success 'follow redirects (301)' '
@@ -274,21 +307,23 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set
127.0.0.1 FALSE /smart_cookies/ FALSE 0 othername othervalue
EOF
sort >expect_cookies.txt <<-\EOF &&
-
127.0.0.1 FALSE /smart_cookies/ FALSE 0 othername othervalue
+ 127.0.0.1 FALSE /smart_cookies/repo.git/ FALSE 0 name value
127.0.0.1 FALSE /smart_cookies/repo.git/info/ FALSE 0 name value
EOF
git config http.cookiefile cookies.txt &&
git config http.savecookies true &&
- git ls-remote $HTTPD_URL/smart_cookies/repo.git main &&
- # NEEDSWORK: If the overspecification of the expected result is reduced, we
- # might be able to run this test in all protocol versions.
- if test "$GIT_TEST_PROTOCOL_VERSION" = 0
- then
- tail -3 cookies.txt | sort >cookies_tail.txt &&
- test_cmp expect_cookies.txt cookies_tail.txt
- fi
+ test_when_finished "
+ git --git-dir=\"\$HTTPD_DOCUMENT_ROOT_PATH/repo.git\" \
+ tag -d cookie-tag
+ " &&
+ git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
+ tag -m "foo" cookie-tag &&
+ git fetch $HTTPD_URL/smart_cookies/repo.git cookie-tag &&
+
+ grep "^[^#]" cookies.txt | sort >cookies_stripped.txt &&
+ test_cmp expect_cookies.txt cookies_stripped.txt
'
test_expect_success 'transfer.hiderefs works over smart-http' '
@@ -347,7 +382,10 @@ test_expect_success CMDLINE_LIMIT \
test_expect_success 'large fetch-pack requests can be sent using chunked encoding' '
GIT_TRACE_CURL=true git -c http.postbuffer=65536 \
clone --bare "$HTTPD_URL/smart/repo.git" split.git 2>err &&
- grep "^=> Send header: Transfer-Encoding: chunked" err
+ {
+ test_have_prereq HTTP2 ||
+ grep "^=> Send header: Transfer-Encoding: chunked" err
+ }
'
test_expect_success 'test allowreachablesha1inwant' '
@@ -580,4 +618,90 @@ test_expect_success 'passing hostname resolution information works' '
git -c "http.curloptResolve=$BOGUS_HOST:$LIB_HTTPD_PORT:127.0.0.1" ls-remote "$BOGUS_HTTPD_URL/smart/repo.git" >/dev/null
'
+# here user%40host is the URL-encoded version of user@host,
+# which is our intentionally-odd username to catch parsing errors
+url_user=$HTTPD_URL_USER/auth/smart/repo.git
+url_userpass=$HTTPD_URL_USER_PASS/auth/smart/repo.git
+url_userblank=$HTTPD_PROTO://user%40host:@$HTTPD_DEST/auth/smart/repo.git
+message="URL .*:<redacted>@.* uses plaintext credentials"
+
+test_expect_success 'clone warns or fails when using username:password' '
+ test_when_finished "rm -rf attempt*" &&
+
+ git -c transfer.credentialsInUrl=allow \
+ clone $url_userpass attempt1 2>err &&
+ ! grep "$message" err &&
+
+ git -c transfer.credentialsInUrl=warn \
+ clone $url_userpass attempt2 2>err &&
+ grep "warning: $message" err >warnings &&
+ test_line_count -ge 1 warnings &&
+
+ test_must_fail git -c transfer.credentialsInUrl=die \
+ clone $url_userpass attempt3 2>err &&
+ grep "fatal: $message" err >warnings &&
+ test_line_count -ge 1 warnings &&
+
+ test_must_fail git -c transfer.credentialsInUrl=die \
+ clone $url_userblank attempt4 2>err &&
+ grep "fatal: $message" err >warnings &&
+ test_line_count -ge 1 warnings
+'
+
+test_expect_success 'clone does not detect username:password when it is https://username@domain:port/' '
+ test_when_finished "rm -rf attempt1" &&
+
+ # we are relying on lib-httpd for url construction, so document our
+ # assumptions
+ case "$HTTPD_URL_USER" in
+ *:[0-9]*) : ok ;;
+ *) BUG "httpd url does not have port: $HTTPD_URL_USER"
+ esac &&
+
+ git -c transfer.credentialsInUrl=warn clone $url_user attempt1 2>err &&
+ ! grep "uses plaintext credentials" err
+'
+
+test_expect_success 'fetch warns or fails when using username:password' '
+ git -c transfer.credentialsInUrl=allow fetch $url_userpass 2>err &&
+ ! grep "$message" err &&
+
+ git -c transfer.credentialsInUrl=warn fetch $url_userpass 2>err &&
+ grep "warning: $message" err >warnings &&
+ test_line_count -ge 1 warnings &&
+
+ test_must_fail git -c transfer.credentialsInUrl=die \
+ fetch $url_userpass 2>err &&
+ grep "fatal: $message" err >warnings &&
+ test_line_count -ge 1 warnings &&
+
+ test_must_fail git -c transfer.credentialsInUrl=die \
+ fetch $url_userblank 2>err &&
+ grep "fatal: $message" err >warnings &&
+ test_line_count -ge 1 warnings
+'
+
+
+test_expect_success 'push warns or fails when using username:password' '
+ git -c transfer.credentialsInUrl=allow push $url_userpass 2>err &&
+ ! grep "$message" err &&
+
+ git -c transfer.credentialsInUrl=warn push $url_userpass 2>err &&
+ grep "warning: $message" err >warnings &&
+
+ test_must_fail git -c transfer.credentialsInUrl=die \
+ push $url_userpass 2>err &&
+ grep "fatal: $message" err >warnings &&
+ test_line_count -ge 1 warnings
+'
+
+test_expect_success 'no empty path components' '
+ # In the URL, add a trailing slash, and see if git appends yet another
+ # slash.
+ git clone $HTTPD_URL/smart/repo.git/ clone-with-slash &&
+
+ strip_access_log >log &&
+ ! grep "//" log
+'
+
test_done
diff --git a/t/t5552-skipping-fetch-negotiator.sh b/t/t5552-skipping-fetch-negotiator.sh
index 165427d57e..b55a9f65e6 100755
--- a/t/t5552-skipping-fetch-negotiator.sh
+++ b/t/t5552-skipping-fetch-negotiator.sh
@@ -3,6 +3,22 @@
test_description='test skipping fetch negotiator'
. ./test-lib.sh
+test_expect_success 'fetch.negotiationalgorithm config' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ cat >repo/.git/config <<-\EOF &&
+ [fetch]
+ negotiationAlgorithm
+ EOF
+ cat >expect <<-\EOF &&
+ error: missing value for '\''fetch.negotiationalgorithm'\''
+ fatal: bad config variable '\''fetch.negotiationalgorithm'\'' in file '\''.git/config'\'' at line 2
+ EOF
+ test_expect_code 128 git -C repo fetch >out 2>actual &&
+ test_must_be_empty out &&
+ test_cmp expect actual
+'
+
have_sent () {
while test "$#" -ne 0
do
diff --git a/t/t5554-noop-fetch-negotiator.sh b/t/t5554-noop-fetch-negotiator.sh
index 2ac7b5859e..06991e8e8a 100755
--- a/t/t5554-noop-fetch-negotiator.sh
+++ b/t/t5554-noop-fetch-negotiator.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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/t5558-clone-bundle-uri.sh b/t/t5558-clone-bundle-uri.sh
index ad666a2d28..996a08e90c 100755
--- a/t/t5558-clone-bundle-uri.sh
+++ b/t/t5558-clone-bundle-uri.sh
@@ -41,6 +41,215 @@ test_expect_success 'clone with file:// bundle' '
test_cmp expect actual
'
+# To get interesting tests for bundle lists, we need to construct a
+# somewhat-interesting commit history.
+#
+# ---------------- bundle-4
+#
+# 4
+# / \
+# ----|---|------- bundle-3
+# | |
+# | 3
+# | |
+# ----|---|------- bundle-2
+# | |
+# 2 |
+# | |
+# ----|---|------- bundle-1
+# \ /
+# 1
+# |
+# (previous commits)
+test_expect_success 'construct incremental bundle list' '
+ (
+ cd clone-from &&
+ git checkout -b base &&
+ test_commit 1 &&
+ git checkout -b left &&
+ test_commit 2 &&
+ git checkout -b right base &&
+ test_commit 3 &&
+ git checkout -b merge left &&
+ git merge right -m "4" &&
+
+ git bundle create bundle-1.bundle base &&
+ git bundle create bundle-2.bundle base..left &&
+ git bundle create bundle-3.bundle base..right &&
+ git bundle create bundle-4.bundle merge --not left right
+ )
+'
+
+test_expect_success 'clone bundle list (file, no heuristic)' '
+ cat >bundle-list <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+
+ [bundle "bundle-1"]
+ uri = file://$(pwd)/clone-from/bundle-1.bundle
+
+ [bundle "bundle-2"]
+ uri = file://$(pwd)/clone-from/bundle-2.bundle
+
+ [bundle "bundle-3"]
+ uri = file://$(pwd)/clone-from/bundle-3.bundle
+
+ [bundle "bundle-4"]
+ uri = file://$(pwd)/clone-from/bundle-4.bundle
+ EOF
+
+ git clone --bundle-uri="file://$(pwd)/bundle-list" \
+ clone-from clone-list-file 2>err &&
+ ! grep "Repository lacks these prerequisite commits" err &&
+
+ git -C clone-from for-each-ref --format="%(objectname)" >oids &&
+ git -C clone-list-file cat-file --batch-check <oids &&
+
+ git -C clone-list-file for-each-ref --format="%(refname)" >refs &&
+ grep "refs/bundles/" refs >actual &&
+ cat >expect <<-\EOF &&
+ refs/bundles/base
+ refs/bundles/left
+ refs/bundles/merge
+ refs/bundles/right
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'clone bundle list (file, all mode, some failures)' '
+ cat >bundle-list <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+
+ # Does not exist. Should be skipped.
+ [bundle "bundle-0"]
+ uri = file://$(pwd)/clone-from/bundle-0.bundle
+
+ [bundle "bundle-1"]
+ uri = file://$(pwd)/clone-from/bundle-1.bundle
+
+ [bundle "bundle-2"]
+ uri = file://$(pwd)/clone-from/bundle-2.bundle
+
+ # No bundle-3 means bundle-4 will not apply.
+
+ [bundle "bundle-4"]
+ uri = file://$(pwd)/clone-from/bundle-4.bundle
+
+ # Does not exist. Should be skipped.
+ [bundle "bundle-5"]
+ uri = file://$(pwd)/clone-from/bundle-5.bundle
+ EOF
+
+ GIT_TRACE2_PERF=1 \
+ git clone --bundle-uri="file://$(pwd)/bundle-list" \
+ clone-from clone-all-some 2>err &&
+ ! grep "Repository lacks these prerequisite commits" err &&
+ ! grep "fatal" err &&
+ grep "warning: failed to download bundle from URI" err &&
+
+ git -C clone-from for-each-ref --format="%(objectname)" >oids &&
+ git -C clone-all-some cat-file --batch-check <oids &&
+
+ git -C clone-all-some for-each-ref --format="%(refname)" >refs &&
+ grep "refs/bundles/" refs >actual &&
+ cat >expect <<-\EOF &&
+ refs/bundles/base
+ refs/bundles/left
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'clone bundle list (file, all mode, all failures)' '
+ cat >bundle-list <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+
+ # Does not exist. Should be skipped.
+ [bundle "bundle-0"]
+ uri = file://$(pwd)/clone-from/bundle-0.bundle
+
+ # Does not exist. Should be skipped.
+ [bundle "bundle-5"]
+ uri = file://$(pwd)/clone-from/bundle-5.bundle
+ EOF
+
+ git clone --bundle-uri="file://$(pwd)/bundle-list" \
+ clone-from clone-all-fail 2>err &&
+ ! grep "Repository lacks these prerequisite commits" err &&
+ ! grep "fatal" err &&
+ grep "warning: failed to download bundle from URI" err &&
+
+ git -C clone-from for-each-ref --format="%(objectname)" >oids &&
+ git -C clone-all-fail cat-file --batch-check <oids &&
+
+ git -C clone-all-fail for-each-ref --format="%(refname)" >refs &&
+ ! grep "refs/bundles/" refs
+'
+
+test_expect_success 'clone bundle list (file, any mode)' '
+ cat >bundle-list <<-EOF &&
+ [bundle]
+ version = 1
+ mode = any
+
+ # Does not exist. Should be skipped.
+ [bundle "bundle-0"]
+ uri = file://$(pwd)/clone-from/bundle-0.bundle
+
+ [bundle "bundle-1"]
+ uri = file://$(pwd)/clone-from/bundle-1.bundle
+
+ # Does not exist. Should be skipped.
+ [bundle "bundle-5"]
+ uri = file://$(pwd)/clone-from/bundle-5.bundle
+ EOF
+
+ git clone --bundle-uri="file://$(pwd)/bundle-list" \
+ clone-from clone-any-file 2>err &&
+ ! grep "Repository lacks these prerequisite commits" err &&
+
+ git -C clone-from for-each-ref --format="%(objectname)" >oids &&
+ git -C clone-any-file cat-file --batch-check <oids &&
+
+ git -C clone-any-file for-each-ref --format="%(refname)" >refs &&
+ grep "refs/bundles/" refs >actual &&
+ cat >expect <<-\EOF &&
+ refs/bundles/base
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'clone bundle list (file, any mode, all failures)' '
+ cat >bundle-list <<-EOF &&
+ [bundle]
+ version = 1
+ mode = any
+
+ # Does not exist. Should be skipped.
+ [bundle "bundle-0"]
+ uri = $HTTPD_URL/bundle-0.bundle
+
+ # Does not exist. Should be skipped.
+ [bundle "bundle-5"]
+ uri = $HTTPD_URL/bundle-5.bundle
+ EOF
+
+ git clone --bundle-uri="file://$(pwd)/bundle-list" \
+ clone-from clone-any-fail 2>err &&
+ ! grep "fatal" err &&
+ grep "warning: failed to download bundle from URI" err &&
+
+ git -C clone-from for-each-ref --format="%(objectname)" >oids &&
+ git -C clone-any-fail cat-file --batch-check <oids &&
+
+ git -C clone-any-fail for-each-ref --format="%(refname)" >refs &&
+ ! grep "refs/bundles/" refs
+'
+
#########################################################################
# HTTP tests begin here
@@ -75,6 +284,774 @@ test_expect_success 'clone HTTP bundle' '
test_config -C clone-http log.excludedecoration refs/bundle/
'
+test_expect_success 'clone bundle list (HTTP, no heuristic)' '
+ test_when_finished rm -f trace*.txt &&
+
+ cp clone-from/bundle-*.bundle "$HTTPD_DOCUMENT_ROOT_PATH/" &&
+ cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+
+ [bundle "bundle-1"]
+ uri = $HTTPD_URL/bundle-1.bundle
+
+ [bundle "bundle-2"]
+ uri = $HTTPD_URL/bundle-2.bundle
+
+ [bundle "bundle-3"]
+ uri = $HTTPD_URL/bundle-3.bundle
+
+ [bundle "bundle-4"]
+ uri = $HTTPD_URL/bundle-4.bundle
+ EOF
+
+ GIT_TRACE2_EVENT="$(pwd)/trace-clone.txt" \
+ git clone --bundle-uri="$HTTPD_URL/bundle-list" \
+ clone-from clone-list-http 2>err &&
+ ! grep "Repository lacks these prerequisite commits" err &&
+
+ git -C clone-from for-each-ref --format="%(objectname)" >oids &&
+ git -C clone-list-http cat-file --batch-check <oids &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-1.bundle
+ $HTTPD_URL/bundle-2.bundle
+ $HTTPD_URL/bundle-3.bundle
+ $HTTPD_URL/bundle-4.bundle
+ $HTTPD_URL/bundle-list
+ EOF
+
+ # Sort the list, since the order is not well-defined
+ # without a heuristic.
+ test_remote_https_urls <trace-clone.txt | sort >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'clone bundle list (HTTP, any mode)' '
+ cp clone-from/bundle-*.bundle "$HTTPD_DOCUMENT_ROOT_PATH/" &&
+ cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle]
+ version = 1
+ mode = any
+
+ # Does not exist. Should be skipped.
+ [bundle "bundle-0"]
+ uri = $HTTPD_URL/bundle-0.bundle
+
+ [bundle "bundle-1"]
+ uri = $HTTPD_URL/bundle-1.bundle
+
+ # Does not exist. Should be skipped.
+ [bundle "bundle-5"]
+ uri = $HTTPD_URL/bundle-5.bundle
+ EOF
+
+ git clone --bundle-uri="$HTTPD_URL/bundle-list" \
+ clone-from clone-any-http 2>err &&
+ ! grep "fatal" err &&
+ grep "warning: failed to download bundle from URI" err &&
+
+ git -C clone-from for-each-ref --format="%(objectname)" >oids &&
+ git -C clone-any-http cat-file --batch-check <oids &&
+
+ git -C clone-list-file for-each-ref --format="%(refname)" >refs &&
+ grep "refs/bundles/" refs >actual &&
+ cat >expect <<-\EOF &&
+ refs/bundles/base
+ refs/bundles/left
+ refs/bundles/merge
+ refs/bundles/right
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'clone bundle list (http, creationToken)' '
+ test_when_finished rm -f trace*.txt &&
+
+ cp clone-from/bundle-*.bundle "$HTTPD_DOCUMENT_ROOT_PATH/" &&
+ cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ heuristic = creationToken
+
+ [bundle "bundle-1"]
+ uri = bundle-1.bundle
+ creationToken = 1
+
+ [bundle "bundle-2"]
+ uri = bundle-2.bundle
+ creationToken = 2
+
+ [bundle "bundle-3"]
+ uri = bundle-3.bundle
+ creationToken = 3
+
+ [bundle "bundle-4"]
+ uri = bundle-4.bundle
+ creationToken = 4
+ EOF
+
+ GIT_TRACE2_EVENT="$(pwd)/trace-clone.txt" git \
+ clone --bundle-uri="$HTTPD_URL/bundle-list" \
+ "$HTTPD_URL/smart/fetch.git" clone-list-http-2 &&
+
+ git -C clone-from for-each-ref --format="%(objectname)" >oids &&
+ git -C clone-list-http-2 cat-file --batch-check <oids &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-list
+ $HTTPD_URL/bundle-4.bundle
+ $HTTPD_URL/bundle-3.bundle
+ $HTTPD_URL/bundle-2.bundle
+ $HTTPD_URL/bundle-1.bundle
+ EOF
+
+ test_remote_https_urls <trace-clone.txt >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'clone incomplete bundle list (http, creationToken)' '
+ test_when_finished rm -f trace*.txt &&
+
+ cp clone-from/bundle-*.bundle "$HTTPD_DOCUMENT_ROOT_PATH/" &&
+ cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ heuristic = creationToken
+
+ [bundle "bundle-1"]
+ uri = bundle-1.bundle
+ creationToken = 1
+ EOF
+
+ GIT_TRACE2_EVENT=$(pwd)/trace-clone.txt \
+ git clone --bundle-uri="$HTTPD_URL/bundle-list" \
+ --single-branch --branch=base --no-tags \
+ "$HTTPD_URL/smart/fetch.git" clone-token-http &&
+
+ test_cmp_config -C clone-token-http "$HTTPD_URL/bundle-list" fetch.bundleuri &&
+ test_cmp_config -C clone-token-http 1 fetch.bundlecreationtoken &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-list
+ $HTTPD_URL/bundle-1.bundle
+ EOF
+
+ test_remote_https_urls <trace-clone.txt >actual &&
+ test_cmp expect actual &&
+
+ # We now have only one bundle ref.
+ git -C clone-token-http for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ cat >expect <<-\EOF &&
+ refs/bundles/base
+ EOF
+ test_cmp expect refs &&
+
+ # Add remaining bundles, exercising the "deepening" strategy
+ # for downloading via the creationToken heurisitc.
+ cat >>"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle "bundle-2"]
+ uri = bundle-2.bundle
+ creationToken = 2
+
+ [bundle "bundle-3"]
+ uri = bundle-3.bundle
+ creationToken = 3
+
+ [bundle "bundle-4"]
+ uri = bundle-4.bundle
+ creationToken = 4
+ EOF
+
+ GIT_TRACE2_EVENT="$(pwd)/trace1.txt" \
+ git -C clone-token-http fetch origin --no-tags \
+ refs/heads/merge:refs/heads/merge &&
+ test_cmp_config -C clone-token-http 4 fetch.bundlecreationtoken &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-list
+ $HTTPD_URL/bundle-4.bundle
+ $HTTPD_URL/bundle-3.bundle
+ $HTTPD_URL/bundle-2.bundle
+ EOF
+
+ test_remote_https_urls <trace1.txt >actual &&
+ test_cmp expect actual &&
+
+ # We now have all bundle refs.
+ git -C clone-token-http for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+
+ cat >expect <<-\EOF &&
+ refs/bundles/base
+ refs/bundles/left
+ refs/bundles/merge
+ refs/bundles/right
+ EOF
+ test_cmp expect refs
+'
+
+test_expect_success 'http clone with bundle.heuristic creates fetch.bundleURI' '
+ test_when_finished rm -rf fetch-http-4 trace*.txt &&
+
+ cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ heuristic = creationToken
+
+ [bundle "bundle-1"]
+ uri = bundle-1.bundle
+ creationToken = 1
+ EOF
+
+ GIT_TRACE2_EVENT="$(pwd)/trace-clone.txt" \
+ git clone --single-branch --branch=base \
+ --bundle-uri="$HTTPD_URL/bundle-list" \
+ "$HTTPD_URL/smart/fetch.git" fetch-http-4 &&
+
+ test_cmp_config -C fetch-http-4 "$HTTPD_URL/bundle-list" fetch.bundleuri &&
+ test_cmp_config -C fetch-http-4 1 fetch.bundlecreationtoken &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-list
+ $HTTPD_URL/bundle-1.bundle
+ EOF
+
+ test_remote_https_urls <trace-clone.txt >actual &&
+ test_cmp expect actual &&
+
+ # only received base ref from bundle-1
+ git -C fetch-http-4 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ cat >expect <<-\EOF &&
+ refs/bundles/base
+ EOF
+ test_cmp expect refs &&
+
+ cat >>"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle "bundle-2"]
+ uri = bundle-2.bundle
+ creationToken = 2
+ EOF
+
+ # Fetch the objects for bundle-2 _and_ bundle-3.
+ GIT_TRACE2_EVENT="$(pwd)/trace1.txt" \
+ git -C fetch-http-4 fetch origin --no-tags \
+ refs/heads/left:refs/heads/left \
+ refs/heads/right:refs/heads/right &&
+ test_cmp_config -C fetch-http-4 2 fetch.bundlecreationtoken &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-list
+ $HTTPD_URL/bundle-2.bundle
+ EOF
+
+ test_remote_https_urls <trace1.txt >actual &&
+ test_cmp expect actual &&
+
+ # received left from bundle-2
+ git -C fetch-http-4 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ cat >expect <<-\EOF &&
+ refs/bundles/base
+ refs/bundles/left
+ EOF
+ test_cmp expect refs &&
+
+ # No-op fetch
+ GIT_TRACE2_EVENT="$(pwd)/trace1b.txt" \
+ git -C fetch-http-4 fetch origin --no-tags \
+ refs/heads/left:refs/heads/left \
+ refs/heads/right:refs/heads/right &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-list
+ EOF
+ test_remote_https_urls <trace1b.txt >actual &&
+ test_cmp expect actual &&
+
+ cat >>"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle "bundle-3"]
+ uri = bundle-3.bundle
+ creationToken = 3
+
+ [bundle "bundle-4"]
+ uri = bundle-4.bundle
+ creationToken = 4
+ EOF
+
+ # This fetch should skip bundle-3.bundle, since its objects are
+ # already local (we have the requisite commits for bundle-4.bundle).
+ GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
+ git -C fetch-http-4 fetch origin --no-tags \
+ refs/heads/merge:refs/heads/merge &&
+ test_cmp_config -C fetch-http-4 4 fetch.bundlecreationtoken &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-list
+ $HTTPD_URL/bundle-4.bundle
+ EOF
+
+ test_remote_https_urls <trace2.txt >actual &&
+ test_cmp expect actual &&
+
+ # received merge ref from bundle-4, but right is missing
+ # because we did not download bundle-3.
+ git -C fetch-http-4 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+
+ cat >expect <<-\EOF &&
+ refs/bundles/base
+ refs/bundles/left
+ refs/bundles/merge
+ EOF
+ test_cmp expect refs &&
+
+ # No-op fetch
+ GIT_TRACE2_EVENT="$(pwd)/trace2b.txt" \
+ git -C fetch-http-4 fetch origin &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-list
+ EOF
+ test_remote_https_urls <trace2b.txt >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'creationToken heuristic with failed downloads (clone)' '
+ test_when_finished rm -rf download-* trace*.txt &&
+
+ # Case 1: base bundle does not exist, nothing can unbundle
+ cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ heuristic = creationToken
+
+ [bundle "bundle-1"]
+ uri = fake.bundle
+ creationToken = 1
+
+ [bundle "bundle-2"]
+ uri = bundle-2.bundle
+ creationToken = 2
+
+ [bundle "bundle-3"]
+ uri = bundle-3.bundle
+ creationToken = 3
+
+ [bundle "bundle-4"]
+ uri = bundle-4.bundle
+ creationToken = 4
+ EOF
+
+ GIT_TRACE2_EVENT="$(pwd)/trace-clone-1.txt" \
+ git clone --single-branch --branch=base \
+ --bundle-uri="$HTTPD_URL/bundle-list" \
+ "$HTTPD_URL/smart/fetch.git" download-1 &&
+
+ # Bundle failure does not set these configs.
+ test_must_fail git -C download-1 config fetch.bundleuri &&
+ test_must_fail git -C download-1 config fetch.bundlecreationtoken &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-list
+ $HTTPD_URL/bundle-4.bundle
+ $HTTPD_URL/bundle-3.bundle
+ $HTTPD_URL/bundle-2.bundle
+ $HTTPD_URL/fake.bundle
+ EOF
+ test_remote_https_urls <trace-clone-1.txt >actual &&
+ test_cmp expect actual &&
+
+ # All bundles failed to unbundle
+ git -C download-1 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ test_must_be_empty refs &&
+
+ # Case 2: middle bundle does not exist, only two bundles can unbundle
+ cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ heuristic = creationToken
+
+ [bundle "bundle-1"]
+ uri = bundle-1.bundle
+ creationToken = 1
+
+ [bundle "bundle-2"]
+ uri = fake.bundle
+ creationToken = 2
+
+ [bundle "bundle-3"]
+ uri = bundle-3.bundle
+ creationToken = 3
+
+ [bundle "bundle-4"]
+ uri = bundle-4.bundle
+ creationToken = 4
+ EOF
+
+ GIT_TRACE2_EVENT="$(pwd)/trace-clone-2.txt" \
+ git clone --single-branch --branch=base \
+ --bundle-uri="$HTTPD_URL/bundle-list" \
+ "$HTTPD_URL/smart/fetch.git" download-2 &&
+
+ # Bundle failure does not set these configs.
+ test_must_fail git -C download-2 config fetch.bundleuri &&
+ test_must_fail git -C download-2 config fetch.bundlecreationtoken &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-list
+ $HTTPD_URL/bundle-4.bundle
+ $HTTPD_URL/bundle-3.bundle
+ $HTTPD_URL/fake.bundle
+ $HTTPD_URL/bundle-1.bundle
+ EOF
+ test_remote_https_urls <trace-clone-2.txt >actual &&
+ test_cmp expect actual &&
+
+ # bundle-1 and bundle-3 could unbundle, but bundle-4 could not
+ git -C download-2 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ cat >expect <<-EOF &&
+ refs/bundles/base
+ refs/bundles/right
+ EOF
+ test_cmp expect refs &&
+
+ # Case 3: top bundle does not exist, rest unbundle fine.
+ cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ heuristic = creationToken
+
+ [bundle "bundle-1"]
+ uri = bundle-1.bundle
+ creationToken = 1
+
+ [bundle "bundle-2"]
+ uri = bundle-2.bundle
+ creationToken = 2
+
+ [bundle "bundle-3"]
+ uri = bundle-3.bundle
+ creationToken = 3
+
+ [bundle "bundle-4"]
+ uri = fake.bundle
+ creationToken = 4
+ EOF
+
+ GIT_TRACE2_EVENT="$(pwd)/trace-clone-3.txt" \
+ git clone --single-branch --branch=base \
+ --bundle-uri="$HTTPD_URL/bundle-list" \
+ "$HTTPD_URL/smart/fetch.git" download-3 &&
+
+ # As long as we have continguous successful downloads,
+ # we _do_ set these configs.
+ test_cmp_config -C download-3 "$HTTPD_URL/bundle-list" fetch.bundleuri &&
+ test_cmp_config -C download-3 3 fetch.bundlecreationtoken &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-list
+ $HTTPD_URL/fake.bundle
+ $HTTPD_URL/bundle-3.bundle
+ $HTTPD_URL/bundle-2.bundle
+ $HTTPD_URL/bundle-1.bundle
+ EOF
+ test_remote_https_urls <trace-clone-3.txt >actual &&
+ test_cmp expect actual &&
+
+ # fake.bundle did not unbundle, but the others did.
+ git -C download-3 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ cat >expect <<-EOF &&
+ refs/bundles/base
+ refs/bundles/left
+ refs/bundles/right
+ EOF
+ test_cmp expect refs
+'
+
+# Expand the bundle list to include other interesting shapes, specifically
+# interesting for use when fetching from a previous state.
+#
+# ---------------- bundle-7
+# 7
+# _/|\_
+# ---/--|--\------ bundle-6
+# 5 | 6
+# --|---|---|----- bundle-4
+# | 4 |
+# | / \ /
+# --|-|---|/------ bundle-3 (the client will be caught up to this point.)
+# \ | 3
+# ---\|---|------- bundle-2
+# 2 |
+# ----|---|------- bundle-1
+# \ /
+# 1
+# |
+# (previous commits)
+test_expect_success 'expand incremental bundle list' '
+ (
+ cd clone-from &&
+ git checkout -b lefter left &&
+ test_commit 5 &&
+ git checkout -b righter right &&
+ test_commit 6 &&
+ git checkout -b top lefter &&
+ git merge -m "7" merge righter &&
+
+ git bundle create bundle-6.bundle lefter righter --not left right &&
+ git bundle create bundle-7.bundle top --not lefter merge righter &&
+
+ cp bundle-*.bundle "$HTTPD_DOCUMENT_ROOT_PATH/"
+ ) &&
+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/fetch.git" fetch origin +refs/heads/*:refs/heads/*
+'
+
+test_expect_success 'creationToken heuristic with failed downloads (fetch)' '
+ test_when_finished rm -rf download-* trace*.txt &&
+
+ cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ heuristic = creationToken
+
+ [bundle "bundle-1"]
+ uri = bundle-1.bundle
+ creationToken = 1
+
+ [bundle "bundle-2"]
+ uri = bundle-2.bundle
+ creationToken = 2
+
+ [bundle "bundle-3"]
+ uri = bundle-3.bundle
+ creationToken = 3
+ EOF
+
+ git clone --single-branch --branch=left \
+ --bundle-uri="$HTTPD_URL/bundle-list" \
+ "$HTTPD_URL/smart/fetch.git" fetch-base &&
+ test_cmp_config -C fetch-base "$HTTPD_URL/bundle-list" fetch.bundleURI &&
+ test_cmp_config -C fetch-base 3 fetch.bundleCreationToken &&
+
+ # Case 1: all bundles exist: successful unbundling of all bundles
+ cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ heuristic = creationToken
+
+ [bundle "bundle-1"]
+ uri = bundle-1.bundle
+ creationToken = 1
+
+ [bundle "bundle-2"]
+ uri = bundle-2.bundle
+ creationToken = 2
+
+ [bundle "bundle-3"]
+ uri = bundle-3.bundle
+ creationToken = 3
+
+ [bundle "bundle-4"]
+ uri = bundle-4.bundle
+ creationToken = 4
+
+ [bundle "bundle-6"]
+ uri = bundle-6.bundle
+ creationToken = 6
+
+ [bundle "bundle-7"]
+ uri = bundle-7.bundle
+ creationToken = 7
+ EOF
+
+ cp -r fetch-base fetch-1 &&
+ GIT_TRACE2_EVENT="$(pwd)/trace-fetch-1.txt" \
+ git -C fetch-1 fetch origin &&
+ test_cmp_config -C fetch-1 7 fetch.bundlecreationtoken &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-list
+ $HTTPD_URL/bundle-7.bundle
+ $HTTPD_URL/bundle-6.bundle
+ $HTTPD_URL/bundle-4.bundle
+ EOF
+ test_remote_https_urls <trace-fetch-1.txt >actual &&
+ test_cmp expect actual &&
+
+ # Check which bundles have unbundled by refs
+ git -C fetch-1 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ cat >expect <<-EOF &&
+ refs/bundles/base
+ refs/bundles/left
+ refs/bundles/lefter
+ refs/bundles/merge
+ refs/bundles/right
+ refs/bundles/righter
+ refs/bundles/top
+ EOF
+ test_cmp expect refs &&
+
+ # Case 2: middle bundle does not exist, only bundle-4 can unbundle
+ cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ heuristic = creationToken
+
+ [bundle "bundle-1"]
+ uri = bundle-1.bundle
+ creationToken = 1
+
+ [bundle "bundle-2"]
+ uri = bundle-2.bundle
+ creationToken = 2
+
+ [bundle "bundle-3"]
+ uri = bundle-3.bundle
+ creationToken = 3
+
+ [bundle "bundle-4"]
+ uri = bundle-4.bundle
+ creationToken = 4
+
+ [bundle "bundle-6"]
+ uri = fake.bundle
+ creationToken = 6
+
+ [bundle "bundle-7"]
+ uri = bundle-7.bundle
+ creationToken = 7
+ EOF
+
+ cp -r fetch-base fetch-2 &&
+ GIT_TRACE2_EVENT="$(pwd)/trace-fetch-2.txt" \
+ git -C fetch-2 fetch origin &&
+
+ # Since bundle-7 fails to unbundle, do not update creation token.
+ test_cmp_config -C fetch-2 3 fetch.bundlecreationtoken &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-list
+ $HTTPD_URL/bundle-7.bundle
+ $HTTPD_URL/fake.bundle
+ $HTTPD_URL/bundle-4.bundle
+ EOF
+ test_remote_https_urls <trace-fetch-2.txt >actual &&
+ test_cmp expect actual &&
+
+ # Check which bundles have unbundled by refs
+ git -C fetch-2 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ cat >expect <<-EOF &&
+ refs/bundles/base
+ refs/bundles/left
+ refs/bundles/merge
+ refs/bundles/right
+ EOF
+ test_cmp expect refs &&
+
+ # Case 3: top bundle does not exist, rest unbundle fine.
+ cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ heuristic = creationToken
+
+ [bundle "bundle-1"]
+ uri = bundle-1.bundle
+ creationToken = 1
+
+ [bundle "bundle-2"]
+ uri = bundle-2.bundle
+ creationToken = 2
+
+ [bundle "bundle-3"]
+ uri = bundle-3.bundle
+ creationToken = 3
+
+ [bundle "bundle-4"]
+ uri = bundle-4.bundle
+ creationToken = 4
+
+ [bundle "bundle-6"]
+ uri = bundle-6.bundle
+ creationToken = 6
+
+ [bundle "bundle-7"]
+ uri = fake.bundle
+ creationToken = 7
+ EOF
+
+ cp -r fetch-base fetch-3 &&
+ GIT_TRACE2_EVENT="$(pwd)/trace-fetch-3.txt" \
+ git -C fetch-3 fetch origin &&
+
+ # As long as we have continguous successful downloads,
+ # we _do_ set the maximum creation token.
+ test_cmp_config -C fetch-3 6 fetch.bundlecreationtoken &&
+
+ # NOTE: the fetch skips bundle-4 since bundle-6 successfully
+ # unbundles itself and bundle-7 failed to download.
+ cat >expect <<-EOF &&
+ $HTTPD_URL/bundle-list
+ $HTTPD_URL/fake.bundle
+ $HTTPD_URL/bundle-6.bundle
+ EOF
+ test_remote_https_urls <trace-fetch-3.txt >actual &&
+ test_cmp expect actual &&
+
+ # Check which bundles have unbundled by refs
+ git -C fetch-3 for-each-ref --format="%(refname)" "refs/bundles/*" >refs &&
+ cat >expect <<-EOF &&
+ refs/bundles/base
+ refs/bundles/left
+ refs/bundles/lefter
+ refs/bundles/right
+ refs/bundles/righter
+ EOF
+ test_cmp expect refs
+'
+
+test_expect_success 'bundles are downloaded once during fetch --all' '
+ test_when_finished rm -rf download-* trace*.txt fetch-mult &&
+
+ cat >"$HTTPD_DOCUMENT_ROOT_PATH/bundle-list" <<-EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ heuristic = creationToken
+
+ [bundle "bundle-1"]
+ uri = bundle-1.bundle
+ creationToken = 1
+
+ [bundle "bundle-2"]
+ uri = bundle-2.bundle
+ creationToken = 2
+
+ [bundle "bundle-3"]
+ uri = bundle-3.bundle
+ creationToken = 3
+ EOF
+
+ git clone --single-branch --branch=left \
+ --bundle-uri="$HTTPD_URL/bundle-list" \
+ "$HTTPD_URL/smart/fetch.git" fetch-mult &&
+ git -C fetch-mult remote add dup1 "$HTTPD_URL/smart/fetch.git" &&
+ git -C fetch-mult remote add dup2 "$HTTPD_URL/smart/fetch.git" &&
+
+ GIT_TRACE2_EVENT="$(pwd)/trace-mult.txt" \
+ git -C fetch-mult fetch --all &&
+ grep "\"child_start\".*\"git-remote-https\",\"$HTTPD_URL/bundle-list\"" \
+ trace-mult.txt >bundle-fetches &&
+ test_line_count = 1 bundle-fetches
+'
# Do not add tests here unless they use the HTTP server, as they will
# not run unless the HTTP dependencies exist.
diff --git a/t/t5559-http-fetch-smart-http2.sh b/t/t5559-http-fetch-smart-http2.sh
new file mode 100755
index 0000000000..54aa9d3bff
--- /dev/null
+++ b/t/t5559-http-fetch-smart-http2.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+HTTP_PROTO=HTTP/2
+LIB_HTTPD_SSL=1
+. ./t5551-http-fetch-smart.sh
diff --git a/t/t5560-http-backend-noserver.sh b/t/t5560-http-backend-noserver.sh
index d30cf4f5b8..f75068de64 100755
--- a/t/t5560-http-backend-noserver.sh
+++ b/t/t5560-http-backend-noserver.sh
@@ -4,6 +4,7 @@ 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 9c57d84315..e1d3b8caed 100755
--- a/t/t5561-http-backend.sh
+++ b/t/t5561-http-backend.sh
@@ -4,6 +4,7 @@ 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 b68ec22d3f..7ee9858a78 100755
--- a/t/t5562-http-backend-content-length.sh
+++ b/t/t5562-http-backend-content-length.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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/t5563-simple-http-auth.sh b/t/t5563-simple-http-auth.sh
new file mode 100755
index 0000000000..f45a43b4b5
--- /dev/null
+++ b/t/t5563-simple-http-auth.sh
@@ -0,0 +1,323 @@
+#!/bin/sh
+
+test_description='test http auth header and credential helper interop'
+
+. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-httpd.sh
+
+start_httpd
+
+test_expect_success 'setup_credential_helper' '
+ mkdir "$TRASH_DIRECTORY/bin" &&
+ PATH=$PATH:"$TRASH_DIRECTORY/bin" &&
+ export PATH &&
+
+ CREDENTIAL_HELPER="$TRASH_DIRECTORY/bin/git-credential-test-helper" &&
+ write_script "$CREDENTIAL_HELPER" <<-\EOF
+ cmd=$1
+ teefile=$cmd-query.cred
+ catfile=$cmd-reply.cred
+ sed -n -e "/^$/q" -e "p" >>$teefile
+ if test "$cmd" = "get"
+ then
+ cat $catfile
+ fi
+ EOF
+'
+
+set_credential_reply () {
+ cat >"$TRASH_DIRECTORY/$1-reply.cred"
+}
+
+expect_credential_query () {
+ cat >"$TRASH_DIRECTORY/$1-expect.cred" &&
+ test_cmp "$TRASH_DIRECTORY/$1-expect.cred" \
+ "$TRASH_DIRECTORY/$1-query.cred"
+}
+
+per_test_cleanup () {
+ rm -f *.cred &&
+ rm -f "$HTTPD_ROOT_PATH"/custom-auth.valid \
+ "$HTTPD_ROOT_PATH"/custom-auth.challenge
+}
+
+test_expect_success 'setup repository' '
+ test_commit foo &&
+ git init --bare "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
+ git push --mirror "$HTTPD_DOCUMENT_ROOT_PATH/repo.git"
+'
+
+test_expect_success 'access using basic auth' '
+ test_when_finished "per_test_cleanup" &&
+
+ set_credential_reply get <<-EOF &&
+ username=alice
+ password=secret-passwd
+ EOF
+
+ # Basic base64(alice:secret-passwd)
+ cat >"$HTTPD_ROOT_PATH/custom-auth.valid" <<-EOF &&
+ Basic YWxpY2U6c2VjcmV0LXBhc3N3ZA==
+ EOF
+
+ cat >"$HTTPD_ROOT_PATH/custom-auth.challenge" <<-EOF &&
+ WWW-Authenticate: Basic realm="example.com"
+ EOF
+
+ test_config_global credential.helper test-helper &&
+ git ls-remote "$HTTPD_URL/custom_auth/repo.git" &&
+
+ expect_credential_query get <<-EOF &&
+ protocol=http
+ host=$HTTPD_DEST
+ wwwauth[]=Basic realm="example.com"
+ EOF
+
+ expect_credential_query store <<-EOF
+ protocol=http
+ host=$HTTPD_DEST
+ username=alice
+ password=secret-passwd
+ EOF
+'
+
+test_expect_success 'access using basic auth invalid credentials' '
+ test_when_finished "per_test_cleanup" &&
+
+ set_credential_reply get <<-EOF &&
+ username=baduser
+ password=wrong-passwd
+ EOF
+
+ # Basic base64(alice:secret-passwd)
+ cat >"$HTTPD_ROOT_PATH/custom-auth.valid" <<-EOF &&
+ Basic YWxpY2U6c2VjcmV0LXBhc3N3ZA==
+ EOF
+
+ cat >"$HTTPD_ROOT_PATH/custom-auth.challenge" <<-EOF &&
+ WWW-Authenticate: Basic realm="example.com"
+ EOF
+
+ test_config_global credential.helper test-helper &&
+ test_must_fail git ls-remote "$HTTPD_URL/custom_auth/repo.git" &&
+
+ expect_credential_query get <<-EOF &&
+ protocol=http
+ host=$HTTPD_DEST
+ wwwauth[]=Basic realm="example.com"
+ EOF
+
+ expect_credential_query erase <<-EOF
+ protocol=http
+ host=$HTTPD_DEST
+ username=baduser
+ password=wrong-passwd
+ wwwauth[]=Basic realm="example.com"
+ EOF
+'
+
+test_expect_success 'access using basic auth with extra challenges' '
+ test_when_finished "per_test_cleanup" &&
+
+ set_credential_reply get <<-EOF &&
+ username=alice
+ password=secret-passwd
+ EOF
+
+ # Basic base64(alice:secret-passwd)
+ cat >"$HTTPD_ROOT_PATH/custom-auth.valid" <<-EOF &&
+ Basic YWxpY2U6c2VjcmV0LXBhc3N3ZA==
+ EOF
+
+ cat >"$HTTPD_ROOT_PATH/custom-auth.challenge" <<-EOF &&
+ WWW-Authenticate: FooBar param1="value1" param2="value2"
+ WWW-Authenticate: Bearer authorize_uri="id.example.com" p=1 q=0
+ WWW-Authenticate: Basic realm="example.com"
+ EOF
+
+ test_config_global credential.helper test-helper &&
+ git ls-remote "$HTTPD_URL/custom_auth/repo.git" &&
+
+ expect_credential_query get <<-EOF &&
+ protocol=http
+ host=$HTTPD_DEST
+ wwwauth[]=FooBar param1="value1" param2="value2"
+ wwwauth[]=Bearer authorize_uri="id.example.com" p=1 q=0
+ wwwauth[]=Basic realm="example.com"
+ EOF
+
+ expect_credential_query store <<-EOF
+ protocol=http
+ host=$HTTPD_DEST
+ username=alice
+ password=secret-passwd
+ EOF
+'
+
+test_expect_success 'access using basic auth mixed-case wwwauth header name' '
+ test_when_finished "per_test_cleanup" &&
+
+ set_credential_reply get <<-EOF &&
+ username=alice
+ password=secret-passwd
+ EOF
+
+ # Basic base64(alice:secret-passwd)
+ cat >"$HTTPD_ROOT_PATH/custom-auth.valid" <<-EOF &&
+ Basic YWxpY2U6c2VjcmV0LXBhc3N3ZA==
+ EOF
+
+ cat >"$HTTPD_ROOT_PATH/custom-auth.challenge" <<-EOF &&
+ www-authenticate: foobar param1="value1" param2="value2"
+ WWW-AUTHENTICATE: BEARER authorize_uri="id.example.com" p=1 q=0
+ WwW-aUtHeNtIcAtE: baSiC realm="example.com"
+ EOF
+
+ test_config_global credential.helper test-helper &&
+ git ls-remote "$HTTPD_URL/custom_auth/repo.git" &&
+
+ expect_credential_query get <<-EOF &&
+ protocol=http
+ host=$HTTPD_DEST
+ wwwauth[]=foobar param1="value1" param2="value2"
+ wwwauth[]=BEARER authorize_uri="id.example.com" p=1 q=0
+ wwwauth[]=baSiC realm="example.com"
+ EOF
+
+ expect_credential_query store <<-EOF
+ protocol=http
+ host=$HTTPD_DEST
+ username=alice
+ password=secret-passwd
+ EOF
+'
+
+test_expect_success 'access using basic auth with wwwauth header continuations' '
+ test_when_finished "per_test_cleanup" &&
+
+ set_credential_reply get <<-EOF &&
+ username=alice
+ password=secret-passwd
+ EOF
+
+ # Basic base64(alice:secret-passwd)
+ cat >"$HTTPD_ROOT_PATH/custom-auth.valid" <<-EOF &&
+ Basic YWxpY2U6c2VjcmV0LXBhc3N3ZA==
+ EOF
+
+ # Note that leading and trailing whitespace is important to correctly
+ # simulate a continuation/folded header.
+ cat >"$HTTPD_ROOT_PATH/custom-auth.challenge" <<-EOF &&
+ WWW-Authenticate: FooBar param1="value1"
+ param2="value2"
+ WWW-Authenticate: Bearer authorize_uri="id.example.com"
+ p=1
+ q=0
+ WWW-Authenticate: Basic realm="example.com"
+ EOF
+
+ test_config_global credential.helper test-helper &&
+ git ls-remote "$HTTPD_URL/custom_auth/repo.git" &&
+
+ expect_credential_query get <<-EOF &&
+ protocol=http
+ host=$HTTPD_DEST
+ wwwauth[]=FooBar param1="value1" param2="value2"
+ wwwauth[]=Bearer authorize_uri="id.example.com" p=1 q=0
+ wwwauth[]=Basic realm="example.com"
+ EOF
+
+ expect_credential_query store <<-EOF
+ protocol=http
+ host=$HTTPD_DEST
+ username=alice
+ password=secret-passwd
+ EOF
+'
+
+test_expect_success 'access using basic auth with wwwauth header empty continuations' '
+ test_when_finished "per_test_cleanup" &&
+
+ set_credential_reply get <<-EOF &&
+ username=alice
+ password=secret-passwd
+ EOF
+
+ # Basic base64(alice:secret-passwd)
+ cat >"$HTTPD_ROOT_PATH/custom-auth.valid" <<-EOF &&
+ Basic YWxpY2U6c2VjcmV0LXBhc3N3ZA==
+ EOF
+
+ CHALLENGE="$HTTPD_ROOT_PATH/custom-auth.challenge" &&
+
+ # Note that leading and trailing whitespace is important to correctly
+ # simulate a continuation/folded header.
+ printf "WWW-Authenticate: FooBar param1=\"value1\"\r\n" >"$CHALLENGE" &&
+ printf " \r\n" >>"$CHALLENGE" &&
+ printf " param2=\"value2\"\r\n" >>"$CHALLENGE" &&
+ printf "WWW-Authenticate: Bearer authorize_uri=\"id.example.com\"\r\n" >>"$CHALLENGE" &&
+ printf " p=1\r\n" >>"$CHALLENGE" &&
+ printf " \r\n" >>"$CHALLENGE" &&
+ printf " q=0\r\n" >>"$CHALLENGE" &&
+ printf "WWW-Authenticate: Basic realm=\"example.com\"\r\n" >>"$CHALLENGE" &&
+
+ test_config_global credential.helper test-helper &&
+ git ls-remote "$HTTPD_URL/custom_auth/repo.git" &&
+
+ expect_credential_query get <<-EOF &&
+ protocol=http
+ host=$HTTPD_DEST
+ wwwauth[]=FooBar param1="value1" param2="value2"
+ wwwauth[]=Bearer authorize_uri="id.example.com" p=1 q=0
+ wwwauth[]=Basic realm="example.com"
+ EOF
+
+ expect_credential_query store <<-EOF
+ protocol=http
+ host=$HTTPD_DEST
+ username=alice
+ password=secret-passwd
+ EOF
+'
+
+test_expect_success 'access using basic auth with wwwauth header mixed line-endings' '
+ test_when_finished "per_test_cleanup" &&
+
+ set_credential_reply get <<-EOF &&
+ username=alice
+ password=secret-passwd
+ EOF
+
+ # Basic base64(alice:secret-passwd)
+ cat >"$HTTPD_ROOT_PATH/custom-auth.valid" <<-EOF &&
+ Basic YWxpY2U6c2VjcmV0LXBhc3N3ZA==
+ EOF
+
+ CHALLENGE="$HTTPD_ROOT_PATH/custom-auth.challenge" &&
+
+ # Note that leading and trailing whitespace is important to correctly
+ # simulate a continuation/folded header.
+ printf "WWW-Authenticate: FooBar param1=\"value1\"\r\n" >"$CHALLENGE" &&
+ printf " \r\n" >>"$CHALLENGE" &&
+ printf "\tparam2=\"value2\"\r\n" >>"$CHALLENGE" &&
+ printf "WWW-Authenticate: Basic realm=\"example.com\"" >>"$CHALLENGE" &&
+
+ test_config_global credential.helper test-helper &&
+ git ls-remote "$HTTPD_URL/custom_auth/repo.git" &&
+
+ expect_credential_query get <<-EOF &&
+ protocol=http
+ host=$HTTPD_DEST
+ wwwauth[]=FooBar param1="value1" param2="value2"
+ wwwauth[]=Basic realm="example.com"
+ EOF
+
+ expect_credential_query store <<-EOF
+ protocol=http
+ host=$HTTPD_DEST
+ username=alice
+ password=secret-passwd
+ EOF
+'
+
+test_done
diff --git a/t/t5564-http-proxy.sh b/t/t5564-http-proxy.sh
new file mode 100755
index 0000000000..9da5134614
--- /dev/null
+++ b/t/t5564-http-proxy.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+test_description="test fetching through http proxy"
+
+. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-httpd.sh
+
+LIB_HTTPD_PROXY=1
+start_httpd
+
+test_expect_success 'setup repository' '
+ test_commit foo &&
+ git init --bare "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
+ git push --mirror "$HTTPD_DOCUMENT_ROOT_PATH/repo.git"
+'
+
+setup_askpass_helper
+
+# sanity check that our test setup is correctly using proxy
+test_expect_success 'proxy requires password' '
+ test_config_global http.proxy $HTTPD_DEST &&
+ test_must_fail git clone $HTTPD_URL/smart/repo.git 2>err &&
+ grep "error.*407" err
+'
+
+test_expect_success 'clone through proxy with auth' '
+ test_when_finished "rm -rf clone" &&
+ test_config_global http.proxy http://proxuser:proxpass@$HTTPD_DEST &&
+ GIT_TRACE_CURL=$PWD/trace git clone $HTTPD_URL/smart/repo.git clone &&
+ grep -i "Proxy-Authorization: Basic <redacted>" trace
+'
+
+test_expect_success 'clone can prompt for proxy password' '
+ test_when_finished "rm -rf clone" &&
+ test_config_global http.proxy http://proxuser@$HTTPD_DEST &&
+ set_askpass nobody proxpass &&
+ GIT_TRACE_CURL=$PWD/trace git clone $HTTPD_URL/smart/repo.git clone &&
+ expect_askpass pass proxuser
+'
+
+test_done
diff --git a/t/t5573-pull-verify-signatures.sh b/t/t5573-pull-verify-signatures.sh
index a53dd8550d..1221ac0597 100755
--- a/t/t5573-pull-verify-signatures.sh
+++ b/t/t5573-pull-verify-signatures.sh
@@ -1,6 +1,8 @@
#!/bin/sh
test_description='pull signature verification tests'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-gpg.sh"
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 45f0803ed4..b7d5551262 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -71,29 +71,6 @@ test_expect_success 'clone respects GIT_WORK_TREE' '
'
-test_expect_success LIBCURL 'clone warns or fails when using username:password' '
- message="URL '\''https://username:<redacted>@localhost/'\'' uses plaintext credentials" &&
- test_must_fail git -c transfer.credentialsInUrl=allow clone https://username:password@localhost attempt1 2>err &&
- ! grep "$message" err &&
-
- test_must_fail git -c transfer.credentialsInUrl=warn clone https://username:password@localhost attempt2 2>err &&
- grep "warning: $message" err >warnings &&
- test_line_count = 2 warnings &&
-
- test_must_fail git -c transfer.credentialsInUrl=die clone https://username:password@localhost attempt3 2>err &&
- grep "fatal: $message" err >warnings &&
- test_line_count = 1 warnings &&
-
- test_must_fail git -c transfer.credentialsInUrl=die clone https://username:@localhost attempt3 2>err &&
- grep "fatal: $message" err >warnings &&
- test_line_count = 1 warnings
-'
-
-test_expect_success LIBCURL 'clone does not detect username:password when it is https://username@domain:port/' '
- test_must_fail git -c transfer.credentialsInUrl=warn clone https://username@localhost:8080 attempt3 2>err &&
- ! grep "uses plaintext credentials" err
-'
-
test_expect_success 'clone from hooks' '
test_create_repo r0 &&
@@ -795,6 +772,111 @@ test_expect_success 'reject cloning shallow repository using HTTP' '
git clone --no-reject-shallow $HTTPD_URL/smart/repo.git repo
'
+test_expect_success 'auto-discover bundle URI from HTTP clone' '
+ test_when_finished rm -rf trace.txt repo2 "$HTTPD_DOCUMENT_ROOT_PATH/repo2.git" &&
+ git -C src bundle create "$HTTPD_DOCUMENT_ROOT_PATH/everything.bundle" --all &&
+ git clone --bare --no-local src "$HTTPD_DOCUMENT_ROOT_PATH/repo2.git" &&
+
+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo2.git" config \
+ uploadpack.advertiseBundleURIs true &&
+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo2.git" config \
+ bundle.version 1 &&
+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo2.git" config \
+ bundle.mode all &&
+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo2.git" config \
+ bundle.everything.uri "$HTTPD_URL/everything.bundle" &&
+
+ GIT_TRACE2_EVENT="$(pwd)/trace.txt" \
+ git -c protocol.version=2 \
+ -c transfer.bundleURI=true clone \
+ $HTTPD_URL/smart/repo2.git repo2 &&
+ cat >pattern <<-EOF &&
+ "event":"child_start".*"argv":\["git-remote-https","$HTTPD_URL/everything.bundle"\]
+ EOF
+ grep -f pattern trace.txt
+'
+
+test_expect_success 'auto-discover multiple bundles from HTTP clone' '
+ test_when_finished rm -rf trace.txt repo3 "$HTTPD_DOCUMENT_ROOT_PATH/repo3.git" &&
+
+ test_commit -C src new &&
+ git -C src bundle create "$HTTPD_DOCUMENT_ROOT_PATH/new.bundle" HEAD~1..HEAD &&
+ git clone --bare --no-local src "$HTTPD_DOCUMENT_ROOT_PATH/repo3.git" &&
+
+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo3.git" config \
+ uploadpack.advertiseBundleURIs true &&
+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo3.git" config \
+ bundle.version 1 &&
+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo3.git" config \
+ bundle.mode all &&
+
+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo3.git" config \
+ bundle.everything.uri "$HTTPD_URL/everything.bundle" &&
+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/repo3.git" config \
+ bundle.new.uri "$HTTPD_URL/new.bundle" &&
+
+ GIT_TRACE2_EVENT="$(pwd)/trace.txt" \
+ git -c protocol.version=2 \
+ -c transfer.bundleURI=true clone \
+ $HTTPD_URL/smart/repo3.git repo3 &&
+
+ # We should fetch _both_ bundles
+ cat >pattern <<-EOF &&
+ "event":"child_start".*"argv":\["git-remote-https","$HTTPD_URL/everything.bundle"\]
+ EOF
+ grep -f pattern trace.txt &&
+ cat >pattern <<-EOF &&
+ "event":"child_start".*"argv":\["git-remote-https","$HTTPD_URL/new.bundle"\]
+ EOF
+ grep -f pattern trace.txt
+'
+
+test_expect_success 'auto-discover multiple bundles from HTTP clone: creationToken heuristic' '
+ test_when_finished rm -rf "$HTTPD_DOCUMENT_ROOT_PATH/repo4.git" &&
+ test_when_finished rm -rf clone-heuristic trace*.txt &&
+
+ test_commit -C src newest &&
+ git -C src bundle create "$HTTPD_DOCUMENT_ROOT_PATH/newest.bundle" HEAD~1..HEAD &&
+ git clone --bare --no-local src "$HTTPD_DOCUMENT_ROOT_PATH/repo4.git" &&
+
+ cat >>"$HTTPD_DOCUMENT_ROOT_PATH/repo4.git/config" <<-EOF &&
+ [uploadPack]
+ advertiseBundleURIs = true
+
+ [bundle]
+ version = 1
+ mode = all
+ heuristic = creationToken
+
+ [bundle "everything"]
+ uri = $HTTPD_URL/everything.bundle
+ creationtoken = 1
+
+ [bundle "new"]
+ uri = $HTTPD_URL/new.bundle
+ creationtoken = 2
+
+ [bundle "newest"]
+ uri = $HTTPD_URL/newest.bundle
+ creationtoken = 3
+ EOF
+
+ GIT_TRACE2_EVENT="$(pwd)/trace-clone.txt" \
+ git -c protocol.version=2 \
+ -c transfer.bundleURI=true clone \
+ "$HTTPD_URL/smart/repo4.git" clone-heuristic &&
+
+ cat >expect <<-EOF &&
+ $HTTPD_URL/newest.bundle
+ $HTTPD_URL/new.bundle
+ $HTTPD_URL/everything.bundle
+ EOF
+
+ # We should fetch all bundles in the expected order.
+ test_remote_https_urls <trace-clone.txt >actual &&
+ test_cmp expect actual
+'
+
# DO NOT add non-httpd-specific tests here, because the last part of this
# test script is only executed when httpd is available and enabled.
diff --git a/t/t5604-clone-reference.sh b/t/t5604-clone-reference.sh
index 7ccebb40c3..9845fc04d5 100755
--- a/t/t5604-clone-reference.sh
+++ b/t/t5604-clone-reference.sh
@@ -7,6 +7,7 @@ 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)
@@ -357,7 +358,7 @@ test_expect_success SYMLINKS 'clone repo with symlinked objects directory' '
test_must_fail git clone --local malicious clone 2>err &&
test_path_is_missing clone &&
- grep "failed to start iterator over" err
+ grep "is a symlink, refusing to clone with --local" err
'
test_done
diff --git a/t/t5605-clone-local.sh b/t/t5605-clone-local.sh
index 38b850c10e..1d7b1abda1 100755
--- a/t/t5605-clone-local.sh
+++ b/t/t5605-clone-local.sh
@@ -15,8 +15,12 @@ test_expect_success 'preparing origin repository' '
: >file && git add . && git commit -m1 &&
git clone --bare . a.git &&
git clone --bare . x &&
- test "$(cd a.git && git config --bool core.bare)" = true &&
- test "$(cd x && git config --bool core.bare)" = true &&
+ echo true >expect &&
+ git -C a.git config --bool core.bare >actual &&
+ test_cmp expect actual &&
+ echo true >expect &&
+ git -C x config --bool core.bare >actual &&
+ test_cmp expect actual &&
git bundle create b1.bundle --all &&
git bundle create b2.bundle main &&
mkdir dir &&
@@ -29,7 +33,9 @@ test_expect_success 'preparing origin repository' '
test_expect_success 'local clone without .git suffix' '
git clone -l -s a b &&
(cd b &&
- test "$(git config --bool core.bare)" = false &&
+ echo false >expect &&
+ git config --bool core.bare >actual &&
+ test_cmp expect actual &&
git fetch)
'
diff --git a/t/t5606-clone-options.sh b/t/t5606-clone-options.sh
index cf221e92c4..27f9f77638 100755
--- a/t/t5606-clone-options.sh
+++ b/t/t5606-clone-options.sh
@@ -4,6 +4,7 @@ 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/t5610-clone-detached.sh b/t/t5610-clone-detached.sh
index a7ec21eda5..022ed3d87c 100755
--- a/t/t5610-clone-detached.sh
+++ b/t/t5610-clone-detached.sh
@@ -4,6 +4,7 @@ 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 4b3877216e..727caff443 100755
--- a/t/t5611-clone-config.sh
+++ b/t/t5611-clone-config.sh
@@ -4,6 +4,7 @@ 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/t5613-info-alternate.sh b/t/t5613-info-alternate.sh
index 895f46bb91..7708cbafa9 100755
--- a/t/t5613-info-alternate.sh
+++ b/t/t5613-info-alternate.sh
@@ -4,6 +4,8 @@
#
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 0c85ef834a..c2a2bb453e 100755
--- a/t/t5614-clone-submodules-shallow.sh
+++ b/t/t5614-clone-submodules-shallow.sh
@@ -2,6 +2,7 @@
test_description='Test shallow cloning of repos with submodules'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
pwd=$(pwd)
diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
index 037941b95d..f519d2a87a 100755
--- a/t/t5616-partial-clone.sh
+++ b/t/t5616-partial-clone.sh
@@ -644,6 +644,49 @@ test_expect_success 'repack does not loosen promisor objects' '
grep "loosen_unused_packed_objects/loosened:0" trace
'
+test_expect_success 'lazy-fetch in submodule succeeds' '
+ # setup
+ test_config_global protocol.file.allow always &&
+
+ test_when_finished "rm -rf src-sub" &&
+ git init src-sub &&
+ git -C src-sub config uploadpack.allowfilter 1 &&
+ git -C src-sub config uploadpack.allowanysha1inwant 1 &&
+
+ # This blob must be missing in the subsequent commit.
+ echo foo >src-sub/file &&
+ git -C src-sub add file &&
+ git -C src-sub commit -m "submodule one" &&
+ SUB_ONE=$(git -C src-sub rev-parse HEAD) &&
+
+ echo bar >src-sub/file &&
+ git -C src-sub add file &&
+ git -C src-sub commit -m "submodule two" &&
+ SUB_TWO=$(git -C src-sub rev-parse HEAD) &&
+
+ test_when_finished "rm -rf src-super" &&
+ git init src-super &&
+ git -C src-super config uploadpack.allowfilter 1 &&
+ git -C src-super config uploadpack.allowanysha1inwant 1 &&
+ git -C src-super submodule add ../src-sub src-sub &&
+
+ git -C src-super/src-sub checkout $SUB_ONE &&
+ git -C src-super add src-sub &&
+ git -C src-super commit -m "superproject one" &&
+
+ git -C src-super/src-sub checkout $SUB_TWO &&
+ git -C src-super add src-sub &&
+ git -C src-super commit -m "superproject two" &&
+
+ # the fetch
+ test_when_finished "rm -rf client" &&
+ git clone --filter=blob:none --also-filter-submodules \
+ --recurse-submodules "file://$(pwd)/src-super" client &&
+
+ # Trigger lazy-fetch from the superproject
+ git -C client restore --recurse-submodules --source=HEAD^ :/
+'
+
. "$TEST_DIRECTORY"/lib-httpd.sh
start_httpd
diff --git a/t/t5617-clone-submodules-remote.sh b/t/t5617-clone-submodules-remote.sh
index 6884338249..5a4d7936a7 100755
--- a/t/t5617-clone-submodules-remote.sh
+++ b/t/t5617-clone-submodules-remote.sh
@@ -5,6 +5,7 @@ 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 3353216f09..f905db0a3f 100755
--- a/t/t5618-alternate-refs.sh
+++ b/t/t5618-alternate-refs.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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/t5701-git-serve.sh b/t/t5701-git-serve.sh
index 1896f671cb..f21e5e9d33 100755
--- a/t/t5701-git-serve.sh
+++ b/t/t5701-git-serve.sh
@@ -13,7 +13,7 @@ test_expect_success 'test capability advertisement' '
wrong_algo sha1:sha256
wrong_algo sha256:sha1
EOF
- cat >expect <<-EOF &&
+ cat >expect.base <<-EOF &&
version 2
agent=git/$(git version | cut -d" " -f3)
ls-refs=unborn
@@ -21,8 +21,11 @@ test_expect_success 'test capability advertisement' '
server-option
object-format=$(test_oid algo)
object-info
+ EOF
+ cat >expect.trailer <<-EOF &&
0000
EOF
+ cat expect.base expect.trailer >expect &&
GIT_TEST_SIDEBAND_ALL=0 test-tool serve-v2 \
--advertise-capabilities >out &&
@@ -342,4 +345,39 @@ test_expect_success 'basics of object-info' '
test_cmp expect actual
'
+test_expect_success 'test capability advertisement with uploadpack.advertiseBundleURIs' '
+ test_config uploadpack.advertiseBundleURIs true &&
+
+ cat >expect.extra <<-EOF &&
+ bundle-uri
+ EOF
+ cat expect.base \
+ expect.extra \
+ expect.trailer >expect &&
+
+ GIT_TEST_SIDEBAND_ALL=0 test-tool serve-v2 \
+ --advertise-capabilities >out &&
+ test-tool pkt-line unpack <out >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'basics of bundle-uri: dies if not enabled' '
+ test-tool pkt-line pack >in <<-EOF &&
+ command=bundle-uri
+ 0000
+ EOF
+
+ cat >err.expect <<-\EOF &&
+ fatal: invalid command '"'"'bundle-uri'"'"'
+ EOF
+
+ cat >expect <<-\EOF &&
+ ERR serve: invalid command '"'"'bundle-uri'"'"'
+ EOF
+
+ test_must_fail test-tool serve-v2 --stateless-rpc <in >out 2>err.actual &&
+ test_cmp err.expect err.actual &&
+ test_must_be_empty out
+'
+
test_done
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index 5d42a355a8..6af5c2062f 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -269,6 +269,17 @@ test_expect_success 'clone propagates unborn HEAD from non-empty repo' '
grep "warning: remote HEAD refers to nonexistent ref" stderr
'
+test_expect_success 'clone propagates object-format from empty repo' '
+ test_when_finished "rm -fr src256 dst256" &&
+
+ echo sha256 >expect &&
+ git init --object-format=sha256 src256 &&
+ git clone src256 dst256 &&
+ git -C dst256 rev-parse --show-object-format >actual &&
+
+ test_cmp expect actual
+'
+
test_expect_success 'bare clone propagates unborn HEAD from non-empty repo' '
test_when_finished "rm -rf file_unborn_parent file_unborn_child.git" &&
@@ -728,6 +739,33 @@ test_expect_success 'file:// --negotiate-only with protocol v0' '
test_i18ngrep "negotiate-only requires protocol v2" err
'
+test_expect_success 'push with custom path does not request v2' '
+ rm -f env.trace &&
+ git -C client push \
+ --receive-pack="env >../env.trace; git-receive-pack" \
+ origin HEAD:refs/heads/custom-push-test &&
+ test_path_is_file env.trace &&
+ ! grep ^GIT_PROTOCOL env.trace
+'
+
+test_expect_success 'fetch with custom path does request v2' '
+ rm -f env.trace &&
+ git -C client fetch \
+ --upload-pack="env >../env.trace; git-upload-pack" \
+ origin HEAD &&
+ grep ^GIT_PROTOCOL=version=2 env.trace
+'
+
+test_expect_success 'archive with custom path does not request v2' '
+ rm -f env.trace &&
+ git -C client archive \
+ --exec="env >../env.trace; git-upload-archive" \
+ --remote=origin \
+ HEAD >/dev/null &&
+ test_path_is_file env.trace &&
+ ! grep ^GIT_PROTOCOL env.trace
+'
+
# Test protocol v2 with 'http://' transport
#
. "$TEST_DIRECTORY"/lib-httpd.sh
@@ -1001,7 +1039,7 @@ test_expect_success 'part of packfile response provided as URI' '
do
git verify-pack --object-format=$(test_oid algo) --verbose $idx >out &&
{
- grep "^[0-9a-f]\{16,\} " out || :
+ grep -E "^[0-9a-f]{16,} " out || :
} >out.objectlist &&
if test_line_count = 1 out.objectlist
then
@@ -1114,7 +1152,7 @@ test_expect_success 'packfile-uri with transfer.fsckobjects fails on bad object'
This commit object intentionally broken
EOF
- BOGUS=$(git -C "$P" hash-object -t commit -w --stdin <bogus-commit) &&
+ BOGUS=$(git -C "$P" hash-object -t commit -w --stdin --literally <bogus-commit) &&
git -C "$P" branch bogus-branch "$BOGUS" &&
echo my-blob >"$P/my-blob" &&
diff --git a/t/t5705-session-id-in-capabilities.sh b/t/t5705-session-id-in-capabilities.sh
index ed38c76c29..b8a722ec27 100755
--- a/t/t5705-session-id-in-capabilities.sh
+++ b/t/t5705-session-id-in-capabilities.sh
@@ -2,6 +2,7 @@
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
new file mode 100755
index 0000000000..37bdb725bc
--- /dev/null
+++ b/t/t5730-protocol-v2-bundle-uri-file.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+test_description="Test bundle-uri with protocol v2 and 'file://' transport"
+
+TEST_NO_CREATE_REPO=1
+
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
+. ./test-lib.sh
+
+# Test protocol v2 with 'file://' transport
+#
+BUNDLE_URI_PROTOCOL=file
+. "$TEST_DIRECTORY"/lib-bundle-uri-protocol.sh
+
+test_done
diff --git a/t/t5731-protocol-v2-bundle-uri-git.sh b/t/t5731-protocol-v2-bundle-uri-git.sh
new file mode 100755
index 0000000000..8add1b37ab
--- /dev/null
+++ b/t/t5731-protocol-v2-bundle-uri-git.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+test_description="Test bundle-uri with protocol v2 and 'git://' transport"
+
+TEST_NO_CREATE_REPO=1
+
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
+. ./test-lib.sh
+
+# Test protocol v2 with 'git://' transport
+#
+BUNDLE_URI_PROTOCOL=git
+. "$TEST_DIRECTORY"/lib-bundle-uri-protocol.sh
+
+test_done
diff --git a/t/t5732-protocol-v2-bundle-uri-http.sh b/t/t5732-protocol-v2-bundle-uri-http.sh
new file mode 100755
index 0000000000..129daa0226
--- /dev/null
+++ b/t/t5732-protocol-v2-bundle-uri-http.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+test_description="Test bundle-uri with protocol v2 and 'http://' transport"
+
+TEST_NO_CREATE_REPO=1
+
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
+. ./test-lib.sh
+
+# Test protocol v2 with 'http://' transport
+#
+BUNDLE_URI_PROTOCOL=http
+. "$TEST_DIRECTORY"/lib-bundle-uri-protocol.sh
+
+test_done
diff --git a/t/t5750-bundle-uri-parse.sh b/t/t5750-bundle-uri-parse.sh
new file mode 100755
index 0000000000..81bdf58b94
--- /dev/null
+++ b/t/t5750-bundle-uri-parse.sh
@@ -0,0 +1,290 @@
+#!/bin/sh
+
+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' '
+ cat >in <<-\EOF &&
+ bundle.one.uri=http://example.com/bundle.bdl
+ bundle.two.uri=https://example.com/bundle.bdl
+ bundle.three.uri=file:///usr/share/git/bundle.bdl
+ EOF
+
+ cat >expect <<-\EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ [bundle "one"]
+ uri = http://example.com/bundle.bdl
+ [bundle "two"]
+ uri = https://example.com/bundle.bdl
+ [bundle "three"]
+ uri = file:///usr/share/git/bundle.bdl
+ EOF
+
+ test-tool bundle-uri parse-key-values in >actual 2>err &&
+ test_must_be_empty err &&
+ test_cmp_config_output expect actual
+'
+
+test_expect_success 'bundle_uri_parse_line(): relative URIs' '
+ cat >in <<-\EOF &&
+ bundle.one.uri=bundle.bdl
+ bundle.two.uri=../bundle.bdl
+ bundle.three.uri=sub/dir/bundle.bdl
+ EOF
+
+ cat >expect <<-\EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ [bundle "one"]
+ uri = <uri>/bundle.bdl
+ [bundle "two"]
+ uri = bundle.bdl
+ [bundle "three"]
+ uri = <uri>/sub/dir/bundle.bdl
+ EOF
+
+ test-tool bundle-uri parse-key-values in >actual 2>err &&
+ test_must_be_empty err &&
+ test_cmp_config_output expect actual
+'
+
+test_expect_success 'bundle_uri_parse_line(): relative URIs and parent paths' '
+ cat >in <<-\EOF &&
+ bundle.one.uri=bundle.bdl
+ bundle.two.uri=../bundle.bdl
+ bundle.three.uri=../../bundle.bdl
+ EOF
+
+ cat >expect <<-\EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ [bundle "one"]
+ uri = <uri>/bundle.bdl
+ [bundle "two"]
+ uri = bundle.bdl
+ [bundle "three"]
+ uri = <uri>/../bundle.bdl
+ EOF
+
+ # TODO: We would prefer if parsing a bundle list would not cause
+ # a die() and instead would give a warning and allow the rest of
+ # a Git command to continue. This test_must_fail is necessary for
+ # now until the interface for relative_url() allows for reporting
+ # an error instead of die()ing.
+ test_must_fail test-tool bundle-uri parse-key-values in >actual 2>err &&
+ grep "fatal: cannot strip one component off url" err
+'
+
+test_expect_success 'bundle_uri_parse_line() parsing edge cases: empty key or value' '
+ cat >in <<-\EOF &&
+ =bogus-value
+ bogus-key=
+ EOF
+
+ cat >err.expect <<-EOF &&
+ error: bundle-uri: line has empty key or value
+ error: bad line: '\''=bogus-value'\''
+ error: bundle-uri: line has empty key or value
+ error: bad line: '\''bogus-key='\''
+ EOF
+
+ cat >expect <<-\EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ EOF
+
+ test_must_fail test-tool bundle-uri parse-key-values in >actual 2>err &&
+ test_cmp err.expect err &&
+ test_cmp_config_output expect actual
+'
+
+test_expect_success 'bundle_uri_parse_line() parsing edge cases: empty lines' '
+ cat >in <<-\EOF &&
+ bundle.one.uri=http://example.com/bundle.bdl
+
+ bundle.two.uri=https://example.com/bundle.bdl
+
+ bundle.three.uri=file:///usr/share/git/bundle.bdl
+ EOF
+
+ cat >err.expect <<-\EOF &&
+ error: bundle-uri: got an empty line
+ error: bad line: '\'''\''
+ error: bundle-uri: got an empty line
+ error: bad line: '\'''\''
+ EOF
+
+ # We fail, but try to continue parsing regardless
+ cat >expect <<-\EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ [bundle "one"]
+ uri = http://example.com/bundle.bdl
+ [bundle "two"]
+ uri = https://example.com/bundle.bdl
+ [bundle "three"]
+ uri = file:///usr/share/git/bundle.bdl
+ EOF
+
+ test_must_fail test-tool bundle-uri parse-key-values in >actual 2>err &&
+ test_cmp err.expect err &&
+ test_cmp_config_output expect actual
+'
+
+test_expect_success 'bundle_uri_parse_line() parsing edge cases: duplicate lines' '
+ cat >in <<-\EOF &&
+ bundle.one.uri=http://example.com/bundle.bdl
+ bundle.two.uri=https://example.com/bundle.bdl
+ bundle.one.uri=https://example.com/bundle-2.bdl
+ bundle.three.uri=file:///usr/share/git/bundle.bdl
+ EOF
+
+ cat >err.expect <<-\EOF &&
+ error: bad line: '\''bundle.one.uri=https://example.com/bundle-2.bdl'\''
+ EOF
+
+ # We fail, but try to continue parsing regardless
+ cat >expect <<-\EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ [bundle "one"]
+ uri = http://example.com/bundle.bdl
+ [bundle "two"]
+ uri = https://example.com/bundle.bdl
+ [bundle "three"]
+ uri = file:///usr/share/git/bundle.bdl
+ EOF
+
+ test_must_fail test-tool bundle-uri parse-key-values in >actual 2>err &&
+ test_cmp err.expect err &&
+ test_cmp_config_output expect actual
+'
+
+test_expect_success 'parse config format: just URIs' '
+ cat >expect <<-\EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ [bundle "one"]
+ uri = http://example.com/bundle.bdl
+ [bundle "two"]
+ uri = https://example.com/bundle.bdl
+ [bundle "three"]
+ uri = file:///usr/share/git/bundle.bdl
+ EOF
+
+ test-tool bundle-uri parse-config expect >actual 2>err &&
+ test_must_be_empty err &&
+ test_cmp_config_output expect actual
+'
+
+test_expect_success 'parse config format: relative URIs' '
+ cat >in <<-\EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ [bundle "one"]
+ uri = bundle.bdl
+ [bundle "two"]
+ uri = ../bundle.bdl
+ [bundle "three"]
+ uri = sub/dir/bundle.bdl
+ EOF
+
+ cat >expect <<-\EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ [bundle "one"]
+ uri = <uri>/bundle.bdl
+ [bundle "two"]
+ uri = bundle.bdl
+ [bundle "three"]
+ uri = <uri>/sub/dir/bundle.bdl
+ EOF
+
+ test-tool bundle-uri parse-config in >actual 2>err &&
+ test_must_be_empty err &&
+ test_cmp_config_output expect actual
+'
+
+test_expect_success 'parse config format edge cases: empty key or value' '
+ cat >in1 <<-\EOF &&
+ = bogus-value
+ EOF
+
+ cat >err1 <<-EOF &&
+ error: bad config line 1 in file in1
+ EOF
+
+ cat >expect <<-\EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ EOF
+
+ test_must_fail test-tool bundle-uri parse-config in1 >actual 2>err &&
+ test_cmp err1 err &&
+ test_cmp_config_output expect actual &&
+
+ cat >in2 <<-\EOF &&
+ bogus-key =
+ EOF
+
+ cat >err2 <<-EOF &&
+ error: bad config line 1 in file in2
+ EOF
+
+ test_must_fail test-tool bundle-uri parse-config in2 >actual 2>err &&
+ test_cmp err2 err &&
+ test_cmp_config_output expect actual
+'
+
+test_expect_success 'parse config format: creationToken heuristic' '
+ cat >expect <<-\EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ heuristic = creationToken
+ [bundle "one"]
+ uri = http://example.com/bundle.bdl
+ creationToken = 123456
+ [bundle "two"]
+ uri = https://example.com/bundle.bdl
+ creationToken = 12345678901234567890
+ [bundle "three"]
+ uri = file:///usr/share/git/bundle.bdl
+ creationToken = 1
+ EOF
+
+ test-tool bundle-uri parse-config expect >actual 2>err &&
+ test_must_be_empty err &&
+ test_cmp_config_output expect actual
+'
+
+test_expect_success 'parse config format edge cases: creationToken heuristic' '
+ cat >expect <<-\EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ heuristic = creationToken
+ [bundle "one"]
+ uri = http://example.com/bundle.bdl
+ creationToken = bogus
+ EOF
+
+ test-tool bundle-uri parse-config expect >actual 2>err &&
+ grep "could not parse bundle list key creationToken with value '\''bogus'\''" err
+'
+
+test_done
diff --git a/t/t5810-proto-disable-local.sh b/t/t5810-proto-disable-local.sh
index c1ef99b85c..862610256f 100755
--- a/t/t5810-proto-disable-local.sh
+++ b/t/t5810-proto-disable-local.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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/t5813-proto-disable-ssh.sh b/t/t5813-proto-disable-ssh.sh
index 3f084ee306..2e975dc70e 100755
--- a/t/t5813-proto-disable-ssh.sh
+++ b/t/t5813-proto-disable-ssh.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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/t6003-rev-list-topo-order.sh b/t/t6003-rev-list-topo-order.sh
index 1f7d7dd20c..5cf2cee74d 100755
--- a/t/t6003-rev-list-topo-order.sh
+++ b/t/t6003-rev-list-topo-order.sh
@@ -326,19 +326,16 @@ a2
c3
EOF
-#
-# this test fails on --topo-order - a fix is required
-#
-#test_output_expect_success '--max-age=c3, --topo-order' "git rev-list --topo-order --max-age=$(commit_date c3) l5" <<EOF
-#l5
-#l4
-#l3
-#a4
-#c3
-#b4
-#a3
-#a2
-#EOF
+test_output_expect_success '--max-age=c3, --topo-order' "git rev-list --topo-order --max-age=$(commit_date c3) l5" <<EOF
+l5
+l4
+l3
+a4
+c3
+b4
+a3
+a2
+EOF
test_output_expect_success 'one specified head reachable from another a4, c3, --topo-order' "list_duplicates git rev-list --topo-order a4 c3" <<EOF
EOF
diff --git a/t/t6011-rev-list-with-bad-commit.sh b/t/t6011-rev-list-with-bad-commit.sh
index bad02cf5b8..b2e422cf0f 100755
--- a/t/t6011-rev-list-with-bad-commit.sh
+++ b/t/t6011-rev-list-with-bad-commit.sh
@@ -2,6 +2,7 @@
test_description='git rev-list should notice bad commits'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
# Note:
diff --git a/t/t6014-rev-list-all.sh b/t/t6014-rev-list-all.sh
index c9bedd29cb..16b8bd1d09 100755
--- a/t/t6014-rev-list-all.sh
+++ b/t/t6014-rev-list-all.sh
@@ -2,6 +2,7 @@
test_description='--all includes detached HEADs'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
diff --git a/t/t6018-rev-list-glob.sh b/t/t6018-rev-list-glob.sh
index e1abc5c2b3..67d523d405 100755
--- a/t/t6018-rev-list-glob.sh
+++ b/t/t6018-rev-list-glob.sh
@@ -187,6 +187,46 @@ test_expect_success 'rev-parse --exclude=ref with --remotes=glob' '
compare rev-parse "--exclude=upstream/x --remotes=upstream/*" "upstream/one upstream/two"
'
+for section in fetch receive uploadpack
+do
+ test_expect_success "rev-parse --exclude-hidden=$section with --all" '
+ compare "-c transfer.hideRefs=refs/remotes/ rev-parse" "--branches --tags" "--exclude-hidden=$section --all"
+ '
+
+ test_expect_success "rev-parse --exclude-hidden=$section with --all" '
+ compare "-c transfer.hideRefs=refs/heads/subspace/ rev-parse" "--exclude=refs/heads/subspace/* --all" "--exclude-hidden=$section --all"
+ '
+
+ test_expect_success "rev-parse --exclude-hidden=$section with --glob" '
+ compare "-c transfer.hideRefs=refs/heads/subspace/ rev-parse" "--exclude=refs/heads/subspace/* --glob=refs/heads/*" "--exclude-hidden=$section --glob=refs/heads/*"
+ '
+
+ test_expect_success "rev-parse --exclude-hidden=$section can be passed once per pseudo-ref" '
+ compare "-c transfer.hideRefs=refs/remotes/ rev-parse" "--branches --tags --branches --tags" "--exclude-hidden=$section --all --exclude-hidden=$section --all"
+ '
+
+ test_expect_success "rev-parse --exclude-hidden=$section can only be passed once per pseudo-ref" '
+ echo "fatal: --exclude-hidden= passed more than once" >expected &&
+ test_must_fail git rev-parse --exclude-hidden=$section --exclude-hidden=$section 2>err &&
+ test_cmp expected err
+ '
+
+ for pseudoopt in branches tags remotes
+ do
+ test_expect_success "rev-parse --exclude-hidden=$section fails with --$pseudoopt" '
+ echo "error: --exclude-hidden cannot be used together with --$pseudoopt" >expected &&
+ test_must_fail git rev-parse --exclude-hidden=$section --$pseudoopt 2>err &&
+ test_cmp expected err
+ '
+
+ test_expect_success "rev-parse --exclude-hidden=$section fails with --$pseudoopt=pattern" '
+ echo "error: --exclude-hidden cannot be used together with --$pseudoopt" >expected &&
+ test_must_fail git rev-parse --exclude-hidden=$section --$pseudoopt=pattern 2>err &&
+ test_cmp expected err
+ '
+ done
+done
+
test_expect_success 'rev-list --exclude=glob with --branches=glob' '
compare rev-list "--exclude=subspace-* --branches=sub*" "subspace/one subspace/two"
'
diff --git a/t/t6020-bundle-misc.sh b/t/t6020-bundle-misc.sh
index 833205125a..dface8bcfe 100755
--- a/t/t6020-bundle-misc.sh
+++ b/t/t6020-bundle-misc.sh
@@ -10,6 +10,14 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-bundle.sh
+. "$TEST_DIRECTORY"/lib-terminal.sh
+
+for cmd in create verify list-heads unbundle
+do
+ test_expect_success "usage: git bundle $cmd needs an argument" '
+ test_expect_code 129 git bundle $cmd
+ '
+done
# Create a commit or tag and set the variable with the object ID.
test_commit_setvar () {
@@ -559,4 +567,82 @@ test_expect_success 'cloning from filtered bundle has useful error' '
grep "cannot clone from filtered bundle" err
'
+test_expect_success 'verify catches unreachable, broken prerequisites' '
+ test_when_finished rm -rf clone-from clone-to &&
+ git init clone-from &&
+ (
+ cd clone-from &&
+ git checkout -b base &&
+ test_commit A &&
+ git checkout -b tip &&
+ git commit --allow-empty -m "will drop by shallow" &&
+ git commit --allow-empty -m "will keep by shallow" &&
+ git commit --allow-empty -m "for bundle, not clone" &&
+ git bundle create tip.bundle tip~1..tip &&
+ git reset --hard HEAD~1 &&
+ git checkout base
+ ) &&
+ BAD_OID=$(git -C clone-from rev-parse tip~1) &&
+ TIP_OID=$(git -C clone-from rev-parse tip) &&
+ git clone --depth=1 --no-single-branch \
+ "file://$(pwd)/clone-from" clone-to &&
+ (
+ cd clone-to &&
+
+ # Set up broken history by removing shallow markers
+ git update-ref -d refs/remotes/origin/tip &&
+ rm .git/shallow &&
+
+ # Verify should fail
+ test_must_fail git bundle verify \
+ ../clone-from/tip.bundle 2>err &&
+ grep "some prerequisite commits .* are not connected" err &&
+ test_line_count = 1 err &&
+
+ # Unbundling should fail
+ test_must_fail git bundle unbundle \
+ ../clone-from/tip.bundle 2>err &&
+ grep "some prerequisite commits .* are not connected" err &&
+ test_line_count = 1 err
+ )
+'
+
+test_expect_success 'bundle progress includes write phase' '
+ GIT_PROGRESS_DELAY=0 \
+ git bundle create --progress out.bundle --all 2>err &&
+ grep 'Writing' err
+'
+
+test_expect_success TTY 'create --quiet disables all bundle progress' '
+ test_terminal env GIT_PROGRESS_DELAY=0 \
+ git bundle create --quiet out.bundle --all 2>err &&
+ test_must_be_empty err
+'
+
+test_expect_success 'read bundle over stdin' '
+ git bundle create some.bundle HEAD &&
+
+ git bundle verify - <some.bundle 2>err &&
+ grep "<stdin> is okay" err &&
+
+ git bundle list-heads some.bundle >expect &&
+ git bundle list-heads - <some.bundle >actual &&
+ test_cmp expect actual &&
+
+ git bundle unbundle some.bundle >expect &&
+ git bundle unbundle - <some.bundle >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'send a bundle to standard output' '
+ git bundle create - --all HEAD >bundle-one &&
+ mkdir -p down &&
+ git -C down bundle create - --all HEAD >bundle-two &&
+ git bundle verify bundle-one &&
+ git bundle verify bundle-two &&
+ git ls-remote bundle-one >expect &&
+ git ls-remote bundle-two >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t6021-rev-list-exclude-hidden.sh b/t/t6021-rev-list-exclude-hidden.sh
new file mode 100755
index 0000000000..1a9d37e638
--- /dev/null
+++ b/t/t6021-rev-list-exclude-hidden.sh
@@ -0,0 +1,164 @@
+#!/bin/sh
+
+test_description='git rev-list --exclude-hidden test'
+
+TEST_PASSES_SANITIZE_LEAK=true
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ test_commit_bulk --id=commit --ref=refs/heads/branch 1 &&
+ COMMIT=$(git rev-parse refs/heads/branch) &&
+ test_commit_bulk --id=tag --ref=refs/tags/lightweight 1 &&
+ TAG=$(git rev-parse refs/tags/lightweight) &&
+ test_commit_bulk --id=hidden --ref=refs/hidden/commit 1 &&
+ HIDDEN=$(git rev-parse refs/hidden/commit) &&
+ test_commit_bulk --id=namespace --ref=refs/namespaces/namespace/refs/namespaced/commit 1 &&
+ NAMESPACE=$(git rev-parse refs/namespaces/namespace/refs/namespaced/commit)
+'
+
+test_expect_success 'invalid section' '
+ echo "fatal: unsupported section for hidden refs: unsupported" >expected &&
+ test_must_fail git rev-list --exclude-hidden=unsupported 2>err &&
+ test_cmp expected err
+'
+
+for section in fetch receive uploadpack
+do
+ test_expect_success "$section: passed multiple times" '
+ echo "fatal: --exclude-hidden= passed more than once" >expected &&
+ test_must_fail git rev-list --exclude-hidden=$section --exclude-hidden=$section 2>err &&
+ test_cmp expected err
+ '
+
+ test_expect_success "$section: without hiddenRefs" '
+ git rev-list --exclude-hidden=$section --all >out &&
+ cat >expected <<-EOF &&
+ $NAMESPACE
+ $HIDDEN
+ $TAG
+ $COMMIT
+ EOF
+ test_cmp expected out
+ '
+
+ test_expect_success "$section: hidden via transfer.hideRefs" '
+ git -c transfer.hideRefs=refs/hidden/ rev-list --exclude-hidden=$section --all >out &&
+ cat >expected <<-EOF &&
+ $NAMESPACE
+ $TAG
+ $COMMIT
+ EOF
+ test_cmp expected out
+ '
+
+ test_expect_success "$section: hidden via $section.hideRefs" '
+ git -c $section.hideRefs=refs/hidden/ rev-list --exclude-hidden=$section --all >out &&
+ cat >expected <<-EOF &&
+ $NAMESPACE
+ $TAG
+ $COMMIT
+ EOF
+ test_cmp expected out
+ '
+
+ test_expect_success "$section: respects both transfer.hideRefs and $section.hideRefs" '
+ git -c transfer.hideRefs=refs/tags/ -c $section.hideRefs=refs/hidden/ rev-list --exclude-hidden=$section --all >out &&
+ cat >expected <<-EOF &&
+ $NAMESPACE
+ $COMMIT
+ EOF
+ test_cmp expected out
+ '
+
+ test_expect_success "$section: negation without hidden refs marks everything as uninteresting" '
+ git rev-list --all --exclude-hidden=$section --not --all >out &&
+ test_must_be_empty out
+ '
+
+ test_expect_success "$section: negation with hidden refs marks them as interesting" '
+ git -c transfer.hideRefs=refs/hidden/ rev-list --all --exclude-hidden=$section --not --all >out &&
+ cat >expected <<-EOF &&
+ $HIDDEN
+ EOF
+ test_cmp expected out
+ '
+
+ test_expect_success "$section: hidden refs and excludes work together" '
+ git -c transfer.hideRefs=refs/hidden/ rev-list --exclude=refs/tags/* --exclude-hidden=$section --all >out &&
+ cat >expected <<-EOF &&
+ $NAMESPACE
+ $COMMIT
+ EOF
+ test_cmp expected out
+ '
+
+ test_expect_success "$section: excluded hidden refs get reset" '
+ git -c transfer.hideRefs=refs/ rev-list --exclude-hidden=$section --all --all >out &&
+ cat >expected <<-EOF &&
+ $NAMESPACE
+ $HIDDEN
+ $TAG
+ $COMMIT
+ EOF
+ test_cmp expected out
+ '
+
+ test_expect_success "$section: excluded hidden refs can be used with multiple pseudo-refs" '
+ git -c transfer.hideRefs=refs/ rev-list --exclude-hidden=$section --all --exclude-hidden=$section --all >out &&
+ test_must_be_empty out
+ '
+
+ test_expect_success "$section: works with --glob" '
+ git -c transfer.hideRefs=refs/hidden/ rev-list --exclude-hidden=$section --glob=refs/h* >out &&
+ cat >expected <<-EOF &&
+ $COMMIT
+ EOF
+ test_cmp expected out
+ '
+
+ test_expect_success "$section: operates on stripped refs by default" '
+ GIT_NAMESPACE=namespace git -c transfer.hideRefs=refs/namespaced/ rev-list --exclude-hidden=$section --all >out &&
+ cat >expected <<-EOF &&
+ $HIDDEN
+ $TAG
+ $COMMIT
+ EOF
+ test_cmp expected out
+ '
+
+ test_expect_success "$section: does not hide namespace by default" '
+ GIT_NAMESPACE=namespace git -c transfer.hideRefs=refs/namespaces/namespace/ rev-list --exclude-hidden=$section --all >out &&
+ cat >expected <<-EOF &&
+ $NAMESPACE
+ $HIDDEN
+ $TAG
+ $COMMIT
+ EOF
+ test_cmp expected out
+ '
+
+ test_expect_success "$section: can operate on unstripped refs" '
+ GIT_NAMESPACE=namespace git -c transfer.hideRefs=^refs/namespaces/namespace/ rev-list --exclude-hidden=$section --all >out &&
+ cat >expected <<-EOF &&
+ $HIDDEN
+ $TAG
+ $COMMIT
+ EOF
+ test_cmp expected out
+ '
+
+ for pseudoopt in remotes branches tags
+ do
+ test_expect_success "$section: fails with --$pseudoopt" '
+ test_must_fail git rev-list --exclude-hidden=$section --$pseudoopt 2>err &&
+ test_i18ngrep "error: --exclude-hidden cannot be used together with --$pseudoopt" err
+ '
+
+ test_expect_success "$section: fails with --$pseudoopt=pattern" '
+ test_must_fail git rev-list --exclude-hidden=$section --$pseudoopt=pattern 2>err &&
+ test_i18ngrep "error: --exclude-hidden cannot be used together with --$pseudoopt" err
+ '
+ done
+done
+
+test_done
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 83931d482f..fb01bd6abc 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -34,6 +34,36 @@ HASH2=
HASH3=
HASH4=
+test_bisect_usage () {
+ local code="$1" &&
+ shift &&
+ cat >expect &&
+ test_expect_code $code "$@" >out 2>actual &&
+ test_must_be_empty out &&
+ test_cmp expect actual
+}
+
+test_expect_success 'bisect usage' "
+ test_bisect_usage 1 git bisect reset extra1 extra2 <<-\EOF &&
+ error: 'git bisect reset' requires either no argument or a commit
+ EOF
+ test_bisect_usage 1 git bisect terms extra1 extra2 <<-\EOF &&
+ error: 'git bisect terms' requires 0 or 1 argument
+ EOF
+ test_bisect_usage 1 git bisect next extra1 <<-\EOF &&
+ error: 'git bisect next' requires 0 arguments
+ EOF
+ test_bisect_usage 1 git bisect log extra1 <<-\EOF &&
+ error: We are not bisecting.
+ EOF
+ test_bisect_usage 1 git bisect replay <<-\EOF &&
+ error: no logfile given
+ EOF
+ test_bisect_usage 1 git bisect run <<-\EOF
+ error: 'git bisect run' failed: no command provided.
+ EOF
+"
+
test_expect_success 'set up basic repo with 1 file (hello) and 4 commits' '
add_line_into_file "1: Hello World" hello &&
HASH1=$(git rev-parse --verify HEAD) &&
@@ -92,6 +122,29 @@ test_expect_success 'bisect start without -- takes unknown arg as pathspec' '
grep bar ".git/BISECT_NAMES"
'
+test_expect_success 'bisect reset: back in a branch checked out also elsewhere' '
+ echo "shared" > branch.expect &&
+ test_bisect_reset() {
+ git -C $1 bisect start &&
+ git -C $1 bisect good $HASH1 &&
+ git -C $1 bisect bad $HASH3 &&
+ git -C $1 bisect reset &&
+ git -C $1 branch --show-current > branch.output &&
+ cmp branch.expect branch.output
+ } &&
+ test_when_finished "
+ git worktree remove wt1 &&
+ git worktree remove wt2 &&
+ git branch -d shared
+ " &&
+ git worktree add wt1 -b shared &&
+ git worktree add wt2 -f shared &&
+ # we test in both worktrees to ensure that works
+ # as expected with "first" and "next" worktrees
+ test_bisect_reset wt1 &&
+ test_bisect_reset wt2
+'
+
test_expect_success 'bisect reset: back in the main branch' '
git bisect reset &&
echo "* main" > branch.expect &&
@@ -252,6 +305,124 @@ test_expect_success 'bisect skip: with commit both bad and skipped' '
grep $HASH4 my_bisect_log.txt
'
+test_bisect_run_args () {
+ test_when_finished "rm -f run.sh actual" &&
+ >actual &&
+ cat >expect.args &&
+ cat <&6 >expect.out &&
+ cat <&7 >expect.err &&
+ write_script run.sh <<-\EOF &&
+ while test $# != 0
+ do
+ echo "<$1>" &&
+ shift
+ done >actual.args
+ EOF
+
+ test_when_finished "git bisect reset" &&
+ git bisect start &&
+ git bisect good $HASH1 &&
+ git bisect bad $HASH4 &&
+ git bisect run ./run.sh $@ >actual.out.raw 2>actual.err &&
+ # Prune just the log output
+ sed -n \
+ -e '/^Author:/d' \
+ -e '/^Date:/d' \
+ -e '/^$/d' \
+ -e '/^commit /d' \
+ -e '/^ /d' \
+ -e 'p' \
+ <actual.out.raw >actual.out &&
+ test_cmp expect.out actual.out &&
+ test_cmp expect.err actual.err &&
+ test_cmp expect.args actual.args
+}
+
+test_expect_success 'git bisect run: args, stdout and stderr with no arguments' "
+ test_bisect_run_args <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
+ EOF_ARGS
+ running './run.sh'
+ $HASH4 is the first bad commit
+ bisect found first bad commit
+ EOF_OUT
+ EOF_ERR
+"
+
+test_expect_success 'git bisect run: args, stdout and stderr: "--" argument' "
+ test_bisect_run_args -- <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
+ <-->
+ EOF_ARGS
+ running './run.sh' '--'
+ $HASH4 is the first bad commit
+ bisect found first bad commit
+ EOF_OUT
+ EOF_ERR
+"
+
+test_expect_success 'git bisect run: args, stdout and stderr: "--log foo --no-log bar" arguments' "
+ test_bisect_run_args --log foo --no-log bar <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
+ <--log>
+ <foo>
+ <--no-log>
+ <bar>
+ EOF_ARGS
+ running './run.sh' '--log' 'foo' '--no-log' 'bar'
+ $HASH4 is the first bad commit
+ bisect found first bad commit
+ EOF_OUT
+ EOF_ERR
+"
+
+test_expect_success 'git bisect run: args, stdout and stderr: "--bisect-start" argument' "
+ test_bisect_run_args --bisect-start <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
+ <--bisect-start>
+ EOF_ARGS
+ running './run.sh' '--bisect-start'
+ $HASH4 is the first bad commit
+ bisect found first bad commit
+ EOF_OUT
+ EOF_ERR
+"
+
+test_expect_success 'git bisect run: negative exit code' "
+ write_script fail.sh <<-'EOF' &&
+ exit 255
+ EOF
+ cat <<-'EOF' >expect &&
+ bisect run failed: exit code -1 from './fail.sh' is < 0 or >= 128
+ EOF
+ test_when_finished 'git bisect reset' &&
+ git bisect start &&
+ git bisect good $HASH1 &&
+ git bisect bad $HASH4 &&
+ ! git bisect run ./fail.sh 2>err &&
+ sed -En 's/.*(bisect.*code) (-?[0-9]+) (from.*)/\1 -1 \3/p' err >actual &&
+ test_cmp expect actual
+"
+
+test_expect_success 'git bisect run: unable to verify on good' "
+ write_script fail.sh <<-'EOF' &&
+ head=\$(git rev-parse --verify HEAD)
+ good=\$(git rev-parse --verify $HASH1)
+ if test "\$head" = "\$good"
+ then
+ exit 255
+ else
+ exit 127
+ fi
+ EOF
+ cat <<-'EOF' >expect &&
+ unable to verify './fail.sh' on good revision
+ EOF
+ test_when_finished 'git bisect reset' &&
+ git bisect start &&
+ git bisect good $HASH1 &&
+ git bisect bad $HASH4 &&
+ ! git bisect run ./fail.sh 2>err &&
+ sed -n 's/.*\(unable to verify.*\)/\1/p' err >actual &&
+ test_cmp expect actual
+"
+
# We want to automatically find the commit that
# added "Another" into hello.
test_expect_success '"git bisect run" simple case' '
@@ -266,6 +437,16 @@ test_expect_success '"git bisect run" simple case' '
git bisect reset
'
+# We want to make sure no arguments has been eaten
+test_expect_success '"git bisect run" simple case' '
+ git bisect start &&
+ git bisect good $HASH1 &&
+ git bisect bad $HASH4 &&
+ git bisect run printf "%s %s\n" reset --bisect-skip >my_bisect_log.txt &&
+ grep -e "reset --bisect-skip" my_bisect_log.txt &&
+ git bisect reset
+'
+
# We want to automatically find the commit that
# added "Ciao" into hello.
test_expect_success '"git bisect run" with more complex "git bisect start"' '
@@ -900,6 +1081,16 @@ test_expect_success 'bisect start with one term1 and term2' '
git bisect reset
'
+test_expect_success 'bogus command does not start bisect' '
+ git bisect reset &&
+ test_must_fail git bisect --bisect-terms 1 2 2>out &&
+ ! grep "You need to start" out &&
+ test_must_fail git bisect --bisect-terms 2>out &&
+ ! grep "You need to start" out &&
+ grep "git bisect.*visualize" out &&
+ git bisect reset
+'
+
test_expect_success 'bisect replay with term1 and term2' '
git bisect replay log_to_replay.txt >bisect_result &&
grep "$HASH2 is the first term1 commit" bisect_result &&
@@ -990,7 +1181,6 @@ test_expect_success 'git bisect reset cleans bisection state properly' '
test_path_is_missing ".git/BISECT_LOG" &&
test_path_is_missing ".git/BISECT_RUN" &&
test_path_is_missing ".git/BISECT_TERMS" &&
- test_path_is_missing ".git/head-name" &&
test_path_is_missing ".git/BISECT_HEAD" &&
test_path_is_missing ".git/BISECT_START"
'
@@ -1053,4 +1243,14 @@ test_expect_success 'bisect state output with bad commit' '
grep -F "waiting for good commit(s), bad commit known" output
'
+test_expect_success 'verify correct error message' '
+ git bisect reset &&
+ git bisect start $HASH4 $HASH1 &&
+ write_script test_script.sh <<-\EOF &&
+ rm .git/BISECT*
+ EOF
+ test_must_fail git bisect run ./test_script.sh 2>error &&
+ grep "git bisect good.*exited with error code" error
+'
+
test_done
diff --git a/t/t6060-merge-index.sh b/t/t6060-merge-index.sh
index ed449abe55..1a8b64cce1 100755
--- a/t/t6060-merge-index.sh
+++ b/t/t6060-merge-index.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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/t6102-rev-list-unexpected-objects.sh b/t/t6102-rev-list-unexpected-objects.sh
index 4a9a4436e2..9350b5fd2c 100755
--- a/t/t6102-rev-list-unexpected-objects.sh
+++ b/t/t6102-rev-list-unexpected-objects.sh
@@ -121,8 +121,8 @@ test_expect_success 'setup unexpected non-blob tag' '
tag=$(git hash-object -w --literally -t tag broken-tag)
'
-test_expect_success 'TODO (should fail!): traverse unexpected non-blob tag (lone)' '
- git rev-list --objects $tag
+test_expect_success 'traverse unexpected non-blob tag (lone)' '
+ test_must_fail git rev-list --objects $tag
'
test_expect_success 'traverse unexpected non-blob tag (seen)' '
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index 9a35e783a7..c9afcef201 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -657,4 +657,10 @@ test_expect_success 'setup: describe commits with disjoint bases 2' '
check_describe -C disjoint2 "B-3-gHASH" 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
+'
+
+check_describe newer-tag-older-commit~1 --contains unique-file~2
+
test_done
diff --git a/t/t6132-pathspec-exclude.sh b/t/t6132-pathspec-exclude.sh
index cada952f9a..9fdafeb1e9 100755
--- a/t/t6132-pathspec-exclude.sh
+++ b/t/t6132-pathspec-exclude.sh
@@ -293,11 +293,7 @@ test_expect_success 'add with all negative' '
test_cmp expect actual
'
-test_lazy_prereq ADD_I_USE_BUILTIN_OR_PERL '
- test_have_prereq ADD_I_USE_BUILTIN || test_have_prereq PERL
-'
-
-test_expect_success ADD_I_USE_BUILTIN_OR_PERL 'add -p with all negative' '
+test_expect_success 'add -p with all negative' '
H=$(git rev-parse HEAD) &&
git reset --hard $H &&
git clean -f &&
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index dcaab7265f..5c00607608 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -606,7 +606,7 @@ test_expect_success 'create tag without tagger' '
git tag -a -m "Broken tag" taggerless &&
git tag -f taggerless $(git cat-file tag taggerless |
sed -e "/^tagger /d" |
- git hash-object --stdin -w -t tag)
+ git hash-object --literally --stdin -w -t tag)
'
test_atom refs/tags/taggerless type 'commit'
@@ -1242,6 +1242,24 @@ test_expect_success 'basic atom: rest must fail' '
test_must_fail git for-each-ref --format="%(rest)" refs/heads/main
'
+test_expect_success 'HEAD atom does not take arguments' '
+ test_must_fail git for-each-ref --format="%(HEAD:foo)" 2>err &&
+ echo "fatal: %(HEAD) does not take arguments" >expect &&
+ test_cmp expect err
+'
+
+test_expect_success 'subject atom rejects unknown arguments' '
+ test_must_fail git for-each-ref --format="%(subject:foo)" 2>err &&
+ echo "fatal: unrecognized %(subject) argument: foo" >expect &&
+ test_cmp expect err
+'
+
+test_expect_success 'refname atom rejects unknown arguments' '
+ test_must_fail git for-each-ref --format="%(refname:foo)" 2>err &&
+ echo "fatal: unrecognized %(refname) argument: foo" >expect &&
+ test_cmp expect err
+'
+
test_expect_success 'trailer parsing not fooled by --- line' '
git commit --allow-empty -F - <<-\EOF &&
this is the subject
@@ -1356,6 +1374,14 @@ test_expect_success 'for-each-ref --ignore-case ignores case' '
test_cmp expect actual
'
+test_expect_success 'for-each-ref --omit-empty works' '
+ git for-each-ref --format="%(refname)" >actual &&
+ test_line_count -gt 1 actual &&
+ git for-each-ref --format="%(if:equals=refs/heads/main)%(refname)%(then)%(refname)%(end)" --omit-empty >actual &&
+ echo refs/heads/main >expect &&
+ test_cmp expect actual
+'
+
test_expect_success 'for-each-ref --ignore-case works on multiple sort keys' '
# name refs numerically to avoid case-insensitive filesystem conflicts
nr=0 &&
@@ -1406,4 +1432,94 @@ test_expect_success 'for-each-ref reports broken tags' '
refs/tags/broken-tag-*
'
+test_expect_success 'set up tag with signature and no blank lines' '
+ git tag -F - fake-sig-no-blanks <<-\EOF
+ this is the subject
+ -----BEGIN PGP SIGNATURE-----
+ not a real signature, but we just care about the
+ subject/body parsing. It is important here that
+ there are no blank lines in the signature.
+ -----END PGP SIGNATURE-----
+ EOF
+'
+
+test_atom refs/tags/fake-sig-no-blanks contents:subject 'this is the subject'
+test_atom refs/tags/fake-sig-no-blanks contents:body ''
+test_atom refs/tags/fake-sig-no-blanks contents:signature "$sig"
+
+test_expect_success 'set up tag with CRLF signature' '
+ append_cr <<-\EOF |
+ this is the subject
+ -----BEGIN PGP SIGNATURE-----
+
+ not a real signature, but we just care about
+ the subject/body parsing. It is important here
+ that there is a blank line separating this
+ from the signature header.
+ -----END PGP SIGNATURE-----
+ EOF
+ git tag -F - --cleanup=verbatim fake-sig-crlf
+'
+
+test_atom refs/tags/fake-sig-crlf contents:subject 'this is the subject'
+test_atom refs/tags/fake-sig-crlf contents:body ''
+
+# CRLF is retained in the signature, so we have to pass our expected value
+# through append_cr. But test_atom requires a shell string, which means command
+# substitution, and the shell will strip trailing newlines from the output of
+# the substitution. Hack around it by adding and then removing a dummy line.
+sig_crlf="$(printf "%s" "$sig" | append_cr; echo dummy)"
+sig_crlf=${sig_crlf%dummy}
+test_atom refs/tags/fake-sig-crlf contents:signature "$sig_crlf"
+
+test_expect_success 'git for-each-ref --stdin: empty' '
+ >in &&
+ git for-each-ref --format="%(refname)" --stdin <in >actual &&
+ git for-each-ref --format="%(refname)" >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success 'git for-each-ref --stdin: fails if extra args' '
+ >in &&
+ test_must_fail git for-each-ref --format="%(refname)" \
+ --stdin refs/heads/extra <in 2>err &&
+ grep "unknown arguments supplied with --stdin" err
+'
+
+test_expect_success 'git for-each-ref --stdin: matches' '
+ cat >in <<-EOF &&
+ refs/tags/multi*
+ refs/heads/amb*
+ EOF
+
+ cat >expect <<-EOF &&
+ refs/heads/ambiguous
+ refs/tags/multi-ref1-100000-user1
+ refs/tags/multi-ref1-100000-user2
+ refs/tags/multi-ref1-200000-user1
+ refs/tags/multi-ref1-200000-user2
+ refs/tags/multi-ref2-100000-user1
+ refs/tags/multi-ref2-100000-user2
+ refs/tags/multi-ref2-200000-user1
+ refs/tags/multi-ref2-200000-user2
+ refs/tags/multiline
+ EOF
+
+ git for-each-ref --format="%(refname)" --stdin <in >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'git for-each-ref with non-existing refs' '
+ cat >in <<-EOF &&
+ refs/heads/this-ref-does-not-exist
+ refs/tags/bogus
+ EOF
+
+ git for-each-ref --format="%(refname)" --stdin <in >actual &&
+ test_must_be_empty actual &&
+
+ xargs git for-each-ref --format="%(refname)" <in >actual &&
+ test_must_be_empty actual
+'
+
test_done
diff --git a/t/t6301-for-each-ref-errors.sh b/t/t6301-for-each-ref-errors.sh
index 40edf9dab5..2667dd13fe 100755
--- a/t/t6301-for-each-ref-errors.sh
+++ b/t/t6301-for-each-ref-errors.sh
@@ -2,6 +2,7 @@
test_description='for-each-ref errors for broken refs'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
ZEROS=$ZERO_OID
@@ -53,4 +54,18 @@ test_expect_success 'Missing objects are reported correctly' '
test_must_be_empty brief-err
'
+test_expect_success 'ahead-behind requires an argument' '
+ test_must_fail git for-each-ref \
+ --format="%(ahead-behind)" 2>err &&
+ echo "fatal: expected format: %(ahead-behind:<committish>)" >expect &&
+ test_cmp expect err
+'
+
+test_expect_success 'missing ahead-behind base' '
+ test_must_fail git for-each-ref \
+ --format="%(ahead-behind:refs/heads/missing)" 2>err &&
+ echo "fatal: failed to find '\''refs/heads/missing'\''" >expect &&
+ test_cmp expect err
+'
+
test_done
diff --git a/t/t6401-merge-criss-cross.sh b/t/t6401-merge-criss-cross.sh
index 9d5e992878..1962310408 100755
--- a/t/t6401-merge-criss-cross.sh
+++ b/t/t6401-merge-criss-cross.sh
@@ -8,6 +8,8 @@
test_description='Test criss-cross merge'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'prepare repository' '
diff --git a/t/t6406-merge-attr.sh b/t/t6406-merge-attr.sh
index 8650a88c40..5e4e4dd6d9 100755
--- a/t/t6406-merge-attr.sh
+++ b/t/t6406-merge-attr.sh
@@ -8,6 +8,7 @@ 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 e8a28717ce..0753fc95f4 100755
--- a/t/t6407-merge-binary.sh
+++ b/t/t6407-merge-binary.sh
@@ -5,6 +5,7 @@ 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/t6415-merge-dir-to-symlink.sh b/t/t6415-merge-dir-to-symlink.sh
index 2655e295f5..ae00492c76 100755
--- a/t/t6415-merge-dir-to-symlink.sh
+++ b/t/t6415-merge-dir-to-symlink.sh
@@ -4,6 +4,7 @@ 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/t6421-merge-partial-clone.sh b/t/t6421-merge-partial-clone.sh
index 5413e5dd9d..711b709e75 100755
--- a/t/t6421-merge-partial-clone.sh
+++ b/t/t6421-merge-partial-clone.sh
@@ -155,7 +155,7 @@ test_setup_repo () {
# Commit A:
# (Rename leap->jump, rename basename/ -> basename/subdir/, rename dir/
# -> folder/, move e into newsubdir, add newfile.rs, remove f, modify
-# both both Makefiles and jumps)
+# both Makefiles and jumps)
# general/{jump1_A, jump2_A}
# basename/subdir/{numbers_A, sequence_A, values_A}
# folder/subdir/{a,b,c,d,Makefile_TOP_A}
@@ -343,7 +343,7 @@ test_expect_merge_algorithm failure success 'Objects downloaded when a directory
# Commit A:
# (Rename leap->jump, rename basename/ -> basename/subdir/, rename dir/
# -> folder/, move e into newsubdir, add newfile.rs, remove f, modify
-# both both Makefiles and jumps)
+# both Makefiles and jumps)
# general/{jump1_A, jump2_A}
# basename/subdir/{numbers_A, sequence_A, values_A}
# folder/subdir/{a,b,c,d,Makefile_TOP_A}
diff --git a/t/t6422-merge-rename-corner-cases.sh b/t/t6422-merge-rename-corner-cases.sh
index 346253c7c8..076b6a74d5 100755
--- a/t/t6422-merge-rename-corner-cases.sh
+++ b/t/t6422-merge-rename-corner-cases.sh
@@ -1159,7 +1159,6 @@ test_conflicts_with_adds_and_renames() {
# 4) There should not be any three~* files in the working
# tree
test_setup_collision_conflict () {
- #test_expect_success "setup simple $sideL/$sideR conflict" '
git init simple_${sideL}_${sideR} &&
(
cd simple_${sideL}_${sideR} &&
@@ -1236,7 +1235,6 @@ test_conflicts_with_adds_and_renames() {
fi &&
test_tick && git commit -m R
)
- #'
}
test_expect_success "check simple $sideL/$sideR conflict" '
diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh
index a4941878fe..944de75b80 100755
--- a/t/t6423-merge-rename-directories.sh
+++ b/t/t6423-merge-rename-directories.sh
@@ -5304,6 +5304,62 @@ test_expect_merge_algorithm failure success '12l (A into B): Rename into each ot
)
'
+# Testcase 12m, Directory rename, plus change of parent dir to symlink
+# Commit O: dir/subdir/file
+# Commit A: renamed-dir/subdir/file
+# Commit B: dir/subdir
+# In words:
+# A: dir/subdir/ -> renamed-dir/subdir
+# B: delete dir/subdir/file, add dir/subdir as symlink
+#
+# Expected: CONFLICT (rename/delete): renamed-dir/subdir/file,
+# CONFLICT (file location): renamed-dir/subdir vs. dir/subdir
+# CONFLICT (directory/file): renamed-dir/subdir symlink has
+# renamed-dir/subdir in the way
+
+test_setup_12m () {
+ git init 12m &&
+ (
+ cd 12m &&
+
+ mkdir -p dir/subdir &&
+ echo 1 >dir/subdir/file &&
+ git add . &&
+ git commit -m "O" &&
+
+ git branch O &&
+ git branch A &&
+ git branch B &&
+
+ git switch A &&
+ git mv dir/ renamed-dir/ &&
+ git add . &&
+ git commit -m "A" &&
+
+ git switch B &&
+ git rm dir/subdir/file &&
+ mkdir dir &&
+ ln -s /dev/null dir/subdir &&
+ git add . &&
+ git commit -m "B"
+ )
+}
+
+test_expect_merge_algorithm failure success '12m: Change parent of renamed-dir to symlink on other side' '
+ test_setup_12m &&
+ (
+ cd 12m &&
+
+ git checkout -q A^0 &&
+
+ test_must_fail git -c merge.directoryRenames=conflict merge -s recursive B^0 &&
+
+ test_stdout_line_count = 3 git ls-files -s &&
+ test_stdout_line_count = 2 ls -1 renamed-dir &&
+ test_path_is_missing dir
+ )
+'
+
###########################################################################
# SECTION 13: Checking informational and conflict messages
#
diff --git a/t/t6426-merge-skip-unneeded-updates.sh b/t/t6426-merge-skip-unneeded-updates.sh
index 2bb8e7f09b..fd21c1a486 100755
--- a/t/t6426-merge-skip-unneeded-updates.sh
+++ b/t/t6426-merge-skip-unneeded-updates.sh
@@ -378,42 +378,30 @@ test_expect_success '2c: Modify b & add c VS rename b->c' '
test_i18ngrep "CONFLICT (.*/add):" out &&
test_must_be_empty err &&
- # Make sure c WAS updated
+ git ls-files -s >index_files &&
+ test_line_count = 2 index_files &&
+
+ # Ensure b was removed
+ test_path_is_missing b &&
+
+ # Make sure c WAS updated...
test-tool chmtime --get c >new-mtime &&
- test $(cat old-mtime) -lt $(cat new-mtime)
-
- # FIXME: rename/add conflicts are horribly broken right now;
- # when I get back to my patch series fixing it and
- # rename/rename(2to1) conflicts to bring them in line with
- # how add/add conflicts behave, then checks like the below
- # could be added. But that patch series is waiting until
- # the rename-directory-detection series lands, which this
- # is part of. And in the mean time, I do not want to further
- # enforce broken behavior. So for now, the main test is the
- # one above that err is an empty file.
-
- #git ls-files -s >index_files &&
- #test_line_count = 2 index_files &&
-
- #git rev-parse >actual :2:c :3:c &&
- #git rev-parse >expect A:b A:c &&
- #test_cmp expect actual &&
-
- #git cat-file -p A:b >>merged &&
- #git cat-file -p A:c >>merge-me &&
- #>empty &&
- #test_must_fail git merge-file \
- # -L "Temporary merge branch 1" \
- # -L "" \
- # -L "Temporary merge branch 2" \
- # merged empty merge-me &&
- #sed -e "s/^\([<=>]\)/\1\1\1/" merged >merged-internal &&
-
- #git hash-object c >actual &&
- #git hash-object merged-internal >expect &&
- #test_cmp expect actual &&
-
- #test_path_is_missing b
+ test $(cat old-mtime) -lt $(cat new-mtime) &&
+
+ # ...and has correct index entries and working tree contents
+ git rev-parse >actual :2:c :3:c &&
+ git rev-parse >expect A:c A:b &&
+ test_cmp expect actual &&
+
+ git cat-file -p A:b >>merge-me &&
+ git cat-file -p A:c >>merged &&
+ >empty &&
+ test_must_fail git merge-file \
+ -L "HEAD" \
+ -L "" \
+ -L "B^0" \
+ merged empty merge-me &&
+ test_cmp merged c
)
'
diff --git a/t/t6435-merge-sparse.sh b/t/t6435-merge-sparse.sh
index fde4aa3cd1..78628fb248 100755
--- a/t/t6435-merge-sparse.sh
+++ b/t/t6435-merge-sparse.sh
@@ -3,6 +3,7 @@
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/t6439-merge-co-error-msgs.sh b/t/t6439-merge-co-error-msgs.sh
index 52cf0c8769..0cbec57cda 100755
--- a/t/t6439-merge-co-error-msgs.sh
+++ b/t/t6439-merge-co-error-msgs.sh
@@ -5,6 +5,7 @@ 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 cd6c53360d..69509d0c11 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -202,6 +202,107 @@ test_expect_success 'one of gc.reflogExpire{Unreachable,}=never does not skip "e
grep -E "^trace: (built-in|exec|run_command): git reflog expire --" trace.out
'
+prepare_cruft_history () {
+ test_commit base &&
+
+ test_commit --no-tag foo &&
+ test_commit --no-tag bar &&
+ git reset HEAD^^
+}
+
+assert_no_cruft_packs () {
+ find .git/objects/pack -name "*.mtimes" >mtimes &&
+ test_must_be_empty mtimes
+}
+
+for argv in \
+ "gc" \
+ "-c gc.cruftPacks=true gc" \
+ "-c gc.cruftPacks=false gc --cruft"
+do
+ test_expect_success "git $argv generates a cruft pack" '
+ test_when_finished "rm -fr repo" &&
+ git init repo &&
+ (
+ cd repo &&
+
+ prepare_cruft_history &&
+ git $argv &&
+
+ find .git/objects/pack -name "*.mtimes" >mtimes &&
+ sed -e 's/\.mtimes$/\.pack/g' mtimes >packs &&
+
+ test_file_not_empty packs &&
+ while read pack
+ do
+ test_path_is_file "$pack" || return 1
+ done <packs
+ )
+ '
+done
+
+for argv in \
+ "gc --no-cruft" \
+ "-c gc.cruftPacks=false gc" \
+ "-c gc.cruftPacks=true gc --no-cruft"
+do
+ test_expect_success "git $argv does not generate a cruft pack" '
+ test_when_finished "rm -fr repo" &&
+ git init repo &&
+ (
+ cd repo &&
+
+ prepare_cruft_history &&
+ git $argv &&
+
+ assert_no_cruft_packs
+ )
+ '
+done
+
+test_expect_success '--keep-largest-pack ignores cruft packs' '
+ test_when_finished "rm -fr repo" &&
+ git init repo &&
+ (
+ cd repo &&
+
+ # Generate a pack for reachable objects (of which there
+ # are 3), and one for unreachable objects (of which
+ # there are 6).
+ prepare_cruft_history &&
+ git gc --cruft &&
+
+ mtimes="$(find .git/objects/pack -type f -name "pack-*.mtimes")" &&
+ sz="$(test_file_size "${mtimes%.mtimes}.pack")" &&
+
+ # Ensure that the cruft pack gets removed (due to
+ # `--prune=now`) despite it being the largest pack.
+ git -c gc.bigPackThreshold=$sz gc --cruft --prune=now &&
+
+ assert_no_cruft_packs
+ )
+'
+
+test_expect_success 'gc.bigPackThreshold ignores cruft packs' '
+ test_when_finished "rm -fr repo" &&
+ git init repo &&
+ (
+ cd repo &&
+
+ # Generate a pack for reachable objects (of which there
+ # are 3), and one for unreachable objects (of which
+ # there are 6).
+ prepare_cruft_history &&
+ git gc --cruft &&
+
+ # Ensure that the cruft pack gets removed (due to
+ # `--prune=now`) despite it being the largest pack.
+ git gc --cruft --prune=now --keep-largest-pack &&
+
+ assert_no_cruft_packs
+ )
+'
+
run_and_wait_for_auto_gc () {
# We read stdout from gc for the side effect of waiting until the
# background gc process exits, closing its fd 9. Furthermore, the
diff --git a/t/t6501-freshen-objects.sh b/t/t6501-freshen-objects.sh
index 10662456ae..dbfa8a4d4c 100755
--- a/t/t6501-freshen-objects.sh
+++ b/t/t6501-freshen-objects.sh
@@ -28,6 +28,7 @@ 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
@@ -100,7 +101,7 @@ do
'
test_expect_success "simultaneous gc ($title)" '
- git gc --prune=12.hours.ago
+ git gc --no-cruft --prune=12.hours.ago
'
test_expect_success "finish writing out commit ($title)" '
@@ -130,7 +131,7 @@ do
'
test_expect_success "simultaneous gc ($title)" '
- git gc --prune=12.hours.ago
+ git gc --no-cruft --prune=12.hours.ago
'
# tree should have been refreshed by write-tree
@@ -150,7 +151,7 @@ test_expect_success 'do not complain about existing broken links (commit)' '
some message
EOF
commit=$(git hash-object -t commit -w broken-commit) &&
- git gc -q 2>stderr &&
+ git gc --no-cruft -q 2>stderr &&
verbose git cat-file -e $commit &&
test_must_be_empty stderr
'
@@ -160,7 +161,7 @@ test_expect_success 'do not complain about existing broken links (tree)' '
100644 blob $(test_oid 003) foo
EOF
tree=$(git mktree --missing <broken-tree) &&
- git gc -q 2>stderr &&
+ git gc --no-cruft -q 2>stderr &&
git cat-file -e $tree &&
test_must_be_empty stderr
'
@@ -175,7 +176,7 @@ test_expect_success 'do not complain about existing broken links (tag)' '
this is a broken tag
EOF
tag=$(git hash-object -t tag -w broken-tag) &&
- git gc -q 2>stderr &&
+ git gc --no-cruft -q 2>stderr &&
git cat-file -e $tag &&
test_must_be_empty stderr
'
diff --git a/t/t6600-test-reach.sh b/t/t6600-test-reach.sh
index 338a9c46a2..b330945f49 100755
--- a/t/t6600-test-reach.sh
+++ b/t/t6600-test-reach.sh
@@ -443,4 +443,173 @@ test_expect_success 'get_reachable_subset:none' '
test_all_modes get_reachable_subset
'
+test_expect_success 'for-each-ref ahead-behind:linear' '
+ cat >input <<-\EOF &&
+ refs/heads/commit-1-1
+ refs/heads/commit-1-3
+ refs/heads/commit-1-5
+ refs/heads/commit-1-8
+ EOF
+ cat >expect <<-\EOF &&
+ refs/heads/commit-1-1 0 8
+ refs/heads/commit-1-3 0 6
+ refs/heads/commit-1-5 0 4
+ refs/heads/commit-1-8 0 1
+ EOF
+ run_all_modes git for-each-ref \
+ --format="%(refname) %(ahead-behind:commit-1-9)" --stdin
+'
+
+test_expect_success 'for-each-ref ahead-behind:all' '
+ cat >input <<-\EOF &&
+ refs/heads/commit-1-1
+ refs/heads/commit-2-4
+ refs/heads/commit-4-2
+ refs/heads/commit-4-4
+ EOF
+ cat >expect <<-\EOF &&
+ refs/heads/commit-1-1 0 24
+ refs/heads/commit-2-4 0 17
+ refs/heads/commit-4-2 0 17
+ refs/heads/commit-4-4 0 9
+ EOF
+ run_all_modes git for-each-ref \
+ --format="%(refname) %(ahead-behind:commit-5-5)" --stdin
+'
+
+test_expect_success 'for-each-ref ahead-behind:some' '
+ cat >input <<-\EOF &&
+ refs/heads/commit-1-1
+ refs/heads/commit-5-3
+ refs/heads/commit-4-8
+ refs/heads/commit-9-9
+ EOF
+ cat >expect <<-\EOF &&
+ refs/heads/commit-1-1 0 53
+ refs/heads/commit-4-8 8 30
+ refs/heads/commit-5-3 0 39
+ refs/heads/commit-9-9 27 0
+ EOF
+ run_all_modes git for-each-ref \
+ --format="%(refname) %(ahead-behind:commit-9-6)" --stdin
+'
+
+test_expect_success 'for-each-ref ahead-behind:some, multibase' '
+ cat >input <<-\EOF &&
+ refs/heads/commit-1-1
+ refs/heads/commit-5-3
+ refs/heads/commit-7-8
+ refs/heads/commit-4-8
+ refs/heads/commit-9-9
+ EOF
+ cat >expect <<-\EOF &&
+ refs/heads/commit-1-1 0 53 0 53
+ refs/heads/commit-4-8 8 30 0 22
+ refs/heads/commit-5-3 0 39 0 39
+ refs/heads/commit-7-8 14 12 8 6
+ refs/heads/commit-9-9 27 0 27 0
+ EOF
+ run_all_modes git for-each-ref \
+ --format="%(refname) %(ahead-behind:commit-9-6) %(ahead-behind:commit-6-9)" \
+ --stdin
+'
+
+test_expect_success 'for-each-ref ahead-behind:none' '
+ cat >input <<-\EOF &&
+ refs/heads/commit-7-5
+ refs/heads/commit-4-8
+ refs/heads/commit-9-9
+ EOF
+ cat >expect <<-\EOF &&
+ refs/heads/commit-4-8 16 16
+ refs/heads/commit-7-5 7 4
+ refs/heads/commit-9-9 49 0
+ EOF
+ run_all_modes git for-each-ref \
+ --format="%(refname) %(ahead-behind:commit-8-4)" --stdin
+'
+
+test_expect_success 'for-each-ref merged:linear' '
+ cat >input <<-\EOF &&
+ refs/heads/commit-1-1
+ refs/heads/commit-1-3
+ refs/heads/commit-1-5
+ refs/heads/commit-1-8
+ refs/heads/commit-2-1
+ refs/heads/commit-5-1
+ refs/heads/commit-9-1
+ EOF
+ cat >expect <<-\EOF &&
+ refs/heads/commit-1-1
+ refs/heads/commit-1-3
+ refs/heads/commit-1-5
+ refs/heads/commit-1-8
+ EOF
+ run_all_modes git for-each-ref --merged=commit-1-9 \
+ --format="%(refname)" --stdin
+'
+
+test_expect_success 'for-each-ref merged:all' '
+ cat >input <<-\EOF &&
+ refs/heads/commit-1-1
+ refs/heads/commit-2-4
+ refs/heads/commit-4-2
+ refs/heads/commit-4-4
+ EOF
+ cat >expect <<-\EOF &&
+ refs/heads/commit-1-1
+ refs/heads/commit-2-4
+ refs/heads/commit-4-2
+ refs/heads/commit-4-4
+ EOF
+ run_all_modes git for-each-ref --merged=commit-5-5 \
+ --format="%(refname)" --stdin
+'
+
+test_expect_success 'for-each-ref ahead-behind:some' '
+ cat >input <<-\EOF &&
+ refs/heads/commit-1-1
+ refs/heads/commit-5-3
+ refs/heads/commit-4-8
+ refs/heads/commit-9-9
+ EOF
+ cat >expect <<-\EOF &&
+ refs/heads/commit-1-1
+ refs/heads/commit-5-3
+ EOF
+ run_all_modes git for-each-ref --merged=commit-9-6 \
+ --format="%(refname)" --stdin
+'
+
+test_expect_success 'for-each-ref merged:some, multibase' '
+ cat >input <<-\EOF &&
+ refs/heads/commit-1-1
+ refs/heads/commit-5-3
+ refs/heads/commit-7-8
+ refs/heads/commit-4-8
+ refs/heads/commit-9-9
+ EOF
+ cat >expect <<-\EOF &&
+ refs/heads/commit-1-1
+ refs/heads/commit-4-8
+ refs/heads/commit-5-3
+ EOF
+ run_all_modes git for-each-ref \
+ --merged=commit-5-8 \
+ --merged=commit-8-5 \
+ --format="%(refname)" \
+ --stdin
+'
+
+test_expect_success 'for-each-ref merged:none' '
+ cat >input <<-\EOF &&
+ refs/heads/commit-7-5
+ refs/heads/commit-4-8
+ refs/heads/commit-9-9
+ EOF
+ >expect &&
+ run_all_modes git for-each-ref --merged=commit-8-4 \
+ --format="%(refname)" --stdin
+'
+
test_done
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index 8c37bceb33..d72cef8826 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -60,8 +60,8 @@ test_expect_success 'checking the commit' '
test_expect_success 'mv --dry-run does not move file' '
git mv -n path0/COPYING MOVED &&
- test -f path0/COPYING &&
- test ! -f MOVED
+ test_path_is_file path0/COPYING &&
+ test_path_is_missing MOVED
'
test_expect_success 'checking -k on non-existing file' '
@@ -71,25 +71,25 @@ test_expect_success 'checking -k on non-existing file' '
test_expect_success 'checking -k on untracked file' '
>untracked1 &&
git mv -k untracked1 path0 &&
- test -f untracked1 &&
- test ! -f path0/untracked1
+ test_path_is_file untracked1 &&
+ test_path_is_missing path0/untracked1
'
test_expect_success 'checking -k on multiple untracked files' '
>untracked2 &&
git mv -k untracked1 untracked2 path0 &&
- test -f untracked1 &&
- test -f untracked2 &&
- test ! -f path0/untracked1 &&
- test ! -f path0/untracked2
+ test_path_is_file untracked1 &&
+ test_path_is_file untracked2 &&
+ test_path_is_missing path0/untracked1 &&
+ test_path_is_missing path0/untracked2
'
test_expect_success 'checking -f on untracked file with existing target' '
>path0/untracked1 &&
test_must_fail git mv -f untracked1 path0 &&
- test ! -f .git/index.lock &&
- test -f untracked1 &&
- test -f path0/untracked1
+ test_path_is_missing .git/index.lock &&
+ test_path_is_file untracked1 &&
+ test_path_is_file path0/untracked1
'
# clean up the mess in case bad things happen
@@ -215,8 +215,8 @@ test_expect_success 'absolute pathname' '
git add sub/file &&
git mv sub "$(pwd)/in" &&
- ! test -d sub &&
- test -d in &&
+ test_path_is_missing sub &&
+ test_path_is_dir in &&
git ls-files --error-unmatch in/file
)
'
@@ -234,8 +234,8 @@ test_expect_success 'absolute pathname outside should fail' '
git add sub/file &&
test_must_fail git mv sub "$out/out" &&
- test -d sub &&
- ! test -d ../in &&
+ test_path_is_dir sub &&
+ test_path_is_missing ../in &&
git ls-files --error-unmatch sub/file
)
'
@@ -295,8 +295,8 @@ test_expect_success 'git mv should overwrite symlink to a file' '
git add moved &&
test_must_fail git mv moved symlink &&
git mv -f moved symlink &&
- ! test -e moved &&
- test -f symlink &&
+ test_path_is_missing moved &&
+ test_path_is_file symlink &&
test "$(cat symlink)" = 1 &&
git update-index --refresh &&
git diff-files --quiet
@@ -312,13 +312,13 @@ test_expect_success 'git mv should overwrite file with a symlink' '
git add moved &&
test_must_fail git mv symlink moved &&
git mv -f symlink moved &&
- ! test -e symlink &&
+ test_path_is_missing symlink &&
git update-index --refresh &&
git diff-files --quiet
'
test_expect_success SYMLINKS 'check moved symlink' '
- test -h moved
+ test_path_is_symlink moved
'
rm -f moved symlink
@@ -352,7 +352,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
) &&
mkdir mod &&
git mv sub mod/sub &&
- ! test -e sub &&
+ test_path_is_missing sub &&
test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
git -C mod/sub status &&
git update-index --refresh &&
@@ -372,7 +372,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
) &&
mkdir mod &&
git mv sub mod/sub &&
- ! test -e sub &&
+ test_path_is_missing sub &&
test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
git -C mod/sub status &&
echo mod/sub >expected &&
@@ -389,7 +389,7 @@ test_expect_success 'git mv moves a submodule with gitfile' '
entry="$(git ls-files --stage sub | cut -f 1)" &&
mkdir mod &&
git -C mod mv ../sub/ . &&
- ! test -e sub &&
+ test_path_is_missing sub &&
test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
git -C mod/sub status &&
echo mod/sub >expected &&
@@ -408,7 +408,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
mkdir mod &&
git mv sub mod/sub 2>actual.err &&
test_must_be_empty actual.err &&
- ! test -e sub &&
+ test_path_is_missing sub &&
test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
git -C mod/sub status &&
git update-index --refresh &&
@@ -423,13 +423,13 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
entry="$(git ls-files --stage sub | cut -f 1)" &&
mkdir mod &&
test_must_fail git mv sub mod/sub 2>actual.err &&
- test -s actual.err &&
- test -e sub &&
+ test_file_not_empty actual.err &&
+ test_path_exists sub &&
git diff-files --quiet -- sub &&
git add .gitmodules &&
git mv sub mod/sub 2>actual.err &&
test_must_be_empty actual.err &&
- ! test -e sub &&
+ test_path_is_missing sub &&
test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
git -C mod/sub status &&
git update-index --refresh &&
@@ -447,7 +447,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
mkdir mod &&
git mv sub mod/sub 2>actual.err &&
test_cmp expect.err actual.err &&
- ! test -e sub &&
+ test_path_is_missing sub &&
test "$entry" = "$(git ls-files --stage mod/sub | cut -f 1)" &&
git -C mod/sub status &&
git update-index --refresh &&
@@ -460,7 +460,7 @@ test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '
git submodule update &&
mkdir mod &&
git mv -n sub mod/sub 2>actual.err &&
- test -f sub/.git &&
+ test_path_is_file sub/.git &&
git diff-index --exit-code HEAD &&
git update-index --refresh &&
git diff-files --quiet -- sub .gitmodules
@@ -474,10 +474,10 @@ test_expect_success 'checking out a commit before submodule moved needs manual u
git status -s sub2 >actual &&
echo "?? sub2/" >expected &&
test_cmp expected actual &&
- ! test -f sub/.git &&
- test -f sub2/.git &&
+ test_path_is_missing sub/.git &&
+ test_path_is_file sub2/.git &&
git submodule update &&
- test -f sub/.git &&
+ test_path_is_file sub/.git &&
rm -rf sub2 &&
git diff-index --exit-code HEAD &&
git update-index --refresh &&
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index e18a218952..f6aebe92ff 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -49,7 +49,7 @@ test_expect_success 'result is really identical' '
test_expect_success 'rewrite bare repository identically' '
(git config core.bare true && cd .git &&
git filter-branch branch > filter-output 2>&1 &&
- ! fgrep fatal filter-output)
+ ! grep fatal filter-output)
'
git config core.bare false
test_expect_success 'result is really identical' '
@@ -506,7 +506,7 @@ test_expect_success 'rewrite repository including refs that point at non-commit
git tag -a -m "tag to a tree" treetag $new_tree &&
git reset --hard HEAD &&
git filter-branch -f -- --all >filter-output 2>&1 &&
- ! fgrep fatal filter-output
+ ! grep fatal filter-output
'
test_expect_success 'filter-branch handles ref deletion' '
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 9aa1660651..0fe6ba93a2 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -792,6 +792,34 @@ test_expect_success 'annotations for blobs are empty' '
test_cmp expect actual
'
+# Run this before doing any signing, so the test has the same results
+# regardless of the GPG prereq.
+test_expect_success 'git tag --format with ahead-behind' '
+ test_when_finished git reset --hard tag-one-line &&
+ git commit --allow-empty -m "left" &&
+ git tag -a -m left tag-left &&
+ git reset --hard HEAD~1 &&
+ git commit --allow-empty -m "right" &&
+ git tag -a -m left tag-right &&
+
+ # Use " !" at the end to demonstrate whitespace
+ # around empty ahead-behind token for tag-blob.
+ cat >expect <<-EOF &&
+ refs/tags/tag-blob !
+ refs/tags/tag-left 1 1 !
+ refs/tags/tag-lines 0 1 !
+ refs/tags/tag-one-line 0 1 !
+ refs/tags/tag-right 0 0 !
+ refs/tags/tag-zero-lines 0 1 !
+ EOF
+ git tag -l --format="%(refname) %(ahead-behind:HEAD) !" >actual 2>err &&
+ grep "refs/tags/tag" actual >actual.focus &&
+ test_cmp expect actual.focus &&
+
+ # Error reported for tags that point to non-commits.
+ grep "error: object [0-9a-f]* is a blob, not a commit" err
+'
+
# trying to verify annotated non-signed tags:
test_expect_success GPG \
@@ -1843,6 +1871,23 @@ test_expect_success 'invalid sort parameter in configuratoin' '
test_must_fail git tag -l "foo*"
'
+test_expect_success 'version sort handles empty value for versionsort.{prereleaseSuffix,suffix}' '
+ cp .git/config .git/config.orig &&
+ test_when_finished mv .git/config.orig .git/config &&
+
+ cat >>.git/config <<-\EOF &&
+ [versionsort]
+ prereleaseSuffix
+ suffix
+ EOF
+ cat >expect <<-\EOF &&
+ error: missing value for '\''versionsort.suffix'\''
+ error: missing value for '\''versionsort.prereleasesuffix'\''
+ EOF
+ git tag -l --sort=version:refname 2>actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'version sort with prerelease reordering' '
test_config versionsort.prereleaseSuffix -rc &&
git tag foo1.6-rc1 &&
@@ -2001,6 +2046,22 @@ test_expect_success '--format should list tags as per format given' '
test_cmp expect actual
'
+test_expect_success '--format --omit-empty works' '
+ cat >expect <<-\EOF &&
+ refname : refs/tags/v1.0
+
+ refname : refs/tags/v1.1.3
+ EOF
+ git tag -l --format="%(if:notequals=refs/tags/v1.0.1)%(refname)%(then)refname : %(refname)%(end)" "v1*" >actual &&
+ test_cmp expect actual &&
+ cat >expect <<-\EOF &&
+ refname : refs/tags/v1.0
+ refname : refs/tags/v1.1.3
+ EOF
+ git tag -l --omit-empty --format="%(if:notequals=refs/tags/v1.0.1)%(refname)%(then)refname : %(refname)%(end)" "v1*" >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'git tag -l with --format="%(rest)" must fail' '
test_must_fail git tag -l --format="%(rest)" "v1*"
'
diff --git a/t/t7030-verify-tag.sh b/t/t7030-verify-tag.sh
index 10faa64515..6f526c37c2 100755
--- a/t/t7030-verify-tag.sh
+++ b/t/t7030-verify-tag.sh
@@ -115,7 +115,7 @@ test_expect_success GPGSM 'verify and show signatures x509 with high minTrustLev
test_expect_success GPG 'detect fudged signature' '
git cat-file tag seventh-signed >raw &&
- sed -e "/^tag / s/seventh/7th forged/" raw >forged1 &&
+ sed -e "/^tag / s/seventh/7th-forged/" raw >forged1 &&
git hash-object -w -t tag forged1 >forged1.tag &&
test_must_fail git verify-tag $(cat forged1.tag) 2>actual1 &&
grep "BAD signature from" actual1 &&
diff --git a/t/t7031-verify-tag-signed-ssh.sh b/t/t7031-verify-tag-signed-ssh.sh
index 1cb36b9ab8..20913b3713 100755
--- a/t/t7031-verify-tag-signed-ssh.sh
+++ b/t/t7031-verify-tag-signed-ssh.sh
@@ -125,7 +125,7 @@ test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'verify-tag failes with tag date ou
test_expect_success GPGSSH 'detect fudged ssh signature' '
test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
git cat-file tag seventh-signed >raw &&
- sed -e "/^tag / s/seventh/7th forged/" raw >forged1 &&
+ sed -e "/^tag / s/seventh/7th-forged/" raw >forged1 &&
git hash-object -w -t tag forged1 >forged1.tag &&
test_must_fail git verify-tag $(cat forged1.tag) 2>actual1 &&
grep "${GPGSSH_BAD_SIGNATURE}" actual1 &&
@@ -200,4 +200,14 @@ test_expect_success GPGSSH 'verifying a forged tag with --format should fail sil
test_must_be_empty actual-forged
'
+test_expect_success GPGSSH 'rev-list --format=%G' '
+ test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
+ git rev-list -1 --format="%G? %H" sixth-signed >actual &&
+ cat >expect <<-EOF &&
+ commit $(git rev-parse sixth-signed^0)
+ G $(git rev-parse sixth-signed^0)
+ EOF
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t7103-reset-bare.sh b/t/t7103-reset-bare.sh
index a60153f9f3..18bbd9975e 100755
--- a/t/t7103-reset-bare.sh
+++ b/t/t7103-reset-bare.sh
@@ -63,7 +63,7 @@ test_expect_success '"mixed" reset is not allowed in bare' '
test_must_fail git reset --mixed HEAD^
'
-test_expect_success !SANITIZE_LEAK '"soft" reset is allowed in bare' '
+test_expect_success '"soft" reset is allowed in bare' '
git reset --soft HEAD^ &&
git show --pretty=format:%s >out &&
echo one >expect &&
diff --git a/t/t7105-reset-patch.sh b/t/t7105-reset-patch.sh
index fc2a6cf5c7..9b46da7aaa 100755
--- a/t/t7105-reset-patch.sh
+++ b/t/t7105-reset-patch.sh
@@ -1,6 +1,8 @@
#!/bin/sh
test_description='git reset --patch'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./lib-patch-mode.sh
test_expect_success PERL 'setup' '
diff --git a/t/t7106-reset-unborn-branch.sh b/t/t7106-reset-unborn-branch.sh
index ecb85c3b82..a0b67a0b84 100755
--- a/t/t7106-reset-unborn-branch.sh
+++ b/t/t7106-reset-unborn-branch.sh
@@ -1,6 +1,8 @@
#!/bin/sh
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 523efbecde..af5ea406db 100755
--- a/t/t7107-reset-pathspec-file.sh
+++ b/t/t7107-reset-pathspec-file.sh
@@ -2,6 +2,7 @@
test_description='reset --pathspec-from-file'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_tick
diff --git a/t/t7301-clean-interactive.sh b/t/t7301-clean-interactive.sh
index a07e8b86de..d82a3210a1 100755
--- a/t/t7301-clean-interactive.sh
+++ b/t/t7301-clean-interactive.sh
@@ -2,6 +2,7 @@
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 a989aafaf5..eae6a46ef3 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -579,6 +579,16 @@ test_expect_success 'status should be "modified" after submodule commit' '
grep "^+$rev2" list
'
+test_expect_success '"submodule --cached" command forms should be identical' '
+ git submodule status --cached >expect &&
+
+ git submodule --cached >actual &&
+ test_cmp expect actual &&
+
+ git submodule --cached status >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'the --cached sha1 should be rev1' '
git submodule --cached status >list &&
grep "^+$rev1" list
diff --git a/t/t7402-submodule-rebase.sh b/t/t7402-submodule-rebase.sh
index ebeca12a71..2b3c363078 100755
--- a/t/t7402-submodule-rebase.sh
+++ b/t/t7402-submodule-rebase.sh
@@ -5,6 +5,7 @@
test_description='Test rebasing, stashing, etc. with submodules'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
@@ -55,12 +56,15 @@ chmod a+x fake-editor.sh
test_expect_success 'interactive rebase with a dirty submodule' '
- test submodule = $(git diff --name-only) &&
+ echo submodule >expect &&
+ git diff --name-only >actual &&
+ test_cmp expect actual &&
HEAD=$(git rev-parse HEAD) &&
GIT_EDITOR="\"$(pwd)/fake-editor.sh\"" EDITOR_TEXT="pick $HEAD" \
git rebase -i HEAD^ &&
- test submodule = $(git diff --name-only)
-
+ echo submodule >expect &&
+ git diff --name-only >actual &&
+ test_cmp expect actual
'
test_expect_success 'rebase with dirty file and submodule fails' '
@@ -82,11 +86,19 @@ test_expect_success 'stash with a dirty submodule' '
CURRENT=$(cd submodule && git rev-parse HEAD) &&
git stash &&
test new != $(cat file) &&
- test submodule = $(git diff --name-only) &&
- test $CURRENT = $(cd submodule && git rev-parse HEAD) &&
+ echo submodule >expect &&
+ git diff --name-only >actual &&
+ test_cmp expect actual &&
+
+ echo "$CURRENT" >expect &&
+ git -C submodule rev-parse HEAD >actual &&
+ test_cmp expect actual &&
+
git stash apply &&
test new = $(cat file) &&
- test $CURRENT = $(cd submodule && git rev-parse HEAD)
+ echo "$CURRENT" >expect &&
+ git -C submodule rev-parse HEAD >actual &&
+ test_cmp expect actual
'
diff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh
index ea92ef52a5..ff09443a0a 100755
--- a/t/t7403-submodule-sync.sh
+++ b/t/t7403-submodule-sync.sh
@@ -11,6 +11,7 @@ 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/t7407-submodule-foreach.sh b/t/t7407-submodule-foreach.sh
index 59bd150166..8d7b234beb 100755
--- a/t/t7407-submodule-foreach.sh
+++ b/t/t7407-submodule-foreach.sh
@@ -154,6 +154,11 @@ test_expect_success 'use "submodule foreach" to checkout 2nd level submodule' '
)
'
+test_expect_success 'usage: foreach -- --not-an-option' '
+ test_expect_code 1 git submodule foreach -- --not-an-option &&
+ test_expect_code 1 git -C clone2 submodule foreach -- --not-an-option
+'
+
test_expect_success 'use "foreach --recursive" to checkout all submodules' '
(
cd clone2 &&
diff --git a/t/t7409-submodule-detached-work-tree.sh b/t/t7409-submodule-detached-work-tree.sh
index 374ed481e9..574a6fc526 100755
--- a/t/t7409-submodule-detached-work-tree.sh
+++ b/t/t7409-submodule-detached-work-tree.sh
@@ -13,6 +13,7 @@ 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 c583c4e373..c0167944ab 100755
--- a/t/t7411-submodule-config.sh
+++ b/t/t7411-submodule-config.sh
@@ -137,44 +137,44 @@ test_expect_success 'error in history in fetchrecursesubmodule lets continue' '
)
'
-test_expect_success 'reading submodules config from the working tree with "submodule--helper config"' '
+test_expect_success 'reading submodules config from the working tree' '
(cd super &&
echo "../submodule" >expect &&
- git submodule--helper config submodule.submodule.url >actual &&
+ test-tool submodule config-list submodule.submodule.url >actual &&
test_cmp expect actual
)
'
-test_expect_success 'unsetting submodules config from the working tree with "submodule--helper config --unset"' '
+test_expect_success 'unsetting submodules config from the working tree' '
(cd super &&
- git submodule--helper config --unset submodule.submodule.url &&
- git submodule--helper config submodule.submodule.url >actual &&
+ test-tool submodule config-unset submodule.submodule.url &&
+ test-tool submodule config-list submodule.submodule.url >actual &&
test_must_be_empty actual
)
'
-test_expect_success 'writing submodules config with "submodule--helper config"' '
+test_expect_success 'writing submodules config' '
(cd super &&
echo "new_url" >expect &&
- git submodule--helper config submodule.submodule.url "new_url" &&
- git submodule--helper config submodule.submodule.url >actual &&
+ test-tool submodule config-set submodule.submodule.url "new_url" &&
+ test-tool submodule config-list submodule.submodule.url >actual &&
test_cmp expect actual
)
'
-test_expect_success 'overwriting unstaged submodules config with "submodule--helper config"' '
+test_expect_success 'overwriting unstaged submodules config' '
test_when_finished "git -C super checkout .gitmodules" &&
(cd super &&
echo "newer_url" >expect &&
- git submodule--helper config submodule.submodule.url "newer_url" &&
- git submodule--helper config submodule.submodule.url >actual &&
+ test-tool submodule config-set submodule.submodule.url "newer_url" &&
+ test-tool submodule config-list submodule.submodule.url >actual &&
test_cmp expect actual
)
'
test_expect_success 'writeable .gitmodules when it is in the working tree' '
- git -C super submodule--helper config --check-writeable
+ test-tool -C super submodule config-writeable
'
test_expect_success 'writeable .gitmodules when it is nowhere in the repository' '
@@ -183,7 +183,7 @@ test_expect_success 'writeable .gitmodules when it is nowhere in the repository'
(cd super &&
git rm .gitmodules &&
git commit -m "remove .gitmodules from the current branch" &&
- git submodule--helper config --check-writeable
+ test-tool submodule config-writeable
)
'
@@ -191,7 +191,7 @@ test_expect_success 'non-writeable .gitmodules when it is in the index but not i
test_when_finished "git -C super checkout .gitmodules" &&
(cd super &&
rm -f .gitmodules &&
- test_must_fail git submodule--helper config --check-writeable
+ test_must_fail test-tool submodule config-writeable
)
'
@@ -200,7 +200,7 @@ test_expect_success 'non-writeable .gitmodules when it is in the current branch
test_when_finished "git -C super reset --hard $ORIG" &&
(cd super &&
git rm .gitmodules &&
- test_must_fail git submodule--helper config --check-writeable
+ test_must_fail test-tool submodule config-writeable
)
'
@@ -208,11 +208,11 @@ test_expect_success 'reading submodules config from the index when .gitmodules i
ORIG=$(git -C super rev-parse HEAD) &&
test_when_finished "git -C super reset --hard $ORIG" &&
(cd super &&
- git submodule--helper config submodule.submodule.url "staged_url" &&
+ test-tool submodule config-set submodule.submodule.url "staged_url" &&
git add .gitmodules &&
rm -f .gitmodules &&
echo "staged_url" >expect &&
- git submodule--helper config submodule.submodule.url >actual &&
+ test-tool submodule config-list submodule.submodule.url >actual &&
test_cmp expect actual
)
'
@@ -223,7 +223,7 @@ test_expect_success 'reading submodules config from the current branch when .git
(cd super &&
git rm .gitmodules &&
echo "../submodule" >expect &&
- git submodule--helper config submodule.submodule.url >actual &&
+ test-tool submodule config-list submodule.submodule.url >actual &&
test_cmp expect actual
)
'
diff --git a/t/t7412-submodule-absorbgitdirs.sh b/t/t7412-submodule-absorbgitdirs.sh
index 2859695c6d..f778321857 100755
--- a/t/t7412-submodule-absorbgitdirs.sh
+++ b/t/t7412-submodule-absorbgitdirs.sh
@@ -10,6 +10,7 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup a real submodule' '
+ cwd="$(pwd)" &&
git init sub1 &&
test_commit -C sub1 first &&
git submodule add ./sub1 &&
@@ -18,13 +19,21 @@ test_expect_success 'setup a real submodule' '
'
test_expect_success 'absorb the git dir' '
+ >expect &&
+ >actual &&
>expect.1 &&
>expect.2 &&
>actual.1 &&
>actual.2 &&
git status >expect.1 &&
git -C sub1 rev-parse HEAD >expect.2 &&
- git submodule absorbgitdirs &&
+ cat >expect <<-EOF &&
+ Migrating git directory of '\''sub1'\'' from
+ '\''$cwd/sub1/.git'\'' to
+ '\''$cwd/.git/modules/sub1'\''
+ EOF
+ git submodule absorbgitdirs 2>actual &&
+ test_cmp expect actual &&
git fsck &&
test -f sub1/.git &&
test -d .git/modules/sub1 &&
@@ -37,7 +46,8 @@ test_expect_success 'absorb the git dir' '
test_expect_success 'absorbing does not fail for deinitialized submodules' '
test_when_finished "git submodule update --init" &&
git submodule deinit --all &&
- git submodule absorbgitdirs &&
+ git submodule absorbgitdirs 2>err &&
+ test_must_be_empty err &&
test -d .git/modules/sub1 &&
test -d sub1 &&
! test -e sub1/.git
@@ -56,7 +66,13 @@ test_expect_success 'setup nested submodule' '
test_expect_success 'absorb the git dir in a nested submodule' '
git status >expect.1 &&
git -C sub1/nested rev-parse HEAD >expect.2 &&
- git submodule absorbgitdirs &&
+ cat >expect <<-EOF &&
+ Migrating git directory of '\''sub1/nested'\'' from
+ '\''$cwd/sub1/nested/.git'\'' to
+ '\''$cwd/.git/modules/sub1/modules/nested'\''
+ EOF
+ git submodule absorbgitdirs 2>actual &&
+ test_cmp expect actual &&
test -f sub1/nested/.git &&
test -d .git/modules/sub1/modules/nested &&
git status >actual.1 &&
@@ -87,7 +103,13 @@ test_expect_success 're-setup nested submodule' '
test_expect_success 'absorb the git dir in a nested submodule' '
git status >expect.1 &&
git -C sub1/nested rev-parse HEAD >expect.2 &&
- git submodule absorbgitdirs &&
+ cat >expect <<-EOF &&
+ Migrating git directory of '\''sub1'\'' from
+ '\''$cwd/sub1/.git'\'' to
+ '\''$cwd/.git/modules/sub1'\''
+ EOF
+ git submodule absorbgitdirs 2>actual &&
+ test_cmp expect actual &&
test -f sub1/.git &&
test -f sub1/nested/.git &&
test -d .git/modules/sub1/modules/nested &&
@@ -97,6 +119,27 @@ test_expect_success 'absorb the git dir in a nested submodule' '
test_cmp expect.2 actual.2
'
+test_expect_success 'absorb the git dir outside of primary worktree' '
+ test_when_finished "rm -rf repo-bare.git" &&
+ git clone --bare . repo-bare.git &&
+ test_when_finished "rm -rf repo-wt" &&
+ git -C repo-bare.git worktree add ../repo-wt &&
+
+ test_when_finished "rm -f .gitconfig" &&
+ test_config_global protocol.file.allow always &&
+ git -C repo-wt submodule update --init &&
+ git init repo-wt/sub2 &&
+ test_commit -C repo-wt/sub2 A &&
+ git -C repo-wt submodule add ./sub2 sub2 &&
+ cat >expect <<-EOF &&
+ Migrating git directory of '\''sub2'\'' from
+ '\''$cwd/repo-wt/sub2/.git'\'' to
+ '\''$cwd/repo-bare.git/worktrees/repo-wt/modules/sub2'\''
+ EOF
+ git -C repo-wt submodule absorbgitdirs 2>actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'setup a gitlink with missing .gitmodules entry' '
git init sub2 &&
test_commit -C sub2 first &&
@@ -107,7 +150,11 @@ test_expect_success 'setup a gitlink with missing .gitmodules entry' '
test_expect_success 'absorbing the git dir fails for incomplete submodules' '
git status >expect.1 &&
git -C sub2 rev-parse HEAD >expect.2 &&
- test_must_fail git submodule absorbgitdirs &&
+ cat >expect <<-\EOF &&
+ fatal: could not lookup name for submodule '\''sub2'\''
+ EOF
+ test_must_fail git submodule absorbgitdirs 2>actual &&
+ test_cmp expect actual &&
git -C sub2 fsck &&
test -d sub2/.git &&
git status >actual &&
@@ -127,8 +174,11 @@ test_expect_success 'setup a submodule with multiple worktrees' '
'
test_expect_success 'absorbing fails for a submodule with multiple worktrees' '
- test_must_fail git submodule absorbgitdirs sub3 2>error &&
- test_i18ngrep "not supported" error
+ cat >expect <<-\EOF &&
+ fatal: could not lookup name for submodule '\''sub2'\''
+ EOF
+ test_must_fail git submodule absorbgitdirs 2>actual &&
+ test_cmp expect actual
'
test_done
diff --git a/t/t7413-submodule-is-active.sh b/t/t7413-submodule-is-active.sh
index 7cdc263764..887d181b72 100755
--- a/t/t7413-submodule-is-active.sh
+++ b/t/t7413-submodule-is-active.sh
@@ -51,6 +51,22 @@ test_expect_success 'is-active works with submodule.<name>.active config' '
test-tool -C super submodule is-active sub1
'
+test_expect_success 'is-active handles submodule.active config missing a value' '
+ cp super/.git/config super/.git/config.orig &&
+ test_when_finished mv super/.git/config.orig super/.git/config &&
+
+ cat >>super/.git/config <<-\EOF &&
+ [submodule]
+ active
+ EOF
+
+ cat >expect <<-\EOF &&
+ error: missing value for '\''submodule.active'\''
+ EOF
+ test-tool -C super submodule is-active sub1 2>actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'is-active works with basic submodule.active config' '
test_when_finished "git -C super config submodule.sub1.URL ../sub" &&
test_when_finished "git -C super config --unset-all submodule.active" &&
diff --git a/t/t7416-submodule-dash-url.sh b/t/t7416-submodule-dash-url.sh
index 3ebd985981..7cf72b9a07 100755
--- a/t/t7416-submodule-dash-url.sh
+++ b/t/t7416-submodule-dash-url.sh
@@ -1,6 +1,8 @@
#!/bin/sh
test_description='check handling of disallowed .gitmodule urls'
+
+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 d5874200fd..dde11ecce8 100755
--- a/t/t7418-submodule-sparse-gitmodules.sh
+++ b/t/t7418-submodule-sparse-gitmodules.sh
@@ -50,12 +50,12 @@ test_expect_success 'sparse checkout setup which hides .gitmodules' '
test_expect_success 'reading gitmodules config file when it is not checked out' '
echo "../submodule" >expect &&
- git -C super submodule--helper config submodule.submodule.url >actual &&
+ test-tool -C super submodule config-list submodule.submodule.url >actual &&
test_cmp expect actual
'
test_expect_success 'not writing gitmodules config file when it is not checked out' '
- test_must_fail git -C super submodule--helper config submodule.submodule.url newurl &&
+ test_must_fail test-tool -C super submodule config-set submodule.submodule.url newurl &&
test_path_is_missing super/.gitmodules
'
diff --git a/t/t7422-submodule-output.sh b/t/t7422-submodule-output.sh
new file mode 100755
index 0000000000..ab946ec940
--- /dev/null
+++ b/t/t7422-submodule-output.sh
@@ -0,0 +1,170 @@
+#!/bin/sh
+
+test_description='submodule --cached, --quiet etc. output'
+
+TEST_PASSES_SANITIZE_LEAK=true
+. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-t3100.sh
+
+setup_sub () {
+ local d="$1" &&
+ shift &&
+ git $@ clone . "$d" &&
+ git $@ submodule add ./"$d"
+}
+
+normalize_status () {
+ sed -e 's/-g[0-9a-f]*/-gHASH/'
+}
+
+test_expect_success 'setup' '
+ test_commit A &&
+ test_commit B &&
+ setup_sub S &&
+ setup_sub S.D &&
+ setup_sub S.C &&
+ setup_sub S.C.D &&
+ setup_sub X &&
+ git add S* &&
+ test_commit C &&
+
+ # recursive in X/
+ git -C X pull &&
+ GIT_ALLOW_PROTOCOL=file git -C X submodule update --init &&
+
+ # dirty
+ for d in S.D X/S.D
+ do
+ echo dirty >"$d"/A.t || return 1
+ done &&
+
+ # commit (for --cached)
+ for d in S.C* X/S.C*
+ do
+ git -C "$d" reset --hard A || return 1
+ done &&
+
+ # dirty
+ for d in S*.D X/S*.D
+ do
+ echo dirty >"$d/C2.t" || return 1
+ done &&
+
+ for ref in A B C
+ do
+ # Not different with SHA-1 and SHA-256, just (ab)using
+ # test_oid_cache as a variable bag to avoid using
+ # $(git rev-parse ...).
+ oid=$(git rev-parse $ref) &&
+ test_oid_cache <<-EOF || return 1
+ $ref sha1:$oid
+ $ref sha256:$oid
+ EOF
+ done
+'
+
+for opts in "" "status"
+do
+ test_expect_success "git submodule $opts" '
+ sed -e "s/^>//" >expect <<-EOF &&
+ > $(test_oid B) S (B)
+ >+$(test_oid A) S.C (A)
+ >+$(test_oid A) S.C.D (A)
+ > $(test_oid B) S.D (B)
+ >+$(test_oid C) X (C)
+ EOF
+ git submodule $opts >actual.raw &&
+ normalize_status <actual.raw >actual &&
+ test_cmp expect actual
+ '
+done
+
+for opts in \
+ "status --recursive"
+do
+ test_expect_success "git submodule $opts" '
+ sed -e "s/^>//" >expect <<-EOF &&
+ > $(test_oid B) S (B)
+ >+$(test_oid A) S.C (A)
+ >+$(test_oid A) S.C.D (A)
+ > $(test_oid B) S.D (B)
+ >+$(test_oid C) X (C)
+ > $(test_oid B) X/S (B)
+ >+$(test_oid A) X/S.C (A)
+ >+$(test_oid A) X/S.C.D (A)
+ > $(test_oid B) X/S.D (B)
+ > $(test_oid B) X/X (B)
+ EOF
+ git submodule $opts >actual.raw &&
+ normalize_status <actual.raw >actual &&
+ test_cmp expect actual
+ '
+done
+
+for opts in \
+ "--quiet" \
+ "--quiet status" \
+ "status --quiet"
+do
+ test_expect_success "git submodule $opts" '
+ git submodule $opts >out &&
+ test_must_be_empty out
+ '
+done
+
+for opts in \
+ "--cached" \
+ "--cached status" \
+ "status --cached"
+do
+ test_expect_success "git submodule $opts" '
+ sed -e "s/^>//" >expect <<-EOF &&
+ > $(test_oid B) S (B)
+ >+$(test_oid B) S.C (B)
+ >+$(test_oid B) S.C.D (B)
+ > $(test_oid B) S.D (B)
+ >+$(test_oid B) X (B)
+ EOF
+ git submodule $opts >actual.raw &&
+ normalize_status <actual.raw >actual &&
+ test_cmp expect actual
+ '
+done
+
+for opts in \
+ "--cached --quiet" \
+ "--cached --quiet status" \
+ "--cached status --quiet" \
+ "--quiet status --cached" \
+ "status --cached --quiet"
+do
+ test_expect_success "git submodule $opts" '
+ git submodule $opts >out &&
+ test_must_be_empty out
+ '
+done
+
+for opts in \
+ "status --cached --recursive" \
+ "--cached status --recursive"
+do
+ test_expect_success "git submodule $opts" '
+ sed -e "s/^>//" >expect <<-EOF &&
+ > $(test_oid B) S (B)
+ >+$(test_oid B) S.C (B)
+ >+$(test_oid B) S.C.D (B)
+ > $(test_oid B) S.D (B)
+ >+$(test_oid B) X (B)
+ > $(test_oid B) X/S (B)
+ >+$(test_oid B) X/S.C (B)
+ >+$(test_oid B) X/S.C.D (B)
+ > $(test_oid B) X/S.D (B)
+ > $(test_oid B) X/X (B)
+ EOF
+ git submodule $opts >actual.raw &&
+ normalize_status <actual.raw >actual &&
+ test_cmp expect actual
+ '
+done
+
+test_done
diff --git a/t/t7450-bad-git-dotfiles.sh b/t/t7450-bad-git-dotfiles.sh
index ba1f569bcb..0d0c3f2c68 100755
--- a/t/t7450-bad-git-dotfiles.sh
+++ b/t/t7450-bad-git-dotfiles.sh
@@ -12,6 +12,8 @@ Such as:
- symlinked .gitmodules, etc
'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-pack.sh
diff --git a/t/t7504-commit-msg-hook.sh b/t/t7504-commit-msg-hook.sh
index a39de8c112..d1255228d5 100755
--- a/t/t7504-commit-msg-hook.sh
+++ b/t/t7504-commit-msg-hook.sh
@@ -5,6 +5,7 @@ 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' '
@@ -101,7 +102,9 @@ test_expect_success 'setup: commit-msg hook that always fails' '
'
commit_msg_is () {
- test "$(git log --pretty=format:%s%b -1)" = "$1"
+ printf "%s" "$1" >expect &&
+ git log --pretty=format:%s%b -1 >actual &&
+ test_cmp expect actual
}
test_expect_success 'with failing hook' '
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index 2b7ef6c41a..aed07c5b62 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -1676,4 +1676,74 @@ test_expect_success 'racy timestamps will be fixed for dirty worktree' '
! test_is_magic_mtime .git/index
'
+test_expect_success 'setup slow status advice' '
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main git init slowstatus &&
+ (
+ cd slowstatus &&
+ cat >.gitignore <<-\EOF &&
+ /actual
+ /expected
+ /out
+ EOF
+ git add .gitignore &&
+ git commit -m "Add .gitignore" &&
+ git config advice.statusuoption true
+ )
+'
+
+test_expect_success 'slow status advice when core.untrackedCache and fsmonitor are unset' '
+ (
+ cd slowstatus &&
+ git config core.untrackedCache false &&
+ git config core.fsmonitor false &&
+ GIT_TEST_UF_DELAY_WARNING=1 git status >actual &&
+ cat >expected <<-\EOF &&
+ On branch main
+
+ It took 3.25 seconds to enumerate untracked files.
+ See '\''git help status'\'' for information on how to improve this.
+
+ nothing to commit, working tree clean
+ EOF
+ test_cmp expected actual
+ )
+'
+
+test_expect_success 'slow status advice when core.untrackedCache true, but not fsmonitor' '
+ (
+ cd slowstatus &&
+ git config core.untrackedCache true &&
+ git config core.fsmonitor false &&
+ GIT_TEST_UF_DELAY_WARNING=1 git status >actual &&
+ cat >expected <<-\EOF &&
+ On branch main
+
+ It took 3.25 seconds to enumerate untracked files.
+ See '\''git help status'\'' for information on how to improve this.
+
+ nothing to commit, working tree clean
+ EOF
+ test_cmp expected actual
+ )
+'
+
+test_expect_success 'slow status advice when core.untrackedCache true, and fsmonitor' '
+ (
+ cd slowstatus &&
+ git config core.untrackedCache true &&
+ git config core.fsmonitor true &&
+ GIT_TEST_UF_DELAY_WARNING=1 git status >actual &&
+ cat >expected <<-\EOF &&
+ On branch main
+
+ It took 3.25 seconds to enumerate untracked files,
+ but the results were cached, and subsequent runs may be faster.
+ See '\''git help status'\'' for information on how to improve this.
+
+ nothing to commit, working tree clean
+ EOF
+ test_cmp expected actual
+ )
+'
+
test_done
diff --git a/t/t7509-commit-authorship.sh b/t/t7509-commit-authorship.sh
index 21c668f75e..5d890949f7 100755
--- a/t/t7509-commit-authorship.sh
+++ b/t/t7509-commit-authorship.sh
@@ -105,7 +105,7 @@ test_expect_success '--amend option with empty author' '
test_expect_success '--amend option with missing author' '
git cat-file commit Initial >tmp &&
sed "s/author [^<]* </author </" tmp >malformed &&
- sha=$(git hash-object -t commit -w malformed) &&
+ sha=$(git hash-object --literally -t commit -w malformed) &&
test_when_finished "remove_object $sha" &&
git checkout $sha &&
test_when_finished "git checkout Initial" &&
diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh
index 8593b7e3cb..ccbc416402 100755
--- a/t/t7510-signed-commit.sh
+++ b/t/t7510-signed-commit.sh
@@ -202,7 +202,7 @@ test_expect_success GPG 'detect fudged signature with NUL' '
git cat-file commit seventh-signed >raw &&
cat raw >forged2 &&
echo Qwik | tr "Q" "\000" >>forged2 &&
- git hash-object -w -t commit forged2 >forged2.commit &&
+ git hash-object --literally -w -t commit forged2 >forged2.commit &&
test_must_fail git verify-commit $(cat forged2.commit) &&
git show --pretty=short --show-signature $(cat forged2.commit) >actual2 &&
grep "BAD signature from" actual2 &&
@@ -221,84 +221,91 @@ test_expect_success GPG 'amending already signed commit' '
test_expect_success GPG 'show good signature with custom format' '
cat >expect <<-\EOF &&
G
+ ultimate
13B6F51ECDDE430D
C O Mitter <committer@example.com>
73D758744BE721698EC54E8713B6F51ECDDE430D
73D758744BE721698EC54E8713B6F51ECDDE430D
EOF
- git log -1 --format="%G?%n%GK%n%GS%n%GF%n%GP" sixth-signed >actual &&
+ git log -1 --format="%G?%n%GT%n%GK%n%GS%n%GF%n%GP" sixth-signed >actual &&
test_cmp expect actual
'
test_expect_success GPG 'show bad signature with custom format' '
cat >expect <<-\EOF &&
B
+ undefined
13B6F51ECDDE430D
C O Mitter <committer@example.com>
EOF
- git log -1 --format="%G?%n%GK%n%GS%n%GF%n%GP" $(cat forged1.commit) >actual &&
+ git log -1 --format="%G?%n%GT%n%GK%n%GS%n%GF%n%GP" $(cat forged1.commit) >actual &&
test_cmp expect actual
'
test_expect_success GPG 'show untrusted signature with custom format' '
cat >expect <<-\EOF &&
U
+ undefined
65A0EEA02E30CAD7
Eris Discordia <discord@example.net>
F8364A59E07FFE9F4D63005A65A0EEA02E30CAD7
D4BE22311AD3131E5EDA29A461092E85B7227189
EOF
- git log -1 --format="%G?%n%GK%n%GS%n%GF%n%GP" eighth-signed-alt >actual &&
+ git log -1 --format="%G?%n%GT%n%GK%n%GS%n%GF%n%GP" eighth-signed-alt >actual &&
test_cmp expect actual
'
test_expect_success GPG 'show untrusted signature with undefined trust level' '
cat >expect <<-\EOF &&
+ U
undefined
65A0EEA02E30CAD7
Eris Discordia <discord@example.net>
F8364A59E07FFE9F4D63005A65A0EEA02E30CAD7
D4BE22311AD3131E5EDA29A461092E85B7227189
EOF
- git log -1 --format="%GT%n%GK%n%GS%n%GF%n%GP" eighth-signed-alt >actual &&
+ git log -1 --format="%G?%n%GT%n%GK%n%GS%n%GF%n%GP" eighth-signed-alt >actual &&
test_cmp expect actual
'
test_expect_success GPG 'show untrusted signature with ultimate trust level' '
cat >expect <<-\EOF &&
+ G
ultimate
13B6F51ECDDE430D
C O Mitter <committer@example.com>
73D758744BE721698EC54E8713B6F51ECDDE430D
73D758744BE721698EC54E8713B6F51ECDDE430D
EOF
- git log -1 --format="%GT%n%GK%n%GS%n%GF%n%GP" sixth-signed >actual &&
+ git log -1 --format="%G?%n%GT%n%GK%n%GS%n%GF%n%GP" sixth-signed >actual &&
test_cmp expect actual
'
test_expect_success GPG 'show unknown signature with custom format' '
cat >expect <<-\EOF &&
E
+ undefined
65A0EEA02E30CAD7
EOF
- GNUPGHOME="$GNUPGHOME_NOT_USED" git log -1 --format="%G?%n%GK%n%GS%n%GF%n%GP" eighth-signed-alt >actual &&
+ GNUPGHOME="$GNUPGHOME_NOT_USED" git log -1 --format="%G?%n%GT%n%GK%n%GS%n%GF%n%GP" eighth-signed-alt >actual &&
test_cmp expect actual
'
test_expect_success GPG 'show lack of signature with custom format' '
cat >expect <<-\EOF &&
N
+ undefined
EOF
- git log -1 --format="%G?%n%GK%n%GS%n%GF%n%GP" seventh-unsigned >actual &&
+ git log -1 --format="%G?%n%GT%n%GK%n%GS%n%GF%n%GP" seventh-unsigned >actual &&
test_cmp expect actual
'
@@ -387,4 +394,48 @@ test_expect_success GPG 'verify-commit verifies multiply signed commits' '
! grep "BAD signature from" actual
'
+test_expect_success 'custom `gpg.program`' '
+ write_script fake-gpg <<-\EOF &&
+ args="$*"
+
+ # skip uninteresting options
+ while case "$1" in
+ --status-fd=*|--keyid-format=*) ;; # skip
+ *) break;;
+ esac; do shift; done
+
+ case "$1" in
+ -bsau)
+ test -z "$LET_GPG_PROGRAM_FAIL" || {
+ echo "zOMG signing failed!" >&2
+ exit 1
+ }
+ cat >sign.file
+ echo "[GNUPG:] SIG_CREATED $args" >&2
+ echo "-----BEGIN PGP MESSAGE-----"
+ echo "$args"
+ echo "-----END PGP MESSAGE-----"
+ ;;
+ --verify)
+ cat "$2" >verify.file
+ exit 0
+ ;;
+ *)
+ echo "Unhandled args: $*" >&2
+ exit 1
+ ;;
+ esac
+ EOF
+
+ test_config gpg.program "$(pwd)/fake-gpg" &&
+ git commit -S --allow-empty -m signed-commit &&
+ test_path_exists sign.file &&
+ git show --show-signature &&
+ test_path_exists verify.file &&
+
+ test_must_fail env LET_GPG_PROGRAM_FAIL=1 \
+ git commit -S --allow-empty -m must-fail 2>err &&
+ grep zOMG err
+'
+
test_done
diff --git a/t/t7516-commit-races.sh b/t/t7516-commit-races.sh
index f2ce14e907..2d38a16480 100755
--- a/t/t7516-commit-races.sh
+++ b/t/t7516-commit-races.sh
@@ -10,7 +10,8 @@ test_expect_success 'race to create orphan commit' '
test_must_fail env EDITOR=./hare-editor git commit --allow-empty -m tortoise -e &&
git show -s --pretty=format:%s >subject &&
grep hare subject &&
- test -z "$(git show -s --pretty=format:%P)"
+ git show -s --pretty=format:%P >out &&
+ test_must_be_empty out
'
test_expect_success 'race to create non-orphan commit' '
diff --git a/t/t7517-per-repo-email.sh b/t/t7517-per-repo-email.sh
index 163ae80468..efc6496e2b 100755
--- a/t/t7517-per-repo-email.sh
+++ b/t/t7517-per-repo-email.sh
@@ -9,6 +9,7 @@ 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/t7520-ignored-hook-warning.sh b/t/t7520-ignored-hook-warning.sh
index dc57526e6f..184b258989 100755
--- a/t/t7520-ignored-hook-warning.sh
+++ b/t/t7520-ignored-hook-warning.sh
@@ -2,6 +2,7 @@
test_description='ignored hook warning'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success setup '
diff --git a/t/t7527-builtin-fsmonitor.sh b/t/t7527-builtin-fsmonitor.sh
index d419085379..0c241d6c14 100755
--- a/t/t7527-builtin-fsmonitor.sh
+++ b/t/t7527-builtin-fsmonitor.sh
@@ -866,27 +866,9 @@ test_expect_success 'submodule always visited' '
# the submodule, and someone does a `git submodule absorbgitdirs`
# in the super, Git will recursively invoke `git submodule--helper`
# to do the work and this may try to read the index. This will
-# try to start the daemon in the submodule *and* pass (either
-# directly or via inheritance) the `--super-prefix` arg to the
-# `git fsmonitor--daemon start` command inside the submodule.
-# This causes a warning because fsmonitor--daemon does take that
-# global arg (see the table in git.c)
-#
-# This causes a warning when trying to start the daemon that is
-# somewhat confusing. It does not seem to hurt anything because
-# the fsmonitor code maps the query failure into a trivial response
-# and does the work anyway.
-#
-# It would be nice to silence the warning, however.
+# try to start the daemon in the submodule.
-have_t2_error_event () {
- log=$1
- msg="fsmonitor--daemon doesnQt support --super-prefix" &&
-
- tr '\047' Q <$1 | grep -e "$msg"
-}
-
-test_expect_success "stray submodule super-prefix warning" '
+test_expect_success "submodule absorbgitdirs implicitly starts daemon" '
test_when_finished "rm -rf super; \
rm -rf sub; \
rm super-sub.trace" &&
@@ -904,21 +886,31 @@ test_expect_success "stray submodule super-prefix warning" '
test_path_is_dir super/dir_1/dir_2/sub/.git &&
+ cwd="$(cd super && pwd)" &&
+ cat >expect <<-EOF &&
+ Migrating git directory of '\''dir_1/dir_2/sub'\'' from
+ '\''$cwd/dir_1/dir_2/sub/.git'\'' to
+ '\''$cwd/.git/modules/dir_1/dir_2/sub'\''
+ EOF
GIT_TRACE2_EVENT="$PWD/super-sub.trace" \
- git -C super submodule absorbgitdirs &&
+ git -C super submodule absorbgitdirs >out 2>actual &&
+ test_cmp expect actual &&
+ test_must_be_empty out &&
- ! have_t2_error_event super-sub.trace
+ # Confirm that the trace2 log contains a record of the
+ # daemon starting.
+ test_subcommand git fsmonitor--daemon start <super-sub.trace
'
# On a case-insensitive file system, confirm that the daemon
# notices when the .git directory is moved/renamed/deleted
-# regardless of how it is spelled in the the FS event.
+# regardless of how it is spelled in the FS event.
# That is, does the FS event receive the spelling of the
# operation or does it receive the spelling preserved with
# the file/directory.
#
test_expect_success CASE_INSENSITIVE_FS 'case insensitive+preserving' '
-# test_when_finished "stop_daemon_delete_repo test_insensitive" &&
+ test_when_finished "stop_daemon_delete_repo test_insensitive" &&
git init test_insensitive &&
@@ -930,8 +922,8 @@ test_expect_success CASE_INSENSITIVE_FS 'case insensitive+preserving' '
test_path_is_dir test_insensitive/.git &&
test_path_is_dir test_insensitive/.GIT &&
- # Rename .git using an alternate spelling to verify that that
- # daemon detects it and automatically shuts down.
+ # Rename .git using an alternate spelling to verify that
+ # the daemon detects it and automatically shuts down.
mv test_insensitive/.GIT test_insensitive/.FOO &&
# See [1] above.
@@ -943,9 +935,9 @@ test_expect_success CASE_INSENSITIVE_FS 'case insensitive+preserving' '
# directories and files that we touched. We may or may not get a
# trailing slash on modified directories.
#
- egrep "^event: abc/?$" ./insensitive.trace &&
- egrep "^event: abc/def/?$" ./insensitive.trace &&
- egrep "^event: abc/def/xyz$" ./insensitive.trace
+ grep -E "^event: abc/?$" ./insensitive.trace &&
+ grep -E "^event: abc/def/?$" ./insensitive.trace &&
+ grep -E "^event: abc/def/xyz$" ./insensitive.trace
'
# The variable "unicode_debug" is defined in the following library
@@ -987,20 +979,57 @@ test_expect_success !UNICODE_COMPOSITION_SENSITIVE 'Unicode nfc/nfd' '
then
# We should have seen NFC event from OS.
# We should not have synthesized an NFD event.
- egrep "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace &&
- egrep -v "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace
+ grep -E "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace &&
+ grep -E -v "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace
else
# We should have seen NFD event from OS.
# We should have synthesized an NFC event.
- egrep "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace &&
- egrep "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace
+ grep -E "^event: nfc/c_${utf8_nfd}/?$" ./unicode.trace &&
+ grep -E "^event: nfc/c_${utf8_nfc}/?$" ./unicode.trace
fi &&
# We assume UNICODE_NFD_PRESERVED.
# We should have seen explicit NFD from OS.
# We should have synthesized an NFC event.
- egrep "^event: nfd/d_${utf8_nfd}/?$" ./unicode.trace &&
- egrep "^event: nfd/d_${utf8_nfc}/?$" ./unicode.trace
+ grep -E "^event: nfd/d_${utf8_nfd}/?$" ./unicode.trace &&
+ grep -E "^event: nfd/d_${utf8_nfc}/?$" ./unicode.trace
+'
+
+test_expect_success 'split-index and FSMonitor work well together' '
+ git init split-index &&
+ test_when_finished "git -C \"$PWD/split-index\" \
+ fsmonitor--daemon stop" &&
+ (
+ cd split-index &&
+ git config core.splitIndex true &&
+ # force split-index in most cases
+ git config splitIndex.maxPercentChange 99 &&
+ git config core.fsmonitor true &&
+
+ # Create the following commit topology:
+ #
+ # * merge three
+ # |\
+ # | * three
+ # * | merge two
+ # |\|
+ # | * two
+ # * | one
+ # |/
+ # * 5a5efd7 initial
+
+ test_commit initial &&
+ test_commit two &&
+ test_commit three &&
+ git reset --hard initial &&
+ test_commit one &&
+ test_tick &&
+ git merge two &&
+ test_tick &&
+ git merge three &&
+
+ git rebase --force-rebase -r one
+ )
'
test_done
diff --git a/t/t7528-signed-commit-ssh.sh b/t/t7528-signed-commit-ssh.sh
index f47e995179..065f780636 100755
--- a/t/t7528-signed-commit-ssh.sh
+++ b/t/t7528-signed-commit-ssh.sh
@@ -270,7 +270,7 @@ test_expect_success GPGSSH 'detect fudged signature with NUL' '
git cat-file commit seventh-signed >raw &&
cat raw >forged2 &&
echo Qwik | tr "Q" "\000" >>forged2 &&
- git hash-object -w -t commit forged2 >forged2.commit &&
+ git hash-object --literally -w -t commit forged2 >forged2.commit &&
test_must_fail git verify-commit $(cat forged2.commit) &&
git show --pretty=short --show-signature $(cat forged2.commit) >actual2 &&
grep "${GPGSSH_BAD_SIGNATURE}" actual2 &&
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 7c3f6ed994..060e145957 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -105,7 +105,7 @@ verify_mergeheads () {
test_write_lines "$@" >mergehead.expected &&
while read sha1 rest
do
- git rev-parse $sha1
+ git rev-parse $sha1 || return 1
done <.git/MERGE_HEAD >mergehead.actual &&
test_cmp mergehead.expected mergehead.actual
}
diff --git a/t/t7605-merge-resolve.sh b/t/t7605-merge-resolve.sh
index 5d56c38546..62d935d31c 100755
--- a/t/t7605-merge-resolve.sh
+++ b/t/t7605-merge-resolve.sh
@@ -4,6 +4,7 @@ test_description='git merge
Testing the resolve strategy.'
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index 8cc64729ad..22b3a85b3e 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -33,7 +33,7 @@ test_expect_success 'setup' '
git add foo &&
git commit -m "Add foo"
) &&
- git submodule add git://example.com/submod submod &&
+ git submodule add file:///dev/null submod &&
git add file1 "spaced name" file1[1-4] subdir/file3 .gitmodules submod &&
git commit -m "add initial versions" &&
@@ -614,7 +614,7 @@ test_expect_success 'submodule in subdirectory' '
)
) &&
test_when_finished "rm -rf subdir/subdir_module" &&
- git submodule add git://example.com/subsubmodule subdir/subdir_module &&
+ git submodule add file:///dev/null subdir/subdir_module &&
git add subdir/subdir_module &&
git commit -m "add submodule in subdirectory" &&
@@ -860,4 +860,42 @@ test_expect_success 'mergetool hideResolved' '
git commit -m "test resolved with mergetool"
'
+test_expect_success 'mergetool with guiDefault' '
+ test_config merge.guitool myguitool &&
+ test_config mergetool.myguitool.cmd "(printf \"gui \" && cat \"\$REMOTE\") >\"\$MERGED\"" &&
+ test_config mergetool.myguitool.trustExitCode true &&
+ test_when_finished "git reset --hard" &&
+ git checkout -b test$test_count branch1 &&
+ git submodule update -N &&
+ test_must_fail git merge main &&
+
+ test_config mergetool.guiDefault auto &&
+ DISPLAY=SOMETHING && export DISPLAY &&
+ yes "" | git mergetool both &&
+ yes "" | git mergetool file1 file1 &&
+
+ DISPLAY= && export DISPLAY &&
+ yes "" | git mergetool file2 "spaced name" &&
+
+ test_config mergetool.guiDefault true &&
+ yes "" | git mergetool subdir/file3 &&
+
+ yes "d" | git mergetool file11 &&
+ yes "d" | git mergetool file12 &&
+ yes "l" | git mergetool submod &&
+
+ echo "gui main updated" >expect &&
+ test_cmp expect file1 &&
+
+ echo "main new" >expect &&
+ test_cmp expect file2 &&
+
+ echo "gui main new sub" >expect &&
+ test_cmp expect subdir/file3 &&
+
+ echo "branch1 submodule" >expect &&
+ test_cmp expect submod/bar &&
+ git commit -m "branch1 resolved with mergetool"
+'
+
test_done
diff --git a/t/t7612-merge-verify-signatures.sh b/t/t7612-merge-verify-signatures.sh
index 61330f71b1..f5c90cc22a 100755
--- a/t/t7612-merge-verify-signatures.sh
+++ b/t/t7612-merge-verify-signatures.sh
@@ -4,6 +4,7 @@ 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 fee258d4f0..cf96a35e8e 100755
--- a/t/t7614-merge-signoff.sh
+++ b/t/t7614-merge-signoff.sh
@@ -8,6 +8,7 @@ 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/t7700-repack.sh b/t/t7700-repack.sh
index ca45c4cd2c..faa739eeb9 100755
--- a/t/t7700-repack.sh
+++ b/t/t7700-repack.sh
@@ -90,6 +90,39 @@ test_expect_success 'loose objects in alternate ODB are not repacked' '
test_has_duplicate_object false
'
+test_expect_success SYMLINKS '--local keeps packs when alternate is objectdir ' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ test_commit -C repo A &&
+ (
+ cd repo &&
+ git repack -a &&
+ ls .git/objects/pack/*.pack >../expect &&
+ ln -s objects .git/alt_objects &&
+ echo "$(pwd)/.git/alt_objects" >.git/objects/info/alternates &&
+ git repack -a -d -l &&
+ ls .git/objects/pack/*.pack >../actual
+ ) &&
+ test_cmp expect actual
+'
+
+test_expect_success '--local disables writing bitmaps when connected to alternate ODB' '
+ test_when_finished "rm -rf shared member" &&
+
+ git init shared &&
+ git clone --shared shared member &&
+ (
+ cd member &&
+ test_commit "object" &&
+ GIT_TEST_MULTI_PACK_INDEX=0 git repack -Adl --write-bitmap-index 2>err &&
+ cat >expect <<-EOF &&
+ warning: disabling bitmap writing, as some objects are not being packed
+ EOF
+ test_cmp expect err &&
+ test_path_is_missing .git/objects/pack-*.bitmap
+ )
+'
+
test_expect_success 'packed obs in alt ODB are repacked even when local repo is packless' '
mkdir alt_objects/pack &&
mv .git/objects/pack/* alt_objects/pack &&
@@ -426,12 +459,73 @@ test_expect_success '--write-midx -b packs non-kept objects' '
)
'
+test_expect_success '--write-midx removes stale pack-based bitmaps' '
+ rm -fr repo &&
+ git init repo &&
+ test_when_finished "rm -fr repo" &&
+ (
+ cd repo &&
+ test_commit base &&
+ GIT_TEST_MULTI_PACK_INDEX=0 git repack -Ab &&
+
+ pack_bitmap=$(ls $objdir/pack/pack-*.bitmap) &&
+ test_path_is_file "$pack_bitmap" &&
+
+ test_commit tip &&
+ GIT_TEST_MULTI_PACK_INDEX=0 git repack -bm &&
+
+ test_path_is_file $midx &&
+ test_path_is_file $midx-$(midx_checksum $objdir).bitmap &&
+ test_path_is_missing $pack_bitmap
+ )
+'
+
+test_expect_success '--write-midx with --pack-kept-objects' '
+ git init repo &&
+ test_when_finished "rm -fr repo" &&
+ (
+ cd repo &&
+
+ test_commit one &&
+ test_commit two &&
+
+ one="$(echo "one" | git pack-objects --revs $objdir/pack/pack)" &&
+ two="$(echo "one..two" | git pack-objects --revs $objdir/pack/pack)" &&
+
+ keep="$objdir/pack/pack-$one.keep" &&
+ touch "$keep" &&
+
+ git repack --write-midx --write-bitmap-index --geometric=2 -d \
+ --pack-kept-objects &&
+
+ test_path_is_file $keep &&
+ test_path_is_file $midx &&
+ test_path_is_file $midx-$(midx_checksum $objdir).bitmap
+ )
+'
+
test_expect_success TTY '--quiet disables progress' '
test_terminal env GIT_PROGRESS_DELAY=0 \
git -C midx repack -ad --quiet --write-midx 2>stderr &&
test_must_be_empty stderr
'
+test_expect_success 'clean up .tmp-* packs on error' '
+ test_must_fail ok=sigpipe git \
+ -c repack.cruftwindow=bogus \
+ repack -ad --cruft &&
+ find $objdir/pack -name '.tmp-*' >tmpfiles &&
+ test_must_be_empty tmpfiles
+'
+
+test_expect_success 'repack -ad cleans up old .tmp-* packs' '
+ git rev-parse HEAD >input &&
+ git pack-objects $objdir/pack/.tmp-1234 <input &&
+ git repack -ad &&
+ find $objdir/pack -name '.tmp-*' >tmpfiles &&
+ test_must_be_empty tmpfiles
+'
+
test_expect_success 'setup for update-server-info' '
git init update-server-info &&
test_commit -C update-server-info message
@@ -482,4 +576,125 @@ test_expect_success '-n overrides repack.updateServerInfo=true' '
test_server_info_missing
'
+test_expect_success '--expire-to stores pruned objects (now)' '
+ git init expire-to-now &&
+ (
+ cd expire-to-now &&
+
+ git branch -M main &&
+
+ test_commit base &&
+
+ git checkout -b cruft &&
+ test_commit --no-tag cruft &&
+
+ git rev-list --objects --no-object-names main..cruft >moved.raw &&
+ sort moved.raw >moved.want &&
+
+ git rev-list --all --objects --no-object-names >expect.raw &&
+ sort expect.raw >expect &&
+
+ git checkout main &&
+ git branch -D cruft &&
+ git reflog expire --all --expire=all &&
+
+ git init --bare expired.git &&
+ git repack -d \
+ --cruft --cruft-expiration="now" \
+ --expire-to="expired.git/objects/pack/pack" &&
+
+ expired="$(ls expired.git/objects/pack/pack-*.idx)" &&
+ test_path_is_file "${expired%.idx}.mtimes" &&
+
+ # Since the `--cruft-expiration` is "now", the effective
+ # behavior is to move _all_ unreachable objects out to
+ # the location in `--expire-to`.
+ git show-index <$expired >expired.raw &&
+ cut -d" " -f2 expired.raw | sort >expired.objects &&
+ git rev-list --all --objects --no-object-names \
+ >remaining.objects &&
+
+ # ...in other words, the combined contents of this
+ # repository and expired.git should be the same as the
+ # set of objects we started with.
+ cat expired.objects remaining.objects | sort >actual &&
+ test_cmp expect actual &&
+
+ # The "moved" objects (i.e., those in expired.git)
+ # should be the same as the cruft objects which were
+ # expired in the previous step.
+ test_cmp moved.want expired.objects
+ )
+'
+
+test_expect_success '--expire-to stores pruned objects (5.minutes.ago)' '
+ git init expire-to-5.minutes.ago &&
+ (
+ cd expire-to-5.minutes.ago &&
+
+ git branch -M main &&
+
+ test_commit base &&
+
+ # Create two classes of unreachable objects, one which
+ # is older than 5 minutes (stale), and another which is
+ # newer (recent).
+ for kind in stale recent
+ do
+ git checkout -b $kind main &&
+ test_commit --no-tag $kind || return 1
+ done &&
+
+ git rev-list --objects --no-object-names main..stale >in &&
+ stale="$(git pack-objects $objdir/pack/pack <in)" &&
+ mtime="$(test-tool chmtime --get =-600 $objdir/pack/pack-$stale.pack)" &&
+
+ # expect holds the set of objects we expect to find in
+ # this repository after repacking
+ git rev-list --objects --no-object-names recent >expect.raw &&
+ sort expect.raw >expect &&
+
+ # moved.want holds the set of objects we expect to find
+ # in expired.git
+ git rev-list --objects --no-object-names main..stale >out &&
+ sort out >moved.want &&
+
+ git checkout main &&
+ git branch -D stale recent &&
+ git reflog expire --all --expire=all &&
+ git prune-packed &&
+
+ git init --bare expired.git &&
+ git repack -d \
+ --cruft --cruft-expiration=5.minutes.ago \
+ --expire-to="expired.git/objects/pack/pack" &&
+
+ # Some of the remaining objects in this repository are
+ # unreachable, so use `cat-file --batch-all-objects`
+ # instead of `rev-list` to get their names
+ git cat-file --batch-all-objects --batch-check="%(objectname)" \
+ >remaining.objects &&
+ sort remaining.objects >actual &&
+ test_cmp expect actual &&
+
+ (
+ cd expired.git &&
+
+ expired="$(ls objects/pack/pack-*.mtimes)" &&
+ test-tool pack-mtimes $(basename $expired) >out &&
+ cut -d" " -f1 out | sort >../moved.got &&
+
+ # Ensure that there are as many objects with the
+ # expected mtime as were moved to expired.git.
+ #
+ # In other words, ensure that the recorded
+ # mtimes of any moved objects was written
+ # correctly.
+ grep " $mtime$" out >matching &&
+ test_line_count = $(wc -l <../moved.want) matching
+ ) &&
+ test_cmp moved.want moved.got
+ )
+'
+
test_done
diff --git a/t/t7701-repack-unpack-unreachable.sh b/t/t7701-repack-unpack-unreachable.sh
index 937f89ee8c..ebb267855f 100755
--- a/t/t7701-repack-unpack-unreachable.sh
+++ b/t/t7701-repack-unpack-unreachable.sh
@@ -5,6 +5,7 @@ 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=
@@ -35,7 +36,7 @@ test_expect_success '-A with -d option leaves unreachable objects unpacked' '
git repack -A -d -l &&
# verify objects are packed in repository
test 3 = $(git verify-pack -v -- .git/objects/pack/*.idx |
- egrep "^($fsha1|$csha1|$tsha1) " |
+ grep -E "^($fsha1|$csha1|$tsha1) " |
sort | uniq | wc -l) &&
git show $fsha1 &&
git show $csha1 &&
@@ -49,7 +50,7 @@ test_expect_success '-A with -d option leaves unreachable objects unpacked' '
git repack -A -d -l &&
# verify objects are retained unpacked
test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |
- egrep "^($fsha1|$csha1|$tsha1) " |
+ grep -E "^($fsha1|$csha1|$tsha1) " |
sort | uniq | wc -l) &&
git show $fsha1 &&
git show $csha1 &&
diff --git a/t/t7703-repack-geometric.sh b/t/t7703-repack-geometric.sh
index da87f8b2d8..00f28fb558 100755
--- a/t/t7703-repack-geometric.sh
+++ b/t/t7703-repack-geometric.sh
@@ -10,6 +10,12 @@ objdir=.git/objects
packdir=$objdir/pack
midx=$objdir/pack/multi-pack-index
+packed_objects () {
+ git show-index <"$1" >tmp-object-list &&
+ cut -d' ' -f2 tmp-object-list | sort &&
+ rm tmp-object-list
+ }
+
test_expect_success '--geometric with no packs' '
git init geometric &&
test_when_finished "rm -fr geometric" &&
@@ -176,8 +182,12 @@ test_expect_success '--geometric ignores kept packs' '
# be repacked, too.
git repack --geometric 2 -d --pack-kept-objects &&
+ # After repacking, two packs remain: one new one (containing the
+ # objects in both the .keep and non-kept pack), and the .keep
+ # pack (since `--pack-kept-objects -d` does not actually delete
+ # the kept pack).
find $objdir/pack -name "*.pack" >after &&
- test_line_count = 1 after
+ test_line_count = 2 after
)
'
@@ -277,4 +287,162 @@ test_expect_success '--geometric with pack.packSizeLimit' '
)
'
+test_expect_success '--geometric --write-midx with packfiles in main and alternate ODB' '
+ test_when_finished "rm -fr shared member" &&
+
+ # Create a shared repository that will serve as the alternate object
+ # database for the member linked to it. It has got some objects on its
+ # own that are packed into a single packfile.
+ git init shared &&
+ test_commit -C shared common-object &&
+ git -C shared repack -ad &&
+
+ # We create member so that its alternates file points to the shared
+ # repository. We then create a commit in it so that git-repack(1) has
+ # something to repack.
+ # of the shared object database.
+ git clone --shared shared member &&
+ test_commit -C member unique-object &&
+ git -C member repack --geometric=2 --write-midx 2>err &&
+ test_must_be_empty err &&
+
+ # We should see that a new packfile was generated.
+ find shared/.git/objects/pack -type f -name "*.pack" >packs &&
+ test_line_count = 1 packs &&
+
+ # We should also see a multi-pack-index. This multi-pack-index should
+ # never refer to any packfiles in the alternate object database.
+ test_path_is_file member/.git/objects/pack/multi-pack-index &&
+ test-tool read-midx member/.git/objects >packs.midx &&
+ grep "^pack-.*\.idx$" packs.midx | sort >actual &&
+ basename member/.git/objects/pack/pack-*.idx >expect &&
+ test_cmp expect actual
+'
+
+test_expect_success '--geometric --with-midx with no local objects' '
+ test_when_finished "rm -fr shared member" &&
+
+ # Create a repository with a single packfile that acts as alternate
+ # object database.
+ git init shared &&
+ test_commit -C shared "shared-objects" &&
+ git -C shared repack -ad &&
+
+ # Create a second repository linked to the first one and perform a
+ # geometric repack on it.
+ git clone --shared shared member &&
+ git -C member repack --geometric 2 --write-midx 2>err &&
+ test_must_be_empty err &&
+
+ # Assert that we wrote neither a new packfile nor a multi-pack-index.
+ # We should not have a packfile because the single packfile in the
+ # alternate object database does not invalidate the geometric sequence.
+ # And we should not have a multi-pack-index because these only index
+ # local packfiles, and there are none.
+ test_dir_is_empty member/$packdir
+'
+
+test_expect_success '--geometric with same pack in main and alternate ODB' '
+ test_when_finished "rm -fr shared member" &&
+
+ # Create a repository with a single packfile that acts as alternate
+ # object database.
+ git init shared &&
+ test_commit -C shared "shared-objects" &&
+ git -C shared repack -ad &&
+
+ # We create the member repository as an exact copy so that it has the
+ # same packfile.
+ cp -r shared member &&
+ test-tool path-utils real_path shared/.git/objects >member/.git/objects/info/alternates &&
+ find shared/.git/objects -type f >expected-files &&
+
+ # Verify that we can repack objects as expected without observing any
+ # error. Having the same packfile in both ODBs used to cause an error
+ # in git-pack-objects(1).
+ git -C member repack --geometric 2 2>err &&
+ test_must_be_empty err &&
+ # Nothing should have changed.
+ find shared/.git/objects -type f >actual-files &&
+ test_cmp expected-files actual-files
+'
+
+test_expect_success '--geometric -l with non-intact geometric sequence across ODBs' '
+ test_when_finished "rm -fr shared member" &&
+
+ git init shared &&
+ test_commit_bulk -C shared --start=1 1 &&
+
+ git clone --shared shared member &&
+ test_commit_bulk -C member --start=2 1 &&
+
+ # Verify that our assumptions actually hold: both generated packfiles
+ # should have three objects and should be non-equal.
+ packed_objects shared/.git/objects/pack/pack-*.idx >shared-objects &&
+ packed_objects member/.git/objects/pack/pack-*.idx >member-objects &&
+ test_line_count = 3 shared-objects &&
+ test_line_count = 3 member-objects &&
+ ! test_cmp shared-objects member-objects &&
+
+ # Perform the geometric repack. With `-l`, we should only see the local
+ # packfile and thus arrive at the conclusion that the geometric
+ # sequence is intact. We thus expect no changes.
+ #
+ # Note that we are tweaking mtimes of the packfiles so that we can
+ # verify they did not change. This is done in order to detect the case
+ # where we do repack objects, but the resulting packfile is the same.
+ test-tool chmtime --verbose =0 member/.git/objects/pack/* >expected-member-packs &&
+ git -C member repack --geometric=2 -l -d &&
+ test-tool chmtime --verbose member/.git/objects/pack/* >actual-member-packs &&
+ test_cmp expected-member-packs actual-member-packs &&
+
+ {
+ packed_objects shared/.git/objects/pack/pack-*.idx &&
+ packed_objects member/.git/objects/pack/pack-*.idx
+ } | sort >expected-objects &&
+
+ # On the other hand, when doing a non-local geometric repack we should
+ # see both packfiles and thus repack them. We expect that the shared
+ # object database was not changed.
+ test-tool chmtime --verbose =0 shared/.git/objects/pack/* >expected-shared-packs &&
+ git -C member repack --geometric=2 -d &&
+ test-tool chmtime --verbose shared/.git/objects/pack/* >actual-shared-packs &&
+ test_cmp expected-shared-packs actual-shared-packs &&
+
+ # Furthermore, we expect that the member repository now has a single
+ # packfile that contains the combined shared and non-shared objects.
+ ls member/.git/objects/pack/pack-*.idx >actual &&
+ test_line_count = 1 actual &&
+ packed_objects member/.git/objects/pack/pack-*.idx >actual-objects &&
+ test_line_count = 6 actual-objects &&
+ test_cmp expected-objects actual-objects
+'
+
+test_expect_success '--geometric -l disables writing bitmaps with non-local packfiles' '
+ test_when_finished "rm -fr shared member" &&
+
+ git init shared &&
+ test_commit_bulk -C shared --start=1 1 &&
+
+ git clone --shared shared member &&
+ test_commit_bulk -C member --start=2 1 &&
+
+ # When performing a geometric repack with `-l` while connected to an
+ # alternate object database that has a packfile we do not have full
+ # coverage of objects. As a result, we expect that writing the bitmap
+ # will be disabled.
+ git -C member repack -l --geometric=2 --write-midx --write-bitmap-index 2>err &&
+ cat >expect <<-EOF &&
+ warning: disabling bitmap writing, as some objects are not being packed
+ EOF
+ test_cmp expect err &&
+ test_path_is_missing member/.git/objects/pack/multi-pack-index-*.bitmap &&
+
+ # On the other hand, when we repack without `-l`, we should see that
+ # the bitmap gets created.
+ git -C member repack --geometric=2 --write-midx --write-bitmap-index 2>err &&
+ test_must_be_empty err &&
+ test_path_is_file member/.git/objects/pack/multi-pack-index-*.bitmap
+'
+
test_done
diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index 24297e26ca..59d3847bf8 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -155,6 +155,58 @@ test_expect_success 'difftool honors --gui' '
test_cmp expect actual
'
+test_expect_success 'difftool with guiDefault auto selects gui tool when there is DISPLAY' '
+ difftool_test_setup &&
+ test_config merge.tool bogus-tool &&
+ test_config diff.tool bogus-tool &&
+ test_config diff.guitool test-tool &&
+ test_config difftool.guiDefault auto &&
+ DISPLAY=SOMETHING && export DISPLAY &&
+
+ echo branch >expect &&
+ git difftool --no-prompt branch >actual &&
+ test_cmp expect actual
+'
+test_expect_success 'difftool with guiDefault auto selects regular tool when no DISPLAY' '
+ difftool_test_setup &&
+ test_config diff.guitool bogus-tool &&
+ test_config diff.tool test-tool &&
+ test_config difftool.guiDefault Auto &&
+ DISPLAY= && export DISPLAY &&
+
+ echo branch >expect &&
+ git difftool --no-prompt branch >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'difftool with guiDefault true selects gui tool' '
+ difftool_test_setup &&
+ test_config diff.tool bogus-tool &&
+ test_config diff.guitool test-tool &&
+ test_config difftool.guiDefault true &&
+
+ DISPLAY= && export DISPLAY &&
+ echo branch >expect &&
+ git difftool --no-prompt branch >actual &&
+ test_cmp expect actual &&
+
+ DISPLAY=Something && export DISPLAY &&
+ echo branch >expect &&
+ git difftool --no-prompt branch >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'difftool --no-gui trumps config guiDefault' '
+ difftool_test_setup &&
+ test_config diff.guitool bogus-tool &&
+ test_config diff.tool test-tool &&
+ test_config difftool.guiDefault true &&
+
+ echo branch >expect &&
+ git difftool --no-prompt --no-gui branch >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'difftool --gui last setting wins' '
difftool_test_setup &&
: >expect &&
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index 0f937990a0..39d6d713ec 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -18,6 +18,9 @@ test_invalid_grep_expression() {
'
}
+LC_ALL=en_US.UTF-8 test-tool regex '^.$' '¿' &&
+ test_set_prereq MB_REGEX
+
cat >hello.c <<EOF
#include <assert.h>
#include <stdio.h>
@@ -88,6 +91,10 @@ test_expect_success setup '
echo unusual >"\"unusual\" pathname" &&
echo unusual >"t/nested \"unusual\" pathname"
fi &&
+ if test_have_prereq MB_REGEX
+ then
+ echo "¿" >reverse-question-mark
+ fi &&
git add . &&
test_tick &&
git commit -m initial
@@ -569,6 +576,14 @@ do
'
done
+test_expect_success MB_REGEX 'grep exactly one char in single-char multibyte file' '
+ LC_ALL=en_US.UTF-8 git grep "^.$" reverse-question-mark
+'
+
+test_expect_success MB_REGEX 'grep two chars in single-char multibyte file' '
+ LC_ALL=en_US.UTF-8 test_expect_code 1 git grep ".." reverse-question-mark
+'
+
cat >expected <<EOF
file
EOF
@@ -986,7 +1001,9 @@ test_expect_success 'log --committer does not search in timestamp' '
test_expect_success 'grep with CE_VALID file' '
git update-index --assume-unchanged t/t &&
rm t/t &&
- test "$(git grep test)" = "t/t:test" &&
+ echo "t/t:test" >expect &&
+ git grep test >actual &&
+ test_cmp expect actual &&
git update-index --no-assume-unchanged t/t &&
git checkout t/t
'
diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
index 2724a44fe3..487e326b3f 100755
--- a/t/t7900-maintenance.sh
+++ b/t/t7900-maintenance.sh
@@ -480,6 +480,11 @@ test_expect_success 'maintenance.strategy inheritance' '
test_expect_success 'register and unregister' '
test_when_finished git config --global --unset-all maintenance.repo &&
+
+ test_must_fail git maintenance unregister 2>err &&
+ grep "is not registered" err &&
+ git maintenance unregister --force &&
+
git config --global --add maintenance.repo /existing1 &&
git config --global --add maintenance.repo /existing2 &&
git config --global --get-all maintenance.repo >before &&
@@ -493,7 +498,68 @@ test_expect_success 'register and unregister' '
git maintenance unregister &&
git config --global --get-all maintenance.repo >actual &&
- test_cmp before actual
+ test_cmp before actual &&
+
+ git config --file ./other --add maintenance.repo /existing1 &&
+ git config --file ./other --add maintenance.repo /existing2 &&
+ git config --file ./other --get-all maintenance.repo >before &&
+
+ git maintenance register --config-file ./other &&
+ test_cmp_config false maintenance.auto &&
+ git config --file ./other --get-all maintenance.repo >between &&
+ cp before expect &&
+ pwd >>expect &&
+ test_cmp expect between &&
+
+ git maintenance unregister --config-file ./other &&
+ git config --file ./other --get-all maintenance.repo >actual &&
+ test_cmp before actual &&
+
+ test_must_fail git maintenance unregister 2>err &&
+ grep "is not registered" err &&
+ git maintenance unregister --force &&
+
+ test_must_fail git maintenance unregister --config-file ./other 2>err &&
+ grep "is not registered" err &&
+ git maintenance unregister --config-file ./other --force
+'
+
+test_expect_success 'register with no value for maintenance.repo' '
+ cp .git/config .git/config.orig &&
+ test_when_finished mv .git/config.orig .git/config &&
+
+ cat >>.git/config <<-\EOF &&
+ [maintenance]
+ repo
+ EOF
+ cat >expect <<-\EOF &&
+ error: missing value for '\''maintenance.repo'\''
+ EOF
+ git maintenance register 2>actual &&
+ test_cmp expect actual &&
+ git config maintenance.repo
+'
+
+test_expect_success 'unregister with no value for maintenance.repo' '
+ cp .git/config .git/config.orig &&
+ test_when_finished mv .git/config.orig .git/config &&
+
+ cat >>.git/config <<-\EOF &&
+ [maintenance]
+ repo
+ EOF
+ cat >expect <<-\EOF &&
+ error: missing value for '\''maintenance.repo'\''
+ EOF
+ test_expect_code 128 git maintenance unregister 2>actual.raw &&
+ grep ^error actual.raw >actual &&
+ test_cmp expect actual &&
+ git config maintenance.repo &&
+
+ git maintenance unregister --force 2>actual.raw &&
+ grep ^error actual.raw >actual &&
+ test_cmp expect actual &&
+ git config maintenance.repo
'
test_expect_success !MINGW 'register and unregister with regex metacharacters' '
diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh
index d751d48b7d..8bcd39e81b 100755
--- a/t/t8003-blame-corner-cases.sh
+++ b/t/t8003-blame-corner-cases.sh
@@ -201,7 +201,7 @@ committer David Reiss <dreiss@facebook.com> 1234567890 +0000
some message
EOF
- COMMIT=$(git hash-object -t commit -w badcommit) &&
+ COMMIT=$(git hash-object --literally -t commit -w badcommit) &&
git --no-pager blame $COMMIT -- uno >/dev/null
'
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 01c74b8b07..b77726c320 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -12,7 +12,7 @@ PREREQ="PERL"
replace_variable_fields () {
sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
- -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
+ -e "s/^\(Message-ID:\).*/\1 MESSAGE-ID-STRING/" \
-e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/"
}
@@ -225,7 +225,7 @@ Cc: cc@example.com,
two@example.com
Subject: [PATCH 1/1] Second.
Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
X-Mailer: X-MAILER-STRING
In-Reply-To: <unique-message-id@example.com>
References: <unique-message-id@example.com>
@@ -374,13 +374,16 @@ test_expect_success $PREREQ,!AUTOIDENT 'broken implicit ident aborts send-email'
)
'
-test_expect_success $PREREQ 'setup tocmd and cccmd scripts' '
+test_expect_success $PREREQ 'setup cmd scripts' '
write_script tocmd-sed <<-\EOF &&
sed -n -e "s/^tocmd--//p" "$1"
EOF
- write_script cccmd-sed <<-\EOF
+ write_script cccmd-sed <<-\EOF &&
sed -n -e "s/^cccmd--//p" "$1"
EOF
+ write_script headercmd-sed <<-\EOF
+ sed -n -e "s/^headercmd--//p" "$1"
+ EOF
'
test_expect_success $PREREQ 'tocmd works' '
@@ -410,6 +413,70 @@ test_expect_success $PREREQ 'cccmd works' '
grep "^ cccmd@example.com" msgtxt1
'
+test_expect_success $PREREQ 'headercmd works' '
+ clean_fake_sendmail &&
+ cp $patches headercmd.patch &&
+ echo "headercmd--X-Debbugs-CC: dummy@example.com" >>headercmd.patch &&
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --header-cmd=./headercmd-sed \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ headercmd.patch \
+ &&
+ grep "^X-Debbugs-CC: dummy@example.com" msgtxt1
+'
+
+test_expect_success $PREREQ '--no-header-cmd works' '
+ clean_fake_sendmail &&
+ cp $patches headercmd.patch &&
+ echo "headercmd--X-Debbugs-CC: dummy@example.com" >>headercmd.patch &&
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --header-cmd=./headercmd-sed \
+ --no-header-cmd \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ headercmd.patch \
+ &&
+ ! grep "^X-Debbugs-CC: dummy@example.com" msgtxt1
+'
+
+test_expect_success $PREREQ 'multiline fields are correctly unfolded' '
+ clean_fake_sendmail &&
+ cp $patches headercmd.patch &&
+ write_script headercmd-multiline <<-\EOF &&
+ echo "X-Debbugs-CC: someone@example.com
+FoldedField: This is a tale
+ best told using
+ multiple lines."
+ EOF
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --header-cmd=./headercmd-multiline \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ headercmd.patch &&
+ grep "^FoldedField: This is a tale best told using multiple lines.$" msgtxt1
+'
+
+# Blank lines in the middle of the output of a command are invalid.
+test_expect_success $PREREQ 'malform output reported on blank lines in command output' '
+ clean_fake_sendmail &&
+ cp $patches headercmd.patch &&
+ write_script headercmd-malformed-output <<-\EOF &&
+ echo "X-Debbugs-CC: someone@example.com
+
+SomeOtherField: someone-else@example.com"
+ EOF
+ ! git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --header-cmd=./headercmd-malformed-output \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ headercmd.patch
+'
+
test_expect_success $PREREQ 'reject long lines' '
z8=zzzzzzzz &&
z64=$z8$z8$z8$z8$z8$z8$z8$z8 &&
@@ -540,7 +607,7 @@ test_expect_success $PREREQ "--validate respects relative core.hooksPath path" '
test_path_is_file my-hooks.ran &&
cat >expect <<-EOF &&
fatal: longline.patch: rejected by sendemail-validate hook
- fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch>'"'"' died with exit code 1
+ fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch> <header>'"'"' died with exit code 1
warning: no patches were sent
EOF
test_cmp expect actual
@@ -559,12 +626,35 @@ test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
test_path_is_file my-hooks.ran &&
cat >expect <<-EOF &&
fatal: longline.patch: rejected by sendemail-validate hook
- fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch>'"'"' died with exit code 1
+ fatal: command '"'"'git hook run --ignore-missing sendemail-validate -- <patch> <header>'"'"' died with exit code 1
warning: no patches were sent
EOF
test_cmp expect actual
'
+test_expect_success $PREREQ "--validate hook supports header argument" '
+ write_script my-hooks/sendemail-validate <<-\EOF &&
+ if test "$#" -ge 2
+ then
+ grep "X-test-header: v1.0" "$2"
+ else
+ echo "No header arg passed"
+ exit 1
+ fi
+ EOF
+ test_config core.hooksPath "my-hooks" &&
+ rm -fr outdir &&
+ git format-patch \
+ --add-header="X-test-header: v1.0" \
+ -n HEAD^1 -o outdir &&
+ git send-email \
+ --dry-run \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ --validate \
+ outdir/000?-*.patch
+'
+
for enc in 7bit 8bit quoted-printable base64
do
test_expect_success $PREREQ "--transfer-encoding=$enc produces correct header" '
@@ -617,7 +707,7 @@ test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' '
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
test_cmp expect actual &&
# Second and subsequent messages are replies to the first one
- sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
+ sed -n -e "s/^Message-ID: *\(.*\)/\1/p" msgtxt1 >expect &&
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
test_cmp expect actual &&
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
@@ -637,10 +727,10 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
2>errors &&
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
test_cmp expect actual &&
- sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
+ sed -n -e "s/^Message-ID: *\(.*\)/\1/p" msgtxt1 >expect &&
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
test_cmp expect actual &&
- sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt2 >expect &&
+ sed -n -e "s/^Message-ID: *\(.*\)/\1/p" msgtxt2 >expect &&
sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
test_cmp expect actual
'
@@ -713,7 +803,7 @@ Cc: cc@example.com,
two@example.com
Subject: [PATCH 1/1] Second.
Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
X-Mailer: X-MAILER-STRING
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
@@ -759,7 +849,7 @@ Cc: A <author@example.com>,
two@example.com
Subject: [PATCH 1/1] Second.
Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
X-Mailer: X-MAILER-STRING
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
@@ -796,7 +886,7 @@ Cc: A <author@example.com>,
C O Mitter <committer@example.com>
Subject: [PATCH 1/1] Second.
Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
X-Mailer: X-MAILER-STRING
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
@@ -824,7 +914,7 @@ From: Example <from@example.com>
To: to@example.com
Subject: [PATCH 1/1] Second.
Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
X-Mailer: X-MAILER-STRING
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
@@ -860,7 +950,7 @@ Cc: A <author@example.com>,
cc-cmd@example.com
Subject: [PATCH 1/1] Second.
Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
X-Mailer: X-MAILER-STRING
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
@@ -893,7 +983,7 @@ Cc: A <author@example.com>,
two@example.com
Subject: [PATCH 1/1] Second.
Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
X-Mailer: X-MAILER-STRING
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
@@ -926,7 +1016,7 @@ Cc: A <author@example.com>,
two@example.com
Subject: [PATCH 1/1] Second.
Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
X-Mailer: X-MAILER-STRING
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
@@ -963,7 +1053,7 @@ Cc: A <author@example.com>,
C O Mitter <committer@example.com>
Subject: [PATCH 1/1] Second.
Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
X-Mailer: X-MAILER-STRING
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
@@ -993,7 +1083,7 @@ Cc: A <author@example.com>,
C O Mitter <committer@example.com>
Subject: [PATCH 1/1] Second.
Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
X-Mailer: X-MAILER-STRING
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
@@ -1478,7 +1568,7 @@ test_expect_success $PREREQ 'To headers from files reset each patch' '
test_expect_success $PREREQ 'setup expect' '
cat >email-using-8bit <<\EOF
From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
-Message-Id: <bogus-message-id@example.com>
+Message-ID: <bogus-message-id@example.com>
From: author@example.com
Date: Sat, 12 Jun 2010 15:53:58 +0200
Subject: subject goes here
@@ -1519,7 +1609,7 @@ test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '
grep "do not declare a Content-Transfer-Encoding" stdout &&
grep email-using-8bit stdout &&
grep "Which 8bit encoding" stdout &&
- egrep "Content|MIME" msgtxt1 >actual &&
+ grep -E "Content|MIME" msgtxt1 >actual &&
test_cmp content-type-decl actual
'
@@ -1530,7 +1620,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
git send-email --from=author@example.com --to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
email-using-8bit >stdout &&
- egrep "Content|MIME" msgtxt1 >actual &&
+ grep -E "Content|MIME" msgtxt1 >actual &&
test_cmp content-type-decl actual
'
@@ -1545,7 +1635,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding in .git/config overrides --g
git send-email --from=author@example.com --to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
email-using-8bit >stdout &&
- egrep "Content|MIME" msgtxt1 >actual &&
+ grep -E "Content|MIME" msgtxt1 >actual &&
test_cmp content-type-decl actual
'
@@ -1557,14 +1647,14 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
--smtp-server="$(pwd)/fake.sendmail" \
--8bit-encoding=UTF-8 \
email-using-8bit >stdout &&
- egrep "Content|MIME" msgtxt1 >actual &&
+ grep -E "Content|MIME" msgtxt1 >actual &&
test_cmp content-type-decl actual
'
test_expect_success $PREREQ 'setup expect' '
cat >email-using-8bit <<-\EOF
From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
- Message-Id: <bogus-message-id@example.com>
+ Message-ID: <bogus-message-id@example.com>
From: author@example.com
Date: Sat, 12 Jun 2010 15:53:58 +0200
Subject: Dieser Betreff enthält auch einen Umlaut!
@@ -1593,7 +1683,7 @@ test_expect_success $PREREQ '--8bit-encoding also treats subject' '
test_expect_success $PREREQ 'setup expect' '
cat >email-using-8bit <<-\EOF
From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
- Message-Id: <bogus-message-id@example.com>
+ Message-ID: <bogus-message-id@example.com>
From: A U Thor <author@example.com>
Date: Sat, 12 Jun 2010 15:53:58 +0200
Content-Type: text/plain; charset=UTF-8
@@ -1674,7 +1764,7 @@ test_expect_success $PREREQ '8-bit and sendemail.transferencoding=base64' '
test_expect_success $PREREQ 'setup expect' '
cat >email-using-qp <<-\EOF
From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
- Message-Id: <bogus-message-id@example.com>
+ Message-ID: <bogus-message-id@example.com>
From: A U Thor <author@example.com>
Date: Sat, 12 Jun 2010 15:53:58 +0200
MIME-Version: 1.0
@@ -1700,7 +1790,7 @@ test_expect_success $PREREQ 'convert from quoted-printable to base64' '
test_expect_success $PREREQ 'setup expect' "
tr -d '\\015' | tr '%' '\\015' >email-using-crlf <<EOF
From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
-Message-Id: <bogus-message-id@example.com>
+Message-ID: <bogus-message-id@example.com>
From: A U Thor <author@example.com>
Date: Sat, 12 Jun 2010 15:53:58 +0200
Content-Type: text/plain; charset=UTF-8
@@ -2326,6 +2416,37 @@ test_expect_success $PREREQ 'invoke hook' '
)
'
+expected_file_counter_output () {
+ total=$1
+ count=0
+ while test $count -ne $total
+ do
+ count=$((count + 1)) &&
+ echo "$count/$total" || return
+ done
+}
+
+test_expect_success $PREREQ '--validate hook allows counting of messages' '
+ test_when_finished "rm -rf my-hooks.log" &&
+ test_config core.hooksPath "my-hooks" &&
+ mkdir -p my-hooks &&
+
+ write_script my-hooks/sendemail-validate <<-\EOF &&
+ num=$GIT_SENDEMAIL_FILE_COUNTER &&
+ tot=$GIT_SENDEMAIL_FILE_TOTAL &&
+ echo "$num/$tot" >>my-hooks.log || exit 1
+ EOF
+
+ >my-hooks.log &&
+ expected_file_counter_output 4 >expect &&
+ git send-email \
+ --from="Example <from@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ --validate -3 --cover-letter --force &&
+ test_cmp expect my-hooks.log
+'
+
test_expect_success $PREREQ 'test that send-email works outside a repo' '
nongit git send-email \
--from="Example <nobody@example.com>" \
@@ -2334,6 +2455,12 @@ test_expect_success $PREREQ 'test that send-email works outside a repo' '
"$(pwd)/0001-add-main.patch"
'
+test_expect_success $PREREQ 'send-email relays -v 3 to format-patch' '
+ test_when_finished "rm -f out" &&
+ git send-email --dry-run -v 3 -1 >out &&
+ grep "PATCH v3" out
+'
+
test_expect_success $PREREQ 'test that sendmail config is rejected' '
test_config sendmail.program sendmail &&
test_must_fail git send-email \
diff --git a/t/t9003-help-autocorrect.sh b/t/t9003-help-autocorrect.sh
index f00deaf381..14a704d0a8 100755
--- a/t/t9003-help-autocorrect.sh
+++ b/t/t9003-help-autocorrect.sh
@@ -1,6 +1,8 @@
#!/bin/sh
test_description='help.autocorrect finding a match'
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
@@ -60,4 +62,10 @@ test_expect_success 'autocorrect can be declined altogether' '
test_line_count = 1 actual
'
+test_expect_success 'autocorrect works in work tree created from bare repo' '
+ git clone --bare . bare.git &&
+ git -C bare.git worktree add ../worktree &&
+ git -C worktree -c help.autocorrect=immediate stauts
+'
+
test_done
diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh
index 3cab0b9720..bca496c40e 100755
--- a/t/t9106-git-svn-commit-diff-clobber.sh
+++ b/t/t9106-git-svn-commit-diff-clobber.sh
@@ -3,7 +3,6 @@
# Copyright (c) 2006 Eric Wong
test_description='git svn commit-diff clobber'
-TEST_FAILS_SANITIZE_LEAK=true
. ./lib-git-svn.sh
test_expect_success 'initialize repo' '
diff --git a/t/t9115-git-svn-dcommit-funky-renames.sh b/t/t9115-git-svn-dcommit-funky-renames.sh
index 419f055721..743fbe1fe4 100755
--- a/t/t9115-git-svn-dcommit-funky-renames.sh
+++ b/t/t9115-git-svn-dcommit-funky-renames.sh
@@ -5,7 +5,6 @@
test_description='git svn dcommit can commit renames of files with ugly names'
-TEST_FAILS_SANITIZE_LEAK=true
. ./lib-git-svn.sh
test_expect_success 'load repository with strange names' '
diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh
index 8201c3e808..088d1c57a8 100755
--- a/t/t9119-git-svn-info.sh
+++ b/t/t9119-git-svn-info.sh
@@ -28,7 +28,7 @@ test_cmp_info () {
rm -f tmp.expect tmp.actual
}
-quoted_svnrepo="$(echo $svnrepo | sed 's/ /%20/')"
+quoted_svnrepo="$(echo $svnrepo | test_uri_escape)"
test_expect_success 'setup repository and import' '
mkdir info &&
diff --git a/t/t9133-git-svn-nested-git-repo.sh b/t/t9133-git-svn-nested-git-repo.sh
index f894860867..d8d536269c 100755
--- a/t/t9133-git-svn-nested-git-repo.sh
+++ b/t/t9133-git-svn-nested-git-repo.sh
@@ -35,7 +35,7 @@ test_expect_success 'SVN-side change outside of .git' '
echo b >> a &&
svn_cmd commit -m "SVN-side change outside of .git" &&
svn_cmd up &&
- svn_cmd log -v | fgrep "SVN-side change outside of .git"
+ svn_cmd log -v | grep -F "SVN-side change outside of .git"
)
'
@@ -59,7 +59,7 @@ test_expect_success 'SVN-side change inside of .git' '
svn_cmd add --force .git &&
svn_cmd commit -m "SVN-side change inside of .git" &&
svn_cmd up &&
- svn_cmd log -v | fgrep "SVN-side change inside of .git"
+ svn_cmd log -v | grep -F "SVN-side change inside of .git"
)
'
@@ -82,7 +82,7 @@ test_expect_success 'SVN-side change in and out of .git' '
git commit -m "add a inside an SVN repo" &&
svn_cmd commit -m "SVN-side change in and out of .git" &&
svn_cmd up &&
- svn_cmd log -v | fgrep "SVN-side change in and out of .git"
+ svn_cmd log -v | grep -F "SVN-side change in and out of .git"
)
'
diff --git a/t/t9134-git-svn-ignore-paths.sh b/t/t9134-git-svn-ignore-paths.sh
index 4a77eb9f60..3188400226 100755
--- a/t/t9134-git-svn-ignore-paths.sh
+++ b/t/t9134-git-svn-ignore-paths.sh
@@ -43,7 +43,7 @@ test_expect_success 'init+fetch an SVN repository with ignored www directory' '
test_expect_success 'verify ignore-paths config saved by clone' '
(
cd g &&
- git config --get svn-remote.svn.ignore-paths | fgrep "www"
+ git config --get svn-remote.svn.ignore-paths | grep www
)
'
@@ -53,7 +53,7 @@ test_expect_success 'SVN-side change outside of www' '
echo b >> qqq/test_qqq.txt &&
svn_cmd commit -m "SVN-side change outside of www" &&
svn_cmd up &&
- svn_cmd log -v | fgrep "SVN-side change outside of www"
+ svn_cmd log -v | grep "SVN-side change outside of www"
)
'
@@ -85,7 +85,7 @@ test_expect_success 'SVN-side change inside of ignored www' '
echo zaq >> www/test_www.txt &&
svn_cmd commit -m "SVN-side change inside of www/test_www.txt" &&
svn_cmd up &&
- svn_cmd log -v | fgrep "SVN-side change inside of www/test_www.txt"
+ svn_cmd log -v | grep -F "SVN-side change inside of www/test_www.txt"
)
'
@@ -118,7 +118,7 @@ test_expect_success 'SVN-side change in and out of ignored www' '
echo ygg >> qqq/test_qqq.txt &&
svn_cmd commit -m "SVN-side change in and out of ignored www" &&
svn_cmd up &&
- svn_cmd log -v | fgrep "SVN-side change in and out of ignored www"
+ svn_cmd log -v | grep "SVN-side change in and out of ignored www"
)
'
diff --git a/t/t9140-git-svn-reset.sh b/t/t9140-git-svn-reset.sh
index e855904629..a420b2a87a 100755
--- a/t/t9140-git-svn-reset.sh
+++ b/t/t9140-git-svn-reset.sh
@@ -43,7 +43,7 @@ test_expect_success 'fetch fails on modified hidden file' '
git svn find-rev refs/remotes/git-svn > ../expect &&
test_must_fail git svn fetch 2> ../errors &&
git svn find-rev refs/remotes/git-svn > ../expect2 ) &&
- fgrep "not found in commit" errors &&
+ grep "not found in commit" errors &&
test_cmp expect expect2
'
@@ -59,7 +59,7 @@ test_expect_success 'refetch succeeds not ignoring any files' '
( cd g &&
git svn fetch &&
git svn rebase &&
- fgrep "mod hidden" hid/hid.txt
+ grep "mod hidden" hid/hid.txt
)
'
diff --git a/t/t9146-git-svn-empty-dirs.sh b/t/t9146-git-svn-empty-dirs.sh
index 79c26ed69c..09606f1b3c 100755
--- a/t/t9146-git-svn-empty-dirs.sh
+++ b/t/t9146-git-svn-empty-dirs.sh
@@ -4,7 +4,6 @@
test_description='git svn creates empty directories'
-TEST_FAILS_SANITIZE_LEAK=true
. ./lib-git-svn.sh
test_expect_success 'initialize repo' '
diff --git a/t/t9147-git-svn-include-paths.sh b/t/t9147-git-svn-include-paths.sh
index 257fc8f2f8..63fa0b6732 100755
--- a/t/t9147-git-svn-include-paths.sh
+++ b/t/t9147-git-svn-include-paths.sh
@@ -45,7 +45,7 @@ test_expect_success 'init+fetch an SVN repository with included qqq directory' '
test_expect_success 'verify include-paths config saved by clone' '
(
cd g &&
- git config --get svn-remote.svn.include-paths | fgrep "qqq"
+ git config --get svn-remote.svn.include-paths | grep qqq
)
'
@@ -55,7 +55,7 @@ test_expect_success 'SVN-side change outside of www' '
echo b >> qqq/test_qqq.txt &&
svn_cmd commit -m "SVN-side change outside of www" &&
svn_cmd up &&
- svn_cmd log -v | fgrep "SVN-side change outside of www"
+ svn_cmd log -v | grep "SVN-side change outside of www"
)
'
@@ -87,7 +87,7 @@ test_expect_success 'SVN-side change inside of ignored www' '
echo zaq >> www/test_www.txt &&
svn_cmd commit -m "SVN-side change inside of www/test_www.txt" &&
svn_cmd up &&
- svn_cmd log -v | fgrep "SVN-side change inside of www/test_www.txt"
+ svn_cmd log -v | grep "SVN-side change inside of www/test_www.txt"
)
'
@@ -120,7 +120,7 @@ test_expect_success 'SVN-side change in and out of included qqq' '
echo ygg >> qqq/test_qqq.txt &&
svn_cmd commit -m "SVN-side change in and out of ignored www" &&
svn_cmd up &&
- svn_cmd log -v | fgrep "SVN-side change in and out of ignored www"
+ svn_cmd log -v | grep "SVN-side change in and out of ignored www"
)
'
diff --git a/t/t9148-git-svn-propset.sh b/t/t9148-git-svn-propset.sh
index 6cc76a07b3..aebb28995e 100755
--- a/t/t9148-git-svn-propset.sh
+++ b/t/t9148-git-svn-propset.sh
@@ -5,7 +5,6 @@
test_description='git svn propset tests'
-TEST_FAILS_SANITIZE_LEAK=true
. ./lib-git-svn.sh
test_expect_success 'setup propset via import' '
diff --git a/t/t9160-git-svn-preserve-empty-dirs.sh b/t/t9160-git-svn-preserve-empty-dirs.sh
index 9cf7a1427a..36c6b1a12f 100755
--- a/t/t9160-git-svn-preserve-empty-dirs.sh
+++ b/t/t9160-git-svn-preserve-empty-dirs.sh
@@ -9,7 +9,6 @@ This test uses git to clone a Subversion repository that contains empty
directories, and checks that corresponding directories are created in the
local Git repository with placeholder files.'
-TEST_FAILS_SANITIZE_LEAK=true
. ./lib-git-svn.sh
GIT_REPO=git-svn-repo
diff --git a/t/t9164-git-svn-dcommit-concurrent.sh b/t/t9164-git-svn-dcommit-concurrent.sh
index 1465156072..c8e6c0733f 100755
--- a/t/t9164-git-svn-dcommit-concurrent.sh
+++ b/t/t9164-git-svn-dcommit-concurrent.sh
@@ -5,7 +5,6 @@
test_description='concurrent git svn dcommit'
-TEST_FAILS_SANITIZE_LEAK=true
. ./lib-git-svn.sh
diff --git a/t/t9210-scalar.sh b/t/t9210-scalar.sh
index 14ca575a21..4432a30d10 100755
--- a/t/t9210-scalar.sh
+++ b/t/t9210-scalar.sh
@@ -104,6 +104,13 @@ test_expect_success FSMONITOR_DAEMON 'scalar register starts fsmon daemon' '
test_cmp_config -C test/src true core.fsmonitor
'
+test_expect_success 'scalar register warns when background maintenance fails' '
+ git init register-repo &&
+ GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \
+ scalar register register-repo 2>err &&
+ grep "could not turn on maintenance" err
+'
+
test_expect_success 'scalar unregister' '
git init vanish/src &&
scalar register vanish/src &&
@@ -116,7 +123,10 @@ test_expect_success 'scalar unregister' '
test_must_fail git config --get --global --fixed-value \
maintenance.repo "$(pwd)/vanish/src" &&
scalar list >scalar.repos &&
- ! grep -F "$(pwd)/vanish/src" scalar.repos
+ ! grep -F "$(pwd)/vanish/src" scalar.repos &&
+
+ # scalar unregister should be idempotent
+ scalar unregister vanish
'
test_expect_success 'set up repository to clone' '
@@ -163,6 +173,20 @@ test_expect_success 'scalar reconfigure' '
test true = "$(git -C one/src config core.preloadIndex)"
'
+test_expect_success '`reconfigure -a` removes stale config entries' '
+ git init stale/src &&
+ scalar register stale &&
+ scalar list >scalar.repos &&
+ grep stale scalar.repos &&
+
+ grep -v stale scalar.repos >expect &&
+
+ rm -rf stale &&
+ scalar reconfigure -a &&
+ scalar list >scalar.repos &&
+ test_cmp expect scalar.repos
+'
+
test_expect_success 'scalar delete without enlistment shows a usage' '
test_expect_code 129 scalar delete
'
diff --git a/t/t9211-scalar-clone.sh b/t/t9211-scalar-clone.sh
index dd33d87e9b..872ad1c9c2 100755
--- a/t/t9211-scalar-clone.sh
+++ b/t/t9211-scalar-clone.sh
@@ -3,6 +3,7 @@
test_description='test the `scalar clone` subcommand'
. ./test-lib.sh
+. "${TEST_DIRECTORY}/lib-terminal.sh"
GIT_TEST_MAINT_SCHEDULER="crontab:test-tool crontab cron.txt,launchctl:true,schtasks:true"
export GIT_TEST_MAINT_SCHEDULER
@@ -148,4 +149,35 @@ test_expect_success '--no-single-branch clones all branches' '
cleanup_clone $enlistment
'
+test_expect_success TTY 'progress with tty' '
+ enlistment=progress1 &&
+
+ test_config -C to-clone uploadpack.allowfilter true &&
+ test_config -C to-clone uploadpack.allowanysha1inwant true &&
+
+ test_terminal env GIT_PROGRESS_DELAY=0 \
+ scalar clone "file://$(pwd)/to-clone" "$enlistment" 2>stderr &&
+ grep "Enumerating objects" stderr >actual &&
+ test_line_count = 2 actual &&
+ cleanup_clone $enlistment
+'
+
+test_expect_success 'progress without tty' '
+ enlistment=progress2 &&
+
+ test_config -C to-clone uploadpack.allowfilter true &&
+ test_config -C to-clone uploadpack.allowanysha1inwant true &&
+
+ GIT_PROGRESS_DELAY=0 scalar clone "file://$(pwd)/to-clone" "$enlistment" 2>stderr &&
+ ! grep "Enumerating objects" stderr &&
+ ! grep "Updating files" stderr &&
+ cleanup_clone $enlistment
+'
+
+test_expect_success 'scalar clone warns when background maintenance fails' '
+ GIT_TEST_MAINT_SCHEDULER="crontab:false,launchctl:false,schtasks:false" \
+ scalar clone "file://$(pwd)/to-clone" maint-fail 2>err &&
+ grep "could not turn on maintenance" err
+'
+
test_done
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index aa55b41b9a..ac237a1f90 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -388,9 +388,7 @@ test_expect_success 'B: accept branch name "TEMP_TAG"' '
INPUT_END
- test_when_finished "rm -f .git/TEMP_TAG
- git gc
- git prune" &&
+ test_when_finished "rm -f .git/TEMP_TAG && git gc --prune=now" &&
git fast-import <input &&
test $(test-tool ref-store main resolve-ref TEMP_TAG 0 | cut -f1 -d " " ) != "$ZERO_OID" &&
test $(git rev-parse main) = $(git rev-parse TEMP_TAG^)
@@ -406,8 +404,7 @@ test_expect_success 'B: accept empty committer' '
INPUT_END
test_when_finished "git update-ref -d refs/heads/empty-committer-1
- git gc
- git prune" &&
+ git gc --prune=now" &&
git fast-import <input &&
out=$(git fsck) &&
echo "$out" &&
@@ -452,8 +449,7 @@ test_expect_success 'B: accept and fixup committer with no name' '
INPUT_END
test_when_finished "git update-ref -d refs/heads/empty-committer-2
- git gc
- git prune" &&
+ git gc --prune=now" &&
git fast-import <input &&
out=$(git fsck) &&
echo "$out" &&
@@ -1778,8 +1774,7 @@ test_expect_success 'P: verbatim SHA gitlinks' '
INPUT_END
git branch -D sub &&
- git gc &&
- git prune &&
+ git gc --prune=now &&
git fast-import <input &&
test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)
'
diff --git a/t/t9304-fast-import-marks.sh b/t/t9304-fast-import-marks.sh
index a98ef032d9..410a871c52 100755
--- a/t/t9304-fast-import-marks.sh
+++ b/t/t9304-fast-import-marks.sh
@@ -49,4 +49,33 @@ test_expect_success 'import with submodule mapping' '
test_cmp expect actual
'
+test_expect_success 'paths adjusted for relative subdir' '
+ git init deep-dst &&
+ mkdir deep-dst/subdir &&
+ >deep-dst/subdir/empty-marks &&
+ git -C deep-dst/subdir fast-import \
+ --rewrite-submodules-from=sub:../../from \
+ --rewrite-submodules-to=sub:../../to \
+ --import-marks=empty-marks \
+ --export-marks=exported-marks \
+ --export-pack-edges=exported-edges \
+ <dump &&
+ # we do not bother checking resulting repo; we just care that nothing
+ # complained about failing to open files for reading, and that files
+ # for writing were created in the expected spot
+ test_path_is_file deep-dst/subdir/exported-marks &&
+ test_path_is_file deep-dst/subdir/exported-edges
+'
+
+test_expect_success 'relative marks are not affected by subdir' '
+ git init deep-relative &&
+ mkdir deep-relative/subdir &&
+ git -C deep-relative/subdir fast-import \
+ --relative-marks \
+ --export-marks=exported-marks \
+ <dump &&
+ test_path_is_missing deep-relative/subdir/exported-marks &&
+ test_path_is_file deep-relative/.git/info/fast-import/exported-marks
+'
+
test_done
diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh
index ff21a12ee6..26c25c0eb2 100755
--- a/t/t9350-fast-export.sh
+++ b/t/t9350-fast-export.sh
@@ -373,7 +373,7 @@ EOF
test_expect_success 'cope with tagger-less tags' '
- TAG=$(git hash-object -t tag -w tag-content) &&
+ TAG=$(git hash-object --literally -t tag -w tag-content) &&
git update-ref refs/tags/sonnenschein $TAG &&
git fast-export -C -C --signed-tags=strip --all > output &&
test $(grep -c "^tag " output) = 4 &&
diff --git a/t/t9351-fast-export-anonymize.sh b/t/t9351-fast-export-anonymize.sh
index 77047e250d..156a647484 100755
--- a/t/t9351-fast-export-anonymize.sh
+++ b/t/t9351-fast-export-anonymize.sh
@@ -25,6 +25,7 @@ test_expect_success 'setup simple repo' '
test_expect_success 'export anonymized stream' '
git fast-export --anonymize --all \
--anonymize-map=retain-me \
+ --anonymize-map=xyzzy:should-not-appear \
--anonymize-map=xyzzy:custom-name \
--anonymize-map=other \
>stream
@@ -41,6 +42,7 @@ test_expect_success 'stream omits path names' '
test_expect_success 'stream contains user-specified names' '
grep retain-me stream &&
+ ! grep should-not-appear stream &&
grep custom-name stream
'
diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh
index 4aa5d90d32..ccc8212d73 100755
--- a/t/t9700-perl-git.sh
+++ b/t/t9700-perl-git.sh
@@ -13,37 +13,40 @@ skip_all_if_no_Test_More
# set up test repository
-test_expect_success \
- 'set up test repository' \
- 'echo "test file 1" > file1 &&
- echo "test file 2" > file2 &&
- mkdir directory1 &&
- echo "in directory1" >> directory1/file &&
- mkdir directory2 &&
- echo "in directory2" >> directory2/file &&
- git add . &&
- git commit -m "first commit" &&
-
- echo "new file in subdir 2" > directory2/file2 &&
- git add . &&
- git commit -m "commit in directory2" &&
-
- echo "changed file 1" > file1 &&
- git commit -a -m "second commit" &&
-
- git config --add color.test.slot1 green &&
- git config --add test.string value &&
- git config --add test.dupstring value1 &&
- git config --add test.dupstring value2 &&
- git config --add test.booltrue true &&
- git config --add test.boolfalse no &&
- git config --add test.boolother other &&
- git config --add test.int 2k &&
- git config --add test.path "~/foo" &&
- git config --add test.pathexpanded "$HOME/foo" &&
- git config --add test.pathmulti foo &&
- git config --add test.pathmulti bar
- '
+test_expect_success 'set up test repository' '
+ echo "test file 1" >file1 &&
+ echo "test file 2" >file2 &&
+ mkdir directory1 &&
+ echo "in directory1" >>directory1/file &&
+ mkdir directory2 &&
+ echo "in directory2" >>directory2/file &&
+ git add . &&
+ git commit -m "first commit" &&
+
+ echo "new file in subdir 2" >directory2/file2 &&
+ git add . &&
+ git commit -m "commit in directory2" &&
+
+ echo "changed file 1" >file1 &&
+ git commit -a -m "second commit" &&
+
+ git config --add color.test.slot1 green &&
+ git config --add test.string value &&
+ git config --add test.dupstring value1 &&
+ git config --add test.dupstring value2 &&
+ git config --add test.booltrue true &&
+ git config --add test.boolfalse no &&
+ git config --add test.boolother other &&
+ git config --add test.int 2k &&
+ git config --add test.path "~/foo" &&
+ git config --add test.pathexpanded "$HOME/foo" &&
+ git config --add test.pathmulti foo &&
+ git config --add test.pathmulti bar
+'
+
+test_expect_success 'set up bare repository' '
+ git init --bare bare.git
+'
test_expect_success 'use t9700/test.pl to test Git.pm' '
"$PERL_PATH" "$TEST_DIRECTORY"/t9700/test.pl 2>stderr &&
diff --git a/t/t9700/test.pl b/t/t9700/test.pl
index e046f7db76..6d753708d2 100755
--- a/t/t9700/test.pl
+++ b/t/t9700/test.pl
@@ -30,6 +30,18 @@ BEGIN { use_ok('Git') }
# set up
our $abs_repo_dir = cwd();
ok(our $r = Git->repository(Directory => "."), "open repository");
+{
+ local $ENV{GIT_TEST_ASSUME_DIFFERENT_OWNER} = 1;
+ my $failed;
+
+ $failed = eval { Git->repository(Directory => $abs_repo_dir) };
+ ok(!$failed, "reject unsafe non-bare repository");
+ like($@, qr/not a git repository/i, "unsafe error message");
+
+ $failed = eval { Git->repository(Directory => "$abs_repo_dir/bare.git") };
+ ok(!$failed, "reject unsafe bare repository");
+ like($@, qr/not a git repository/i, "unsafe error message");
+}
# config
is($r->config("test.string"), "value", "config scalar: string");
diff --git a/t/t9814-git-p4-rename.sh b/t/t9814-git-p4-rename.sh
index 468767cbf4..2a9838f37f 100755
--- a/t/t9814-git-p4-rename.sh
+++ b/t/t9814-git-p4-rename.sh
@@ -216,7 +216,7 @@ test_expect_success 'detect copies' '
# variable exists, which allows admins to disable the "p4 move" command.
test_lazy_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW '
p4 configure show run.move.allow >out &&
- egrep ^run.move.allow: out
+ grep -E ^run.move.allow: out
'
# If move can be disabled, turn it off and test p4 move handling
diff --git a/t/t9815-git-p4-submit-fail.sh b/t/t9815-git-p4-submit-fail.sh
index 9779dc0d11..0ca9937de6 100755
--- a/t/t9815-git-p4-submit-fail.sh
+++ b/t/t9815-git-p4-submit-fail.sh
@@ -417,8 +417,8 @@ test_expect_success 'cleanup chmod after submit cancel' '
! p4 fstat -T action text &&
test_path_is_file text+x &&
! p4 fstat -T action text+x &&
- ls -l text | egrep ^-r-- &&
- ls -l text+x | egrep ^-r-x
+ ls -l text | grep -E ^-r-- &&
+ ls -l text+x | grep -E ^-r-x
)
'
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 43de868b80..d6c0478d98 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -2255,6 +2255,36 @@ test_expect_success 'checkout completes ref names' '
EOF
'
+test_expect_success 'checkout does not match ref names of a different case' '
+ test_completion "git checkout M" ""
+'
+
+test_expect_success 'checkout matches case insensitively with GIT_COMPLETION_IGNORE_CASE' '
+ (
+ GIT_COMPLETION_IGNORE_CASE=1 &&
+ test_completion "git checkout M" <<-\EOF
+ main Z
+ mybranch Z
+ mytag Z
+ EOF
+ )
+'
+
+test_expect_success 'checkout completes pseudo refs' '
+ test_completion "git checkout H" <<-\EOF
+ HEAD Z
+ EOF
+'
+
+test_expect_success 'checkout completes pseudo refs case insensitively with GIT_COMPLETION_IGNORE_CASE' '
+ (
+ GIT_COMPLETION_IGNORE_CASE=1 &&
+ test_completion "git checkout h" <<-\EOF
+ HEAD Z
+ EOF
+ )
+'
+
test_expect_success 'git -C <path> checkout uses the right repo' '
test_completion "git -C subdir -C subsubdir -C .. -C ../otherrepo checkout b" <<-\EOF
branch-in-other Z
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index d459fae655..d667dda654 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -13,10 +13,10 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
. "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh"
actual="$TRASH_DIRECTORY/actual"
-c_red='\\[\\e[31m\\]'
-c_green='\\[\\e[32m\\]'
-c_lblue='\\[\\e[1;34m\\]'
-c_clear='\\[\\e[0m\\]'
+c_red='\001\e[31m\002'
+c_green='\001\e[32m\002'
+c_lblue='\001\e[1;34m\002'
+c_clear='\001\e[0m\002'
test_expect_success 'setup for prompt tests' '
git init otherrepo &&
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index c6479f24eb..999d46fafe 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -32,6 +32,14 @@ test_set_editor () {
export EDITOR
}
+# Like test_set_editor but sets GIT_SEQUENCE_EDITOR instead of EDITOR
+test_set_sequence_editor () {
+ FAKE_SEQUENCE_EDITOR="$1"
+ export FAKE_SEQUENCE_EDITOR
+ GIT_SEQUENCE_EDITOR='"$FAKE_SEQUENCE_EDITOR"'
+ export GIT_SEQUENCE_EDITOR
+}
+
test_decode_color () {
awk '
function name(n) {
@@ -273,13 +281,13 @@ debug () {
# <file>, <contents>, and <tag> all default to <message>.
test_commit () {
- notick= &&
- echo=echo &&
- append= &&
- author= &&
- signoff= &&
- indir= &&
- tag=light &&
+ local notick= &&
+ local echo=echo &&
+ local append= &&
+ local author= &&
+ local signoff= &&
+ local indir= &&
+ local tag=light &&
while test $# != 0
do
case "$1" in
@@ -322,7 +330,7 @@ test_commit () {
shift
done &&
indir=${indir:+"$indir"/} &&
- file=${2:-"$1.t"} &&
+ local file=${2:-"$1.t"} &&
if test -n "$append"
then
$echo "${3-$1}" >>"$indir$file"
@@ -897,7 +905,7 @@ test_path_is_symlink () {
test_dir_is_empty () {
test "$#" -ne 1 && BUG "1 param"
test_path_is_dir "$1" &&
- if test -n "$(ls -a1 "$1" | egrep -v '^\.\.?$')"
+ if test -n "$(ls -a1 "$1" | grep -E -v '^\.\.?$')"
then
echo "Directory '$1' is not empty, it contains:"
ls -la "$1"
@@ -921,10 +929,6 @@ test_path_is_missing () {
then
echo "Path exists:"
ls -ld "$1"
- if test $# -ge 1
- then
- echo "$*"
- fi
false
fi
}
@@ -1020,7 +1024,7 @@ test_must_fail_acceptable () {
fi
case "$1" in
- git|__git*|test-tool|test_terminal)
+ git|__git*|scalar|test-tool|test_terminal)
return 0
;;
*)
@@ -1426,7 +1430,7 @@ test_bool_env () {
BUG "test_bool_env requires two parameters (variable name and default value)"
fi
- git env--helper --type=bool --default="$2" --exit-code "$1"
+ test-tool env-helper --type=bool --default="$2" --exit-code "$1"
ret=$?
case $ret in
0|1) # unset or valid bool value
@@ -1454,72 +1458,6 @@ test_skip_or_die () {
error "$2"
}
-# The following mingw_* functions obey POSIX shell syntax, but are actually
-# bash scripts, and are meant to be used only with bash on Windows.
-
-# A test_cmp function that treats LF and CRLF equal and avoids to fork
-# diff when possible.
-mingw_test_cmp () {
- # Read text into shell variables and compare them. If the results
- # are different, use regular diff to report the difference.
- local test_cmp_a= test_cmp_b=
-
- # When text came from stdin (one argument is '-') we must feed it
- # to diff.
- local stdin_for_diff=
-
- # Since it is difficult to detect the difference between an
- # empty input file and a failure to read the files, we go straight
- # to diff if one of the inputs is empty.
- if test -s "$1" && test -s "$2"
- then
- # regular case: both files non-empty
- mingw_read_file_strip_cr_ test_cmp_a <"$1"
- mingw_read_file_strip_cr_ test_cmp_b <"$2"
- elif test -s "$1" && test "$2" = -
- then
- # read 2nd file from stdin
- mingw_read_file_strip_cr_ test_cmp_a <"$1"
- mingw_read_file_strip_cr_ test_cmp_b
- stdin_for_diff='<<<"$test_cmp_b"'
- elif test "$1" = - && test -s "$2"
- then
- # read 1st file from stdin
- mingw_read_file_strip_cr_ test_cmp_a
- mingw_read_file_strip_cr_ test_cmp_b <"$2"
- stdin_for_diff='<<<"$test_cmp_a"'
- fi
- test -n "$test_cmp_a" &&
- test -n "$test_cmp_b" &&
- test "$test_cmp_a" = "$test_cmp_b" ||
- eval "diff -u \"\$@\" $stdin_for_diff"
-}
-
-# $1 is the name of the shell variable to fill in
-mingw_read_file_strip_cr_ () {
- # Read line-wise using LF as the line separator
- # and use IFS to strip CR.
- local line
- while :
- do
- if IFS=$'\r' read -r -d $'\n' line
- then
- # good
- line=$line$'\n'
- else
- # we get here at EOF, but also if the last line
- # was not terminated by LF; in the latter case,
- # some text was read
- if test -z "$line"
- then
- # EOF, really
- break
- fi
- fi
- eval "$1=\$$1\$line"
- done
-}
-
# Like "env FOO=BAR some-program", but run inside a subshell, which means
# it also works for shell functions (though those functions cannot impact
# the environment outside of the test_env invocation).
@@ -1686,7 +1624,7 @@ test_oid () {
then
BUG "undefined key '$1'"
fi &&
- eval "printf '%s' \"\${$var}\""
+ eval "printf '%s\n' \"\${$var}\""
}
# Insert a slash into an object ID so it can be used to reference a location
@@ -1755,6 +1693,13 @@ test_path_is_hidden () {
return 1
}
+# Poor man's URI escaping. Good enough for the test suite whose trash
+# directory has a space in it. See 93c3fcbe4d4 (git-svn: attempt to
+# mimic SVN 1.7 URL canonicalization, 2012-07-28) for prior art.
+test_uri_escape() {
+ sed 's/ /%20/g'
+}
+
# Check that the given command was invoked as part of the
# trace2-format trace on stdin.
#
@@ -1830,6 +1775,14 @@ test_region () {
return 0
}
+# Given a GIT_TRACE2_EVENT log over stdin, writes to stdout a list of URLs
+# sent to git-remote-https child processes.
+test_remote_https_urls() {
+ grep -e '"event":"child_start".*"argv":\["git-remote-https",".*"\]' |
+ sed -e 's/{"event":"child_start".*"argv":\["git-remote-https","//g' \
+ -e 's/"\]}//g'
+}
+
# Print the destination of symlink(s) provided as arguments. Basically
# the same as the readlink command, but it's not available everywhere.
test_readlink () {
@@ -1868,3 +1821,22 @@ test_is_magic_mtime () {
rm -f .git/test-mtime-actual
return $ret
}
+
+# Given two filenames, parse both using 'git config --list --file'
+# and compare the sorted output of those commands. Useful when
+# wanting to ignore whitespace differences and sorting concerns.
+test_cmp_config_output () {
+ git config --list --file="$1" >config-expect &&
+ git config --list --file="$2" >config-actual &&
+ sort config-expect >sorted-expect &&
+ sort config-actual >sorted-actual &&
+ test_cmp sorted-expect sorted-actual
+}
+
+# Given a filename, extract its trailing hash as a hex string
+test_trailing_hash () {
+ local file="$1" &&
+ tail -c $(test_oid rawsz) "$file" |
+ test-tool hexdump |
+ sed "s/ //g"
+}
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 6ca68311eb..293caf0f20 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -47,6 +47,16 @@ then
echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
exit 1
fi
+if test -f "$GIT_BUILD_DIR/GIT-BUILD-DIR"
+then
+ GIT_BUILD_DIR="$(cat "$GIT_BUILD_DIR/GIT-BUILD-DIR")" || exit 1
+ # On Windows, we must convert Windows paths lest they contain a colon
+ case "$(uname -s)" in
+ *MINGW*)
+ GIT_BUILD_DIR="$(cygpath -au "$GIT_BUILD_DIR")"
+ ;;
+ esac
+fi
# Prepend a string to a VAR using an arbitrary ":" delimiter, not
# adding the delimiter if VAR or VALUE is empty. I.e. a generalized:
@@ -635,12 +645,6 @@ u200c=$(printf '\342\200\214')
export _x05 _x35 LF u200c EMPTY_TREE EMPTY_BLOB ZERO_OID OID_REGEX
-# Each test should start with something like this, after copyright notices:
-#
-# test_description='Description of this test...
-# This test checks if command xyzzy does the right thing...
-# '
-# . ./test-lib.sh
test "x$TERM" != "xdumb" && (
test -t 1 &&
tput bold >/dev/null 2>&1 &&
@@ -1037,10 +1041,7 @@ want_trace () {
# (and we want to make sure we run any cleanup like
# "set +x").
test_eval_inner_ () {
- # Do not add anything extra (including LF) after '$*'
- eval "
- want_trace && trace_level_=$(($trace_level_+1)) && set -x
- $*"
+ eval "$*"
}
test_eval_ () {
@@ -1065,7 +1066,10 @@ test_eval_ () {
# be _inside_ the block to avoid polluting the "set -x" output
#
- test_eval_inner_ "$@" </dev/null >&3 2>&4
+ # Do not add anything extra (including LF) after '$*'
+ test_eval_inner_ </dev/null >&3 2>&4 "
+ want_trace && trace_level_=$(($trace_level_+1)) && set -x
+ $*"
{
test_eval_ret_=$?
if want_trace
@@ -1082,22 +1086,22 @@ test_eval_ () {
return $test_eval_ret_
}
+fail_117 () {
+ return 117
+}
+
test_run_ () {
test_cleanup=:
expecting_failure=$2
if test "${GIT_TEST_CHAIN_LINT:-1}" != 0; then
- # turn off tracing for this test-eval, as it simply creates
- # confusing noise in the "-x" output
- trace_tmp=$trace
- trace=
# 117 is magic because it is unlikely to match the exit
# code of other programs
- if test "OK-117" != "$(test_eval_ "(exit 117) && $1${LF}${LF}echo OK-\$?" 3>&1)"
+ test_eval_inner_ "fail_117 && $1" </dev/null >&3 2>&4
+ if test $? != 117
then
- BUG "broken &&-chain or run-away HERE-DOC: $1"
+ BUG "broken &&-chain: $1"
fi
- trace=$trace_tmp
fi
setup_malloc_check
@@ -1532,8 +1536,8 @@ then
# Normalize with test_bool_env
passes_sanitize_leak=
- # We need to see TEST_PASSES_SANITIZE_LEAK in "git
- # env--helper" (via test_bool_env)
+ # 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
@@ -1589,7 +1593,8 @@ then
BAIL_OUT_ENV_NEEDS_SANITIZE_LEAK "GIT_TEST_SANITIZE_LEAK_LOG=true"
fi
-if test "${GIT_TEST_CHAIN_LINT:-1}" != 0
+if test "${GIT_TEST_CHAIN_LINT:-1}" != 0 &&
+ test "${GIT_TEST_EXT_CHAIN_LINT:-1}" != 0
then
"$PERL_PATH" "$TEST_DIRECTORY/chainlint.pl" "$0" ||
BUG "lint error (see '?!...!? annotations above)"
@@ -1672,7 +1677,7 @@ yes () {
# The GIT_TEST_FAIL_PREREQS code hooks into test_set_prereq(), and
# thus needs to be set up really early, and set an internal variable
# for convenience so the hot test_set_prereq() codepath doesn't need
-# to call "git env--helper" (via test_bool_env). Only do that work
+# to call "test-tool env-helper" (via test_bool_env). Only do that work
# if needed by seeing if GIT_TEST_FAIL_PREREQS is set at all.
GIT_TEST_FAIL_PREREQS_INTERNAL=
if test -n "$GIT_TEST_FAIL_PREREQS"
@@ -1711,7 +1716,7 @@ case $uname_s in
test_set_prereq SED_STRIPS_CR
test_set_prereq GREP_STRIPS_CR
test_set_prereq WINDOWS
- GIT_TEST_CMP=mingw_test_cmp
+ GIT_TEST_CMP="GIT_DIR=/dev/null git diff --no-index --ignore-cr-at-eol --"
;;
*CYGWIN*)
test_set_prereq POSIXPERM
@@ -1927,10 +1932,6 @@ test_lazy_prereq SHA1 '
esac
'
-test_lazy_prereq ADD_I_USE_BUILTIN '
- test_bool_env GIT_TEST_ADD_I_USE_BUILTIN true
-'
-
# Ensure that no test accidentally triggers a Git command
# that runs the actual maintenance scheduler, affecting a user's
# system permanently.
diff --git a/tag.c b/tag.c
index dfbcd7fcc2..96dbd5b2d5 100644
--- a/tag.c
+++ b/tag.c
@@ -1,12 +1,16 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "environment.h"
#include "tag.h"
+#include "object-name.h"
#include "object-store.h"
#include "commit.h"
#include "tree.h"
#include "blob.h"
#include "alloc.h"
#include "gpg-interface.h"
+#include "hex.h"
#include "packfile.h"
+#include "wrapper.h"
const char *tag_type = "tag";
@@ -51,15 +55,15 @@ int gpg_verify_tag(const struct object_id *oid, const char *name_to_report,
return error("%s: cannot verify a non-tag object of type %s.",
name_to_report ?
name_to_report :
- find_unique_abbrev(oid, DEFAULT_ABBREV),
+ repo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV),
type_name(type));
- buf = read_object_file(oid, &type, &size);
+ buf = repo_read_object_file(the_repository, oid, &type, &size);
if (!buf)
return error("%s: unable to read file.",
name_to_report ?
name_to_report :
- find_unique_abbrev(oid, DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, oid, DEFAULT_ABBREV));
ret = run_gpg_verify(buf, size, flags);
@@ -216,7 +220,8 @@ int parse_tag(struct tag *item)
if (item->object.parsed)
return 0;
- data = read_object_file(&item->object.oid, &type, &size);
+ data = repo_read_object_file(the_repository, &item->object.oid, &type,
+ &size);
if (!data)
return error("Could not read %s",
oid_to_hex(&item->object.oid));
diff --git a/tempfile.c b/tempfile.c
index e27048f970..50c377134c 100644
--- a/tempfile.c
+++ b/tempfile.c
@@ -42,9 +42,11 @@
* file created by its parent.
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "path.h"
#include "tempfile.h"
#include "sigchain.h"
+#include "wrapper.h"
static VOLATILE_LIST_HEAD(tempfile_list);
diff --git a/templates/hooks--sendemail-validate.sample b/templates/hooks--sendemail-validate.sample
new file mode 100755
index 0000000000..640bcf874d
--- /dev/null
+++ b/templates/hooks--sendemail-validate.sample
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+# An example hook script to validate a patch (and/or patch series) before
+# sending it via email.
+#
+# The hook should exit with non-zero status after issuing an appropriate
+# message if it wants to prevent the email(s) from being sent.
+#
+# To enable this hook, rename this file to "sendemail-validate".
+#
+# By default, it will only check that the patch(es) can be applied on top of
+# the default upstream branch without conflicts in a secondary worktree. After
+# validation (successful or not) of the last patch of a series, the worktree
+# will be deleted.
+#
+# The following config variables can be set to change the default remote and
+# remote ref that are used to apply the patches against:
+#
+# sendemail.validateRemote (default: origin)
+# sendemail.validateRemoteRef (default: HEAD)
+#
+# Replace the TODO placeholders with appropriate checks according to your
+# needs.
+
+validate_cover_letter () {
+ file="$1"
+ # TODO: Replace with appropriate checks (e.g. spell checking).
+ true
+}
+
+validate_patch () {
+ file="$1"
+ # Ensure that the patch applies without conflicts.
+ git am -3 "$file" || return
+ # TODO: Replace with appropriate checks for this patch
+ # (e.g. checkpatch.pl).
+ true
+}
+
+validate_series () {
+ # TODO: Replace with appropriate checks for the whole series
+ # (e.g. quick build, coding style checks, etc.).
+ true
+}
+
+# main -------------------------------------------------------------------------
+
+if test "$GIT_SENDEMAIL_FILE_COUNTER" = 1
+then
+ remote=$(git config --default origin --get sendemail.validateRemote) &&
+ ref=$(git config --default HEAD --get sendemail.validateRemoteRef) &&
+ worktree=$(mktemp --tmpdir -d sendemail-validate.XXXXXXX) &&
+ git worktree add -fd --checkout "$worktree" "refs/remotes/$remote/$ref" &&
+ git config --replace-all sendemail.validateWorktree "$worktree"
+else
+ worktree=$(git config --get sendemail.validateWorktree)
+fi || {
+ echo "sendemail-validate: error: failed to prepare worktree" >&2
+ exit 1
+}
+
+unset GIT_DIR GIT_WORK_TREE
+cd "$worktree" &&
+
+if grep -q "^diff --git " "$1"
+then
+ validate_patch "$1"
+else
+ validate_cover_letter "$1"
+fi &&
+
+if test "$GIT_SENDEMAIL_FILE_COUNTER" = "$GIT_SENDEMAIL_FILE_TOTAL"
+then
+ git config --unset-all sendemail.validateWorktree &&
+ trap 'git worktree remove -ff "$worktree"' EXIT &&
+ validate_series
+fi
diff --git a/thread-utils.c b/thread-utils.c
index 5329845691..1f89ffab4c 100644
--- a/thread-utils.c
+++ b/thread-utils.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "thread-utils.h"
#if defined(hpux) || defined(__hpux) || defined(_hpux)
diff --git a/tmp-objdir.c b/tmp-objdir.c
index 2a2012eb6d..c33a554f92 100644
--- a/tmp-objdir.c
+++ b/tmp-objdir.c
@@ -1,7 +1,10 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "tmp-objdir.h"
+#include "abspath.h"
#include "chdir-notify.h"
#include "dir.h"
+#include "environment.h"
+#include "object-file.h"
#include "sigchain.h"
#include "string-list.h"
#include "strbuf.h"
diff --git a/tmp-objdir.h b/tmp-objdir.h
index 76efc7edee..237d96b660 100644
--- a/tmp-objdir.h
+++ b/tmp-objdir.h
@@ -10,9 +10,11 @@
*
* Example:
*
+ * struct child_process child = CHILD_PROCESS_INIT;
* struct tmp_objdir *t = tmp_objdir_create("incoming");
- * if (!run_command_v_opt_cd_env(cmd, 0, NULL, tmp_objdir_env(t)) &&
- * !tmp_objdir_migrate(t))
+ * strvec_push(&child.args, cmd);
+ * strvec_pushv(&child.env, tmp_objdir_env(t));
+ * if (!run_command(&child)) && !tmp_objdir_migrate(t))
* printf("success!\n");
* else
* die("failed...tmp_objdir will clean up for us");
diff --git a/trace.c b/trace.c
index 794a087c21..592c141d78 100644
--- a/trace.c
+++ b/trace.c
@@ -21,8 +21,13 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "environment.h"
#include "quote.h"
+#include "setup.h"
+#include "trace.h"
+#include "wrapper.h"
struct trace_key trace_default_key = { "GIT_TRACE", 0, 0, 0 };
struct trace_key trace_perf_key = TRACE_KEY_INIT(PERFORMANCE);
@@ -291,10 +296,9 @@ static const char *quote_crnl(const char *path)
return new_path.buf;
}
-/* FIXME: move prefix to startup_info struct and get rid of this arg */
-void trace_repo_setup(const char *prefix)
+void trace_repo_setup(void)
{
- const char *git_work_tree;
+ const char *git_work_tree, *prefix = startup_info->prefix;
char *cwd;
if (!trace_want(&trace_setup_key))
@@ -305,7 +309,7 @@ void trace_repo_setup(const char *prefix)
if (!(git_work_tree = get_git_work_tree()))
git_work_tree = "(null)";
- if (!prefix)
+ if (!startup_info->prefix)
prefix = "(null)";
trace_printf_key(&trace_setup_key, "setup: git_dir: %s\n", quote_crnl(get_git_dir()));
diff --git a/trace.h b/trace.h
index 4e771f86ac..d304d55aa1 100644
--- a/trace.h
+++ b/trace.h
@@ -1,7 +1,6 @@
#ifndef TRACE_H
#define TRACE_H
-#include "git-compat-util.h"
#include "strbuf.h"
/**
@@ -93,7 +92,7 @@ extern struct trace_key trace_default_key;
extern struct trace_key trace_perf_key;
extern struct trace_key trace_setup_key;
-void trace_repo_setup(const char *prefix);
+void trace_repo_setup(void);
/**
* Checks whether the trace key is enabled. Used to prevent expensive
diff --git a/trace2.c b/trace2.c
index 0c0a11e07d..0efc4e7b95 100644
--- a/trace2.c
+++ b/trace2.c
@@ -1,18 +1,23 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "json-writer.h"
#include "quote.h"
+#include "repository.h"
#include "run-command.h"
#include "sigchain.h"
#include "thread-utils.h"
#include "version.h"
+#include "trace.h"
+#include "trace2.h"
#include "trace2/tr2_cfg.h"
#include "trace2/tr2_cmd_name.h"
+#include "trace2/tr2_ctr.h"
#include "trace2/tr2_dst.h"
#include "trace2/tr2_sid.h"
#include "trace2/tr2_sysenv.h"
#include "trace2/tr2_tgt.h"
#include "trace2/tr2_tls.h"
+#include "trace2/tr2_tmr.h"
static int trace2_enabled;
@@ -52,7 +57,7 @@ static struct tr2_tgt *tr2_tgt_builtins[] =
* Force (rather than lazily) initialize any of the requested
* builtin TRACE2 targets at startup (and before we've seen an
* actual TRACE2 event call) so we can see if we need to setup
- * the TR2 and TLS machinery.
+ * private data structures and thread-local storage.
*
* Return the number of builtin targets enabled.
*/
@@ -83,6 +88,39 @@ static void tr2_tgt_disable_builtins(void)
tgt_j->pfn_term();
}
+/*
+ * The signature of this function must match the pfn_timer
+ * method in the targets. (Think of this is an apply operation
+ * across the set of active targets.)
+ */
+static void tr2_tgt_emit_a_timer(const struct tr2_timer_metadata *meta,
+ const struct tr2_timer *timer,
+ int is_final_data)
+{
+ struct tr2_tgt *tgt_j;
+ int j;
+
+ for_each_wanted_builtin (j, tgt_j)
+ if (tgt_j->pfn_timer)
+ tgt_j->pfn_timer(meta, timer, is_final_data);
+}
+
+/*
+ * The signature of this function must match the pfn_counter
+ * method in the targets.
+ */
+static void tr2_tgt_emit_a_counter(const struct tr2_counter_metadata *meta,
+ const struct tr2_counter *counter,
+ int is_final_data)
+{
+ struct tr2_tgt *tgt_j;
+ int j;
+
+ for_each_wanted_builtin (j, tgt_j)
+ if (tgt_j->pfn_counter)
+ tgt_j->pfn_counter(meta, counter, is_final_data);
+}
+
static int tr2main_exit_code;
/*
@@ -110,6 +148,32 @@ static void tr2main_atexit_handler(void)
*/
tr2tls_pop_unwind_self();
+ /*
+ * Some timers want per-thread details. If the main thread
+ * used one of those timers, emit the details now (before
+ * we emit the aggregate timer values).
+ *
+ * Likewise for counters.
+ */
+ tr2_emit_per_thread_timers(tr2_tgt_emit_a_timer);
+ tr2_emit_per_thread_counters(tr2_tgt_emit_a_counter);
+
+ /*
+ * Add stopwatch timer and counter data for the main thread to
+ * the final totals. And then emit the final values.
+ *
+ * Technically, we shouldn't need to hold the lock to update
+ * and output the final_timer_block and final_counter_block
+ * (since all other threads should be dead by now), but it
+ * doesn't hurt anything.
+ */
+ tr2tls_lock();
+ tr2_update_final_timers();
+ tr2_update_final_counters();
+ tr2_emit_final_timers(tr2_tgt_emit_a_timer);
+ tr2_emit_final_counters(tr2_tgt_emit_a_counter);
+ tr2tls_unlock();
+
for_each_wanted_builtin (j, tgt_j)
if (tgt_j->pfn_atexit)
tgt_j->pfn_atexit(us_elapsed_absolute,
@@ -466,7 +530,7 @@ void trace2_exec_result_fl(const char *file, int line, int exec_id, int code)
file, line, us_elapsed_absolute, exec_id, code);
}
-void trace2_thread_start_fl(const char *file, int line, const char *thread_name)
+void trace2_thread_start_fl(const char *file, int line, const char *thread_base_name)
{
struct tr2_tgt *tgt_j;
int j;
@@ -488,14 +552,14 @@ void trace2_thread_start_fl(const char *file, int line, const char *thread_name)
*/
trace2_region_enter_printf_fl(file, line, NULL, NULL, NULL,
"thread-proc on main: %s",
- thread_name);
+ thread_base_name);
return;
}
us_now = getnanotime() / 1000;
us_elapsed_absolute = tr2tls_absolute_elapsed(us_now);
- tr2tls_create_self(thread_name, us_now);
+ tr2tls_create_self(thread_base_name, us_now);
for_each_wanted_builtin (j, tgt_j)
if (tgt_j->pfn_thread_start_fl)
@@ -541,6 +605,25 @@ void trace2_thread_exit_fl(const char *file, int line)
tr2tls_pop_unwind_self();
us_elapsed_thread = tr2tls_region_elasped_self(us_now);
+ /*
+ * Some timers want per-thread details. If this thread used
+ * one of those timers, emit the details now.
+ *
+ * Likewise for counters.
+ */
+ tr2_emit_per_thread_timers(tr2_tgt_emit_a_timer);
+ tr2_emit_per_thread_counters(tr2_tgt_emit_a_counter);
+
+ /*
+ * Add stopwatch timer and counter data from the current
+ * (non-main) thread to the final totals. (We'll accumulate
+ * data for the main thread later during "atexit".)
+ */
+ tr2tls_lock();
+ tr2_update_final_timers();
+ tr2_update_final_counters();
+ tr2tls_unlock();
+
for_each_wanted_builtin (j, tgt_j)
if (tgt_j->pfn_thread_exit_fl)
tgt_j->pfn_thread_exit_fl(file, line,
@@ -795,6 +878,39 @@ void trace2_printf_fl(const char *file, int line, const char *fmt, ...)
va_end(ap);
}
+void trace2_timer_start(enum trace2_timer_id tid)
+{
+ if (!trace2_enabled)
+ return;
+
+ if (tid < 0 || tid >= TRACE2_NUMBER_OF_TIMERS)
+ BUG("trace2_timer_start: invalid timer id: %d", tid);
+
+ tr2_start_timer(tid);
+}
+
+void trace2_timer_stop(enum trace2_timer_id tid)
+{
+ if (!trace2_enabled)
+ return;
+
+ if (tid < 0 || tid >= TRACE2_NUMBER_OF_TIMERS)
+ BUG("trace2_timer_stop: invalid timer id: %d", tid);
+
+ tr2_stop_timer(tid);
+}
+
+void trace2_counter_add(enum trace2_counter_id cid, uint64_t value)
+{
+ if (!trace2_enabled)
+ return;
+
+ if (cid < 0 || cid >= TRACE2_NUMBER_OF_COUNTERS)
+ BUG("trace2_counter_add: invalid counter id: %d", cid);
+
+ tr2_counter_increment(cid, value);
+}
+
const char *trace2_session_id(void)
{
return tr2_sid_get();
diff --git a/trace2.h b/trace2.h
index 88d906ea83..4ced30c0db 100644
--- a/trace2.h
+++ b/trace2.h
@@ -51,6 +51,8 @@ struct json_writer;
* [] trace2_region* -- emit region nesting messages.
* [] trace2_data* -- emit region/thread/repo data messages.
* [] trace2_printf* -- legacy trace[1] messages.
+ * [] trace2_timer* -- stopwatch timers (messages are deferred).
+ * [] trace2_counter* -- global counters (messages are deferred).
*/
/*
@@ -73,8 +75,7 @@ void trace2_initialize_clock(void);
/*
* Initialize TRACE2 tracing facility if any of the builtin TRACE2
* targets are enabled in the system config or the environment.
- * This includes setting up the Trace2 thread local storage (TLS).
- * Emits a 'version' message containing the version of git
+ * This emits a 'version' message containing the version of git
* and the Trace2 protocol.
*
* This function should be called from `main()` as early as possible in
@@ -302,21 +303,23 @@ void trace2_exec_result_fl(const char *file, int line, int exec_id, int code);
/*
* Emit a 'thread_start' event. This must be called from inside the
- * thread-proc to set up the trace2 TLS data for the thread.
+ * thread-proc to allow the thread to create its own thread-local
+ * storage.
*
- * Thread names should be descriptive, like "preload_index".
- * Thread names will be decorated with an instance number automatically.
+ * The thread base name should be descriptive, like "preload_index" or
+ * taken from the thread-proc function. A unique thread name will be
+ * created from the given base name and the thread id automatically.
*/
void trace2_thread_start_fl(const char *file, int line,
- const char *thread_name);
+ const char *thread_base_name);
-#define trace2_thread_start(thread_name) \
- trace2_thread_start_fl(__FILE__, __LINE__, (thread_name))
+#define trace2_thread_start(thread_base_name) \
+ trace2_thread_start_fl(__FILE__, __LINE__, (thread_base_name))
/*
* Emit a 'thread_exit' event. This must be called from inside the
- * thread-proc to report thread-specific data and cleanup TLS data
- * for the thread.
+ * thread-proc so that the thread can access and clean up its
+ * thread-local storage.
*/
void trace2_thread_exit_fl(const char *file, int line);
@@ -485,6 +488,84 @@ void trace2_printf_fl(const char *file, int line, const char *fmt, ...);
#define trace2_printf(...) trace2_printf_fl(__FILE__, __LINE__, __VA_ARGS__)
/*
+ * Define the set of stopwatch timers.
+ *
+ * We can add more at any time, but they must be defined at compile
+ * time (to avoid the need to dynamically allocate and synchronize
+ * them between different threads).
+ *
+ * These must start at 0 and be contiguous (because we use them
+ * elsewhere as array indexes).
+ *
+ * Any values added to this enum must also be added to the
+ * `tr2_timer_metadata[]` in `trace2/tr2_tmr.c`.
+ */
+enum trace2_timer_id {
+ /*
+ * Define two timers for testing. See `t/helper/test-trace2.c`.
+ * These can be used for ad hoc testing, but should not be used
+ * for permanent analysis code.
+ */
+ TRACE2_TIMER_ID_TEST1 = 0, /* emits summary event only */
+ TRACE2_TIMER_ID_TEST2, /* emits summary and thread events */
+
+ /* Add additional timer definitions before here. */
+ TRACE2_NUMBER_OF_TIMERS
+};
+
+/*
+ * Start/Stop the indicated stopwatch timer in the current thread.
+ *
+ * The time spent by the current thread between the _start and _stop
+ * calls will be added to the thread's partial sum for this timer.
+ *
+ * Timer events are emitted at thread and program exit.
+ *
+ * Note: Since the stopwatch API routines do not generate individual
+ * events, they do not take (file, line) arguments. Similarly, the
+ * category and timer name values are defined at compile-time in the
+ * timer definitions array, so they are not needed here in the API.
+ */
+void trace2_timer_start(enum trace2_timer_id tid);
+void trace2_timer_stop(enum trace2_timer_id tid);
+
+/*
+ * Define the set of global counters.
+ *
+ * We can add more at any time, but they must be defined at compile
+ * time (to avoid the need to dynamically allocate and synchronize
+ * them between different threads).
+ *
+ * These must start at 0 and be contiguous (because we use them
+ * elsewhere as array indexes).
+ *
+ * Any values added to this enum be also be added to the
+ * `tr2_counter_metadata[]` in `trace2/tr2_tr2_ctr.c`.
+ */
+enum trace2_counter_id {
+ /*
+ * Define two counters for testing. See `t/helper/test-trace2.c`.
+ * These can be used for ad hoc testing, but should not be used
+ * for permanent analysis code.
+ */
+ TRACE2_COUNTER_ID_TEST1 = 0, /* emits summary event only */
+ TRACE2_COUNTER_ID_TEST2, /* emits summary and thread events */
+
+ /* Add additional counter definitions before here. */
+ TRACE2_NUMBER_OF_COUNTERS
+};
+
+/*
+ * Increase the named global counter by value.
+ *
+ * Note that this adds `value` to the current thread's partial sum for
+ * this counter (without locking) and that the complete sum is not
+ * available until all threads have exited, so it does not return the
+ * new value of the counter.
+ */
+void trace2_counter_add(enum trace2_counter_id cid, uint64_t value);
+
+/*
* Optional platform-specific code to dump information about the
* current and any parent process(es). This is intended to allow
* post-processors to know who spawned this git instance and anything
diff --git a/trace2/tr2_cfg.c b/trace2/tr2_cfg.c
index ec9ac1a6ef..78cfc15d52 100644
--- a/trace2/tr2_cfg.c
+++ b/trace2/tr2_cfg.c
@@ -1,5 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
+#include "strbuf.h"
+#include "trace2.h"
#include "trace2/tr2_cfg.h"
#include "trace2/tr2_sysenv.h"
diff --git a/trace2/tr2_cmd_name.c b/trace2/tr2_cmd_name.c
index dd313204f5..b7b5a869b7 100644
--- a/trace2/tr2_cmd_name.c
+++ b/trace2/tr2_cmd_name.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "strbuf.h"
#include "trace2/tr2_cmd_name.h"
#define TR2_ENVVAR_PARENT_NAME "GIT_TRACE2_PARENT_NAME"
diff --git a/trace2/tr2_ctr.c b/trace2/tr2_ctr.c
new file mode 100644
index 0000000000..b342d3b1a3
--- /dev/null
+++ b/trace2/tr2_ctr.c
@@ -0,0 +1,101 @@
+#include "git-compat-util.h"
+#include "thread-utils.h"
+#include "trace2/tr2_tgt.h"
+#include "trace2/tr2_tls.h"
+#include "trace2/tr2_ctr.h"
+
+/*
+ * A global counter block to aggregrate values from the partial sums
+ * from each thread.
+ */
+static struct tr2_counter_block final_counter_block; /* access under tr2tls_mutex */
+
+/*
+ * Define metadata for each global counter.
+ *
+ * This array must match the "enum trace2_counter_id" and the values
+ * in "struct tr2_counter_block.counter[*]".
+ */
+static struct tr2_counter_metadata tr2_counter_metadata[TRACE2_NUMBER_OF_COUNTERS] = {
+ [TRACE2_COUNTER_ID_TEST1] = {
+ .category = "test",
+ .name = "test1",
+ .want_per_thread_events = 0,
+ },
+ [TRACE2_COUNTER_ID_TEST2] = {
+ .category = "test",
+ .name = "test2",
+ .want_per_thread_events = 1,
+ },
+
+ /* Add additional metadata before here. */
+};
+
+void tr2_counter_increment(enum trace2_counter_id cid, uint64_t value)
+{
+ struct tr2tls_thread_ctx *ctx = tr2tls_get_self();
+ struct tr2_counter *c = &ctx->counter_block.counter[cid];
+
+ c->value += value;
+
+ ctx->used_any_counter = 1;
+ if (tr2_counter_metadata[cid].want_per_thread_events)
+ ctx->used_any_per_thread_counter = 1;
+}
+
+void tr2_update_final_counters(void)
+{
+ struct tr2tls_thread_ctx *ctx = tr2tls_get_self();
+ enum trace2_counter_id cid;
+
+ if (!ctx->used_any_counter)
+ return;
+
+ /*
+ * Access `final_counter_block` requires holding `tr2tls_mutex`.
+ * We assume that our caller is holding the lock.
+ */
+
+ for (cid = 0; cid < TRACE2_NUMBER_OF_COUNTERS; cid++) {
+ struct tr2_counter *c_final = &final_counter_block.counter[cid];
+ const struct tr2_counter *c = &ctx->counter_block.counter[cid];
+
+ c_final->value += c->value;
+ }
+}
+
+void tr2_emit_per_thread_counters(tr2_tgt_evt_counter_t *fn_apply)
+{
+ struct tr2tls_thread_ctx *ctx = tr2tls_get_self();
+ enum trace2_counter_id cid;
+
+ if (!ctx->used_any_per_thread_counter)
+ return;
+
+ /*
+ * For each counter, if the counter wants per-thread events
+ * and this thread used it (the value is non-zero), emit it.
+ */
+ for (cid = 0; cid < TRACE2_NUMBER_OF_COUNTERS; cid++)
+ if (tr2_counter_metadata[cid].want_per_thread_events &&
+ ctx->counter_block.counter[cid].value)
+ fn_apply(&tr2_counter_metadata[cid],
+ &ctx->counter_block.counter[cid],
+ 0);
+}
+
+void tr2_emit_final_counters(tr2_tgt_evt_counter_t *fn_apply)
+{
+ enum trace2_counter_id cid;
+
+ /*
+ * Access `final_counter_block` requires holding `tr2tls_mutex`.
+ * We assume that our caller is holding the lock.
+ */
+
+ for (cid = 0; cid < TRACE2_NUMBER_OF_COUNTERS; cid++)
+ if (final_counter_block.counter[cid].value)
+ fn_apply(&tr2_counter_metadata[cid],
+ &final_counter_block.counter[cid],
+ 1);
+}
diff --git a/trace2/tr2_ctr.h b/trace2/tr2_ctr.h
new file mode 100644
index 0000000000..a2267ee990
--- /dev/null
+++ b/trace2/tr2_ctr.h
@@ -0,0 +1,104 @@
+#ifndef TR2_CTR_H
+#define TR2_CTR_H
+
+#include "trace2.h"
+#include "trace2/tr2_tgt.h"
+
+/*
+ * Define a mechanism to allow global "counters".
+ *
+ * Counters can be used count interesting activity that does not fit
+ * the "region and data" model, such as code called from many
+ * different regions and/or where you want to count a number of items,
+ * but don't have control of when the last item will be processed,
+ * such as counter the number of calls to `lstat()`.
+ *
+ * Counters differ from Trace2 "data" events. Data events are emitted
+ * immediately and are appropriate for documenting loop counters at
+ * the end of a region, for example. Counter values are accumulated
+ * during the program and final counter values are emitted at program
+ * exit.
+ *
+ * To make this model efficient, we define a compile-time fixed set of
+ * counters and counter ids using a fixed size "counter block" array
+ * in thread-local storage. This gives us constant time, lock-free
+ * access to each counter within each thread. This lets us avoid the
+ * complexities of dynamically allocating a counter and sharing that
+ * definition with other threads.
+ *
+ * Each thread uses the counter block in its thread-local storage to
+ * increment partial sums for each counter (without locking). When a
+ * thread exits, those partial sums are (under lock) added to the
+ * global final sum.
+ *
+ * Partial sums for each counter are optionally emitted when a thread
+ * exits.
+ *
+ * Final sums for each counter are emitted between the "exit" and
+ * "atexit" events.
+ *
+ * A parallel "counter metadata" table contains the "category" and
+ * "name" fields for each counter. This eliminates the need to
+ * include those args in the various counter APIs.
+ */
+
+/*
+ * The definition of an individual counter as used by an individual
+ * thread (and later in aggregation).
+ */
+struct tr2_counter {
+ uint64_t value;
+};
+
+/*
+ * Metadata for a counter.
+ */
+struct tr2_counter_metadata {
+ const char *category;
+ const char *name;
+
+ /*
+ * True if we should emit per-thread events for this counter
+ * when individual threads exit.
+ */
+ unsigned int want_per_thread_events:1;
+};
+
+/*
+ * A compile-time fixed block of counters to insert into thread-local
+ * storage. This wrapper is used to avoid quirks of C and the usual
+ * need to pass an array size argument.
+ */
+struct tr2_counter_block {
+ struct tr2_counter counter[TRACE2_NUMBER_OF_COUNTERS];
+};
+
+/*
+ * Private routines used by trace2.c to increment a counter for the
+ * current thread.
+ */
+void tr2_counter_increment(enum trace2_counter_id cid, uint64_t value);
+
+/*
+ * Add the current thread's counter data to the global totals.
+ * This is called during thread-exit.
+ *
+ * Caller must be holding the tr2tls_mutex.
+ */
+void tr2_update_final_counters(void);
+
+/*
+ * Emit per-thread counter data for the current thread.
+ * This is called during thread-exit.
+ */
+void tr2_emit_per_thread_counters(tr2_tgt_evt_counter_t *fn_apply);
+
+/*
+ * Emit global counter values.
+ * This is called during atexit handling.
+ *
+ * Caller must be holding the tr2tls_mutex.
+ */
+void tr2_emit_final_counters(tr2_tgt_evt_counter_t *fn_apply);
+
+#endif /* TR2_CTR_H */
diff --git a/trace2/tr2_dst.c b/trace2/tr2_dst.c
index 8a21dd2972..5be892cd5c 100644
--- a/trace2/tr2_dst.c
+++ b/trace2/tr2_dst.c
@@ -1,5 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
#include "sigchain.h"
+#include "strbuf.h"
#include "trace2/tr2_dst.h"
#include "trace2/tr2_sid.h"
#include "trace2/tr2_sysenv.h"
diff --git a/trace2/tr2_sid.c b/trace2/tr2_sid.c
index dc6e75ef13..09c4ef0d17 100644
--- a/trace2/tr2_sid.c
+++ b/trace2/tr2_sid.c
@@ -1,4 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "hex.h"
+#include "strbuf.h"
#include "trace2/tr2_tbuf.h"
#include "trace2/tr2_sid.h"
diff --git a/trace2/tr2_sysenv.c b/trace2/tr2_sysenv.c
index a380dcf910..069786cb92 100644
--- a/trace2/tr2_sysenv.c
+++ b/trace2/tr2_sysenv.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "dir.h"
#include "tr2_sysenv.h"
diff --git a/trace2/tr2_tbuf.c b/trace2/tr2_tbuf.c
index 2498482d9a..c3b3822ed7 100644
--- a/trace2/tr2_tbuf.c
+++ b/trace2/tr2_tbuf.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "tr2_tbuf.h"
void tr2_tbuf_local_time(struct tr2_tbuf *tb)
diff --git a/trace2/tr2_tgt.h b/trace2/tr2_tgt.h
index 65f94e1574..bf8745c4f0 100644
--- a/trace2/tr2_tgt.h
+++ b/trace2/tr2_tgt.h
@@ -4,6 +4,12 @@
struct child_process;
struct repository;
struct json_writer;
+struct tr2_timer_metadata;
+struct tr2_timer;
+struct tr2_counter_metadata;
+struct tr2_counter;
+
+#define NS_TO_SEC(ns) ((double)(ns) / 1.0e9)
/*
* Function prototypes for a TRACE2 "target" vtable.
@@ -96,6 +102,14 @@ typedef void(tr2_tgt_evt_printf_va_fl_t)(const char *file, int line,
uint64_t us_elapsed_absolute,
const char *fmt, va_list ap);
+typedef void(tr2_tgt_evt_timer_t)(const struct tr2_timer_metadata *meta,
+ const struct tr2_timer *timer,
+ int is_final_data);
+
+typedef void(tr2_tgt_evt_counter_t)(const struct tr2_counter_metadata *meta,
+ const struct tr2_counter *counter,
+ int is_final_data);
+
/*
* "vtable" for a TRACE2 target. Use NULL if a target does not want
* to emit that message.
@@ -132,6 +146,8 @@ struct tr2_tgt {
tr2_tgt_evt_data_fl_t *pfn_data_fl;
tr2_tgt_evt_data_json_fl_t *pfn_data_json_fl;
tr2_tgt_evt_printf_va_fl_t *pfn_printf_va_fl;
+ tr2_tgt_evt_timer_t *pfn_timer;
+ tr2_tgt_evt_counter_t *pfn_counter;
};
/* clang-format on */
diff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c
index 37a3163be1..2af53e5d4d 100644
--- a/trace2/tr2_tgt_event.c
+++ b/trace2/tr2_tgt_event.c
@@ -1,6 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "json-writer.h"
+#include "repository.h"
#include "run-command.h"
#include "version.h"
#include "trace2/tr2_dst.h"
@@ -9,6 +10,7 @@
#include "trace2/tr2_sysenv.h"
#include "trace2/tr2_tgt.h"
#include "trace2/tr2_tls.h"
+#include "trace2/tr2_tmr.h"
static struct tr2_dst tr2dst_event = {
.sysenv_var = TR2_SYSENV_EVENT,
@@ -90,7 +92,7 @@ static void event_fmt_prepare(const char *event_name, const char *file,
jw_object_string(jw, "event", event_name);
jw_object_string(jw, "sid", tr2_sid_get());
- jw_object_string(jw, "thread", ctx->thread_name.buf);
+ jw_object_string(jw, "thread", ctx->thread_name);
/*
* In brief mode, only emit <time> on these 2 event types.
@@ -617,6 +619,48 @@ static void fn_data_json_fl(const char *file, int line,
}
}
+static void fn_timer(const struct tr2_timer_metadata *meta,
+ const struct tr2_timer *timer,
+ int is_final_data)
+{
+ const char *event_name = is_final_data ? "timer" : "th_timer";
+ struct json_writer jw = JSON_WRITER_INIT;
+ double t_total = NS_TO_SEC(timer->total_ns);
+ double t_min = NS_TO_SEC(timer->min_ns);
+ double t_max = NS_TO_SEC(timer->max_ns);
+
+ jw_object_begin(&jw, 0);
+ event_fmt_prepare(event_name, __FILE__, __LINE__, NULL, &jw);
+ jw_object_string(&jw, "category", meta->category);
+ jw_object_string(&jw, "name", meta->name);
+ jw_object_intmax(&jw, "intervals", timer->interval_count);
+ jw_object_double(&jw, "t_total", 6, t_total);
+ jw_object_double(&jw, "t_min", 6, t_min);
+ jw_object_double(&jw, "t_max", 6, t_max);
+ jw_end(&jw);
+
+ tr2_dst_write_line(&tr2dst_event, &jw.json);
+ jw_release(&jw);
+}
+
+static void fn_counter(const struct tr2_counter_metadata *meta,
+ const struct tr2_counter *counter,
+ int is_final_data)
+{
+ const char *event_name = is_final_data ? "counter" : "th_counter";
+ struct json_writer jw = JSON_WRITER_INIT;
+
+ jw_object_begin(&jw, 0);
+ event_fmt_prepare(event_name, __FILE__, __LINE__, NULL, &jw);
+ jw_object_string(&jw, "category", meta->category);
+ jw_object_string(&jw, "name", meta->name);
+ jw_object_intmax(&jw, "count", counter->value);
+ jw_end(&jw);
+
+ tr2_dst_write_line(&tr2dst_event, &jw.json);
+ jw_release(&jw);
+}
+
struct tr2_tgt tr2_tgt_event = {
.pdst = &tr2dst_event,
@@ -648,4 +692,6 @@ struct tr2_tgt tr2_tgt_event = {
.pfn_data_fl = fn_data_fl,
.pfn_data_json_fl = fn_data_json_fl,
.pfn_printf_va_fl = NULL,
+ .pfn_timer = fn_timer,
+ .pfn_counter = fn_counter,
};
diff --git a/trace2/tr2_tgt_normal.c b/trace2/tr2_tgt_normal.c
index 69f8033077..1ebfb464d5 100644
--- a/trace2/tr2_tgt_normal.c
+++ b/trace2/tr2_tgt_normal.c
@@ -1,5 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
+#include "repository.h"
#include "run-command.h"
#include "quote.h"
#include "version.h"
@@ -8,6 +9,7 @@
#include "trace2/tr2_tbuf.h"
#include "trace2/tr2_tgt.h"
#include "trace2/tr2_tls.h"
+#include "trace2/tr2_tmr.h"
static struct tr2_dst tr2dst_normal = {
.sysenv_var = TR2_SYSENV_NORMAL,
@@ -329,6 +331,42 @@ static void fn_printf_va_fl(const char *file, int line,
strbuf_release(&buf_payload);
}
+static void fn_timer(const struct tr2_timer_metadata *meta,
+ const struct tr2_timer *timer,
+ int is_final_data)
+{
+ const char *event_name = is_final_data ? "timer" : "th_timer";
+ struct strbuf buf_payload = STRBUF_INIT;
+ double t_total = NS_TO_SEC(timer->total_ns);
+ double t_min = NS_TO_SEC(timer->min_ns);
+ double t_max = NS_TO_SEC(timer->max_ns);
+
+ strbuf_addf(&buf_payload, ("%s %s/%s"
+ " intervals:%"PRIu64
+ " total:%8.6f min:%8.6f max:%8.6f"),
+ event_name, meta->category, meta->name,
+ timer->interval_count,
+ t_total, t_min, t_max);
+
+ normal_io_write_fl(__FILE__, __LINE__, &buf_payload);
+ strbuf_release(&buf_payload);
+}
+
+static void fn_counter(const struct tr2_counter_metadata *meta,
+ const struct tr2_counter *counter,
+ int is_final_data)
+{
+ const char *event_name = is_final_data ? "counter" : "th_counter";
+ struct strbuf buf_payload = STRBUF_INIT;
+
+ strbuf_addf(&buf_payload, "%s %s/%s value:%"PRIu64,
+ event_name, meta->category, meta->name,
+ counter->value);
+
+ normal_io_write_fl(__FILE__, __LINE__, &buf_payload);
+ strbuf_release(&buf_payload);
+}
+
struct tr2_tgt tr2_tgt_normal = {
.pdst = &tr2dst_normal,
@@ -360,4 +398,6 @@ struct tr2_tgt tr2_tgt_normal = {
.pfn_data_fl = NULL,
.pfn_data_json_fl = NULL,
.pfn_printf_va_fl = fn_printf_va_fl,
+ .pfn_timer = fn_timer,
+ .pfn_counter = fn_counter,
};
diff --git a/trace2/tr2_tgt_perf.c b/trace2/tr2_tgt_perf.c
index 8cb792488c..328e483a05 100644
--- a/trace2/tr2_tgt_perf.c
+++ b/trace2/tr2_tgt_perf.c
@@ -1,5 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
+#include "repository.h"
#include "run-command.h"
#include "quote.h"
#include "version.h"
@@ -10,6 +11,7 @@
#include "trace2/tr2_tbuf.h"
#include "trace2/tr2_tgt.h"
#include "trace2/tr2_tls.h"
+#include "trace2/tr2_tmr.h"
static struct tr2_dst tr2dst_perf = {
.sysenv_var = TR2_SYSENV_PERF,
@@ -108,7 +110,7 @@ static void perf_fmt_prepare(const char *event_name,
strbuf_addf(buf, "d%d | ", tr2_sid_depth());
strbuf_addf(buf, "%-*s | %-*s | ", TR2_MAX_THREAD_NAME,
- ctx->thread_name.buf, TR2FMT_PERF_MAX_EVENT_NAME,
+ ctx->thread_name, TR2FMT_PERF_MAX_EVENT_NAME,
event_name);
len = buf->len + TR2FMT_PERF_REPO_WIDTH;
@@ -555,6 +557,44 @@ static void fn_printf_va_fl(const char *file, int line,
strbuf_release(&buf_payload);
}
+static void fn_timer(const struct tr2_timer_metadata *meta,
+ const struct tr2_timer *timer,
+ int is_final_data)
+{
+ const char *event_name = is_final_data ? "timer" : "th_timer";
+ struct strbuf buf_payload = STRBUF_INIT;
+ double t_total = NS_TO_SEC(timer->total_ns);
+ double t_min = NS_TO_SEC(timer->min_ns);
+ double t_max = NS_TO_SEC(timer->max_ns);
+
+ strbuf_addf(&buf_payload, ("name:%s"
+ " intervals:%"PRIu64
+ " total:%8.6f min:%8.6f max:%8.6f"),
+ meta->name,
+ timer->interval_count,
+ t_total, t_min, t_max);
+
+ perf_io_write_fl(__FILE__, __LINE__, event_name, NULL, NULL, NULL,
+ meta->category, &buf_payload);
+ strbuf_release(&buf_payload);
+}
+
+static void fn_counter(const struct tr2_counter_metadata *meta,
+ const struct tr2_counter *counter,
+ int is_final_data)
+{
+ const char *event_name = is_final_data ? "counter" : "th_counter";
+ struct strbuf buf_payload = STRBUF_INIT;
+
+ strbuf_addf(&buf_payload, "name:%s value:%"PRIu64,
+ meta->name,
+ counter->value);
+
+ perf_io_write_fl(__FILE__, __LINE__, event_name, NULL, NULL, NULL,
+ meta->category, &buf_payload);
+ strbuf_release(&buf_payload);
+}
+
struct tr2_tgt tr2_tgt_perf = {
.pdst = &tr2dst_perf,
@@ -586,4 +626,6 @@ struct tr2_tgt tr2_tgt_perf = {
.pfn_data_fl = fn_data_fl,
.pfn_data_json_fl = fn_data_json_fl,
.pfn_printf_va_fl = fn_printf_va_fl,
+ .pfn_timer = fn_timer,
+ .pfn_counter = fn_counter,
};
diff --git a/trace2/tr2_tls.c b/trace2/tr2_tls.c
index 7da94aba52..9f46ae12f5 100644
--- a/trace2/tr2_tls.c
+++ b/trace2/tr2_tls.c
@@ -1,5 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "thread-utils.h"
+#include "trace.h"
#include "trace2/tr2_tls.h"
/*
@@ -31,10 +33,11 @@ void tr2tls_start_process_clock(void)
tr2tls_us_start_process = getnanotime() / 1000;
}
-struct tr2tls_thread_ctx *tr2tls_create_self(const char *thread_name,
+struct tr2tls_thread_ctx *tr2tls_create_self(const char *thread_base_name,
uint64_t us_thread_start)
{
struct tr2tls_thread_ctx *ctx = xcalloc(1, sizeof(*ctx));
+ struct strbuf buf = STRBUF_INIT;
/*
* Implicitly "tr2tls_push_self()" to capture the thread's start
@@ -47,12 +50,13 @@ struct tr2tls_thread_ctx *tr2tls_create_self(const char *thread_name,
ctx->thread_id = tr2tls_locked_increment(&tr2_next_thread_id);
- strbuf_init(&ctx->thread_name, 0);
+ strbuf_init(&buf, 0);
if (ctx->thread_id)
- strbuf_addf(&ctx->thread_name, "th%02d:", ctx->thread_id);
- strbuf_addstr(&ctx->thread_name, thread_name);
- if (ctx->thread_name.len > TR2_MAX_THREAD_NAME)
- strbuf_setlen(&ctx->thread_name, TR2_MAX_THREAD_NAME);
+ strbuf_addf(&buf, "th%02d:", ctx->thread_id);
+ strbuf_addstr(&buf, thread_base_name);
+ if (buf.len > TR2_MAX_THREAD_NAME)
+ strbuf_setlen(&buf, TR2_MAX_THREAD_NAME);
+ ctx->thread_name = strbuf_detach(&buf, NULL);
pthread_setspecific(tr2tls_key, ctx);
@@ -69,9 +73,9 @@ struct tr2tls_thread_ctx *tr2tls_get_self(void)
ctx = pthread_getspecific(tr2tls_key);
/*
- * If the thread-proc did not call trace2_thread_start(), we won't
- * have any TLS data associated with the current thread. Fix it
- * here and silently continue.
+ * If the current thread's thread-proc did not call
+ * trace2_thread_start(), then the thread will not have any
+ * thread-local storage. Create it now and silently continue.
*/
if (!ctx)
ctx = tr2tls_create_self("unknown", getnanotime() / 1000);
@@ -95,7 +99,7 @@ void tr2tls_unset_self(void)
pthread_setspecific(tr2tls_key, NULL);
- strbuf_release(&ctx->thread_name);
+ free((char *)ctx->thread_name);
free(ctx->array_us_start);
free(ctx);
}
@@ -113,7 +117,7 @@ void tr2tls_pop_self(void)
struct tr2tls_thread_ctx *ctx = tr2tls_get_self();
if (!ctx->nr_open_regions)
- BUG("no open regions in thread '%s'", ctx->thread_name.buf);
+ BUG("no open regions in thread '%s'", ctx->thread_name);
ctx->nr_open_regions--;
}
@@ -179,3 +183,13 @@ int tr2tls_locked_increment(int *p)
return current_value;
}
+
+void tr2tls_lock(void)
+{
+ pthread_mutex_lock(&tr2tls_mutex);
+}
+
+void tr2tls_unlock(void)
+{
+ pthread_mutex_unlock(&tr2tls_mutex);
+}
diff --git a/trace2/tr2_tls.h b/trace2/tr2_tls.h
index b1e327a928..f9049805d4 100644
--- a/trace2/tr2_tls.h
+++ b/trace2/tr2_tls.h
@@ -2,6 +2,14 @@
#define TR2_TLS_H
#include "strbuf.h"
+#include "trace2/tr2_ctr.h"
+#include "trace2/tr2_tmr.h"
+
+/*
+ * Notice: the term "TLS" refers to "thread-local storage" in the
+ * Trace2 source files. This usage is borrowed from GCC and Windows.
+ * There is NO relation to "transport layer security".
+ */
/*
* Arbitry limit for thread names for column alignment.
@@ -9,33 +17,40 @@
#define TR2_MAX_THREAD_NAME (24)
struct tr2tls_thread_ctx {
- struct strbuf thread_name;
+ const char *thread_name;
uint64_t *array_us_start;
- int alloc;
- int nr_open_regions; /* plays role of "nr" in ALLOC_GROW */
+ size_t alloc;
+ size_t nr_open_regions; /* plays role of "nr" in ALLOC_GROW */
int thread_id;
+ struct tr2_timer_block timer_block;
+ struct tr2_counter_block counter_block;
+ unsigned int used_any_timer:1;
+ unsigned int used_any_per_thread_timer:1;
+ unsigned int used_any_counter:1;
+ unsigned int used_any_per_thread_counter:1;
};
/*
- * Create TLS data for the current thread. This gives us a place to
- * put per-thread data, such as thread start time, function nesting
- * and a per-thread label for our messages.
- *
- * We assume the first thread is "main". Other threads are given
- * non-zero thread-ids to help distinguish messages from concurrent
- * threads.
+ * Create thread-local storage for the current thread.
*
- * Truncate the thread name if necessary to help with column alignment
- * in printf-style messages.
+ * The first thread in the process will have:
+ * { .thread_id=0, .thread_name="main" }
+ * Subsequent threads are given a non-zero thread_id and a thread_name
+ * constructed from the id and a thread base name (which is usually just
+ * the name of the thread-proc function). For example:
+ * { .thread_id=10, .thread_name="th10:fsm-listen" }
+ * This helps to identify and distinguish messages from concurrent threads.
+ * The ctx.thread_name field is truncated if necessary to help with column
+ * alignment in printf-style messages.
*
* In this and all following functions the term "self" refers to the
* current thread.
*/
-struct tr2tls_thread_ctx *tr2tls_create_self(const char *thread_name,
+struct tr2tls_thread_ctx *tr2tls_create_self(const char *thread_base_name,
uint64_t us_thread_start);
/*
- * Get our TLS data.
+ * Get the thread-local storage pointer of the current thread.
*/
struct tr2tls_thread_ctx *tr2tls_get_self(void);
@@ -45,7 +60,7 @@ struct tr2tls_thread_ctx *tr2tls_get_self(void);
int tr2tls_is_main_thread(void);
/*
- * Free our TLS data.
+ * Free the current thread's thread-local storage.
*/
void tr2tls_unset_self(void);
@@ -81,12 +96,12 @@ uint64_t tr2tls_region_elasped_self(uint64_t us);
uint64_t tr2tls_absolute_elapsed(uint64_t us);
/*
- * Initialize the tr2 TLS system.
+ * Initialize thread-local storage for Trace2.
*/
void tr2tls_init(void);
/*
- * Free all tr2 TLS resources.
+ * Free all Trace2 thread-local storage resources.
*/
void tr2tls_release(void);
@@ -100,4 +115,10 @@ int tr2tls_locked_increment(int *p);
*/
void tr2tls_start_process_clock(void);
+/*
+ * Explicitly lock/unlock our mutex.
+ */
+void tr2tls_lock(void);
+void tr2tls_unlock(void);
+
#endif /* TR2_TLS_H */
diff --git a/trace2/tr2_tmr.c b/trace2/tr2_tmr.c
new file mode 100644
index 0000000000..31d0e4d1bd
--- /dev/null
+++ b/trace2/tr2_tmr.c
@@ -0,0 +1,183 @@
+#include "git-compat-util.h"
+#include "thread-utils.h"
+#include "trace2/tr2_tgt.h"
+#include "trace2/tr2_tls.h"
+#include "trace2/tr2_tmr.h"
+#include "trace.h"
+
+#define MY_MAX(a, b) ((a) > (b) ? (a) : (b))
+#define MY_MIN(a, b) ((a) < (b) ? (a) : (b))
+
+/*
+ * A global timer block to aggregate values from the partial sums from
+ * each thread.
+ */
+static struct tr2_timer_block final_timer_block; /* access under tr2tls_mutex */
+
+/*
+ * Define metadata for each stopwatch timer.
+ *
+ * This array must match "enum trace2_timer_id" and the values
+ * in "struct tr2_timer_block.timer[*]".
+ */
+static struct tr2_timer_metadata tr2_timer_metadata[TRACE2_NUMBER_OF_TIMERS] = {
+ [TRACE2_TIMER_ID_TEST1] = {
+ .category = "test",
+ .name = "test1",
+ .want_per_thread_events = 0,
+ },
+ [TRACE2_TIMER_ID_TEST2] = {
+ .category = "test",
+ .name = "test2",
+ .want_per_thread_events = 1,
+ },
+
+ /* Add additional metadata before here. */
+};
+
+void tr2_start_timer(enum trace2_timer_id tid)
+{
+ struct tr2tls_thread_ctx *ctx = tr2tls_get_self();
+ struct tr2_timer *t = &ctx->timer_block.timer[tid];
+
+ t->recursion_count++;
+ if (t->recursion_count > 1)
+ return; /* ignore recursive starts */
+
+ t->start_ns = getnanotime();
+}
+
+void tr2_stop_timer(enum trace2_timer_id tid)
+{
+ struct tr2tls_thread_ctx *ctx = tr2tls_get_self();
+ struct tr2_timer *t = &ctx->timer_block.timer[tid];
+ uint64_t ns_now;
+ uint64_t ns_interval;
+
+ assert(t->recursion_count > 0);
+
+ t->recursion_count--;
+ if (t->recursion_count)
+ return; /* still in recursive call(s) */
+
+ ns_now = getnanotime();
+ ns_interval = ns_now - t->start_ns;
+
+ t->total_ns += ns_interval;
+
+ /*
+ * min_ns was initialized to zero (in the xcalloc()) rather
+ * than UINT_MAX when the block of timers was allocated,
+ * so we should always set both the min_ns and max_ns values
+ * the first time that the timer is used.
+ */
+ if (!t->interval_count) {
+ t->min_ns = ns_interval;
+ t->max_ns = ns_interval;
+ } else {
+ t->min_ns = MY_MIN(ns_interval, t->min_ns);
+ t->max_ns = MY_MAX(ns_interval, t->max_ns);
+ }
+
+ t->interval_count++;
+
+ ctx->used_any_timer = 1;
+ if (tr2_timer_metadata[tid].want_per_thread_events)
+ ctx->used_any_per_thread_timer = 1;
+}
+
+void tr2_update_final_timers(void)
+{
+ struct tr2tls_thread_ctx *ctx = tr2tls_get_self();
+ enum trace2_timer_id tid;
+
+ if (!ctx->used_any_timer)
+ return;
+
+ /*
+ * Accessing `final_timer_block` requires holding `tr2tls_mutex`.
+ * We assume that our caller is holding the lock.
+ */
+
+ for (tid = 0; tid < TRACE2_NUMBER_OF_TIMERS; tid++) {
+ struct tr2_timer *t_final = &final_timer_block.timer[tid];
+ struct tr2_timer *t = &ctx->timer_block.timer[tid];
+
+ if (t->recursion_count) {
+ /*
+ * The current thread is exiting with
+ * timer[tid] still running.
+ *
+ * Technically, this is a bug, but I'm going
+ * to ignore it.
+ *
+ * I don't think it is worth calling die()
+ * for. I don't think it is worth killing the
+ * process for this bookkeeping error. We
+ * might want to call warning(), but I'm going
+ * to wait on that.
+ *
+ * The downside here is that total_ns won't
+ * include the current open interval (now -
+ * start_ns). I can live with that.
+ */
+ }
+
+ if (!t->interval_count)
+ continue; /* this timer was not used by this thread */
+
+ t_final->total_ns += t->total_ns;
+
+ /*
+ * final_timer_block.timer[tid].min_ns was initialized to
+ * was initialized to zero rather than UINT_MAX, so we should
+ * always set both the min_ns and max_ns values the first time
+ * that we add a partial sum into it.
+ */
+ if (!t_final->interval_count) {
+ t_final->min_ns = t->min_ns;
+ t_final->max_ns = t->max_ns;
+ } else {
+ t_final->min_ns = MY_MIN(t_final->min_ns, t->min_ns);
+ t_final->max_ns = MY_MAX(t_final->max_ns, t->max_ns);
+ }
+
+ t_final->interval_count += t->interval_count;
+ }
+}
+
+void tr2_emit_per_thread_timers(tr2_tgt_evt_timer_t *fn_apply)
+{
+ struct tr2tls_thread_ctx *ctx = tr2tls_get_self();
+ enum trace2_timer_id tid;
+
+ if (!ctx->used_any_per_thread_timer)
+ return;
+
+ /*
+ * For each timer, if the timer wants per-thread events and
+ * this thread used it, emit it.
+ */
+ for (tid = 0; tid < TRACE2_NUMBER_OF_TIMERS; tid++)
+ if (tr2_timer_metadata[tid].want_per_thread_events &&
+ ctx->timer_block.timer[tid].interval_count)
+ fn_apply(&tr2_timer_metadata[tid],
+ &ctx->timer_block.timer[tid],
+ 0);
+}
+
+void tr2_emit_final_timers(tr2_tgt_evt_timer_t *fn_apply)
+{
+ enum trace2_timer_id tid;
+
+ /*
+ * Accessing `final_timer_block` requires holding `tr2tls_mutex`.
+ * We assume that our caller is holding the lock.
+ */
+
+ for (tid = 0; tid < TRACE2_NUMBER_OF_TIMERS; tid++)
+ if (final_timer_block.timer[tid].interval_count)
+ fn_apply(&tr2_timer_metadata[tid],
+ &final_timer_block.timer[tid],
+ 1);
+}
diff --git a/trace2/tr2_tmr.h b/trace2/tr2_tmr.h
new file mode 100644
index 0000000000..d575357613
--- /dev/null
+++ b/trace2/tr2_tmr.h
@@ -0,0 +1,140 @@
+#ifndef TR2_TMR_H
+#define TR2_TMR_H
+
+#include "trace2.h"
+#include "trace2/tr2_tgt.h"
+
+/*
+ * Define a mechanism to allow "stopwatch" timers.
+ *
+ * Timers can be used to measure "interesting" activity that does not
+ * fit the "region" model, such as code called from many different
+ * regions (like zlib) and/or where data for individual calls are not
+ * interesting or are too numerous to be efficiently logged.
+ *
+ * Timer values are accumulated during program execution and emitted
+ * to the Trace2 logs at program exit.
+ *
+ * To make this model efficient, we define a compile-time fixed set of
+ * timers and timer ids using a "timer block" array in thread-local
+ * storage. This gives us constant time access to each timer within
+ * each thread, since we want start/stop operations to be as fast as
+ * possible. This lets us avoid the complexities of dynamically
+ * allocating a timer on the first use by a thread and/or possibly
+ * sharing that timer definition with other concurrent threads.
+ * However, this does require that we define time the set of timers at
+ * compile time.
+ *
+ * Each thread uses the timer block in its thread-local storage to
+ * compute partial sums for each timer (without locking). When a
+ * thread exits, those partial sums are (under lock) added to the
+ * global final sum.
+ *
+ * Using this "timer block" model costs ~48 bytes per timer per thread
+ * (we have about six uint64 fields per timer). This does increase
+ * the size of the thread-local storage block, but it is allocated (at
+ * thread create time) and not on the thread stack, so I'm not worried
+ * about the size.
+ *
+ * Partial sums for each timer are optionally emitted when a thread
+ * exits.
+ *
+ * Final sums for each timer are emitted between the "exit" and
+ * "atexit" events.
+ *
+ * A parallel "timer metadata" table contains the "category" and "name"
+ * fields for each timer. This eliminates the need to include those
+ * args in the various timer APIs.
+ */
+
+/*
+ * The definition of an individual timer and used by an individual
+ * thread.
+ */
+struct tr2_timer {
+ /*
+ * Total elapsed time for this timer in this thread in nanoseconds.
+ */
+ uint64_t total_ns;
+
+ /*
+ * The maximum and minimum interval values observed for this
+ * timer in this thread.
+ */
+ uint64_t min_ns;
+ uint64_t max_ns;
+
+ /*
+ * The value of the clock when this timer was started in this
+ * thread. (Undefined when the timer is not active in this
+ * thread.)
+ */
+ uint64_t start_ns;
+
+ /*
+ * Number of times that this timer has been started and stopped
+ * in this thread. (Recursive starts are ignored.)
+ */
+ uint64_t interval_count;
+
+ /*
+ * Number of nested starts on the stack in this thread. (We
+ * ignore recursive starts and use this to track the recursive
+ * calls.)
+ */
+ unsigned int recursion_count;
+};
+
+/*
+ * Metadata for a timer.
+ */
+struct tr2_timer_metadata {
+ const char *category;
+ const char *name;
+
+ /*
+ * True if we should emit per-thread events for this timer
+ * when individual threads exit.
+ */
+ unsigned int want_per_thread_events:1;
+};
+
+/*
+ * A compile-time fixed-size block of timers to insert into
+ * thread-local storage. This wrapper is used to avoid quirks
+ * of C and the usual need to pass an array size argument.
+ */
+struct tr2_timer_block {
+ struct tr2_timer timer[TRACE2_NUMBER_OF_TIMERS];
+};
+
+/*
+ * Private routines used by trace2.c to actually start/stop an
+ * individual timer in the current thread.
+ */
+void tr2_start_timer(enum trace2_timer_id tid);
+void tr2_stop_timer(enum trace2_timer_id tid);
+
+/*
+ * Add the current thread's timer data to the global totals.
+ * This is called during thread-exit.
+ *
+ * Caller must be holding the tr2tls_mutex.
+ */
+void tr2_update_final_timers(void);
+
+/*
+ * Emit per-thread timer data for the current thread.
+ * This is called during thread-exit.
+ */
+void tr2_emit_per_thread_timers(tr2_tgt_evt_timer_t *fn_apply);
+
+/*
+ * Emit global total timer values.
+ * This is called during atexit handling.
+ *
+ * Caller must be holding the tr2tls_mutex.
+ */
+void tr2_emit_final_timers(tr2_tgt_evt_timer_t *fn_apply);
+
+#endif /* TR2_TMR_H */
diff --git a/trailer.c b/trailer.c
index 0fd5b142a3..a2c3ed6f28 100644
--- a/trailer.c
+++ b/trailer.c
@@ -1,5 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
#include "string-list.h"
#include "run-command.h"
#include "commit.h"
diff --git a/transport-helper.c b/transport-helper.c
index e95267a4ab..6b816940dc 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -1,9 +1,13 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "transport.h"
#include "quote.h"
#include "run-command.h"
#include "commit.h"
#include "diff.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-name.h"
#include "revision.h"
#include "remote.h"
#include "string-list.h"
@@ -14,6 +18,7 @@
#include "refspec.h"
#include "transport-internal.h"
#include "protocol.h"
+#include "wrapper.h"
static int debug;
@@ -1081,7 +1086,7 @@ static int push_refs_with_export(struct transport *transport,
struct object_id oid;
private = apply_refspecs(&data->rs, ref->name);
- if (private && !get_oid(private, &oid)) {
+ if (private && !repo_get_oid(the_repository, private, &oid)) {
strbuf_addf(&buf, "^%s", private);
string_list_append_nodup(&revlist_args,
strbuf_detach(&buf, NULL));
@@ -1267,9 +1272,22 @@ static struct ref *get_refs_list_using_list(struct transport *transport,
return ret;
}
+static int get_bundle_uri(struct transport *transport)
+{
+ get_helper(transport);
+
+ if (process_connect(transport, 0)) {
+ do_take_over(transport);
+ return transport->vtable->get_bundle_uri(transport);
+ }
+
+ return -1;
+}
+
static struct transport_vtable vtable = {
.set_option = set_helper_option,
.get_refs_list = get_refs_list,
+ .get_bundle_uri = get_bundle_uri,
.fetch_refs = fetch_refs,
.push_refs = push_refs,
.connect = connect_helper,
diff --git a/transport-internal.h b/transport-internal.h
index c4ca0b733a..90ea749e5c 100644
--- a/transport-internal.h
+++ b/transport-internal.h
@@ -27,6 +27,13 @@ struct transport_vtable {
struct transport_ls_refs_options *transport_options);
/**
+ * Populates the remote side's bundle-uri under protocol v2,
+ * if the "bundle-uri" capability was advertised. Returns 0 if
+ * OK, negative values on error.
+ */
+ int (*get_bundle_uri)(struct transport *transport);
+
+ /**
* Fetch the objects for the given refs. Note that this gets
* an array, and should ignore the list structure.
*
diff --git a/transport.c b/transport.c
index 70e9c188a3..67afdae57c 100644
--- a/transport.c
+++ b/transport.c
@@ -1,5 +1,9 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "advice.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
+#include "hex.h"
#include "transport.h"
#include "hook.h"
#include "pkt-line.h"
@@ -10,6 +14,7 @@
#include "walker.h"
#include "bundle.h"
#include "dir.h"
+#include "gettext.h"
#include "refs.h"
#include "refspec.h"
#include "branch.h"
@@ -18,10 +23,14 @@
#include "string-list.h"
#include "oid-array.h"
#include "sigchain.h"
+#include "trace2.h"
#include "transport-internal.h"
#include "protocol.h"
+#include "object-name.h"
#include "object-store.h"
#include "color.h"
+#include "bundle-uri.h"
+#include "wrapper.h"
static int transport_use_color = -1;
static char transport_colors[][COLOR_MAXLEN] = {
@@ -166,7 +175,8 @@ static struct ref *get_refs_from_bundle(struct transport *transport,
}
static int fetch_refs_from_bundle(struct transport *transport,
- int nr_heads, struct ref **to_fetch)
+ int nr_heads UNUSED,
+ struct ref **to_fetch UNUSED)
{
struct bundle_transport_data *data = transport->data;
struct strvec extra_index_pack_args = STRVEC_INIT;
@@ -178,7 +188,7 @@ static int fetch_refs_from_bundle(struct transport *transport,
if (!data->get_refs_from_bundle_called)
get_refs_from_bundle_inner(transport);
ret = unbundle(the_repository, &data->header, data->fd,
- &extra_index_pack_args);
+ &extra_index_pack_args, 0);
transport->hash_algo = data->header.hash_algo;
return ret;
}
@@ -197,7 +207,7 @@ struct git_transport_data {
struct git_transport_options options;
struct child_process *conn;
int fd[2];
- unsigned got_remote_heads : 1;
+ unsigned finished_handshake : 1;
enum protocol_version version;
struct oid_array extra_have;
struct oid_array shallow;
@@ -275,8 +285,12 @@ static int connect_setup(struct transport *transport, int for_push)
}
data->conn = git_connect(data->fd, transport->url,
- for_push ? data->options.receivepack :
- data->options.uploadpack,
+ for_push ?
+ "git-receive-pack" :
+ "git-upload-pack",
+ for_push ?
+ data->options.receivepack :
+ data->options.uploadpack,
flags);
return 0;
@@ -306,7 +320,7 @@ static struct ref *handshake(struct transport *transport, int for_push,
struct git_transport_data *data = transport->data;
struct ref *refs = NULL;
struct packet_reader reader;
- int sid_len;
+ size_t sid_len;
const char *server_sid;
connect_setup(transport, for_push);
@@ -344,7 +358,7 @@ static struct ref *handshake(struct transport *transport, int for_push,
case protocol_unknown_version:
BUG("unknown protocol version");
}
- data->got_remote_heads = 1;
+ data->finished_handshake = 1;
transport->hash_algo = reader.hash_algo;
if (reader.line_peeked)
@@ -359,6 +373,39 @@ static struct ref *get_refs_via_connect(struct transport *transport, int for_pus
return handshake(transport, for_push, options, 1);
}
+static int get_bundle_uri(struct transport *transport)
+{
+ struct git_transport_data *data = transport->data;
+ struct packet_reader reader;
+ int stateless_rpc = transport->stateless_rpc;
+
+ if (!transport->bundles) {
+ CALLOC_ARRAY(transport->bundles, 1);
+ init_bundle_list(transport->bundles);
+ }
+
+ if (!data->finished_handshake) {
+ struct ref *refs = handshake(transport, 0, NULL, 0);
+
+ if (refs)
+ free_refs(refs);
+ }
+
+ /*
+ * "Support" protocol v0 and v2 without bundle-uri support by
+ * silently degrading to a NOOP.
+ */
+ if (!server_supports_v2("bundle-uri"))
+ return 0;
+
+ packet_reader_init(&reader, data->fd[0], NULL, 0,
+ PACKET_READ_CHOMP_NEWLINE |
+ PACKET_READ_GENTLE_ON_EOF);
+
+ return get_remote_bundle_uri(data->fd[1], &reader,
+ transport->bundles, stateless_rpc);
+}
+
static int fetch_refs_via_pack(struct transport *transport,
int nr_heads, struct ref **to_fetch)
{
@@ -394,7 +441,7 @@ static int fetch_refs_via_pack(struct transport *transport,
args.negotiation_tips = data->options.negotiation_tips;
args.reject_shallow_remote = transport->smart_options->reject_shallow;
- if (!data->got_remote_heads) {
+ if (!data->finished_handshake) {
int i;
int must_list_refs = 0;
for (i = 0; i < nr_heads; i++) {
@@ -434,7 +481,7 @@ static int fetch_refs_via_pack(struct transport *transport,
to_fetch, nr_heads, &data->shallow,
&transport->pack_lockfiles, data->version);
- data->got_remote_heads = 0;
+ data->finished_handshake = 0;
data->options.self_contained_and_connected =
args.self_contained_and_connected;
data->options.connectivity_checked = args.connectivity_checked;
@@ -742,7 +789,8 @@ static int print_one_push_status(struct ref *ref, const char *dest, int count,
static int measure_abbrev(const struct object_id *oid, int sofar)
{
char hex[GIT_MAX_HEXSZ + 1];
- int w = find_unique_abbrev_r(hex, oid, DEFAULT_ABBREV);
+ int w = repo_find_unique_abbrev_r(the_repository, hex, oid,
+ DEFAULT_ABBREV);
return (w < sofar) ? sofar : w;
}
@@ -819,7 +867,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
if (transport_color_config() < 0)
return -1;
- if (!data->got_remote_heads)
+ if (!data->finished_handshake)
get_refs_via_connect(transport, 1, NULL);
memset(&args, 0, sizeof(args));
@@ -867,7 +915,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
else
ret = finish_connect(data->conn);
data->conn = NULL;
- data->got_remote_heads = 0;
+ data->finished_handshake = 0;
return ret;
}
@@ -877,7 +925,7 @@ static int connect_git(struct transport *transport, const char *name,
{
struct git_transport_data *data = transport->data;
data->conn = git_connect(data->fd, transport->url,
- executable, 0);
+ name, executable, 0);
fd[0] = data->fd[0];
fd[1] = data->fd[1];
return 0;
@@ -887,7 +935,7 @@ static int disconnect_git(struct transport *transport)
{
struct git_transport_data *data = transport->data;
if (data->conn) {
- if (data->got_remote_heads && !transport->stateless_rpc)
+ if (data->finished_handshake && !transport->stateless_rpc)
packet_flush(data->fd[1]);
close(data->fd[0]);
if (data->fd[1] >= 0)
@@ -902,6 +950,7 @@ static int disconnect_git(struct transport *transport)
static struct transport_vtable taken_over_vtable = {
.get_refs_list = get_refs_via_connect,
+ .get_bundle_uri = get_bundle_uri,
.fetch_refs = fetch_refs_via_pack,
.push_refs = git_transport_push,
.disconnect = disconnect_git
@@ -921,7 +970,7 @@ void transport_take_over(struct transport *transport,
data->conn = child;
data->fd[0] = data->conn->out;
data->fd[1] = data->conn->in;
- data->got_remote_heads = 0;
+ data->finished_handshake = 0;
transport->data = data;
transport->vtable = &taken_over_vtable;
@@ -1054,6 +1103,7 @@ static struct transport_vtable bundle_vtable = {
static struct transport_vtable builtin_smart_vtable = {
.get_refs_list = get_refs_via_connect,
+ .get_bundle_uri = get_bundle_uri,
.fetch_refs = fetch_refs_via_pack,
.push_refs = git_transport_push,
.connect = connect_git,
@@ -1068,6 +1118,9 @@ struct transport *transport_get(struct remote *remote, const char *url)
ret->progress = isatty(2);
string_list_init_dup(&ret->pack_lockfiles);
+ CALLOC_ARRAY(ret->bundles, 1);
+ init_bundle_list(ret->bundles);
+
if (!remote)
BUG("No remote provided to transport_get()");
@@ -1118,7 +1171,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
ret->smart_options = &(data->options);
data->conn = NULL;
- data->got_remote_heads = 0;
+ data->finished_handshake = 0;
} else {
/* Unknown protocol in URL. Pass to external handler. */
int len = external_specification_len(url);
@@ -1482,6 +1535,34 @@ int transport_fetch_refs(struct transport *transport, struct ref *refs)
return rc;
}
+int transport_get_remote_bundle_uri(struct transport *transport)
+{
+ int value = 0;
+ const struct transport_vtable *vtable = transport->vtable;
+
+ /* Check config only once. */
+ if (transport->got_remote_bundle_uri)
+ return 0;
+ transport->got_remote_bundle_uri = 1;
+
+ /*
+ * Don't request bundle-uri from the server unless configured to
+ * do so by the transfer.bundleURI=true config option.
+ */
+ if (git_config_get_bool("transfer.bundleuri", &value) || !value)
+ return 0;
+
+ if (!transport->bundles->baseURI)
+ transport->bundles->baseURI = xstrdup(transport->url);
+
+ if (!vtable->get_bundle_uri)
+ return error(_("bundle-uri operation not supported by protocol"));
+
+ if (vtable->get_bundle_uri(transport) < 0)
+ return error(_("could not retrieve server-advertised bundle-uri list"));
+ return 0;
+}
+
void transport_unlock_pack(struct transport *transport, unsigned int flags)
{
int in_signal_handler = !!(flags & TRANSPORT_UNLOCK_PACK_IN_SIGNAL_HANDLER);
@@ -1512,6 +1593,8 @@ int transport_disconnect(struct transport *transport)
ret = transport->vtable->disconnect(transport);
if (transport->got_remote_refs)
free_refs((void *)transport->remote_refs);
+ clear_bundle_list(transport->bundles);
+ free(transport->bundles);
free(transport);
return ret;
}
diff --git a/transport.h b/transport.h
index b5bf7b3e70..6393cd9823 100644
--- a/transport.h
+++ b/transport.h
@@ -1,7 +1,6 @@
#ifndef TRANSPORT_H
#define TRANSPORT_H
-#include "cache.h"
#include "run-command.h"
#include "remote.h"
#include "list-objects-filter-options.h"
@@ -62,6 +61,7 @@ enum transport_family {
TRANSPORT_FAMILY_IPV6
};
+struct bundle_list;
struct transport {
const struct transport_vtable *vtable;
@@ -76,6 +76,18 @@ struct transport {
*/
unsigned got_remote_refs : 1;
+ /**
+ * Indicates whether we already called get_bundle_uri_list(); set by
+ * transport.c::transport_get_remote_bundle_uri().
+ */
+ unsigned got_remote_bundle_uri : 1;
+
+ /*
+ * The results of "command=bundle-uri", if both sides support
+ * the "bundle-uri" capability.
+ */
+ struct bundle_list *bundles;
+
/*
* Transports that call take-over destroys the data specific to
* the transport type while doing so, and cannot be reused.
@@ -281,6 +293,12 @@ void transport_ls_refs_options_release(struct transport_ls_refs_options *opts);
const struct ref *transport_get_remote_refs(struct transport *transport,
struct transport_ls_refs_options *transport_options);
+/**
+ * Retrieve bundle URI(s) from a remote. Populates "struct
+ * transport"'s "bundle_uri" and "got_remote_bundle_uri".
+ */
+int transport_get_remote_bundle_uri(struct transport *transport);
+
/*
* Fetch the hash algorithm used by a remote.
*
diff --git a/tree-diff.c b/tree-diff.c
index 69031d7cba..20bb15f38d 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -1,10 +1,24 @@
/*
* Helper functions for tree diff generation
*/
-#include "cache.h"
+#include "git-compat-util.h"
#include "diff.h"
#include "diffcore.h"
#include "tree.h"
+#include "tree-walk.h"
+
+/*
+ * Some mode bits are also used internally for computations.
+ *
+ * They *must* not overlap with any valid modes, and they *must* not be emitted
+ * to outside world - i.e. appear on disk or network. In other words, it's just
+ * temporary fields, which we internally use, but they have to stay in-house.
+ *
+ * ( such approach is valid, as standard S_IF* fits into 16 bits, and in Git
+ * codebase mode is `unsigned int` which is assumed to be at least 32 bits )
+ */
+
+#define S_DIFFTREE_IFXMIN_NEQ 0x80000000
/*
* internal mode marker, saying a tree entry != entry of tp[imin]
diff --git a/tree-walk.c b/tree-walk.c
index 74f4d710e8..d3c48e06df 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -1,7 +1,12 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "tree-walk.h"
+#include "alloc.h"
#include "dir.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-file.h"
#include "object-store.h"
+#include "trace2.h"
#include "tree.h"
#include "pathspec.h"
#include "json-writer.h"
diff --git a/tree-walk.h b/tree-walk.h
index 6305d53150..01a9d8eb44 100644
--- a/tree-walk.h
+++ b/tree-walk.h
@@ -1,7 +1,10 @@
#ifndef TREE_WALK_H
#define TREE_WALK_H
-#include "cache.h"
+#include "hash-ll.h"
+
+struct index_state;
+struct repository;
#define MAX_TRAVERSE_TREES 8
diff --git a/tree.c b/tree.c
index 410e3b477e..0dd2029a8a 100644
--- a/tree.c
+++ b/tree.c
@@ -1,6 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "cache-tree.h"
+#include "hex.h"
#include "tree.h"
+#include "object-name.h"
#include "object-store.h"
#include "blob.h"
#include "commit.h"
@@ -58,7 +60,7 @@ int read_tree_at(struct repository *r,
oid_to_hex(&entry.oid),
base->buf, entry.path);
- if (parse_commit(commit))
+ if (repo_parse_commit(r, commit))
die("Invalid commit %s in submodule path %s%s",
oid_to_hex(&entry.oid),
base->buf, entry.path);
@@ -92,14 +94,72 @@ int read_tree(struct repository *r,
return ret;
}
-int cmp_cache_name_compare(const void *a_, const void *b_)
+int base_name_compare(const char *name1, size_t len1, int mode1,
+ const char *name2, size_t len2, int mode2)
{
- const struct cache_entry *ce1, *ce2;
+ unsigned char c1, c2;
+ size_t len = len1 < len2 ? len1 : len2;
+ int cmp;
+
+ cmp = memcmp(name1, name2, len);
+ if (cmp)
+ return cmp;
+ c1 = name1[len];
+ c2 = name2[len];
+ if (!c1 && S_ISDIR(mode1))
+ c1 = '/';
+ if (!c2 && S_ISDIR(mode2))
+ c2 = '/';
+ return (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0;
+}
+
+/*
+ * df_name_compare() is identical to base_name_compare(), except it
+ * compares conflicting directory/file entries as equal. Note that
+ * while a directory name compares as equal to a regular file, they
+ * then individually compare _differently_ to a filename that has
+ * a dot after the basename (because '\0' < '.' < '/').
+ *
+ * This is used by routines that want to traverse the git namespace
+ * but then handle conflicting entries together when possible.
+ */
+int df_name_compare(const char *name1, size_t len1, int mode1,
+ const char *name2, size_t len2, int mode2)
+{
+ unsigned char c1, c2;
+ size_t len = len1 < len2 ? len1 : len2;
+ int cmp;
+
+ cmp = memcmp(name1, name2, len);
+ if (cmp)
+ return cmp;
+ /* Directories and files compare equal (same length, same name) */
+ if (len1 == len2)
+ return 0;
+ c1 = name1[len];
+ if (!c1 && S_ISDIR(mode1))
+ c1 = '/';
+ c2 = name2[len];
+ if (!c2 && S_ISDIR(mode2))
+ c2 = '/';
+ if (c1 == '/' && !c2)
+ return 0;
+ if (c2 == '/' && !c1)
+ return 0;
+ return c1 - c2;
+}
- ce1 = *((const struct cache_entry **)a_);
- ce2 = *((const struct cache_entry **)b_);
- return cache_name_stage_compare(ce1->name, ce1->ce_namelen, ce_stage(ce1),
- ce2->name, ce2->ce_namelen, ce_stage(ce2));
+int name_compare(const char *name1, size_t len1, const char *name2, size_t len2)
+{
+ size_t min_len = (len1 < len2) ? len1 : len2;
+ int cmp = memcmp(name1, name2, min_len);
+ if (cmp)
+ return cmp;
+ if (len1 < len2)
+ return -1;
+ if (len1 > len2)
+ return 1;
+ return 0;
}
struct tree *lookup_tree(struct repository *r, const struct object_id *oid)
@@ -129,7 +189,8 @@ int parse_tree_gently(struct tree *item, int quiet_on_missing)
if (item->object.parsed)
return 0;
- buffer = read_object_file(&item->object.oid, &type, &size);
+ buffer = repo_read_object_file(the_repository, &item->object.oid,
+ &type, &size);
if (!buffer)
return quiet_on_missing ? -1 :
error("Could not read %s",
diff --git a/tree.h b/tree.h
index 6efff003e2..1b5ecbda6b 100644
--- a/tree.h
+++ b/tree.h
@@ -3,6 +3,7 @@
#include "object.h"
+struct pathspec;
struct repository;
struct strbuf;
@@ -28,7 +29,15 @@ void free_tree_buffer(struct tree *tree);
/* Parses and returns the tree in the given ent, chasing tags and commits. */
struct tree *parse_tree_indirect(const struct object_id *oid);
-int cmp_cache_name_compare(const void *a_, const void *b_);
+/*
+ * Functions for comparing pathnames
+ */
+int base_name_compare(const char *name1, size_t len1, int mode1,
+ const char *name2, size_t len2, int mode2);
+int df_name_compare(const char *name1, size_t len1, int mode1,
+ const char *name2, size_t len2, int mode2);
+int name_compare(const char *name1, size_t len1,
+ const char *name2, size_t len2);
#define READ_TREE_RECURSIVE 1
typedef int (*read_tree_fn_t)(const struct object_id *, struct strbuf *, const char *, unsigned int, void *);
diff --git a/unicode-width.h b/unicode-width.h
index 97c851b27d..e15fb0455b 100644
--- a/unicode-width.h
+++ b/unicode-width.h
@@ -94,7 +94,7 @@ static const struct interval zero_width[] = {
{ 0x0E47, 0x0E4E },
{ 0x0EB1, 0x0EB1 },
{ 0x0EB4, 0x0EBC },
-{ 0x0EC8, 0x0ECD },
+{ 0x0EC8, 0x0ECE },
{ 0x0F18, 0x0F19 },
{ 0x0F35, 0x0F35 },
{ 0x0F37, 0x0F37 },
@@ -228,6 +228,7 @@ static const struct interval zero_width[] = {
{ 0x10AE5, 0x10AE6 },
{ 0x10D24, 0x10D27 },
{ 0x10EAB, 0x10EAC },
+{ 0x10EFD, 0x10EFF },
{ 0x10F46, 0x10F50 },
{ 0x10F82, 0x10F85 },
{ 0x11001, 0x11001 },
@@ -252,6 +253,7 @@ static const struct interval zero_width[] = {
{ 0x11234, 0x11234 },
{ 0x11236, 0x11237 },
{ 0x1123E, 0x1123E },
+{ 0x11241, 0x11241 },
{ 0x112DF, 0x112DF },
{ 0x112E3, 0x112EA },
{ 0x11300, 0x11301 },
@@ -313,7 +315,12 @@ static const struct interval zero_width[] = {
{ 0x11D95, 0x11D95 },
{ 0x11D97, 0x11D97 },
{ 0x11EF3, 0x11EF4 },
-{ 0x13430, 0x13438 },
+{ 0x11F00, 0x11F01 },
+{ 0x11F36, 0x11F3A },
+{ 0x11F40, 0x11F40 },
+{ 0x11F42, 0x11F42 },
+{ 0x13430, 0x13440 },
+{ 0x13447, 0x13455 },
{ 0x16AF0, 0x16AF4 },
{ 0x16B30, 0x16B36 },
{ 0x16F4F, 0x16F4F },
@@ -339,9 +346,11 @@ static const struct interval zero_width[] = {
{ 0x1E01B, 0x1E021 },
{ 0x1E023, 0x1E024 },
{ 0x1E026, 0x1E02A },
+{ 0x1E08F, 0x1E08F },
{ 0x1E130, 0x1E136 },
{ 0x1E2AE, 0x1E2AE },
{ 0x1E2EC, 0x1E2EF },
+{ 0x1E4EC, 0x1E4EF },
{ 0x1E8D0, 0x1E8D6 },
{ 0x1E944, 0x1E94A },
{ 0xE0001, 0xE0001 },
@@ -417,7 +426,9 @@ static const struct interval double_width[] = {
{ 0x1AFF5, 0x1AFFB },
{ 0x1AFFD, 0x1AFFE },
{ 0x1B000, 0x1B122 },
+{ 0x1B132, 0x1B132 },
{ 0x1B150, 0x1B152 },
+{ 0x1B155, 0x1B155 },
{ 0x1B164, 0x1B167 },
{ 0x1B170, 0x1B2FB },
{ 0x1F004, 0x1F004 },
@@ -451,7 +462,7 @@ static const struct interval double_width[] = {
{ 0x1F6CC, 0x1F6CC },
{ 0x1F6D0, 0x1F6D2 },
{ 0x1F6D5, 0x1F6D7 },
-{ 0x1F6DD, 0x1F6DF },
+{ 0x1F6DC, 0x1F6DF },
{ 0x1F6EB, 0x1F6EC },
{ 0x1F6F4, 0x1F6FC },
{ 0x1F7E0, 0x1F7EB },
@@ -459,15 +470,13 @@ static const struct interval double_width[] = {
{ 0x1F90C, 0x1F93A },
{ 0x1F93C, 0x1F945 },
{ 0x1F947, 0x1F9FF },
-{ 0x1FA70, 0x1FA74 },
-{ 0x1FA78, 0x1FA7C },
-{ 0x1FA80, 0x1FA86 },
-{ 0x1FA90, 0x1FAAC },
-{ 0x1FAB0, 0x1FABA },
-{ 0x1FAC0, 0x1FAC5 },
-{ 0x1FAD0, 0x1FAD9 },
-{ 0x1FAE0, 0x1FAE7 },
-{ 0x1FAF0, 0x1FAF6 },
+{ 0x1FA70, 0x1FA7C },
+{ 0x1FA80, 0x1FA88 },
+{ 0x1FA90, 0x1FABD },
+{ 0x1FABF, 0x1FAC5 },
+{ 0x1FACE, 0x1FADB },
+{ 0x1FAE0, 0x1FAE8 },
+{ 0x1FAF0, 0x1FAF8 },
{ 0x20000, 0x2FFFD },
{ 0x30000, 0x3FFFD }
};
diff --git a/unix-socket.c b/unix-socket.c
index e0be1badb5..79800d8063 100644
--- a/unix-socket.c
+++ b/unix-socket.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "strbuf.h"
#include "unix-socket.h"
#define DEFAULT_UNIX_STREAM_LISTEN_BACKLOG (5)
diff --git a/unix-stream-server.c b/unix-stream-server.c
index efa2a207ab..22ac2373e0 100644
--- a/unix-stream-server.c
+++ b/unix-stream-server.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "lockfile.h"
#include "unix-socket.h"
#include "unix-stream-server.h"
diff --git a/unpack-trees.c b/unpack-trees.c
index bae812156c..e8c32a40dc 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1,8 +1,12 @@
#include "cache.h"
+#include "advice.h"
#include "strvec.h"
#include "repository.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "tree.h"
#include "tree-walk.h"
#include "cache-tree.h"
@@ -14,12 +18,14 @@
#include "sparse-index.h"
#include "submodule.h"
#include "submodule-config.h"
+#include "symlinks.h"
+#include "trace2.h"
#include "fsmonitor.h"
#include "object-store.h"
#include "promisor-remote.h"
#include "entry.h"
#include "parallel-checkout.h"
-#include "sparse-index.h"
+#include "setup.h"
/*
* Error messages expected by scripts out of plumbing commands such as
@@ -67,11 +73,11 @@ static const char *unpack_plumbing_errors[NB_UNPACK_TREES_WARNING_TYPES] = {
};
#define ERRORMSG(o,type) \
- ( ((o) && (o)->msgs[(type)]) \
- ? ((o)->msgs[(type)]) \
+ ( ((o) && (o)->internal.msgs[(type)]) \
+ ? ((o)->internal.msgs[(type)]) \
: (unpack_plumbing_errors[(type)]) )
-static const char *super_prefixed(const char *path)
+static const char *super_prefixed(const char *path, const char *super_prefix)
{
/*
* It is necessary and sufficient to have two static buffers
@@ -83,7 +89,6 @@ static const char *super_prefixed(const char *path)
static unsigned idx = ARRAY_SIZE(buf) - 1;
if (super_prefix_len < 0) {
- const char *super_prefix = get_super_prefix();
if (!super_prefix) {
super_prefix_len = 0;
} else {
@@ -110,10 +115,10 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
const char *cmd)
{
int i;
- const char **msgs = opts->msgs;
+ const char **msgs = opts->internal.msgs;
const char *msg;
- strvec_init(&opts->msgs_to_free);
+ strvec_init(&opts->internal.msgs_to_free);
if (!strcmp(cmd, "checkout"))
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
@@ -131,7 +136,7 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
"Please commit your changes or stash them before you %s.")
: _("Your local changes to the following files would be overwritten by %s:\n%%s");
msgs[ERROR_WOULD_OVERWRITE] = msgs[ERROR_NOT_UPTODATE_FILE] =
- strvec_pushf(&opts->msgs_to_free, msg, cmd, cmd);
+ strvec_pushf(&opts->internal.msgs_to_free, msg, cmd, cmd);
msgs[ERROR_NOT_UPTODATE_DIR] =
_("Updating the following directories would lose untracked files in them:\n%s");
@@ -155,7 +160,7 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
"Please move or remove them before you %s.")
: _("The following untracked working tree files would be removed by %s:\n%%s");
msgs[ERROR_WOULD_LOSE_UNTRACKED_REMOVED] =
- strvec_pushf(&opts->msgs_to_free, msg, cmd, cmd);
+ strvec_pushf(&opts->internal.msgs_to_free, msg, cmd, cmd);
if (!strcmp(cmd, "checkout"))
msg = advice_enabled(ADVICE_COMMIT_BEFORE_MERGE)
@@ -173,7 +178,7 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
"Please move or remove them before you %s.")
: _("The following untracked working tree files would be overwritten by %s:\n%%s");
msgs[ERROR_WOULD_LOSE_UNTRACKED_OVERWRITTEN] =
- strvec_pushf(&opts->msgs_to_free, msg, cmd, cmd);
+ strvec_pushf(&opts->internal.msgs_to_free, msg, cmd, cmd);
/*
* Special case: ERROR_BIND_OVERLAP refers to a pair of paths, we
@@ -191,16 +196,16 @@ void setup_unpack_trees_porcelain(struct unpack_trees_options *opts,
msgs[WARNING_SPARSE_ORPHANED_NOT_OVERWRITTEN] =
_("The following paths were already present and thus not updated despite sparse patterns:\n%s");
- opts->show_all_errors = 1;
+ opts->internal.show_all_errors = 1;
/* rejected paths may not have a static buffer */
- for (i = 0; i < ARRAY_SIZE(opts->unpack_rejects); i++)
- opts->unpack_rejects[i].strdup_strings = 1;
+ for (i = 0; i < ARRAY_SIZE(opts->internal.unpack_rejects); i++)
+ opts->internal.unpack_rejects[i].strdup_strings = 1;
}
void clear_unpack_trees_porcelain(struct unpack_trees_options *opts)
{
- strvec_clear(&opts->msgs_to_free);
- memset(opts->msgs, 0, sizeof(opts->msgs));
+ strvec_clear(&opts->internal.msgs_to_free);
+ memset(opts->internal.msgs, 0, sizeof(opts->internal.msgs));
}
static int do_add_entry(struct unpack_trees_options *o, struct cache_entry *ce,
@@ -212,7 +217,7 @@ static int do_add_entry(struct unpack_trees_options *o, struct cache_entry *ce,
set |= CE_WT_REMOVE;
ce->ce_flags = (ce->ce_flags & ~clear) | set;
- return add_index_entry(&o->result, ce,
+ return add_index_entry(&o->internal.result, ce,
ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE);
}
@@ -220,7 +225,7 @@ static void add_entry(struct unpack_trees_options *o,
const struct cache_entry *ce,
unsigned int set, unsigned int clear)
{
- do_add_entry(o, dup_cache_entry(ce, &o->result), set, clear);
+ do_add_entry(o, dup_cache_entry(ce, &o->internal.result), set, clear);
}
/*
@@ -235,14 +240,15 @@ static int add_rejected_path(struct unpack_trees_options *o,
if (o->quiet)
return -1;
- if (!o->show_all_errors)
- return error(ERRORMSG(o, e), super_prefixed(path));
+ if (!o->internal.show_all_errors)
+ return error(ERRORMSG(o, e), super_prefixed(path,
+ o->super_prefix));
/*
* Otherwise, insert in a list for future display by
* display_(error|warning)_msgs()
*/
- string_list_append(&o->unpack_rejects[e], path);
+ string_list_append(&o->internal.unpack_rejects[e], path);
return -1;
}
@@ -254,7 +260,7 @@ static void display_error_msgs(struct unpack_trees_options *o)
int e;
unsigned error_displayed = 0;
for (e = 0; e < NB_UNPACK_TREES_ERROR_TYPES; e++) {
- struct string_list *rejects = &o->unpack_rejects[e];
+ struct string_list *rejects = &o->internal.unpack_rejects[e];
if (rejects->nr > 0) {
int i;
@@ -263,7 +269,8 @@ static void display_error_msgs(struct unpack_trees_options *o)
error_displayed = 1;
for (i = 0; i < rejects->nr; i++)
strbuf_addf(&path, "\t%s\n", rejects->items[i].string);
- error(ERRORMSG(o, e), super_prefixed(path.buf));
+ error(ERRORMSG(o, e), super_prefixed(path.buf,
+ o->super_prefix));
strbuf_release(&path);
}
string_list_clear(rejects, 0);
@@ -281,7 +288,7 @@ static void display_warning_msgs(struct unpack_trees_options *o)
unsigned warning_displayed = 0;
for (e = NB_UNPACK_TREES_ERROR_TYPES + 1;
e < NB_UNPACK_TREES_WARNING_TYPES; e++) {
- struct string_list *rejects = &o->unpack_rejects[e];
+ struct string_list *rejects = &o->internal.unpack_rejects[e];
if (rejects->nr > 0) {
int i;
@@ -290,7 +297,8 @@ static void display_warning_msgs(struct unpack_trees_options *o)
warning_displayed = 1;
for (i = 0; i < rejects->nr; i++)
strbuf_addf(&path, "\t%s\n", rejects->items[i].string);
- warning(ERRORMSG(o, e), super_prefixed(path.buf));
+ warning(ERRORMSG(o, e), super_prefixed(path.buf,
+ o->super_prefix));
strbuf_release(&path);
}
string_list_clear(rejects, 0);
@@ -312,7 +320,8 @@ static int check_submodule_move_head(const struct cache_entry *ce,
if (o->reset)
flags |= SUBMODULE_MOVE_HEAD_FORCE;
- if (submodule_move_head(ce->name, old_id, new_id, flags))
+ if (submodule_move_head(ce->name, o->super_prefix, old_id, new_id,
+ flags))
return add_rejected_path(o, ERROR_WOULD_LOSE_SUBMODULE, ce->name);
return 0;
}
@@ -415,6 +424,7 @@ static int check_updates(struct unpack_trees_options *o,
int i, pc_workers, pc_threshold;
trace_performance_enter();
+ state.super_prefix = o->super_prefix;
state.force = 1;
state.quiet = 1;
state.refresh_cache = 1;
@@ -445,7 +455,7 @@ static int check_updates(struct unpack_trees_options *o,
if (ce->ce_flags & CE_WT_REMOVE) {
display_progress(progress, ++cnt);
- unlink_entry(ce);
+ unlink_entry(ce, o->super_prefix);
}
}
@@ -455,7 +465,7 @@ static int check_updates(struct unpack_trees_options *o,
if (should_update_submodules())
load_gitmodules_file(index, &state);
- if (has_promisor_remote())
+ if (repo_has_promisor_remote(the_repository))
/*
* Prefetch the objects that are to be checked out in the loop
* below.
@@ -597,13 +607,14 @@ static void mark_ce_used(struct cache_entry *ce, struct unpack_trees_options *o)
{
ce->ce_flags |= CE_UNPACKED;
- if (o->cache_bottom < o->src_index->cache_nr &&
- o->src_index->cache[o->cache_bottom] == ce) {
- int bottom = o->cache_bottom;
+ if (o->internal.cache_bottom < o->src_index->cache_nr &&
+ o->src_index->cache[o->internal.cache_bottom] == ce) {
+ int bottom = o->internal.cache_bottom;
+
while (bottom < o->src_index->cache_nr &&
o->src_index->cache[bottom]->ce_flags & CE_UNPACKED)
bottom++;
- o->cache_bottom = bottom;
+ o->internal.cache_bottom = bottom;
}
}
@@ -649,7 +660,7 @@ static void mark_ce_used_same_name(struct cache_entry *ce,
static struct cache_entry *next_cache_entry(struct unpack_trees_options *o)
{
const struct index_state *index = o->src_index;
- int pos = o->cache_bottom;
+ int pos = o->internal.cache_bottom;
while (pos < index->cache_nr) {
struct cache_entry *ce = index->cache[pos];
@@ -708,7 +719,7 @@ static void restore_cache_bottom(struct traverse_info *info, int bottom)
if (o->diff_index_cached)
return;
- o->cache_bottom = bottom;
+ o->internal.cache_bottom = bottom;
}
static int switch_cache_bottom(struct traverse_info *info)
@@ -718,13 +729,13 @@ static int switch_cache_bottom(struct traverse_info *info)
if (o->diff_index_cached)
return 0;
- ret = o->cache_bottom;
+ ret = o->internal.cache_bottom;
pos = find_cache_pos(info->prev, info->name, info->namelen);
if (pos < -1)
- o->cache_bottom = -2 - pos;
+ o->internal.cache_bottom = -2 - pos;
else if (pos < 0)
- o->cache_bottom = o->src_index->cache_nr;
+ o->internal.cache_bottom = o->src_index->cache_nr;
return ret;
}
@@ -835,7 +846,7 @@ static int traverse_by_cache_tree(int pos, int nr_entries, int nr_names,
mark_ce_used(src[0], o);
}
free(tree_ce);
- if (o->debug_unpack)
+ if (o->internal.debug_unpack)
printf("Unpacked %d entries from %s to %s using cache-tree\n",
nr_entries,
o->src_index->cache[pos]->name,
@@ -870,9 +881,9 @@ static int traverse_trees_recursive(int n, unsigned long dirmask,
* save and restore cache_bottom anyway to not miss
* unprocessed entries before 'pos'.
*/
- bottom = o->cache_bottom;
+ bottom = o->internal.cache_bottom;
ret = traverse_by_cache_tree(pos, nr_entries, n, info);
- o->cache_bottom = bottom;
+ o->internal.cache_bottom = bottom;
return ret;
}
@@ -1209,8 +1220,8 @@ static int unpack_single_entry(int n, unsigned long mask,
* cache entry from the index aware logic.
*/
src[i + o->merge] = create_ce_entry(info, names + i, stage,
- &o->result, o->merge,
- bit & dirmask);
+ &o->internal.result,
+ o->merge, bit & dirmask);
}
if (o->merge) {
@@ -1234,7 +1245,7 @@ static int unpack_single_entry(int n, unsigned long mask,
static int unpack_failed(struct unpack_trees_options *o, const char *message)
{
- discard_index(&o->result);
+ discard_index(&o->internal.result);
if (!o->quiet && !o->exiting_early) {
if (message)
return error("%s", message);
@@ -1257,7 +1268,7 @@ static int find_cache_pos(struct traverse_info *info,
struct index_state *index = o->src_index;
int pfxlen = info->pathlen;
- for (pos = o->cache_bottom; pos < index->cache_nr; pos++) {
+ for (pos = o->internal.cache_bottom; pos < index->cache_nr; pos++) {
const struct cache_entry *ce = index->cache[pos];
const char *ce_name, *ce_slash;
int cmp, ce_len;
@@ -1268,8 +1279,8 @@ static int find_cache_pos(struct traverse_info *info,
* we can never match it; don't check it
* again.
*/
- if (pos == o->cache_bottom)
- ++o->cache_bottom;
+ if (pos == o->internal.cache_bottom)
+ ++o->internal.cache_bottom;
continue;
}
if (!ce_in_traverse_path(ce, info)) {
@@ -1447,7 +1458,7 @@ static int unpack_sparse_callback(int n, unsigned long mask, unsigned long dirma
*/
if (!is_null_oid(&names[0].oid)) {
src[0] = create_ce_entry(info, &names[0], 0,
- &o->result, 1,
+ &o->internal.result, 1,
dirmask & (1ul << 0));
src[0]->ce_flags |= (CE_SKIP_WORKTREE | CE_NEW_SKIP_WORKTREE);
}
@@ -1484,7 +1495,7 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
while (!p->mode)
p++;
- if (o->debug_unpack)
+ if (o->internal.debug_unpack)
debug_unpack_callback(n, mask, dirmask, names, info);
/* Are we supposed to look at the index too? */
@@ -1557,7 +1568,7 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
* in 'mark_ce_used()'
*/
if (!src[0] || !S_ISSPARSEDIR(src[0]->ce_mode))
- o->cache_bottom += matches;
+ o->internal.cache_bottom += matches;
return mask;
}
}
@@ -1806,7 +1817,7 @@ static void populate_from_existing_patterns(struct unpack_trees_options *o,
if (get_sparse_checkout_patterns(pl) < 0)
o->skip_sparse_checkout = 1;
else
- o->pl = pl;
+ o->internal.pl = pl;
}
static void update_sparsity_for_prefix(const char *prefix,
@@ -1868,8 +1879,12 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
if (len > MAX_UNPACK_TREES)
die("unpack_trees takes at most %d trees", MAX_UNPACK_TREES);
- if (o->dir)
- BUG("o->dir is for internal use only");
+ if (o->internal.dir)
+ BUG("o->internal.dir is for internal use only");
+ if (o->internal.pl)
+ BUG("o->internal.pl is for internal use only");
+ if (o->df_conflict_entry)
+ BUG("o->df_conflict_entry is an output only field");
trace_performance_enter();
trace2_region_enter("unpack_trees", "unpack_trees", the_repository);
@@ -1877,7 +1892,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
prepare_repo_settings(repo);
if (repo->settings.command_requires_full_index) {
ensure_full_index(o->src_index);
- ensure_full_index(o->dst_index);
+ if (o->dst_index)
+ ensure_full_index(o->dst_index);
}
if (o->reset == UNPACK_RESET_OVERWRITE_UNTRACKED &&
@@ -1885,9 +1901,9 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
BUG("UNPACK_RESET_OVERWRITE_UNTRACKED incompatible with preserved ignored files");
if (!o->preserve_ignored) {
- o->dir = &dir;
- o->dir->flags |= DIR_SHOW_IGNORED;
- setup_standard_excludes(o->dir);
+ o->internal.dir = &dir;
+ o->internal.dir->flags |= DIR_SHOW_IGNORED;
+ setup_standard_excludes(o->internal.dir);
}
if (o->prefix)
@@ -1895,49 +1911,52 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
if (!core_apply_sparse_checkout || !o->update)
o->skip_sparse_checkout = 1;
- if (!o->skip_sparse_checkout && !o->pl) {
+ if (!o->skip_sparse_checkout) {
memset(&pl, 0, sizeof(pl));
free_pattern_list = 1;
populate_from_existing_patterns(o, &pl);
}
- memset(&o->result, 0, sizeof(o->result));
- o->result.initialized = 1;
- o->result.timestamp.sec = o->src_index->timestamp.sec;
- o->result.timestamp.nsec = o->src_index->timestamp.nsec;
- o->result.version = o->src_index->version;
+ index_state_init(&o->internal.result, o->src_index->repo);
+ o->internal.result.initialized = 1;
+ o->internal.result.timestamp.sec = o->src_index->timestamp.sec;
+ o->internal.result.timestamp.nsec = o->src_index->timestamp.nsec;
+ o->internal.result.version = o->src_index->version;
if (!o->src_index->split_index) {
- o->result.split_index = NULL;
+ o->internal.result.split_index = NULL;
} else if (o->src_index == o->dst_index) {
/*
* o->dst_index (and thus o->src_index) will be discarded
- * and overwritten with o->result at the end of this function,
- * so just use src_index's split_index to avoid having to
- * create a new one.
+ * and overwritten with o->internal.result at the end of
+ * this function, so just use src_index's split_index to
+ * avoid having to create a new one.
*/
- o->result.split_index = o->src_index->split_index;
- o->result.split_index->refcount++;
+ o->internal.result.split_index = o->src_index->split_index;
+ if (o->src_index->cache_changed & SPLIT_INDEX_ORDERED)
+ o->internal.result.cache_changed |= SPLIT_INDEX_ORDERED;
+ o->internal.result.split_index->refcount++;
} else {
- o->result.split_index = init_split_index(&o->result);
+ o->internal.result.split_index =
+ init_split_index(&o->internal.result);
}
- oidcpy(&o->result.oid, &o->src_index->oid);
- o->merge_size = len;
+ oidcpy(&o->internal.result.oid, &o->src_index->oid);
+ o->internal.merge_size = len;
mark_all_ce_unused(o->src_index);
- o->result.fsmonitor_last_update =
+ o->internal.result.fsmonitor_last_update =
xstrdup_or_null(o->src_index->fsmonitor_last_update);
- o->result.fsmonitor_has_run_once = o->src_index->fsmonitor_has_run_once;
+ o->internal.result.fsmonitor_has_run_once = o->src_index->fsmonitor_has_run_once;
if (!o->src_index->initialized &&
!repo->settings.command_requires_full_index &&
- is_sparse_index_allowed(&o->result, 0))
- o->result.sparse_index = 1;
+ is_sparse_index_allowed(&o->internal.result, 0))
+ o->internal.result.sparse_index = 1;
/*
* Sparse checkout loop #1: set NEW_SKIP_WORKTREE on existing entries
*/
if (!o->skip_sparse_checkout)
- mark_new_skip_worktree(o->pl, o->src_index, 0,
+ mark_new_skip_worktree(o->internal.pl, o->src_index, 0,
CE_NEW_SKIP_WORKTREE, o->verbose_update);
if (!dfc)
@@ -1951,7 +1970,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
setup_traverse_info(&info, prefix);
info.fn = unpack_callback;
info.data = o;
- info.show_all_errors = o->show_all_errors;
+ info.show_all_errors = o->internal.show_all_errors;
info.pathspec = o->pathspec;
if (o->prefix) {
@@ -1992,7 +2011,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
}
mark_all_ce_unused(o->src_index);
- if (o->trivial_merges_only && o->nontrivial_merge) {
+ if (o->trivial_merges_only && o->internal.nontrivial_merge) {
ret = unpack_failed(o, "Merge requires file-level merging");
goto done;
}
@@ -2003,13 +2022,13 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
* If they will have NEW_SKIP_WORKTREE, also set CE_SKIP_WORKTREE
* so apply_sparse_checkout() won't attempt to remove it from worktree
*/
- mark_new_skip_worktree(o->pl, &o->result,
+ mark_new_skip_worktree(o->internal.pl, &o->internal.result,
CE_ADDED, CE_SKIP_WORKTREE | CE_NEW_SKIP_WORKTREE,
o->verbose_update);
ret = 0;
- for (i = 0; i < o->result.cache_nr; i++) {
- struct cache_entry *ce = o->result.cache[i];
+ for (i = 0; i < o->internal.result.cache_nr; i++) {
+ struct cache_entry *ce = o->internal.result.cache[i];
/*
* Entries marked with CE_ADDED in merged_entry() do not have
@@ -2023,7 +2042,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
verify_absent(ce, WARNING_SPARSE_ORPHANED_NOT_OVERWRITTEN, o))
ret = 1;
- if (apply_sparse_checkout(&o->result, ce, o))
+ if (apply_sparse_checkout(&o->internal.result, ce, o))
ret = 1;
}
if (ret == 1) {
@@ -2031,45 +2050,47 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
* Inability to sparsify or de-sparsify individual
* paths is not an error, but just a warning.
*/
- if (o->show_all_errors)
+ if (o->internal.show_all_errors)
display_warning_msgs(o);
ret = 0;
}
}
- ret = check_updates(o, &o->result) ? (-2) : 0;
+ ret = check_updates(o, &o->internal.result) ? (-2) : 0;
if (o->dst_index) {
- move_index_extensions(&o->result, o->src_index);
+ move_index_extensions(&o->internal.result, o->src_index);
if (!ret) {
if (git_env_bool("GIT_TEST_CHECK_CACHE_TREE", 0))
- cache_tree_verify(the_repository, &o->result);
- if (!cache_tree_fully_valid(o->result.cache_tree))
- cache_tree_update(&o->result,
+ cache_tree_verify(the_repository,
+ &o->internal.result);
+ if (!o->skip_cache_tree_update &&
+ !cache_tree_fully_valid(o->internal.result.cache_tree))
+ cache_tree_update(&o->internal.result,
WRITE_TREE_SILENT |
WRITE_TREE_REPAIR);
}
- o->result.updated_workdir = 1;
+ o->internal.result.updated_workdir = 1;
discard_index(o->dst_index);
- *o->dst_index = o->result;
+ *o->dst_index = o->internal.result;
} else {
- discard_index(&o->result);
+ discard_index(&o->internal.result);
}
o->src_index = NULL;
done:
if (free_pattern_list)
clear_pattern_list(&pl);
- if (o->dir) {
- dir_clear(o->dir);
- o->dir = NULL;
+ if (o->internal.dir) {
+ dir_clear(o->internal.dir);
+ o->internal.dir = NULL;
}
trace2_region_leave("unpack_trees", "unpack_trees", the_repository);
trace_performance_leave("unpack_trees");
return ret;
return_failed:
- if (o->show_all_errors)
+ if (o->internal.show_all_errors)
display_error_msgs(o);
mark_all_ce_unused(o->src_index);
ret = unpack_failed(o, NULL);
@@ -2084,16 +2105,17 @@ return_failed:
*
* CE_NEW_SKIP_WORKTREE is used internally.
*/
-enum update_sparsity_result update_sparsity(struct unpack_trees_options *o)
+enum update_sparsity_result update_sparsity(struct unpack_trees_options *o,
+ struct pattern_list *pl)
{
enum update_sparsity_result ret = UPDATE_SPARSITY_SUCCESS;
- struct pattern_list pl;
int i;
unsigned old_show_all_errors;
int free_pattern_list = 0;
- old_show_all_errors = o->show_all_errors;
- o->show_all_errors = 1;
+ old_show_all_errors = o->internal.show_all_errors;
+ o->internal.show_all_errors = 1;
+ index_state_init(&o->internal.result, o->src_index->repo);
/* Sanity checks */
if (!o->update || o->index_only || o->skip_sparse_checkout)
@@ -2104,20 +2126,19 @@ enum update_sparsity_result update_sparsity(struct unpack_trees_options *o)
trace_performance_enter();
/* If we weren't given patterns, use the recorded ones */
- if (!o->pl) {
- memset(&pl, 0, sizeof(pl));
+ if (!pl) {
free_pattern_list = 1;
- populate_from_existing_patterns(o, &pl);
- if (o->skip_sparse_checkout)
- goto skip_sparse_checkout;
+ pl = xcalloc(1, sizeof(*pl));
+ populate_from_existing_patterns(o, pl);
}
+ o->internal.pl = pl;
/* Expand sparse directories as needed */
- expand_index(o->src_index, o->pl);
+ expand_index(o->src_index, o->internal.pl);
/* Set NEW_SKIP_WORKTREE on existing entries. */
mark_all_ce_unused(o->src_index);
- mark_new_skip_worktree(o->pl, o->src_index, 0,
+ mark_new_skip_worktree(o->internal.pl, o->src_index, 0,
CE_NEW_SKIP_WORKTREE, o->verbose_update);
/* Then loop over entries and update/remove as needed */
@@ -2137,14 +2158,16 @@ enum update_sparsity_result update_sparsity(struct unpack_trees_options *o)
ret = UPDATE_SPARSITY_WARNINGS;
}
-skip_sparse_checkout:
if (check_updates(o, o->src_index))
ret = UPDATE_SPARSITY_WORKTREE_UPDATE_FAILURES;
display_warning_msgs(o);
- o->show_all_errors = old_show_all_errors;
- if (free_pattern_list)
- clear_pattern_list(&pl);
+ o->internal.show_all_errors = old_show_all_errors;
+ if (free_pattern_list) {
+ clear_pattern_list(pl);
+ free(pl);
+ o->internal.pl = NULL;
+ }
trace_performance_leave("update_sparsity");
return ret;
}
@@ -2239,15 +2262,15 @@ static int verify_uptodate_sparse(const struct cache_entry *ce,
}
/*
- * TODO: We should actually invalidate o->result, not src_index [1].
+ * TODO: We should actually invalidate o->internal.result, not src_index [1].
* But since cache tree and untracked cache both are not copied to
- * o->result until unpacking is complete, we invalidate them on
+ * o->internal.result until unpacking is complete, we invalidate them on
* src_index instead with the assumption that they will be copied to
* dst_index at the end.
*
* [1] src_index->cache_tree is also used in unpack_callback() so if
- * we invalidate o->result, we need to update it to use
- * o->result.cache_tree as well.
+ * we invalidate o->internal.result, we need to update it to use
+ * o->internal.result.cache_tree as well.
*/
static void invalidate_ce_path(const struct cache_entry *ce,
struct unpack_trees_options *o)
@@ -2331,8 +2354,8 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
pathbuf = xstrfmt("%.*s/", namelen, ce->name);
memset(&d, 0, sizeof(d));
- if (o->dir)
- d.exclude_per_dir = o->dir->exclude_per_dir;
+ if (o->internal.dir)
+ setup_standard_excludes(&d);
i = read_directory(&d, o->src_index, pathbuf, namelen+1, NULL);
dir_clear(&d);
free(pathbuf);
@@ -2386,8 +2409,8 @@ static int check_ok_to_remove(const char *name, int len, int dtype,
if (ignore_case && icase_exists(o, name, len, st))
return 0;
- if (o->dir &&
- is_excluded(o->dir, o->src_index, name, &dtype))
+ if (o->internal.dir &&
+ is_excluded(o->internal.dir, o->src_index, name, &dtype))
/*
* ce->name is explicitly excluded, so it is Ok to
* overwrite it.
@@ -2415,7 +2438,7 @@ static int check_ok_to_remove(const char *name, int len, int dtype,
* delete this path, which is in a subdirectory that
* is being replaced with a blob.
*/
- result = index_file_exists(&o->result, name, len, 0);
+ result = index_file_exists(&o->internal.result, name, len, 0);
if (result) {
if (result->ce_flags & CE_REMOVE)
return 0;
@@ -2516,7 +2539,7 @@ static int merged_entry(const struct cache_entry *ce,
struct unpack_trees_options *o)
{
int update = CE_UPDATE;
- struct cache_entry *merge = dup_cache_entry(ce, &o->result);
+ struct cache_entry *merge = dup_cache_entry(ce, &o->internal.result);
if (!old) {
/*
@@ -2611,7 +2634,7 @@ static int merged_sparse_dir(const struct cache_entry * const *src, int n,
setup_traverse_info(&info, src[0]->name);
info.fn = unpack_sparse_callback;
info.data = o;
- info.show_all_errors = o->show_all_errors;
+ info.show_all_errors = o->internal.show_all_errors;
info.pathspec = o->pathspec;
/* Get the tree descriptors of the sparse directory in each of the merging trees */
@@ -2829,7 +2852,7 @@ int threeway_merge(const struct cache_entry * const *stages,
return -1;
}
- o->nontrivial_merge = 1;
+ o->internal.nontrivial_merge = 1;
/* #2, #3, #4, #6, #7, #9, #10, #11. */
count = 0;
@@ -2870,9 +2893,9 @@ int twoway_merge(const struct cache_entry * const *src,
const struct cache_entry *oldtree = src[1];
const struct cache_entry *newtree = src[2];
- if (o->merge_size != 2)
+ if (o->internal.merge_size != 2)
return error("Cannot do a twoway merge of %d trees",
- o->merge_size);
+ o->internal.merge_size);
if (oldtree == o->df_conflict_entry)
oldtree = NULL;
@@ -2952,14 +2975,14 @@ int bind_merge(const struct cache_entry * const *src,
const struct cache_entry *old = src[0];
const struct cache_entry *a = src[1];
- if (o->merge_size != 1)
+ if (o->internal.merge_size != 1)
return error("Cannot do a bind merge of %d trees",
- o->merge_size);
+ o->internal.merge_size);
if (a && old)
return o->quiet ? -1 :
error(ERRORMSG(o, ERROR_BIND_OVERLAP),
- super_prefixed(a->name),
- super_prefixed(old->name));
+ super_prefixed(a->name, o->super_prefix),
+ super_prefixed(old->name, o->super_prefix));
if (!a)
return keep_entry(old, o);
else
@@ -2978,9 +3001,9 @@ int oneway_merge(const struct cache_entry * const *src,
const struct cache_entry *old = src[0];
const struct cache_entry *a = src[1];
- if (o->merge_size != 1)
+ if (o->internal.merge_size != 1)
return error("Cannot do a oneway merge of %d trees",
- o->merge_size);
+ o->internal.merge_size);
if (!a || a == o->df_conflict_entry)
return deleted_entry(old, old, o);
@@ -3015,12 +3038,12 @@ int stash_worktree_untracked_merge(const struct cache_entry * const *src,
const struct cache_entry *worktree = src[1];
const struct cache_entry *untracked = src[2];
- if (o->merge_size != 2)
- BUG("invalid merge_size: %d", o->merge_size);
+ if (o->internal.merge_size != 2)
+ BUG("invalid merge_size: %d", o->internal.merge_size);
if (worktree && untracked)
return error(_("worktree and untracked commit have duplicate entries: %s"),
- super_prefixed(worktree->name));
+ super_prefixed(worktree->name, o->super_prefix));
return merged_entry(worktree ? worktree : untracked, NULL, o);
}
diff --git a/unpack-trees.h b/unpack-trees.h
index efb9edfbb2..30622aeebf 100644
--- a/unpack-trees.h
+++ b/unpack-trees.h
@@ -2,6 +2,7 @@
#define UNPACK_TREES_H
#include "cache.h"
+#include "convert.h"
#include "strvec.h"
#include "string-list.h"
#include "tree-walk.h"
@@ -59,45 +60,54 @@ struct unpack_trees_options {
preserve_ignored,
clone,
index_only,
- nontrivial_merge,
trivial_merges_only,
verbose_update,
aggressive,
skip_unmerged,
initial_checkout,
diff_index_cached,
- debug_unpack,
skip_sparse_checkout,
quiet,
exiting_early,
- show_all_errors,
- dry_run;
+ dry_run,
+ skip_cache_tree_update;
enum unpack_trees_reset_type reset;
const char *prefix;
- int cache_bottom;
+ const char *super_prefix;
struct pathspec *pathspec;
merge_fn_t fn;
- const char *msgs[NB_UNPACK_TREES_WARNING_TYPES];
- struct strvec msgs_to_free;
- /*
- * Store error messages in an array, each case
- * corresponding to a error message type
- */
- struct string_list unpack_rejects[NB_UNPACK_TREES_WARNING_TYPES];
int head_idx;
- int merge_size;
- struct cache_entry *df_conflict_entry;
+ struct cache_entry *df_conflict_entry; /* output only */
void *unpack_data;
struct index_state *dst_index;
struct index_state *src_index;
- struct index_state result;
- struct pattern_list *pl; /* for internal use */
- struct dir_struct *dir; /* for internal use only */
struct checkout_metadata meta;
+
+ struct unpack_trees_options_internal {
+ unsigned int nontrivial_merge,
+ show_all_errors,
+ debug_unpack; /* used by read-tree debugging */
+
+ int merge_size; /* used by read-tree debugging */
+ int cache_bottom;
+ const char *msgs[NB_UNPACK_TREES_WARNING_TYPES];
+ struct strvec msgs_to_free;
+
+ /*
+ * Store error messages in an array, each case
+ * corresponding to a error message type
+ */
+ struct string_list unpack_rejects[NB_UNPACK_TREES_WARNING_TYPES];
+
+ struct index_state result;
+
+ struct pattern_list *pl;
+ struct dir_struct *dir;
+ } internal;
};
int unpack_trees(unsigned n, struct tree_desc *t,
@@ -110,7 +120,8 @@ enum update_sparsity_result {
UPDATE_SPARSITY_WORKTREE_UPDATE_FAILURES = -2
};
-enum update_sparsity_result update_sparsity(struct unpack_trees_options *options);
+enum update_sparsity_result update_sparsity(struct unpack_trees_options *options,
+ struct pattern_list *pl);
int verify_uptodate(const struct cache_entry *ce,
struct unpack_trees_options *o);
diff --git a/upload-pack.c b/upload-pack.c
index 0b8311bd68..08633dc121 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -1,10 +1,14 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
#include "pkt-line.h"
#include "sideband.h"
#include "repository.h"
#include "object-store.h"
+#include "oid-array.h"
#include "tag.h"
#include "object.h"
#include "commit.h"
@@ -19,6 +23,7 @@
#include "version.h"
#include "string-list.h"
#include "strvec.h"
+#include "trace2.h"
#include "prio-queue.h"
#include "protocol.h"
#include "quote.h"
@@ -27,6 +32,8 @@
#include "commit-graph.h"
#include "commit-reach.h"
#include "shallow.h"
+#include "wrapper.h"
+#include "write-or-die.h"
/* Remember to update object flag allocation in object.h */
#define THEY_HAVE (1u << 11)
@@ -62,6 +69,7 @@ struct upload_pack_data {
struct object_array have_obj;
struct oid_array haves; /* v2 only */
struct string_list wanted_refs; /* v2 only */
+ struct string_list hidden_refs;
struct object_array shallows;
struct string_list deepen_not;
@@ -118,6 +126,7 @@ static void upload_pack_data_init(struct upload_pack_data *data)
{
struct string_list symref = STRING_LIST_INIT_DUP;
struct string_list wanted_refs = STRING_LIST_INIT_DUP;
+ struct string_list hidden_refs = STRING_LIST_INIT_DUP;
struct object_array want_obj = OBJECT_ARRAY_INIT;
struct object_array have_obj = OBJECT_ARRAY_INIT;
struct oid_array haves = OID_ARRAY_INIT;
@@ -130,6 +139,7 @@ static void upload_pack_data_init(struct upload_pack_data *data)
memset(data, 0, sizeof(*data));
data->symref = symref;
data->wanted_refs = wanted_refs;
+ data->hidden_refs = hidden_refs;
data->want_obj = want_obj;
data->have_obj = have_obj;
data->haves = haves;
@@ -151,6 +161,7 @@ static void upload_pack_data_clear(struct upload_pack_data *data)
{
string_list_clear(&data->symref, 1);
string_list_clear(&data->wanted_refs, 1);
+ string_list_clear(&data->hidden_refs, 0);
object_array_clear(&data->want_obj);
object_array_clear(&data->have_obj);
oid_array_clear(&data->haves);
@@ -495,8 +506,8 @@ static int got_oid(struct upload_pack_data *data,
{
if (get_oid_hex(hex, oid))
die("git upload-pack: expected SHA1 object, got '%s'", hex);
- if (!has_object_file_with_flags(oid,
- OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))
+ if (!repo_has_object_file_with_flags(the_repository, oid,
+ OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))
return -1;
return do_got_oid(data, oid);
}
@@ -842,8 +853,8 @@ static void deepen(struct upload_pack_data *data, int depth)
* Checking for reachable shallows requires that our refs be
* marked with OUR_REF.
*/
- head_ref_namespaced(check_ref, NULL);
- for_each_namespaced_ref(check_ref, NULL);
+ head_ref_namespaced(check_ref, data);
+ for_each_namespaced_ref(check_ref, data);
get_reachable_list(data, &reachable_shallows);
result = get_shallow_commits(&reachable_shallows,
@@ -1059,7 +1070,7 @@ static void receive_needs(struct upload_pack_data *data,
const char *features;
struct object_id oid_buf;
const char *arg;
- int feature_len;
+ size_t feature_len;
reset_timeout(data->timeout);
if (packet_reader_read(reader) != PACKET_READ_NORMAL)
@@ -1158,11 +1169,11 @@ static void receive_needs(struct upload_pack_data *data,
/* return non-zero if the ref is hidden, otherwise 0 */
static int mark_our_ref(const char *refname, const char *refname_full,
- const struct object_id *oid)
+ const struct object_id *oid, const struct string_list *hidden_refs)
{
struct object *o = lookup_unknown_object(the_repository, oid);
- if (ref_is_hidden(refname, refname_full)) {
+ if (ref_is_hidden(refname, refname_full, hidden_refs)) {
o->flags |= HIDDEN_REF;
return 1;
}
@@ -1171,11 +1182,12 @@ static int mark_our_ref(const char *refname, const char *refname_full,
}
static int check_ref(const char *refname_full, const struct object_id *oid,
- int flag UNUSED, void *cb_data UNUSED)
+ int flag UNUSED, void *cb_data)
{
const char *refname = strip_namespace(refname_full);
+ struct upload_pack_data *data = cb_data;
- mark_our_ref(refname, refname_full, oid);
+ mark_our_ref(refname, refname_full, oid, &data->hidden_refs);
return 0;
}
@@ -1204,7 +1216,7 @@ static int send_ref(const char *refname, const struct object_id *oid,
struct object_id peeled;
struct upload_pack_data *data = cb_data;
- if (mark_our_ref(refname_nons, refname, oid))
+ if (mark_our_ref(refname_nons, refname, oid, &data->hidden_refs))
return 0;
if (capabilities) {
@@ -1327,7 +1339,7 @@ static int upload_pack_config(const char *var, const char *value, void *cb_data)
if (parse_object_filter_config(var, value, data) < 0)
return -1;
- return parse_hide_refs_config(var, value, "uploadpack");
+ return parse_hide_refs_config(var, value, "uploadpack", &data->hidden_refs);
}
static int upload_pack_protected_config(const char *var, const char *value, void *cb_data)
@@ -1375,8 +1387,8 @@ void upload_pack(const int advertise_refs, const int stateless_rpc,
advertise_shallow_grafts(1);
packet_flush(1);
} else {
- head_ref_namespaced(check_ref, NULL);
- for_each_namespaced_ref(check_ref, NULL);
+ head_ref_namespaced(check_ref, &data);
+ for_each_namespaced_ref(check_ref, &data);
}
if (!advertise_refs) {
@@ -1441,6 +1453,7 @@ static int parse_want(struct packet_writer *writer, const char *line,
static int parse_want_ref(struct packet_writer *writer, const char *line,
struct string_list *wanted_refs,
+ struct string_list *hidden_refs,
struct object_array *want_obj)
{
const char *refname_nons;
@@ -1451,7 +1464,7 @@ static int parse_want_ref(struct packet_writer *writer, const char *line,
struct strbuf refname = STRBUF_INIT;
strbuf_addf(&refname, "%s%s", get_git_namespace(), refname_nons);
- if (ref_is_hidden(refname_nons, refname.buf) ||
+ if (ref_is_hidden(refname_nons, refname.buf, hidden_refs) ||
read_ref(refname.buf, &oid)) {
packet_writer_error(writer, "unknown ref %s", refname_nons);
die("unknown ref %s", refname_nons);
@@ -1508,7 +1521,7 @@ static void process_args(struct packet_reader *request,
continue;
if (data->allow_ref_in_want &&
parse_want_ref(&data->writer, arg, &data->wanted_refs,
- &data->want_obj))
+ &data->hidden_refs, &data->want_obj))
continue;
/* process have line */
if (parse_have(arg, &data->haves))
@@ -1594,8 +1607,8 @@ static int process_haves(struct upload_pack_data *data, struct oid_array *common
for (i = 0; i < data->haves.nr; i++) {
const struct object_id *oid = &data->haves.oid[i];
- if (!has_object_file_with_flags(oid,
- OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))
+ if (!repo_has_object_file_with_flags(the_repository, oid,
+ OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT))
continue;
oid_array_append(common, oid);
@@ -1693,7 +1706,7 @@ enum fetch_state {
FETCH_DONE,
};
-int upload_pack_v2(struct repository *r, struct packet_reader *request)
+int upload_pack_v2(struct repository *r UNUSED, struct packet_reader *request)
{
enum fetch_state state = FETCH_PROCESS_ARGS;
struct upload_pack_data data;
@@ -1769,26 +1782,26 @@ int upload_pack_advertise(struct repository *r,
strbuf_addstr(value, "shallow wait-for-done");
- if (!repo_config_get_bool(the_repository,
+ if (!repo_config_get_bool(r,
"uploadpack.allowfilter",
&allow_filter_value) &&
allow_filter_value)
strbuf_addstr(value, " filter");
- if (!repo_config_get_bool(the_repository,
+ if (!repo_config_get_bool(r,
"uploadpack.allowrefinwant",
&allow_ref_in_want) &&
allow_ref_in_want)
strbuf_addstr(value, " ref-in-want");
if (git_env_bool("GIT_TEST_SIDEBAND_ALL", 0) ||
- (!repo_config_get_bool(the_repository,
+ (!repo_config_get_bool(r,
"uploadpack.allowsidebandall",
&allow_sideband_all_value) &&
allow_sideband_all_value))
strbuf_addstr(value, " sideband-all");
- if (!repo_config_get_string(the_repository,
+ if (!repo_config_get_string(r,
"uploadpack.blobpackfileuri",
&str) &&
str) {
diff --git a/url.c b/url.c
index e04bd60b6b..2e1a9f6fee 100644
--- a/url.c
+++ b/url.c
@@ -1,4 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "hex.h"
+#include "strbuf.h"
#include "url.h"
int is_urlschemechar(int first_flag, int ch)
diff --git a/urlmatch.c b/urlmatch.c
index b615adc923..eba0bdd77f 100644
--- a/urlmatch.c
+++ b/urlmatch.c
@@ -1,4 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
+#include "hex.h"
+#include "strbuf.h"
#include "urlmatch.h"
#define URL_ALPHA "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
@@ -209,7 +212,7 @@ static char *url_normalize_1(const char *url, struct url_info *out_info, char al
*/
if (!url_len || strchr(":/?#", *url)) {
/* Missing host invalid for all URL schemes except file */
- if (strncmp(norm.buf, "file:", 5)) {
+ if (!starts_with(norm.buf, "file:")) {
if (out_info) {
out_info->url = NULL;
out_info->err = _("missing host and scheme is not 'file:'");
@@ -268,11 +271,11 @@ static char *url_normalize_1(const char *url, struct url_info *out_info, char al
if (url == slash_ptr) {
/* Skip ":" port with no number, it's same as default */
} else if (slash_ptr - url == 2 &&
- !strncmp(norm.buf, "http:", 5) &&
+ starts_with(norm.buf, "http:") &&
!strncmp(url, "80", 2)) {
/* Skip http :80 as it's the default */
} else if (slash_ptr - url == 3 &&
- !strncmp(norm.buf, "https:", 6) &&
+ starts_with(norm.buf, "https:") &&
!strncmp(url, "443", 3)) {
/* Skip https :443 as it's the default */
} else {
diff --git a/usage.c b/usage.c
index 5a7c6c346c..46d99f8bd4 100644
--- a/usage.c
+++ b/usage.c
@@ -4,7 +4,9 @@
* Copyright (C) Linus Torvalds, 2005
*/
#include "git-compat-util.h"
-#include "cache.h"
+#include "gettext.h"
+#include "trace2.h"
+#include "wrapper.h"
static void vreportf(const char *prefix, const char *err, va_list params)
{
diff --git a/userdiff.c b/userdiff.c
index 151d9a5278..eaec6ebb5e 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -1,7 +1,9 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "config.h"
#include "userdiff.h"
#include "attr.h"
+#include "strbuf.h"
static struct userdiff_driver *drivers;
static int ndrivers;
@@ -15,6 +17,7 @@ static int drivers_alloc;
.cflags = REG_EXTENDED, \
}, \
.word_regex = wrx "|[^[:space:]]|[\xc0-\xff][\x80-\xbf]+", \
+ .word_regex_multi_byte = wrx "|[^[:space:]]", \
}
#define IPATTERN(lang, rx, wrx) { \
.name = lang, \
@@ -24,6 +27,7 @@ static int drivers_alloc;
.cflags = REG_EXTENDED | REG_ICASE, \
}, \
.word_regex = wrx "|[^[:space:]]|[\xc0-\xff][\x80-\xbf]+", \
+ .word_regex_multi_byte = wrx "|[^[:space:]]", \
}
/*
@@ -170,8 +174,8 @@ PATTERNS("html",
"[^<>= \t]+"),
PATTERNS("java",
"!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
- /* Class, enum, and interface declarations */
- "^[ \t]*(([a-z]+[ \t]+)*(class|enum|interface)[ \t]+[A-Za-z][A-Za-z0-9_$]*[ \t]+.*)$\n"
+ /* Class, enum, interface, and record declarations */
+ "^[ \t]*(([a-z-]+[ \t]+)*(class|enum|interface|record)[ \t]+.*)$\n"
/* Method definitions; note that constructor signatures are not */
/* matched because they are indistinguishable from method calls. */
"^[ \t]*(([A-Za-z_<>&][][?&<>.,A-Za-z_0-9]*[ \t]+)+[A-Za-z_][A-Za-z_0-9]*[ \t]*\\([^;]*)$",
@@ -292,8 +296,8 @@ PATTERNS("scheme",
/* All other words should be delimited by spaces or parentheses */
"|([^][)(}{[ \t])+"),
PATTERNS("tex", "^(\\\\((sub)*section|chapter|part)\\*{0,1}\\{.*)$",
- "\\\\[a-zA-Z@]+|\\\\.|[a-zA-Z0-9\x80-\xff]+"),
-{ "default", NULL, -1, { NULL, 0 } },
+ "\\\\[a-zA-Z@]+|\\\\.|([a-zA-Z0-9]|[^\x01-\x7f])+"),
+{ "default", NULL, NULL, -1, { NULL, 0 } },
};
#undef PATTERNS
#undef IPATTERN
@@ -315,7 +319,8 @@ struct find_by_namelen_data {
};
static int userdiff_find_by_namelen_cb(struct userdiff_driver *driver,
- enum userdiff_driver_type type, void *priv)
+ enum userdiff_driver_type type UNUSED,
+ void *priv)
{
struct find_by_namelen_data *cb_data = priv;
@@ -327,6 +332,25 @@ static int userdiff_find_by_namelen_cb(struct userdiff_driver *driver,
return 0;
}
+static int regexec_supports_multi_byte_chars(void)
+{
+ static const char not_space[] = "[^[:space:]]";
+ static const char utf8_multi_byte_char[] = "\xc2\xa3";
+ regex_t re;
+ regmatch_t match;
+ static int result = -1;
+
+ if (result != -1)
+ return result;
+ if (regcomp(&re, not_space, REG_EXTENDED))
+ BUG("invalid regular expression: %s", not_space);
+ result = !regexec(&re, utf8_multi_byte_char, 1, &match, 0) &&
+ match.rm_so == 0 &&
+ match.rm_eo == strlen(utf8_multi_byte_char);
+ regfree(&re);
+ return result;
+}
+
static struct userdiff_driver *userdiff_find_by_namelen(const char *name, size_t len)
{
struct find_by_namelen_data udcbdata = {
@@ -393,6 +417,8 @@ int userdiff_config(const char *k, const char *v)
return parse_bool(&drv->textconv_want_cache, k, v);
if (!strcmp(type, "wordregex"))
return git_config_string(&drv->word_regex, k, v);
+ if (!strcmp(type, "algorithm"))
+ return git_config_string(&drv->algorithm, k, v);
return 0;
}
@@ -400,7 +426,13 @@ int userdiff_config(const char *k, const char *v)
struct userdiff_driver *userdiff_find_by_name(const char *name)
{
int len = strlen(name);
- return userdiff_find_by_namelen(name, len);
+ struct userdiff_driver *driver = userdiff_find_by_namelen(name, len);
+ if (driver && driver->word_regex_multi_byte) {
+ if (regexec_supports_multi_byte_chars())
+ driver->word_regex = driver->word_regex_multi_byte;
+ driver->word_regex_multi_byte = NULL;
+ }
+ return driver;
}
struct userdiff_driver *userdiff_find_by_path(struct index_state *istate,
@@ -412,7 +444,7 @@ struct userdiff_driver *userdiff_find_by_path(struct index_state *istate,
check = attr_check_initl("diff", NULL);
if (!path)
return NULL;
- git_check_attr(istate, path, check);
+ git_check_attr(istate, NULL, path, check);
if (ATTR_TRUE(check->items[0].value))
return &driver_true;
diff --git a/userdiff.h b/userdiff.h
index aee91bc77e..d726804c3e 100644
--- a/userdiff.h
+++ b/userdiff.h
@@ -14,9 +14,11 @@ struct userdiff_funcname {
struct userdiff_driver {
const char *name;
const char *external;
+ const char *algorithm;
int binary;
struct userdiff_funcname funcname;
const char *word_regex;
+ const char *word_regex_multi_byte;
const char *textconv;
struct notes_cache *textconv_cache;
int textconv_want_cache;
diff --git a/versioncmp.c b/versioncmp.c
index 069ee94a4d..74cc7c43f0 100644
--- a/versioncmp.c
+++ b/versioncmp.c
@@ -1,6 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "string-list.h"
+#include "versioncmp.h"
/*
* versioncmp(): copied from string/strverscmp.c in glibc commit
@@ -160,15 +161,21 @@ int versioncmp(const char *s1, const char *s2)
}
if (!initialized) {
- const struct string_list *deprecated_prereleases;
+ const char *const newk = "versionsort.suffix";
+ const char *const oldk = "versionsort.prereleasesuffix";
+ const struct string_list *newl;
+ const struct string_list *oldl;
+ int new = git_config_get_string_multi(newk, &newl);
+ int old = git_config_get_string_multi(oldk, &oldl);
+
+ if (!new && !old)
+ warning("ignoring %s because %s is set", oldk, newk);
+ if (!new)
+ prereleases = newl;
+ else if (!old)
+ prereleases = oldl;
+
initialized = 1;
- prereleases = git_config_get_value_multi("versionsort.suffix");
- deprecated_prereleases = git_config_get_value_multi("versionsort.prereleasesuffix");
- if (prereleases) {
- if (deprecated_prereleases)
- warning("ignoring versionsort.prereleasesuffix because versionsort.suffix is set");
- } else
- prereleases = deprecated_prereleases;
}
if (prereleases && swap_prereleases(s1, s2, (const char *) p1 - s1 - 1,
&diff))
diff --git a/versioncmp.h b/versioncmp.h
new file mode 100644
index 0000000000..879b510e82
--- /dev/null
+++ b/versioncmp.h
@@ -0,0 +1,6 @@
+#ifndef VERSIONCMP_H
+#define VERSIONCMP_H
+
+int versioncmp(const char *s1, const char *s2);
+
+#endif /* VERSIONCMP_H */
diff --git a/walker.c b/walker.c
index 99d0e0eae0..24ff7dfdc2 100644
--- a/walker.c
+++ b/walker.c
@@ -1,4 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "gettext.h"
+#include "hex.h"
#include "walker.h"
#include "repository.h"
#include "object-store.h"
@@ -79,7 +81,7 @@ static int process_commit(struct walker *walker, struct commit *commit)
{
struct commit_list *parents;
- if (parse_commit(commit))
+ if (repo_parse_commit(the_repository, commit))
return -1;
while (complete && complete->item->date >= commit->date) {
@@ -93,7 +95,7 @@ static int process_commit(struct walker *walker, struct commit *commit)
walker_say(walker, "walk %s\n", oid_to_hex(&commit->object.oid));
- if (process(walker, &get_commit_tree(commit)->object))
+ if (process(walker, &repo_get_commit_tree(the_repository, commit)->object))
return -1;
for (parents = commit->parents; parents; parents = parents->next) {
@@ -145,7 +147,7 @@ static int process(struct walker *walker, struct object *obj)
return 0;
obj->flags |= SEEN;
- if (has_object_file(&obj->oid)) {
+ if (repo_has_object_file(the_repository, &obj->oid)) {
/* We already have it, so we should scan it now. */
obj->flags |= TO_SCAN;
}
diff --git a/wildmatch.c b/wildmatch.c
index 7e5a7ea1ea..8ea29141bd 100644
--- a/wildmatch.c
+++ b/wildmatch.c
@@ -9,11 +9,15 @@
** work differently than '*', and to fix the character-class code.
*/
-#include "cache.h"
+#include "git-compat-util.h"
#include "wildmatch.h"
typedef unsigned char uchar;
+/* Internal return values */
+#define WM_ABORT_ALL -1
+#define WM_ABORT_TO_STARSTAR -2
+
/* What character marks an inverted character class? */
#define NEGATE_CLASS '!'
#define NEGATE_CLASS2 '^'
@@ -83,12 +87,12 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags)
continue;
case '*':
if (*++p == '*') {
- const uchar *prev_p = p - 2;
+ const uchar *prev_p = p;
while (*++p == '*') {}
if (!(flags & WM_PATHNAME))
/* without WM_PATHNAME, '*' == '**' */
match_slash = 1;
- else if ((prev_p < pattern || *prev_p == '/') &&
+ else if ((prev_p - pattern < 2 || *(prev_p - 2) == '/') &&
(*p == '\0' || *p == '/' ||
(p[0] == '\\' && p[1] == '/'))) {
/*
@@ -114,7 +118,7 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags)
* only if there are no more slash characters. */
if (!match_slash) {
if (strchr((char *)text, '/'))
- return WM_NOMATCH;
+ return WM_ABORT_TO_STARSTAR;
}
return WM_MATCH;
} else if (!match_slash && *p == '/') {
@@ -125,7 +129,7 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags)
*/
const char *slash = strchr((char*)text, '/');
if (!slash)
- return WM_NOMATCH;
+ return WM_ABORT_ALL;
text = (const uchar*)slash;
/* the slash is consumed by the top-level for loop */
break;
@@ -153,8 +157,12 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags)
break;
text++;
}
- if (t_ch != p_ch)
- return WM_NOMATCH;
+ if (t_ch != p_ch) {
+ if (match_slash)
+ return WM_ABORT_ALL;
+ else
+ return WM_ABORT_TO_STARSTAR;
+ }
}
if ((matched = dowild(p, text, flags)) != WM_NOMATCH) {
if (!match_slash || matched != WM_ABORT_TO_STARSTAR)
@@ -274,5 +282,6 @@ static int dowild(const uchar *p, const uchar *text, unsigned int flags)
/* Match the "pattern" against the "text" string. */
int wildmatch(const char *pattern, const char *text, unsigned int flags)
{
- return dowild((const uchar*)pattern, (const uchar*)text, flags);
+ int res = dowild((const uchar*)pattern, (const uchar*)text, flags);
+ return res == WM_MATCH ? WM_MATCH : WM_NOMATCH;
}
diff --git a/wildmatch.h b/wildmatch.h
index 5993696298..0c890cb56b 100644
--- a/wildmatch.h
+++ b/wildmatch.h
@@ -6,8 +6,6 @@
#define WM_NOMATCH 1
#define WM_MATCH 0
-#define WM_ABORT_ALL -1
-#define WM_ABORT_TO_STARSTAR -2
int wildmatch(const char *pattern, const char *text, unsigned int flags);
#endif
diff --git a/worktree.c b/worktree.c
index 257ba4cf1e..b5ee71c5eb 100644
--- a/worktree.c
+++ b/worktree.c
@@ -1,11 +1,17 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "alloc.h"
+#include "environment.h"
+#include "gettext.h"
#include "repository.h"
#include "refs.h"
+#include "setup.h"
#include "strbuf.h"
#include "worktree.h"
#include "dir.h"
#include "wt-status.h"
#include "config.h"
+#include "wrapper.h"
void free_worktrees(struct worktree **worktrees)
{
@@ -403,44 +409,43 @@ int is_worktree_being_bisected(const struct worktree *wt,
* bisect). New commands that do similar things should update this
* function as well.
*/
-const struct worktree *find_shared_symref(struct worktree **worktrees,
- const char *symref,
- const char *target)
+int is_shared_symref(const struct worktree *wt, const char *symref,
+ const char *target)
{
- const struct worktree *existing = NULL;
- int i = 0;
+ const char *symref_target;
+ struct ref_store *refs;
+ int flags;
- for (i = 0; worktrees[i]; i++) {
- struct worktree *wt = worktrees[i];
- const char *symref_target;
- struct ref_store *refs;
- int flags;
+ if (wt->is_bare)
+ return 0;
- if (wt->is_bare)
- continue;
+ if (wt->is_detached && !strcmp(symref, "HEAD")) {
+ if (is_worktree_being_rebased(wt, target))
+ return 1;
+ if (is_worktree_being_bisected(wt, target))
+ return 1;
+ }
- if (wt->is_detached && !strcmp(symref, "HEAD")) {
- if (is_worktree_being_rebased(wt, target)) {
- existing = wt;
- break;
- }
- if (is_worktree_being_bisected(wt, target)) {
- existing = wt;
- break;
- }
- }
+ refs = get_worktree_ref_store(wt);
+ symref_target = refs_resolve_ref_unsafe(refs, symref, 0,
+ NULL, &flags);
+ if ((flags & REF_ISSYMREF) &&
+ symref_target && !strcmp(symref_target, target))
+ return 1;
- refs = get_worktree_ref_store(wt);
- symref_target = refs_resolve_ref_unsafe(refs, symref, 0,
- NULL, &flags);
- if ((flags & REF_ISSYMREF) &&
- symref_target && !strcmp(symref_target, target)) {
- existing = wt;
- break;
- }
- }
+ return 0;
+}
+
+const struct worktree *find_shared_symref(struct worktree **worktrees,
+ const char *symref,
+ const char *target)
+{
+
+ for (int i = 0; worktrees[i]; i++)
+ if (is_shared_symref(worktrees[i], symref, target))
+ return worktrees[i];
- return existing;
+ return NULL;
}
int submodule_uses_worktrees(const char *path)
@@ -489,62 +494,17 @@ int submodule_uses_worktrees(const char *path)
return ret;
}
-int parse_worktree_ref(const char *worktree_ref, const char **name,
- int *name_length, const char **ref)
-{
- if (skip_prefix(worktree_ref, "main-worktree/", &worktree_ref)) {
- if (!*worktree_ref)
- return -1;
- if (name)
- *name = NULL;
- if (name_length)
- *name_length = 0;
- if (ref)
- *ref = worktree_ref;
- return 0;
- }
- if (skip_prefix(worktree_ref, "worktrees/", &worktree_ref)) {
- const char *slash = strchr(worktree_ref, '/');
-
- if (!slash || slash == worktree_ref || !slash[1])
- return -1;
- if (name)
- *name = worktree_ref;
- if (name_length)
- *name_length = slash - worktree_ref;
- if (ref)
- *ref = slash + 1;
- return 0;
- }
- return -1;
-}
-
void strbuf_worktree_ref(const struct worktree *wt,
struct strbuf *sb,
const char *refname)
{
- switch (ref_type(refname)) {
- case REF_TYPE_PSEUDOREF:
- case REF_TYPE_PER_WORKTREE:
- if (wt && !wt->is_current) {
- if (is_main_worktree(wt))
- strbuf_addstr(sb, "main-worktree/");
- else
- strbuf_addf(sb, "worktrees/%s/", wt->id);
- }
- break;
-
- case REF_TYPE_MAIN_PSEUDOREF:
- case REF_TYPE_OTHER_PSEUDOREF:
- break;
-
- case REF_TYPE_NORMAL:
- /*
- * For shared refs, don't prefix worktrees/ or
- * main-worktree/. It's not necessary and
- * files-backend.c can't handle it anyway.
- */
- break;
+ if (parse_worktree_ref(refname, NULL, NULL, NULL) ==
+ REF_WORKTREE_CURRENT &&
+ wt && !wt->is_current) {
+ if (is_main_worktree(wt))
+ strbuf_addstr(sb, "main-worktree/");
+ else
+ strbuf_addf(sb, "worktrees/%s/", wt->id);
}
strbuf_addstr(sb, refname);
}
diff --git a/worktree.h b/worktree.h
index e9e839926b..ce45b66de9 100644
--- a/worktree.h
+++ b/worktree.h
@@ -1,7 +1,6 @@
#ifndef WORKTREE_H
#define WORKTREE_H
-#include "cache.h"
#include "refs.h"
struct strbuf;
@@ -150,6 +149,12 @@ const struct worktree *find_shared_symref(struct worktree **worktrees,
const char *target);
/*
+ * Returns true if a symref points to a ref in a worktree.
+ */
+int is_shared_symref(const struct worktree *wt,
+ const char *symref, const char *target);
+
+/*
* Similar to head_ref() for all HEADs _except_ one from the current
* worktree, which is covered by head_ref().
*/
@@ -167,16 +172,6 @@ const char *worktree_git_path(const struct worktree *wt,
__attribute__((format (printf, 2, 3)));
/*
- * Parse a worktree ref (i.e. with prefix main-worktree/ or
- * worktrees/) and return the position of the worktree's name and
- * length (or NULL and zero if it's main worktree), and ref.
- *
- * All name, name_length and ref arguments could be NULL.
- */
-int parse_worktree_ref(const char *worktree_ref, const char **name,
- int *name_length, const char **ref);
-
-/*
* Return a refname suitable for access from the current ref store.
*/
void strbuf_worktree_ref(const struct worktree *wt,
diff --git a/wrapper.c b/wrapper.c
index 299d6489a6..67f5f5dbe1 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -1,8 +1,15 @@
/*
* Various trivial helper wrappers around standard functions
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
#include "config.h"
+#include "gettext.h"
+#include "object.h"
+#include "repository.h"
+#include "strbuf.h"
+#include "trace2.h"
+#include "wrapper.h"
static intmax_t count_fsync_writeout_only;
static intmax_t count_fsync_hardware_flush;
diff --git a/wrapper.h b/wrapper.h
new file mode 100644
index 0000000000..f0c7d0616d
--- /dev/null
+++ b/wrapper.h
@@ -0,0 +1,36 @@
+#ifndef WRAPPER_H
+#define WRAPPER_H
+
+/* set default permissions by passing mode arguments to open(2) */
+int git_mkstemps_mode(char *pattern, int suffix_len, int mode);
+int git_mkstemp_mode(char *pattern, int mode);
+
+ssize_t read_in_full(int fd, void *buf, size_t count);
+ssize_t write_in_full(int fd, const void *buf, size_t count);
+ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset);
+
+static inline ssize_t write_str_in_full(int fd, const char *str)
+{
+ return write_in_full(fd, str, strlen(str));
+}
+
+/**
+ * Open (and truncate) the file at path, write the contents of buf to it,
+ * and close it. Dies if any errors are encountered.
+ */
+void write_file_buf(const char *path, const char *buf, size_t len);
+
+/**
+ * Like write_file_buf(), but format the contents into a buffer first.
+ * Additionally, write_file() will append a newline if one is not already
+ * present, making it convenient to write text files:
+ *
+ * write_file(path, "counter: %d", ctr);
+ */
+__attribute__((format (printf, 2, 3)))
+void write_file(const char *path, const char *fmt, ...);
+
+/* Return 1 if the file is empty or does not exists, 0 otherwise. */
+int is_empty_or_missing_file(const char *filename);
+
+#endif /* WRAPPER_H */
diff --git a/write-or-die.c b/write-or-die.c
index aaa0318e82..cc9e0787a1 100644
--- a/write-or-die.c
+++ b/write-or-die.c
@@ -1,6 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
#include "run-command.h"
+#include "wrapper.h"
+#include "write-or-die.h"
/*
* Some cases use stdio, but want to flush after the write
diff --git a/write-or-die.h b/write-or-die.h
new file mode 100644
index 0000000000..65a5c42a47
--- /dev/null
+++ b/write-or-die.h
@@ -0,0 +1,78 @@
+#ifndef WRITE_OR_DIE_H
+#define WRITE_OR_DIE_H
+
+void maybe_flush_or_die(FILE *, const char *);
+__attribute__((format (printf, 2, 3)))
+void fprintf_or_die(FILE *, const char *fmt, ...);
+void fwrite_or_die(FILE *f, const void *buf, size_t count);
+void fflush_or_die(FILE *f);
+void write_or_die(int fd, const void *buf, size_t count);
+
+/*
+ * These values are used to help identify parts of a repository to fsync.
+ * FSYNC_COMPONENT_NONE identifies data that will not be a persistent part of the
+ * repository and so shouldn't be fsynced.
+ */
+enum fsync_component {
+ FSYNC_COMPONENT_NONE,
+ FSYNC_COMPONENT_LOOSE_OBJECT = 1 << 0,
+ FSYNC_COMPONENT_PACK = 1 << 1,
+ FSYNC_COMPONENT_PACK_METADATA = 1 << 2,
+ FSYNC_COMPONENT_COMMIT_GRAPH = 1 << 3,
+ FSYNC_COMPONENT_INDEX = 1 << 4,
+ FSYNC_COMPONENT_REFERENCE = 1 << 5,
+};
+
+#define FSYNC_COMPONENTS_OBJECTS (FSYNC_COMPONENT_LOOSE_OBJECT | \
+ FSYNC_COMPONENT_PACK)
+
+#define FSYNC_COMPONENTS_DERIVED_METADATA (FSYNC_COMPONENT_PACK_METADATA | \
+ FSYNC_COMPONENT_COMMIT_GRAPH)
+
+#define FSYNC_COMPONENTS_DEFAULT ((FSYNC_COMPONENTS_OBJECTS | \
+ FSYNC_COMPONENTS_DERIVED_METADATA) & \
+ ~FSYNC_COMPONENT_LOOSE_OBJECT)
+
+#define FSYNC_COMPONENTS_COMMITTED (FSYNC_COMPONENTS_OBJECTS | \
+ FSYNC_COMPONENT_REFERENCE)
+
+#define FSYNC_COMPONENTS_ADDED (FSYNC_COMPONENTS_COMMITTED | \
+ FSYNC_COMPONENT_INDEX)
+
+#define FSYNC_COMPONENTS_ALL (FSYNC_COMPONENT_LOOSE_OBJECT | \
+ FSYNC_COMPONENT_PACK | \
+ FSYNC_COMPONENT_PACK_METADATA | \
+ FSYNC_COMPONENT_COMMIT_GRAPH | \
+ FSYNC_COMPONENT_INDEX | \
+ FSYNC_COMPONENT_REFERENCE)
+
+#ifndef FSYNC_COMPONENTS_PLATFORM_DEFAULT
+#define FSYNC_COMPONENTS_PLATFORM_DEFAULT FSYNC_COMPONENTS_DEFAULT
+#endif
+
+/* IO helper functions */
+void fsync_or_die(int fd, const char *);
+int fsync_component(enum fsync_component component, int fd);
+void fsync_component_or_die(enum fsync_component component, int fd, const char *msg);
+
+/*
+ * A bitmask indicating which components of the repo should be fsynced.
+ */
+extern enum fsync_component fsync_components;
+extern int fsync_object_files;
+extern int use_fsync;
+
+enum fsync_method {
+ FSYNC_METHOD_FSYNC,
+ FSYNC_METHOD_WRITEOUT_ONLY,
+ FSYNC_METHOD_BATCH,
+};
+
+extern enum fsync_method fsync_method;
+
+static inline int batch_fsync_enabled(enum fsync_component component)
+{
+ return (fsync_components & component) && (fsync_method == FSYNC_METHOD_BATCH);
+}
+
+#endif /* WRITE_OR_DIE_H */
diff --git a/ws.c b/ws.c
index 6e69877f25..d356d4ec9e 100644
--- a/ws.c
+++ b/ws.c
@@ -3,8 +3,12 @@
*
* Copyright (c) 2007 Junio C Hamano
*/
-#include "cache.h"
+#include "git-compat-util.h"
#include "attr.h"
+#include "strbuf.h"
+#include "ws.h"
+
+unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
static struct whitespace_rule {
const char *rule_name;
@@ -29,6 +33,7 @@ unsigned parse_whitespace_rule(const char *string)
int i;
size_t len;
const char *ep;
+ const char *arg;
int negated = 0;
string = string + strspn(string, ", \t\n\r");
@@ -52,15 +57,15 @@ unsigned parse_whitespace_rule(const char *string)
rule |= whitespace_rule_names[i].rule_bits;
break;
}
- if (strncmp(string, "tabwidth=", 9) == 0) {
- unsigned tabwidth = atoi(string + 9);
+ if (skip_prefix(string, "tabwidth=", &arg)) {
+ unsigned tabwidth = atoi(arg);
if (0 < tabwidth && tabwidth < 0100) {
rule &= ~WS_TAB_WIDTH_MASK;
rule |= tabwidth;
}
else
warning("tabwidth %.*s out of range",
- (int)(len - 9), string + 9);
+ (int)(ep - arg), arg);
}
string = ep;
}
@@ -78,7 +83,7 @@ unsigned whitespace_rule(struct index_state *istate, const char *pathname)
if (!attr_whitespace_rule)
attr_whitespace_rule = attr_check_initl("whitespace", NULL);
- git_check_attr(istate, pathname, attr_whitespace_rule);
+ git_check_attr(istate, NULL, pathname, attr_whitespace_rule);
value = attr_whitespace_rule->items[0].value;
if (ATTR_TRUE(value)) {
/* true (whitespace) */
@@ -252,7 +257,7 @@ unsigned ws_check(const char *line, int len, unsigned ws_rule)
return ws_check_emit_1(line, len, ws_rule, NULL, NULL, NULL, NULL);
}
-int ws_blank_line(const char *line, int len, unsigned ws_rule)
+int ws_blank_line(const char *line, int len)
{
/*
* We _might_ want to treat CR differently from other
diff --git a/ws.h b/ws.h
new file mode 100644
index 0000000000..5ba676c559
--- /dev/null
+++ b/ws.h
@@ -0,0 +1,33 @@
+#ifndef WS_H
+#define WS_H
+
+struct index_state;
+struct strbuf;
+
+/*
+ * whitespace rules.
+ * used by both diff and apply
+ * last two digits are tab width
+ */
+#define WS_BLANK_AT_EOL 0100
+#define WS_SPACE_BEFORE_TAB 0200
+#define WS_INDENT_WITH_NON_TAB 0400
+#define WS_CR_AT_EOL 01000
+#define WS_BLANK_AT_EOF 02000
+#define WS_TAB_IN_INDENT 04000
+#define WS_TRAILING_SPACE (WS_BLANK_AT_EOL|WS_BLANK_AT_EOF)
+#define WS_DEFAULT_RULE (WS_TRAILING_SPACE|WS_SPACE_BEFORE_TAB|8)
+#define WS_TAB_WIDTH_MASK 077
+/* All WS_* -- when extended, adapt diff.c emit_symbol */
+#define WS_RULE_MASK 07777
+extern unsigned whitespace_rule_cfg;
+unsigned whitespace_rule(struct index_state *, const char *);
+unsigned parse_whitespace_rule(const char *);
+unsigned ws_check(const char *line, int len, unsigned ws_rule);
+void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws);
+char *whitespace_error_string(unsigned ws);
+void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *);
+int ws_blank_line(const char *line, int len);
+#define ws_tab_width(rule) ((rule) & WS_TAB_WIDTH_MASK)
+
+#endif /* WS_H */
diff --git a/wt-status.c b/wt-status.c
index 5813174896..068b76ef6d 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1,9 +1,14 @@
#include "cache.h"
+#include "advice.h"
#include "wt-status.h"
#include "object.h"
#include "dir.h"
#include "commit.h"
#include "diff.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
+#include "object-name.h"
#include "revision.h"
#include "diffcore.h"
#include "quote.h"
@@ -13,13 +18,19 @@
#include "refs.h"
#include "submodule.h"
#include "column.h"
+#include "setup.h"
#include "strbuf.h"
+#include "trace.h"
+#include "trace2.h"
+#include "tree.h"
#include "utf8.h"
#include "worktree.h"
#include "lockfile.h"
#include "sequencer.h"
+#include "fsmonitor-settings.h"
#define AB_DELAY_WARNING_IN_MS (2 * 1000)
+#define UF_DELAY_WARNING_IN_MS (2 * 1000)
static const char cut_line[] =
"------------------------ >8 ------------------------\n";
@@ -438,7 +449,7 @@ static char short_submodule_status(struct wt_status_change_data *d)
}
static void wt_status_collect_changed_cb(struct diff_queue_struct *q,
- struct diff_options *options,
+ struct diff_options *options UNUSED,
void *data)
{
struct wt_status *s = data;
@@ -525,7 +536,7 @@ static int unmerged_mask(struct index_state *istate, const char *path)
}
static void wt_status_collect_updated_cb(struct diff_queue_struct *q,
- struct diff_options *options,
+ struct diff_options *options UNUSED,
void *data)
{
struct wt_status *s = data;
@@ -1205,6 +1216,13 @@ static void wt_longstatus_print_tracking(struct wt_status *s)
strbuf_release(&sb);
}
+static int uf_was_slow(struct wt_status *s)
+{
+ if (getenv("GIT_TEST_UF_DELAY_WARNING"))
+ s->untracked_in_ms = 3250;
+ return UF_DELAY_WARNING_IN_MS < s->untracked_in_ms;
+}
+
static void show_merge_in_progress(struct wt_status *s,
const char *color)
{
@@ -1328,7 +1346,7 @@ static void abbrev_oid_in_line(struct strbuf *line)
* it after abbreviation.
*/
strbuf_trim(split[1]);
- if (!get_oid(split[1]->buf, &oid)) {
+ if (!repo_get_oid(the_repository, split[1]->buf, &oid)) {
strbuf_reset(split[1]);
strbuf_add_unique_abbrev(split[1], &oid,
DEFAULT_ABBREV);
@@ -1494,8 +1512,8 @@ static void show_cherry_pick_in_progress(struct wt_status *s,
else
status_printf_ln(s, color,
_("You are currently cherry-picking commit %s."),
- find_unique_abbrev(&s->state.cherry_pick_head_oid,
- DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, &s->state.cherry_pick_head_oid,
+ DEFAULT_ABBREV));
if (s->hints) {
if (has_unmerged(s))
@@ -1524,8 +1542,8 @@ static void show_revert_in_progress(struct wt_status *s,
else
status_printf_ln(s, color,
_("You are currently reverting commit %s."),
- find_unique_abbrev(&s->state.revert_head_oid,
- DEFAULT_ABBREV));
+ repo_find_unique_abbrev(the_repository, &s->state.revert_head_oid,
+ DEFAULT_ABBREV));
if (s->hints) {
if (has_unmerged(s))
status_printf_ln(s, color,
@@ -1655,7 +1673,8 @@ static void wt_status_get_detached_from(struct repository *r,
return;
}
- if (dwim_ref(cb.buf.buf, cb.buf.len, &oid, &ref, 1) == 1 &&
+ if (repo_dwim_ref(r, cb.buf.buf, cb.buf.len, &oid, &ref,
+ 1) == 1 &&
/* oid is a commit? match without further lookup */
(oideq(&cb.noid, &oid) ||
/* perhaps oid is a tag, try to dereference to a commit */
@@ -1667,9 +1686,9 @@ static void wt_status_get_detached_from(struct repository *r,
state->detached_from = xstrdup(from);
} else
state->detached_from =
- xstrdup(find_unique_abbrev(&cb.noid, DEFAULT_ABBREV));
+ xstrdup(repo_find_unique_abbrev(r, &cb.noid, DEFAULT_ABBREV));
oidcpy(&state->detached_oid, &cb.noid);
- state->detached_at = !get_oid("HEAD", &oid) &&
+ state->detached_at = !repo_get_oid(r, "HEAD", &oid) &&
oideq(&oid, &state->detached_oid);
free(ref);
@@ -1760,13 +1779,13 @@ void wt_status_get_state(struct repository *r,
} else if (wt_status_check_rebase(NULL, state)) {
; /* all set */
} else if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") &&
- !get_oid("CHERRY_PICK_HEAD", &oid)) {
+ !repo_get_oid(r, "CHERRY_PICK_HEAD", &oid)) {
state->cherry_pick_in_progress = 1;
oidcpy(&state->cherry_pick_head_oid, &oid);
}
wt_status_check_bisect(NULL, state);
if (refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD") &&
- !get_oid("REVERT_HEAD", &oid)) {
+ !repo_get_oid(r, "REVERT_HEAD", &oid)) {
state->revert_in_progress = 1;
oidcpy(&state->revert_head_oid, &oid);
}
@@ -1814,6 +1833,7 @@ static void wt_longstatus_print(struct wt_status *s)
{
const char *branch_color = color(WT_STATUS_ONBRANCH, s);
const char *branch_status_color = color(WT_STATUS_HEADER, s);
+ enum fsmonitor_mode fsm_mode = fsm_settings__get_mode(s->repo);
if (s->branch) {
const char *on_what = _("On branch ");
@@ -1870,13 +1890,21 @@ static void wt_longstatus_print(struct wt_status *s)
wt_longstatus_print_other(s, &s->untracked, _("Untracked files"), "add");
if (s->show_ignored_mode)
wt_longstatus_print_other(s, &s->ignored, _("Ignored files"), "add -f");
- if (advice_enabled(ADVICE_STATUS_U_OPTION) && 2000 < s->untracked_in_ms) {
+ if (advice_enabled(ADVICE_STATUS_U_OPTION) && uf_was_slow(s)) {
status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
+ if (fsm_mode > FSMONITOR_MODE_DISABLED) {
+ status_printf_ln(s, GIT_COLOR_NORMAL,
+ _("It took %.2f seconds to enumerate untracked files,\n"
+ "but the results were cached, and subsequent runs may be faster."),
+ s->untracked_in_ms / 1000.0);
+ } else {
+ status_printf_ln(s, GIT_COLOR_NORMAL,
+ _("It took %.2f seconds to enumerate untracked files."),
+ s->untracked_in_ms / 1000.0);
+ }
status_printf_ln(s, GIT_COLOR_NORMAL,
- _("It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
- "may speed it up, but you have to be careful not to forget to add\n"
- "new files yourself (see 'git help status')."),
- s->untracked_in_ms / 1000.0);
+ _("See 'git help status' for information on how to improve this."));
+ status_printf_ln(s, GIT_COLOR_NORMAL, "%s", "");
}
} else if (s->committable)
status_printf_ln(s, GIT_COLOR_NORMAL, _("Untracked files not listed%s"),
diff --git a/xdiff-interface.c b/xdiff-interface.c
index e87950de32..0460e03f5e 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -1,5 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
#include "config.h"
+#include "hex.h"
#include "object-store.h"
#include "xdiff-interface.h"
#include "xdiff/xtypes.h"
@@ -183,7 +184,7 @@ void read_mmblob(mmfile_t *ptr, const struct object_id *oid)
return;
}
- ptr->ptr = read_object_file(oid, &type, &size);
+ ptr->ptr = repo_read_object_file(the_repository, oid, &type, &size);
if (!ptr->ptr || type != OBJ_BLOB)
die("unable to read blob object %s", oid_to_hex(oid));
ptr->size = size;
diff --git a/xdiff-interface.h b/xdiff-interface.h
index 4301a7eef2..733c364d26 100644
--- a/xdiff-interface.h
+++ b/xdiff-interface.h
@@ -1,7 +1,7 @@
#ifndef XDIFF_INTERFACE_H
#define XDIFF_INTERFACE_H
-#include "cache.h"
+#include "hash-ll.h"
#include "xdiff/xdiff.h"
/*
diff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c
index 32652ded2d..344c2dfc3e 100644
--- a/xdiff/xdiffi.c
+++ b/xdiff/xdiffi.c
@@ -973,7 +973,7 @@ void xdl_free_script(xdchange_t *xscr) {
}
}
-static int xdl_call_hunk_func(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
+static int xdl_call_hunk_func(xdfenv_t *xe UNUSED, xdchange_t *xscr, xdemitcb_t *ecb,
xdemitconf_t const *xecfg)
{
xdchange_t *xch, *xche;
diff --git a/xdiff/xemit.c b/xdiff/xemit.c
index c4ccd68d47..75f0fe4986 100644
--- a/xdiff/xemit.c
+++ b/xdiff/xemit.c
@@ -95,7 +95,7 @@ xdchange_t *xdl_get_hunk(xdchange_t **xscr, xdemitconf_t const *xecfg)
}
-static long def_ff(const char *rec, long len, char *buf, long sz, void *priv)
+static long def_ff(const char *rec, long len, char *buf, long sz)
{
if (len > 0 &&
(isalpha((unsigned char)*rec) || /* identifier? */
@@ -117,7 +117,7 @@ static long match_func_rec(xdfile_t *xdf, xdemitconf_t const *xecfg, long ri,
const char *rec;
long len = xdl_get_rec(xdf, ri, &rec);
if (!xecfg->find_func)
- return def_ff(rec, len, buf, sz, xecfg->find_func_priv);
+ return def_ff(rec, len, buf, sz);
return xecfg->find_func(rec, len, buf, sz, xecfg->find_func_priv);
}